forked from mirrors/gecko-dev
Bug 1367780 - Enable eslint on testing/firefox-ui,mozbase,profiles,specialpowers - mechanical updates; r=Standard8
This commit is contained in:
parent
616d5746f2
commit
67daf2d2b0
11 changed files with 111 additions and 121 deletions
|
|
@ -295,13 +295,11 @@ services/sync/modules/constants.js
|
|||
services/sync/services-sync.js
|
||||
|
||||
# testing/ exclusions
|
||||
testing/firefox-ui/**
|
||||
testing/marionette/**
|
||||
testing/mochitest/**
|
||||
testing/modules/**
|
||||
testing/mozbase/**
|
||||
testing/profiles/**
|
||||
testing/specialpowers/**
|
||||
# octothorpe used for pref file comment causes parsing error
|
||||
testing/mozbase/mozprofile/tests/files/prefs_with_comments.js
|
||||
testing/talos/**
|
||||
testing/web-platform/**
|
||||
testing/xpcshell/moz-http2/**
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<script type="text/javascript">
|
||||
function setCookie()
|
||||
{
|
||||
function setCookie() {
|
||||
var date = new Date();
|
||||
date.setDate(new Date().getDate() + 36);
|
||||
document.cookie = "litmus_1=true;expires=" + date.toGMTString();
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@
|
|||
try {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
result.textContent = "FAIL";
|
||||
}
|
||||
catch (ex) {
|
||||
} catch (ex) {
|
||||
result.textContent = "PASS";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,17 +28,17 @@ addEventListener("DOMContentLoaded", function() {
|
|||
|
||||
split_debug_onto_two_rows();
|
||||
|
||||
find_all('.col-links a.screenshot').forEach(function(elem) {
|
||||
find_all(".col-links a.screenshot").forEach(function(elem) {
|
||||
elem.addEventListener("click",
|
||||
function(event) {
|
||||
var node = elem;
|
||||
while (node && !node.classList.contains('results-table-row')) {
|
||||
while (node && !node.classList.contains("results-table-row")) {
|
||||
node = node.parentNode;
|
||||
}
|
||||
if (node != null) {
|
||||
if (node.nextSibling &&
|
||||
node.nextSibling.classList.contains("debug")) {
|
||||
var href = find('.screenshot img', node.nextSibling).src;
|
||||
var href = find(".screenshot img", node.nextSibling).src;
|
||||
window.open(href);
|
||||
}
|
||||
}
|
||||
|
|
@ -46,20 +46,20 @@ addEventListener("DOMContentLoaded", function() {
|
|||
})
|
||||
});
|
||||
|
||||
find_all('.screenshot a').forEach(function(elem) {
|
||||
find_all(".screenshot a").forEach(function(elem) {
|
||||
elem.addEventListener("click",
|
||||
function(event) {
|
||||
window.open(find('img', elem).getAttribute('src'));
|
||||
window.open(find("img", elem).getAttribute("src"));
|
||||
event.preventDefault();
|
||||
})
|
||||
});
|
||||
|
||||
find_all('.sortable').forEach(function(elem) {
|
||||
find_all(".sortable").forEach(function(elem) {
|
||||
elem.addEventListener("click",
|
||||
function(event) {
|
||||
toggle_sort_states(elem);
|
||||
var colIndex = toArray(elem.parentNode.childNodes).indexOf(elem);
|
||||
var key = elem.classList.contains('numeric') ? key_num : key_alpha;
|
||||
var key = elem.classList.contains("numeric") ? key_num : key_alpha;
|
||||
sort_table(elem, key(colIndex));
|
||||
})
|
||||
});
|
||||
|
|
@ -68,12 +68,12 @@ addEventListener("DOMContentLoaded", function() {
|
|||
|
||||
function sort_table(clicked, key_func) {
|
||||
one_row_for_data();
|
||||
var rows = find_all('.results-table-row');
|
||||
var reversed = !clicked.classList.contains('asc');
|
||||
var rows = find_all(".results-table-row");
|
||||
var reversed = !clicked.classList.contains("asc");
|
||||
|
||||
var sorted_rows = sort(rows, key_func, reversed);
|
||||
|
||||
var parent = document.getElementById('results-table-body');
|
||||
var parent = document.getElementById("results-table-body");
|
||||
sorted_rows.forEach(function(elem) {
|
||||
parent.appendChild(elem);
|
||||
});
|
||||
|
|
@ -112,10 +112,10 @@ function key_num(col_index) {
|
|||
}
|
||||
|
||||
function reset_sort_headers() {
|
||||
find_all('.sort-icon').forEach(function(elem) {
|
||||
find_all(".sort-icon").forEach(function(elem) {
|
||||
elem.remove();
|
||||
});
|
||||
find_all('.sortable').forEach(function(elem) {
|
||||
find_all(".sortable").forEach(function(elem) {
|
||||
var icon = document.createElement("div");
|
||||
icon.className = "sort-icon";
|
||||
icon.textContent = "vvv";
|
||||
|
|
@ -126,29 +126,29 @@ function reset_sort_headers() {
|
|||
}
|
||||
|
||||
function toggle_sort_states(elem) {
|
||||
//if active, toggle between asc and desc
|
||||
if (elem.classList.contains('active')) {
|
||||
elem.classList.toggle('asc');
|
||||
elem.classList.toggle('desc');
|
||||
// if active, toggle between asc and desc
|
||||
if (elem.classList.contains("active")) {
|
||||
elem.classList.toggle("asc");
|
||||
elem.classList.toggle("desc");
|
||||
}
|
||||
|
||||
//if inactive, reset all other functions and add ascending active
|
||||
if (elem.classList.contains('inactive')) {
|
||||
// if inactive, reset all other functions and add ascending active
|
||||
if (elem.classList.contains("inactive")) {
|
||||
reset_sort_headers();
|
||||
elem.classList.remove('inactive');
|
||||
elem.classList.add('active');
|
||||
elem.classList.remove("inactive");
|
||||
elem.classList.add("active");
|
||||
}
|
||||
}
|
||||
|
||||
function split_debug_onto_two_rows() {
|
||||
find_all('tr.results-table-row').forEach(function(elem) {
|
||||
find_all("tr.results-table-row").forEach(function(elem) {
|
||||
var new_row = document.createElement("tr")
|
||||
new_row.className = "debug";
|
||||
elem.parentNode.insertBefore(new_row, elem.nextSibling);
|
||||
find_all(".debug", elem).forEach(function (td_elem) {
|
||||
find_all(".debug", elem).forEach(function(td_elem) {
|
||||
if (find(".log", td_elem)) {
|
||||
new_row.appendChild(td_elem);
|
||||
td_elem.colSpan=5;
|
||||
td_elem.colSpan = 5;
|
||||
} else {
|
||||
td_elem.remove();
|
||||
}
|
||||
|
|
@ -157,10 +157,10 @@ function split_debug_onto_two_rows() {
|
|||
}
|
||||
|
||||
function one_row_for_data() {
|
||||
find_all('tr.results-table-row').forEach(function(elem) {
|
||||
if (elem.nextSibling.classList.contains('debug')) {
|
||||
find_all("tr.results-table-row").forEach(function(elem) {
|
||||
if (elem.nextSibling.classList.contains("debug")) {
|
||||
toArray(elem.nextSibling.childNodes).forEach(
|
||||
function (td_elem) {
|
||||
function(td_elem) {
|
||||
elem.appendChild(td_elem);
|
||||
})
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -237,38 +237,38 @@ user_pref("dom.presentation.testing.simulate-receiver", false);
|
|||
|
||||
// Don't connect to Yahoo! for RSS feed tests.
|
||||
// en-US only uses .types.0.uri, but set all of them just to be sure.
|
||||
user_pref('browser.contentHandlers.types.0.uri', 'http://test1.example.org/rss?url=%%s')
|
||||
user_pref('browser.contentHandlers.types.1.uri', 'http://test1.example.org/rss?url=%%s')
|
||||
user_pref('browser.contentHandlers.types.2.uri', 'http://test1.example.org/rss?url=%%s')
|
||||
user_pref('browser.contentHandlers.types.3.uri', 'http://test1.example.org/rss?url=%%s')
|
||||
user_pref('browser.contentHandlers.types.4.uri', 'http://test1.example.org/rss?url=%%s')
|
||||
user_pref('browser.contentHandlers.types.5.uri', 'http://test1.example.org/rss?url=%%s')
|
||||
user_pref("browser.contentHandlers.types.0.uri", "http://test1.example.org/rss?url=%%s")
|
||||
user_pref("browser.contentHandlers.types.1.uri", "http://test1.example.org/rss?url=%%s")
|
||||
user_pref("browser.contentHandlers.types.2.uri", "http://test1.example.org/rss?url=%%s")
|
||||
user_pref("browser.contentHandlers.types.3.uri", "http://test1.example.org/rss?url=%%s")
|
||||
user_pref("browser.contentHandlers.types.4.uri", "http://test1.example.org/rss?url=%%s")
|
||||
user_pref("browser.contentHandlers.types.5.uri", "http://test1.example.org/rss?url=%%s")
|
||||
|
||||
// We want to collect telemetry, but we don't want to send in the results.
|
||||
user_pref('toolkit.telemetry.server', 'https://%(server)s/telemetry-dummy/');
|
||||
user_pref("toolkit.telemetry.server", "https://%(server)s/telemetry-dummy/");
|
||||
// Don't new-profile' ping on new profiles during tests, otherwise the testing framework
|
||||
// might wait on the pingsender to finish and slow down tests.
|
||||
user_pref("toolkit.telemetry.newProfilePing.enabled", false);
|
||||
|
||||
// A couple of preferences with default values to test that telemetry preference
|
||||
// watching is working.
|
||||
user_pref('toolkit.telemetry.test.pref1', true);
|
||||
user_pref('toolkit.telemetry.test.pref2', false);
|
||||
user_pref("toolkit.telemetry.test.pref1", true);
|
||||
user_pref("toolkit.telemetry.test.pref2", false);
|
||||
|
||||
// We don't want to hit the real Firefox Accounts server for tests. We don't
|
||||
// actually need a functioning FxA server, so just set it to something that
|
||||
// resolves and accepts requests, even if they all fail.
|
||||
user_pref('identity.fxaccounts.auth.uri', 'https://%(server)s/fxa-dummy/');
|
||||
user_pref("identity.fxaccounts.auth.uri", "https://%(server)s/fxa-dummy/");
|
||||
|
||||
// Ditto for all the other Firefox accounts URIs used for about:accounts et al.:
|
||||
user_pref("identity.fxaccounts.remote.signup.uri", "https://%(server)s/fxa-signup");
|
||||
user_pref("identity.fxaccounts.remote.force_auth.uri", "https://%(server)s/fxa-force-auth");
|
||||
user_pref("identity.fxaccounts.remote.signin.uri", "https://%(server)s/fxa-signin");
|
||||
user_pref("identity.fxaccounts.settings.uri", "https://%(server)s/fxa-settings");
|
||||
user_pref('identity.fxaccounts.remote.webchannel.uri', 'https://%(server)s/');
|
||||
user_pref("identity.fxaccounts.remote.webchannel.uri", "https://%(server)s/");
|
||||
|
||||
// We don't want browser tests to perform FxA device registration.
|
||||
user_pref('identity.fxaccounts.skipDeviceRegistration', true);
|
||||
user_pref("identity.fxaccounts.skipDeviceRegistration", true);
|
||||
|
||||
// Increase the APZ content response timeout in tests to 1 minute.
|
||||
// This is to accommodate the fact that test environments tends to be slower
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ Cu.forcePermissiveCOWs();
|
|||
var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
var oldClassID = "", oldFactory = null;
|
||||
var newClassID = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator).generateUUID();
|
||||
var newFactory = function (window) {
|
||||
var newFactory = function(window) {
|
||||
return {
|
||||
createInstance: function(aOuter, aIID) {
|
||||
if (aOuter)
|
||||
|
|
@ -43,7 +43,7 @@ this.MockColorPicker = {
|
|||
try {
|
||||
oldClassID = registrar.contractIDToCID(CONTRACT_ID);
|
||||
oldFactory = Cm.getClassObject(Cc[CONTRACT_ID], Ci.nsIFactory);
|
||||
} catch(ex) {
|
||||
} catch (ex) {
|
||||
oldClassID = "";
|
||||
oldFactory = null;
|
||||
dump("TEST-INFO | can't get colorpicker registered component, " +
|
||||
|
|
@ -77,7 +77,7 @@ this.MockColorPicker = {
|
|||
|
||||
function MockColorPickerInstance(window) {
|
||||
this.window = window;
|
||||
};
|
||||
}
|
||||
MockColorPickerInstance.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIColorPicker]),
|
||||
init: function(aParent, aTitle, aInitialColor) {
|
||||
|
|
@ -105,7 +105,7 @@ MockColorPickerInstance.prototype = {
|
|||
} else if (typeof MockColorPicker.returnColor === "string") {
|
||||
result = MockColorPicker.returnColor;
|
||||
}
|
||||
} catch(ex) {
|
||||
} catch (ex) {
|
||||
dump("TEST-UNEXPECTED-FAIL | Exception in MockColorPicker.jsm open() " +
|
||||
"method: " + ex + "\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ Cu.forcePermissiveCOWs();
|
|||
var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
var oldClassID, oldFactory;
|
||||
var newClassID = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator).generateUUID();
|
||||
var newFactory = function (window) {
|
||||
var newFactory = function(window) {
|
||||
return {
|
||||
createInstance: function(aOuter, aIID) {
|
||||
if (aOuter)
|
||||
|
|
@ -120,7 +120,7 @@ this.MockFilePicker = {
|
|||
|
||||
useBlobFile: function() {
|
||||
var blob = new this.window.Blob([]);
|
||||
var file = new this.window.File([blob], 'helloworld.txt', { type: 'plain/text' });
|
||||
var file = new this.window.File([blob], "helloworld.txt", { type: "plain/text" });
|
||||
this.returnData = [this.internalFileData({ domFile: file })];
|
||||
this.pendingPromises = [];
|
||||
},
|
||||
|
|
@ -159,7 +159,7 @@ this.MockFilePicker = {
|
|||
|
||||
function MockFilePickerInstance(window) {
|
||||
this.window = window;
|
||||
};
|
||||
}
|
||||
MockFilePickerInstance.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIFilePicker]),
|
||||
init: function(aParent, aTitle, aMode) {
|
||||
|
|
@ -190,7 +190,7 @@ MockFilePickerInstance.prototype = {
|
|||
},
|
||||
|
||||
// We don't support directories here.
|
||||
get domFileOrDirectory() {
|
||||
get domFileOrDirectory() {
|
||||
if (MockFilePicker.returnData.length < 1) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ MockFilePickerInstance.prototype = {
|
|||
}
|
||||
};
|
||||
},
|
||||
get domFileOrDirectoryEnumerator() {
|
||||
get domFileOrDirectoryEnumerator() {
|
||||
let utils = this.parent.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
return {
|
||||
|
|
@ -279,7 +279,7 @@ MockFilePickerInstance.prototype = {
|
|||
if (typeof returnValue != "undefined") {
|
||||
return returnValue;
|
||||
}
|
||||
} catch(ex) {
|
||||
} catch (ex) {
|
||||
return Ci.nsIFilePicker.returnCancel;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,10 +49,10 @@ this.MockPermissionPrompt = {
|
|||
registrar.registerFactory(newClassID, "", CONTRACT_ID, newFactory);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
reset: function() {
|
||||
},
|
||||
|
||||
|
||||
cleanup: function() {
|
||||
this.reset();
|
||||
if (oldFactory) {
|
||||
|
|
@ -62,7 +62,7 @@ this.MockPermissionPrompt = {
|
|||
},
|
||||
};
|
||||
|
||||
function MockPermissionPromptInstance() { };
|
||||
function MockPermissionPromptInstance() { }
|
||||
MockPermissionPromptInstance.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionPrompt]),
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ MockPermissionPrompt.reset();
|
|||
function exposeAll(obj) {
|
||||
var props = {};
|
||||
for (var prop in obj)
|
||||
props[prop] = 'rw';
|
||||
props[prop] = "rw";
|
||||
obj.__exposedProps__ = props;
|
||||
}
|
||||
exposeAll(MockPermissionPrompt);
|
||||
|
|
|
|||
|
|
@ -8,24 +8,24 @@ function MozillaLogger(aPath) {
|
|||
}
|
||||
|
||||
function formatLogMessage(msg) {
|
||||
return msg.info.join(' ') + "\n";
|
||||
return msg.info.join(" ") + "\n";
|
||||
}
|
||||
|
||||
MozillaLogger.prototype = {
|
||||
init : function(path) {},
|
||||
init: function(path) {},
|
||||
|
||||
getLogCallback : function() {
|
||||
return function (msg) {
|
||||
getLogCallback: function() {
|
||||
return function(msg) {
|
||||
var data = formatLogMessage(msg);
|
||||
dump(data);
|
||||
};
|
||||
},
|
||||
|
||||
log : function(msg) {
|
||||
log: function(msg) {
|
||||
dump(msg);
|
||||
},
|
||||
|
||||
close : function() {}
|
||||
close: function() {}
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -41,12 +41,12 @@ function SpecialPowersLogger(aPath) {
|
|||
}
|
||||
|
||||
SpecialPowersLogger.prototype = {
|
||||
init : function (path) {
|
||||
init: function(path) {
|
||||
SpecialPowers.setLogFile(path);
|
||||
},
|
||||
|
||||
getLogCallback : function () {
|
||||
return function (msg) {
|
||||
getLogCallback: function() {
|
||||
return function(msg) {
|
||||
var data = formatLogMessage(msg);
|
||||
SpecialPowers.log(data);
|
||||
|
||||
|
|
@ -56,11 +56,11 @@ SpecialPowersLogger.prototype = {
|
|||
};
|
||||
},
|
||||
|
||||
log : function (msg) {
|
||||
log: function(msg) {
|
||||
SpecialPowers.log(msg);
|
||||
},
|
||||
|
||||
close : function () {
|
||||
close: function() {
|
||||
SpecialPowers.closeLogFile();
|
||||
}
|
||||
};
|
||||
|
|
@ -82,7 +82,7 @@ function MozillaFileLogger(aPath) {
|
|||
|
||||
MozillaFileLogger.prototype = {
|
||||
|
||||
init : function (path) {
|
||||
init: function(path) {
|
||||
var PR_WRITE_ONLY = 0x02; // Open for writing only.
|
||||
var PR_CREATE_FILE = 0x08;
|
||||
var PR_APPEND = 0x10;
|
||||
|
|
@ -99,8 +99,8 @@ MozillaFileLogger.prototype = {
|
|||
this._converter.init(this._foStream, "UTF-8", 0, 0);
|
||||
},
|
||||
|
||||
getLogCallback : function() {
|
||||
return function (msg) {
|
||||
getLogCallback: function() {
|
||||
return function(msg) {
|
||||
var data = formatLogMessage(msg);
|
||||
if (MozillaFileLogger._converter) {
|
||||
this._converter.writeString(data);
|
||||
|
|
@ -112,12 +112,12 @@ MozillaFileLogger.prototype = {
|
|||
};
|
||||
},
|
||||
|
||||
log : function(msg) {
|
||||
log: function(msg) {
|
||||
if (this._converter) {
|
||||
this._converter.writeString(msg);
|
||||
}
|
||||
},
|
||||
close : function() {
|
||||
close: function() {
|
||||
if (this._converter) {
|
||||
this._converter.flush();
|
||||
this._converter.close();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ var EXPORTED_SYMBOLS = ["SpecialPowersObserver", "SpecialPowersObserverFactory"]
|
|||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.importGlobalProperties(['File']);
|
||||
Components.utils.importGlobalProperties(["File"]);
|
||||
|
||||
if (typeof(Cc) == "undefined") {
|
||||
const Cc = Components.classes;
|
||||
|
|
@ -44,8 +44,7 @@ SpecialPowersObserver.prototype.classID = Components.ID("{59a52458-13e0-4d93-9d8
|
|||
SpecialPowersObserver.prototype.contractID = "@mozilla.org/special-powers-observer;1";
|
||||
SpecialPowersObserver.prototype.QueryInterface = XPCOMUtils.generateQI([Components.interfaces.nsIObserver]);
|
||||
|
||||
SpecialPowersObserver.prototype.observe = function(aSubject, aTopic, aData)
|
||||
{
|
||||
SpecialPowersObserver.prototype.observe = function(aSubject, aTopic, aData) {
|
||||
switch (aTopic) {
|
||||
case "chrome-document-global-created":
|
||||
this._loadFrameScript();
|
||||
|
|
@ -64,8 +63,7 @@ SpecialPowersObserver.prototype.observe = function(aSubject, aTopic, aData)
|
|||
}
|
||||
};
|
||||
|
||||
SpecialPowersObserver.prototype._loadFrameScript = function()
|
||||
{
|
||||
SpecialPowersObserver.prototype._loadFrameScript = function() {
|
||||
if (!this._isFrameScriptLoaded) {
|
||||
// Register for any messages our API needs us to handle
|
||||
this._messageManager.addMessageListener("SPPrefService", this);
|
||||
|
|
@ -96,8 +94,7 @@ SpecialPowersObserver.prototype._loadFrameScript = function()
|
|||
}
|
||||
};
|
||||
|
||||
SpecialPowersObserver.prototype._sendAsyncMessage = function(msgname, msg)
|
||||
{
|
||||
SpecialPowersObserver.prototype._sendAsyncMessage = function(msgname, msg) {
|
||||
this._messageManager.broadcastAsyncMessage(msgname, msg);
|
||||
};
|
||||
|
||||
|
|
@ -105,8 +102,7 @@ SpecialPowersObserver.prototype._receiveMessage = function(aMessage) {
|
|||
return this._receiveMessageAPI(aMessage);
|
||||
};
|
||||
|
||||
SpecialPowersObserver.prototype.init = function()
|
||||
{
|
||||
SpecialPowersObserver.prototype.init = function() {
|
||||
var obs = Services.obs;
|
||||
obs.addObserver(this, "chrome-document-global-created");
|
||||
|
||||
|
|
@ -128,8 +124,7 @@ SpecialPowersObserver.prototype.init = function()
|
|||
this._loadFrameScript();
|
||||
};
|
||||
|
||||
SpecialPowersObserver.prototype.uninit = function()
|
||||
{
|
||||
SpecialPowersObserver.prototype.uninit = function() {
|
||||
var obs = Services.obs;
|
||||
obs.removeObserver(this, "chrome-document-global-created");
|
||||
obs.removeObserver(this, "http-on-modify-request");
|
||||
|
|
@ -201,7 +196,7 @@ SpecialPowersObserver.prototype._registerObservers = {
|
|||
Services.obs.addObserver(this, topic);
|
||||
}
|
||||
},
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
var msg = { aData: aData };
|
||||
switch (aTopic) {
|
||||
case "perm-changed":
|
||||
|
|
@ -229,7 +224,7 @@ SpecialPowersObserver.prototype._registerObservers = {
|
|||
* This will get requests from our API in the window and process them in chrome for it
|
||||
**/
|
||||
SpecialPowersObserver.prototype.receiveMessage = function(aMessage) {
|
||||
switch(aMessage.name) {
|
||||
switch (aMessage.name) {
|
||||
case "SPPingService":
|
||||
if (aMessage.json.op == "ping") {
|
||||
aMessage.target
|
||||
|
|
@ -299,7 +294,7 @@ SpecialPowersObserver.prototype.receiveMessage = function(aMessage) {
|
|||
break;
|
||||
case "SpecialPowers.RemoveFiles":
|
||||
if (this._createdFiles) {
|
||||
this._createdFiles.forEach(function (testFile) {
|
||||
this._createdFiles.forEach(function(testFile) {
|
||||
try {
|
||||
testFile.remove(false);
|
||||
} catch (e) {}
|
||||
|
|
@ -315,9 +310,9 @@ SpecialPowersObserver.prototype.receiveMessage = function(aMessage) {
|
|||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SpecialPowersObserver]);
|
||||
this.SpecialPowersObserverFactory = Object.freeze({
|
||||
createInstance: function(outer, id) {
|
||||
if (outer) { throw Components.results.NS_ERROR_NO_AGGREGATION };
|
||||
if (outer) { throw Components.results.NS_ERROR_NO_AGGREGATION }
|
||||
return new SpecialPowersObserver();
|
||||
},
|
||||
loadFactory: function(lock){},
|
||||
loadFactory: function(lock) {},
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory])
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
if (typeof(Ci) == 'undefined') {
|
||||
if (typeof(Ci) == "undefined") {
|
||||
var Ci = Components.interfaces;
|
||||
}
|
||||
|
||||
if (typeof(Cc) == 'undefined') {
|
||||
if (typeof(Cc) == "undefined") {
|
||||
var Cc = Components.classes;
|
||||
}
|
||||
|
||||
|
|
@ -35,14 +35,14 @@ this.SpecialPowersObserverAPI = function SpecialPowersObserverAPI() {
|
|||
}
|
||||
|
||||
function parseKeyValuePairs(text) {
|
||||
var lines = text.split('\n');
|
||||
var lines = text.split("\n");
|
||||
var data = {};
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
if (lines[i] == '')
|
||||
if (lines[i] == "")
|
||||
continue;
|
||||
|
||||
// can't just .split() because the value might contain = characters
|
||||
let eq = lines[i].indexOf('=');
|
||||
let eq = lines[i].indexOf("=");
|
||||
if (eq != -1) {
|
||||
let [key, value] = [lines[i].substring(0, eq),
|
||||
lines[i].substring(eq + 1)];
|
||||
|
|
@ -61,7 +61,7 @@ function parseKeyValuePairsFromFile(file) {
|
|||
createInstance(Ci.nsIConverterInputStream);
|
||||
is.init(fstream, "UTF-8", 1024, Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);
|
||||
var str = {};
|
||||
var contents = '';
|
||||
var contents = "";
|
||||
while (is.readString(4096, str) != 0) {
|
||||
contents += str.value;
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ SpecialPowersObserverAPI.prototype = {
|
|||
function addDumpIDToMessage(propertyName) {
|
||||
try {
|
||||
var id = aSubject.getPropertyAsAString(propertyName);
|
||||
} catch(ex) {
|
||||
} catch (ex) {
|
||||
var id = null;
|
||||
}
|
||||
if (id) {
|
||||
|
|
@ -99,7 +99,7 @@ SpecialPowersObserverAPI.prototype = {
|
|||
}
|
||||
}
|
||||
|
||||
switch(aTopic) {
|
||||
switch (aTopic) {
|
||||
case "plugin-crashed":
|
||||
case "ipc:content-shutdown":
|
||||
var message = { type: "crash-observed", dumpIDs: [] };
|
||||
|
|
@ -111,7 +111,7 @@ SpecialPowersObserverAPI.prototype = {
|
|||
let pluginID = aSubject.getPropertyAsAString("pluginDumpID");
|
||||
let extra = this._getExtraData(pluginID);
|
||||
if (extra && ("additional_minidumps" in extra)) {
|
||||
let dumpNames = extra.additional_minidumps.split(',');
|
||||
let dumpNames = extra.additional_minidumps.split(",");
|
||||
for (let name of dumpNames) {
|
||||
message.dumpIDs.push({id: pluginID + "-" + name, extension: "dmp"});
|
||||
}
|
||||
|
|
@ -203,7 +203,7 @@ SpecialPowersObserverAPI.prototype = {
|
|||
return removed;
|
||||
},
|
||||
|
||||
_getURI: function (url) {
|
||||
_getURI: function(url) {
|
||||
return Services.io.newURI(url);
|
||||
},
|
||||
|
||||
|
|
@ -274,8 +274,7 @@ SpecialPowersObserverAPI.prototype = {
|
|||
if (contractID.substring(0, serviceMarker.length) == serviceMarker) {
|
||||
contractID = contractID.substring(serviceMarker.length);
|
||||
factoryFunction = "getService";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
factoryFunction = "createInstance";
|
||||
}
|
||||
|
||||
|
|
@ -285,7 +284,7 @@ SpecialPowersObserverAPI.prototype = {
|
|||
let observer = handler.QueryInterface(Ci.nsIObserver);
|
||||
observers.push(observer);
|
||||
}
|
||||
} catch(e) { }
|
||||
} catch (e) { }
|
||||
}
|
||||
|
||||
// Next enumerate the registered observers.
|
||||
|
|
@ -299,10 +298,10 @@ SpecialPowersObserverAPI.prototype = {
|
|||
} catch (e) { }
|
||||
}
|
||||
|
||||
observers.forEach(function (observer) {
|
||||
observers.forEach(function(observer) {
|
||||
try {
|
||||
observer.observe(subject, topic, data);
|
||||
} catch(e) { }
|
||||
} catch (e) { }
|
||||
});
|
||||
},
|
||||
|
||||
|
|
@ -314,7 +313,7 @@ SpecialPowersObserverAPI.prototype = {
|
|||
// We explicitly return values in the below code so that this function
|
||||
// doesn't trigger a flurry of warnings about "does not always return
|
||||
// a value".
|
||||
switch(aMessage.name) {
|
||||
switch (aMessage.name) {
|
||||
case "SPPrefService": {
|
||||
let prefs = Services.prefs;
|
||||
let prefType = aMessage.json.prefType.toUpperCase();
|
||||
|
|
@ -329,7 +328,7 @@ SpecialPowersObserverAPI.prototype = {
|
|||
if (prefs.getPrefType(prefName) == prefs.PREF_INVALID)
|
||||
return null;
|
||||
} else if (aMessage.json.op == "set") {
|
||||
if (!prefName || !prefType || prefValue === null)
|
||||
if (!prefName || !prefType || prefValue === null)
|
||||
throw new SpecialPowersError("Invalid parameters for set in SPPrefService");
|
||||
} else if (aMessage.json.op == "clear") {
|
||||
if (!prefName)
|
||||
|
|
@ -339,27 +338,27 @@ SpecialPowersObserverAPI.prototype = {
|
|||
}
|
||||
|
||||
// Now we make the call
|
||||
switch(prefType) {
|
||||
switch (prefType) {
|
||||
case "BOOL":
|
||||
if (aMessage.json.op == "get")
|
||||
return(prefs.getBoolPref(prefName));
|
||||
return (prefs.getBoolPref(prefName));
|
||||
else
|
||||
return(prefs.setBoolPref(prefName, prefValue));
|
||||
return (prefs.setBoolPref(prefName, prefValue));
|
||||
case "INT":
|
||||
if (aMessage.json.op == "get")
|
||||
return(prefs.getIntPref(prefName));
|
||||
return (prefs.getIntPref(prefName));
|
||||
else
|
||||
return(prefs.setIntPref(prefName, prefValue));
|
||||
return (prefs.setIntPref(prefName, prefValue));
|
||||
case "CHAR":
|
||||
if (aMessage.json.op == "get")
|
||||
return(prefs.getCharPref(prefName));
|
||||
return (prefs.getCharPref(prefName));
|
||||
else
|
||||
return(prefs.setCharPref(prefName, prefValue));
|
||||
return (prefs.setCharPref(prefName, prefValue));
|
||||
case "COMPLEX":
|
||||
if (aMessage.json.op == "get")
|
||||
return(prefs.getComplexValue(prefName, prefValue[0]));
|
||||
return (prefs.getComplexValue(prefName, prefValue[0]));
|
||||
else
|
||||
return(prefs.setComplexValue(prefName, prefValue[0], prefValue[1]));
|
||||
return (prefs.setComplexValue(prefName, prefValue[0], prefValue[1]));
|
||||
case "":
|
||||
if (aMessage.json.op == "clear") {
|
||||
prefs.clearUserPref(prefName);
|
||||
|
|
@ -475,14 +474,14 @@ SpecialPowersObserverAPI.prototype = {
|
|||
sb.browserElement = aMessage.target;
|
||||
|
||||
// Also expose assertion functions
|
||||
let reporter = function (err, message, stack) {
|
||||
let reporter = function(err, message, stack) {
|
||||
// Pipe assertions back to parent process
|
||||
mm.sendAsyncMessage("SPChromeScriptAssert",
|
||||
{ id, name: scriptName, err, message,
|
||||
stack });
|
||||
};
|
||||
Object.defineProperty(sb, "assert", {
|
||||
get: function () {
|
||||
get: function() {
|
||||
let scope = Components.utils.createObjectIn(sb);
|
||||
Services.scriptloader.loadSubScript("chrome://specialpowers/content/Assert.jsm",
|
||||
scope);
|
||||
|
|
@ -497,7 +496,7 @@ SpecialPowersObserverAPI.prototype = {
|
|||
// Evaluate the chrome script
|
||||
try {
|
||||
Components.utils.evalInSandbox(jsScript, sb, "1.8", scriptName, 1);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
throw new SpecialPowersError(
|
||||
"Error while executing chrome script '" + scriptName + "':\n" +
|
||||
e + "\n" +
|
||||
|
|
|
|||
Loading…
Reference in a new issue