forked from mirrors/gecko-dev
Bug 1554142 - Enable most ESLint rules for image/. r=aosmond
Depends on D32450 Differential Revision: https://phabricator.services.mozilla.com/D32493 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
6971980f49
commit
99101f0542
11 changed files with 52 additions and 23 deletions
|
|
@ -14,7 +14,6 @@ obj*/**
|
|||
# We ignore all these directories by default, until we get them enabled.
|
||||
# If you are enabling a directory, please add directory specific exclusions
|
||||
# below.
|
||||
image/**
|
||||
layout/**
|
||||
netwerk/cookie/test/browser/**
|
||||
netwerk/test/browser/**
|
||||
|
|
|
|||
34
.eslintrc.js
34
.eslintrc.js
|
|
@ -158,8 +158,40 @@ module.exports = {
|
|||
"quotes": "off",
|
||||
"semi": "off",
|
||||
"space-infix-ops": "off",
|
||||
}
|
||||
}, {
|
||||
"files": [
|
||||
"image/**",
|
||||
],
|
||||
"rules": {
|
||||
"mozilla/consistent-if-bracing": "off",
|
||||
"mozilla/use-chromeutils-generateqi": "off",
|
||||
"mozilla/use-services": "off",
|
||||
"no-array-constructor": "off",
|
||||
"no-implied-eval": "off",
|
||||
"no-redeclare": "off",
|
||||
"no-self-assign": "off",
|
||||
"no-throw-literal": "off",
|
||||
"no-undef": "off",
|
||||
"no-unneeded-ternary": "off",
|
||||
"no-unused-vars": "off",
|
||||
|
||||
|
||||
// Not enabling the rules below for now pending prettier roll-out.
|
||||
"brace-style": "off",
|
||||
"comma-dangle": "off",
|
||||
"comma-spacing": "off",
|
||||
"key-spacing": "off",
|
||||
"keyword-spacing": "off",
|
||||
"no-extra-semi": "off",
|
||||
"no-tabs": "off",
|
||||
"no-mixed-spaces-and-tabs": "off",
|
||||
"no-multi-spaces": "off",
|
||||
"no-trailing-spaces": "off",
|
||||
"padded-blocks": "off",
|
||||
"quotes": "off",
|
||||
"semi": "off",
|
||||
"space-before-function-paren": "off",
|
||||
"space-infix-ops": "off",
|
||||
}
|
||||
}]
|
||||
};
|
||||
|
|
|
|||
|
|
@ -229,14 +229,12 @@ AnimationTest.prototype.setupPolledImage = function ()
|
|||
|
||||
this.cleanUpAndFinish();
|
||||
}
|
||||
} else {
|
||||
if (!gIsRefImageLoaded) {
|
||||
} else if (!gIsRefImageLoaded) {
|
||||
this.myImage = new Image();
|
||||
this.myImage.onload = reuseImageCallback;
|
||||
document.getElementById(this.imageElementId).setAttribute('src',
|
||||
this.referenceElementId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AnimationTest.prototype.checkImage = function ()
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ function startTest(i)
|
|||
testData.op + " " + testData.test + " " + testData.reference);
|
||||
RemoveFinishDependency();
|
||||
}
|
||||
var iframe = { element: element, loaded: false };
|
||||
var iframe = { element, loaded: false };
|
||||
|
||||
return iframe;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ RemoteCanvas.prototype.load = function(cb) {
|
|||
// Here is where the magic happens... add a listener to the
|
||||
// frame's onload event - it will call handleEvent
|
||||
iframe.addEventListener("load", this, true);
|
||||
//append to the end of the page
|
||||
// append to the end of the page
|
||||
window.document.body.appendChild(iframe);
|
||||
};
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ RemoteCanvas.prototype.handleEvent = function() {
|
|||
// SpecialPowers.snapshotRect method
|
||||
var remoteWindow = ldrFrame.contentWindow;
|
||||
|
||||
//Draw canvas
|
||||
// Draw canvas
|
||||
canvas.style.width = RemoteCanvas.CANVAS_WIDTH + "px";
|
||||
canvas.style.height = RemoteCanvas.CANVAS_HEIGHT + "px";
|
||||
canvas.width = RemoteCanvas.CANVAS_WIDTH;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ RemoteCanvas.prototype.load = function(cb) {
|
|||
// Here is where the magic happens... add a listener to the
|
||||
// frame's onload event - it will call handleEvent
|
||||
iframe.addEventListener("load", this, true);
|
||||
//append to the end of the page
|
||||
// append to the end of the page
|
||||
window.document.body.appendChild(iframe);
|
||||
};
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ RemoteCanvas.prototype.handleEvent = function() {
|
|||
// SpecialPowers.snapshotRect method
|
||||
var remoteWindow = ldrFrame.contentWindow;
|
||||
|
||||
//Draw canvas
|
||||
// Draw canvas
|
||||
canvas.style.width = RemoteCanvas.CANVAS_WIDTH + "px";
|
||||
canvas.style.height = RemoteCanvas.CANVAS_HEIGHT + "px";
|
||||
canvas.width = RemoteCanvas.CANVAS_WIDTH;
|
||||
|
|
|
|||
|
|
@ -23,14 +23,14 @@ var obs = Cc["@mozilla.org/observer-service;1"].getService();
|
|||
obs = obs.QueryInterface(Ci.nsIObserverService);
|
||||
|
||||
var observer = {
|
||||
QueryInterface: function (aIID) {
|
||||
QueryInterface (aIID) {
|
||||
if (aIID.equals(Ci.nsISupports) ||
|
||||
aIID.equals(Ci.nsIObserver))
|
||||
return this;
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
observe: function(subject, topic, data) {
|
||||
observe(subject, topic, data) {
|
||||
ok(topic == "net:failed-to-process-uri-content", "wrong topic");
|
||||
subject = subject.QueryInterface(Ci.nsIURI);
|
||||
is(subject.asciiSpec, "http://mochi.test:8888/tests/image/test/mochitest/invalid.jpg", "wrong subject");
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ function checkClone(other_listener, aRequest)
|
|||
do_test_pending();
|
||||
|
||||
// For as long as clone notification is synchronous, we can't test the clone state reliably.
|
||||
var listener = new ImageListener(null, function(foo, bar) { do_test_finished(); } /*getCloneStopCallback(other_listener)*/);
|
||||
var listener = new ImageListener(null, function(foo, bar) { do_test_finished(); } /* getCloneStopCallback(other_listener)*/);
|
||||
listener.synchronous = false;
|
||||
var outer = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools)
|
||||
.createScriptedObserver(listener);
|
||||
|
|
@ -123,7 +123,7 @@ function getChannelLoadImageStopCallback(streamlistener, next)
|
|||
function checkSecondChannelLoad()
|
||||
{
|
||||
do_test_pending();
|
||||
var channel = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
|
||||
var channel = NetUtil.newChannel({uri, loadUsingSystemPrincipal: true});
|
||||
var channellistener = new ChannelListener();
|
||||
channel.asyncOpen(channellistener);
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ function run_loadImageWithChannel_tests()
|
|||
gCurrentLoader = Cc["@mozilla.org/image/loader;1"].createInstance(Ci.imgILoader);
|
||||
|
||||
do_test_pending();
|
||||
var channel = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
|
||||
var channel = NetUtil.newChannel({uri, loadUsingSystemPrincipal: true});
|
||||
var channellistener = new ChannelListener();
|
||||
channel.asyncOpen(channellistener);
|
||||
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ function makeDataURLFromAsync(encoder, mimetype, expected) {
|
|||
|
||||
var asyncReader =
|
||||
{
|
||||
onInputStreamReady: function(stream)
|
||||
onInputStreamReady(stream)
|
||||
{
|
||||
binarystream.setInputStream(stream);
|
||||
var available = 0;
|
||||
|
|
|
|||
|
|
@ -646,18 +646,18 @@ var testData =
|
|||
for(var i=0; i<testData.length; ++i) {
|
||||
var dict = testData[i];
|
||||
|
||||
var imgFile = do_get_file(dict["refImage"]);
|
||||
var imgFile = do_get_file(dict.refImage);
|
||||
var istream = getFileInputStream(imgFile);
|
||||
var refBytes = streamToArray(istream);
|
||||
|
||||
imgFile = do_get_file(dict["preImage"]);
|
||||
imgFile = do_get_file(dict.preImage);
|
||||
istream = getFileInputStream(imgFile);
|
||||
|
||||
var buffer = NetUtil.readInputStreamToString(istream, istream.available());
|
||||
var container = imgTools.decodeImageFromBuffer(buffer, buffer.length,
|
||||
dict["preImageMimeType"]);
|
||||
dict.preImageMimeType);
|
||||
|
||||
istream = imgTools.encodeImage(container, dict["refImageMimeType"]);
|
||||
istream = imgTools.encodeImage(container, dict.refImageMimeType);
|
||||
|
||||
var sstream = Cc["@mozilla.org/storagestream;1"].
|
||||
createInstance(Ci.nsIStorageStream);
|
||||
|
|
@ -666,7 +666,7 @@ for(var i=0; i<testData.length; ++i) {
|
|||
var bostream = Cc["@mozilla.org/network/buffered-output-stream;1"].
|
||||
createInstance(Ci.nsIBufferedOutputStream);
|
||||
|
||||
//use a tiny buffer to make sure the image data doesn't fully fit in it
|
||||
// use a tiny buffer to make sure the image data doesn't fully fit in it
|
||||
bostream.init(ostream, 8);
|
||||
|
||||
bostream.writeFrom(istream, istream.available());
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ function setup_chan(path, isPrivate, callback) {
|
|||
var securityFlags = Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL;
|
||||
var principal = Services.scriptSecurityManager
|
||||
.createCodebasePrincipal(uri, {privateBrowsingId: isPrivate ? 1 : 0});
|
||||
var chan = NetUtil.newChannel({uri: uri, loadingPrincipal: principal,
|
||||
securityFlags: securityFlags,
|
||||
var chan = NetUtil.newChannel({uri, loadingPrincipal: principal,
|
||||
securityFlags,
|
||||
contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE});
|
||||
chan.notificationCallbacks = isPrivate ? privateLoadContext
|
||||
: nonPrivateLoadContext;
|
||||
|
|
|
|||
Loading…
Reference in a new issue