MozReview-Commit-ID: FIRww20wbCc
This commit is contained in:
Kartikaya Gupta 2017-01-03 08:43:47 -05:00
Родитель 11a6af96a5 59622380b0
Коммит 76d8274792
1305 изменённых файлов: 28144 добавлений и 26273 удалений

Просмотреть файл

@ -117,20 +117,9 @@ devtools/server/tests/browser/**
devtools/server/tests/mochitest/**
devtools/server/tests/unit/**
devtools/shared/apps/**
devtools/shared/client/**
devtools/shared/discovery/**
devtools/shared/gcli/**
!devtools/shared/gcli/templater.js
devtools/shared/heapsnapshot/**
devtools/shared/layout/**
devtools/shared/performance/**
!devtools/shared/platform/**
devtools/shared/qrcode/**
devtools/shared/security/**
devtools/shared/shims/**
devtools/shared/tests/**
!devtools/shared/tests/unit/test_csslexer.js
devtools/shared/touch/**
devtools/shared/transport/**
!devtools/shared/transport/transport.js
!devtools/shared/transport/websocket-transport.js

Просмотреть файл

@ -374,10 +374,9 @@ bool
TextAttrsMgr::BGColorTextAttr::
GetColor(nsIFrame* aFrame, nscolor* aColor)
{
const nsStyleBackground* styleBackground = aFrame->StyleBackground();
if (NS_GET_A(styleBackground->mBackgroundColor) > 0) {
*aColor = styleBackground->mBackgroundColor;
nscolor backgroundColor = aFrame->StyleBackground()->BackgroundColor(aFrame);
if (NS_GET_A(backgroundColor) > 0) {
*aColor = backgroundColor;
return true;
}

Просмотреть файл

@ -1075,7 +1075,7 @@ HTMLTableAccessible::IsProbablyLayoutTable()
if (child->Role() == roles::ROW) {
prevRowColor = rowColor;
nsIFrame* rowFrame = child->GetFrame();
rowColor = rowFrame->StyleBackground()->mBackgroundColor;
rowColor = rowFrame->StyleBackground()->BackgroundColor(rowFrame);
if (childIdx > 0 && prevRowColor != rowColor)
RETURN_LAYOUT_ANSWER(false, "2 styles of row background color, non-bordered");

Просмотреть файл

@ -117,8 +117,9 @@ ia2AccessibleComponent::get_background(IA2Color* aBackground)
return CO_E_OBJNOTCONNECTED;
nsIFrame* frame = acc->GetFrame();
if (frame)
*aBackground = frame->StyleBackground()->mBackgroundColor;
if (frame) {
*aBackground = frame->StyleBackground()->BackgroundColor(frame);
}
return S_OK;

Просмотреть файл

@ -135,7 +135,7 @@ exports.testEmbeddedWebExtensionContentScript = function* (assert, done) {
browser.runtime.onConnect.addListener(portListener);
});
let url = "data:text/html;charset=utf-8,<h1>Test Page</h1>";
let url = "http://example.org/";
var openedTab;
tabs.once('open', function onOpen(tab) {

Просмотреть файл

@ -27,11 +27,13 @@ const test = function(unit) {
return function*(assert) {
assert.isRendered = (panel, toolbox) => {
const doc = toolbox.doc;
assert.ok(doc.querySelector("[value='" + panel.label + "']"),
"panel.label is found in the developer toolbox DOM");
assert.ok(doc.querySelector("[tooltiptext='" + panel.tooltip + "']"),
"panel.tooltip is found in the developer toolbox DOM");
assert.ok(Array.from(doc.querySelectorAll(".devtools-tab"))
.find(el => el.textContent === panel.label),
"panel.label is found in the developer toolbox DOM " + panel.label);
if (panel.tooltip) {
assert.ok(doc.querySelector("[title='" + panel.tooltip + "']"),
`panel.tooltip is found in the developer toolbox DOM "${panel.tooltip}"`);
}
assert.ok(doc.querySelector("#toolbox-panel-" + panel.id),
"toolbar panel with a matching id is present");
};

Просмотреть файл

@ -1221,7 +1221,8 @@ pref("security.mixed_content.block_active_content", true);
// Show degraded UI for http pages with password fields.
pref("security.insecure_password.ui.enabled", true);
pref("security.insecure_field_warning.contextual.enabled", false);
// Show in-content login form warning UI for insecure login fields
pref("security.insecure_field_warning.contextual.enabled", true);
// 1 = allow MITM for certificate pinning checks.
pref("security.cert_pinning.enforcement_level", 1);

Просмотреть файл

@ -168,7 +168,7 @@ appUpdater.prototype =
* @param aChildID
* The id of the deck's child to select, e.g. "apply".
*/
selectPanel: function(aChildID) {
selectPanel(aChildID) {
let panel = document.getElementById(aChildID);
let button = panel.querySelector("button");
@ -191,7 +191,7 @@ appUpdater.prototype =
/**
* Check for updates
*/
checkForUpdates: function() {
checkForUpdates() {
// Clear prefs that could prevent a user from discovering available updates.
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_CANCELATIONS_OSX)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_CANCELATIONS_OSX);
@ -209,7 +209,7 @@ appUpdater.prototype =
* Handles oncommand for the "Restart to Update" button
* which is presented after the download has been downloaded.
*/
buttonRestartAfterDownload: function() {
buttonRestartAfterDownload() {
if (!this.isPending && !this.isApplied) {
return;
}
@ -249,7 +249,7 @@ appUpdater.prototype =
/**
* See nsIUpdateService.idl
*/
onCheckComplete: function(aRequest, aUpdates, aUpdateCount) {
onCheckComplete(aRequest, aUpdates, aUpdateCount) {
gAppUpdater.isChecking = false;
gAppUpdater.update = gAppUpdater.aus.
selectUpdate(aUpdates, aUpdates.length);
@ -281,7 +281,7 @@ appUpdater.prototype =
/**
* See nsIUpdateService.idl
*/
onError: function(aRequest, aUpdate) {
onError(aRequest, aUpdate) {
// Errors in the update check are treated as no updates found. If the
// update check fails repeatedly without a success the user will be
// notified with the normal app update user interface so this is safe.
@ -292,7 +292,7 @@ appUpdater.prototype =
/**
* See nsISupports.idl
*/
QueryInterface: function(aIID) {
QueryInterface(aIID) {
if (!aIID.equals(Components.interfaces.nsIUpdateCheckListener) &&
!aIID.equals(Components.interfaces.nsISupports))
throw Components.results.NS_ERROR_NO_INTERFACE;
@ -303,7 +303,7 @@ appUpdater.prototype =
/**
* Starts the download of an update mar.
*/
startDownload: function() {
startDownload() {
if (!this.update)
this.update = this.um.activeUpdate;
this.update.QueryInterface(Components.interfaces.nsIWritablePropertyBag);
@ -322,7 +322,7 @@ appUpdater.prototype =
/**
* Switches to the UI responsible for tracking the download.
*/
setupDownloadingUI: function() {
setupDownloadingUI() {
this.downloadStatus = document.getElementById("downloadStatus");
this.downloadStatus.value =
DownloadUtils.getTransferTotal(0, this.update.selectedPatch.size);
@ -330,7 +330,7 @@ appUpdater.prototype =
this.aus.addDownloadListener(this);
},
removeDownloadListener: function() {
removeDownloadListener() {
if (this.aus) {
this.aus.removeDownloadListener(this);
}
@ -339,13 +339,13 @@ appUpdater.prototype =
/**
* See nsIRequestObserver.idl
*/
onStartRequest: function(aRequest, aContext) {
onStartRequest(aRequest, aContext) {
},
/**
* See nsIRequestObserver.idl
*/
onStopRequest: function(aRequest, aContext, aStatusCode) {
onStopRequest(aRequest, aContext, aStatusCode) {
switch (aStatusCode) {
case Components.results.NS_ERROR_UNEXPECTED:
if (this.update.selectedPatch.state == "download-failed" &&
@ -404,13 +404,13 @@ appUpdater.prototype =
/**
* See nsIProgressEventSink.idl
*/
onStatus: function(aRequest, aContext, aStatus, aStatusArg) {
onStatus(aRequest, aContext, aStatus, aStatusArg) {
},
/**
* See nsIProgressEventSink.idl
*/
onProgress: function(aRequest, aContext, aProgress, aProgressMax) {
onProgress(aRequest, aContext, aProgress, aProgressMax) {
this.downloadStatus.value =
DownloadUtils.getTransferTotal(aProgress, aProgressMax);
},
@ -418,7 +418,7 @@ appUpdater.prototype =
/**
* See nsISupports.idl
*/
QueryInterface: function(aIID) {
QueryInterface(aIID) {
if (!aIID.equals(Components.interfaces.nsIProgressEventSink) &&
!aIID.equals(Components.interfaces.nsIRequestObserver) &&
!aIID.equals(Components.interfaces.nsISupports))

Просмотреть файл

@ -101,7 +101,7 @@ function updateDisplayedEmail(user) {
var wrapper = {
iframe: null,
init: function(url, urlParams) {
init(url, urlParams) {
// If a master-password is enabled, we want to encourage the user to
// unlock it. Things still work if not, but the user will probably need
// to re-auth next startup (in which case we will get here again and
@ -130,7 +130,7 @@ var wrapper = {
webNav.loadURI(url, Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY, null, null, null);
},
retry: function() {
retry() {
let webNav = this.iframe.frameLoader.docShell.QueryInterface(Ci.nsIWebNavigation);
webNav.loadURI(this.url, Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY, null, null, null);
},
@ -140,7 +140,7 @@ var wrapper = {
Ci.nsISupportsWeakReference,
Ci.nsISupports]),
onStateChange: function(aWebProgress, aRequest, aState, aStatus) {
onStateChange(aWebProgress, aRequest, aState, aStatus) {
let failure = false;
// Captive portals sometimes redirect users
@ -164,19 +164,19 @@ var wrapper = {
}
},
onLocationChange: function(aWebProgress, aRequest, aLocation, aFlags) {
onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
if (aRequest && aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE) {
aRequest.cancel(Components.results.NS_BINDING_ABORTED);
setErrorPage("networkError");
}
},
onProgressChange: function() {},
onStatusChange: function() {},
onSecurityChange: function() {},
onProgressChange() {},
onStatusChange() {},
onSecurityChange() {},
},
handleEvent: function(evt) {
handleEvent(evt) {
switch (evt.type) {
case "load":
this.iframe.contentWindow.addEventListener("FirefoxAccountsCommand", this);
@ -194,7 +194,7 @@ var wrapper = {
*
* @param accountData the user's account data and credentials
*/
onLogin: function(accountData) {
onLogin(accountData) {
log("Received: 'login'. Data:" + JSON.stringify(accountData));
if (accountData.customizeSync) {
@ -251,16 +251,16 @@ var wrapper = {
);
},
onCanLinkAccount: function(accountData) {
onCanLinkAccount(accountData) {
// We need to confirm a relink - see shouldAllowRelink for more
let ok = shouldAllowRelink(accountData.email);
this.injectData("message", { status: "can_link_account", data: { ok: ok } });
this.injectData("message", { status: "can_link_account", data: { ok } });
},
/**
* onSignOut handler erases the current user's session from the fxaccounts service
*/
onSignOut: function() {
onSignOut() {
log("Received: 'sign_out'.");
fxAccounts.signOut().then(
@ -269,7 +269,7 @@ var wrapper = {
);
},
handleRemoteCommand: function(evt) {
handleRemoteCommand(evt) {
log('command: ' + evt.detail.command);
let data = evt.detail.data;
@ -289,11 +289,11 @@ var wrapper = {
}
},
injectData: function(type, content) {
injectData(type, content) {
return fxAccounts.promiseAccountsSignUpURI().then(authUrl => {
let data = {
type: type,
content: content
type,
content
};
this.iframe.contentWindow.postMessage(data, authUrl);
})

Просмотреть файл

@ -15,28 +15,28 @@ const PREF_UNIFIED = "toolkit.telemetry.unified";
const PREF_REPORTING_URL = "datareporting.healthreport.about.reportUrl";
var healthReportWrapper = {
init: function() {
init() {
let iframe = document.getElementById("remote-report");
iframe.addEventListener("load", healthReportWrapper.initRemotePage, false);
iframe.src = this._getReportURI().spec;
prefs.observe("uploadEnabled", this.updatePrefState, healthReportWrapper);
},
uninit: function() {
uninit() {
prefs.ignore("uploadEnabled", this.updatePrefState, healthReportWrapper);
},
_getReportURI: function() {
_getReportURI() {
let url = Services.urlFormatter.formatURLPref(PREF_REPORTING_URL);
return Services.io.newURI(url, null, null);
},
setDataSubmission: function(enabled) {
setDataSubmission(enabled) {
MozSelfSupport.healthReportDataSubmissionEnabled = enabled;
this.updatePrefState();
},
updatePrefState: function() {
updatePrefState() {
try {
let prefsObj = {
enabled: MozSelfSupport.healthReportDataSubmissionEnabled,
@ -48,7 +48,7 @@ var healthReportWrapper = {
}
},
sendTelemetryPingList: function() {
sendTelemetryPingList() {
console.log("AboutHealthReport: Collecting Telemetry ping list.");
MozSelfSupport.getTelemetryPingList().then((list) => {
console.log("AboutHealthReport: Sending Telemetry ping list.");
@ -58,7 +58,7 @@ var healthReportWrapper = {
});
},
sendTelemetryPingData: function(pingId) {
sendTelemetryPingData(pingId) {
console.log("AboutHealthReport: Collecting Telemetry ping data.");
MozSelfSupport.getTelemetryPing(pingId).then((ping) => {
console.log("AboutHealthReport: Sending Telemetry ping data.");
@ -75,7 +75,7 @@ var healthReportWrapper = {
});
},
sendCurrentEnvironment: function() {
sendCurrentEnvironment() {
console.log("AboutHealthReport: Sending Telemetry environment data.");
MozSelfSupport.getCurrentTelemetryEnvironment().then((environment) => {
this.injectData("telemetry-current-environment-data", environment);
@ -84,7 +84,7 @@ var healthReportWrapper = {
});
},
sendCurrentPingData: function() {
sendCurrentPingData() {
console.log("AboutHealthReport: Sending current Telemetry ping data.");
MozSelfSupport.getCurrentTelemetrySubsessionPing().then((ping) => {
this.injectData("telemetry-current-ping-data", ping);
@ -93,7 +93,7 @@ var healthReportWrapper = {
});
},
injectData: function(type, content) {
injectData(type, content) {
let report = this._getReportURI();
// file URIs can't be used for targetOrigin, so we use "*" for this special case
@ -101,15 +101,15 @@ var healthReportWrapper = {
let reportUrl = report.scheme == "file" ? "*" : report.spec;
let data = {
type: type,
content: content
type,
content
}
let iframe = document.getElementById("remote-report");
iframe.contentWindow.postMessage(data, reportUrl);
},
handleRemoteCommand: function(evt) {
handleRemoteCommand(evt) {
// Do an origin check to harden against the frame content being loaded from unexpected locations.
let allowedPrincipal = Services.scriptSecurityManager.getCodebasePrincipal(this._getReportURI());
let targetPrincipal = evt.target.nodePrincipal;
@ -147,7 +147,7 @@ var healthReportWrapper = {
}
},
initRemotePage: function() {
initRemotePage() {
let iframe = document.getElementById("remote-report").contentDocument;
iframe.addEventListener("RemoteHealthReportCommand",
function onCommand(e) { healthReportWrapper.handleRemoteCommand(e); },
@ -160,18 +160,18 @@ var healthReportWrapper = {
ERROR_PAYLOAD_FAILED: 2,
ERROR_PREFS_FAILED: 3,
reportFailure: function(error) {
reportFailure(error) {
let details = {
errorType: error,
}
healthReportWrapper.injectData("error", details);
},
handleInitFailure: function() {
handleInitFailure() {
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_INIT_FAILED);
},
handlePayloadFailure: function() {
handlePayloadFailure() {
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_PAYLOAD_FAILED);
},
}

Просмотреть файл

@ -186,18 +186,18 @@ function ensureSnippetsMapThen(aCallback)
// The cache has been filled up, create the snippets map.
gSnippetsMap = Object.freeze({
get: (aKey) => cache.get(aKey),
set: function(aKey, aValue) {
set(aKey, aValue) {
db.transaction(SNIPPETS_OBJECTSTORE_NAME, "readwrite")
.objectStore(SNIPPETS_OBJECTSTORE_NAME).put(aValue, aKey);
return cache.set(aKey, aValue);
},
has: (aKey) => cache.has(aKey),
delete: function(aKey) {
delete(aKey) {
db.transaction(SNIPPETS_OBJECTSTORE_NAME, "readwrite")
.objectStore(SNIPPETS_OBJECTSTORE_NAME).delete(aKey);
return cache.delete(aKey);
},
clear: function() {
clear() {
db.transaction(SNIPPETS_OBJECTSTORE_NAME, "readwrite")
.objectStore(SNIPPETS_OBJECTSTORE_NAME).clear();
return cache.clear();

Просмотреть файл

@ -30,7 +30,7 @@ function removeNotificationOnEnd(notification, installs) {
}
const gXPInstallObserver = {
_findChildShell: function(aDocShell, aSoughtShell)
_findChildShell(aDocShell, aSoughtShell)
{
if (aDocShell == aSoughtShell)
return aDocShell;
@ -45,7 +45,7 @@ const gXPInstallObserver = {
return null;
},
_getBrowser: function(aDocShell)
_getBrowser(aDocShell)
{
for (let browser of gBrowser.browsers) {
if (this._findChildShell(browser.docShell, aDocShell))
@ -56,7 +56,7 @@ const gXPInstallObserver = {
pendingInstalls: new WeakMap(),
showInstallConfirmation: function(browser, installInfo, height = undefined) {
showInstallConfirmation(browser, installInfo, height = undefined) {
// If the confirmation notification is already open cache the installInfo
// and the new confirmation will be shown later
if (PopupNotifications.getNotification("addon-install-confirmation", browser)) {
@ -217,7 +217,7 @@ const gXPInstallObserver = {
.add(Ci.nsISecurityUITelemetry.WARNING_CONFIRM_ADDON_INSTALL);
},
observe: function(aSubject, aTopic, aData)
observe(aSubject, aTopic, aData)
{
var brandBundle = document.getElementById("bundle_brand");
var installInfo = aSubject.QueryInterface(Components.interfaces.amIWebInstallInfo);
@ -282,7 +282,7 @@ const gXPInstallObserver = {
action = {
label: gNavigatorBundle.getString("xpinstallPromptAllowButton"),
accessKey: gNavigatorBundle.getString("xpinstallPromptAllowButton.accesskey"),
callback: function() {
callback() {
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_ADDON_ASKING_PREVENTED_CLICK_THROUGH);
installInfo.install();
}
@ -433,7 +433,7 @@ const gXPInstallObserver = {
action = {
label: gNavigatorBundle.getString("addonInstallRestartButton"),
accessKey: gNavigatorBundle.getString("addonInstallRestartButton.accesskey"),
callback: function() {
callback() {
BrowserUtils.restartApplication();
}
};
@ -472,14 +472,14 @@ const gXPInstallObserver = {
};
var LightWeightThemeWebInstaller = {
init: function() {
init() {
let mm = window.messageManager;
mm.addMessageListener("LightWeightThemeWebInstaller:Install", this);
mm.addMessageListener("LightWeightThemeWebInstaller:Preview", this);
mm.addMessageListener("LightWeightThemeWebInstaller:ResetPreview", this);
},
receiveMessage: function(message) {
receiveMessage(message) {
// ignore requests from background tabs
if (message.target != gBrowser.selectedBrowser) {
return;
@ -503,7 +503,7 @@ var LightWeightThemeWebInstaller = {
}
},
handleEvent: function(event) {
handleEvent(event) {
switch (event.type) {
case "TabSelect": {
this._resetPreview();
@ -519,7 +519,7 @@ var LightWeightThemeWebInstaller = {
return this._manager = temp.LightweightThemeManager;
},
_installRequest: function(dataString, baseURI) {
_installRequest(dataString, baseURI) {
let data = this._manager.parseTheme(dataString, baseURI);
if (!data) {
@ -560,7 +560,7 @@ var LightWeightThemeWebInstaller = {
let buttons = [{
label: allowButtonText,
accessKey: allowButtonAccesskey,
callback: function() {
callback() {
LightWeightThemeWebInstaller._install(data, notify);
}
}];
@ -575,11 +575,11 @@ var LightWeightThemeWebInstaller = {
notificationBar.persistence = 1;
},
_install: function(newLWTheme, notify) {
_install(newLWTheme, notify) {
let previousLWTheme = this._manager.currentTheme;
let listener = {
onEnabling: function(aAddon, aRequiresRestart) {
onEnabling(aAddon, aRequiresRestart) {
if (!aRequiresRestart) {
return;
}
@ -590,7 +590,7 @@ var LightWeightThemeWebInstaller = {
let action = {
label: gNavigatorBundle.getString("lwthemeNeedsRestart.button"),
accessKey: gNavigatorBundle.getString("lwthemeNeedsRestart.accesskey"),
callback: function() {
callback() {
BrowserUtils.restartApplication();
}
};
@ -604,7 +604,7 @@ var LightWeightThemeWebInstaller = {
action, null, options);
},
onEnabled: function(aAddon) {
onEnabled(aAddon) {
if (notify) {
LightWeightThemeWebInstaller._postInstallNotification(newLWTheme, previousLWTheme);
}
@ -616,7 +616,7 @@ var LightWeightThemeWebInstaller = {
AddonManager.removeAddonListener(listener);
},
_postInstallNotification: function(newTheme, previousTheme) {
_postInstallNotification(newTheme, previousTheme) {
function text(id) {
return gNavigatorBundle.getString("lwthemePostInstallNotification." + id);
}
@ -624,14 +624,14 @@ var LightWeightThemeWebInstaller = {
let buttons = [{
label: text("undoButton"),
accessKey: text("undoButton.accesskey"),
callback: function() {
callback() {
LightWeightThemeWebInstaller._manager.forgetUsedTheme(newTheme.id);
LightWeightThemeWebInstaller._manager.currentTheme = previousTheme;
}
}, {
label: text("manageButton"),
accessKey: text("manageButton.accesskey"),
callback: function() {
callback() {
BrowserOpenAddonsMgr("addons://list/theme");
}
}];
@ -648,7 +648,7 @@ var LightWeightThemeWebInstaller = {
notificationBar.timeout = Date.now() + 20000; // 20 seconds
},
_removePreviousNotifications: function() {
_removePreviousNotifications() {
let box = gBrowser.getNotificationBox();
["lwtheme-install-request",
@ -659,7 +659,7 @@ var LightWeightThemeWebInstaller = {
});
},
_preview: function(dataString, baseURI) {
_preview(dataString, baseURI) {
if (!this._isAllowed(baseURI))
return;
@ -672,14 +672,14 @@ var LightWeightThemeWebInstaller = {
this._manager.previewTheme(data);
},
_resetPreview: function(baseURI) {
_resetPreview(baseURI) {
if (baseURI && !this._isAllowed(baseURI))
return;
gBrowser.tabContainer.removeEventListener("TabSelect", this, false);
this._manager.resetPreview();
},
_isAllowed: function(srcURIString) {
_isAllowed(srcURIString) {
let uri;
try {
uri = makeURI(srcURIString);
@ -704,7 +704,7 @@ var LightWeightThemeWebInstaller = {
var LightweightThemeListener = {
_modifiedStyles: [],
init: function() {
init() {
XPCOMUtils.defineLazyGetter(this, "styleSheet", function() {
for (let i = document.styleSheets.length - 1; i >= 0; i--) {
let sheet = document.styleSheets[i];
@ -720,7 +720,7 @@ var LightweightThemeListener = {
this.updateStyleSheet(document.documentElement.style.backgroundImage);
},
uninit: function() {
uninit() {
Services.obs.removeObserver(this, "lightweight-theme-styling-update");
Services.obs.removeObserver(this, "lightweight-theme-optimized");
},
@ -731,13 +731,13 @@ var LightweightThemeListener = {
*
* @param headerImage - a string containing a CSS image for the lightweight theme header.
*/
updateStyleSheet: function(headerImage) {
updateStyleSheet(headerImage) {
if (!this.styleSheet)
return;
this.substituteRules(this.styleSheet.cssRules, headerImage);
},
substituteRules: function(ruleList, headerImage, existingStyleRulesModified = 0) {
substituteRules(ruleList, headerImage, existingStyleRulesModified = 0) {
let styleRulesModified = 0;
for (let i = 0; i < ruleList.length; i++) {
let rule = ruleList[i];
@ -761,7 +761,7 @@ var LightweightThemeListener = {
},
// nsIObserver
observe: function(aSubject, aTopic, aData) {
observe(aSubject, aTopic, aData) {
if ((aTopic != "lightweight-theme-styling-update" && aTopic != "lightweight-theme-optimized") ||
!this.styleSheet)
return;

Просмотреть файл

@ -96,7 +96,7 @@ var tabPreviews = {
};
var tabPreviewPanelHelper = {
opening: function(host) {
opening(host) {
host.panel.hidden = false;
var handler = this._generateHandler(host);
@ -105,7 +105,7 @@ var tabPreviewPanelHelper = {
host._prevFocus = document.commandDispatcher.focusedElement;
},
_generateHandler: function(host) {
_generateHandler(host) {
var self = this;
return function(event) {
if (event.target == host.panel) {
@ -114,11 +114,11 @@ var tabPreviewPanelHelper = {
}
};
},
_popupshown: function(host) {
_popupshown(host) {
if ("setupGUI" in host)
host.setupGUI();
},
_popuphiding: function(host) {
_popuphiding(host) {
if ("suspendGUI" in host)
host.suspendGUI();
@ -219,7 +219,7 @@ var ctrlTab = {
else
this.uninit();
},
observe: function(aSubject, aTopic, aPrefName) {
observe(aSubject, aTopic, aPrefName) {
this.readPref();
},
@ -507,7 +507,7 @@ var ctrlTab = {
}
},
filterForThumbnailExpiration: function(aCallback) {
filterForThumbnailExpiration(aCallback) {
// Save a few more thumbnails than we actually display, so that when tabs
// are closed, the previews we add instead still get thumbnails.
const extraThumbnails = 3;
@ -521,7 +521,7 @@ var ctrlTab = {
aCallback(urls);
},
_initRecentlyUsedTabs: function() {
_initRecentlyUsedTabs() {
this._recentlyUsedTabs =
Array.filter(gBrowser.tabs, tab => !tab.closing)
.sort((tab1, tab2) => tab2.lastAccessed - tab1.lastAccessed);

Просмотреть файл

@ -9,7 +9,7 @@
* events.
*/
var CustomizationHandler = {
handleEvent: function(aEvent) {
handleEvent(aEvent) {
switch (aEvent.type) {
case "customizationstarting":
this._customizationStarting();
@ -23,11 +23,11 @@ var CustomizationHandler = {
}
},
isCustomizing: function() {
isCustomizing() {
return document.documentElement.hasAttribute("customizing");
},
_customizationStarting: function() {
_customizationStarting() {
// Disable the toolbar context menu items
let menubar = document.getElementById("main-menubar");
for (let childNode of menubar.childNodes)
@ -51,11 +51,11 @@ var CustomizationHandler = {
}
},
_customizationChange: function() {
_customizationChange() {
PlacesToolbarHelper.customizeChange();
},
_customizationEnding: function(aDetails) {
_customizationEnding(aDetails) {
// Update global UI elements that may have been added or removed
if (aDetails.changed) {
gURLBar = document.getElementById("urlbar");

Просмотреть файл

@ -27,7 +27,7 @@ var gDataNotificationInfoBar = {
return this._log = Log.repository.getLoggerWithMessagePrefix(LOGGER_NAME, LOGGER_PREFIX);
},
init: function() {
init() {
window.addEventListener("unload", () => {
for (let o of this._OBSERVERS) {
Services.obs.removeObserver(this, o);
@ -39,11 +39,11 @@ var gDataNotificationInfoBar = {
}
},
_getDataReportingNotification: function(name = this._DATA_REPORTING_NOTIFICATION) {
_getDataReportingNotification(name = this._DATA_REPORTING_NOTIFICATION) {
return this._notificationBox.getNotificationWithValue(name);
},
_displayDataPolicyInfoBar: function(request) {
_displayDataPolicyInfoBar(request) {
if (this._getDataReportingNotification()) {
return;
}
@ -88,7 +88,7 @@ var gDataNotificationInfoBar = {
request.onUserNotifyComplete();
},
_clearPolicyNotification: function() {
_clearPolicyNotification() {
let notification = this._getDataReportingNotification();
if (notification) {
this._log.debug("Closing notification.");
@ -96,7 +96,7 @@ var gDataNotificationInfoBar = {
}
},
observe: function(subject, topic, data) {
observe(subject, topic, data) {
switch (topic) {
case "datareporting:notify-data-policy:request":
let request = subject.wrappedJSObject.object;

Просмотреть файл

@ -21,7 +21,7 @@ var DevEdition = {
return theme && theme.id == "firefox-devedition@mozilla.org";
},
init: function() {
init() {
this.initialized = true;
Services.prefs.addObserver(this._devtoolsThemePrefName, this, false);
Services.obs.addObserver(this, "lightweight-theme-styling-update", false);
@ -33,7 +33,7 @@ var DevEdition = {
}
},
createStyleSheet: function() {
createStyleSheet() {
let styleSheetAttr = `href="${this.styleSheetLocation}" type="text/css"`;
this.styleSheet = document.createProcessingInstruction(
"xml-stylesheet", styleSheetAttr);
@ -42,7 +42,7 @@ var DevEdition = {
this.styleSheet.sheet.disabled = true;
},
observe: function(subject, topic, data) {
observe(subject, topic, data) {
if (topic == "lightweight-theme-styling-update") {
let newTheme = JSON.parse(data);
if (newTheme && newTheme.id == "firefox-devedition@mozilla.org") {
@ -59,7 +59,7 @@ var DevEdition = {
}
},
_inferBrightness: function() {
_inferBrightness() {
ToolbarIconColor.inferFromText();
// Get an inverted full screen button if the dark theme is applied.
if (this.isStyleSheetEnabled &&
@ -78,7 +78,7 @@ var DevEdition = {
}
},
_updateDevtoolsThemeAttribute: function() {
_updateDevtoolsThemeAttribute() {
// Set an attribute on root element to make it possible
// to change colors based on the selected devtools theme.
let devtoolsTheme = Services.prefs.getCharPref(this._devtoolsThemePrefName);
@ -90,14 +90,14 @@ var DevEdition = {
this._inferBrightness();
},
handleEvent: function(e) {
handleEvent(e) {
if (e.type === "load") {
this.styleSheet.removeEventListener("load", this);
this.refreshBrowserDisplay();
}
},
refreshBrowserDisplay: function() {
refreshBrowserDisplay() {
// Don't touch things on the browser if gBrowserInit.onLoad hasn't
// yet fired.
if (this.initialized) {
@ -106,7 +106,7 @@ var DevEdition = {
}
},
_toggleStyleSheet: function(deveditionThemeEnabled) {
_toggleStyleSheet(deveditionThemeEnabled) {
let wasEnabled = this.isStyleSheetEnabled;
if (deveditionThemeEnabled && !wasEnabled) {
// The stylesheet may not have been created yet if it wasn't
@ -122,7 +122,7 @@ var DevEdition = {
}
},
uninit: function() {
uninit() {
Services.prefs.removeObserver(this._devtoolsThemePrefName, this);
Services.obs.removeObserver(this, "lightweight-theme-styling-update", false);
Services.obs.removeObserver(this, "lightweight-theme-window-updated", false);

Просмотреть файл

@ -8,19 +8,19 @@ var PointerlockFsWarning = {
_element: null,
_origin: null,
init: function() {
init() {
this.Timeout.prototype = {
start: function() {
start() {
this.cancel();
this._id = setTimeout(() => this._handle(), this._delay);
},
cancel: function() {
cancel() {
if (this._id) {
clearTimeout(this._id);
this._id = 0;
}
},
_handle: function() {
_handle() {
this._id = 0;
this._func();
},
@ -30,6 +30,13 @@ var PointerlockFsWarning = {
};
},
/* eslint-disable object-shorthand */
/* The object-shorthand rule must be disabled for this constructor
* because the ES6 method syntax causes "this.Timeout is not a
* constructor" exception. Further, using the {ignoreConstructors: true}
* option causes "TypeError: Cannot read property 'charAt' of undefined"
* in eslint.
*/
/**
* Timeout object for managing timeout request. If it is started when
* the previous call hasn't finished, it would automatically cancelled
@ -40,15 +47,16 @@ var PointerlockFsWarning = {
this._func = func;
this._delay = delay;
},
/* eslint-enable object-shorthand */
showPointerLock: function(aOrigin) {
showPointerLock(aOrigin) {
if (!document.fullscreen) {
let timeout = gPrefService.getIntPref("pointer-lock-api.warning.timeout");
this.show(aOrigin, "pointerlock-warning", timeout, 0);
}
},
showFullScreen: function(aOrigin) {
showFullScreen(aOrigin) {
let timeout = gPrefService.getIntPref("full-screen-api.warning.timeout");
let delay = gPrefService.getIntPref("full-screen-api.warning.delay");
this.show(aOrigin, "fullscreen-warning", timeout, delay);
@ -56,7 +64,7 @@ var PointerlockFsWarning = {
// Shows a warning that the site has entered fullscreen or
// pointer lock for a short duration.
show: function(aOrigin, elementId, timeout, delay) {
show(aOrigin, elementId, timeout, delay) {
if (!this._element) {
this._element = document.getElementById(elementId);
@ -111,7 +119,7 @@ var PointerlockFsWarning = {
this._timeoutHide.start();
},
close: function() {
close() {
if (!this._element) {
return;
}
@ -180,7 +188,7 @@ var PointerlockFsWarning = {
}
},
handleEvent: function(event) {
handleEvent(event) {
switch (event.type) {
case "mousemove": {
let state = this._state;
@ -226,12 +234,12 @@ var PointerlockFsWarning = {
var PointerLock = {
init: function() {
init() {
window.messageManager.addMessageListener("PointerLock:Entered", this);
window.messageManager.addMessageListener("PointerLock:Exited", this);
},
receiveMessage: function(aMessage) {
receiveMessage(aMessage) {
switch (aMessage.name) {
case "PointerLock:Entered": {
PointerlockFsWarning.showPointerLock(aMessage.data.originNoSuffix);
@ -253,7 +261,7 @@ var FullScreen = {
"DOMFullscreen:Painted",
],
init: function() {
init() {
// called when we go into full screen, even if initiated by a web page script
window.addEventListener("fullscreen", this, true);
window.addEventListener("MozDOMFullscreen:Entered", this,
@ -270,14 +278,14 @@ var FullScreen = {
this.toggle();
},
uninit: function() {
uninit() {
for (let type of this._MESSAGES) {
window.messageManager.removeMessageListener(type, this);
}
this.cleanup();
},
toggle: function() {
toggle() {
var enterFS = window.fullScreen;
// Toggle the View:FullScreen command, which controls elements like the
@ -342,11 +350,11 @@ var FullScreen = {
}
},
exitDomFullScreen : function() {
exitDomFullScreen() {
document.exitFullscreen();
},
handleEvent: function(event) {
handleEvent(event) {
switch (event.type) {
case "fullscreen":
this.toggle();
@ -377,7 +385,7 @@ var FullScreen = {
}
},
receiveMessage: function(aMessage) {
receiveMessage(aMessage) {
let browser = aMessage.target;
switch (aMessage.name) {
case "DOMFullscreen:Request": {
@ -403,7 +411,7 @@ var FullScreen = {
}
},
enterDomFullscreen : function(aBrowser) {
enterDomFullscreen(aBrowser) {
if (!document.fullscreenElement) {
return;
@ -456,7 +464,7 @@ var FullScreen = {
window.addEventListener("activate", this);
},
cleanup: function() {
cleanup() {
if (!window.fullScreen) {
MousePosTracker.removeListener(this);
document.removeEventListener("keypress", this._keyToggleCallback, false);
@ -465,7 +473,7 @@ var FullScreen = {
}
},
cleanupDomFullscreen: function() {
cleanupDomFullscreen() {
window.messageManager
.broadcastAsyncMessage("DOMFullscreen:CleanUp");
@ -478,7 +486,7 @@ var FullScreen = {
document.documentElement.removeAttribute("inDOMFullscreen");
},
_isRemoteBrowser: function(aBrowser) {
_isRemoteBrowser(aBrowser) {
return gMultiProcessBrowser && aBrowser.getAttribute("remote") == "true";
},
@ -487,21 +495,21 @@ var FullScreen = {
.getInterface(Ci.nsIDOMWindowUtils);
},
getMouseTargetRect: function()
getMouseTargetRect()
{
return this._mouseTargetRect;
},
// Event callbacks
_expandCallback: function()
_expandCallback()
{
FullScreen.showNavToolbox();
},
onMouseEnter: function()
onMouseEnter()
{
FullScreen.hideNavToolbox();
},
_keyToggleCallback: function(aEvent)
_keyToggleCallback(aEvent)
{
// if we can use the keyboard (eg Ctrl+L or Ctrl+E) to open the toolbars, we
// should provide a way to collapse them too.
@ -516,7 +524,7 @@ var FullScreen = {
// Checks whether we are allowed to collapse the chrome
_isPopupOpen: false,
_isChromeCollapsed: false,
_safeToCollapse: function() {
_safeToCollapse() {
if (!gPrefService.getBoolPref("browser.fullscreen.autohide"))
return false;
@ -538,7 +546,7 @@ var FullScreen = {
return true;
},
_setPopupOpen: function(aEvent)
_setPopupOpen(aEvent)
{
// Popups should only veto chrome collapsing if they were opened when the chrome was not collapsed.
// Otherwise, they would not affect chrome and the user would expect the chrome to go away.
@ -556,18 +564,18 @@ var FullScreen = {
},
// Autohide helpers for the context menu item
getAutohide: function(aItem)
getAutohide(aItem)
{
aItem.setAttribute("checked", gPrefService.getBoolPref("browser.fullscreen.autohide"));
},
setAutohide: function()
setAutohide()
{
gPrefService.setBoolPref("browser.fullscreen.autohide", !gPrefService.getBoolPref("browser.fullscreen.autohide"));
// Try again to hide toolbar when we change the pref.
FullScreen.hideNavToolbox(true);
},
showNavToolbox: function(trackMouse = true) {
showNavToolbox(trackMouse = true) {
this._fullScrToggler.hidden = true;
gNavToolbox.removeAttribute("fullscreenShouldAnimate");
gNavToolbox.style.marginTop = "";
@ -591,7 +599,7 @@ var FullScreen = {
this._isChromeCollapsed = false;
},
hideNavToolbox: function(aAnimate = false) {
hideNavToolbox(aAnimate = false) {
if (this._isChromeCollapsed || !this._safeToCollapse())
return;
@ -615,7 +623,7 @@ var FullScreen = {
MousePosTracker.removeListener(this);
},
_updateToolbars: function(aEnterFS) {
_updateToolbars(aEnterFS) {
for (let el of document.querySelectorAll("toolbar[fullscreentoolbar=true]")) {
if (aEnterFS) {
// Give the main nav bar and the tab bar the fullscreen context menu,

Просмотреть файл

@ -89,7 +89,7 @@ var FullZoom = {
// nsIObserver
observe: function(aSubject, aTopic, aData) {
observe(aSubject, aTopic, aData) {
switch (aTopic) {
case "nsPref:changed":
switch (aData) {
@ -154,7 +154,7 @@ var FullZoom = {
let hasPref = false;
let token = this._getBrowserToken(browser);
this._cps2.getByDomainAndName(browser.currentURI.spec, this.name, ctxt, {
handleResult: function() { hasPref = true; },
handleResult() { hasPref = true; },
handleCompletion: function() {
if (!hasPref && token.isCurrent)
this._applyPrefToZoom(undefined, browser);
@ -223,7 +223,7 @@ var FullZoom = {
let value = undefined;
let token = this._getBrowserToken(browser);
this._cps2.getByDomainAndName(aURI.spec, this.name, ctxt, {
handleResult: function(resultPref) { value = resultPref.value; },
handleResult(resultPref) { value = resultPref.value; },
handleCompletion: function() {
if (!token.isCurrent) {
this._notifyOnLocationChange(browser);
@ -269,7 +269,7 @@ var FullZoom = {
* Sets the zoom level for the given browser to the given floating
* point value, where 1 is the default zoom level.
*/
setZoom: function(value, browser = gBrowser.selectedBrowser) {
setZoom(value, browser = gBrowser.selectedBrowser) {
ZoomManager.setZoomForBrowser(browser, value);
this._ignorePendingZoomAccesses(browser);
this._applyZoomToPref(browser);
@ -487,7 +487,7 @@ var FullZoom = {
}
let value = undefined;
this._cps2.getGlobal(this.name, this._loadContextFromBrowser(browser), {
handleResult: function(pref) { value = pref.value; },
handleResult(pref) { value = pref.value; },
handleCompletion: (reason) => {
this._globalValue = this._ensureValid(value);
resolve(this._globalValue);

Просмотреть файл

@ -88,7 +88,7 @@ var gFxAccounts = {
.sort((a, b) => a.name.localeCompare(b.name));
},
init: function() {
init() {
// Bail out if we're already initialized and for pop-up windows.
if (this._initialized || !window.toolbar.visible) {
return;
@ -107,7 +107,7 @@ var gFxAccounts = {
this.updateUI();
},
uninit: function() {
uninit() {
if (!this._initialized) {
return;
}
@ -119,7 +119,7 @@ var gFxAccounts = {
this._initialized = false;
},
observe: function(subject, topic, data) {
observe(subject, topic, data) {
switch (topic) {
case "fxa-migration:state-changed":
this.onMigrationStateChanged(data, subject);
@ -133,7 +133,7 @@ var gFxAccounts = {
}
},
onMigrationStateChanged: function() {
onMigrationStateChanged() {
// Since we nuked most of the migration code, this notification will fire
// once after legacy Sync has been disconnected (and should never fire
// again)
@ -175,12 +175,12 @@ var gFxAccounts = {
this.updateAppMenuItem();
},
handleEvent: function(event) {
handleEvent(event) {
this._inCustomizationMode = event.type == "customizationstarting";
this.updateAppMenuItem();
},
updateUI: function() {
updateUI() {
// It's possible someone signed in to FxA after seeing our notification
// about "Legacy Sync migration" (which now is actually "Legacy Sync
// auto-disconnect") so kill that notification if it still exists.
@ -194,7 +194,7 @@ var gFxAccounts = {
},
// Note that updateAppMenuItem() returns a Promise that's only used by tests.
updateAppMenuItem: function() {
updateAppMenuItem() {
let profileInfoEnabled = false;
try {
profileInfoEnabled = Services.prefs.getBoolPref("identity.fxaccounts.profile_image.enabled");
@ -320,7 +320,7 @@ var gFxAccounts = {
});
},
onMenuPanelCommand: function() {
onMenuPanelCommand() {
switch (this.panelUIFooter.getAttribute("fxastatus")) {
case "signedin":
@ -341,11 +341,11 @@ var gFxAccounts = {
PanelUI.hide();
},
openPreferences: function() {
openPreferences() {
openPreferences("paneSync", { urlParams: { entrypoint: "menupanel" } });
},
openAccountsPage: function(action, urlParams = {}) {
openAccountsPage(action, urlParams = {}) {
let params = new URLSearchParams();
if (action) {
params.set("action", action);
@ -361,15 +361,15 @@ var gFxAccounts = {
});
},
openSignInAgainPage: function(entryPoint) {
openSignInAgainPage(entryPoint) {
this.openAccountsPage("reauth", { entrypoint: entryPoint });
},
sendTabToDevice: function(url, clientId, title) {
sendTabToDevice(url, clientId, title) {
Weave.Service.clientsEngine.sendURIToClientForDisplay(url, clientId, title);
},
populateSendTabToDevicesMenu: function(devicesPopup, url, title) {
populateSendTabToDevicesMenu(devicesPopup, url, title) {
// remove existing menu items
while (devicesPopup.hasChildNodes()) {
devicesPopup.removeChild(devicesPopup.firstChild);
@ -410,7 +410,7 @@ var gFxAccounts = {
devicesPopup.appendChild(fragment);
},
updateTabContextMenu: function(aPopupMenu) {
updateTabContextMenu(aPopupMenu) {
if (!this.sendTabToDeviceEnabled) {
return;
}
@ -420,7 +420,7 @@ var gFxAccounts = {
.forEach(id => { document.getElementById(id).hidden = !remoteClientPresent });
},
initPageContextMenu: function(contextMenu) {
initPageContextMenu(contextMenu) {
if (!this.sendTabToDeviceEnabled) {
return;
}

Просмотреть файл

@ -351,7 +351,7 @@ var gGestureSupport = {
* @param aEvent
* The continual motion update event to handle
*/
_doUpdate: function(aEvent) {},
_doUpdate(aEvent) {},
/**
* Handle gesture end events. This function will be set by _setupSwipe.
@ -359,7 +359,7 @@ var gGestureSupport = {
* @param aEvent
* The gesture end event to handle
*/
_doEnd: function(aEvent) {},
_doEnd(aEvent) {},
/**
* Convert the swipe gesture into a browser action based on the direction.
@ -444,7 +444,7 @@ var gGestureSupport = {
* @param aEvent
* The MozRotateGestureUpdate event triggering this call
*/
rotate: function(aEvent) {
rotate(aEvent) {
if (!(content.document instanceof ImageDocument))
return;
@ -463,7 +463,7 @@ var gGestureSupport = {
/**
* Perform a rotation end for ImageDocuments
*/
rotateEnd: function() {
rotateEnd() {
if (!(content.document instanceof ImageDocument))
return;
@ -531,7 +531,7 @@ var gGestureSupport = {
* When the location/tab changes, need to reload the current rotation for the
* image
*/
restoreRotationState: function() {
restoreRotationState() {
// Bug 863514 - Make gesture support work in electrolysis
if (gMultiProcessBrowser)
return;
@ -560,7 +560,7 @@ var gGestureSupport = {
/**
* Removes the transition rule by removing the completeRotation class
*/
_clearCompleteRotation: function() {
_clearCompleteRotation() {
let contentElement = content.document &&
content.document instanceof ImageDocument &&
content.document.body &&
@ -731,7 +731,7 @@ var gHistorySwipeAnimation = {
}
},
_getCurrentHistoryIndex: function() {
_getCurrentHistoryIndex() {
return SessionStore.getSessionHistory(gBrowser.selectedTab).index;
},

Просмотреть файл

@ -12,7 +12,7 @@ var gEMEHandler = {
}
return emeUIEnabled;
},
ensureEMEEnabled: function(browser, keySystem) {
ensureEMEEnabled(browser, keySystem) {
Services.prefs.setBoolPref("media.eme.enabled", true);
if (keySystem) {
if (keySystem.startsWith("com.adobe") &&
@ -27,7 +27,7 @@ var gEMEHandler = {
}
browser.reload();
},
isKeySystemVisible: function(keySystem) {
isKeySystemVisible(keySystem) {
if (!keySystem) {
return false;
}
@ -41,13 +41,13 @@ var gEMEHandler = {
}
return true;
},
getLearnMoreLink: function(msgId) {
getLearnMoreLink(msgId) {
let text = gNavigatorBundle.getString("emeNotifications." + msgId + ".learnMoreLabel");
let baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL");
return "<label class='text-link' href='" + baseURL + "drm-content'>" +
text + "</label>";
},
receiveMessage: function({target: browser, data: data}) {
receiveMessage({target: browser, data: data}) {
let parsedData;
try {
parsedData = JSON.parse(data);
@ -102,7 +102,7 @@ var gEMEHandler = {
this.showNotificationBar(browser, notificationId, keySystem, params, buttonCallback);
},
showNotificationBar: function(browser, notificationId, keySystem, labelParams, callback) {
showNotificationBar(browser, notificationId, keySystem, labelParams, callback) {
let box = gBrowser.getNotificationBox(browser);
if (box.getNotificationWithValue(notificationId)) {
return;
@ -122,7 +122,7 @@ var gEMEHandler = {
buttons.push({
label: gNavigatorBundle.getString(btnLabelId),
accessKey: gNavigatorBundle.getString(btnAccessKeyId),
callback: callback
callback
});
}
@ -139,7 +139,7 @@ var gEMEHandler = {
box.appendNotification(fragment, notificationId, iconURL, box.PRIORITY_WARNING_MEDIUM,
buttons);
},
showPopupNotificationForSuccess: function(browser, keySystem) {
showPopupNotificationForSuccess(browser, keySystem) {
// We're playing EME content! Remove any "we can't play because..." messages.
var box = gBrowser.getNotificationBox(browser);
["drmContentDisabled",
@ -174,7 +174,7 @@ var gEMEHandler = {
let mainAction = {
label: gNavigatorBundle.getString(btnLabelId),
accessKey: gNavigatorBundle.getString(btnAccessKeyId),
callback: function() { openPreferences("paneContent"); },
callback() { openPreferences("paneContent"); },
dismiss: true
};
let options = {

Просмотреть файл

@ -9,7 +9,7 @@ var StarUI = {
_isNewBookmark: false,
_autoCloseTimer: 0,
_element: function(aID) {
_element(aID) {
return document.getElementById(aID);
},
@ -633,10 +633,10 @@ var PlacesCommandHook = {
PlacesUIUtils.showBookmarkDialog({ action: "add"
, type: "livemark"
, feedURI: feedURI
, feedURI
, siteURI: gBrowser.currentURI
, title: title
, description: description
, title
, description
, defaultInsertionPoint: toolbarIP
, hiddenRows: [ "feedLocation"
, "siteLocation"
@ -1143,7 +1143,7 @@ var PlacesToolbarHelper = {
return !area || CustomizableUI.TYPE_MENU_PANEL == areaType;
},
onPlaceholderCommand: function() {
onPlaceholderCommand() {
let widgetGroup = CustomizableUI.getWidget("personal-bookmarks");
let widget = widgetGroup.forWindow(window);
if (widget.overflowed ||
@ -1152,7 +1152,7 @@ var PlacesToolbarHelper = {
}
},
_getParentToolbar: function(element) {
_getParentToolbar(element) {
while (element) {
if (element.localName == "toolbar") {
return element;
@ -1162,7 +1162,7 @@ var PlacesToolbarHelper = {
return null;
},
onWidgetUnderflow: function(aNode, aContainer) {
onWidgetUnderflow(aNode, aContainer) {
// The view gets broken by being removed and reinserted by the overflowable
// toolbar, so we have to force an uninit and reinit.
let win = aNode.ownerGlobal;
@ -1171,7 +1171,7 @@ var PlacesToolbarHelper = {
}
},
onWidgetAdded: function(aWidgetId, aArea, aPosition) {
onWidgetAdded(aWidgetId, aArea, aPosition) {
if (aWidgetId == "personal-bookmarks" && !this._isCustomizing) {
// It's possible (with the "Add to Menu", "Add to Toolbar" context
// options) that the Places Toolbar Items have been moved without
@ -1182,7 +1182,7 @@ var PlacesToolbarHelper = {
}
},
_resetView: function() {
_resetView() {
if (this._viewElt) {
// It's possible that the placesView might not exist, and we need to
// do a full init. This could happen if the Bookmarks Toolbar Items are
@ -1274,7 +1274,7 @@ var BookmarkingUI = {
this._getFormattedTooltip("starButtonOff.tooltip2");
},
_getFormattedTooltip: function(strId) {
_getFormattedTooltip(strId) {
let args = [];
let shortcut = document.getElementById(this.BOOKMARK_BUTTON_SHORTCUT);
if (shortcut)
@ -1287,7 +1287,7 @@ var BookmarkingUI = {
* When in the panel, we don't update the button's icon.
*/
_currentAreaType: null,
_shouldUpdateStarState: function() {
_shouldUpdateStarState() {
return this._currentAreaType == CustomizableUI.TYPE_TOOLBAR;
},
@ -1349,7 +1349,7 @@ var BookmarkingUI = {
}
},
attachPlacesView: function(event, node) {
attachPlacesView(event, node) {
// If the view is already there, bail out early.
if (node.parentNode._placesView)
return;
@ -1577,7 +1577,7 @@ var BookmarkingUI = {
}
},
init: function() {
init() {
CustomizableUI.addListener(this);
this._updateCustomizationState();
},
@ -1757,7 +1757,7 @@ var BookmarkingUI = {
}, 1000);
},
_showSubview: function() {
_showSubview() {
let view = document.getElementById("PanelUI-bookmarks");
view.addEventListener("ViewShowing", this);
view.addEventListener("ViewHiding", this);
@ -1902,11 +1902,11 @@ var BookmarkingUI = {
}
},
onBeginUpdateBatch: function() {},
onEndUpdateBatch: function() {},
onBeforeItemRemoved: function() {},
onItemVisited: function() {},
onItemMoved: function() {},
onBeginUpdateBatch() {},
onEndUpdateBatch() {},
onBeforeItemRemoved() {},
onItemVisited() {},
onItemMoved() {},
// CustomizableUI events:
_starButtonLabel: null,
@ -1920,7 +1920,7 @@ var BookmarkingUI = {
return this._starButtonOverflowedStarredLabel =
gNavigatorBundle.getString("starButtonOverflowedStarred.label");
},
onWidgetOverflow: function(aNode, aContainer) {
onWidgetOverflow(aNode, aContainer) {
let win = aNode.ownerGlobal;
if (aNode.id != this.BOOKMARK_BUTTON_ID || win != window)
return;
@ -1936,7 +1936,7 @@ var BookmarkingUI = {
}
},
onWidgetUnderflow: function(aNode, aContainer) {
onWidgetUnderflow(aNode, aContainer) {
let win = aNode.ownerGlobal;
if (aNode.id != this.BOOKMARK_BUTTON_ID || win != window)
return;

Просмотреть файл

@ -17,7 +17,7 @@ var gPluginHandler = {
"PluginContent:LinkClickCallback",
],
init: function() {
init() {
const mm = window.messageManager;
for (let msg of this.MESSAGES) {
mm.addMessageListener(msg, this);
@ -25,7 +25,7 @@ var gPluginHandler = {
window.addEventListener("unload", this);
},
uninit: function() {
uninit() {
const mm = window.messageManager;
for (let msg of this.MESSAGES) {
mm.removeMessageListener(msg, this);
@ -33,13 +33,13 @@ var gPluginHandler = {
window.removeEventListener("unload", this);
},
handleEvent: function(event) {
handleEvent(event) {
if (event.type == "unload") {
this.uninit();
}
},
receiveMessage: function(msg) {
receiveMessage(msg) {
switch (msg.name) {
case "PluginContent:ShowClickToPlayNotification":
this.showClickToPlayNotification(msg.target, msg.data.plugins, msg.data.showNow,
@ -83,13 +83,13 @@ var gPluginHandler = {
},
// Callback for user clicking on a disabled plugin
managePlugins: function() {
managePlugins() {
BrowserOpenAddonsMgr("addons://list/plugin");
},
// Callback for user clicking on the link in a click-to-play plugin
// (where the plugin has an update)
openPluginUpdatePage: function(pluginTag) {
openPluginUpdatePage(pluginTag) {
let url = Services.blocklist.getPluginInfoURL(pluginTag);
if (!url) {
url = Services.blocklist.getPluginBlocklistURL(pluginTag);
@ -106,12 +106,12 @@ var gPluginHandler = {
},
// Callback for user clicking a "reload page" link
reloadPage: function(browser) {
reloadPage(browser) {
browser.reload();
},
// Callback for user clicking the help icon
openHelpPage: function() {
openHelpPage() {
openHelpLink("plugin-crashed", false);
},
@ -139,7 +139,7 @@ var gPluginHandler = {
* and activate plugins if necessary.
* aNewState should be either "allownow" "allowalways" or "block"
*/
_updatePluginPermission: function(aNotification, aPluginInfo, aNewState) {
_updatePluginPermission(aNotification, aPluginInfo, aNewState) {
let permission;
let expireType;
let expireTime;
@ -208,7 +208,7 @@ var gPluginHandler = {
});
},
showClickToPlayNotification: function(browser, plugins, showNow,
showClickToPlayNotification(browser, plugins, showNow,
principal, location) {
// It is possible that we've received a message from the frame script to show
// a click to play notification for a principal that no longer matches the one
@ -281,8 +281,8 @@ var gPluginHandler = {
persistent: showNow,
eventCallback: this._clickToPlayNotificationEventCallback,
primaryPlugin: primaryPluginPermission,
pluginData: pluginData,
principal: principal,
pluginData,
principal,
};
PopupNotifications.show(browser, "click-to-play-plugins",
"", "plugins-notification-icon",
@ -290,20 +290,20 @@ var gPluginHandler = {
browser.messageManager.sendAsyncMessage("BrowserPlugins:NotificationShown");
},
removeNotification: function(browser, name) {
removeNotification(browser, name) {
let notification = PopupNotifications.getNotification(name, browser);
if (notification)
PopupNotifications.remove(notification);
},
hideNotificationBar: function(browser, name) {
hideNotificationBar(browser, name) {
let notificationBox = gBrowser.getNotificationBox(browser);
let notification = notificationBox.getNotificationWithValue(name);
if (notification)
notificationBox.removeNotification(notification, true);
},
updateHiddenPluginUI: function(browser, haveInsecure, actions,
updateHiddenPluginUI(browser, haveInsecure, actions,
principal, location) {
let origin = principal.originNoSuffix;
@ -391,7 +391,7 @@ var gPluginHandler = {
{
label: gNavigatorBundle.getString("pluginContinueBlocking.label"),
accessKey: gNavigatorBundle.getString("pluginContinueBlocking.accesskey"),
callback: function() {
callback() {
Services.telemetry.getHistogramById("PLUGINS_INFOBAR_BLOCK").
add(true);
@ -403,7 +403,7 @@ var gPluginHandler = {
{
label: gNavigatorBundle.getString("pluginActivateTrigger.label"),
accessKey: gNavigatorBundle.getString("pluginActivateTrigger.accesskey"),
callback: function() {
callback() {
Services.telemetry.getHistogramById("PLUGINS_INFOBAR_ALLOW").
add(true);
@ -437,14 +437,14 @@ var gPluginHandler = {
}
},
contextMenuCommand: function(browser, plugin, command) {
contextMenuCommand(browser, plugin, command) {
browser.messageManager.sendAsyncMessage("BrowserPlugins:ContextMenuCommand",
{ command: command }, { plugin: plugin });
{ command }, { plugin });
},
// Crashed-plugin observer. Notified once per plugin crash, before events
// are dispatched to individual plugin instances.
NPAPIPluginCrashed : function(subject, topic, data) {
NPAPIPluginCrashed(subject, topic, data) {
let propertyBag = subject;
if (!(propertyBag instanceof Ci.nsIPropertyBag2) ||
!(propertyBag instanceof Ci.nsIWritablePropertyBag2) ||
@ -493,7 +493,7 @@ var gPluginHandler = {
* For a GMP, this is the pluginID. For NPAPI plugins (where "pluginID"
* means something different), this is the runID.
*/
showPluginCrashedNotification: function(browser, messageString, pluginID) {
showPluginCrashedNotification(browser, messageString, pluginID) {
// If there's already an existing notification bar, don't do anything.
let notificationBox = gBrowser.getNotificationBox(browser);
let notification = notificationBox.getNotificationWithValue("plugin-crashed");
@ -511,7 +511,7 @@ var gPluginHandler = {
label: reloadLabel,
accessKey: reloadKey,
popup: null,
callback: function() { browser.reload(); },
callback() { browser.reload(); },
}];
if (AppConstants.MOZ_CRASHREPORTER &&

Просмотреть файл

@ -17,7 +17,7 @@ var RefreshBlocker = {
gBrowser.removeEventListener("RefreshBlocked", this);
},
handleEvent: function(event) {
handleEvent(event) {
if (event.type == "RefreshBlocked") {
this.block(event.originalTarget, event.detail);
}
@ -68,7 +68,7 @@ var RefreshBlocker = {
let buttons = [{
label: refreshButtonText,
accessKey: refreshButtonAccesskey,
callback: function() {
callback() {
if (browser.messageManager) {
browser.messageManager.sendAsyncMessage("RefreshBlocker:Refresh", data);
}

Просмотреть файл

@ -4,7 +4,7 @@
var gSafeBrowsing = {
setReportPhishingMenu: function() {
setReportPhishingMenu() {
// In order to detect whether or not we're at the phishing warning
// page, we have to check the documentURI instead of the currentURI.
// This is because when the DocShell loads an error page, the
@ -42,7 +42,7 @@ var gSafeBrowsing = {
* @param name String One of "Phish", "Error", "Malware" or "MalwareError"
* @return String the report phishing URL.
*/
getReportURL: function(name) {
getReportURL(name) {
return SafeBrowsing.getReportURL(name, gBrowser.currentURI);
}
}

Просмотреть файл

@ -258,7 +258,7 @@ var SidebarUI = {
let selBrowser = gBrowser.selectedBrowser;
selBrowser.messageManager.sendAsyncMessage("Sidebar:VisibilityChange",
{commandID: commandID, isOpen: true}
{commandID, isOpen: true}
);
BrowserUITelemetry.countSidebarEvent(commandID, "show");
});
@ -296,7 +296,7 @@ var SidebarUI = {
let selBrowser = gBrowser.selectedBrowser;
selBrowser.focus();
selBrowser.messageManager.sendAsyncMessage("Sidebar:VisibilityChange",
{commandID: commandID, isOpen: false}
{commandID, isOpen: false}
);
BrowserUITelemetry.countSidebarEvent(commandID, "hide");
},

Просмотреть файл

@ -39,7 +39,7 @@ var gSyncUI = {
_syncStartTime: 0,
_syncAnimationTimer: 0,
init: function() {
init() {
Cu.import("resource://services-common/stringbundle.js");
// Proceed to set up the UI if Sync has already started up.
@ -137,7 +137,7 @@ var gSyncUI = {
// Note that we don't show login errors in a notification bar here, but do
// still need to track a login-failed state so the "Tools" menu updates
// with the correct state.
_loginFailed: function() {
_loginFailed() {
// If Sync isn't already ready, we don't want to force it to initialize
// by referencing Weave.Status - and it isn't going to be accurate before
// Sync is ready anyway.
@ -242,7 +242,7 @@ var gSyncUI = {
this.updateUI();
},
_getAppName: function() {
_getAppName() {
let brand = new StringBundle("chrome://branding/locale/brand.properties");
return brand.get("brandShortName");
},
@ -304,7 +304,7 @@ var gSyncUI = {
},
// Open the legacy-sync device pairing UI. Note used for FxA Sync.
openAddDevice: function() {
openAddDevice() {
if (!Weave.Utils.ensureMPUnlocked())
return;
@ -316,11 +316,11 @@ var gSyncUI = {
"syncAddDevice", "centerscreen,chrome,resizable=no");
},
openPrefs: function(entryPoint) {
openPrefs(entryPoint) {
openPreferences("paneSync", { urlParams: { entrypoint: entryPoint } });
},
openSignInAgainPage: function(entryPoint = "syncbutton") {
openSignInAgainPage(entryPoint = "syncbutton") {
gFxAccounts.openSignInAgainPage(entryPoint);
},
@ -423,7 +423,7 @@ var gSyncUI = {
}
}),
formatLastSyncDate: function(date) {
formatLastSyncDate(date) {
let dateFormat;
let sixDaysAgo = (() => {
let tempDate = new Date();
@ -441,7 +441,7 @@ var gSyncUI = {
return this._stringBundle.formatStringFromName("lastSync2.label", [lastSyncDateString], 1);
},
onClientsSynced: function() {
onClientsSynced() {
let broadcaster = document.getElementById("sync-syncnow-state");
if (broadcaster) {
if (Weave.Service.clientsEngine.stats.numClients > 1) {

Просмотреть файл

@ -7,9 +7,9 @@
// don't have CAN_DRAW_IN_TITLEBAR defined.
var TabsInTitlebar = {
init: function() {},
uninit: function() {},
allowedBy: function(condition, allow) {},
init() {},
uninit() {},
allowedBy(condition, allow) {},
updateAppearance: function updateAppearance(aForce) {},
get enabled() {
return document.documentElement.getAttribute("tabsintitlebar") == "true";

Просмотреть файл

@ -7,7 +7,7 @@
// this one on platforms which don't have CAN_DRAW_IN_TITLEBAR defined.
var TabsInTitlebar = {
init: function() {
init() {
if (this._initialized) {
return;
}
@ -49,7 +49,7 @@ var TabsInTitlebar = {
}
},
allowedBy: function(condition, allow) {
allowedBy(condition, allow) {
if (allow) {
if (condition in this._disallowed) {
delete this._disallowed[condition];
@ -69,18 +69,18 @@ var TabsInTitlebar = {
return document.documentElement.getAttribute("tabsintitlebar") == "true";
},
observe: function(subject, topic, data) {
observe(subject, topic, data) {
if (topic == "nsPref:changed")
this._readPref();
},
handleEvent: function(aEvent) {
handleEvent(aEvent) {
if (aEvent.type == "resolutionchange" && aEvent.target == window) {
this._update(true);
}
},
_onMenuMutate: function(aMutations) {
_onMenuMutate(aMutations) {
for (let mutation of aMutations) {
if (mutation.attributeName == "inactive" ||
mutation.attributeName == "autohide") {
@ -96,12 +96,12 @@ var TabsInTitlebar = {
_prefName: "browser.tabs.drawInTitlebar",
_lastSizeMode: null,
_readPref: function() {
_readPref() {
this.allowedBy("pref",
Services.prefs.getBoolPref(this._prefName));
},
_update: function(aForce = false) {
_update(aForce = false) {
let $ = id => document.getElementById(id);
let rect = ele => ele.getBoundingClientRect();
let verticalMargins = cstyle => parseFloat(cstyle.marginBottom) + parseFloat(cstyle.marginTop);
@ -253,12 +253,12 @@ var TabsInTitlebar = {
}
},
_sizePlaceholder: function(type, width) {
_sizePlaceholder(type, width) {
Array.forEach(document.querySelectorAll(".titlebar-placeholder[type='" + type + "']"),
function(node) { node.width = width; });
},
uninit: function() {
uninit() {
this._initialized = false;
removeEventListener("resolutionchange", this);
Services.prefs.removeObserver(this._prefName, this);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -103,8 +103,8 @@ var handleContentContextMenu = function(event) {
let addonInfo = {};
let subject = {
event: event,
addonInfo: addonInfo,
event,
addonInfo,
};
subject.wrappedJSObject = subject;
Services.obs.notifyObservers(subject, "content-contextmenu", null);
@ -197,18 +197,18 @@ var handleContentContextMenu = function(event) {
let mainWin = browser.ownerGlobal;
mainWin.gContextMenuContentData = {
isRemote: false,
event: event,
event,
popupNode: event.target,
browser: browser,
addonInfo: addonInfo,
browser,
addonInfo,
documentURIObject: doc.documentURIObject,
docLocation: docLocation,
charSet: charSet,
referrer: referrer,
referrerPolicy: referrerPolicy,
contentType: contentType,
contentDisposition: contentDisposition,
selectionInfo: selectionInfo,
docLocation,
charSet,
referrer,
referrerPolicy,
contentType,
contentDisposition,
selectionInfo,
disableSetDesktopBackground: disableSetDesktopBg,
loginFillInfo,
parentAllowsMixedContent,
@ -262,7 +262,7 @@ function getSerializedSecurityInfo(docShell) {
}
var AboutNetAndCertErrorListener = {
init: function(chromeGlobal) {
init(chromeGlobal) {
addMessageListener("CertErrorDetails", this);
addMessageListener("Browser:CaptivePortalFreed", this);
chromeGlobal.addEventListener('AboutNetErrorLoad', this, false, true);
@ -280,7 +280,7 @@ var AboutNetAndCertErrorListener = {
return content.document.documentURI.startsWith("about:certerror");
},
receiveMessage: function(msg) {
receiveMessage(msg) {
if (!this.isAboutCertError) {
return;
}
@ -348,7 +348,7 @@ var AboutNetAndCertErrorListener = {
content.dispatchEvent(new content.CustomEvent("AboutNetErrorCaptivePortalFreed"));
},
handleEvent: function(aEvent) {
handleEvent(aEvent) {
if (!this.isAboutNetError && !this.isAboutCertError) {
return;
}
@ -372,7 +372,7 @@ var AboutNetAndCertErrorListener = {
}
},
changedCertPrefs: function() {
changedCertPrefs() {
for (let prefName of PREF_SSL_IMPACT) {
if (Services.prefs.prefHasUserValue(prefName)) {
return true;
@ -382,7 +382,7 @@ var AboutNetAndCertErrorListener = {
return false;
},
onPageLoad: function(evt) {
onPageLoad(evt) {
if (this.isAboutCertError) {
let originalTarget = evt.originalTarget;
let ownerDoc = originalTarget.ownerDocument;
@ -394,7 +394,7 @@ var AboutNetAndCertErrorListener = {
detail: JSON.stringify({
enabled: Services.prefs.getBoolPref("security.ssl.errorReporting.enabled"),
changedCertPrefs: this.changedCertPrefs(),
automatic: automatic
automatic
})
}));
@ -402,16 +402,16 @@ var AboutNetAndCertErrorListener = {
{reportStatus: TLS_ERROR_REPORT_TELEMETRY_UI_SHOWN});
},
openCaptivePortalPage: function(evt) {
openCaptivePortalPage(evt) {
sendAsyncMessage("Browser:OpenCaptivePortalPage");
},
onResetPreferences: function(evt) {
onResetPreferences(evt) {
sendAsyncMessage("Browser:ResetSSLPreferences");
},
onSetAutomatic: function(evt) {
onSetAutomatic(evt) {
sendAsyncMessage("Browser:SetSSLErrorReportAuto", {
automatic: evt.detail
});
@ -427,7 +427,7 @@ var AboutNetAndCertErrorListener = {
}
},
onOverride: function(evt) {
onOverride(evt) {
let {host, port} = content.document.mozDocumentURIIfNotForErrorPages;
sendAsyncMessage("Browser:OverrideWeakCrypto", { uri: {host, port} });
}
@ -443,7 +443,7 @@ var ClickEventHandler = {
.addSystemEventListener(global, "click", this, true);
},
handleEvent: function(event) {
handleEvent(event) {
if (!event.isTrusted || event.defaultPrevented || event.button == 2) {
return;
}
@ -484,7 +484,7 @@ var ClickEventHandler = {
let json = { button: event.button, shiftKey: event.shiftKey,
ctrlKey: event.ctrlKey, metaKey: event.metaKey,
altKey: event.altKey, href: null, title: null,
bookmark: false, referrerPolicy: referrerPolicy,
bookmark: false, referrerPolicy,
originAttributes: principal ? principal.originAttributes : {},
isContentWindowPrivate: PrivateBrowsingUtils.isContentWindowPrivate(ownerDoc.defaultView)};
@ -535,7 +535,7 @@ var ClickEventHandler = {
}
},
onCertError: function(targetElement, ownerDoc) {
onCertError(targetElement, ownerDoc) {
let docShell = ownerDoc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
@ -547,7 +547,7 @@ var ClickEventHandler = {
});
},
onAboutBlocked: function(targetElement, ownerDoc) {
onAboutBlocked(targetElement, ownerDoc) {
var reason = 'phishing';
if (/e=malwareBlocked/.test(ownerDoc.documentURI)) {
reason = 'malware';
@ -556,13 +556,13 @@ var ClickEventHandler = {
}
sendAsyncMessage("Browser:SiteBlockedError", {
location: ownerDoc.location.href,
reason: reason,
reason,
elementId: targetElement.getAttribute("id"),
isTopFrame: (ownerDoc.defaultView.parent === ownerDoc.defaultView)
});
},
onAboutNetError: function(event, documentURI) {
onAboutNetError(event, documentURI) {
let elmId = event.originalTarget.getAttribute("id");
if (elmId == "returnButton") {
sendAsyncMessage("Browser:SSLErrorGoBack", {});
@ -591,7 +591,7 @@ var ClickEventHandler = {
* element. This includes SVG links, because callers expect |node|
* to behave like an <a> element, which SVG links (XLink) don't.
*/
_hrefAndLinkNodeForClickEvent: function(event) {
_hrefAndLinkNodeForClickEvent(event) {
function isHTMLLink(aNode) {
// Be consistent with what nsContextMenu.js does.
return ((aNode instanceof content.HTMLAnchorElement && aNode.href) ||
@ -656,7 +656,7 @@ addMessageListener("webrtc:StartBrowserSharing", () => {
let windowID = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
sendAsyncMessage("webrtc:response:StartBrowserSharing", {
windowID: windowID
windowID
});
});
@ -876,20 +876,20 @@ addMessageListener("Bookmarks:GetPageDetails", (message) => {
let doc = content.document;
let isErrorPage = /^about:(neterror|certerror|blocked)/.test(doc.documentURI);
sendAsyncMessage("Bookmarks:GetPageDetails:Result",
{ isErrorPage: isErrorPage,
{ isErrorPage,
description: PlacesUIUtils.getDescriptionFromDocument(doc) });
});
var LightWeightThemeWebInstallListener = {
_previewWindow: null,
init: function() {
init() {
addEventListener("InstallBrowserTheme", this, false, true);
addEventListener("PreviewBrowserTheme", this, false, true);
addEventListener("ResetBrowserThemePreview", this, false, true);
},
handleEvent: function(event) {
handleEvent(event) {
switch (event.type) {
case "InstallBrowserTheme": {
sendAsyncMessage("LightWeightThemeWebInstaller:Install", {
@ -923,7 +923,7 @@ var LightWeightThemeWebInstallListener = {
}
},
_resetPreviewWindow: function() {
_resetPreviewWindow() {
this._previewWindow.removeEventListener("pagehide", this, true);
this._previewWindow = null;
}
@ -982,11 +982,11 @@ addMessageListener("ContextMenu:SetAsDesktopBackground", (message) => {
var PageInfoListener = {
init: function() {
init() {
addMessageListener("PageInfo:getData", this);
},
receiveMessage: function(message) {
receiveMessage(message) {
let strings = message.data.strings;
let window;
let document;
@ -1017,7 +1017,7 @@ var PageInfoListener = {
this.getMediaInfo(document, window, strings);
},
getImageInfo: function(imageElement) {
getImageInfo(imageElement) {
let imageInfo = null;
if (imageElement) {
imageInfo = {
@ -1030,7 +1030,7 @@ var PageInfoListener = {
return imageInfo;
},
getMetaInfo: function(document) {
getMetaInfo(document) {
let metaViewRows = [];
// Get the meta tags from the page.
@ -1044,7 +1044,7 @@ var PageInfoListener = {
return metaViewRows;
},
getWindowInfo: function(window) {
getWindowInfo(window) {
let windowInfo = {};
windowInfo.isTopWindow = window == window.top;
@ -1058,7 +1058,7 @@ var PageInfoListener = {
return windowInfo;
},
getDocumentInfo: function(document) {
getDocumentInfo(document) {
let docInfo = {};
docInfo.title = document.title;
docInfo.location = document.location.toString();
@ -1079,7 +1079,7 @@ var PageInfoListener = {
return docInfo;
},
getFeedsInfo: function(document, strings) {
getFeedsInfo(document, strings) {
let feeds = [];
// Get the feeds from the page.
let linkNodes = document.getElementsByTagName("link");
@ -1110,13 +1110,13 @@ var PageInfoListener = {
},
// Only called once to get the media tab's media elements from the content page.
getMediaInfo: function(document, window, strings)
getMediaInfo(document, window, strings)
{
let frameList = this.goThroughFrames(document, window);
Task.spawn(() => this.processFrames(document, frameList, strings));
},
goThroughFrames: function(document, window)
goThroughFrames(document, window)
{
let frameList = [document];
if (window && window.frames.length > 0) {
@ -1130,7 +1130,7 @@ var PageInfoListener = {
return frameList;
},
processFrames: function*(document, frameList, strings)
*processFrames(document, frameList, strings)
{
let nodeCount = 0;
for (let doc of frameList) {
@ -1155,7 +1155,7 @@ var PageInfoListener = {
sendAsyncMessage("PageInfo:mediaData", {isComplete: true});
},
getMediaItems: function(document, strings, elem)
getMediaItems(document, strings, elem)
{
// Check for images defined in CSS (e.g. background, borders)
let computedStyle = elem.ownerGlobal.getComputedStyle(elem);
@ -1241,7 +1241,7 @@ var PageInfoListener = {
* makePreview in pageInfo.js uses to figure out how to display the preview.
*/
serializeElementInfo: function(document, url, type, alt, item, isBG)
serializeElementInfo(document, url, type, alt, item, isBG)
{
let result = {};
@ -1322,7 +1322,7 @@ var PageInfoListener = {
// Other Misc Stuff
// Modified from the Links Panel v2.3, http://segment7.net/mozilla/links/links.html
// parse a node to extract the contents of the node
getValueText: function(node)
getValueText(node)
{
let valueText = "";
@ -1362,7 +1362,7 @@ var PageInfoListener = {
// Copied from the Links Panel v2.3, http://segment7.net/mozilla/links/links.html.
// Traverse the tree in search of an img or area element and grab its alt tag.
getAltText: function(node)
getAltText(node)
{
let altText = "";
@ -1380,7 +1380,7 @@ var PageInfoListener = {
// Copied from the Links Panel v2.3, http://segment7.net/mozilla/links/links.html.
// Strip leading and trailing whitespace, and replace multiple consecutive whitespace characters with a single space.
stripWS: function(text)
stripWS(text)
{
let middleRE = /\s+/g;
let endRE = /(^\s+)|(\s+$)/g;

Просмотреть файл

@ -90,7 +90,7 @@ ContentSearchUIController.prototype = {
}
this._defaultEngine = {
name: engine.name,
icon: icon,
icon,
};
this._updateDefaultEngineHeader();
@ -189,7 +189,7 @@ ContentSearchUIController.prototype = {
return this._suggestionsList.children.length;
},
selectAndUpdateInput: function(idx) {
selectAndUpdateInput(idx) {
this.selectedIndex = idx;
let newValue = this.suggestionAtIndex(idx) || this._stickyInputValue;
// Setting the input value when the value has not changed commits the current
@ -200,12 +200,12 @@ ContentSearchUIController.prototype = {
this._updateSearchWithHeader();
},
suggestionAtIndex: function(idx) {
suggestionAtIndex(idx) {
let row = this._suggestionsList.children[idx];
return row ? row.textContent : null;
},
deleteSuggestionAtIndex: function(idx) {
deleteSuggestionAtIndex(idx) {
// Only form history suggestions can be deleted.
if (this.isFormHistorySuggestionAtIndex(idx)) {
let suggestionStr = this.suggestionAtIndex(idx);
@ -215,20 +215,20 @@ ContentSearchUIController.prototype = {
}
},
isFormHistorySuggestionAtIndex: function(idx) {
isFormHistorySuggestionAtIndex(idx) {
let row = this._suggestionsList.children[idx];
return row && row.classList.contains("formHistory");
},
addInputValueToFormHistory: function() {
addInputValueToFormHistory() {
this._sendMsg("AddFormHistoryEntry", this.input.value);
},
handleEvent: function(event) {
handleEvent(event) {
this["_on" + event.type[0].toUpperCase() + event.type.substr(1)](event);
},
_onCommand: function(aEvent) {
_onCommand(aEvent) {
if (this.selectedButtonIndex == this._oneOffButtons.length) {
// Settings button was selected.
this._sendMsg("ManageEngines");
@ -242,7 +242,7 @@ ContentSearchUIController.prototype = {
}
},
search: function(aEvent) {
search(aEvent) {
if (!this.defaultEngine) {
return; // Not initialized yet.
}
@ -291,7 +291,7 @@ ContentSearchUIController.prototype = {
this.addInputValueToFormHistory();
},
_onInput: function() {
_onInput() {
if (!this.input.value) {
this._stickyInputValue = "";
this._hideSuggestions();
@ -304,7 +304,7 @@ ContentSearchUIController.prototype = {
this._updateSearchWithHeader();
},
_onKeypress: function(event) {
_onKeypress(event) {
let selectedIndexDelta = 0;
let selectedSuggestionDelta = 0;
let selectedOneOffDelta = 0;
@ -451,7 +451,7 @@ ContentSearchUIController.prototype = {
},
_currentEngineIndex: -1,
_cycleCurrentEngine: function(aReverse) {
_cycleCurrentEngine(aReverse) {
if ((this._currentEngineIndex == this._engines.length - 1 && !aReverse) ||
(this._currentEngineIndex == 0 && aReverse)) {
return;
@ -461,7 +461,7 @@ ContentSearchUIController.prototype = {
this._sendMsg("SetCurrentEngine", engineName);
},
_onFocus: function() {
_onFocus() {
if (this._mousedown) {
return;
}
@ -474,7 +474,7 @@ ContentSearchUIController.prototype = {
this._speculativeConnect();
},
_onBlur: function() {
_onBlur() {
if (this._mousedown) {
// At this point, this.input has lost focus, but a new element has not yet
// received it. If we re-focus this.input directly, the new element will
@ -486,7 +486,7 @@ ContentSearchUIController.prototype = {
this._hideSuggestions();
},
_onMousemove: function(event) {
_onMousemove(event) {
let idx = this._indexOfTableItem(event.target);
if (idx >= this.numSuggestions) {
this.selectedButtonIndex = idx - this.numSuggestions;
@ -495,14 +495,14 @@ ContentSearchUIController.prototype = {
this.selectedIndex = idx;
},
_onMouseup: function(event) {
_onMouseup(event) {
if (event.button == 2) {
return;
}
this._onCommand(event);
},
_onMouseout: function(event) {
_onMouseout(event) {
// We only deselect one-off buttons and the settings button when they are
// moused out.
let idx = this._indexOfTableItem(event.originalTarget);
@ -511,22 +511,22 @@ ContentSearchUIController.prototype = {
}
},
_onClick: function(event) {
_onClick(event) {
this._onMouseup(event);
},
_onContentSearchService: function(event) {
_onContentSearchService(event) {
let methodName = "_onMsg" + event.detail.type;
if (methodName in this) {
this[methodName](event.detail.data);
}
},
_onMsgFocusInput: function(event) {
_onMsgFocusInput(event) {
this.input.focus();
},
_onMsgSuggestions: function(suggestions) {
_onMsgSuggestions(suggestions) {
// Ignore the suggestions if their search string or engine doesn't match
// ours. Due to the async nature of message passing, this can easily happen
// when the user types quickly.
@ -581,13 +581,13 @@ ContentSearchUIController.prototype = {
}
},
_onMsgSuggestionsCancelled: function() {
_onMsgSuggestionsCancelled() {
if (!this._table.hidden) {
this._hideSuggestions();
}
},
_onMsgState: function(state) {
_onMsgState(state) {
this.engines = state.engines;
// No point updating the default engine (and the header) if there's no change.
if (this.defaultEngine &&
@ -598,16 +598,16 @@ ContentSearchUIController.prototype = {
this.defaultEngine = state.currentEngine;
},
_onMsgCurrentState: function(state) {
_onMsgCurrentState(state) {
this._onMsgState(state);
},
_onMsgCurrentEngine: function(engine) {
_onMsgCurrentEngine(engine) {
this.defaultEngine = engine;
this._pendingOneOffRefresh = true;
},
_onMsgStrings: function(strings) {
_onMsgStrings(strings) {
this._strings = strings;
this._updateDefaultEngineHeader();
this._updateSearchWithHeader();
@ -616,7 +616,7 @@ ContentSearchUIController.prototype = {
this.input.setAttribute("placeholder", this._strings.searchPlaceholder);
},
_updateDefaultEngineHeader: function() {
_updateDefaultEngineHeader() {
let header = document.getElementById("contentSearchDefaultEngineHeader");
header.firstChild.setAttribute("src", this.defaultEngine.icon);
if (!this._strings) {
@ -629,7 +629,7 @@ ContentSearchUIController.prototype = {
this._strings.searchHeader.replace("%S", this.defaultEngine.name)));
},
_updateSearchWithHeader: function() {
_updateSearchWithHeader() {
if (!this._strings) {
return;
}
@ -642,13 +642,13 @@ ContentSearchUIController.prototype = {
}
},
_speculativeConnect: function() {
_speculativeConnect() {
if (this.defaultEngine) {
this._sendMsg("SpeculativeConnect", this.defaultEngine.name);
}
},
_makeTableRow: function(type, suggestionStr, currentRow, searchWords) {
_makeTableRow(type, suggestionStr, currentRow, searchWords) {
let row = document.createElementNS(HTML_NS, "tr");
row.dir = "auto";
row.classList.add("contentSearchSuggestionRow");
@ -685,28 +685,28 @@ ContentSearchUIController.prototype = {
},
// Converts favicon array buffer into a data URI.
_getFaviconURIFromBuffer: function(buffer) {
_getFaviconURIFromBuffer(buffer) {
let blob = new Blob([buffer]);
return URL.createObjectURL(blob);
},
// Adds "@2x" to the name of the given PNG url for "retina" screens.
_getImageURIForCurrentResolution: function(uri) {
_getImageURIForCurrentResolution(uri) {
if (window.devicePixelRatio > 1) {
return uri.replace(/\.png$/, "@2x.png");
}
return uri;
},
_getSearchEngines: function() {
_getSearchEngines() {
this._sendMsg("GetState");
},
_getStrings: function() {
_getStrings() {
this._sendMsg("GetStrings");
},
_getSuggestions: function() {
_getSuggestions() {
this._stickyInputValue = this.input.value;
if (this.defaultEngine) {
this._sendMsg("GetSuggestions", {
@ -716,13 +716,13 @@ ContentSearchUIController.prototype = {
}
},
_clearSuggestionRows: function() {
_clearSuggestionRows() {
while (this._suggestionsList.firstElementChild) {
this._suggestionsList.firstElementChild.remove();
}
},
_hideSuggestions: function() {
_hideSuggestions() {
this.input.setAttribute("aria-expanded", "false");
this.selectedIndex = -1;
this.selectedButtonIndex = -1;
@ -730,7 +730,7 @@ ContentSearchUIController.prototype = {
this._table.hidden = true;
},
_indexOfTableItem: function(elt) {
_indexOfTableItem(elt) {
if (elt.classList.contains("contentSearchOneOffItem")) {
return this.numSuggestions + this._oneOffButtons.indexOf(elt);
}
@ -746,7 +746,7 @@ ContentSearchUIController.prototype = {
return elt.rowIndex;
},
_makeTable: function(id) {
_makeTable(id) {
this._table = document.createElementNS(HTML_NS, "table");
this._table.id = id;
this._table.hidden = true;
@ -815,7 +815,7 @@ ContentSearchUIController.prototype = {
return this._table;
},
_setUpOneOffButtons: function() {
_setUpOneOffButtons() {
// Sometimes we receive a CurrentEngine message from the ContentSearch service
// before we've received a State message - i.e. before we have our engines.
if (!this._engines) {
@ -896,11 +896,11 @@ ContentSearchUIController.prototype = {
this._oneOffsTable.hidden = false;
},
_sendMsg: function(type, data = null) {
_sendMsg(type, data = null) {
dispatchEvent(new CustomEvent("ContentSearchClient", {
detail: {
type: type,
data: data,
type,
data,
},
}));
},

Просмотреть файл

@ -24,12 +24,12 @@ pageInfoTreeView.prototype = {
set rowCount(c) { throw "rowCount is a readonly property"; },
get rowCount() { return this.rows; },
setTree: function(tree)
setTree(tree)
{
this.tree = tree;
},
getCellText: function(row, column)
getCellText(row, column)
{
// row can be null, but js arrays are 0-indexed.
// colidx cannot be null, but can be larger than the number
@ -38,16 +38,16 @@ pageInfoTreeView.prototype = {
return this.data[row][column.index] || "";
},
setCellValue: function(row, column, value)
setCellValue(row, column, value)
{
},
setCellText: function(row, column, value)
setCellText(row, column, value)
{
this.data[row][column.index] = value;
},
addRow: function(row)
addRow(row)
{
this.rows = this.data.push(row);
this.rowCountChanged(this.rows - 1, 1);
@ -56,24 +56,24 @@ pageInfoTreeView.prototype = {
}
},
addRows: function(rows)
addRows(rows)
{
for (let row of rows) {
this.addRow(row);
}
},
rowCountChanged: function(index, count)
rowCountChanged(index, count)
{
this.tree.rowCountChanged(index, count);
},
invalidate: function()
invalidate()
{
this.tree.invalidate();
},
clear: function()
clear()
{
if (this.tree)
this.tree.rowCountChanged(0, -this.rows);
@ -81,12 +81,12 @@ pageInfoTreeView.prototype = {
this.data = [ ];
},
handleCopy: function(row)
handleCopy(row)
{
return (row < 0 || this.copycol < 0) ? "" : (this.data[row][this.copycol] || "");
},
performActionOnRow: function(action, row)
performActionOnRow(action, row)
{
if (action == "copy") {
var data = this.handleCopy(row)
@ -94,7 +94,7 @@ pageInfoTreeView.prototype = {
}
},
onPageMediaSort : function(columnname)
onPageMediaSort(columnname)
{
var tree = document.getElementById(this.treeid);
var treecol = tree.columns.getNamedColumn(columnname);
@ -121,29 +121,29 @@ pageInfoTreeView.prototype = {
this.sortcol = treecol.index;
},
getRowProperties: function(row) { return ""; },
getCellProperties: function(row, column) { return ""; },
getColumnProperties: function(column) { return ""; },
isContainer: function(index) { return false; },
isContainerOpen: function(index) { return false; },
isSeparator: function(index) { return false; },
isSorted: function() { return this.sortcol > -1 },
canDrop: function(index, orientation) { return false; },
drop: function(row, orientation) { return false; },
getParentIndex: function(index) { return 0; },
hasNextSibling: function(index, after) { return false; },
getLevel: function(index) { return 0; },
getImageSrc: function(row, column) { },
getProgressMode: function(row, column) { },
getCellValue: function(row, column) { },
toggleOpenState: function(index) { },
cycleHeader: function(col) { },
selectionChanged: function() { },
cycleCell: function(row, column) { },
isEditable: function(row, column) { return false; },
isSelectable: function(row, column) { return false; },
performAction: function(action) { },
performActionOnCell: function(action, row, column) { }
getRowProperties(row) { return ""; },
getCellProperties(row, column) { return ""; },
getColumnProperties(column) { return ""; },
isContainer(index) { return false; },
isContainerOpen(index) { return false; },
isSeparator(index) { return false; },
isSorted() { return this.sortcol > -1 },
canDrop(index, orientation) { return false; },
drop(row, orientation) { return false; },
getParentIndex(index) { return 0; },
hasNextSibling(index, after) { return false; },
getLevel(index) { return 0; },
getImageSrc(row, column) { },
getProgressMode(row, column) { },
getCellValue(row, column) { },
toggleOpenState(index) { },
cycleHeader(col) { },
selectionChanged() { },
cycleCell(row, column) { },
isEditable(row, column) { return false; },
isSelectable(row, column) { return false; },
performAction(action) { },
performActionOnCell(action, row, column) { }
};
// mmm, yummy. global variables.
@ -359,7 +359,7 @@ function loadPageInfo(frameOuterWindowID, imageElement, browser)
// Look for pageInfoListener in content.js. Sends message to listener with arguments.
mm.sendAsyncMessage("PageInfo:getData", {strings: gStrings,
frameOuterWindowID: frameOuterWindowID},
frameOuterWindowID},
{ imageElement });
let pageInfoData;
@ -517,10 +517,10 @@ function toggleGroupbox(id)
function openCacheEntry(key, cb)
{
var checkCacheListener = {
onCacheEntryCheck: function(entry, appCache) {
onCacheEntryCheck(entry, appCache) {
return Components.interfaces.nsICacheEntryOpenCallback.ENTRY_WANTED;
},
onCacheEntryAvailable: function(entry, isNew, appCache, status) {
onCacheEntryAvailable(entry, isNew, appCache, status) {
cb(entry);
}
};
@ -1004,7 +1004,7 @@ function makeBlockImage(url)
}
var imagePermissionObserver = {
observe: function(aSubject, aTopic, aData)
observe(aSubject, aTopic, aData)
{
if (document.getElementById("mediaPreviewBox").collapsed)
return;

Просмотреть файл

@ -20,7 +20,7 @@ var gPermissions = SitePermissions.listPermissions().sort((a, b) => {
gPermissions.push("plugins");
var permissionObserver = {
observe: function(aSubject, aTopic, aData)
observe(aSubject, aTopic, aData)
{
if (aTopic == "perm-changed") {
var permission = aSubject.QueryInterface(Components.interfaces.nsIPermission);

Просмотреть файл

@ -9,18 +9,18 @@ XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper",
"resource://gre/modules/LoginHelper.jsm");
var security = {
init: function(uri, windowInfo) {
init(uri, windowInfo) {
this.uri = uri;
this.windowInfo = windowInfo;
},
// Display the server certificate (static)
viewCert : function() {
viewCert() {
var cert = security._cert;
viewCertHelper(window, cert);
},
_getSecurityInfo : function() {
_getSecurityInfo() {
const nsISSLStatusProvider = Components.interfaces.nsISSLStatusProvider;
const nsISSLStatus = Components.interfaces.nsISSLStatus;
@ -54,15 +54,15 @@ var security = {
this.mapIssuerOrganization(cert.issuerOrganization) || cert.issuerName;
var retval = {
hostName : hostName,
hostName,
cAName : issuerName,
encryptionAlgorithm : undefined,
encryptionStrength : undefined,
version: undefined,
isBroken : isBroken,
isMixed : isMixed,
isEV : isEV,
cert : cert,
isBroken,
isMixed,
isEV,
cert,
certificateTransparency : undefined
};
@ -117,21 +117,21 @@ var security = {
return retval;
}
return {
hostName : hostName,
hostName,
cAName : "",
encryptionAlgorithm : "",
encryptionStrength : 0,
version: "",
isBroken : isBroken,
isMixed : isMixed,
isEV : isEV,
isBroken,
isMixed,
isEV,
cert : null,
certificateTransparency : null
};
},
// Find the secureBrowserUI object (if present)
_getSecurityUI : function() {
_getSecurityUI() {
if (window.opener.gBrowser)
return window.opener.gBrowser.securityUI;
return null;
@ -140,7 +140,7 @@ var security = {
// Interface for mapping a certificate issuer organization to
// the value to be displayed.
// Bug 82017 - this implementation should be moved to pipnss C++ code
mapIssuerOrganization: function(name) {
mapIssuerOrganization(name) {
if (!name) return null;
if (name == "RSA Data Security, Inc.") return "Verisign, Inc.";
@ -152,7 +152,7 @@ var security = {
/**
* Open the cookie manager window
*/
viewCookies : function()
viewCookies()
{
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
@ -181,7 +181,7 @@ var security = {
/**
* Open the login manager window
*/
viewPasswords : function() {
viewPasswords() {
LoginHelper.openPasswordManager(window, this._getSecurityInfo().hostName);
},

Просмотреть файл

@ -38,14 +38,14 @@ function Sanitizer() {
}
Sanitizer.prototype = {
// warning to the caller: this one may raise an exception (e.g. bug #265028)
clearItem: function(aItemName)
clearItem(aItemName)
{
this.items[aItemName].clear();
},
prefDomain: "",
getNameFromPreference: function(aPreferenceName)
getNameFromPreference(aPreferenceName)
{
return aPreferenceName.substr(this.prefDomain.length);
},
@ -516,7 +516,7 @@ Sanitizer.prototype = {
openWindows: {
privateStateForNewWindow: "non-private",
_canCloseWindow: function(aWindow) {
_canCloseWindow(aWindow) {
if (aWindow.CanCloseWindow()) {
// We already showed PermitUnload for the window, so let's
// make sure we don't do it again when we actually close the
@ -526,7 +526,7 @@ Sanitizer.prototype = {
}
return false;
},
_resetAllWindowClosures: function(aWindowList) {
_resetAllWindowClosures(aWindowList) {
for (let win of aWindowList) {
win.skipNextCanClose = false;
}

Просмотреть файл

@ -114,7 +114,7 @@ const SocialErrorListener = {
webNav.loadURI(url, null, null, null, null);
}
sendAsyncMessage("Social:ErrorPageNotify", {
origin: origin,
origin,
url: src
});
},

Просмотреть файл

@ -23,7 +23,7 @@ if (AppConstants.MOZ_SERVICES_CLOUDSYNC) {
var RemoteTabViewer = {
_tabsList: null,
init: function() {
init() {
Services.obs.addObserver(this, "weave:service:login:finish", false);
Services.obs.addObserver(this, "weave:engine:sync:finish", false);
@ -34,14 +34,14 @@ var RemoteTabViewer = {
this.buildList(true);
},
uninit: function() {
uninit() {
Services.obs.removeObserver(this, "weave:service:login:finish");
Services.obs.removeObserver(this, "weave:engine:sync:finish");
Services.obs.removeObserver(this, "cloudsync:tabs:update");
},
createItem: function(attrs) {
createItem(attrs) {
let item = document.createElement("richlistitem");
// Copy the attributes from the argument into the item.
@ -56,7 +56,7 @@ var RemoteTabViewer = {
return item;
},
filterTabs: function(event) {
filterTabs(event) {
let val = event.target.value.toLowerCase();
let numTabs = this._tabsList.getRowCount();
let clientTabs = 0;
@ -89,7 +89,7 @@ var RemoteTabViewer = {
}
},
openSelected: function() {
openSelected() {
let items = this._tabsList.selectedItems;
let urls = [];
for (let i = 0; i < items.length; i++) {
@ -105,14 +105,14 @@ var RemoteTabViewer = {
}
},
bookmarkSingleTab: function() {
bookmarkSingleTab() {
let item = this._tabsList.selectedItems[0];
let uri = Weave.Utils.makeURI(item.getAttribute("url"));
let title = item.getAttribute("title");
PlacesUIUtils.showBookmarkDialog({ action: "add"
, type: "bookmark"
, uri: uri
, title: title
, uri
, title
, hiddenRows: [ "description"
, "location"
, "loadInSidebar"
@ -120,7 +120,7 @@ var RemoteTabViewer = {
}, window.top);
},
bookmarkSelectedTabs: function() {
bookmarkSelectedTabs() {
let items = this._tabsList.selectedItems;
let URIs = [];
for (let i = 0; i < items.length; i++) {
@ -142,7 +142,7 @@ var RemoteTabViewer = {
}
},
getIcon: function(iconUri, defaultIcon) {
getIcon(iconUri, defaultIcon) {
try {
let iconURI = Weave.Utils.makeURI(iconUri);
return PlacesUtils.favicons.getFaviconLinkForIcon(iconURI).spec;
@ -158,7 +158,7 @@ var RemoteTabViewer = {
_buildListRequested: false,
buildList: function(forceSync) {
buildList(forceSync) {
if (this._waitingForBuildList) {
this._buildListRequested = true;
return;
@ -192,7 +192,7 @@ var RemoteTabViewer = {
}
},
_clearTabList: function() {
_clearTabList() {
let list = this._tabsList;
// Clear out existing richlistitems.
@ -204,7 +204,7 @@ var RemoteTabViewer = {
}
},
_generateWeaveTabList: function() {
_generateWeaveTabList() {
let engine = Weave.Service.engineManager.get("tabs");
let list = this._tabsList;
@ -236,7 +236,7 @@ var RemoteTabViewer = {
let attrs = {
type: "tab",
title: title || url,
url: url,
url,
icon: this.getIcon(icon),
}
let tab = this.createItem(attrs);
@ -245,7 +245,7 @@ var RemoteTabViewer = {
}
},
_generateCloudSyncTabList: function() {
_generateCloudSyncTabList() {
let updateTabList = function(remoteTabs) {
let list = this._tabsList;
@ -275,7 +275,7 @@ var RemoteTabViewer = {
.then(updateTabList, Promise.reject.bind(Promise));
},
adjustContextMenu: function(event) {
adjustContextMenu(event) {
let mode = "all";
switch (this._tabsList.selectedItems.length) {
case 0:
@ -300,7 +300,7 @@ var RemoteTabViewer = {
}
},
_refetchTabs: function(force) {
_refetchTabs(force) {
if (!force) {
// Don't bother refetching tabs if we already did so recently
let lastFetch = 0;
@ -325,7 +325,7 @@ var RemoteTabViewer = {
return true;
},
observe: function(subject, topic, data) {
observe(subject, topic, data) {
switch (topic) {
case "weave:service:login:finish":
// A login has finished, which means that a Sync is about to start and
@ -346,7 +346,7 @@ var RemoteTabViewer = {
}
},
handleClick: function(event) {
handleClick(event) {
if (event.target.getAttribute("type") != "tab") {
return;
}

Просмотреть файл

@ -136,7 +136,7 @@ var Change = {
window.setTimeout(window.close, 1500);
},
onDialogAccept: function() {
onDialogAccept() {
switch (this._dialogType) {
case "UpdatePassphrase":
case "ResetPassphrase":
@ -147,7 +147,7 @@ var Change = {
return undefined;
},
doGeneratePassphrase: function() {
doGeneratePassphrase() {
let passphrase = Weave.Utils.generatePassphrase();
this._passphraseBox.value = Weave.Utils.hyphenatePassphrase(passphrase);
this._dialog.getButton("finish").disabled = false;
@ -201,7 +201,7 @@ var Change = {
return false;
},
validate: function(event) {
validate(event) {
let valid = false;
let errorString = "";

Просмотреть файл

@ -61,7 +61,7 @@ var gSyncSetup = {
return document.getElementById("existingServer").selectedIndex == 0;
},
init: function() {
init() {
let obs = [
["weave:service:change-passphrase", "onResetPassphrase"],
["weave:service:login:start", "onLoginStart"],
@ -121,14 +121,14 @@ var gSyncSetup = {
.getAttribute("accesskey");
},
startNewAccountSetup: function() {
startNewAccountSetup() {
if (!Weave.Utils.ensureMPUnlocked())
return;
this._settingUpNew = true;
this.wizard.pageIndex = NEW_ACCOUNT_START_PAGE;
},
useExistingAccount: function() {
useExistingAccount() {
if (!Weave.Utils.ensureMPUnlocked())
return;
this._settingUpNew = false;
@ -173,22 +173,22 @@ var gSyncSetup = {
gSyncUtils.resetPassphrase(true);
},
onResetPassphrase: function() {
onResetPassphrase() {
document.getElementById("existingPassphrase").value =
Weave.Utils.hyphenatePassphrase(Weave.Service.identity.syncKey);
this.checkFields();
this.wizard.advance();
},
onLoginStart: function() {
onLoginStart() {
this.toggleLoginFeedback(false);
},
onLoginEnd: function() {
onLoginEnd() {
this.toggleLoginFeedback(true);
},
sendCredentialsAfterSync: function() {
sendCredentialsAfterSync() {
let send = function() {
Services.obs.removeObserver("weave:service:sync:finish", send);
Services.obs.removeObserver("weave:service:sync:error", send);
@ -202,7 +202,7 @@ var gSyncSetup = {
Services.obs.addObserver("weave:service:sync:error", send, false);
},
toggleLoginFeedback: function(stop) {
toggleLoginFeedback(stop) {
document.getElementById("login-throbber").hidden = stop;
let password = document.getElementById("existingPasswordFeedbackRow");
let server = document.getElementById("existingServerFeedbackRow");
@ -231,7 +231,7 @@ var gSyncSetup = {
this._setFeedbackMessage(feedback, false, Weave.Status.login);
},
setupInitialSync: function() {
setupInitialSync() {
let action = document.getElementById("mergeChoiceRadio").selectedItem.id;
switch (action) {
case "resetClient":
@ -248,11 +248,11 @@ var gSyncSetup = {
},
// fun with validation!
checkFields: function() {
checkFields() {
this.wizard.canAdvance = this.readyToAdvance();
},
readyToAdvance: function() {
readyToAdvance() {
switch (this.wizard.pageIndex) {
case INTRO_PAGE:
return false;
@ -293,7 +293,7 @@ var gSyncSetup = {
this.pin3.value.length == PIN_PART_LENGTH);
},
onEmailInput: function() {
onEmailInput() {
// Check account validity when the user stops typing for 1 second.
if (this._checkAccountTimer)
window.clearTimeout(this._checkAccountTimer);
@ -302,7 +302,7 @@ var gSyncSetup = {
}, 1000);
},
checkAccount: function() {
checkAccount() {
delete this._checkAccountTimer;
let value = Weave.Utils.normalizeAccount(
document.getElementById("weaveEmail").value);
@ -337,7 +337,7 @@ var gSyncSetup = {
this.checkFields();
},
onPasswordChange: function() {
onPasswordChange() {
let password = document.getElementById("weavePassword");
let pwconfirm = document.getElementById("weavePasswordConfirm");
let [valid, errorString] = gSyncUtils.validatePassword(password, pwconfirm);
@ -349,7 +349,7 @@ var gSyncSetup = {
this.checkFields();
},
onPageShow: function() {
onPageShow() {
switch (this.wizard.pageIndex) {
case PAIR_PAGE:
this.wizard.getButton("back").hidden = true;
@ -420,7 +420,7 @@ var gSyncSetup = {
}
},
onWizardAdvance: function() {
onWizardAdvance() {
// Check pageIndex so we don't prompt before the Sync setup wizard appears.
// This is a fallback in case the Master Password gets locked mid-wizard.
if ((this.wizard.pageIndex >= 0) &&
@ -509,7 +509,7 @@ var gSyncSetup = {
return true;
},
onWizardBack: function() {
onWizardBack() {
switch (this.wizard.pageIndex) {
case NEW_ACCOUNT_START_PAGE:
this.wizard.pageIndex = INTRO_PAGE;
@ -535,7 +535,7 @@ var gSyncSetup = {
return true;
},
wizardFinish: function() {
wizardFinish() {
this.setupInitialSync();
if (this.wizardType == "pair") {
@ -563,7 +563,7 @@ var gSyncSetup = {
window.close();
},
onWizardCancel: function() {
onWizardCancel() {
if (this._resettingSync)
return;
@ -572,12 +572,12 @@ var gSyncSetup = {
Weave.Service.startOver();
},
onSyncOptions: function() {
onSyncOptions() {
this._beforeOptionsPage = this.wizard.pageIndex;
this.wizard.pageIndex = OPTIONS_PAGE;
},
returnFromOptions: function() {
returnFromOptions() {
this.wizard.getButton("next").label = this._nextButtonLabel;
this.wizard.getButton("next").setAttribute("accesskey",
this._nextButtonAccesskey);
@ -644,7 +644,7 @@ var gSyncSetup = {
this._jpakeclient.controller = controller;
},
startEasySetup: function() {
startEasySetup() {
// Don't do anything if we have a client already (e.g. we went to
// Sync Options and just came back).
if (this._jpakeclient)
@ -691,7 +691,7 @@ var gSyncSetup = {
this._jpakeclient.receiveNoPIN();
},
abortEasySetup: function() {
abortEasySetup() {
document.getElementById("easySetupPIN1").value = "";
document.getElementById("easySetupPIN2").value = "";
document.getElementById("easySetupPIN3").value = "";
@ -702,7 +702,7 @@ var gSyncSetup = {
delete this._jpakeclient;
},
manualSetup: function() {
manualSetup() {
this.abortEasySetup();
this.wizard.pageIndex = EXISTING_ACCOUNT_LOGIN_PAGE;
},
@ -710,7 +710,7 @@ var gSyncSetup = {
// _handleNoScript is needed because it blocks the captcha. So we temporarily
// allow the necessary sites so that we can verify the user is in fact a human.
// This was done with the help of Giorgio (NoScript author). See bug 508112.
_handleNoScript: function(addExceptions) {
_handleNoScript(addExceptions) {
// if NoScript isn't installed, or is disabled, bail out.
let ns = Cc["@maone.net/noscript-service;1"];
if (ns == null)
@ -734,7 +734,7 @@ var gSyncSetup = {
}
},
onExistingServerCommand: function() {
onExistingServerCommand() {
let control = document.getElementById("existingServer");
if (control.selectedIndex == 0) {
control.removeAttribute("editable");
@ -750,7 +750,7 @@ var gSyncSetup = {
this.checkFields();
},
onExistingServerInput: function() {
onExistingServerInput() {
// Check custom server validity when the user stops typing for 1 second.
if (this._existingServerTimer)
window.clearTimeout(this._existingServerTimer);
@ -759,7 +759,7 @@ var gSyncSetup = {
}, 1000);
},
onServerCommand: function() {
onServerCommand() {
setVisibility(document.getElementById("TOSRow"), this._usingMainServers);
let control = document.getElementById("server");
if (!this._usingMainServers) {
@ -783,7 +783,7 @@ var gSyncSetup = {
this.checkFields();
},
onServerInput: function() {
onServerInput() {
// Check custom server validity when the user stops typing for 1 second.
if (this._checkServerTimer)
window.clearTimeout(this._checkServerTimer);
@ -792,7 +792,7 @@ var gSyncSetup = {
}, 1000);
},
checkServer: function() {
checkServer() {
delete this._checkServerTimer;
let el = document.getElementById("server");
let valid = false;
@ -813,7 +813,7 @@ var gSyncSetup = {
this.checkFields();
},
_validateServer: function(element) {
_validateServer(element) {
let valid = false;
let val = element.value;
if (!val)
@ -859,7 +859,7 @@ var gSyncSetup = {
return valid;
},
_handleChoice: function() {
_handleChoice() {
let desc = document.getElementById("mergeChoiceRadio").selectedIndex;
document.getElementById("chosenActionDeck").selectedIndex = desc;
switch (desc) {
@ -983,7 +983,7 @@ var gSyncSetup = {
// sets class and string on a feedback element
// if no property string is passed in, we clear label/style
_setFeedback: function(element, success, string) {
_setFeedback(element, success, string) {
element.hidden = success || !string;
let classname = success ? "success" : "error";
let image = element.getElementsByAttribute("class", "statusIcon")[0];
@ -993,7 +993,7 @@ var gSyncSetup = {
},
// shim
_setFeedbackMessage: function(element, success, string) {
_setFeedbackMessage(element, success, string) {
let str = "";
if (string) {
try {
@ -1015,7 +1015,7 @@ var gSyncSetup = {
}
},
onStateChange: function(webProgress, request, stateFlags, status) {
onStateChange(webProgress, request, stateFlags, status) {
// We're only looking for the end of the frame load
if ((stateFlags & Ci.nsIWebProgressListener.STATE_STOP) == 0)
return;
@ -1029,10 +1029,10 @@ var gSyncSetup = {
setVisibility(this.captchaBrowser, responseStatus != 404);
// XXX TODO we should really log any responseStatus other than 200
},
onProgressChange: function() {},
onStatusChange: function() {},
onSecurityChange: function() {},
onLocationChange: function() {}
onProgressChange() {},
onStatusChange() {},
onSecurityChange() {},
onLocationChange() {}
};
// Define lazy getters for various XUL elements.

Просмотреть файл

@ -22,7 +22,7 @@ var gSyncUtils = {
},
// opens in a new window if we're in a modal prefwindow world, in a new tab otherwise
_openLink: function(url) {
_openLink(url) {
let thisDocEl = document.documentElement,
openerDocEl = window.opener && window.opener.document.documentElement;
if (thisDocEl.id == "accountSetup" && window.opener &&
@ -58,22 +58,22 @@ var gSyncUtils = {
type, duringSetup);
},
changePassword: function() {
changePassword() {
if (Weave.Utils.ensureMPUnlocked())
this.openChange("ChangePassword");
},
resetPassphrase: function(duringSetup) {
resetPassphrase(duringSetup) {
if (Weave.Utils.ensureMPUnlocked())
this.openChange("ResetPassphrase", duringSetup);
},
updatePassphrase: function() {
updatePassphrase() {
if (Weave.Utils.ensureMPUnlocked())
this.openChange("UpdatePassphrase");
},
resetPassword: function() {
resetPassword() {
this._openLink(Weave.Service.pwResetURL);
},
@ -82,7 +82,7 @@ var gSyncUtils = {
return Weave.Svc.Prefs.get(root + "termsURL");
},
openToS: function() {
openToS() {
this._openLink(this.tosURL);
},
@ -91,7 +91,7 @@ var gSyncUtils = {
return Weave.Svc.Prefs.get(root + "privacyURL");
},
openPrivacyPolicy: function() {
openPrivacyPolicy() {
this._openLink(this.privacyPolicyURL);
},
@ -102,7 +102,7 @@ var gSyncUtils = {
* @param elid : ID of the form element containing the passphrase.
* @param callback : Function called once the iframe has loaded.
*/
_preparePPiframe: function(elid, callback) {
_preparePPiframe(elid, callback) {
let pp = document.getElementById(elid).value;
// Create an invisible iframe whose contents we can print.
@ -137,7 +137,7 @@ var gSyncUtils = {
*
* @param elid : ID of the form element containing the passphrase.
*/
passphrasePrint: function(elid) {
passphrasePrint(elid) {
this._preparePPiframe(elid, function(iframe) {
let webBrowserPrint = iframe.contentWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
@ -165,7 +165,7 @@ var gSyncUtils = {
*
* @param elid : ID of the form element containing the passphrase.
*/
passphraseSave: function(elid) {
passphraseSave(elid) {
let dialogTitle = this.bundle.GetStringFromName("save.recoverykey.title");
let defaultSaveName = this.bundle.GetStringFromName("save.recoverykey.defaultfilename");
this._preparePPiframe(elid, function(iframe) {
@ -203,7 +203,7 @@ var gSyncUtils = {
*
* returns [valid, errorString]
*/
validatePassword: function(el1, el2) {
validatePassword(el1, el2) {
let valid = false;
let val1 = el1.value;
let val2 = el2 ? el2.value : "";

Просмотреть файл

@ -27,7 +27,7 @@ XPCOMUtils.defineLazyGetter(this, "SimpleServiceDiscovery", function() {
ssdp.registerDevice({
id: "roku:ecp",
target: "roku:ecp",
factory: function(aService) {
factory(aService) {
Cu.import("resource://gre/modules/RokuApp.jsm");
return new RokuApp(aService);
},
@ -98,13 +98,13 @@ addMessageListener("SecondScreen:tab-mirror", function(message) {
if (app) {
let width = content.innerWidth;
let height = content.innerHeight;
let viewport = {cssWidth: width, cssHeight: height, width: width, height: height};
let viewport = {cssWidth: width, cssHeight: height, width, height};
app.mirror(function() {}, content, viewport, function() {}, content);
}
});
var AboutHomeListener = {
init: function(chromeGlobal) {
init(chromeGlobal) {
chromeGlobal.addEventListener('AboutHomeLoad', this, false, true);
},
@ -112,7 +112,7 @@ var AboutHomeListener = {
return content.document.documentURI.toLowerCase() == "about:home";
},
handleEvent: function(aEvent) {
handleEvent(aEvent) {
if (!this.isAboutHome) {
return;
}
@ -129,7 +129,7 @@ var AboutHomeListener = {
}
},
receiveMessage: function(aMessage) {
receiveMessage(aMessage) {
if (!this.isAboutHome) {
return;
}
@ -140,7 +140,7 @@ var AboutHomeListener = {
}
},
onUpdate: function(aData) {
onUpdate(aData) {
let doc = content.document;
if (aData.showRestoreLastSession && !PrivateBrowsingUtils.isContentWindowPrivate(content))
doc.getElementById("launcher").setAttribute("session", "true");
@ -154,7 +154,7 @@ var AboutHomeListener = {
docElt.setAttribute("snippetsVersion", aData.snippetsVersion);
},
onPageLoad: function() {
onPageLoad() {
addMessageListener("AboutHome:Update", this);
addEventListener("click", this, true);
addEventListener("pagehide", this, true);
@ -163,7 +163,7 @@ var AboutHomeListener = {
sendAsyncMessage("AboutHome:RequestUpdate");
},
onClick: function(aEvent) {
onClick(aEvent) {
if (!aEvent.isTrusted || // Don't trust synthetic events
aEvent.button == 2 || aEvent.target.localName != "button") {
return;
@ -210,7 +210,7 @@ var AboutHomeListener = {
}
},
onPageHide: function(aEvent) {
onPageHide(aEvent) {
if (aEvent.target.defaultView.frameElement) {
return;
}
@ -260,7 +260,7 @@ var AboutReaderListener = {
_isLeavingReaderMode: false,
init: function() {
init() {
addEventListener("AboutReaderContentLoaded", this, false, true);
addEventListener("DOMContentLoaded", this, false);
addEventListener("pageshow", this, false);
@ -269,7 +269,7 @@ var AboutReaderListener = {
addMessageListener("Reader:PushState", this);
},
receiveMessage: function(message) {
receiveMessage(message) {
switch (message.name) {
case "Reader:ToggleReaderMode":
if (!this.isAboutReader) {
@ -294,7 +294,7 @@ var AboutReaderListener = {
return content.document.documentURI.startsWith("about:reader");
},
handleEvent: function(aEvent) {
handleEvent(aEvent) {
if (aEvent.originalTarget.defaultView != content) {
return;
}
@ -344,7 +344,7 @@ var AboutReaderListener = {
* this is a suitable document). Calling it on things which won't be
* painted is not going to work.
*/
updateReaderButton: function(forceNonArticle) {
updateReaderButton(forceNonArticle) {
if (!ReaderMode.isEnabledForParseOnLoad || this.isAboutReader ||
!content || !(content.document instanceof content.HTMLDocument) ||
content.document.mozSyntheticDocument) {
@ -354,14 +354,14 @@ var AboutReaderListener = {
this.scheduleReadabilityCheckPostPaint(forceNonArticle);
},
cancelPotentialPendingReadabilityCheck: function() {
cancelPotentialPendingReadabilityCheck() {
if (this._pendingReadabilityCheck) {
removeEventListener("MozAfterPaint", this._pendingReadabilityCheck);
delete this._pendingReadabilityCheck;
}
},
scheduleReadabilityCheckPostPaint: function(forceNonArticle) {
scheduleReadabilityCheckPostPaint(forceNonArticle) {
if (this._pendingReadabilityCheck) {
// We need to stop this check before we re-add one because we don't know
// if forceNonArticle was true or false last time.
@ -371,7 +371,7 @@ var AboutReaderListener = {
addEventListener("MozAfterPaint", this._pendingReadabilityCheck);
},
onPaintWhenWaitedFor: function(forceNonArticle, event) {
onPaintWhenWaitedFor(forceNonArticle, event) {
// In non-e10s, we'll get called for paints other than ours, and so it's
// possible that this page hasn't been laid out yet, in which case we
// should wait until we get an event that does relate to our layout. We
@ -401,18 +401,18 @@ var ContentSearchMediator = {
"about:newtab",
]),
init: function(chromeGlobal) {
init(chromeGlobal) {
chromeGlobal.addEventListener("ContentSearchClient", this, true, true);
addMessageListener("ContentSearch", this);
},
handleEvent: function(event) {
handleEvent(event) {
if (this._contentWhitelisted) {
this._sendMsg(event.detail.type, event.detail.data);
}
},
receiveMessage: function(msg) {
receiveMessage(msg) {
if (msg.data.type == "AddToWhitelist") {
for (let uri of msg.data.data) {
this.whitelist.add(uri);
@ -429,18 +429,18 @@ var ContentSearchMediator = {
return this.whitelist.has(content.document.documentURI);
},
_sendMsg: function(type, data = null) {
_sendMsg(type, data = null) {
sendAsyncMessage("ContentSearch", {
type: type,
data: data,
type,
data,
});
},
_fireEvent: function(type, data = null) {
_fireEvent(type, data = null) {
let event = Cu.cloneInto({
detail: {
type: type,
data: data,
type,
data,
},
}, content);
content.dispatchEvent(new content.CustomEvent("ContentSearchService",
@ -450,7 +450,7 @@ var ContentSearchMediator = {
ContentSearchMediator.init(this);
var PageStyleHandler = {
init: function() {
init() {
addMessageListener("PageStyle:Switch", this);
addMessageListener("PageStyle:Disable", this);
addEventListener("pageshow", () => this.sendStyleSheetInfo());
@ -460,23 +460,23 @@ var PageStyleHandler = {
return docShell.contentViewer;
},
sendStyleSheetInfo: function() {
sendStyleSheetInfo() {
let filteredStyleSheets = this._filterStyleSheets(this.getAllStyleSheets());
sendAsyncMessage("PageStyle:StyleSheets", {
filteredStyleSheets: filteredStyleSheets,
filteredStyleSheets,
authorStyleDisabled: this.markupDocumentViewer.authorStyleDisabled,
preferredStyleSheetSet: content.document.preferredStyleSheetSet
});
},
getAllStyleSheets: function(frameset = content) {
getAllStyleSheets(frameset = content) {
let selfSheets = Array.slice(frameset.document.styleSheets);
let subSheets = Array.map(frameset.frames, frame => this.getAllStyleSheets(frame));
return selfSheets.concat(...subSheets);
},
receiveMessage: function(msg) {
receiveMessage(msg) {
switch (msg.name) {
case "PageStyle:Switch":
this.markupDocumentViewer.authorStyleDisabled = false;
@ -491,7 +491,7 @@ var PageStyleHandler = {
this.sendStyleSheetInfo();
},
_stylesheetSwitchAll: function(frameset, title) {
_stylesheetSwitchAll(frameset, title) {
if (!title || this._stylesheetInFrame(frameset, title)) {
this._stylesheetSwitchFrame(frameset, title);
}
@ -502,7 +502,7 @@ var PageStyleHandler = {
}
},
_stylesheetSwitchFrame: function(frame, title) {
_stylesheetSwitchFrame(frame, title) {
var docStyleSheets = frame.document.styleSheets;
for (let i = 0; i < docStyleSheets.length; ++i) {
@ -515,11 +515,11 @@ var PageStyleHandler = {
}
},
_stylesheetInFrame: function(frame, title) {
_stylesheetInFrame(frame, title) {
return Array.some(frame.document.styleSheets, (styleSheet) => styleSheet.title == title);
},
_filterStyleSheets: function(styleSheets) {
_filterStyleSheets(styleSheets) {
let result = [];
for (let currentStyleSheet of styleSheets) {
@ -661,13 +661,13 @@ let PrerenderContentHandler = {
sendAsyncMessage("Prerender:Request", {
href: aHref.spec,
referrer: aReferrer ? aReferrer.spec : null,
id: id,
id,
});
this._pending.push({
href: aHref,
referrer: aReferrer,
id: id,
id,
success: null,
failure: null,
});
@ -699,12 +699,12 @@ if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) {
}
var WebBrowserChrome = {
onBeforeLinkTraversal: function(originalTarget, linkURI, linkNode, isAppTab) {
onBeforeLinkTraversal(originalTarget, linkURI, linkNode, isAppTab) {
return BrowserUtils.onBeforeLinkTraversal(originalTarget, linkURI, linkNode, isAppTab);
},
// Check whether this URI should load in the current process
shouldLoadURI: function(aDocShell, aURI, aReferrer) {
shouldLoadURI(aDocShell, aURI, aReferrer) {
if (!E10SUtils.shouldLoadURI(aDocShell, aURI, aReferrer)) {
E10SUtils.redirectLoad(aDocShell, aURI, aReferrer);
return false;
@ -713,23 +713,23 @@ var WebBrowserChrome = {
return true;
},
shouldLoadURIInThisProcess: function(aURI) {
shouldLoadURIInThisProcess(aURI) {
return E10SUtils.shouldLoadURIInThisProcess(aURI);
},
// Try to reload the currently active or currently loading page in a new process.
reloadInFreshProcess: function(aDocShell, aURI, aReferrer) {
reloadInFreshProcess(aDocShell, aURI, aReferrer) {
E10SUtils.redirectLoad(aDocShell, aURI, aReferrer, true);
return true;
},
startPrerenderingDocument: function(aHref, aReferrer) {
startPrerenderingDocument(aHref, aReferrer) {
if (PrerenderContentHandler.initialized) {
PrerenderContentHandler.startPrerenderingDocument(aHref, aReferrer);
}
},
shouldSwitchToPrerenderedDocument: function(aHref, aReferrer, aSuccess, aFailure) {
shouldSwitchToPrerenderedDocument(aHref, aReferrer, aSuccess, aFailure) {
if (PrerenderContentHandler.initialized) {
return PrerenderContentHandler.shouldSwitchToPrerenderedDocument(
aHref, aReferrer, aSuccess, aFailure);
@ -747,7 +747,7 @@ if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) {
var DOMFullscreenHandler = {
init: function() {
init() {
addMessageListener("DOMFullscreen:Entered", this);
addMessageListener("DOMFullscreen:CleanUp", this);
addEventListener("MozDOMFullscreen:Request", this);
@ -765,7 +765,7 @@ var DOMFullscreenHandler = {
.getInterface(Ci.nsIDOMWindowUtils);
},
receiveMessage: function(aMessage) {
receiveMessage(aMessage) {
let windowUtils = this._windowUtils;
switch (aMessage.name) {
case "DOMFullscreen:Entered": {
@ -793,7 +793,7 @@ var DOMFullscreenHandler = {
}
},
handleEvent: function(aEvent) {
handleEvent(aEvent) {
switch (aEvent.type) {
case "MozDOMFullscreen:Request": {
sendAsyncMessage("DOMFullscreen:Request");

Просмотреть файл

@ -566,18 +566,18 @@
// count of open requests (should always be 0 or 1)
mRequestCount: 0,
destroy: function() {
destroy() {
delete this.mTab;
delete this.mBrowser;
delete this.mTabBrowser;
},
_callProgressListeners: function() {
_callProgressListeners() {
Array.unshift(arguments, this.mBrowser);
return this.mTabBrowser._callProgressListeners.apply(this.mTabBrowser, arguments);
},
_shouldShowProgress: function(aRequest) {
_shouldShowProgress(aRequest) {
if (this.mBlank)
return false;
@ -591,9 +591,9 @@
return true;
},
onProgressChange: function(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) {
onProgressChange(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) {
this.mTotalProgress = aMaxTotalProgress ? aCurTotalProgress / aMaxTotalProgress : 0;
if (!this._shouldShowProgress(aRequest))
@ -608,15 +608,15 @@
aCurTotalProgress, aMaxTotalProgress]);
},
onProgressChange64: function(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) {
onProgressChange64(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) {
return this.onProgressChange(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress,
aMaxTotalProgress);
},
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) {
onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
if (!aRequest)
return;
@ -757,8 +757,8 @@
this.mStatus = aStatus;
},
onLocationChange: function(aWebProgress, aRequest, aLocation,
aFlags) {
onLocationChange(aWebProgress, aRequest, aLocation,
aFlags) {
// OnLocationChange is called for both the top-level content
// and the subframes.
let topLevel = aWebProgress.isTopLevel;
@ -838,7 +838,7 @@
}
},
onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage) {
onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {
if (this.mBlank)
return;
@ -848,17 +848,17 @@
this.mMessage = aMessage;
},
onSecurityChange: function(aWebProgress, aRequest, aState) {
onSecurityChange(aWebProgress, aRequest, aState) {
this._callProgressListeners("onSecurityChange",
[aWebProgress, aRequest, aState]);
},
onRefreshAttempted: function(aWebProgress, aURI, aDelay, aSameURI) {
onRefreshAttempted(aWebProgress, aURI, aDelay, aSameURI) {
return this._callProgressListeners("onRefreshAttempted",
[aWebProgress, aURI, aDelay, aSameURI]);
},
QueryInterface: function(aIID) {
QueryInterface(aIID) {
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsIWebProgressListener2) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
@ -2072,7 +2072,7 @@
// No preloaded browser found, create one.
browser = this._createBrowser({permanentKey: aTab.permanentKey,
remoteType,
uriIsAboutBlank: uriIsAboutBlank,
uriIsAboutBlank,
userContextId: aParams.userContextId,
relatedBrowser: aParams.relatedBrowser,
opener: aParams.opener,
@ -2124,7 +2124,7 @@
var evt = new CustomEvent("TabBrowserInserted", { bubbles: true, detail: {} });
aTab.dispatchEvent(evt);
return { usingPreloadedContent: usingPreloadedContent };
return { usingPreloadedContent };
]]>
</body>
</method>
@ -3661,7 +3661,7 @@
// Wraps nsITimer. Must not use the vanilla setTimeout and
// clearTimeout, because they will be blocked by nsIPromptService
// dialogs.
setTimer: function(callback, timeout) {
setTimer(callback, timeout) {
let event = {
notify: callback
};
@ -3672,11 +3672,11 @@
return timer;
},
clearTimer: function(timer) {
clearTimer(timer) {
timer.cancel();
},
getTabState: function(tab) {
getTabState(tab) {
let state = this.tabState.get(tab);
if (state === undefined) {
return this.STATE_UNLOADED;
@ -3692,7 +3692,7 @@
}
},
setTabState: function(tab, state) {
setTabState(tab, state) {
this.setTabStateNoAction(tab, state);
let browser = tab.linkedBrowser;
@ -3715,7 +3715,7 @@
return window.windowState == window.STATE_MINIMIZED;
},
init: function() {
init() {
this.log("START");
// If we minimized the window before the switcher was activated,
@ -3735,7 +3735,7 @@
}
},
destroy: function() {
destroy() {
if (this.unloadTimer) {
this.clearTimer(this.unloadTimer);
this.unloadTimer = null;
@ -3761,7 +3761,7 @@
this.activeSuppressDisplayport.clear();
},
finish: function() {
finish() {
this.log("FINISH");
this.assert(this.tabbrowser._switcher);
@ -3796,7 +3796,7 @@
// This function is called after all the main state changes to
// make sure we display the right tab.
updateDisplay: function() {
updateDisplay() {
// Figure out which tab we actually want visible right now.
let showTab = null;
if (this.getTabState(this.requestedTab) != this.STATE_LOADED &&
@ -3855,7 +3855,7 @@
this.lastVisibleTab = this.visibleTab;
},
assert: function(cond) {
assert(cond) {
if (!cond) {
dump("Assertion failure\n" + Error().stack);
@ -3867,7 +3867,7 @@
},
// We've decided to try to load requestedTab.
loadRequestedTab: function() {
loadRequestedTab() {
this.assert(!this.loadTimer);
this.assert(!this.minimized);
@ -3882,7 +3882,7 @@
// This function runs before every event. It fixes up the state
// to account for closed tabs.
preActions: function() {
preActions() {
this.assert(this.tabbrowser._switcher);
this.assert(this.tabbrowser._switcher === this);
@ -3910,7 +3910,7 @@
// tab. It's expected that we've already updated all the principal
// state variables. This function takes care of updating any auxilliary
// state.
postActions: function() {
postActions() {
// Once we finish loading loadingTab, we null it out. So the state should
// always be LOADING.
this.assert(!this.loadingTab ||
@ -3962,7 +3962,7 @@
},
// Fires when we're ready to unload unused tabs.
onUnloadTimeout: function() {
onUnloadTimeout() {
this.logState("onUnloadTimeout");
this.unloadTimer = null;
this.preActions();
@ -3998,7 +3998,7 @@
},
// Fires when an ongoing load has taken too long.
onLoadTimeout: function() {
onLoadTimeout() {
this.logState("onLoadTimeout");
this.preActions();
this.loadTimer = null;
@ -4007,7 +4007,7 @@
},
// Fires when the layers become available for a tab.
onLayersReady: function(browser) {
onLayersReady(browser) {
let tab = this.tabbrowser.getTabForBrowser(browser);
this.logState(`onLayersReady(${tab._tPos})`);
@ -4027,13 +4027,13 @@
// Fires when we paint the screen. Any tab switches we initiated
// previously are done, so there's no need to keep the old layers
// around.
onPaint: function() {
onPaint() {
this.maybeVisibleTabs.clear();
this.maybeFinishTabSwitch();
},
// Called when we're done clearing the layers for a tab.
onLayersCleared: function(browser) {
onLayersCleared(browser) {
let tab = this.tabbrowser.getTabForBrowser(browser);
if (tab) {
this.logState(`onLayersCleared(${tab._tPos})`);
@ -4046,7 +4046,7 @@
// Called when a tab switches from remote to non-remote. In this case
// a MozLayerTreeReady notification that we requested may never fire,
// so we need to simulate it.
onRemotenessChange: function(tab) {
onRemotenessChange(tab) {
this.logState(`onRemotenessChange(${tab._tPos}, ${tab.linkedBrowser.isRemoteBrowser})`);
if (!tab.linkedBrowser.isRemoteBrowser) {
if (this.getTabState(tab) == this.STATE_LOADING) {
@ -4059,7 +4059,7 @@
// Called when a tab has been removed, and the browser node is
// about to be removed from the DOM.
onTabRemoved: function(tab) {
onTabRemoved(tab) {
if (this.lastVisibleTab == tab) {
// The browser that was being presented to the user is
// going to be removed during this tick of the event loop.
@ -4152,7 +4152,7 @@
},
// Called when the user asks to switch to a given tab.
requestTab: function(tab) {
requestTab(tab) {
if (tab === this.requestedTab) {
return;
}
@ -4179,7 +4179,7 @@
this.postActions();
},
handleEvent: function(event, delayed = false) {
handleEvent(event, delayed = false) {
if (this._processing) {
this.setTimer(() => this.handleEvent(event, true), 0);
return;
@ -4217,7 +4217,7 @@
* timing.
*/
startTabSwitch: function() {
startTabSwitch() {
TelemetryStopwatch.cancel("FX_TAB_SWITCH_TOTAL_E10S_MS", window);
TelemetryStopwatch.start("FX_TAB_SWITCH_TOTAL_E10S_MS", window);
this.addMarker("AsyncTabSwitch:Start");
@ -4230,7 +4230,7 @@
* are hidden). This checks to make sure all conditions are
* satisfied, and then records the tab switch as finished.
*/
maybeFinishTabSwitch: function() {
maybeFinishTabSwitch() {
if (this.switchInProgress && this.requestedTab &&
this.getTabState(this.requestedTab) == this.STATE_LOADED) {
// After this point the tab has switched from the content thread's point of view.
@ -4245,7 +4245,7 @@
}
},
spinnerDisplayed: function() {
spinnerDisplayed() {
this.assert(!this.spinnerTab);
TelemetryStopwatch.start("FX_TAB_SWITCH_SPINNER_VISIBLE_MS", window);
// We have a second, similar probe for capturing recordings of
@ -4254,7 +4254,7 @@
this.addMarker("AsyncTabSwitch:SpinnerShown");
},
spinnerHidden: function() {
spinnerHidden() {
this.assert(this.spinnerTab);
this.log("DEBUG: spinner time = " +
TelemetryStopwatch.timeElapsed("FX_TAB_SWITCH_SPINNER_VISIBLE_MS", window));
@ -4265,7 +4265,7 @@
this.maybeFinishTabSwitch();
},
addMarker: function(marker) {
addMarker(marker) {
if (Services.profiler) {
Services.profiler.AddMarker(marker);
}
@ -4278,7 +4278,7 @@
_useDumpForLogging: false,
_logInit: false,
logging: function() {
logging() {
if (this._useDumpForLogging)
return true;
if (this._logInit)
@ -4293,14 +4293,14 @@
return this._shouldLog;
},
tinfo: function(tab) {
tinfo(tab) {
if (tab) {
return tab._tPos + "(" + tab.linkedBrowser.currentURI.spec + ")";
}
return "null";
},
log: function(s) {
log(s) {
if (!this.logging())
return;
if (this._useDumpForLogging) {
@ -4310,7 +4310,7 @@
}
},
logState: function(prefix) {
logState(prefix) {
if (!this.logging())
return;
@ -4721,13 +4721,13 @@
gContextMenuContentData = { isRemote: true,
event: aMessage.objects.event,
popupNode: aMessage.objects.popupNode,
browser: browser,
browser,
editFlags: data.editFlags,
spellInfo: spellInfo,
spellInfo,
principal: data.principal,
customMenuItems: data.customMenuItems,
addonInfo: data.addonInfo,
documentURIObject: documentURIObject,
documentURIObject,
docLocation: data.docLocation,
charSet: data.charSet,
referrer: data.referrer,
@ -5127,14 +5127,14 @@
self: this,
childNodes: [null, this.tabContextMenu, this.tabContainer],
firstChild: { nextSibling: this.tabContextMenu },
getElementsByAttribute: function(attr, attrValue) {
getElementsByAttribute(attr, attrValue) {
if (attr == "anonid" && attrValue == "tabContextMenu")
return [this.self.tabContextMenu];
return [];
},
// Also support adding event listeners (forward to the tab container)
addEventListener: function(a, b, c) { this.self.tabContainer.addEventListener(a, b, c); },
removeEventListener: function(a, b, c) { this.self.tabContainer.removeEventListener(a, b, c); }
addEventListener(a, b, c) { this.self.tabContainer.addEventListener(a, b, c); },
removeEventListener(a, b, c) { this.self.tabContainer.removeEventListener(a, b, c); }
});
]]>
</getter>

Просмотреть файл

@ -36,11 +36,11 @@ registerCleanupFunction(function() {
var gTests = [
{
desc: "Test the remote commands",
teardown: function* () {
*teardown() {
gBrowser.removeCurrentTab();
yield signOut();
},
run: function* ()
*run()
{
setPref("identity.fxaccounts.remote.signup.uri",
"https://example.com/browser/browser/base/content/test/general/accounts_testRemoteCommands.html");
@ -76,7 +76,7 @@ var gTests = [
{
desc: "Test action=signin - no user logged in",
teardown: () => gBrowser.removeCurrentTab(),
run: function* ()
*run()
{
// When this loads with no user logged-in, we expect the "normal" URL
const expected_url = "https://example.com/?is_sign_in";
@ -95,11 +95,11 @@ var gTests = [
},
{
desc: "Test action=signin - user logged in",
teardown: function* () {
*teardown() {
gBrowser.removeCurrentTab();
yield signOut();
},
run: function* ()
*run()
{
// When this loads with a user logged-in, we expect the normal URL to
// have been ignored and the "manage" page to be shown.
@ -124,7 +124,7 @@ var gTests = [
{
desc: "Test action=signin - captive portal",
teardown: () => gBrowser.removeCurrentTab(),
run: function* ()
*run()
{
const signinUrl = "https://redirproxy.example.com/test";
setPref("identity.fxaccounts.remote.signin.uri", signinUrl);
@ -144,7 +144,7 @@ var gTests = [
gBrowser.removeCurrentTab();
BrowserOffline.toggleOfflineStatus();
},
run: function* ()
*run()
{
BrowserOffline.toggleOfflineStatus();
Services.cache2.clear();
@ -164,7 +164,7 @@ var gTests = [
{
desc: "Test action=signup - no user logged in",
teardown: () => gBrowser.removeCurrentTab(),
run: function* ()
*run()
{
const expected_url = "https://example.com/?is_sign_up";
setPref("identity.fxaccounts.remote.signup.uri", expected_url);
@ -183,7 +183,7 @@ var gTests = [
{
desc: "Test action=signup - user logged in",
teardown: () => gBrowser.removeCurrentTab(),
run: function* ()
*run()
{
const expected_url = "https://example.com/?is_sign_up";
setPref("identity.fxaccounts.remote.signup.uri", expected_url);
@ -202,11 +202,11 @@ var gTests = [
},
{
desc: "Test action=reauth",
teardown: function* () {
*teardown() {
gBrowser.removeCurrentTab();
yield signOut();
},
run: function* ()
*run()
{
const expected_url = "https://example.com/?is_force_auth";
setPref("identity.fxaccounts.remote.force_auth.uri", expected_url);
@ -220,11 +220,11 @@ var gTests = [
},
{
desc: "Test with migrateToDevEdition enabled (success)",
teardown: function* () {
*teardown() {
gBrowser.removeCurrentTab();
yield signOut();
},
run: function* ()
*run()
{
let fxAccountsCommon = {};
Cu.import("resource://gre/modules/FxAccountsCommon.js", fxAccountsCommon);
@ -281,11 +281,11 @@ var gTests = [
},
{
desc: "Test with migrateToDevEdition enabled (no user to migrate)",
teardown: function* () {
*teardown() {
gBrowser.removeCurrentTab();
yield signOut();
},
run: function* ()
*run()
{
const pref = "identity.fxaccounts.migrateToDevEdition";
changedPrefs.add(pref);
@ -321,10 +321,10 @@ var gTests = [
},
{
desc: "Test observers about:accounts",
teardown: function() {
teardown() {
gBrowser.removeCurrentTab();
},
run: function* () {
*run() {
setPref("identity.fxaccounts.remote.signup.uri", "https://example.com/");
yield setSignedInUser();
let tab = yield promiseNewTabLoadEvent("about:accounts");
@ -339,7 +339,7 @@ var gTests = [
{
desc: "Test entrypoint query string, no action, no user logged in",
teardown: () => gBrowser.removeCurrentTab(),
run: function* () {
*run() {
// When this loads with no user logged-in, we expect the "normal" URL
setPref("identity.fxaccounts.remote.signup.uri", "https://example.com/");
let [, url] = yield promiseNewTabWithIframeLoadEvent("about:accounts?entrypoint=abouthome");
@ -349,7 +349,7 @@ var gTests = [
{
desc: "Test entrypoint query string for signin",
teardown: () => gBrowser.removeCurrentTab(),
run: function* () {
*run() {
// When this loads with no user logged-in, we expect the "normal" URL
const expected_url = "https://example.com/?is_sign_in";
setPref("identity.fxaccounts.remote.signin.uri", expected_url);
@ -360,7 +360,7 @@ var gTests = [
{
desc: "Test entrypoint query string for signup",
teardown: () => gBrowser.removeCurrentTab(),
run: function* () {
*run() {
// When this loads with no user logged-in, we expect the "normal" URL
const sign_up_url = "https://example.com/?is_sign_up";
setPref("identity.fxaccounts.remote.signup.uri", sign_up_url);
@ -374,7 +374,7 @@ var gTests = [
teardown() {
gBrowser.removeCurrentTab();
},
run: function* () {
*run() {
let signupURL = "https://example.com/";
setPref("identity.fxaccounts.remote.signup.uri", signupURL);
let queryStr = "email=foo%40example.com&foo=bar&baz=quux";
@ -390,7 +390,7 @@ var gTests = [
teardown() {
gBrowser.removeCurrentTab();
},
run: function* () {
*run() {
let signupURL = "https://example.com/?param";
setPref("identity.fxaccounts.remote.signup.uri", signupURL);
let queryStr = "email=foo%40example.com&foo=bar&baz=quux";
@ -472,7 +472,7 @@ function checkVisibilities(tab, data) {
}
deferred.resolve();
});
mm.sendAsyncMessage("test:check-visibilities", {ids: ids});
mm.sendAsyncMessage("test:check-visibilities", {ids});
return deferred.promise;
}

Просмотреть файл

@ -68,7 +68,7 @@ var gTests = [
Preferences.set("datareporting.healthreport.about.reportUrl",
HTTPS_BASE + "healthreport_testRemoteCommands.html");
}),
run: function(iframe)
run(iframe)
{
let deferred = Promise.defer();
let results = 0;

Просмотреть файл

@ -495,7 +495,7 @@ add_task(function* () {
let oldOpenPrefs = window.openPreferences;
let openPrefsPromise = new Promise(resolve => {
window.openPreferences = function(pane, params) {
resolve({ pane: pane, params: params });
resolve({ pane, params });
};
});
@ -647,7 +647,7 @@ function promiseNewEngine(basename) {
return new Promise((resolve, reject) => {
let url = getRootDirectory(gTestPath) + basename;
Services.search.addEngine(url, null, "", false, {
onSuccess: function(engine) {
onSuccess(engine) {
info("Search engine added: " + basename);
registerCleanupFunction(() => {
try {
@ -656,7 +656,7 @@ function promiseNewEngine(basename) {
});
resolve(engine);
},
onError: function(errCode) {
onError(errCode) {
ok(false, "addEngine failed with error code " + errCode);
reject();
},

Просмотреть файл

@ -4,12 +4,12 @@ const gCompleteState = Ci.nsIWebProgressListener.STATE_STOP +
Ci.nsIWebProgressListener.STATE_IS_NETWORK;
var gFrontProgressListener = {
onProgressChange: function(aWebProgress, aRequest,
onProgressChange(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) {
},
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) {
onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
var state = "onStateChange";
info("FrontProgress: " + state + " 0x" + aStateFlags.toString(16));
ok(gFrontNotificationsPos < gFrontNotifications.length, "Got an expected notification for the front notifications listener");
@ -17,7 +17,7 @@ var gFrontProgressListener = {
gFrontNotificationsPos++;
},
onLocationChange: function(aWebProgress, aRequest, aLocationURI, aFlags) {
onLocationChange(aWebProgress, aRequest, aLocationURI, aFlags) {
var state = "onLocationChange";
info("FrontProgress: " + state + " " + aLocationURI.spec);
ok(gFrontNotificationsPos < gFrontNotifications.length, "Got an expected notification for the front notifications listener");
@ -25,10 +25,10 @@ var gFrontProgressListener = {
gFrontNotificationsPos++;
},
onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage) {
onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {
},
onSecurityChange: function(aWebProgress, aRequest, aState) {
onSecurityChange(aWebProgress, aRequest, aState) {
var state = "onSecurityChange";
info("FrontProgress: " + state + " 0x" + aState.toString(16));
ok(gFrontNotificationsPos < gFrontNotifications.length, "Got an expected notification for the front notifications listener");
@ -38,7 +38,7 @@ var gFrontProgressListener = {
}
var gAllProgressListener = {
onStateChange: function(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
var state = "onStateChange";
info("AllProgress: " + state + " 0x" + aStateFlags.toString(16));
ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
@ -53,7 +53,7 @@ var gAllProgressListener = {
}
},
onLocationChange: function(aBrowser, aWebProgress, aRequest, aLocationURI,
onLocationChange(aBrowser, aWebProgress, aRequest, aLocationURI,
aFlags) {
var state = "onLocationChange";
info("AllProgress: " + state + " " + aLocationURI.spec);
@ -63,12 +63,12 @@ var gAllProgressListener = {
gAllNotificationsPos++;
},
onStatusChange: function(aBrowser, aWebProgress, aRequest, aStatus, aMessage) {
onStatusChange(aBrowser, aWebProgress, aRequest, aStatus, aMessage) {
var state = "onStatusChange";
ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
},
onSecurityChange: function(aBrowser, aWebProgress, aRequest, aState) {
onSecurityChange(aBrowser, aWebProgress, aRequest, aState) {
var state = "onSecurityChange";
info("AllProgress: " + state + " 0x" + aState.toString(16));
ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");

Просмотреть файл

@ -60,7 +60,7 @@ function loadPinningPage() {
// After the site is pinned try to load with a subdomain site that should
// fail to validate
var successfulPinningPageListener = {
handleEvent: function() {
handleEvent() {
gBrowser.selectedBrowser.removeEventListener("load", this, true);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "https://" + kBadPinningDomain).then(function() {
return promiseErrorPageLoaded(gBrowser.selectedBrowser);

Просмотреть файл

@ -49,7 +49,7 @@ function test_paste(aCurrentTest) {
// Register input listener.
var inputListener = {
test: aCurrentTest,
handleEvent: function(event) {
handleEvent(event) {
element.removeEventListener(event.type, this, false);
is(element.value, this.test.expected, this.test.desc);

Просмотреть файл

@ -15,7 +15,7 @@ const kPromptServiceFactory = Cm.getClassObject(Cc[kPromptServiceContractID],
Ci.nsIFactory);
var fakePromptServiceFactory = {
createInstance: function(aOuter, aIid) {
createInstance(aOuter, aIid) {
if (aOuter != null)
throw Cr.NS_ERROR_NO_AGGREGATION;
return promptService.QueryInterface(aIid);
@ -24,7 +24,7 @@ var fakePromptServiceFactory = {
var promptService = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPromptService]),
alert: function() {
alert() {
didFail = true;
}
};
@ -47,7 +47,7 @@ const kURIs = [
var gProgressListener = {
_runCount: 0,
onStateChange: function(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
if ((aStateFlags & kCompleteState) == kCompleteState) {
if (++this._runCount != kURIs.length)
return;

Просмотреть файл

@ -24,7 +24,7 @@ add_task(function *() {
let test = tests[index];
yield ContentTask.spawn(gBrowser.selectedBrowser,
{ element: test.element, type: test.type, index: index },
{ element: test.element, type: test.type, index },
function* (arg) {
let element = content.document.createElement(arg.element);
element.id = "element" + arg.index;

Просмотреть файл

@ -152,13 +152,13 @@ function waitForInstallDialog() {
let window = yield new Promise(resolve => {
Services.wm.addListener({
onOpenWindow: function(aXULWindow) {
onOpenWindow(aXULWindow) {
Services.wm.removeListener(this);
resolve(aXULWindow);
},
onCloseWindow: function(aXULWindow) {
onCloseWindow(aXULWindow) {
},
onWindowTitleChange: function(aXULWindow, aNewTitle) {
onWindowTitleChange(aXULWindow, aNewTitle) {
}
});
});
@ -1055,7 +1055,7 @@ function test_cancel() {
let install = notification.notification.options.installs[0];
let cancelledPromise = new Promise(resolve => {
install.addListener({
onDownloadCancelled: function() {
onDownloadCancelled() {
install.removeListener(this);
resolve();
}
@ -1124,7 +1124,7 @@ function test_failedSecurity() {
var gTestStart = null;
var XPInstallObserver = {
observe: function(aSubject, aTopic, aData) {
observe(aSubject, aTopic, aData) {
var installInfo = aSubject.QueryInterface(Components.interfaces.amIWebInstallInfo);
info("Observed " + aTopic + " for " + installInfo.installs.length + " installs");
installInfo.installs.forEach(function(aInstall) {

Просмотреть файл

@ -17,7 +17,7 @@ function checkPopupHide()
var gObserver = {
QueryInterface : XPCOMUtils.generateQI([Ci.nsIFormSubmitObserver]),
notifyInvalidSubmit : function(aFormElement, aInvalidElements)
notifyInvalidSubmit(aFormElement, aInvalidElements)
{
}
};

Просмотреть файл

@ -144,7 +144,7 @@ function test() {
AddonManager.getInstallForURL(TESTROOT + "theme.xpi", function(aInstall) {
aInstall.addListener({
onInstallEnded: function() {
onInstallEnded() {
AddonManager.getAddonByID("theme-xpi@tests.mozilla.org", function(aAddon) {
isnot(aAddon, null, "Should have installed the test theme.");

Просмотреть файл

@ -64,7 +64,7 @@ function test() {
function addWindowListener(aURL, aCallback) {
Services.wm.addListener({
onOpenWindow: function(aXULWindow) {
onOpenWindow(aXULWindow) {
info("window opened, waiting for focus");
Services.wm.removeListener(this);
@ -75,8 +75,8 @@ function addWindowListener(aURL, aCallback) {
aCallback(domwindow);
}, domwindow);
},
onCloseWindow: function(aXULWindow) { },
onWindowTitleChange: function(aXULWindow, aNewTitle) { }
onCloseWindow(aXULWindow) { },
onWindowTitleChange(aXULWindow, aNewTitle) { }
});
}
@ -98,7 +98,7 @@ TabOpenListener.prototype = {
tab: null,
browser: null,
handleEvent: function(event) {
handleEvent(event) {
if (event.type == "TabOpen") {
gBrowser.tabContainer.removeEventListener("TabOpen", this, false);
this.tab = event.originalTarget;

Просмотреть файл

@ -15,15 +15,15 @@ add_task(function* ()
name: "view background image",
url: "http://mochi.test:8888/",
element: "body",
go: function() {
return ContentTask.spawn(gBrowser.selectedBrowser, { writeDomainURL: writeDomainURL }, function* (arg) {
go() {
return ContentTask.spawn(gBrowser.selectedBrowser, { writeDomainURL }, function* (arg) {
let contentBody = content.document.body;
contentBody.style.backgroundImage = "url('" + arg.writeDomainURL + "')";
return "context-viewbgimage";
});
},
verify: function() {
verify() {
return ContentTask.spawn(gBrowser.selectedBrowser, null, function* (arg) {
Assert.ok(!content.document.body.textContent,
"no domain was inherited for view background image");
@ -34,8 +34,8 @@ add_task(function* ()
name: "view image",
url: "http://mochi.test:8888/",
element: "img",
go: function() {
return ContentTask.spawn(gBrowser.selectedBrowser, { writeDomainURL: writeDomainURL }, function* (arg) {
go() {
return ContentTask.spawn(gBrowser.selectedBrowser, { writeDomainURL }, function* (arg) {
let doc = content.document;
let img = doc.createElement("img");
img.height = 100;
@ -46,7 +46,7 @@ add_task(function* ()
return "context-viewimage";
});
},
verify: function() {
verify() {
return ContentTask.spawn(gBrowser.selectedBrowser, null, function* (arg) {
Assert.ok(!content.document.body.textContent,
"no domain was inherited for view image");
@ -57,8 +57,8 @@ add_task(function* ()
name: "show only this frame",
url: "http://mochi.test:8888/",
element: "iframe",
go: function() {
return ContentTask.spawn(gBrowser.selectedBrowser, { writeDomainURL: writeDomainURL }, function* (arg) {
go() {
return ContentTask.spawn(gBrowser.selectedBrowser, { writeDomainURL }, function* (arg) {
let doc = content.document;
let iframe = doc.createElement("iframe");
iframe.setAttribute("src", arg.writeDomainURL);
@ -73,7 +73,7 @@ add_task(function* ()
});
});
},
verify: function() {
verify() {
return ContentTask.spawn(gBrowser.selectedBrowser, null, function* (arg) {
Assert.ok(!content.document.body.textContent,
"no domain was inherited for 'show only this frame'");

Просмотреть файл

@ -54,7 +54,7 @@ add_task(function* test_alt_click()
// When 1 download has been attempted then resolve the promise.
let finishedAllDownloads = new Promise( (resolve) => {
downloadView = {
onDownloadAdded: function(aDownload) {
onDownloadAdded(aDownload) {
downloads.push(aDownload);
resolve();
},
@ -83,7 +83,7 @@ add_task(function* test_alt_click_on_xlinks()
// When all 2 downloads have been attempted then resolve the promise.
let finishedAllDownloads = new Promise( (resolve) => {
downloadView = {
onDownloadAdded: function(aDownload) {
onDownloadAdded(aDownload) {
downloads.push(aDownload);
if (downloads.length == 2) {
resolve();

Просмотреть файл

@ -18,8 +18,8 @@ var gTests = [
{
desc: "Simple left click",
setup: function() {},
clean: function() {},
setup() {},
clean() {},
event: {},
targets: [ "commonlink", "mathxlink", "svgxlink", "maplink" ],
expectedInvokedMethods: [],
@ -28,8 +28,8 @@ var gTests = [
{
desc: "Ctrl/Cmd left click",
setup: function() {},
clean: function() {},
setup() {},
clean() {},
event: { ctrlKey: true,
metaKey: true },
targets: [ "commonlink", "mathxlink", "svgxlink", "maplink" ],
@ -41,10 +41,10 @@ var gTests = [
// just be like Alt click.
{
desc: "Shift+Alt left click",
setup: function() {
setup() {
gPrefService.setBoolPref("browser.altClickSave", true);
},
clean: function() {
clean() {
gPrefService.clearUserPref("browser.altClickSave");
},
event: { shiftKey: true,
@ -56,10 +56,10 @@ var gTests = [
{
desc: "Shift+Alt left click on XLinks",
setup: function() {
setup() {
gPrefService.setBoolPref("browser.altClickSave", true);
},
clean: function() {
clean() {
gPrefService.clearUserPref("browser.altClickSave");
},
event: { shiftKey: true,
@ -71,8 +71,8 @@ var gTests = [
{
desc: "Shift click",
setup: function() {},
clean: function() {},
setup() {},
clean() {},
event: { shiftKey: true },
targets: [ "commonlink", "mathxlink", "svgxlink", "maplink" ],
expectedInvokedMethods: [ "urlSecurityCheck", "openLinkIn" ],
@ -81,10 +81,10 @@ var gTests = [
{
desc: "Alt click",
setup: function() {
setup() {
gPrefService.setBoolPref("browser.altClickSave", true);
},
clean: function() {
clean() {
gPrefService.clearUserPref("browser.altClickSave");
},
event: { altKey: true },
@ -95,10 +95,10 @@ var gTests = [
{
desc: "Alt click on XLinks",
setup: function() {
setup() {
gPrefService.setBoolPref("browser.altClickSave", true);
},
clean: function() {
clean() {
gPrefService.clearUserPref("browser.altClickSave");
},
event: { altKey: true },
@ -109,8 +109,8 @@ var gTests = [
{
desc: "Panel click",
setup: function() {},
clean: function() {},
setup() {},
clean() {},
event: {},
targets: [ "panellink" ],
expectedInvokedMethods: [ "urlSecurityCheck", "loadURI" ],
@ -119,8 +119,8 @@ var gTests = [
{
desc: "Simple middle click opentab",
setup: function() {},
clean: function() {},
setup() {},
clean() {},
event: { button: 1 },
targets: [ "commonlink", "mathxlink", "svgxlink", "maplink" ],
expectedInvokedMethods: [ "urlSecurityCheck", "openLinkIn" ],
@ -129,10 +129,10 @@ var gTests = [
{
desc: "Simple middle click openwin",
setup: function() {
setup() {
gPrefService.setBoolPref("browser.tabs.opentabfor.middleclick", false);
},
clean: function() {
clean() {
gPrefService.clearUserPref("browser.tabs.opentabfor.middleclick");
},
event: { button: 1 },
@ -143,11 +143,11 @@ var gTests = [
{
desc: "Middle mouse paste",
setup: function() {
setup() {
gPrefService.setBoolPref("middlemouse.contentLoadURL", true);
gPrefService.setBoolPref("general.autoScroll", false);
},
clean: function() {
clean() {
gPrefService.clearUserPref("middlemouse.contentLoadURL");
gPrefService.clearUserPref("general.autoScroll");
},
@ -199,7 +199,7 @@ function test() {
// Click handler used to steal click events.
var gClickHandler = {
handleEvent: function(event) {
handleEvent(event) {
let linkId = event.target.id || event.target.localName;
is(event.type, "click",
gCurrentTest.desc + ":Handler received a click event on " + linkId);

Просмотреть файл

@ -195,28 +195,28 @@ add_task(function* cycleSuggestions() {
accelKey: true,
};
let state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
let state = yield msg("key", { key: "VK_DOWN", modifiers });
checkState(state, "xfoo", ["xfoo", "xbar"], 0, aSelectedButtonIndex);
state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
state = yield msg("key", { key: "VK_DOWN", modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1, aSelectedButtonIndex);
state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
state = yield msg("key", { key: "VK_DOWN", modifiers });
checkState(state, "x", ["xfoo", "xbar"], -1, aSelectedButtonIndex);
state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
state = yield msg("key", { key: "VK_DOWN", modifiers });
checkState(state, "xfoo", ["xfoo", "xbar"], 0, aSelectedButtonIndex);
state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
state = yield msg("key", { key: "VK_UP", modifiers });
checkState(state, "x", ["xfoo", "xbar"], -1, aSelectedButtonIndex);
state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
state = yield msg("key", { key: "VK_UP", modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1, aSelectedButtonIndex);
state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
state = yield msg("key", { key: "VK_UP", modifiers });
checkState(state, "xfoo", ["xfoo", "xbar"], 0, aSelectedButtonIndex);
state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
state = yield msg("key", { key: "VK_UP", modifiers });
checkState(state, "x", ["xfoo", "xbar"], -1, aSelectedButtonIndex);
});
@ -249,22 +249,22 @@ add_task(function* cycleOneOffs() {
altKey: true,
};
state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
state = yield msg("key", { key: "VK_DOWN", modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1, 0);
state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
state = yield msg("key", { key: "VK_DOWN", modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1, 1);
state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
state = yield msg("key", { key: "VK_DOWN", modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1);
state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
state = yield msg("key", { key: "VK_UP", modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1, 1);
state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
state = yield msg("key", { key: "VK_UP", modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1, 0);
state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
state = yield msg("key", { key: "VK_UP", modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1);
// If the settings button is selected, pressing alt+up/down should select the
@ -274,13 +274,13 @@ add_task(function* cycleOneOffs() {
state = yield msg("key", "VK_TAB"); // Settings button selected.
checkState(state, "xbar", ["xfoo", "xbar"], 1, 2);
state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
state = yield msg("key", { key: "VK_UP", modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1, 1);
state = yield msg("key", "VK_TAB");
checkState(state, "xbar", ["xfoo", "xbar"], 1, 2);
state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
state = yield msg("key", { key: "VK_DOWN", modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1, 0);
yield msg("removeLastOneOff");
@ -418,7 +418,7 @@ add_task(function* search() {
// Test typing a query and pressing enter.
let p = msg("waitForSearch");
yield msg("key", { key: "x", waitForSuggestions: true });
yield msg("key", { key: "VK_RETURN", modifiers: modifiers });
yield msg("key", { key: "VK_RETURN", modifiers });
let mesg = yield p;
let eventData = {
engineName: TEST_ENGINE_PREFIX + " " + TEST_ENGINE_BASENAME,
@ -437,7 +437,7 @@ add_task(function* search() {
yield msg("key", { key: "x", waitForSuggestions: true });
yield msg("key", "VK_DOWN");
yield msg("key", "VK_DOWN");
yield msg("key", { key: "VK_RETURN", modifiers: modifiers });
yield msg("key", { key: "VK_RETURN", modifiers });
mesg = yield p;
eventData.searchString = "xfoo";
eventData.engineName = TEST_ENGINE_PREFIX + " " + TEST_ENGINE_BASENAME;
@ -455,7 +455,7 @@ add_task(function* search() {
yield msg("key", { key: "x", waitForSuggestions: true });
yield msg("key", "VK_UP");
yield msg("key", "VK_UP");
yield msg("key", { key: "VK_RETURN", modifiers: modifiers });
yield msg("key", { key: "VK_RETURN", modifiers });
mesg = yield p;
delete eventData.selection;
eventData.searchString = "x";
@ -470,7 +470,7 @@ add_task(function* search() {
modifiers.button = 0;
yield msg("key", { key: "x", waitForSuggestions: true });
yield msg("mousemove", -1);
yield msg("click", { eltIdx: -1, modifiers: modifiers });
yield msg("click", { eltIdx: -1, modifiers });
mesg = yield p;
eventData.originalEvent = modifiers;
eventData.engineName = TEST_ENGINE_PREFIX + " " + TEST_ENGINE_BASENAME;
@ -483,7 +483,7 @@ add_task(function* search() {
yield msg("key", { key: "x", waitForSuggestions: true });
p = msg("waitForSearch");
yield msg("mousemove", 1);
yield msg("click", { eltIdx: 1, modifiers: modifiers });
yield msg("click", { eltIdx: 1, modifiers });
mesg = yield p;
eventData.searchString = "xfoo";
eventData.selection = {
@ -499,7 +499,7 @@ add_task(function* search() {
yield msg("key", { key: "x", waitForSuggestions: true });
p = msg("waitForSearch");
yield msg("mousemove", 3);
yield msg("click", { eltIdx: 3, modifiers: modifiers });
yield msg("click", { eltIdx: 3, modifiers });
mesg = yield p;
eventData.searchString = "x";
eventData.engineName = TEST_ENGINE_PREFIX + " " + TEST_ENGINE_2_BASENAME;
@ -515,7 +515,7 @@ add_task(function* search() {
p = msg("waitForSearch");
yield msg("mousemove", 1);
yield msg("mousemove", 3);
yield msg("click", { eltIdx: 3, modifiers: modifiers });
yield msg("click", { eltIdx: 3, modifiers });
mesg = yield p;
eventData.searchString = "xfoo"
eventData.selection = {
@ -534,7 +534,7 @@ add_task(function* search() {
yield msg("key", "VK_DOWN");
yield msg("key", "VK_DOWN");
yield msg("key", "VK_TAB");
yield msg("key", { key: "VK_RETURN", modifiers: modifiers });
yield msg("key", { key: "VK_RETURN", modifiers });
mesg = yield p;
eventData.selection = {
index: 1,
@ -554,7 +554,7 @@ add_task(function* search() {
yield msg("commitComposition");
delete modifiers.button;
p = msg("waitForSearch");
yield msg("key", { key: "VK_RETURN", modifiers: modifiers });
yield msg("key", { key: "VK_RETURN", modifiers });
mesg = yield p;
eventData.searchString = "x"
eventData.originalEvent = modifiers;
@ -583,7 +583,7 @@ add_task(function* search() {
modifiers.button = 0;
p = msg("waitForSearch");
yield msg("click", { eltIdx: 1, modifiers: modifiers });
yield msg("click", { eltIdx: 1, modifiers });
mesg = yield p;
eventData.searchString = "xfoo";
eventData.originalEvent = modifiers;
@ -662,8 +662,8 @@ function setUp(aNoEngine) {
function msg(type, data = null) {
gMsgMan.sendAsyncMessage(TEST_MSG, {
type: type,
data: data,
type,
data,
});
let deferred = Promise.defer();
gMsgMan.addMessageListener(TEST_MSG, function onMsg(msgObj) {

Просмотреть файл

@ -500,7 +500,7 @@ add_task(function* test_contenteditable() {
add_task(function* test_copylinkcommand() {
yield test_contextmenu("#test-link", null, {
postCheckContextMenuFn: function*() {
*postCheckContextMenuFn() {
document.commandDispatcher
.getControllerForCommand("cmd_copyLink")
.doCommand("cmd_copyLink");
@ -562,7 +562,7 @@ add_task(function* test_pagemenu() {
"context-viewsource", true,
"context-viewinfo", true
],
{postCheckContextMenuFn: function*() {
{*postCheckContextMenuFn() {
let item = contextMenu.getElementsByAttribute("generateditemid", "1")[0];
ok(item, "Got generated XUL menu item");
item.doCommand();
@ -820,11 +820,11 @@ add_task(function* test_click_to_play_blocked_plugin() {
"context-viewinfo", true
],
{
preCheckContextMenuFn: function*() {
*preCheckContextMenuFn() {
pushPrefs(["plugins.click_to_play", true]);
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
},
postCheckContextMenuFn: function*() {
*postCheckContextMenuFn() {
getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
}
}

Просмотреть файл

@ -80,7 +80,7 @@ add_task(function* testDevtoolsTheme() {
function dummyLightweightTheme(id) {
return {
id: id,
id,
name: id,
headerURL: "resource:///chrome/browser/content/browser/defaultthemes/devedition.header.png",
iconURL: "resource:///chrome/browser/content/browser/defaultthemes/devedition.icon.png",

Просмотреть файл

@ -60,7 +60,7 @@ function* expectFocusOnF6(backward, expectedDocument, expectedElement, onContent
details += "," + contentFM.focusedElement.id;
}
sendSyncMessage("BrowserTest:FocusChanged", { details : details });
sendSyncMessage("BrowserTest:FocusChanged", { details });
}, true);
});
}

Просмотреть файл

@ -114,7 +114,7 @@ var gTests = [
{
desc: "F11 key",
affectsFullscreenMode: true,
exitFunc: function() {
exitFunc() {
executeSoon(() => EventUtils.synthesizeKey("VK_F11", {}));
}
}

Просмотреть файл

@ -27,11 +27,11 @@ function AboutModule() {
}
AboutModule.prototype = {
newChannel: function(aURI, aLoadInfo) {
newChannel(aURI, aLoadInfo) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
},
getURIFlags: function(aURI) {
getURIFlags(aURI) {
for (let module of TEST_MODULES) {
if (aURI.path.startsWith(module.path)) {
return module.flags;
@ -42,7 +42,7 @@ AboutModule.prototype = {
return 0;
},
getIndexedDBOriginPostfix: function(aURI) {
getIndexedDBOriginPostfix(aURI) {
return null;
},
@ -50,13 +50,13 @@ AboutModule.prototype = {
};
var AboutModuleFactory = {
createInstance: function(aOuter, aIID) {
createInstance(aOuter, aIID) {
if (aOuter)
throw Components.results.NS_ERROR_NO_AGGREGATION;
return new AboutModule().QueryInterface(aIID);
},
lockFactory: function(aLock) {
lockFactory(aLock) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
},

Просмотреть файл

@ -66,7 +66,7 @@ function test_open() {
title: "test_open",
param: "",
},
finalizeFn: function() {},
finalizeFn() {},
});
}
@ -77,7 +77,7 @@ function test_open_with_size() {
title: "test_open_with_size",
param: "width=400,height=400",
},
finalizeFn: function() {},
finalizeFn() {},
});
}
@ -88,7 +88,7 @@ function test_open_with_pos() {
title: "test_open_with_pos",
param: "top=200,left=200",
},
finalizeFn: function() {},
finalizeFn() {},
});
}
@ -100,11 +100,11 @@ function test_open_with_outerSize() {
title: "test_open_with_outerSize",
param: "outerWidth=200,outerHeight=200",
},
successFn: function() {
successFn() {
is(window.outerWidth, outerWidth, "Don't change window.outerWidth.");
is(window.outerHeight, outerHeight, "Don't change window.outerHeight.");
},
finalizeFn: function() {},
finalizeFn() {},
});
}
@ -116,11 +116,11 @@ function test_open_with_innerSize() {
title: "test_open_with_innerSize",
param: "innerWidth=200,innerHeight=200",
},
successFn: function() {
successFn() {
is(window.innerWidth, innerWidth, "Don't change window.innerWidth.");
is(window.innerHeight, innerHeight, "Don't change window.innerHeight.");
},
finalizeFn: function() {},
finalizeFn() {},
});
}
@ -131,7 +131,7 @@ function test_open_with_dialog() {
title: "test_open_with_dialog",
param: "dialog=yes",
},
finalizeFn: function() {},
finalizeFn() {},
});
}
@ -148,7 +148,7 @@ function test_open_when_open_new_window_by_pref() {
title: "test_open_when_open_new_window_by_pref",
param: "width=400,height=400",
},
finalizeFn: function() {
finalizeFn() {
Services.prefs.clearUserPref(PREF_NAME);
},
});
@ -163,7 +163,7 @@ function test_open_with_pref_to_disable_in_fullscreen() {
title: "test_open_with_pref_disabled_in_fullscreen",
param: "width=400,height=400",
},
finalizeFn: function() {
finalizeFn() {
Services.prefs.setBoolPref(PREF_DISABLE_OPEN_NEW_WINDOW, true);
},
});
@ -177,7 +177,7 @@ function test_open_from_chrome() {
title: "test_open_from_chrome",
param: "",
},
finalizeFn: function() {}
finalizeFn() {}
});
}
@ -251,7 +251,7 @@ function waitForWindowOpen(aOptions) {
let listener = new WindowListener(message.title, getBrowserURL(), {
onSuccess: aOptions.successFn,
onFinalize: onFinalize,
onFinalize,
});
Services.wm.addListener(listener);
@ -292,7 +292,7 @@ function waitForWindowOpenFromChrome(aOptions) {
let listener = new WindowListener(message.title, getBrowserURL(), {
onSuccess: aOptions.successFn,
onFinalize: onFinalize,
onFinalize,
});
Services.wm.addListener(listener);
@ -312,7 +312,7 @@ WindowListener.prototype = {
callback_onSuccess: null,
callBack_onFinalize: null,
onOpenWindow: function(aXULWindow) {
onOpenWindow(aXULWindow) {
Services.wm.removeListener(this);
let domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
@ -340,8 +340,8 @@ WindowListener.prototype = {
};
domwindow.addEventListener("load", onLoad, true);
},
onCloseWindow: function(aXULWindow) {},
onWindowTitleChange: function(aXULWindow, aNewTitle) {},
onCloseWindow(aXULWindow) {},
onWindowTitleChange(aXULWindow, aNewTitle) {},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWindowMediatorListener,
Ci.nsISupports]),
};

Просмотреть файл

@ -21,7 +21,7 @@ const HTTP_ENDPOINT_WITH_KEYS = "/browser/browser/base/content/test/general/brow
var gTests = [
{
desc: "FxA OAuth - should open a new tab, complete OAuth flow",
run: function() {
run() {
return new Promise(function(resolve, reject) {
let tabOpened = false;
let properURL = "http://example.com/browser/browser/base/content/test/general/browser_fxa_oauth.html";
@ -74,7 +74,7 @@ var gTests = [
},
{
desc: "FxA OAuth - should open a new tab, complete OAuth flow when forcing auth",
run: function() {
run() {
return new Promise(function(resolve, reject) {
let tabOpened = false;
let properURL = "http://example.com/browser/browser/base/content/test/general/browser_fxa_oauth.html";
@ -131,7 +131,7 @@ var gTests = [
},
{
desc: "FxA OAuth - should receive an error when there's a state mismatch",
run: function() {
run() {
return new Promise(function(resolve, reject) {
let tabOpened = false;
@ -169,7 +169,7 @@ var gTests = [
},
{
desc: "FxA OAuth - should be able to request keys during OAuth flow",
run: function() {
run() {
return new Promise(function(resolve, reject) {
let tabOpened = false;
@ -211,7 +211,7 @@ var gTests = [
},
{
desc: "FxA OAuth - should not receive keys if not explicitly requested",
run: function() {
run() {
return new Promise(function(resolve, reject) {
let tabOpened = false;
@ -252,7 +252,7 @@ var gTests = [
},
{
desc: "FxA OAuth - should receive an error if keys could not be obtained",
run: function() {
run() {
return new Promise(function(resolve, reject) {
let tabOpened = false;

Просмотреть файл

@ -23,7 +23,7 @@ const TEST_CHANNEL_ID = "account_updates_test";
var gTests = [
{
desc: "FxA Web Channel - should receive message about profile changes",
run: function* () {
*run() {
let client = new FxAccountsWebChannel({
content_uri: TEST_HTTP_PATH,
channel_id: TEST_CHANNEL_ID,
@ -37,7 +37,7 @@ var gTests = [
});
yield BrowserTestUtils.withNewTab({
gBrowser: gBrowser,
gBrowser,
url: TEST_BASE_URL + "?profile_change"
}, function* () {
yield promiseObserver;
@ -46,7 +46,7 @@ var gTests = [
},
{
desc: "fxa web channel - login messages should notify the fxAccounts object",
run: function* () {
*run() {
let promiseLogin = new Promise((resolve, reject) => {
let login = (accountData) => {
@ -66,13 +66,13 @@ var gTests = [
content_uri: TEST_HTTP_PATH,
channel_id: TEST_CHANNEL_ID,
helpers: {
login: login
login
}
});
});
yield BrowserTestUtils.withNewTab({
gBrowser: gBrowser,
gBrowser,
url: TEST_BASE_URL + "?login"
}, function* () {
yield promiseLogin;
@ -81,7 +81,7 @@ var gTests = [
},
{
desc: "fxa web channel - can_link_account messages should respond",
run: function* () {
*run() {
let properUrl = TEST_BASE_URL + "?can_link_account";
let promiseEcho = new Promise((resolve, reject) => {
@ -114,7 +114,7 @@ var gTests = [
});
yield BrowserTestUtils.withNewTab({
gBrowser: gBrowser,
gBrowser,
url: properUrl
}, function* () {
yield promiseEcho;
@ -123,7 +123,7 @@ var gTests = [
},
{
desc: "fxa web channel - logout messages should notify the fxAccounts object",
run: function* () {
*run() {
let promiseLogout = new Promise((resolve, reject) => {
let logout = (uid) => {
Assert.equal(uid, 'uid');
@ -136,13 +136,13 @@ var gTests = [
content_uri: TEST_HTTP_PATH,
channel_id: TEST_CHANNEL_ID,
helpers: {
logout: logout
logout
}
});
});
yield BrowserTestUtils.withNewTab({
gBrowser: gBrowser,
gBrowser,
url: TEST_BASE_URL + "?logout"
}, function* () {
yield promiseLogout;
@ -151,7 +151,7 @@ var gTests = [
},
{
desc: "fxa web channel - delete messages should notify the fxAccounts object",
run: function* () {
*run() {
let promiseDelete = new Promise((resolve, reject) => {
let logout = (uid) => {
Assert.equal(uid, 'uid');
@ -164,13 +164,13 @@ var gTests = [
content_uri: TEST_HTTP_PATH,
channel_id: TEST_CHANNEL_ID,
helpers: {
logout: logout
logout
}
});
});
yield BrowserTestUtils.withNewTab({
gBrowser: gBrowser,
gBrowser,
url: TEST_BASE_URL + "?delete"
}, function* () {
yield promiseDelete;

Просмотреть файл

@ -16,7 +16,7 @@ const TEST_ROOT = "http://example.com/browser/browser/base/content/test/general/
// The stub functions.
let stubs = {
updateAppMenuItem: function() {
updateAppMenuItem() {
return unstubs['updateAppMenuItem'].call(gFxAccounts).then(() => {
Services.obs.notifyObservers(null, "test:browser_fxaccounts:updateAppMenuItem", null);
});
@ -25,7 +25,7 @@ const TEST_ROOT = "http://example.com/browser/browser/base/content/test/general/
// due to the promises it fires off at load time and there's no clear way to
// know when they are done.
// So just ensure openPreferences is called rather than whether it opens.
openPreferences: function() {
openPreferences() {
Services.obs.notifyObservers(null, "test:browser_fxaccounts:openPreferences", null);
}
};
@ -237,7 +237,7 @@ function setSignedInUser(verified) {
sessionToken: "dead",
kA: "beef",
kB: "cafe",
verified: verified,
verified,
oauthTokens: {
// a token for the profile server.

Просмотреть файл

@ -19,7 +19,7 @@ function keywordResult(aURL, aPostData, aIsUnsafe) {
function keyWordData() {}
keyWordData.prototype = {
init: function(aKeyWord, aURL, aPostData, aSearchWord) {
init(aKeyWord, aURL, aPostData, aSearchWord) {
this.keyword = aKeyWord;
this.uri = makeURI(aURL);
this.postData = aPostData;

Просмотреть файл

@ -32,7 +32,7 @@ add_task(function*() {
let setHomepagePromise = new Promise(function(resolve) {
let observer = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
observe: function(subject, topic, data) {
observe(subject, topic, data) {
is(topic, "nsPref:changed", "observed correct topic");
is(data, HOMEPAGE_PREF, "observed correct data");
let modified = Services.prefs.getComplexValue(HOMEPAGE_PREF,
@ -57,7 +57,7 @@ add_task(function*() {
function dropInvalidURI() {
return new Promise(resolve => {
let consoleListener = {
observe: function(m) {
observe(m) {
if (m.message.includes("NS_ERROR_DOM_BAD_URI")) {
ok(true, "drop was blocked");
resolve();

Просмотреть файл

@ -20,7 +20,7 @@ function test() {
waitForExplicitFinish();
let windowObserver = {
observe: function(aSubject, aTopic, aData) {
observe(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
ok(false, "Alert window opened");
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);

Просмотреть файл

@ -20,6 +20,10 @@ let whitelist = [
{sourceName: /web\/viewer\.css$/i,
errorMessage: /Unknown pseudo-class.*(fullscreen|selection)/i,
isFromDevTools: false},
// PDFjs rules needed for compat with other UAs.
{sourceName: /web\/viewer\.css$/i,
errorMessage: /Unknown property.*appearance/i,
isFromDevTools: false},
// Tracked in bug 1004428.
{sourceName: /aboutaccounts\/(main|normalize)\.css$/i,
isFromDevTools: false},

Просмотреть файл

@ -119,7 +119,7 @@ add_task(function *() {
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
for (let testid = 0; testid < checks.length; testid++) {
let menuPosition = yield ContentTask.spawn(gBrowser.selectedBrowser, { testid: testid }, function* (arg) {
let menuPosition = yield ContentTask.spawn(gBrowser.selectedBrowser, { testid }, function* (arg) {
let range = content.tests[arg.testid]();
// Get the range of the selection and determine its coordinates. These

Просмотреть файл

@ -14,7 +14,7 @@ function getMinidumpDirectory() {
// This observer is needed so we can clean up all evidence of the crash so
// the testrunner thinks things are peachy.
var CrashObserver = {
observe: function(subject, topic, data) {
observe(subject, topic, data) {
is(topic, 'ipc:content-shutdown', 'Received correct observer topic.');
ok(subject instanceof Ci.nsIPropertyBag2,
'Subject implements nsIPropertyBag2.');

Просмотреть файл

@ -31,7 +31,7 @@ function promiseDownloadRemoved(list) {
let deferred = Promise.defer();
let view = {
onDownloadRemoved: function(download) {
onDownloadRemoved(download) {
list.removeView(view);
deferred.resolve();
}
@ -58,11 +58,11 @@ function countEntries(name, message, check) {
let count;
FormHistory.count(obj, { handleResult: result => count = result,
handleError: function(error) {
handleError(error) {
deferred.reject(error)
throw new Error("Error occurred searching form history: " + error);
},
handleCompletion: function(reason) {
handleCompletion(reason) {
if (!reason) {
check(count, message);
deferred.resolve();
@ -493,11 +493,11 @@ function* setupFormHistory() {
let results = [];
FormHistory.search(terms, params, { handleResult: result => results.push(result),
handleError: function(error) {
handleError(error) {
deferred.reject(error);
throw new Error("Error occurred searching form history: " + error);
},
handleCompletion: function(reason) { deferred.resolve(results); }
handleCompletion(reason) { deferred.resolve(results); }
});
return deferred.promise;
}
@ -505,11 +505,11 @@ function* setupFormHistory() {
function update(changes)
{
let deferred = Promise.defer();
FormHistory.update(changes, { handleError: function(error) {
FormHistory.update(changes, { handleError(error) {
deferred.reject(error);
throw new Error("Error occurred searching form history: " + error);
},
handleCompletion: function(reason) { deferred.resolve(); }
handleCompletion(reason) { deferred.resolve(); }
});
return deferred.promise;
}

Просмотреть файл

@ -572,7 +572,7 @@ add_task(function* test_offline_cache() {
// Check if the cache has been deleted
var size = -1;
var visitor = {
onCacheStorageInfo: function(aEntryCount, aConsumption, aCapacity, aDiskDirectory)
onCacheStorageInfo(aEntryCount, aConsumption, aCapacity, aDiskDirectory)
{
size = aConsumption;
}
@ -583,8 +583,8 @@ add_task(function* test_offline_cache() {
};
var cacheListener = {
onCacheEntryCheck: function() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; },
onCacheEntryAvailable: function(entry, isnew, unused, status) {
onCacheEntryCheck() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; },
onCacheEntryAvailable(entry, isnew, unused, status) {
is(status, Cr.NS_OK);
var stream = entry.openOutputStream(0);
var content = "content";
@ -648,7 +648,7 @@ WindowHelper.prototype = {
/**
* "Presses" the dialog's OK button.
*/
acceptDialog: function() {
acceptDialog() {
is(this.win.document.documentElement.getButton("accept").disabled, false,
"Dialog's OK button should not be disabled");
this.win.document.documentElement.acceptDialog();
@ -657,7 +657,7 @@ WindowHelper.prototype = {
/**
* "Presses" the dialog's Cancel button.
*/
cancelDialog: function() {
cancelDialog() {
this.win.document.documentElement.cancelDialog();
},
@ -669,7 +669,7 @@ WindowHelper.prototype = {
* @param aShouldBeShown
* True if you expect the details to be shown and false if hidden
*/
checkDetails: function(aShouldBeShown) {
checkDetails(aShouldBeShown) {
let button = this.getDetailsButton();
let list = this.getItemList();
let hidden = list.hidden || list.collapsed;
@ -700,7 +700,7 @@ WindowHelper.prototype = {
* @param aCheckState
* True if the checkbox should be checked, false otherwise
*/
checkPrefCheckbox: function(aPrefName, aCheckState) {
checkPrefCheckbox(aPrefName, aCheckState) {
var pref = "privacy.cpd." + aPrefName;
var cb = this.win.document.querySelectorAll(
"#itemList > [preference='" + pref + "']");
@ -712,7 +712,7 @@ WindowHelper.prototype = {
/**
* Makes sure all the checkboxes are checked.
*/
_checkAllCheckboxesCustom: function(check) {
_checkAllCheckboxesCustom(check) {
var cb = this.win.document.querySelectorAll("#itemList > [preference]");
ok(cb.length > 1, "found checkboxes for preferences");
for (var i = 0; i < cb.length; ++i) {
@ -722,39 +722,39 @@ WindowHelper.prototype = {
}
},
checkAllCheckboxes: function() {
checkAllCheckboxes() {
this._checkAllCheckboxesCustom(true);
},
uncheckAllCheckboxes: function() {
uncheckAllCheckboxes() {
this._checkAllCheckboxesCustom(false);
},
/**
* @return The details progressive disclosure button
*/
getDetailsButton: function() {
getDetailsButton() {
return this.win.document.getElementById("detailsExpander");
},
/**
* @return The dialog's duration dropdown
*/
getDurationDropdown: function() {
getDurationDropdown() {
return this.win.document.getElementById("sanitizeDurationChoice");
},
/**
* @return The item list hidden by the details progressive disclosure button
*/
getItemList: function() {
getItemList() {
return this.win.document.getElementById("itemList");
},
/**
* @return The clear-everything warning box
*/
getWarningPanel: function() {
getWarningPanel() {
return this.win.document.getElementById("sanitizeEverythingWarningBox");
},
@ -762,7 +762,7 @@ WindowHelper.prototype = {
* @return True if the "Everything" warning panel is visible (as opposed to
* the tree)
*/
isWarningPanelVisible: function() {
isWarningPanelVisible() {
return !this.getWarningPanel().hidden;
},
@ -774,7 +774,7 @@ WindowHelper.prototype = {
* caller is expected to call waitForAsyncUpdates at some point; if false is
* returned, waitForAsyncUpdates is called automatically.
*/
open: function() {
open() {
let wh = this;
function windowObserver(aSubject, aTopic, aData) {
@ -835,7 +835,7 @@ WindowHelper.prototype = {
* @param aDurVal
* One of the Sanitizer.TIMESPAN_* values
*/
selectDuration: function(aDurVal) {
selectDuration(aDurVal) {
this.getDurationDropdown().value = aDurVal;
if (aDurVal === Sanitizer.TIMESPAN_EVERYTHING) {
is(this.isWarningPanelVisible(), true,
@ -850,7 +850,7 @@ WindowHelper.prototype = {
/**
* Toggles the details progressive disclosure button.
*/
toggleDetails: function() {
toggleDetails() {
this.getDetailsButton().click();
}
};
@ -898,11 +898,11 @@ function promiseAddFormEntryWithMinutesAgo(aMinutesAgo) {
return new Promise((resolve, reject) =>
FormHistory.update({ op: "add", fieldname: name, value: "dummy", firstUsed: timestamp },
{ handleError: function(error) {
{ handleError(error) {
reject();
throw new Error("Error occurred updating form history: " + error);
},
handleCompletion: function(reason) {
handleCompletion(reason) {
resolve(name);
}
})
@ -918,11 +918,11 @@ function formNameExists(name)
let count = 0;
FormHistory.count({ fieldname: name },
{ handleResult: result => count = result,
handleError: function(error) {
handleError(error) {
reject(error);
throw new Error("Error occurred searching form history: " + error);
},
handleCompletion: function(reason) {
handleCompletion(reason) {
if (!reason) {
resolve(count);
}

Просмотреть файл

@ -90,13 +90,13 @@ function triggerSave(aWindow, aCallback) {
var windowObserver = {
setCallback: function(aCallback) {
setCallback(aCallback) {
if (this._callback) {
ok(false, "Should only be dealing with one callback at a time.");
}
this._callback = aCallback;
},
observe: function(aSubject, aTopic, aData) {
observe(aSubject, aTopic, aData) {
if (aTopic != "domwindowopened") {
return;
}

Просмотреть файл

@ -15,17 +15,17 @@ function createTemporarySaveDirectory() {
function promiseNoCacheEntry(filename) {
return new Promise((resolve, reject) => {
Visitor.prototype = {
onCacheStorageInfo: function(num, consumption)
onCacheStorageInfo(num, consumption)
{
info("disk storage contains " + num + " entries");
},
onCacheEntryInfo: function(uri)
onCacheEntryInfo(uri)
{
let urispec = uri.asciiSpec;
info(urispec);
is(urispec.includes(filename), false, "web content present in disk cache");
},
onCacheEntryVisitCompleted: function()
onCacheEntryVisitCompleted()
{
resolve();
}

Просмотреть файл

@ -301,6 +301,7 @@ add_task(function*() {
});
elem.style = contentStep[1];
elem.getBoundingClientRect();
});
});
@ -463,6 +464,7 @@ function* performLargePopupTests(win)
yield ContentTask.spawn(browser, position, function*(contentPosition) {
let select = content.document.getElementById("one");
select.setAttribute("style", contentPosition);
select.getBoundingClientRect();
});
yield contentPainted;
}

Просмотреть файл

@ -53,7 +53,7 @@ function* getFocusedElementForBrowser(browser, dontCheckExtraFocus = false)
// additional focus related properties. This is needed as both URLs are
// loaded using the same child process and share focus managers.
browser.messageManager.sendAsyncMessage("Browser:GetFocusedElement",
{ dontCheckExtraFocus : dontCheckExtraFocus });
{ dontCheckExtraFocus });
});
}
var focusedWindow = {};
@ -113,7 +113,7 @@ function focusInChild()
}
}
sendSyncMessage("Browser:GetCurrentFocus", { details : details });
sendSyncMessage("Browser:GetCurrentFocus", { details });
});
}
@ -122,7 +122,7 @@ function focusElementInChild(elementid, type)
let browser = (elementid.indexOf("1") >= 0) ? browser1 : browser2;
if (gMultiProcessBrowser) {
browser.messageManager.sendAsyncMessage("Browser:ChangeFocus",
{ id: elementid, type: type });
{ id: elementid, type });
}
else {
browser.contentDocument.getElementById(elementid)[type]();

Просмотреть файл

@ -113,7 +113,7 @@ add_task(function*() {
});
var observer = {
reflow: function(start, end) {
reflow(start, end) {
// Gather information about the current code path.
let path = (new Error().stack).split("\n").slice(1).map(line => {
return line.replace(/:\d+:\d+$/, "");
@ -136,7 +136,7 @@ var observer = {
ok(false, "unexpected uninterruptible reflow '" + pathWithLineNumbers + "'");
},
reflowInterruptible: function(start, end) {
reflowInterruptible(start, end) {
// We're not interested in interruptible reflows.
},

Просмотреть файл

@ -28,7 +28,7 @@ function waitForSecurityChange(numChanges = 1) {
return new Promise(resolve => {
let n = 0;
let listener = {
onSecurityChange: function() {
onSecurityChange() {
n = n + 1;
info("Received onSecurityChange event " + n + " of " + numChanges);
if (n >= numChanges) {

Просмотреть файл

@ -4,7 +4,7 @@ function waitForSecurityChange(numChanges = 1) {
return new Promise(resolve => {
let n = 0;
let listener = {
onSecurityChange: function() {
onSecurityChange() {
n = n + 1;
info("Received onSecurityChange event " + n + " of " + numChanges);
if (n >= numChanges) {

Просмотреть файл

@ -1,7 +1,7 @@
function wait_while_tab_is_busy() {
return new Promise(resolve => {
let progressListener = {
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) {
onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
gBrowser.removeProgressListener(this);
setTimeout(resolve, 0);

Просмотреть файл

@ -20,7 +20,7 @@ const HTTP_REDIRECTED_IFRAME_PATH = "http://example.org";
var gTests = [
{
desc: "WebChannel generic message",
run: function* () {
*run() {
return new Promise(function(resolve, reject) {
let tab;
let channel = new WebChannel("generic", Services.io.newURI(HTTP_PATH, null, null));
@ -38,7 +38,7 @@ var gTests = [
},
{
desc: "WebChannel generic message in a private window.",
run: function* () {
*run() {
let promiseTestDone = new Promise(function(resolve, reject) {
let channel = new WebChannel("generic", Services.io.newURI(HTTP_PATH, null, null));
channel.listen(function(id, message, target) {
@ -58,7 +58,7 @@ var gTests = [
},
{
desc: "WebChannel two way communication",
run: function* () {
*run() {
return new Promise(function(resolve, reject) {
let tab;
let channel = new WebChannel("twoway", Services.io.newURI(HTTP_PATH, null, null));
@ -85,7 +85,7 @@ var gTests = [
},
{
desc: "WebChannel two way communication in an iframe",
run: function* () {
*run() {
let parentChannel = new WebChannel("echo", Services.io.newURI(HTTP_PATH, null, null));
let iframeChannel = new WebChannel("twoway", Services.io.newURI(HTTP_IFRAME_PATH, null, null));
let promiseTestDone = new Promise(function(resolve, reject) {
@ -108,7 +108,7 @@ var gTests = [
});
});
yield BrowserTestUtils.withNewTab({
gBrowser: gBrowser,
gBrowser,
url: HTTP_PATH + HTTP_ENDPOINT + "?iframe"
}, function* () {
yield promiseTestDone;
@ -119,7 +119,7 @@ var gTests = [
},
{
desc: "WebChannel response to a redirected iframe",
run: function* () {
*run() {
/**
* This test checks that WebChannel responses are only sent
* to an iframe if the iframe has not redirected to another origin.
@ -172,7 +172,7 @@ var gTests = [
});
yield BrowserTestUtils.withNewTab({
gBrowser: gBrowser,
gBrowser,
url: HTTP_PATH + HTTP_ENDPOINT + "?iframe_pre_redirect"
}, function* () {
yield promiseTestDone;
@ -183,7 +183,7 @@ var gTests = [
},
{
desc: "WebChannel multichannel",
run: function* () {
*run() {
return new Promise(function(resolve, reject) {
let tab;
let channel = new WebChannel("multichannel", Services.io.newURI(HTTP_PATH, null, null));
@ -200,7 +200,7 @@ var gTests = [
},
{
desc: "WebChannel unsolicited send, using system principal",
run: function* () {
*run() {
let channel = new WebChannel("echo", Services.io.newURI(HTTP_PATH, null, null));
// an unsolicted message is sent from Chrome->Content which is then
@ -230,7 +230,7 @@ var gTests = [
},
{
desc: "WebChannel unsolicited send, using target origin's principal",
run: function* () {
*run() {
let targetURI = Services.io.newURI(HTTP_PATH, null, null);
let channel = new WebChannel("echo", targetURI);
@ -263,7 +263,7 @@ var gTests = [
},
{
desc: "WebChannel unsolicited send with principal mismatch",
run: function* () {
*run() {
let targetURI = Services.io.newURI(HTTP_PATH, null, null);
let channel = new WebChannel("echo", targetURI);
@ -284,7 +284,7 @@ var gTests = [
});
yield BrowserTestUtils.withNewTab({
gBrowser: gBrowser,
gBrowser,
url: HTTP_PATH + HTTP_ENDPOINT + "?unsolicited"
}, function* (targetBrowser) {
@ -314,7 +314,7 @@ var gTests = [
},
{
desc: "WebChannel non-window target",
run: function* () {
*run() {
/**
* This test ensures messages can be received from and responses
* sent to non-window elements.
@ -350,7 +350,7 @@ var gTests = [
},
{
desc: "WebChannel disallows non-string message from non-whitelisted origin",
run: function* () {
*run() {
/**
* This test ensures that non-string messages can't be sent via WebChannels.
* We create a page (on a non-whitelisted origin) which should send us two
@ -377,7 +377,7 @@ var gTests = [
},
{
desc: "WebChannel allows both string and non-string message from whitelisted origin",
run: function* () {
*run() {
/**
* Same process as above, but we whitelist the origin before loading the page,
* and expect to get *both* messages back (each exactly once).
@ -419,7 +419,7 @@ var gTests = [
},
{
desc: "WebChannel errors handling the message are delivered back to content",
run: function* () {
*run() {
const ERRNO_UNKNOWN_ERROR = 999; // WebChannel.jsm doesn't export this.
// The channel where we purposely fail responding to a command.
@ -455,7 +455,7 @@ var gTests = [
},
{
desc: "WebChannel errors due to an invalid channel are delivered back to content",
run: function* () {
*run() {
const ERRNO_NO_SUCH_CHANNEL = 2; // WebChannel.jsm doesn't export this.
// The channel where we see the response when the content sees the error
let echoChannel = new WebChannel("echo", Services.io.newURI(HTTP_PATH, null, null));

Просмотреть файл

@ -109,8 +109,8 @@ function reallyRunTests() {
function sendGetBackgroundRequest(ifChanged)
{
browser1.messageManager.sendAsyncMessage("Test:GetBackgroundColor", { ifChanged: ifChanged });
browser2.messageManager.sendAsyncMessage("Test:GetBackgroundColor", { ifChanged: ifChanged });
browser1.messageManager.sendAsyncMessage("Test:GetBackgroundColor", { ifChanged });
browser2.messageManager.sendAsyncMessage("Test:GetBackgroundColor", { ifChanged });
}
function runOtherWindowTests() {
@ -177,7 +177,7 @@ function childFunction()
if (oldColor != color || !ifChanged) {
expectingResponse = false;
oldColor = color;
sendAsyncMessage("Test:BackgroundColorChanged", { color: color });
sendAsyncMessage("Test:BackgroundColorChanged", { color });
}
}, 20);
}

Просмотреть файл

@ -73,7 +73,7 @@ function test() {
}
var observer = {
reflow: function(start, end) {
reflow(start, end) {
// Gather information about the current code path.
let stack = new Error().stack;
let path = stack.split("\n").slice(1).map(line => {
@ -99,7 +99,7 @@ var observer = {
ok(false, "unexpected uninterruptible reflow '" + pathWithLineNumbers + "'");
},
reflowInterruptible: function(start, end) {
reflowInterruptible(start, end) {
// We're not interested in interruptible reflows.
},

Просмотреть файл

@ -15,7 +15,7 @@ addMessageListener(TEST_MSG, msg => {
var messageHandlers = {
init: function() {
init() {
Services.search.currentEngine = Services.search.getEngineByName(ENGINE_NAME);
let input = content.document.querySelector("input");
gController =
@ -29,19 +29,19 @@ var messageHandlers = {
});
},
key: function(arg) {
key(arg) {
let keyName = typeof(arg) == "string" ? arg : arg.key;
content.synthesizeKey(keyName, arg.modifiers || {});
let wait = arg.waitForSuggestions ? waitForSuggestions : cb => cb();
wait(ack.bind(null, "key"));
},
startComposition: function(arg) {
startComposition(arg) {
content.synthesizeComposition({ type: "compositionstart", data: "" });
ack("startComposition");
},
changeComposition: function(arg) {
changeComposition(arg) {
let data = typeof(arg) == "string" ? arg : arg.data;
content.synthesizeCompositionChange({
composition: {
@ -56,31 +56,31 @@ var messageHandlers = {
wait(ack.bind(null, "changeComposition"));
},
commitComposition: function() {
commitComposition() {
content.synthesizeComposition({ type: "compositioncommitasis" });
ack("commitComposition");
},
focus: function() {
focus() {
gController.input.focus();
ack("focus");
},
blur: function() {
blur() {
gController.input.blur();
ack("blur");
},
waitForSearch: function() {
waitForSearch() {
waitForContentSearchEvent("Search", aData => ack("waitForSearch", aData));
},
waitForSearchSettings: function() {
waitForSearchSettings() {
waitForContentSearchEvent("ManageEngines",
aData => ack("waitForSearchSettings", aData));
},
mousemove: function(itemIndex) {
mousemove(itemIndex) {
let row;
if (itemIndex == -1) {
row = gController._table.firstChild;
@ -102,7 +102,7 @@ var messageHandlers = {
content.synthesizeMouseAtCenter(row, event);
},
click: function(arg) {
click(arg) {
let eltIdx = typeof(arg) == "object" ? arg.eltIdx : arg;
let row;
if (eltIdx == -1) {
@ -121,12 +121,12 @@ var messageHandlers = {
ack("click");
},
addInputValueToFormHistory: function() {
addInputValueToFormHistory() {
gController.addInputValueToFormHistory();
ack("addInputValueToFormHistory");
},
addDuplicateOneOff: function() {
addDuplicateOneOff() {
let btn = gController._oneOffButtons[gController._oneOffButtons.length - 1];
let newBtn = btn.cloneNode(true);
btn.parentNode.appendChild(newBtn);
@ -134,12 +134,12 @@ var messageHandlers = {
ack("addDuplicateOneOff");
},
removeLastOneOff: function() {
removeLastOneOff() {
gController._oneOffButtons.pop().remove();
ack("removeLastOneOff");
},
reset: function() {
reset() {
// Reset both the input and suggestions by select all + delete. If there was
// no text entered, this won't have any effect, so also escape to ensure the
// suggestions table is closed.

Просмотреть файл

@ -307,9 +307,9 @@ function waitForAsyncUpdates(aCallback, aScope, aArguments) {
let commit = db.createAsyncStatement("COMMIT");
commit.executeAsync({
handleResult: function() {},
handleError: function() {},
handleCompletion: function(aReason) {
handleResult() {},
handleError() {},
handleCompletion(aReason) {
aCallback.apply(scope, args);
}
});
@ -418,7 +418,7 @@ function waitForDocLoadAndStopIt(aExpectedURL, aBrowser = gBrowser.selectedBrows
}
let progressListener = {
onStateChange: function(webProgress, req, flags, status) {
onStateChange(webProgress, req, flags, status) {
dump("waitForDocLoadAndStopIt: onStateChange " + flags.toString(16) + ": " + req.name + "\n");
if (webProgress.isTopLevel &&
@ -470,7 +470,7 @@ function waitForDocLoadAndStopIt(aExpectedURL, aBrowser = gBrowser.selectedBrows
function waitForDocLoadComplete(aBrowser = gBrowser) {
return new Promise(resolve => {
let listener = {
onStateChange: function(webProgress, req, flags, status) {
onStateChange(webProgress, req, flags, status) {
let docStop = Ci.nsIWebProgressListener.STATE_IS_NETWORK |
Ci.nsIWebProgressListener.STATE_STOP;
info("Saw state " + flags.toString(16) + " and status " + status.toString(16));
@ -918,12 +918,12 @@ function promiseNewSearchEngine(basename) {
info("Waiting for engine to be added: " + basename);
let url = getRootDirectory(gTestPath) + basename;
Services.search.addEngine(url, null, "", false, {
onSuccess: function(engine) {
onSuccess(engine) {
info("Search engine added: " + basename);
registerCleanupFunction(() => Services.search.removeEngine(engine));
resolve(engine);
},
onError: function(errCode) {
onError(errCode) {
Assert.ok(false, "addEngine failed with error code " + errCode);
reject();
},
@ -966,7 +966,7 @@ function isSecurityState(expectedState) {
function promiseOnBookmarkItemAdded(aExpectedURI) {
return new Promise((resolve, reject) => {
let bookmarksObserver = {
onItemAdded: function(aItemId, aFolderId, aIndex, aItemType, aURI) {
onItemAdded(aItemId, aFolderId, aIndex, aItemType, aURI) {
info("Added a bookmark to " + aURI.spec);
PlacesUtils.bookmarks.removeObserver(bookmarksObserver);
if (aURI.equals(aExpectedURI)) {
@ -976,12 +976,12 @@ function promiseOnBookmarkItemAdded(aExpectedURI) {
reject(new Error("Added an unexpected bookmark"));
}
},
onBeginUpdateBatch: function() {},
onEndUpdateBatch: function() {},
onItemRemoved: function() {},
onItemChanged: function() {},
onItemVisited: function() {},
onItemMoved: function() {},
onBeginUpdateBatch() {},
onEndUpdateBatch() {},
onItemRemoved() {},
onItemChanged() {},
onItemVisited() {},
onItemMoved() {},
QueryInterface: XPCOMUtils.generateQI([
Ci.nsINavBookmarkObserver,
])
@ -1006,7 +1006,7 @@ function* loadBadCertPage(url) {
// When the certificate exception dialog has opened, click the button to add
// an exception.
let certExceptionDialogObserver = {
observe: function(aSubject, aTopic, aData) {
observe(aSubject, aTopic, aData) {
if (aTopic == "cert-exception-ui-ready") {
Services.obs.removeObserver(this, "cert-exception-ui-ready");
let certExceptionDialog = getCertExceptionDialog(EXCEPTION_DIALOG_URI);
@ -1073,7 +1073,7 @@ function setupRemoteClientsFixture(fixture) {
Object.getOwnPropertyDescriptor(gFxAccounts, "remoteClients").get;
Object.defineProperty(gFxAccounts, "remoteClients", {
get: function() { return fixture; }
get() { return fixture; }
});
return oldRemoteClientsGetter;
}

Просмотреть файл

@ -1,7 +1,7 @@
var offlineByDefault = {
defaultValue: false,
prefBranch: SpecialPowers.Cc["@mozilla.org/preferences-service;1"].getService(SpecialPowers.Ci.nsIPrefBranch),
set: function(allow) {
set(allow) {
try {
this.defaultValue = this.prefBranch.getBoolPref("offline-apps.allow_by_default");
} catch (e) {
@ -9,7 +9,7 @@ var offlineByDefault = {
}
this.prefBranch.setBoolPref("offline-apps.allow_by_default", allow);
},
reset: function() {
reset() {
this.prefBranch.setBoolPref("offline-apps.allow_by_default", this.defaultValue);
}
}

Просмотреть файл

@ -86,7 +86,7 @@ function iterateOverPath(path, extensions) {
try {
// Iterate through the directory
yield iterator.forEach(pathEntryIterator);
resolve({files: files, subdirs: subdirs});
resolve({files, subdirs});
} catch (ex) {
reject(ex);
} finally {

Просмотреть файл

@ -38,13 +38,13 @@ function promiseAddFakeVisits() {
let place = {
uri: makeURI(URL),
title: "fake site",
visits: visits
visits
};
return new Promise((resolve, reject) => {
PlacesUtils.asyncHistory.updatePlaces(place, {
handleError: () => reject(new Error("Couldn't add visit")),
handleResult: function() {},
handleCompletion: function() {
handleResult() {},
handleCompletion() {
NewTabUtils.links.populateCache(function() {
NewTabUtils.allPages.update();
resolve();

Просмотреть файл

@ -9,7 +9,7 @@ add_task(function* () {
yield* checkGrid("0,1,2,3,4,5,6,7,8");
function doDrop(data) {
return ContentTask.spawn(gBrowser.selectedBrowser, { data: data }, function*(args) {
return ContentTask.spawn(gBrowser.selectedBrowser, { data }, function*(args) {
let dataTransfer = new content.DataTransfer("dragstart", false);
dataTransfer.mozSetDataAt("text/x-moz-url", args.data, 0);
let event = content.document.createEvent("DragEvent");

Просмотреть файл

@ -7,10 +7,10 @@ add_task(function* () {
// add a test provider that waits for load
let afterLoadProvider = {
getLinks: function(callback) {
getLinks(callback) {
this.callback = callback;
},
addObserver: function() {},
addObserver() {},
};
NewTabUtils.links.addProvider(afterLoadProvider);

Просмотреть файл

@ -76,7 +76,7 @@ add_task(function* () {
function doDragEvent(sourceIndex, dropIndex) {
return ContentTask.spawn(gBrowser.selectedBrowser,
{ sourceIndex: sourceIndex, dropIndex: dropIndex }, function*(args) {
{ sourceIndex, dropIndex }, function*(args) {
let dataTransfer = new content.DataTransfer("dragstart", false);
let event = content.document.createEvent("DragEvent");
event.initDragEvent("dragstart", true, true, content, 0, 0, 0, 0, 0,

Просмотреть файл

@ -211,12 +211,12 @@ function promiseNewSearchEngine({name: basename, numLogos}) {
let addEnginePromise = new Promise((resolve, reject) => {
let url = getRootDirectory(gTestPath) + basename;
Services.search.addEngine(url, null, "", false, {
onSuccess: function(engine) {
onSuccess(engine) {
info("Search engine added: " + basename);
gNewEngines.push(engine);
resolve(engine);
},
onError: function(errCode) {
onError(errCode) {
ok(false, "addEngine failed with error code " + errCode);
reject();
},

Просмотреть файл

@ -220,8 +220,8 @@ function fillHistory(aLinks) {
PlacesUtils.asyncHistory.updatePlaces(place, {
handleError: () => ok(false, "couldn't add visit to history"),
handleResult: function() {},
handleCompletion: function() {
handleResult() {},
handleCompletion() {
if (--numLinks == 0) {
resolve();
}

Просмотреть файл

@ -19,7 +19,7 @@ var BlocklistProxy = {
Ci.nsIBlocklistService,
Ci.nsITimerCallback]),
init: function() {
init() {
if (!this._uuid) {
this._uuid =
Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator)
@ -30,7 +30,7 @@ var BlocklistProxy = {
}
},
uninit: function() {
uninit() {
if (this._uuid) {
Cm.nsIComponentRegistrar.unregisterFactory(this._uuid, this);
Cm.nsIComponentRegistrar.registerFactory(Components.ID(kBlocklistServiceUUID),
@ -41,33 +41,33 @@ var BlocklistProxy = {
}
},
notify: function(aTimer) {
notify(aTimer) {
},
observe: function(aSubject, aTopic, aData) {
observe(aSubject, aTopic, aData) {
},
isAddonBlocklisted: function(aAddon, aAppVersion, aToolkitVersion) {
isAddonBlocklisted(aAddon, aAppVersion, aToolkitVersion) {
return false;
},
getAddonBlocklistState: function(aAddon, aAppVersion, aToolkitVersion) {
getAddonBlocklistState(aAddon, aAppVersion, aToolkitVersion) {
return 0; // STATE_NOT_BLOCKED
},
getPluginBlocklistState: function(aPluginTag, aAppVersion, aToolkitVersion) {
getPluginBlocklistState(aPluginTag, aAppVersion, aToolkitVersion) {
return 0; // STATE_NOT_BLOCKED
},
getAddonBlocklistURL: function(aAddon, aAppVersion, aToolkitVersion) {
getAddonBlocklistURL(aAddon, aAppVersion, aToolkitVersion) {
return "";
},
getPluginBlocklistURL: function(aPluginTag) {
getPluginBlocklistURL(aPluginTag) {
return "";
},
getPluginInfoURL: function(aPluginTag) {
getPluginInfoURL(aPluginTag) {
return "";
},
}

Просмотреть файл

@ -22,7 +22,7 @@ add_task(function* () {
let consoleService = Cc["@mozilla.org/consoleservice;1"]
.getService(Ci.nsIConsoleService);
let errorListener = {
observe: function(aMessage) {
observe(aMessage) {
if (aMessage.message.includes("NS_ERROR_FAILURE"))
gConsoleErrors++;
}

Просмотреть файл

@ -68,7 +68,7 @@ function preparePlugin(browser, pluginFallbackState) {
// Somehow, I'm able to get away with overriding the getter for
// this XPCOM object. Probably because I've got chrome privledges.
Object.defineProperty(plugin, "pluginFallbackType", {
get: function() {
get() {
return contentPluginFallbackState;
}
});
@ -162,7 +162,7 @@ add_task(function* testChromeHearsPluginCrashFirst() {
// actually crashing the plugin again. We hack around this by overriding
// the pluginFallbackType again.
Object.defineProperty(plugin, "pluginFallbackType", {
get: function() {
get() {
return Ci.nsIObjectLoadingContent.PLUGIN_CRASHED;
},
});

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше