Backed out 3 changesets (bug 1325464) for xpcshell failures a=backout

Backed out changeset 562ddc32cc21 (bug 1325464)
Backed out changeset cd10db6087dd (bug 1325464)
Backed out changeset 4079437c4648 (bug 1325464)
This commit is contained in:
Wes Kocher 2016-12-29 14:05:44 -08:00
Родитель 42b6140ab1
Коммит 0dfb7c2b5c
854 изменённых файлов: 8157 добавлений и 8141 удалений

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

@ -168,7 +168,7 @@ appUpdater.prototype =
* @param aChildID
* The id of the deck's child to select, e.g. "apply".
*/
selectPanel(aChildID) {
selectPanel: function(aChildID) {
let panel = document.getElementById(aChildID);
let button = panel.querySelector("button");
@ -191,7 +191,7 @@ appUpdater.prototype =
/**
* Check for updates
*/
checkForUpdates() {
checkForUpdates: function() {
// 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() {
buttonRestartAfterDownload: function() {
if (!this.isPending && !this.isApplied) {
return;
}
@ -249,7 +249,7 @@ appUpdater.prototype =
/**
* See nsIUpdateService.idl
*/
onCheckComplete(aRequest, aUpdates, aUpdateCount) {
onCheckComplete: function(aRequest, aUpdates, aUpdateCount) {
gAppUpdater.isChecking = false;
gAppUpdater.update = gAppUpdater.aus.
selectUpdate(aUpdates, aUpdates.length);
@ -281,7 +281,7 @@ appUpdater.prototype =
/**
* See nsIUpdateService.idl
*/
onError(aRequest, aUpdate) {
onError: function(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(aIID) {
QueryInterface: function(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() {
startDownload: function() {
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() {
setupDownloadingUI: function() {
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() {
removeDownloadListener: function() {
if (this.aus) {
this.aus.removeDownloadListener(this);
}
@ -339,13 +339,13 @@ appUpdater.prototype =
/**
* See nsIRequestObserver.idl
*/
onStartRequest(aRequest, aContext) {
onStartRequest: function(aRequest, aContext) {
},
/**
* See nsIRequestObserver.idl
*/
onStopRequest(aRequest, aContext, aStatusCode) {
onStopRequest: function(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(aRequest, aContext, aStatus, aStatusArg) {
onStatus: function(aRequest, aContext, aStatus, aStatusArg) {
},
/**
* See nsIProgressEventSink.idl
*/
onProgress(aRequest, aContext, aProgress, aProgressMax) {
onProgress: function(aRequest, aContext, aProgress, aProgressMax) {
this.downloadStatus.value =
DownloadUtils.getTransferTotal(aProgress, aProgressMax);
},
@ -418,7 +418,7 @@ appUpdater.prototype =
/**
* See nsISupports.idl
*/
QueryInterface(aIID) {
QueryInterface: function(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(url, urlParams) {
init: function(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() {
retry: function() {
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(aWebProgress, aRequest, aState, aStatus) {
onStateChange: function(aWebProgress, aRequest, aState, aStatus) {
let failure = false;
// Captive portals sometimes redirect users
@ -164,19 +164,19 @@ var wrapper = {
}
},
onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
onLocationChange: function(aWebProgress, aRequest, aLocation, aFlags) {
if (aRequest && aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE) {
aRequest.cancel(Components.results.NS_BINDING_ABORTED);
setErrorPage("networkError");
}
},
onProgressChange() {},
onStatusChange() {},
onSecurityChange() {},
onProgressChange: function() {},
onStatusChange: function() {},
onSecurityChange: function() {},
},
handleEvent(evt) {
handleEvent: function(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(accountData) {
onLogin: function(accountData) {
log("Received: 'login'. Data:" + JSON.stringify(accountData));
if (accountData.customizeSync) {
@ -251,16 +251,16 @@ var wrapper = {
);
},
onCanLinkAccount(accountData) {
onCanLinkAccount: function(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 } });
this.injectData("message", { status: "can_link_account", data: { ok: ok } });
},
/**
* onSignOut handler erases the current user's session from the fxaccounts service
*/
onSignOut() {
onSignOut: function() {
log("Received: 'sign_out'.");
fxAccounts.signOut().then(
@ -269,7 +269,7 @@ var wrapper = {
);
},
handleRemoteCommand(evt) {
handleRemoteCommand: function(evt) {
log('command: ' + evt.detail.command);
let data = evt.detail.data;
@ -289,11 +289,11 @@ var wrapper = {
}
},
injectData(type, content) {
injectData: function(type, content) {
return fxAccounts.promiseAccountsSignUpURI().then(authUrl => {
let data = {
type,
content
type: type,
content: 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() {
init: function() {
let iframe = document.getElementById("remote-report");
iframe.addEventListener("load", healthReportWrapper.initRemotePage, false);
iframe.src = this._getReportURI().spec;
prefs.observe("uploadEnabled", this.updatePrefState, healthReportWrapper);
},
uninit() {
uninit: function() {
prefs.ignore("uploadEnabled", this.updatePrefState, healthReportWrapper);
},
_getReportURI() {
_getReportURI: function() {
let url = Services.urlFormatter.formatURLPref(PREF_REPORTING_URL);
return Services.io.newURI(url, null, null);
},
setDataSubmission(enabled) {
setDataSubmission: function(enabled) {
MozSelfSupport.healthReportDataSubmissionEnabled = enabled;
this.updatePrefState();
},
updatePrefState() {
updatePrefState: function() {
try {
let prefsObj = {
enabled: MozSelfSupport.healthReportDataSubmissionEnabled,
@ -48,7 +48,7 @@ var healthReportWrapper = {
}
},
sendTelemetryPingList() {
sendTelemetryPingList: function() {
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(pingId) {
sendTelemetryPingData: function(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() {
sendCurrentEnvironment: function() {
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() {
sendCurrentPingData: function() {
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(type, content) {
injectData: function(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,
content
type: type,
content: content
}
let iframe = document.getElementById("remote-report");
iframe.contentWindow.postMessage(data, reportUrl);
},
handleRemoteCommand(evt) {
handleRemoteCommand: function(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() {
initRemotePage: function() {
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(error) {
reportFailure: function(error) {
let details = {
errorType: error,
}
healthReportWrapper.injectData("error", details);
},
handleInitFailure() {
handleInitFailure: function() {
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_INIT_FAILED);
},
handlePayloadFailure() {
handlePayloadFailure: function() {
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(aKey, aValue) {
set: function(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(aKey) {
delete: function(aKey) {
db.transaction(SNIPPETS_OBJECTSTORE_NAME, "readwrite")
.objectStore(SNIPPETS_OBJECTSTORE_NAME).delete(aKey);
return cache.delete(aKey);
},
clear() {
clear: function() {
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(aDocShell, aSoughtShell)
_findChildShell: function(aDocShell, aSoughtShell)
{
if (aDocShell == aSoughtShell)
return aDocShell;
@ -45,7 +45,7 @@ const gXPInstallObserver = {
return null;
},
_getBrowser(aDocShell)
_getBrowser: function(aDocShell)
{
for (let browser of gBrowser.browsers) {
if (this._findChildShell(browser.docShell, aDocShell))
@ -56,7 +56,7 @@ const gXPInstallObserver = {
pendingInstalls: new WeakMap(),
showInstallConfirmation(browser, installInfo, height = undefined) {
showInstallConfirmation: function(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(aSubject, aTopic, aData)
observe: function(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() {
callback: function() {
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() {
callback: function() {
BrowserUtils.restartApplication();
}
};
@ -472,14 +472,14 @@ const gXPInstallObserver = {
};
var LightWeightThemeWebInstaller = {
init() {
init: function() {
let mm = window.messageManager;
mm.addMessageListener("LightWeightThemeWebInstaller:Install", this);
mm.addMessageListener("LightWeightThemeWebInstaller:Preview", this);
mm.addMessageListener("LightWeightThemeWebInstaller:ResetPreview", this);
},
receiveMessage(message) {
receiveMessage: function(message) {
// ignore requests from background tabs
if (message.target != gBrowser.selectedBrowser) {
return;
@ -503,7 +503,7 @@ var LightWeightThemeWebInstaller = {
}
},
handleEvent(event) {
handleEvent: function(event) {
switch (event.type) {
case "TabSelect": {
this._resetPreview();
@ -519,7 +519,7 @@ var LightWeightThemeWebInstaller = {
return this._manager = temp.LightweightThemeManager;
},
_installRequest(dataString, baseURI) {
_installRequest: function(dataString, baseURI) {
let data = this._manager.parseTheme(dataString, baseURI);
if (!data) {
@ -560,7 +560,7 @@ var LightWeightThemeWebInstaller = {
let buttons = [{
label: allowButtonText,
accessKey: allowButtonAccesskey,
callback() {
callback: function() {
LightWeightThemeWebInstaller._install(data, notify);
}
}];
@ -575,11 +575,11 @@ var LightWeightThemeWebInstaller = {
notificationBar.persistence = 1;
},
_install(newLWTheme, notify) {
_install: function(newLWTheme, notify) {
let previousLWTheme = this._manager.currentTheme;
let listener = {
onEnabling(aAddon, aRequiresRestart) {
onEnabling: function(aAddon, aRequiresRestart) {
if (!aRequiresRestart) {
return;
}
@ -590,7 +590,7 @@ var LightWeightThemeWebInstaller = {
let action = {
label: gNavigatorBundle.getString("lwthemeNeedsRestart.button"),
accessKey: gNavigatorBundle.getString("lwthemeNeedsRestart.accesskey"),
callback() {
callback: function() {
BrowserUtils.restartApplication();
}
};
@ -604,7 +604,7 @@ var LightWeightThemeWebInstaller = {
action, null, options);
},
onEnabled(aAddon) {
onEnabled: function(aAddon) {
if (notify) {
LightWeightThemeWebInstaller._postInstallNotification(newLWTheme, previousLWTheme);
}
@ -616,7 +616,7 @@ var LightWeightThemeWebInstaller = {
AddonManager.removeAddonListener(listener);
},
_postInstallNotification(newTheme, previousTheme) {
_postInstallNotification: function(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() {
callback: function() {
LightWeightThemeWebInstaller._manager.forgetUsedTheme(newTheme.id);
LightWeightThemeWebInstaller._manager.currentTheme = previousTheme;
}
}, {
label: text("manageButton"),
accessKey: text("manageButton.accesskey"),
callback() {
callback: function() {
BrowserOpenAddonsMgr("addons://list/theme");
}
}];
@ -648,7 +648,7 @@ var LightWeightThemeWebInstaller = {
notificationBar.timeout = Date.now() + 20000; // 20 seconds
},
_removePreviousNotifications() {
_removePreviousNotifications: function() {
let box = gBrowser.getNotificationBox();
["lwtheme-install-request",
@ -659,7 +659,7 @@ var LightWeightThemeWebInstaller = {
});
},
_preview(dataString, baseURI) {
_preview: function(dataString, baseURI) {
if (!this._isAllowed(baseURI))
return;
@ -672,14 +672,14 @@ var LightWeightThemeWebInstaller = {
this._manager.previewTheme(data);
},
_resetPreview(baseURI) {
_resetPreview: function(baseURI) {
if (baseURI && !this._isAllowed(baseURI))
return;
gBrowser.tabContainer.removeEventListener("TabSelect", this, false);
this._manager.resetPreview();
},
_isAllowed(srcURIString) {
_isAllowed: function(srcURIString) {
let uri;
try {
uri = makeURI(srcURIString);
@ -704,7 +704,7 @@ var LightWeightThemeWebInstaller = {
var LightweightThemeListener = {
_modifiedStyles: [],
init() {
init: function() {
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() {
uninit: function() {
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(headerImage) {
updateStyleSheet: function(headerImage) {
if (!this.styleSheet)
return;
this.substituteRules(this.styleSheet.cssRules, headerImage);
},
substituteRules(ruleList, headerImage, existingStyleRulesModified = 0) {
substituteRules: function(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(aSubject, aTopic, aData) {
observe: function(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(host) {
opening: function(host) {
host.panel.hidden = false;
var handler = this._generateHandler(host);
@ -105,7 +105,7 @@ var tabPreviewPanelHelper = {
host._prevFocus = document.commandDispatcher.focusedElement;
},
_generateHandler(host) {
_generateHandler: function(host) {
var self = this;
return function(event) {
if (event.target == host.panel) {
@ -114,11 +114,11 @@ var tabPreviewPanelHelper = {
}
};
},
_popupshown(host) {
_popupshown: function(host) {
if ("setupGUI" in host)
host.setupGUI();
},
_popuphiding(host) {
_popuphiding: function(host) {
if ("suspendGUI" in host)
host.suspendGUI();
@ -219,7 +219,7 @@ var ctrlTab = {
else
this.uninit();
},
observe(aSubject, aTopic, aPrefName) {
observe: function(aSubject, aTopic, aPrefName) {
this.readPref();
},
@ -507,7 +507,7 @@ var ctrlTab = {
}
},
filterForThumbnailExpiration(aCallback) {
filterForThumbnailExpiration: function(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() {
_initRecentlyUsedTabs: function() {
this._recentlyUsedTabs =
Array.filter(gBrowser.tabs, tab => !tab.closing)
.sort((tab1, tab2) => tab2.lastAccessed - tab1.lastAccessed);

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

@ -9,7 +9,7 @@
* events.
*/
var CustomizationHandler = {
handleEvent(aEvent) {
handleEvent: function(aEvent) {
switch (aEvent.type) {
case "customizationstarting":
this._customizationStarting();
@ -23,11 +23,11 @@ var CustomizationHandler = {
}
},
isCustomizing() {
isCustomizing: function() {
return document.documentElement.hasAttribute("customizing");
},
_customizationStarting() {
_customizationStarting: function() {
// 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() {
_customizationChange: function() {
PlacesToolbarHelper.customizeChange();
},
_customizationEnding(aDetails) {
_customizationEnding: function(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() {
init: function() {
window.addEventListener("unload", () => {
for (let o of this._OBSERVERS) {
Services.obs.removeObserver(this, o);
@ -39,11 +39,11 @@ var gDataNotificationInfoBar = {
}
},
_getDataReportingNotification(name = this._DATA_REPORTING_NOTIFICATION) {
_getDataReportingNotification: function(name = this._DATA_REPORTING_NOTIFICATION) {
return this._notificationBox.getNotificationWithValue(name);
},
_displayDataPolicyInfoBar(request) {
_displayDataPolicyInfoBar: function(request) {
if (this._getDataReportingNotification()) {
return;
}
@ -88,7 +88,7 @@ var gDataNotificationInfoBar = {
request.onUserNotifyComplete();
},
_clearPolicyNotification() {
_clearPolicyNotification: function() {
let notification = this._getDataReportingNotification();
if (notification) {
this._log.debug("Closing notification.");
@ -96,7 +96,7 @@ var gDataNotificationInfoBar = {
}
},
observe(subject, topic, data) {
observe: function(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() {
init: function() {
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() {
createStyleSheet: function() {
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(subject, topic, data) {
observe: function(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() {
_inferBrightness: function() {
ToolbarIconColor.inferFromText();
// Get an inverted full screen button if the dark theme is applied.
if (this.isStyleSheetEnabled &&
@ -78,7 +78,7 @@ var DevEdition = {
}
},
_updateDevtoolsThemeAttribute() {
_updateDevtoolsThemeAttribute: function() {
// 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(e) {
handleEvent: function(e) {
if (e.type === "load") {
this.styleSheet.removeEventListener("load", this);
this.refreshBrowserDisplay();
}
},
refreshBrowserDisplay() {
refreshBrowserDisplay: function() {
// Don't touch things on the browser if gBrowserInit.onLoad hasn't
// yet fired.
if (this.initialized) {
@ -106,7 +106,7 @@ var DevEdition = {
}
},
_toggleStyleSheet(deveditionThemeEnabled) {
_toggleStyleSheet: function(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() {
uninit: function() {
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() {
init: function() {
this.Timeout.prototype = {
start() {
start: function() {
this.cancel();
this._id = setTimeout(() => this._handle(), this._delay);
},
cancel() {
cancel: function() {
if (this._id) {
clearTimeout(this._id);
this._id = 0;
}
},
_handle() {
_handle: function() {
this._id = 0;
this._func();
},
@ -30,13 +30,6 @@ 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
@ -47,16 +40,15 @@ var PointerlockFsWarning = {
this._func = func;
this._delay = delay;
},
/* eslint-enable object-shorthand */
showPointerLock(aOrigin) {
showPointerLock: function(aOrigin) {
if (!document.fullscreen) {
let timeout = gPrefService.getIntPref("pointer-lock-api.warning.timeout");
this.show(aOrigin, "pointerlock-warning", timeout, 0);
}
},
showFullScreen(aOrigin) {
showFullScreen: function(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);
@ -64,7 +56,7 @@ var PointerlockFsWarning = {
// Shows a warning that the site has entered fullscreen or
// pointer lock for a short duration.
show(aOrigin, elementId, timeout, delay) {
show: function(aOrigin, elementId, timeout, delay) {
if (!this._element) {
this._element = document.getElementById(elementId);
@ -119,7 +111,7 @@ var PointerlockFsWarning = {
this._timeoutHide.start();
},
close() {
close: function() {
if (!this._element) {
return;
}
@ -188,7 +180,7 @@ var PointerlockFsWarning = {
}
},
handleEvent(event) {
handleEvent: function(event) {
switch (event.type) {
case "mousemove": {
let state = this._state;
@ -234,12 +226,12 @@ var PointerlockFsWarning = {
var PointerLock = {
init() {
init: function() {
window.messageManager.addMessageListener("PointerLock:Entered", this);
window.messageManager.addMessageListener("PointerLock:Exited", this);
},
receiveMessage(aMessage) {
receiveMessage: function(aMessage) {
switch (aMessage.name) {
case "PointerLock:Entered": {
PointerlockFsWarning.showPointerLock(aMessage.data.originNoSuffix);
@ -261,7 +253,7 @@ var FullScreen = {
"DOMFullscreen:Painted",
],
init() {
init: function() {
// 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,
@ -278,14 +270,14 @@ var FullScreen = {
this.toggle();
},
uninit() {
uninit: function() {
for (let type of this._MESSAGES) {
window.messageManager.removeMessageListener(type, this);
}
this.cleanup();
},
toggle() {
toggle: function() {
var enterFS = window.fullScreen;
// Toggle the View:FullScreen command, which controls elements like the
@ -350,11 +342,11 @@ var FullScreen = {
}
},
exitDomFullScreen() {
exitDomFullScreen : function() {
document.exitFullscreen();
},
handleEvent(event) {
handleEvent: function(event) {
switch (event.type) {
case "fullscreen":
this.toggle();
@ -385,7 +377,7 @@ var FullScreen = {
}
},
receiveMessage(aMessage) {
receiveMessage: function(aMessage) {
let browser = aMessage.target;
switch (aMessage.name) {
case "DOMFullscreen:Request": {
@ -411,7 +403,7 @@ var FullScreen = {
}
},
enterDomFullscreen(aBrowser) {
enterDomFullscreen : function(aBrowser) {
if (!document.fullscreenElement) {
return;
@ -464,7 +456,7 @@ var FullScreen = {
window.addEventListener("activate", this);
},
cleanup() {
cleanup: function() {
if (!window.fullScreen) {
MousePosTracker.removeListener(this);
document.removeEventListener("keypress", this._keyToggleCallback, false);
@ -473,7 +465,7 @@ var FullScreen = {
}
},
cleanupDomFullscreen() {
cleanupDomFullscreen: function() {
window.messageManager
.broadcastAsyncMessage("DOMFullscreen:CleanUp");
@ -486,7 +478,7 @@ var FullScreen = {
document.documentElement.removeAttribute("inDOMFullscreen");
},
_isRemoteBrowser(aBrowser) {
_isRemoteBrowser: function(aBrowser) {
return gMultiProcessBrowser && aBrowser.getAttribute("remote") == "true";
},
@ -495,21 +487,21 @@ var FullScreen = {
.getInterface(Ci.nsIDOMWindowUtils);
},
getMouseTargetRect()
getMouseTargetRect: function()
{
return this._mouseTargetRect;
},
// Event callbacks
_expandCallback()
_expandCallback: function()
{
FullScreen.showNavToolbox();
},
onMouseEnter()
onMouseEnter: function()
{
FullScreen.hideNavToolbox();
},
_keyToggleCallback(aEvent)
_keyToggleCallback: function(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.
@ -524,7 +516,7 @@ var FullScreen = {
// Checks whether we are allowed to collapse the chrome
_isPopupOpen: false,
_isChromeCollapsed: false,
_safeToCollapse() {
_safeToCollapse: function() {
if (!gPrefService.getBoolPref("browser.fullscreen.autohide"))
return false;
@ -546,7 +538,7 @@ var FullScreen = {
return true;
},
_setPopupOpen(aEvent)
_setPopupOpen: function(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.
@ -564,18 +556,18 @@ var FullScreen = {
},
// Autohide helpers for the context menu item
getAutohide(aItem)
getAutohide: function(aItem)
{
aItem.setAttribute("checked", gPrefService.getBoolPref("browser.fullscreen.autohide"));
},
setAutohide()
setAutohide: function()
{
gPrefService.setBoolPref("browser.fullscreen.autohide", !gPrefService.getBoolPref("browser.fullscreen.autohide"));
// Try again to hide toolbar when we change the pref.
FullScreen.hideNavToolbox(true);
},
showNavToolbox(trackMouse = true) {
showNavToolbox: function(trackMouse = true) {
this._fullScrToggler.hidden = true;
gNavToolbox.removeAttribute("fullscreenShouldAnimate");
gNavToolbox.style.marginTop = "";
@ -599,7 +591,7 @@ var FullScreen = {
this._isChromeCollapsed = false;
},
hideNavToolbox(aAnimate = false) {
hideNavToolbox: function(aAnimate = false) {
if (this._isChromeCollapsed || !this._safeToCollapse())
return;
@ -623,7 +615,7 @@ var FullScreen = {
MousePosTracker.removeListener(this);
},
_updateToolbars(aEnterFS) {
_updateToolbars: function(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(aSubject, aTopic, aData) {
observe: function(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() { hasPref = true; },
handleResult: function() { 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(resultPref) { value = resultPref.value; },
handleResult: function(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(value, browser = gBrowser.selectedBrowser) {
setZoom: function(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(pref) { value = pref.value; },
handleResult: function(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() {
init: function() {
// 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() {
uninit: function() {
if (!this._initialized) {
return;
}
@ -119,7 +119,7 @@ var gFxAccounts = {
this._initialized = false;
},
observe(subject, topic, data) {
observe: function(subject, topic, data) {
switch (topic) {
case "fxa-migration:state-changed":
this.onMigrationStateChanged(data, subject);
@ -133,7 +133,7 @@ var gFxAccounts = {
}
},
onMigrationStateChanged() {
onMigrationStateChanged: function() {
// 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(event) {
handleEvent: function(event) {
this._inCustomizationMode = event.type == "customizationstarting";
this.updateAppMenuItem();
},
updateUI() {
updateUI: function() {
// 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() {
updateAppMenuItem: function() {
let profileInfoEnabled = false;
try {
profileInfoEnabled = Services.prefs.getBoolPref("identity.fxaccounts.profile_image.enabled");
@ -320,7 +320,7 @@ var gFxAccounts = {
});
},
onMenuPanelCommand() {
onMenuPanelCommand: function() {
switch (this.panelUIFooter.getAttribute("fxastatus")) {
case "signedin":
@ -341,11 +341,11 @@ var gFxAccounts = {
PanelUI.hide();
},
openPreferences() {
openPreferences: function() {
openPreferences("paneSync", { urlParams: { entrypoint: "menupanel" } });
},
openAccountsPage(action, urlParams = {}) {
openAccountsPage: function(action, urlParams = {}) {
let params = new URLSearchParams();
if (action) {
params.set("action", action);
@ -361,15 +361,15 @@ var gFxAccounts = {
});
},
openSignInAgainPage(entryPoint) {
openSignInAgainPage: function(entryPoint) {
this.openAccountsPage("reauth", { entrypoint: entryPoint });
},
sendTabToDevice(url, clientId, title) {
sendTabToDevice: function(url, clientId, title) {
Weave.Service.clientsEngine.sendURIToClientForDisplay(url, clientId, title);
},
populateSendTabToDevicesMenu(devicesPopup, url, title) {
populateSendTabToDevicesMenu: function(devicesPopup, url, title) {
// remove existing menu items
while (devicesPopup.hasChildNodes()) {
devicesPopup.removeChild(devicesPopup.firstChild);
@ -410,7 +410,7 @@ var gFxAccounts = {
devicesPopup.appendChild(fragment);
},
updateTabContextMenu(aPopupMenu) {
updateTabContextMenu: function(aPopupMenu) {
if (!this.sendTabToDeviceEnabled) {
return;
}
@ -420,7 +420,7 @@ var gFxAccounts = {
.forEach(id => { document.getElementById(id).hidden = !remoteClientPresent });
},
initPageContextMenu(contextMenu) {
initPageContextMenu: function(contextMenu) {
if (!this.sendTabToDeviceEnabled) {
return;
}

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

@ -351,7 +351,7 @@ var gGestureSupport = {
* @param aEvent
* The continual motion update event to handle
*/
_doUpdate(aEvent) {},
_doUpdate: function(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(aEvent) {},
_doEnd: function(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(aEvent) {
rotate: function(aEvent) {
if (!(content.document instanceof ImageDocument))
return;
@ -463,7 +463,7 @@ var gGestureSupport = {
/**
* Perform a rotation end for ImageDocuments
*/
rotateEnd() {
rotateEnd: function() {
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() {
restoreRotationState: function() {
// 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() {
_clearCompleteRotation: function() {
let contentElement = content.document &&
content.document instanceof ImageDocument &&
content.document.body &&
@ -731,7 +731,7 @@ var gHistorySwipeAnimation = {
}
},
_getCurrentHistoryIndex() {
_getCurrentHistoryIndex: function() {
return SessionStore.getSessionHistory(gBrowser.selectedTab).index;
},

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

@ -12,7 +12,7 @@ var gEMEHandler = {
}
return emeUIEnabled;
},
ensureEMEEnabled(browser, keySystem) {
ensureEMEEnabled: function(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(keySystem) {
isKeySystemVisible: function(keySystem) {
if (!keySystem) {
return false;
}
@ -41,13 +41,13 @@ var gEMEHandler = {
}
return true;
},
getLearnMoreLink(msgId) {
getLearnMoreLink: function(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({target: browser, data: data}) {
receiveMessage: function({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(browser, notificationId, keySystem, labelParams, callback) {
showNotificationBar: function(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(browser, keySystem) {
showPopupNotificationForSuccess: function(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() { openPreferences("paneContent"); },
callback: function() { openPreferences("paneContent"); },
dismiss: true
};
let options = {

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

@ -9,7 +9,7 @@ var StarUI = {
_isNewBookmark: false,
_autoCloseTimer: 0,
_element(aID) {
_element: function(aID) {
return document.getElementById(aID);
},
@ -633,10 +633,10 @@ var PlacesCommandHook = {
PlacesUIUtils.showBookmarkDialog({ action: "add"
, type: "livemark"
, feedURI
, feedURI: feedURI
, siteURI: gBrowser.currentURI
, title
, description
, title: title
, description: description
, defaultInsertionPoint: toolbarIP
, hiddenRows: [ "feedLocation"
, "siteLocation"
@ -1143,7 +1143,7 @@ var PlacesToolbarHelper = {
return !area || CustomizableUI.TYPE_MENU_PANEL == areaType;
},
onPlaceholderCommand() {
onPlaceholderCommand: function() {
let widgetGroup = CustomizableUI.getWidget("personal-bookmarks");
let widget = widgetGroup.forWindow(window);
if (widget.overflowed ||
@ -1152,7 +1152,7 @@ var PlacesToolbarHelper = {
}
},
_getParentToolbar(element) {
_getParentToolbar: function(element) {
while (element) {
if (element.localName == "toolbar") {
return element;
@ -1162,7 +1162,7 @@ var PlacesToolbarHelper = {
return null;
},
onWidgetUnderflow(aNode, aContainer) {
onWidgetUnderflow: function(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(aWidgetId, aArea, aPosition) {
onWidgetAdded: function(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() {
_resetView: function() {
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(strId) {
_getFormattedTooltip: function(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() {
_shouldUpdateStarState: function() {
return this._currentAreaType == CustomizableUI.TYPE_TOOLBAR;
},
@ -1349,7 +1349,7 @@ var BookmarkingUI = {
}
},
attachPlacesView(event, node) {
attachPlacesView: function(event, node) {
// If the view is already there, bail out early.
if (node.parentNode._placesView)
return;
@ -1577,7 +1577,7 @@ var BookmarkingUI = {
}
},
init() {
init: function() {
CustomizableUI.addListener(this);
this._updateCustomizationState();
},
@ -1757,7 +1757,7 @@ var BookmarkingUI = {
}, 1000);
},
_showSubview() {
_showSubview: function() {
let view = document.getElementById("PanelUI-bookmarks");
view.addEventListener("ViewShowing", this);
view.addEventListener("ViewHiding", this);
@ -1902,11 +1902,11 @@ var BookmarkingUI = {
}
},
onBeginUpdateBatch() {},
onEndUpdateBatch() {},
onBeforeItemRemoved() {},
onItemVisited() {},
onItemMoved() {},
onBeginUpdateBatch: function() {},
onEndUpdateBatch: function() {},
onBeforeItemRemoved: function() {},
onItemVisited: function() {},
onItemMoved: function() {},
// CustomizableUI events:
_starButtonLabel: null,
@ -1920,7 +1920,7 @@ var BookmarkingUI = {
return this._starButtonOverflowedStarredLabel =
gNavigatorBundle.getString("starButtonOverflowedStarred.label");
},
onWidgetOverflow(aNode, aContainer) {
onWidgetOverflow: function(aNode, aContainer) {
let win = aNode.ownerGlobal;
if (aNode.id != this.BOOKMARK_BUTTON_ID || win != window)
return;
@ -1936,7 +1936,7 @@ var BookmarkingUI = {
}
},
onWidgetUnderflow(aNode, aContainer) {
onWidgetUnderflow: function(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() {
init: function() {
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() {
uninit: function() {
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(event) {
handleEvent: function(event) {
if (event.type == "unload") {
this.uninit();
}
},
receiveMessage(msg) {
receiveMessage: function(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() {
managePlugins: function() {
BrowserOpenAddonsMgr("addons://list/plugin");
},
// Callback for user clicking on the link in a click-to-play plugin
// (where the plugin has an update)
openPluginUpdatePage(pluginTag) {
openPluginUpdatePage: function(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(browser) {
reloadPage: function(browser) {
browser.reload();
},
// Callback for user clicking the help icon
openHelpPage() {
openHelpPage: function() {
openHelpLink("plugin-crashed", false);
},
@ -139,7 +139,7 @@ var gPluginHandler = {
* and activate plugins if necessary.
* aNewState should be either "allownow" "allowalways" or "block"
*/
_updatePluginPermission(aNotification, aPluginInfo, aNewState) {
_updatePluginPermission: function(aNotification, aPluginInfo, aNewState) {
let permission;
let expireType;
let expireTime;
@ -208,7 +208,7 @@ var gPluginHandler = {
});
},
showClickToPlayNotification(browser, plugins, showNow,
showClickToPlayNotification: function(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,
principal,
pluginData: pluginData,
principal: principal,
};
PopupNotifications.show(browser, "click-to-play-plugins",
"", "plugins-notification-icon",
@ -290,20 +290,20 @@ var gPluginHandler = {
browser.messageManager.sendAsyncMessage("BrowserPlugins:NotificationShown");
},
removeNotification(browser, name) {
removeNotification: function(browser, name) {
let notification = PopupNotifications.getNotification(name, browser);
if (notification)
PopupNotifications.remove(notification);
},
hideNotificationBar(browser, name) {
hideNotificationBar: function(browser, name) {
let notificationBox = gBrowser.getNotificationBox(browser);
let notification = notificationBox.getNotificationWithValue(name);
if (notification)
notificationBox.removeNotification(notification, true);
},
updateHiddenPluginUI(browser, haveInsecure, actions,
updateHiddenPluginUI: function(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() {
callback: function() {
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() {
callback: function() {
Services.telemetry.getHistogramById("PLUGINS_INFOBAR_ALLOW").
add(true);
@ -437,14 +437,14 @@ var gPluginHandler = {
}
},
contextMenuCommand(browser, plugin, command) {
contextMenuCommand: function(browser, plugin, command) {
browser.messageManager.sendAsyncMessage("BrowserPlugins:ContextMenuCommand",
{ command }, { plugin });
{ command: command }, { plugin: plugin });
},
// Crashed-plugin observer. Notified once per plugin crash, before events
// are dispatched to individual plugin instances.
NPAPIPluginCrashed(subject, topic, data) {
NPAPIPluginCrashed : function(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(browser, messageString, pluginID) {
showPluginCrashedNotification: function(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() { browser.reload(); },
callback: function() { browser.reload(); },
}];
if (AppConstants.MOZ_CRASHREPORTER &&

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

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

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

@ -4,7 +4,7 @@
var gSafeBrowsing = {
setReportPhishingMenu() {
setReportPhishingMenu: function() {
// 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(name) {
getReportURL: function(name) {
return SafeBrowsing.getReportURL(name, gBrowser.currentURI);
}
}

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

@ -258,7 +258,7 @@ var SidebarUI = {
let selBrowser = gBrowser.selectedBrowser;
selBrowser.messageManager.sendAsyncMessage("Sidebar:VisibilityChange",
{commandID, isOpen: true}
{commandID: 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, isOpen: false}
{commandID: commandID, isOpen: false}
);
BrowserUITelemetry.countSidebarEvent(commandID, "hide");
},

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

@ -39,7 +39,7 @@ var gSyncUI = {
_syncStartTime: 0,
_syncAnimationTimer: 0,
init() {
init: function() {
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() {
_loginFailed: function() {
// 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() {
_getAppName: function() {
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() {
openAddDevice: function() {
if (!Weave.Utils.ensureMPUnlocked())
return;
@ -316,11 +316,11 @@ var gSyncUI = {
"syncAddDevice", "centerscreen,chrome,resizable=no");
},
openPrefs(entryPoint) {
openPrefs: function(entryPoint) {
openPreferences("paneSync", { urlParams: { entrypoint: entryPoint } });
},
openSignInAgainPage(entryPoint = "syncbutton") {
openSignInAgainPage: function(entryPoint = "syncbutton") {
gFxAccounts.openSignInAgainPage(entryPoint);
},
@ -423,7 +423,7 @@ var gSyncUI = {
}
}),
formatLastSyncDate(date) {
formatLastSyncDate: function(date) {
let dateFormat;
let sixDaysAgo = (() => {
let tempDate = new Date();
@ -441,7 +441,7 @@ var gSyncUI = {
return this._stringBundle.formatStringFromName("lastSync2.label", [lastSyncDateString], 1);
},
onClientsSynced() {
onClientsSynced: function() {
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() {},
uninit() {},
allowedBy(condition, allow) {},
init: function() {},
uninit: function() {},
allowedBy: function(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() {
init: function() {
if (this._initialized) {
return;
}
@ -49,7 +49,7 @@ var TabsInTitlebar = {
}
},
allowedBy(condition, allow) {
allowedBy: function(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(subject, topic, data) {
observe: function(subject, topic, data) {
if (topic == "nsPref:changed")
this._readPref();
},
handleEvent(aEvent) {
handleEvent: function(aEvent) {
if (aEvent.type == "resolutionchange" && aEvent.target == window) {
this._update(true);
}
},
_onMenuMutate(aMutations) {
_onMenuMutate: function(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() {
_readPref: function() {
this.allowedBy("pref",
Services.prefs.getBoolPref(this._prefName));
},
_update(aForce = false) {
_update: function(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(type, width) {
_sizePlaceholder: function(type, width) {
Array.forEach(document.querySelectorAll(".titlebar-placeholder[type='" + type + "']"),
function(node) { node.width = width; });
},
uninit() {
uninit: function() {
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,
addonInfo,
event: event,
addonInfo: 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,
addonInfo,
browser: browser,
addonInfo: addonInfo,
documentURIObject: doc.documentURIObject,
docLocation,
charSet,
referrer,
referrerPolicy,
contentType,
contentDisposition,
selectionInfo,
docLocation: docLocation,
charSet: charSet,
referrer: referrer,
referrerPolicy: referrerPolicy,
contentType: contentType,
contentDisposition: contentDisposition,
selectionInfo: selectionInfo,
disableSetDesktopBackground: disableSetDesktopBg,
loginFillInfo,
parentAllowsMixedContent,
@ -262,7 +262,7 @@ function getSerializedSecurityInfo(docShell) {
}
var AboutNetAndCertErrorListener = {
init(chromeGlobal) {
init: function(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(msg) {
receiveMessage: function(msg) {
if (!this.isAboutCertError) {
return;
}
@ -348,7 +348,7 @@ var AboutNetAndCertErrorListener = {
content.dispatchEvent(new content.CustomEvent("AboutNetErrorCaptivePortalFreed"));
},
handleEvent(aEvent) {
handleEvent: function(aEvent) {
if (!this.isAboutNetError && !this.isAboutCertError) {
return;
}
@ -372,7 +372,7 @@ var AboutNetAndCertErrorListener = {
}
},
changedCertPrefs() {
changedCertPrefs: function() {
for (let prefName of PREF_SSL_IMPACT) {
if (Services.prefs.prefHasUserValue(prefName)) {
return true;
@ -382,7 +382,7 @@ var AboutNetAndCertErrorListener = {
return false;
},
onPageLoad(evt) {
onPageLoad: function(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(evt) {
openCaptivePortalPage: function(evt) {
sendAsyncMessage("Browser:OpenCaptivePortalPage");
},
onResetPreferences(evt) {
onResetPreferences: function(evt) {
sendAsyncMessage("Browser:ResetSSLPreferences");
},
onSetAutomatic(evt) {
onSetAutomatic: function(evt) {
sendAsyncMessage("Browser:SetSSLErrorReportAuto", {
automatic: evt.detail
});
@ -427,7 +427,7 @@ var AboutNetAndCertErrorListener = {
}
},
onOverride(evt) {
onOverride: function(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(event) {
handleEvent: function(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,
bookmark: false, referrerPolicy: referrerPolicy,
originAttributes: principal ? principal.originAttributes : {},
isContentWindowPrivate: PrivateBrowsingUtils.isContentWindowPrivate(ownerDoc.defaultView)};
@ -535,7 +535,7 @@ var ClickEventHandler = {
}
},
onCertError(targetElement, ownerDoc) {
onCertError: function(targetElement, ownerDoc) {
let docShell = ownerDoc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
@ -547,7 +547,7 @@ var ClickEventHandler = {
});
},
onAboutBlocked(targetElement, ownerDoc) {
onAboutBlocked: function(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(event, documentURI) {
onAboutNetError: function(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(event) {
_hrefAndLinkNodeForClickEvent: function(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() {
init: function() {
addEventListener("InstallBrowserTheme", this, false, true);
addEventListener("PreviewBrowserTheme", this, false, true);
addEventListener("ResetBrowserThemePreview", this, false, true);
},
handleEvent(event) {
handleEvent: function(event) {
switch (event.type) {
case "InstallBrowserTheme": {
sendAsyncMessage("LightWeightThemeWebInstaller:Install", {
@ -923,7 +923,7 @@ var LightWeightThemeWebInstallListener = {
}
},
_resetPreviewWindow() {
_resetPreviewWindow: function() {
this._previewWindow.removeEventListener("pagehide", this, true);
this._previewWindow = null;
}
@ -982,11 +982,11 @@ addMessageListener("ContextMenu:SetAsDesktopBackground", (message) => {
var PageInfoListener = {
init() {
init: function() {
addMessageListener("PageInfo:getData", this);
},
receiveMessage(message) {
receiveMessage: function(message) {
let strings = message.data.strings;
let window;
let document;
@ -1017,7 +1017,7 @@ var PageInfoListener = {
this.getMediaInfo(document, window, strings);
},
getImageInfo(imageElement) {
getImageInfo: function(imageElement) {
let imageInfo = null;
if (imageElement) {
imageInfo = {
@ -1030,7 +1030,7 @@ var PageInfoListener = {
return imageInfo;
},
getMetaInfo(document) {
getMetaInfo: function(document) {
let metaViewRows = [];
// Get the meta tags from the page.
@ -1044,7 +1044,7 @@ var PageInfoListener = {
return metaViewRows;
},
getWindowInfo(window) {
getWindowInfo: function(window) {
let windowInfo = {};
windowInfo.isTopWindow = window == window.top;
@ -1058,7 +1058,7 @@ var PageInfoListener = {
return windowInfo;
},
getDocumentInfo(document) {
getDocumentInfo: function(document) {
let docInfo = {};
docInfo.title = document.title;
docInfo.location = document.location.toString();
@ -1079,7 +1079,7 @@ var PageInfoListener = {
return docInfo;
},
getFeedsInfo(document, strings) {
getFeedsInfo: function(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(document, window, strings)
getMediaInfo: function(document, window, strings)
{
let frameList = this.goThroughFrames(document, window);
Task.spawn(() => this.processFrames(document, frameList, strings));
},
goThroughFrames(document, window)
goThroughFrames: function(document, window)
{
let frameList = [document];
if (window && window.frames.length > 0) {
@ -1130,7 +1130,7 @@ var PageInfoListener = {
return frameList;
},
*processFrames(document, frameList, strings)
processFrames: function*(document, frameList, strings)
{
let nodeCount = 0;
for (let doc of frameList) {
@ -1155,7 +1155,7 @@ var PageInfoListener = {
sendAsyncMessage("PageInfo:mediaData", {isComplete: true});
},
getMediaItems(document, strings, elem)
getMediaItems: function(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(document, url, type, alt, item, isBG)
serializeElementInfo: function(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(node)
getValueText: function(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(node)
getAltText: function(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(text)
stripWS: function(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(idx) {
selectAndUpdateInput: function(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(idx) {
suggestionAtIndex: function(idx) {
let row = this._suggestionsList.children[idx];
return row ? row.textContent : null;
},
deleteSuggestionAtIndex(idx) {
deleteSuggestionAtIndex: function(idx) {
// Only form history suggestions can be deleted.
if (this.isFormHistorySuggestionAtIndex(idx)) {
let suggestionStr = this.suggestionAtIndex(idx);
@ -215,20 +215,20 @@ ContentSearchUIController.prototype = {
}
},
isFormHistorySuggestionAtIndex(idx) {
isFormHistorySuggestionAtIndex: function(idx) {
let row = this._suggestionsList.children[idx];
return row && row.classList.contains("formHistory");
},
addInputValueToFormHistory() {
addInputValueToFormHistory: function() {
this._sendMsg("AddFormHistoryEntry", this.input.value);
},
handleEvent(event) {
handleEvent: function(event) {
this["_on" + event.type[0].toUpperCase() + event.type.substr(1)](event);
},
_onCommand(aEvent) {
_onCommand: function(aEvent) {
if (this.selectedButtonIndex == this._oneOffButtons.length) {
// Settings button was selected.
this._sendMsg("ManageEngines");
@ -242,7 +242,7 @@ ContentSearchUIController.prototype = {
}
},
search(aEvent) {
search: function(aEvent) {
if (!this.defaultEngine) {
return; // Not initialized yet.
}
@ -291,7 +291,7 @@ ContentSearchUIController.prototype = {
this.addInputValueToFormHistory();
},
_onInput() {
_onInput: function() {
if (!this.input.value) {
this._stickyInputValue = "";
this._hideSuggestions();
@ -304,7 +304,7 @@ ContentSearchUIController.prototype = {
this._updateSearchWithHeader();
},
_onKeypress(event) {
_onKeypress: function(event) {
let selectedIndexDelta = 0;
let selectedSuggestionDelta = 0;
let selectedOneOffDelta = 0;
@ -451,7 +451,7 @@ ContentSearchUIController.prototype = {
},
_currentEngineIndex: -1,
_cycleCurrentEngine(aReverse) {
_cycleCurrentEngine: function(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() {
_onFocus: function() {
if (this._mousedown) {
return;
}
@ -474,7 +474,7 @@ ContentSearchUIController.prototype = {
this._speculativeConnect();
},
_onBlur() {
_onBlur: function() {
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(event) {
_onMousemove: function(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(event) {
_onMouseup: function(event) {
if (event.button == 2) {
return;
}
this._onCommand(event);
},
_onMouseout(event) {
_onMouseout: function(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(event) {
_onClick: function(event) {
this._onMouseup(event);
},
_onContentSearchService(event) {
_onContentSearchService: function(event) {
let methodName = "_onMsg" + event.detail.type;
if (methodName in this) {
this[methodName](event.detail.data);
}
},
_onMsgFocusInput(event) {
_onMsgFocusInput: function(event) {
this.input.focus();
},
_onMsgSuggestions(suggestions) {
_onMsgSuggestions: function(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() {
_onMsgSuggestionsCancelled: function() {
if (!this._table.hidden) {
this._hideSuggestions();
}
},
_onMsgState(state) {
_onMsgState: function(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(state) {
_onMsgCurrentState: function(state) {
this._onMsgState(state);
},
_onMsgCurrentEngine(engine) {
_onMsgCurrentEngine: function(engine) {
this.defaultEngine = engine;
this._pendingOneOffRefresh = true;
},
_onMsgStrings(strings) {
_onMsgStrings: function(strings) {
this._strings = strings;
this._updateDefaultEngineHeader();
this._updateSearchWithHeader();
@ -616,7 +616,7 @@ ContentSearchUIController.prototype = {
this.input.setAttribute("placeholder", this._strings.searchPlaceholder);
},
_updateDefaultEngineHeader() {
_updateDefaultEngineHeader: function() {
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() {
_updateSearchWithHeader: function() {
if (!this._strings) {
return;
}
@ -642,13 +642,13 @@ ContentSearchUIController.prototype = {
}
},
_speculativeConnect() {
_speculativeConnect: function() {
if (this.defaultEngine) {
this._sendMsg("SpeculativeConnect", this.defaultEngine.name);
}
},
_makeTableRow(type, suggestionStr, currentRow, searchWords) {
_makeTableRow: function(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(buffer) {
_getFaviconURIFromBuffer: function(buffer) {
let blob = new Blob([buffer]);
return URL.createObjectURL(blob);
},
// Adds "@2x" to the name of the given PNG url for "retina" screens.
_getImageURIForCurrentResolution(uri) {
_getImageURIForCurrentResolution: function(uri) {
if (window.devicePixelRatio > 1) {
return uri.replace(/\.png$/, "@2x.png");
}
return uri;
},
_getSearchEngines() {
_getSearchEngines: function() {
this._sendMsg("GetState");
},
_getStrings() {
_getStrings: function() {
this._sendMsg("GetStrings");
},
_getSuggestions() {
_getSuggestions: function() {
this._stickyInputValue = this.input.value;
if (this.defaultEngine) {
this._sendMsg("GetSuggestions", {
@ -716,13 +716,13 @@ ContentSearchUIController.prototype = {
}
},
_clearSuggestionRows() {
_clearSuggestionRows: function() {
while (this._suggestionsList.firstElementChild) {
this._suggestionsList.firstElementChild.remove();
}
},
_hideSuggestions() {
_hideSuggestions: function() {
this.input.setAttribute("aria-expanded", "false");
this.selectedIndex = -1;
this.selectedButtonIndex = -1;
@ -730,7 +730,7 @@ ContentSearchUIController.prototype = {
this._table.hidden = true;
},
_indexOfTableItem(elt) {
_indexOfTableItem: function(elt) {
if (elt.classList.contains("contentSearchOneOffItem")) {
return this.numSuggestions + this._oneOffButtons.indexOf(elt);
}
@ -746,7 +746,7 @@ ContentSearchUIController.prototype = {
return elt.rowIndex;
},
_makeTable(id) {
_makeTable: function(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() {
_setUpOneOffButtons: function() {
// 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(type, data = null) {
_sendMsg: function(type, data = null) {
dispatchEvent(new CustomEvent("ContentSearchClient", {
detail: {
type,
data,
type: type,
data: data,
},
}));
},

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

@ -24,12 +24,12 @@ pageInfoTreeView.prototype = {
set rowCount(c) { throw "rowCount is a readonly property"; },
get rowCount() { return this.rows; },
setTree(tree)
setTree: function(tree)
{
this.tree = tree;
},
getCellText(row, column)
getCellText: function(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(row, column, value)
setCellValue: function(row, column, value)
{
},
setCellText(row, column, value)
setCellText: function(row, column, value)
{
this.data[row][column.index] = value;
},
addRow(row)
addRow: function(row)
{
this.rows = this.data.push(row);
this.rowCountChanged(this.rows - 1, 1);
@ -56,24 +56,24 @@ pageInfoTreeView.prototype = {
}
},
addRows(rows)
addRows: function(rows)
{
for (let row of rows) {
this.addRow(row);
}
},
rowCountChanged(index, count)
rowCountChanged: function(index, count)
{
this.tree.rowCountChanged(index, count);
},
invalidate()
invalidate: function()
{
this.tree.invalidate();
},
clear()
clear: function()
{
if (this.tree)
this.tree.rowCountChanged(0, -this.rows);
@ -81,12 +81,12 @@ pageInfoTreeView.prototype = {
this.data = [ ];
},
handleCopy(row)
handleCopy: function(row)
{
return (row < 0 || this.copycol < 0) ? "" : (this.data[row][this.copycol] || "");
},
performActionOnRow(action, row)
performActionOnRow: function(action, row)
{
if (action == "copy") {
var data = this.handleCopy(row)
@ -94,7 +94,7 @@ pageInfoTreeView.prototype = {
}
},
onPageMediaSort(columnname)
onPageMediaSort : function(columnname)
{
var tree = document.getElementById(this.treeid);
var treecol = tree.columns.getNamedColumn(columnname);
@ -121,29 +121,29 @@ pageInfoTreeView.prototype = {
this.sortcol = treecol.index;
},
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) { }
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) { }
};
// 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(entry, appCache) {
onCacheEntryCheck: function(entry, appCache) {
return Components.interfaces.nsICacheEntryOpenCallback.ENTRY_WANTED;
},
onCacheEntryAvailable(entry, isNew, appCache, status) {
onCacheEntryAvailable: function(entry, isNew, appCache, status) {
cb(entry);
}
};
@ -1004,7 +1004,7 @@ function makeBlockImage(url)
}
var imagePermissionObserver = {
observe(aSubject, aTopic, aData)
observe: function(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(aSubject, aTopic, aData)
observe: function(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(uri, windowInfo) {
init: function(uri, windowInfo) {
this.uri = uri;
this.windowInfo = windowInfo;
},
// Display the server certificate (static)
viewCert() {
viewCert : function() {
var cert = security._cert;
viewCertHelper(window, cert);
},
_getSecurityInfo() {
_getSecurityInfo : function() {
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,
isMixed,
isEV,
cert,
isBroken : isBroken,
isMixed : isMixed,
isEV : isEV,
cert : cert,
certificateTransparency : undefined
};
@ -117,21 +117,21 @@ var security = {
return retval;
}
return {
hostName,
hostName : hostName,
cAName : "",
encryptionAlgorithm : "",
encryptionStrength : 0,
version: "",
isBroken,
isMixed,
isEV,
isBroken : isBroken,
isMixed : isMixed,
isEV : isEV,
cert : null,
certificateTransparency : null
};
},
// Find the secureBrowserUI object (if present)
_getSecurityUI() {
_getSecurityUI : function() {
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(name) {
mapIssuerOrganization: function(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()
viewCookies : function()
{
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() {
viewPasswords : function() {
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(aItemName)
clearItem: function(aItemName)
{
this.items[aItemName].clear();
},
prefDomain: "",
getNameFromPreference(aPreferenceName)
getNameFromPreference: function(aPreferenceName)
{
return aPreferenceName.substr(this.prefDomain.length);
},
@ -516,7 +516,7 @@ Sanitizer.prototype = {
openWindows: {
privateStateForNewWindow: "non-private",
_canCloseWindow(aWindow) {
_canCloseWindow: function(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(aWindowList) {
_resetAllWindowClosures: function(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() {
init: function() {
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() {
uninit: function() {
Services.obs.removeObserver(this, "weave:service:login:finish");
Services.obs.removeObserver(this, "weave:engine:sync:finish");
Services.obs.removeObserver(this, "cloudsync:tabs:update");
},
createItem(attrs) {
createItem: function(attrs) {
let item = document.createElement("richlistitem");
// Copy the attributes from the argument into the item.
@ -56,7 +56,7 @@ var RemoteTabViewer = {
return item;
},
filterTabs(event) {
filterTabs: function(event) {
let val = event.target.value.toLowerCase();
let numTabs = this._tabsList.getRowCount();
let clientTabs = 0;
@ -89,7 +89,7 @@ var RemoteTabViewer = {
}
},
openSelected() {
openSelected: function() {
let items = this._tabsList.selectedItems;
let urls = [];
for (let i = 0; i < items.length; i++) {
@ -105,14 +105,14 @@ var RemoteTabViewer = {
}
},
bookmarkSingleTab() {
bookmarkSingleTab: function() {
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
, title
, uri: uri
, title: title
, hiddenRows: [ "description"
, "location"
, "loadInSidebar"
@ -120,7 +120,7 @@ var RemoteTabViewer = {
}, window.top);
},
bookmarkSelectedTabs() {
bookmarkSelectedTabs: function() {
let items = this._tabsList.selectedItems;
let URIs = [];
for (let i = 0; i < items.length; i++) {
@ -142,7 +142,7 @@ var RemoteTabViewer = {
}
},
getIcon(iconUri, defaultIcon) {
getIcon: function(iconUri, defaultIcon) {
try {
let iconURI = Weave.Utils.makeURI(iconUri);
return PlacesUtils.favicons.getFaviconLinkForIcon(iconURI).spec;
@ -158,7 +158,7 @@ var RemoteTabViewer = {
_buildListRequested: false,
buildList(forceSync) {
buildList: function(forceSync) {
if (this._waitingForBuildList) {
this._buildListRequested = true;
return;
@ -192,7 +192,7 @@ var RemoteTabViewer = {
}
},
_clearTabList() {
_clearTabList: function() {
let list = this._tabsList;
// Clear out existing richlistitems.
@ -204,7 +204,7 @@ var RemoteTabViewer = {
}
},
_generateWeaveTabList() {
_generateWeaveTabList: function() {
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() {
_generateCloudSyncTabList: function() {
let updateTabList = function(remoteTabs) {
let list = this._tabsList;
@ -275,7 +275,7 @@ var RemoteTabViewer = {
.then(updateTabList, Promise.reject.bind(Promise));
},
adjustContextMenu(event) {
adjustContextMenu: function(event) {
let mode = "all";
switch (this._tabsList.selectedItems.length) {
case 0:
@ -300,7 +300,7 @@ var RemoteTabViewer = {
}
},
_refetchTabs(force) {
_refetchTabs: function(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(subject, topic, data) {
observe: function(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(event) {
handleClick: function(event) {
if (event.target.getAttribute("type") != "tab") {
return;
}

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

@ -136,7 +136,7 @@ var Change = {
window.setTimeout(window.close, 1500);
},
onDialogAccept() {
onDialogAccept: function() {
switch (this._dialogType) {
case "UpdatePassphrase":
case "ResetPassphrase":
@ -147,7 +147,7 @@ var Change = {
return undefined;
},
doGeneratePassphrase() {
doGeneratePassphrase: function() {
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(event) {
validate: function(event) {
let valid = false;
let errorString = "";

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

@ -61,7 +61,7 @@ var gSyncSetup = {
return document.getElementById("existingServer").selectedIndex == 0;
},
init() {
init: function() {
let obs = [
["weave:service:change-passphrase", "onResetPassphrase"],
["weave:service:login:start", "onLoginStart"],
@ -121,14 +121,14 @@ var gSyncSetup = {
.getAttribute("accesskey");
},
startNewAccountSetup() {
startNewAccountSetup: function() {
if (!Weave.Utils.ensureMPUnlocked())
return;
this._settingUpNew = true;
this.wizard.pageIndex = NEW_ACCOUNT_START_PAGE;
},
useExistingAccount() {
useExistingAccount: function() {
if (!Weave.Utils.ensureMPUnlocked())
return;
this._settingUpNew = false;
@ -173,22 +173,22 @@ var gSyncSetup = {
gSyncUtils.resetPassphrase(true);
},
onResetPassphrase() {
onResetPassphrase: function() {
document.getElementById("existingPassphrase").value =
Weave.Utils.hyphenatePassphrase(Weave.Service.identity.syncKey);
this.checkFields();
this.wizard.advance();
},
onLoginStart() {
onLoginStart: function() {
this.toggleLoginFeedback(false);
},
onLoginEnd() {
onLoginEnd: function() {
this.toggleLoginFeedback(true);
},
sendCredentialsAfterSync() {
sendCredentialsAfterSync: function() {
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(stop) {
toggleLoginFeedback: function(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() {
setupInitialSync: function() {
let action = document.getElementById("mergeChoiceRadio").selectedItem.id;
switch (action) {
case "resetClient":
@ -248,11 +248,11 @@ var gSyncSetup = {
},
// fun with validation!
checkFields() {
checkFields: function() {
this.wizard.canAdvance = this.readyToAdvance();
},
readyToAdvance() {
readyToAdvance: function() {
switch (this.wizard.pageIndex) {
case INTRO_PAGE:
return false;
@ -293,7 +293,7 @@ var gSyncSetup = {
this.pin3.value.length == PIN_PART_LENGTH);
},
onEmailInput() {
onEmailInput: function() {
// 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() {
checkAccount: function() {
delete this._checkAccountTimer;
let value = Weave.Utils.normalizeAccount(
document.getElementById("weaveEmail").value);
@ -337,7 +337,7 @@ var gSyncSetup = {
this.checkFields();
},
onPasswordChange() {
onPasswordChange: function() {
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() {
onPageShow: function() {
switch (this.wizard.pageIndex) {
case PAIR_PAGE:
this.wizard.getButton("back").hidden = true;
@ -420,7 +420,7 @@ var gSyncSetup = {
}
},
onWizardAdvance() {
onWizardAdvance: function() {
// 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() {
onWizardBack: function() {
switch (this.wizard.pageIndex) {
case NEW_ACCOUNT_START_PAGE:
this.wizard.pageIndex = INTRO_PAGE;
@ -535,7 +535,7 @@ var gSyncSetup = {
return true;
},
wizardFinish() {
wizardFinish: function() {
this.setupInitialSync();
if (this.wizardType == "pair") {
@ -563,7 +563,7 @@ var gSyncSetup = {
window.close();
},
onWizardCancel() {
onWizardCancel: function() {
if (this._resettingSync)
return;
@ -572,12 +572,12 @@ var gSyncSetup = {
Weave.Service.startOver();
},
onSyncOptions() {
onSyncOptions: function() {
this._beforeOptionsPage = this.wizard.pageIndex;
this.wizard.pageIndex = OPTIONS_PAGE;
},
returnFromOptions() {
returnFromOptions: function() {
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() {
startEasySetup: function() {
// 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() {
abortEasySetup: function() {
document.getElementById("easySetupPIN1").value = "";
document.getElementById("easySetupPIN2").value = "";
document.getElementById("easySetupPIN3").value = "";
@ -702,7 +702,7 @@ var gSyncSetup = {
delete this._jpakeclient;
},
manualSetup() {
manualSetup: function() {
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(addExceptions) {
_handleNoScript: function(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() {
onExistingServerCommand: function() {
let control = document.getElementById("existingServer");
if (control.selectedIndex == 0) {
control.removeAttribute("editable");
@ -750,7 +750,7 @@ var gSyncSetup = {
this.checkFields();
},
onExistingServerInput() {
onExistingServerInput: function() {
// 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() {
onServerCommand: function() {
setVisibility(document.getElementById("TOSRow"), this._usingMainServers);
let control = document.getElementById("server");
if (!this._usingMainServers) {
@ -783,7 +783,7 @@ var gSyncSetup = {
this.checkFields();
},
onServerInput() {
onServerInput: function() {
// 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() {
checkServer: function() {
delete this._checkServerTimer;
let el = document.getElementById("server");
let valid = false;
@ -813,7 +813,7 @@ var gSyncSetup = {
this.checkFields();
},
_validateServer(element) {
_validateServer: function(element) {
let valid = false;
let val = element.value;
if (!val)
@ -859,7 +859,7 @@ var gSyncSetup = {
return valid;
},
_handleChoice() {
_handleChoice: function() {
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(element, success, string) {
_setFeedback: function(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(element, success, string) {
_setFeedbackMessage: function(element, success, string) {
let str = "";
if (string) {
try {
@ -1015,7 +1015,7 @@ var gSyncSetup = {
}
},
onStateChange(webProgress, request, stateFlags, status) {
onStateChange: function(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() {},
onStatusChange() {},
onSecurityChange() {},
onLocationChange() {}
onProgressChange: function() {},
onStatusChange: function() {},
onSecurityChange: function() {},
onLocationChange: function() {}
};
// 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(url) {
_openLink: function(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() {
changePassword: function() {
if (Weave.Utils.ensureMPUnlocked())
this.openChange("ChangePassword");
},
resetPassphrase(duringSetup) {
resetPassphrase: function(duringSetup) {
if (Weave.Utils.ensureMPUnlocked())
this.openChange("ResetPassphrase", duringSetup);
},
updatePassphrase() {
updatePassphrase: function() {
if (Weave.Utils.ensureMPUnlocked())
this.openChange("UpdatePassphrase");
},
resetPassword() {
resetPassword: function() {
this._openLink(Weave.Service.pwResetURL);
},
@ -82,7 +82,7 @@ var gSyncUtils = {
return Weave.Svc.Prefs.get(root + "termsURL");
},
openToS() {
openToS: function() {
this._openLink(this.tosURL);
},
@ -91,7 +91,7 @@ var gSyncUtils = {
return Weave.Svc.Prefs.get(root + "privacyURL");
},
openPrivacyPolicy() {
openPrivacyPolicy: function() {
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(elid, callback) {
_preparePPiframe: function(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(elid) {
passphrasePrint: function(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(elid) {
passphraseSave: function(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(el1, el2) {
validatePassword: function(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(aService) {
factory: function(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, height};
let viewport = {cssWidth: width, cssHeight: height, width: width, height: height};
app.mirror(function() {}, content, viewport, function() {}, content);
}
});
var AboutHomeListener = {
init(chromeGlobal) {
init: function(chromeGlobal) {
chromeGlobal.addEventListener('AboutHomeLoad', this, false, true);
},
@ -112,7 +112,7 @@ var AboutHomeListener = {
return content.document.documentURI.toLowerCase() == "about:home";
},
handleEvent(aEvent) {
handleEvent: function(aEvent) {
if (!this.isAboutHome) {
return;
}
@ -129,7 +129,7 @@ var AboutHomeListener = {
}
},
receiveMessage(aMessage) {
receiveMessage: function(aMessage) {
if (!this.isAboutHome) {
return;
}
@ -140,7 +140,7 @@ var AboutHomeListener = {
}
},
onUpdate(aData) {
onUpdate: function(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() {
onPageLoad: function() {
addMessageListener("AboutHome:Update", this);
addEventListener("click", this, true);
addEventListener("pagehide", this, true);
@ -163,7 +163,7 @@ var AboutHomeListener = {
sendAsyncMessage("AboutHome:RequestUpdate");
},
onClick(aEvent) {
onClick: function(aEvent) {
if (!aEvent.isTrusted || // Don't trust synthetic events
aEvent.button == 2 || aEvent.target.localName != "button") {
return;
@ -210,7 +210,7 @@ var AboutHomeListener = {
}
},
onPageHide(aEvent) {
onPageHide: function(aEvent) {
if (aEvent.target.defaultView.frameElement) {
return;
}
@ -260,7 +260,7 @@ var AboutReaderListener = {
_isLeavingReaderMode: false,
init() {
init: function() {
addEventListener("AboutReaderContentLoaded", this, false, true);
addEventListener("DOMContentLoaded", this, false);
addEventListener("pageshow", this, false);
@ -269,7 +269,7 @@ var AboutReaderListener = {
addMessageListener("Reader:PushState", this);
},
receiveMessage(message) {
receiveMessage: function(message) {
switch (message.name) {
case "Reader:ToggleReaderMode":
if (!this.isAboutReader) {
@ -294,7 +294,7 @@ var AboutReaderListener = {
return content.document.documentURI.startsWith("about:reader");
},
handleEvent(aEvent) {
handleEvent: function(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(forceNonArticle) {
updateReaderButton: function(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() {
cancelPotentialPendingReadabilityCheck: function() {
if (this._pendingReadabilityCheck) {
removeEventListener("MozAfterPaint", this._pendingReadabilityCheck);
delete this._pendingReadabilityCheck;
}
},
scheduleReadabilityCheckPostPaint(forceNonArticle) {
scheduleReadabilityCheckPostPaint: function(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(forceNonArticle, event) {
onPaintWhenWaitedFor: function(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(chromeGlobal) {
init: function(chromeGlobal) {
chromeGlobal.addEventListener("ContentSearchClient", this, true, true);
addMessageListener("ContentSearch", this);
},
handleEvent(event) {
handleEvent: function(event) {
if (this._contentWhitelisted) {
this._sendMsg(event.detail.type, event.detail.data);
}
},
receiveMessage(msg) {
receiveMessage: function(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(type, data = null) {
_sendMsg: function(type, data = null) {
sendAsyncMessage("ContentSearch", {
type,
data,
type: type,
data: data,
});
},
_fireEvent(type, data = null) {
_fireEvent: function(type, data = null) {
let event = Cu.cloneInto({
detail: {
type,
data,
type: type,
data: data,
},
}, content);
content.dispatchEvent(new content.CustomEvent("ContentSearchService",
@ -450,7 +450,7 @@ var ContentSearchMediator = {
ContentSearchMediator.init(this);
var PageStyleHandler = {
init() {
init: function() {
addMessageListener("PageStyle:Switch", this);
addMessageListener("PageStyle:Disable", this);
addEventListener("pageshow", () => this.sendStyleSheetInfo());
@ -460,23 +460,23 @@ var PageStyleHandler = {
return docShell.contentViewer;
},
sendStyleSheetInfo() {
sendStyleSheetInfo: function() {
let filteredStyleSheets = this._filterStyleSheets(this.getAllStyleSheets());
sendAsyncMessage("PageStyle:StyleSheets", {
filteredStyleSheets,
filteredStyleSheets: filteredStyleSheets,
authorStyleDisabled: this.markupDocumentViewer.authorStyleDisabled,
preferredStyleSheetSet: content.document.preferredStyleSheetSet
});
},
getAllStyleSheets(frameset = content) {
getAllStyleSheets: function(frameset = content) {
let selfSheets = Array.slice(frameset.document.styleSheets);
let subSheets = Array.map(frameset.frames, frame => this.getAllStyleSheets(frame));
return selfSheets.concat(...subSheets);
},
receiveMessage(msg) {
receiveMessage: function(msg) {
switch (msg.name) {
case "PageStyle:Switch":
this.markupDocumentViewer.authorStyleDisabled = false;
@ -491,7 +491,7 @@ var PageStyleHandler = {
this.sendStyleSheetInfo();
},
_stylesheetSwitchAll(frameset, title) {
_stylesheetSwitchAll: function(frameset, title) {
if (!title || this._stylesheetInFrame(frameset, title)) {
this._stylesheetSwitchFrame(frameset, title);
}
@ -502,7 +502,7 @@ var PageStyleHandler = {
}
},
_stylesheetSwitchFrame(frame, title) {
_stylesheetSwitchFrame: function(frame, title) {
var docStyleSheets = frame.document.styleSheets;
for (let i = 0; i < docStyleSheets.length; ++i) {
@ -515,11 +515,11 @@ var PageStyleHandler = {
}
},
_stylesheetInFrame(frame, title) {
_stylesheetInFrame: function(frame, title) {
return Array.some(frame.document.styleSheets, (styleSheet) => styleSheet.title == title);
},
_filterStyleSheets(styleSheets) {
_filterStyleSheets: function(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(originalTarget, linkURI, linkNode, isAppTab) {
onBeforeLinkTraversal: function(originalTarget, linkURI, linkNode, isAppTab) {
return BrowserUtils.onBeforeLinkTraversal(originalTarget, linkURI, linkNode, isAppTab);
},
// Check whether this URI should load in the current process
shouldLoadURI(aDocShell, aURI, aReferrer) {
shouldLoadURI: function(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(aURI) {
shouldLoadURIInThisProcess: function(aURI) {
return E10SUtils.shouldLoadURIInThisProcess(aURI);
},
// Try to reload the currently active or currently loading page in a new process.
reloadInFreshProcess(aDocShell, aURI, aReferrer) {
reloadInFreshProcess: function(aDocShell, aURI, aReferrer) {
E10SUtils.redirectLoad(aDocShell, aURI, aReferrer, true);
return true;
},
startPrerenderingDocument(aHref, aReferrer) {
startPrerenderingDocument: function(aHref, aReferrer) {
if (PrerenderContentHandler.initialized) {
PrerenderContentHandler.startPrerenderingDocument(aHref, aReferrer);
}
},
shouldSwitchToPrerenderedDocument(aHref, aReferrer, aSuccess, aFailure) {
shouldSwitchToPrerenderedDocument: function(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() {
init: function() {
addMessageListener("DOMFullscreen:Entered", this);
addMessageListener("DOMFullscreen:CleanUp", this);
addEventListener("MozDOMFullscreen:Request", this);
@ -765,7 +765,7 @@ var DOMFullscreenHandler = {
.getInterface(Ci.nsIDOMWindowUtils);
},
receiveMessage(aMessage) {
receiveMessage: function(aMessage) {
let windowUtils = this._windowUtils;
switch (aMessage.name) {
case "DOMFullscreen:Entered": {
@ -793,7 +793,7 @@ var DOMFullscreenHandler = {
}
},
handleEvent(aEvent) {
handleEvent: function(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() {
destroy: function() {
delete this.mTab;
delete this.mBrowser;
delete this.mTabBrowser;
},
_callProgressListeners() {
_callProgressListeners: function() {
Array.unshift(arguments, this.mBrowser);
return this.mTabBrowser._callProgressListeners.apply(this.mTabBrowser, arguments);
},
_shouldShowProgress(aRequest) {
_shouldShowProgress: function(aRequest) {
if (this.mBlank)
return false;
@ -591,9 +591,9 @@
return true;
},
onProgressChange(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) {
onProgressChange: function(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) {
this.mTotalProgress = aMaxTotalProgress ? aCurTotalProgress / aMaxTotalProgress : 0;
if (!this._shouldShowProgress(aRequest))
@ -608,15 +608,15 @@
aCurTotalProgress, aMaxTotalProgress]);
},
onProgressChange64(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) {
onProgressChange64: function(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) {
return this.onProgressChange(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress,
aMaxTotalProgress);
},
onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) {
if (!aRequest)
return;
@ -757,8 +757,8 @@
this.mStatus = aStatus;
},
onLocationChange(aWebProgress, aRequest, aLocation,
aFlags) {
onLocationChange: function(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(aWebProgress, aRequest, aStatus, aMessage) {
onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage) {
if (this.mBlank)
return;
@ -848,17 +848,17 @@
this.mMessage = aMessage;
},
onSecurityChange(aWebProgress, aRequest, aState) {
onSecurityChange: function(aWebProgress, aRequest, aState) {
this._callProgressListeners("onSecurityChange",
[aWebProgress, aRequest, aState]);
},
onRefreshAttempted(aWebProgress, aURI, aDelay, aSameURI) {
onRefreshAttempted: function(aWebProgress, aURI, aDelay, aSameURI) {
return this._callProgressListeners("onRefreshAttempted",
[aWebProgress, aURI, aDelay, aSameURI]);
},
QueryInterface(aIID) {
QueryInterface: function(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 };
return { usingPreloadedContent: 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(callback, timeout) {
setTimer: function(callback, timeout) {
let event = {
notify: callback
};
@ -3672,11 +3672,11 @@
return timer;
},
clearTimer(timer) {
clearTimer: function(timer) {
timer.cancel();
},
getTabState(tab) {
getTabState: function(tab) {
let state = this.tabState.get(tab);
if (state === undefined) {
return this.STATE_UNLOADED;
@ -3692,7 +3692,7 @@
}
},
setTabState(tab, state) {
setTabState: function(tab, state) {
this.setTabStateNoAction(tab, state);
let browser = tab.linkedBrowser;
@ -3715,7 +3715,7 @@
return window.windowState == window.STATE_MINIMIZED;
},
init() {
init: function() {
this.log("START");
// If we minimized the window before the switcher was activated,
@ -3735,7 +3735,7 @@
}
},
destroy() {
destroy: function() {
if (this.unloadTimer) {
this.clearTimer(this.unloadTimer);
this.unloadTimer = null;
@ -3761,7 +3761,7 @@
this.activeSuppressDisplayport.clear();
},
finish() {
finish: function() {
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() {
updateDisplay: function() {
// 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(cond) {
assert: function(cond) {
if (!cond) {
dump("Assertion failure\n" + Error().stack);
@ -3867,7 +3867,7 @@
},
// We've decided to try to load requestedTab.
loadRequestedTab() {
loadRequestedTab: function() {
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() {
preActions: function() {
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() {
postActions: function() {
// 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() {
onUnloadTimeout: function() {
this.logState("onUnloadTimeout");
this.unloadTimer = null;
this.preActions();
@ -3998,7 +3998,7 @@
},
// Fires when an ongoing load has taken too long.
onLoadTimeout() {
onLoadTimeout: function() {
this.logState("onLoadTimeout");
this.preActions();
this.loadTimer = null;
@ -4007,7 +4007,7 @@
},
// Fires when the layers become available for a tab.
onLayersReady(browser) {
onLayersReady: function(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() {
onPaint: function() {
this.maybeVisibleTabs.clear();
this.maybeFinishTabSwitch();
},
// Called when we're done clearing the layers for a tab.
onLayersCleared(browser) {
onLayersCleared: function(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(tab) {
onRemotenessChange: function(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(tab) {
onTabRemoved: function(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(tab) {
requestTab: function(tab) {
if (tab === this.requestedTab) {
return;
}
@ -4179,7 +4179,7 @@
this.postActions();
},
handleEvent(event, delayed = false) {
handleEvent: function(event, delayed = false) {
if (this._processing) {
this.setTimer(() => this.handleEvent(event, true), 0);
return;
@ -4217,7 +4217,7 @@
* timing.
*/
startTabSwitch() {
startTabSwitch: function() {
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() {
maybeFinishTabSwitch: function() {
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() {
spinnerDisplayed: function() {
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() {
spinnerHidden: function() {
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(marker) {
addMarker: function(marker) {
if (Services.profiler) {
Services.profiler.AddMarker(marker);
}
@ -4278,7 +4278,7 @@
_useDumpForLogging: false,
_logInit: false,
logging() {
logging: function() {
if (this._useDumpForLogging)
return true;
if (this._logInit)
@ -4293,14 +4293,14 @@
return this._shouldLog;
},
tinfo(tab) {
tinfo: function(tab) {
if (tab) {
return tab._tPos + "(" + tab.linkedBrowser.currentURI.spec + ")";
}
return "null";
},
log(s) {
log: function(s) {
if (!this.logging())
return;
if (this._useDumpForLogging) {
@ -4310,7 +4310,7 @@
}
},
logState(prefix) {
logState: function(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(attr, attrValue) {
getElementsByAttribute: function(attr, attrValue) {
if (attr == "anonid" && attrValue == "tabContextMenu")
return [this.self.tabContextMenu];
return [];
},
// Also support adding event listeners (forward to the tab container)
addEventListener(a, b, c) { this.self.tabContainer.addEventListener(a, b, c); },
removeEventListener(a, b, c) { this.self.tabContainer.removeEventListener(a, b, c); }
addEventListener: function(a, b, c) { this.self.tabContainer.addEventListener(a, b, c); },
removeEventListener: function(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() {
teardown: function* () {
gBrowser.removeCurrentTab();
yield signOut();
},
*run()
run: function* ()
{
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()
run: function* ()
{
// 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() {
teardown: function* () {
gBrowser.removeCurrentTab();
yield signOut();
},
*run()
run: function* ()
{
// 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()
run: function* ()
{
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()
run: function* ()
{
BrowserOffline.toggleOfflineStatus();
Services.cache2.clear();
@ -164,7 +164,7 @@ var gTests = [
{
desc: "Test action=signup - no user logged in",
teardown: () => gBrowser.removeCurrentTab(),
*run()
run: function* ()
{
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()
run: function* ()
{
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() {
teardown: function* () {
gBrowser.removeCurrentTab();
yield signOut();
},
*run()
run: function* ()
{
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() {
teardown: function* () {
gBrowser.removeCurrentTab();
yield signOut();
},
*run()
run: function* ()
{
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() {
teardown: function* () {
gBrowser.removeCurrentTab();
yield signOut();
},
*run()
run: function* ()
{
const pref = "identity.fxaccounts.migrateToDevEdition";
changedPrefs.add(pref);
@ -321,10 +321,10 @@ var gTests = [
},
{
desc: "Test observers about:accounts",
teardown() {
teardown: function() {
gBrowser.removeCurrentTab();
},
*run() {
run: function* () {
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() {
run: function* () {
// 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() {
run: function* () {
// 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() {
run: function* () {
// 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() {
run: function* () {
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() {
run: function* () {
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});
mm.sendAsyncMessage("test:check-visibilities", {ids: ids});
return deferred.promise;
}

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

@ -68,7 +68,7 @@ var gTests = [
Preferences.set("datareporting.healthreport.about.reportUrl",
HTTPS_BASE + "healthreport_testRemoteCommands.html");
}),
run(iframe)
run: function(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, params });
resolve({ pane: pane, params: 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(engine) {
onSuccess: function(engine) {
info("Search engine added: " + basename);
registerCleanupFunction(() => {
try {
@ -656,7 +656,7 @@ function promiseNewEngine(basename) {
});
resolve(engine);
},
onError(errCode) {
onError: function(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(aWebProgress, aRequest,
onProgressChange: function(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) {
},
onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
onStateChange: function(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(aWebProgress, aRequest, aLocationURI, aFlags) {
onLocationChange: function(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(aWebProgress, aRequest, aStatus, aMessage) {
onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage) {
},
onSecurityChange(aWebProgress, aRequest, aState) {
onSecurityChange: function(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(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
onStateChange: function(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(aBrowser, aWebProgress, aRequest, aLocationURI,
onLocationChange: function(aBrowser, aWebProgress, aRequest, aLocationURI,
aFlags) {
var state = "onLocationChange";
info("AllProgress: " + state + " " + aLocationURI.spec);
@ -63,12 +63,12 @@ var gAllProgressListener = {
gAllNotificationsPos++;
},
onStatusChange(aBrowser, aWebProgress, aRequest, aStatus, aMessage) {
onStatusChange: function(aBrowser, aWebProgress, aRequest, aStatus, aMessage) {
var state = "onStatusChange";
ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
},
onSecurityChange(aBrowser, aWebProgress, aRequest, aState) {
onSecurityChange: function(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() {
handleEvent: function() {
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(event) {
handleEvent: function(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(aOuter, aIid) {
createInstance: function(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() {
alert: function() {
didFail = true;
}
};
@ -47,7 +47,7 @@ const kURIs = [
var gProgressListener = {
_runCount: 0,
onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
onStateChange: function(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 },
{ element: test.element, type: test.type, index: 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(aXULWindow) {
onOpenWindow: function(aXULWindow) {
Services.wm.removeListener(this);
resolve(aXULWindow);
},
onCloseWindow(aXULWindow) {
onCloseWindow: function(aXULWindow) {
},
onWindowTitleChange(aXULWindow, aNewTitle) {
onWindowTitleChange: function(aXULWindow, aNewTitle) {
}
});
});
@ -1055,7 +1055,7 @@ function test_cancel() {
let install = notification.notification.options.installs[0];
let cancelledPromise = new Promise(resolve => {
install.addListener({
onDownloadCancelled() {
onDownloadCancelled: function() {
install.removeListener(this);
resolve();
}
@ -1124,7 +1124,7 @@ function test_failedSecurity() {
var gTestStart = null;
var XPInstallObserver = {
observe(aSubject, aTopic, aData) {
observe: function(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(aFormElement, aInvalidElements)
notifyInvalidSubmit : function(aFormElement, aInvalidElements)
{
}
};

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

@ -144,7 +144,7 @@ function test() {
AddonManager.getInstallForURL(TESTROOT + "theme.xpi", function(aInstall) {
aInstall.addListener({
onInstallEnded() {
onInstallEnded: function() {
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(aXULWindow) {
onOpenWindow: function(aXULWindow) {
info("window opened, waiting for focus");
Services.wm.removeListener(this);
@ -75,8 +75,8 @@ function addWindowListener(aURL, aCallback) {
aCallback(domwindow);
}, domwindow);
},
onCloseWindow(aXULWindow) { },
onWindowTitleChange(aXULWindow, aNewTitle) { }
onCloseWindow: function(aXULWindow) { },
onWindowTitleChange: function(aXULWindow, aNewTitle) { }
});
}
@ -98,7 +98,7 @@ TabOpenListener.prototype = {
tab: null,
browser: null,
handleEvent(event) {
handleEvent: function(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() {
return ContentTask.spawn(gBrowser.selectedBrowser, { writeDomainURL }, function* (arg) {
go: function() {
return ContentTask.spawn(gBrowser.selectedBrowser, { writeDomainURL: writeDomainURL }, function* (arg) {
let contentBody = content.document.body;
contentBody.style.backgroundImage = "url('" + arg.writeDomainURL + "')";
return "context-viewbgimage";
});
},
verify() {
verify: function() {
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() {
return ContentTask.spawn(gBrowser.selectedBrowser, { writeDomainURL }, function* (arg) {
go: function() {
return ContentTask.spawn(gBrowser.selectedBrowser, { writeDomainURL: 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() {
verify: function() {
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() {
return ContentTask.spawn(gBrowser.selectedBrowser, { writeDomainURL }, function* (arg) {
go: function() {
return ContentTask.spawn(gBrowser.selectedBrowser, { writeDomainURL: 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() {
verify: function() {
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(aDownload) {
onDownloadAdded: function(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(aDownload) {
onDownloadAdded: function(aDownload) {
downloads.push(aDownload);
if (downloads.length == 2) {
resolve();

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

@ -18,8 +18,8 @@ var gTests = [
{
desc: "Simple left click",
setup() {},
clean() {},
setup: function() {},
clean: function() {},
event: {},
targets: [ "commonlink", "mathxlink", "svgxlink", "maplink" ],
expectedInvokedMethods: [],
@ -28,8 +28,8 @@ var gTests = [
{
desc: "Ctrl/Cmd left click",
setup() {},
clean() {},
setup: function() {},
clean: function() {},
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() {
setup: function() {
gPrefService.setBoolPref("browser.altClickSave", true);
},
clean() {
clean: function() {
gPrefService.clearUserPref("browser.altClickSave");
},
event: { shiftKey: true,
@ -56,10 +56,10 @@ var gTests = [
{
desc: "Shift+Alt left click on XLinks",
setup() {
setup: function() {
gPrefService.setBoolPref("browser.altClickSave", true);
},
clean() {
clean: function() {
gPrefService.clearUserPref("browser.altClickSave");
},
event: { shiftKey: true,
@ -71,8 +71,8 @@ var gTests = [
{
desc: "Shift click",
setup() {},
clean() {},
setup: function() {},
clean: function() {},
event: { shiftKey: true },
targets: [ "commonlink", "mathxlink", "svgxlink", "maplink" ],
expectedInvokedMethods: [ "urlSecurityCheck", "openLinkIn" ],
@ -81,10 +81,10 @@ var gTests = [
{
desc: "Alt click",
setup() {
setup: function() {
gPrefService.setBoolPref("browser.altClickSave", true);
},
clean() {
clean: function() {
gPrefService.clearUserPref("browser.altClickSave");
},
event: { altKey: true },
@ -95,10 +95,10 @@ var gTests = [
{
desc: "Alt click on XLinks",
setup() {
setup: function() {
gPrefService.setBoolPref("browser.altClickSave", true);
},
clean() {
clean: function() {
gPrefService.clearUserPref("browser.altClickSave");
},
event: { altKey: true },
@ -109,8 +109,8 @@ var gTests = [
{
desc: "Panel click",
setup() {},
clean() {},
setup: function() {},
clean: function() {},
event: {},
targets: [ "panellink" ],
expectedInvokedMethods: [ "urlSecurityCheck", "loadURI" ],
@ -119,8 +119,8 @@ var gTests = [
{
desc: "Simple middle click opentab",
setup() {},
clean() {},
setup: function() {},
clean: function() {},
event: { button: 1 },
targets: [ "commonlink", "mathxlink", "svgxlink", "maplink" ],
expectedInvokedMethods: [ "urlSecurityCheck", "openLinkIn" ],
@ -129,10 +129,10 @@ var gTests = [
{
desc: "Simple middle click openwin",
setup() {
setup: function() {
gPrefService.setBoolPref("browser.tabs.opentabfor.middleclick", false);
},
clean() {
clean: function() {
gPrefService.clearUserPref("browser.tabs.opentabfor.middleclick");
},
event: { button: 1 },
@ -143,11 +143,11 @@ var gTests = [
{
desc: "Middle mouse paste",
setup() {
setup: function() {
gPrefService.setBoolPref("middlemouse.contentLoadURL", true);
gPrefService.setBoolPref("general.autoScroll", false);
},
clean() {
clean: function() {
gPrefService.clearUserPref("middlemouse.contentLoadURL");
gPrefService.clearUserPref("general.autoScroll");
},
@ -199,7 +199,7 @@ function test() {
// Click handler used to steal click events.
var gClickHandler = {
handleEvent(event) {
handleEvent: function(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 });
let state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
checkState(state, "xfoo", ["xfoo", "xbar"], 0, aSelectedButtonIndex);
state = yield msg("key", { key: "VK_DOWN", modifiers });
state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1, aSelectedButtonIndex);
state = yield msg("key", { key: "VK_DOWN", modifiers });
state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
checkState(state, "x", ["xfoo", "xbar"], -1, aSelectedButtonIndex);
state = yield msg("key", { key: "VK_DOWN", modifiers });
state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
checkState(state, "xfoo", ["xfoo", "xbar"], 0, aSelectedButtonIndex);
state = yield msg("key", { key: "VK_UP", modifiers });
state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
checkState(state, "x", ["xfoo", "xbar"], -1, aSelectedButtonIndex);
state = yield msg("key", { key: "VK_UP", modifiers });
state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1, aSelectedButtonIndex);
state = yield msg("key", { key: "VK_UP", modifiers });
state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
checkState(state, "xfoo", ["xfoo", "xbar"], 0, aSelectedButtonIndex);
state = yield msg("key", { key: "VK_UP", modifiers });
state = yield msg("key", { key: "VK_UP", modifiers: 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 });
state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1, 0);
state = yield msg("key", { key: "VK_DOWN", modifiers });
state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1, 1);
state = yield msg("key", { key: "VK_DOWN", modifiers });
state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1);
state = yield msg("key", { key: "VK_UP", modifiers });
state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1, 1);
state = yield msg("key", { key: "VK_UP", modifiers });
state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
checkState(state, "xbar", ["xfoo", "xbar"], 1, 0);
state = yield msg("key", { key: "VK_UP", modifiers });
state = yield msg("key", { key: "VK_UP", modifiers: 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 });
state = yield msg("key", { key: "VK_UP", modifiers: 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 });
state = yield msg("key", { key: "VK_DOWN", modifiers: 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 });
yield msg("key", { key: "VK_RETURN", modifiers: 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 });
yield msg("key", { key: "VK_RETURN", modifiers: 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 });
yield msg("key", { key: "VK_RETURN", modifiers: 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 });
yield msg("click", { eltIdx: -1, modifiers: 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 });
yield msg("click", { eltIdx: 1, modifiers: 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 });
yield msg("click", { eltIdx: 3, modifiers: 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 });
yield msg("click", { eltIdx: 3, modifiers: 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 });
yield msg("key", { key: "VK_RETURN", modifiers: 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 });
yield msg("key", { key: "VK_RETURN", modifiers: 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 });
yield msg("click", { eltIdx: 1, modifiers: 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,
data,
type: type,
data: 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() {
postCheckContextMenuFn: function*() {
document.commandDispatcher
.getControllerForCommand("cmd_copyLink")
.doCommand("cmd_copyLink");
@ -562,7 +562,7 @@ add_task(function* test_pagemenu() {
"context-viewsource", true,
"context-viewinfo", true
],
{*postCheckContextMenuFn() {
{postCheckContextMenuFn: function*() {
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() {
preCheckContextMenuFn: function*() {
pushPrefs(["plugins.click_to_play", true]);
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
},
*postCheckContextMenuFn() {
postCheckContextMenuFn: function*() {
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 });
sendSyncMessage("BrowserTest:FocusChanged", { details : details });
}, true);
});
}

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

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

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

@ -27,11 +27,11 @@ function AboutModule() {
}
AboutModule.prototype = {
newChannel(aURI, aLoadInfo) {
newChannel: function(aURI, aLoadInfo) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
},
getURIFlags(aURI) {
getURIFlags: function(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(aURI) {
getIndexedDBOriginPostfix: function(aURI) {
return null;
},
@ -50,13 +50,13 @@ AboutModule.prototype = {
};
var AboutModuleFactory = {
createInstance(aOuter, aIID) {
createInstance: function(aOuter, aIID) {
if (aOuter)
throw Components.results.NS_ERROR_NO_AGGREGATION;
return new AboutModule().QueryInterface(aIID);
},
lockFactory(aLock) {
lockFactory: function(aLock) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
},

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

@ -66,7 +66,7 @@ function test_open() {
title: "test_open",
param: "",
},
finalizeFn() {},
finalizeFn: function() {},
});
}
@ -77,7 +77,7 @@ function test_open_with_size() {
title: "test_open_with_size",
param: "width=400,height=400",
},
finalizeFn() {},
finalizeFn: function() {},
});
}
@ -88,7 +88,7 @@ function test_open_with_pos() {
title: "test_open_with_pos",
param: "top=200,left=200",
},
finalizeFn() {},
finalizeFn: function() {},
});
}
@ -100,11 +100,11 @@ function test_open_with_outerSize() {
title: "test_open_with_outerSize",
param: "outerWidth=200,outerHeight=200",
},
successFn() {
successFn: function() {
is(window.outerWidth, outerWidth, "Don't change window.outerWidth.");
is(window.outerHeight, outerHeight, "Don't change window.outerHeight.");
},
finalizeFn() {},
finalizeFn: function() {},
});
}
@ -116,11 +116,11 @@ function test_open_with_innerSize() {
title: "test_open_with_innerSize",
param: "innerWidth=200,innerHeight=200",
},
successFn() {
successFn: function() {
is(window.innerWidth, innerWidth, "Don't change window.innerWidth.");
is(window.innerHeight, innerHeight, "Don't change window.innerHeight.");
},
finalizeFn() {},
finalizeFn: function() {},
});
}
@ -131,7 +131,7 @@ function test_open_with_dialog() {
title: "test_open_with_dialog",
param: "dialog=yes",
},
finalizeFn() {},
finalizeFn: function() {},
});
}
@ -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() {
finalizeFn: function() {
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() {
finalizeFn: function() {
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() {}
finalizeFn: function() {}
});
}
@ -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(aXULWindow) {
onOpenWindow: function(aXULWindow) {
Services.wm.removeListener(this);
let domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
@ -340,8 +340,8 @@ WindowListener.prototype = {
};
domwindow.addEventListener("load", onLoad, true);
},
onCloseWindow(aXULWindow) {},
onWindowTitleChange(aXULWindow, aNewTitle) {},
onCloseWindow: function(aXULWindow) {},
onWindowTitleChange: function(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() {
run: function() {
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() {
run: function() {
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() {
run: function() {
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() {
run: function() {
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() {
run: function() {
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() {
run: function() {
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() {
run: function* () {
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() {
run: function* () {
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() {
run: function* () {
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() {
run: function* () {
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() {
run: function* () {
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() {
updateAppMenuItem: function() {
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() {
openPreferences: function() {
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(aKeyWord, aURL, aPostData, aSearchWord) {
init: function(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(subject, topic, data) {
observe: function(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(m) {
observe: function(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(aSubject, aTopic, aData) {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
ok(false, "Alert window opened");
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);

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

@ -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 }, function* (arg) {
let menuPosition = yield ContentTask.spawn(gBrowser.selectedBrowser, { testid: 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(subject, topic, data) {
observe: function(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(download) {
onDownloadRemoved: function(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(error) {
handleError: function(error) {
deferred.reject(error)
throw new Error("Error occurred searching form history: " + error);
},
handleCompletion(reason) {
handleCompletion: function(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(error) {
handleError: function(error) {
deferred.reject(error);
throw new Error("Error occurred searching form history: " + error);
},
handleCompletion(reason) { deferred.resolve(results); }
handleCompletion: function(reason) { deferred.resolve(results); }
});
return deferred.promise;
}
@ -505,11 +505,11 @@ function* setupFormHistory() {
function update(changes)
{
let deferred = Promise.defer();
FormHistory.update(changes, { handleError(error) {
FormHistory.update(changes, { handleError: function(error) {
deferred.reject(error);
throw new Error("Error occurred searching form history: " + error);
},
handleCompletion(reason) { deferred.resolve(); }
handleCompletion: function(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(aEntryCount, aConsumption, aCapacity, aDiskDirectory)
onCacheStorageInfo: function(aEntryCount, aConsumption, aCapacity, aDiskDirectory)
{
size = aConsumption;
}
@ -583,8 +583,8 @@ add_task(function* test_offline_cache() {
};
var cacheListener = {
onCacheEntryCheck() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; },
onCacheEntryAvailable(entry, isnew, unused, status) {
onCacheEntryCheck: function() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; },
onCacheEntryAvailable: function(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() {
acceptDialog: function() {
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() {
cancelDialog: function() {
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(aShouldBeShown) {
checkDetails: function(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(aPrefName, aCheckState) {
checkPrefCheckbox: function(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(check) {
_checkAllCheckboxesCustom: function(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() {
checkAllCheckboxes: function() {
this._checkAllCheckboxesCustom(true);
},
uncheckAllCheckboxes() {
uncheckAllCheckboxes: function() {
this._checkAllCheckboxesCustom(false);
},
/**
* @return The details progressive disclosure button
*/
getDetailsButton() {
getDetailsButton: function() {
return this.win.document.getElementById("detailsExpander");
},
/**
* @return The dialog's duration dropdown
*/
getDurationDropdown() {
getDurationDropdown: function() {
return this.win.document.getElementById("sanitizeDurationChoice");
},
/**
* @return The item list hidden by the details progressive disclosure button
*/
getItemList() {
getItemList: function() {
return this.win.document.getElementById("itemList");
},
/**
* @return The clear-everything warning box
*/
getWarningPanel() {
getWarningPanel: function() {
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() {
isWarningPanelVisible: function() {
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() {
open: function() {
let wh = this;
function windowObserver(aSubject, aTopic, aData) {
@ -835,7 +835,7 @@ WindowHelper.prototype = {
* @param aDurVal
* One of the Sanitizer.TIMESPAN_* values
*/
selectDuration(aDurVal) {
selectDuration: function(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() {
toggleDetails: function() {
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(error) {
{ handleError: function(error) {
reject();
throw new Error("Error occurred updating form history: " + error);
},
handleCompletion(reason) {
handleCompletion: function(reason) {
resolve(name);
}
})
@ -918,11 +918,11 @@ function formNameExists(name)
let count = 0;
FormHistory.count({ fieldname: name },
{ handleResult: result => count = result,
handleError(error) {
handleError: function(error) {
reject(error);
throw new Error("Error occurred searching form history: " + error);
},
handleCompletion(reason) {
handleCompletion: function(reason) {
if (!reason) {
resolve(count);
}

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

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

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

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

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

@ -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 });
sendSyncMessage("Browser:GetCurrentFocus", { details : 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 });
{ id: elementid, type: type });
}
else {
browser.contentDocument.getElementById(elementid)[type]();

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

@ -113,7 +113,7 @@ add_task(function*() {
});
var observer = {
reflow(start, end) {
reflow: function(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(start, end) {
reflowInterruptible: function(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() {
onSecurityChange: function() {
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() {
onSecurityChange: function() {
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(aWebProgress, aRequest, aStateFlags, aStatus) {
onStateChange: function(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() {
run: function* () {
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() {
run: function* () {
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() {
run: function* () {
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() {
run: function* () {
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() {
run: function* () {
/**
* 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() {
run: function* () {
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() {
run: function* () {
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() {
run: function* () {
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() {
run: function* () {
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() {
run: function* () {
/**
* 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() {
run: function* () {
/**
* 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() {
run: function* () {
/**
* 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() {
run: function* () {
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() {
run: function* () {
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 });
browser2.messageManager.sendAsyncMessage("Test:GetBackgroundColor", { ifChanged });
browser1.messageManager.sendAsyncMessage("Test:GetBackgroundColor", { ifChanged: ifChanged });
browser2.messageManager.sendAsyncMessage("Test:GetBackgroundColor", { ifChanged: ifChanged });
}
function runOtherWindowTests() {
@ -177,7 +177,7 @@ function childFunction()
if (oldColor != color || !ifChanged) {
expectingResponse = false;
oldColor = color;
sendAsyncMessage("Test:BackgroundColorChanged", { color });
sendAsyncMessage("Test:BackgroundColorChanged", { color: color });
}
}, 20);
}

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

@ -73,7 +73,7 @@ function test() {
}
var observer = {
reflow(start, end) {
reflow: function(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(start, end) {
reflowInterruptible: function(start, end) {
// We're not interested in interruptible reflows.
},

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

@ -15,7 +15,7 @@ addMessageListener(TEST_MSG, msg => {
var messageHandlers = {
init() {
init: function() {
Services.search.currentEngine = Services.search.getEngineByName(ENGINE_NAME);
let input = content.document.querySelector("input");
gController =
@ -29,19 +29,19 @@ var messageHandlers = {
});
},
key(arg) {
key: function(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(arg) {
startComposition: function(arg) {
content.synthesizeComposition({ type: "compositionstart", data: "" });
ack("startComposition");
},
changeComposition(arg) {
changeComposition: function(arg) {
let data = typeof(arg) == "string" ? arg : arg.data;
content.synthesizeCompositionChange({
composition: {
@ -56,31 +56,31 @@ var messageHandlers = {
wait(ack.bind(null, "changeComposition"));
},
commitComposition() {
commitComposition: function() {
content.synthesizeComposition({ type: "compositioncommitasis" });
ack("commitComposition");
},
focus() {
focus: function() {
gController.input.focus();
ack("focus");
},
blur() {
blur: function() {
gController.input.blur();
ack("blur");
},
waitForSearch() {
waitForSearch: function() {
waitForContentSearchEvent("Search", aData => ack("waitForSearch", aData));
},
waitForSearchSettings() {
waitForSearchSettings: function() {
waitForContentSearchEvent("ManageEngines",
aData => ack("waitForSearchSettings", aData));
},
mousemove(itemIndex) {
mousemove: function(itemIndex) {
let row;
if (itemIndex == -1) {
row = gController._table.firstChild;
@ -102,7 +102,7 @@ var messageHandlers = {
content.synthesizeMouseAtCenter(row, event);
},
click(arg) {
click: function(arg) {
let eltIdx = typeof(arg) == "object" ? arg.eltIdx : arg;
let row;
if (eltIdx == -1) {
@ -121,12 +121,12 @@ var messageHandlers = {
ack("click");
},
addInputValueToFormHistory() {
addInputValueToFormHistory: function() {
gController.addInputValueToFormHistory();
ack("addInputValueToFormHistory");
},
addDuplicateOneOff() {
addDuplicateOneOff: function() {
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() {
removeLastOneOff: function() {
gController._oneOffButtons.pop().remove();
ack("removeLastOneOff");
},
reset() {
reset: function() {
// 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() {},
handleError() {},
handleCompletion(aReason) {
handleResult: function() {},
handleError: function() {},
handleCompletion: function(aReason) {
aCallback.apply(scope, args);
}
});
@ -418,7 +418,7 @@ function waitForDocLoadAndStopIt(aExpectedURL, aBrowser = gBrowser.selectedBrows
}
let progressListener = {
onStateChange(webProgress, req, flags, status) {
onStateChange: function(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(webProgress, req, flags, status) {
onStateChange: function(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(engine) {
onSuccess: function(engine) {
info("Search engine added: " + basename);
registerCleanupFunction(() => Services.search.removeEngine(engine));
resolve(engine);
},
onError(errCode) {
onError: function(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(aItemId, aFolderId, aIndex, aItemType, aURI) {
onItemAdded: function(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() {},
onEndUpdateBatch() {},
onItemRemoved() {},
onItemChanged() {},
onItemVisited() {},
onItemMoved() {},
onBeginUpdateBatch: function() {},
onEndUpdateBatch: function() {},
onItemRemoved: function() {},
onItemChanged: function() {},
onItemVisited: function() {},
onItemMoved: function() {},
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(aSubject, aTopic, aData) {
observe: function(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() { return fixture; }
get: function() { 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(allow) {
set: function(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() {
reset: function() {
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, subdirs});
resolve({files: files, subdirs: 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() {},
handleCompletion() {
handleResult: function() {},
handleCompletion: function() {
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 }, function*(args) {
return ContentTask.spawn(gBrowser.selectedBrowser, { data: 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(callback) {
getLinks: function(callback) {
this.callback = callback;
},
addObserver() {},
addObserver: function() {},
};
NewTabUtils.links.addProvider(afterLoadProvider);

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

@ -76,7 +76,7 @@ add_task(function* () {
function doDragEvent(sourceIndex, dropIndex) {
return ContentTask.spawn(gBrowser.selectedBrowser,
{ sourceIndex, dropIndex }, function*(args) {
{ sourceIndex: sourceIndex, dropIndex: 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(engine) {
onSuccess: function(engine) {
info("Search engine added: " + basename);
gNewEngines.push(engine);
resolve(engine);
},
onError(errCode) {
onError: function(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() {},
handleCompletion() {
handleResult: function() {},
handleCompletion: function() {
if (--numLinks == 0) {
resolve();
}

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

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

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

@ -22,7 +22,7 @@ add_task(function* () {
let consoleService = Cc["@mozilla.org/consoleservice;1"]
.getService(Ci.nsIConsoleService);
let errorListener = {
observe(aMessage) {
observe: function(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() {
get: function() {
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() {
get: function() {
return Ci.nsIObjectLoadingContent.PLUGIN_CRASHED;
},
});

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

@ -17,37 +17,37 @@ function test() {
var tests = [
{ id: "Test#1",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
triggerMainCommand(popup);
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.notifyObj.mainActionClicked, "mainAction was clicked");
ok(!this.notifyObj.dismissalCallbackTriggered, "dismissal callback wasn't triggered");
ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
}
},
{ id: "Test#2",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
triggerSecondaryCommand(popup, 0);
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.notifyObj.secondaryActionClicked, "secondaryAction was clicked");
ok(!this.notifyObj.dismissalCallbackTriggered, "dismissal callback wasn't triggered");
ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
}
},
{ id: "Test#2b",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.secondaryActions.push({
label: "Extra Secondary Action",
@ -56,18 +56,18 @@ var tests = [
});
showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
triggerSecondaryCommand(popup, 1);
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.extraSecondaryActionClicked, "extra secondary action was clicked");
ok(!this.notifyObj.dismissalCallbackTriggered, "dismissal callback wasn't triggered");
ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
}
},
{ id: "Test#2c",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.secondaryActions.push({
label: "Extra Secondary Action",
@ -80,26 +80,26 @@ var tests = [
});
showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
triggerSecondaryCommand(popup, 2);
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.extraSecondaryActionClicked, "extra secondary action was clicked");
ok(!this.notifyObj.dismissalCallbackTriggered, "dismissal callback wasn't triggered");
ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
}
},
{ id: "Test#3",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notification = showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
dismissNotification(popup);
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered");
this.notification.remove();
ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
@ -108,7 +108,7 @@ var tests = [
// test opening a notification for a background browser
// Note: test 4 to 6 share a tab.
{ id: "Test#4",
*run() {
run: function* () {
let tab = gBrowser.addTab("http://example.com/");
yield BrowserTestUtils.browserLoaded(tab.linkedBrowser);
isnot(gBrowser.selectedTab, tab, "new tab isn't selected");
@ -125,18 +125,18 @@ var tests = [
},
// now select that browser and test to see that the notification appeared
{ id: "Test#5",
run() {
run: function() {
this.oldSelectedTab = gBrowser.selectedTab;
gBrowser.selectedTab = gBrowser.tabs[gBrowser.tabs.length - 1];
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, wrongBrowserNotificationObject);
is(PopupNotifications.isPanelOpen, true, "isPanelOpen getter doesn't lie");
// switch back to the old browser
gBrowser.selectedTab = this.oldSelectedTab;
},
onHidden(popup) {
onHidden: function(popup) {
// actually remove the notification to prevent it from reappearing
ok(wrongBrowserNotificationObject.dismissalCallbackTriggered, "dismissal callback triggered due to tab switch");
wrongBrowserNotification.remove();
@ -146,7 +146,7 @@ var tests = [
},
// test that the removed notification isn't shown on browser re-select
{ id: "Test#6",
*run() {
run: function* () {
let promiseTopic = promiseTopicObserved("PopupNotifications-updateNotShowing");
gBrowser.selectedTab = gBrowser.tabs[gBrowser.tabs.length - 1];
yield promiseTopic;
@ -158,24 +158,24 @@ var tests = [
// Test that two notifications with the same ID result in a single displayed
// notification.
{ id: "Test#7",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
// Show the same notification twice
this.notification1 = showNotification(this.notifyObj);
this.notification2 = showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
this.notification2.remove();
},
onHidden(popup) {
onHidden: function(popup) {
ok(!this.notifyObj.dismissalCallbackTriggered, "dismissal callback wasn't triggered");
ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
}
},
// Test that two notifications with different IDs are displayed
{ id: "Test#8",
run() {
run: function() {
this.testNotif1 = new BasicNotification(this.id);
this.testNotif1.message += " 1";
showNotification(this.testNotif1);
@ -184,7 +184,7 @@ var tests = [
this.testNotif2.id += "-2";
showNotification(this.testNotif2);
},
onShown(popup) {
onShown: function(popup) {
is(popup.childNodes.length, 2, "two notifications are shown");
// Trigger the main command for the first notification, and the secondary
// for the second. Need to do mainCommand first since the secondaryCommand
@ -193,7 +193,7 @@ var tests = [
is(popup.childNodes.length, 1, "only one notification left");
triggerSecondaryCommand(popup, 0);
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.testNotif1.mainActionClicked, "main action #1 was clicked");
ok(!this.testNotif1.secondaryActionClicked, "secondary action #1 wasn't clicked");
ok(!this.testNotif1.dismissalCallbackTriggered, "dismissal callback #1 wasn't called");
@ -206,16 +206,16 @@ var tests = [
// Test notification without mainAction or secondaryActions, it should fall back
// to a default button that dismisses the notification in place of the main action.
{ id: "Test#9",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.mainAction = null;
this.notifyObj.secondaryActions = null;
this.notification = showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
triggerMainCommand(popup);
},
onHidden(popup) {
onHidden: function(popup) {
ok(!this.notifyObj.mainActionClicked, "mainAction was not clicked");
ok(!this.notifyObj.dismissalCallbackTriggered, "dismissal callback wasn't triggered");
ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
@ -225,17 +225,17 @@ var tests = [
// to a default button that dismisses the notification in place of the main action
// and ignore the passed secondaryActions.
{ id: "Test#10",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.mainAction = null;
this.notification = showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
let notification = popup.childNodes[0];
is(notification.getAttribute("secondarybuttonhidden"), "true", "secondary button is hidden");
triggerMainCommand(popup);
},
onHidden(popup) {
onHidden: function(popup) {
ok(!this.notifyObj.mainActionClicked, "mainAction was not clicked");
ok(!this.notifyObj.dismissalCallbackTriggered, "dismissal callback wasn't triggered");
ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
@ -243,7 +243,7 @@ var tests = [
},
// Test two notifications with different anchors
{ id: "Test#11",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.firstNotification = showNotification(this.notifyObj);
this.notifyObj2 = new BasicNotification(this.id);
@ -252,14 +252,14 @@ var tests = [
// Second showNotification() overrides the first
this.secondNotification = showNotification(this.notifyObj2);
},
onShown(popup) {
onShown: function(popup) {
// This also checks that only one element is shown.
checkPopup(popup, this.notifyObj2);
is(document.getElementById("geo-notification-icon").boxObject.width, 0,
"geo anchor shouldn't be visible");
dismissNotification(popup);
},
onHidden(popup) {
onHidden: function(popup) {
// Remove the notifications
this.firstNotification.remove();
this.secondNotification.remove();

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

@ -14,16 +14,16 @@ function test() {
var tests = [
// Test optional params
{ id: "Test#1",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.secondaryActions = undefined;
this.notification = showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
dismissNotification(popup);
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered");
this.notification.remove();
ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
@ -31,19 +31,19 @@ var tests = [
},
// Test that icons appear
{ id: "Test#2",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.id = "geolocation";
this.notifyObj.anchorID = "geo-notification-icon";
this.notification = showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
isnot(document.getElementById("geo-notification-icon").boxObject.width, 0,
"geo anchor should be visible");
dismissNotification(popup);
},
onHidden(popup) {
onHidden: function(popup) {
let icon = document.getElementById("geo-notification-icon");
isnot(icon.boxObject.width, 0,
"geo anchor should be visible after dismissal");
@ -55,7 +55,7 @@ var tests = [
// Test that persistence allows the notification to persist across reloads
{ id: "Test#3",
*run() {
run: function* () {
this.oldSelectedTab = gBrowser.selectedTab;
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
this.notifyObj = new BasicNotification(this.id);
@ -64,7 +64,7 @@ var tests = [
});
this.notification = showNotification(this.notifyObj);
},
*onShown(popup) {
onShown: function* (popup) {
this.complete = false;
yield promiseTabLoadEvent(gBrowser.selectedTab, "http://example.org/");
yield promiseTabLoadEvent(gBrowser.selectedTab, "http://example.com/");
@ -72,7 +72,7 @@ var tests = [
this.complete = true;
yield promiseTabLoadEvent(gBrowser.selectedTab, "http://example.org/");
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.complete, "Should only have hidden the notification after 3 page loads");
ok(this.notifyObj.removedCallbackTriggered, "removal callback triggered");
gBrowser.removeTab(gBrowser.selectedTab);
@ -81,7 +81,7 @@ var tests = [
},
// Test that a timeout allows the notification to persist across reloads
{ id: "Test#4",
*run() {
run: function* () {
this.oldSelectedTab = gBrowser.selectedTab;
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
this.notifyObj = new BasicNotification(this.id);
@ -91,7 +91,7 @@ var tests = [
});
this.notification = showNotification(this.notifyObj);
},
*onShown(popup) {
onShown: function* (popup) {
this.complete = false;
yield promiseTabLoadEvent(gBrowser.selectedTab, "http://example.org/");
yield promiseTabLoadEvent(gBrowser.selectedTab, "http://example.com/");
@ -100,7 +100,7 @@ var tests = [
this.complete = true;
yield promiseTabLoadEvent(gBrowser.selectedTab, "http://example.org/");
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.complete, "Should only have hidden the notification after the timeout was passed");
this.notification.remove();
gBrowser.removeTab(gBrowser.selectedTab);
@ -110,7 +110,7 @@ var tests = [
// Test that setting persistWhileVisible allows a visible notification to
// persist across location changes
{ id: "Test#5",
*run() {
run: function* () {
this.oldSelectedTab = gBrowser.selectedTab;
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
this.notifyObj = new BasicNotification(this.id);
@ -119,7 +119,7 @@ var tests = [
});
this.notification = showNotification(this.notifyObj);
},
*onShown(popup) {
onShown: function* (popup) {
this.complete = false;
yield promiseTabLoadEvent(gBrowser.selectedTab, "http://example.org/");
@ -128,7 +128,7 @@ var tests = [
this.complete = true;
dismissNotification(popup);
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.complete, "Should only have hidden the notification after it was dismissed");
this.notification.remove();
gBrowser.removeTab(gBrowser.selectedTab);
@ -138,7 +138,7 @@ var tests = [
// Test that nested icon nodes correctly activate popups
{ id: "Test#6",
run() {
run: function() {
// Add a temporary box as the anchor with a button
this.box = document.createElement("box");
PopupNotifications.iconBox.appendChild(this.box);
@ -160,18 +160,18 @@ var tests = [
// amount.
EventUtils.synthesizeMouse(button, 4, 4, {});
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
dismissNotification(popup);
},
onHidden(popup) {
onHidden: function(popup) {
this.notification.remove();
this.box.parentNode.removeChild(this.box);
}
},
// Test that popupnotifications without popups have anchor icons shown
{ id: "Test#7",
*run() {
run: function* () {
let notifyObj = new BasicNotification(this.id);
notifyObj.anchorID = "geo-notification-icon";
notifyObj.addOptions({neverShow: true});
@ -185,16 +185,16 @@ var tests = [
},
// Test notification close button
{ id: "Test#9",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notification = showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
let notification = popup.childNodes[0];
EventUtils.synthesizeMouseAtCenter(notification.closebutton, {});
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered");
this.notification.remove();
ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
@ -202,17 +202,17 @@ var tests = [
},
// Test notification when chrome is hidden
{ id: "Test#10",
run() {
run: function() {
window.locationbar.visible = false;
this.notifyObj = new BasicNotification(this.id);
this.notification = showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
is(popup.anchorNode.className, "tabbrowser-tab", "notification anchored to tab");
dismissNotification(popup);
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered");
this.notification.remove();
ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");

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

@ -14,25 +14,25 @@ function test() {
var tests = [
// Test notification is removed when dismissed if removeOnDismissal is true
{ id: "Test#1",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.addOptions({
removeOnDismissal: true
});
this.notification = showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
dismissNotification(popup);
},
onHidden(popup) {
onHidden: function(popup) {
ok(!this.notifyObj.dismissalCallbackTriggered, "dismissal callback wasn't triggered");
ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
}
},
// Test multiple notification icons are shown
{ id: "Test#2",
run() {
run: function() {
this.notifyObj1 = new BasicNotification(this.id);
this.notifyObj1.id += "_1";
this.notifyObj1.anchorID = "default-notification-icon";
@ -43,7 +43,7 @@ var tests = [
this.notifyObj2.anchorID = "geo-notification-icon";
this.notification2 = showNotification(this.notifyObj2);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj2);
// check notifyObj1 anchor icon is showing
@ -55,7 +55,7 @@ var tests = [
dismissNotification(popup);
},
onHidden(popup) {
onHidden: function(popup) {
this.notification1.remove();
ok(this.notifyObj1.removedCallbackTriggered, "removed callback triggered");
@ -65,7 +65,7 @@ var tests = [
},
// Test that multiple notification icons are removed when switching tabs
{ id: "Test#3",
*run() {
run: function* () {
// show the notification on old tab.
this.notifyObjOld = new BasicNotification(this.id);
this.notifyObjOld.anchorID = "default-notification-icon";
@ -80,7 +80,7 @@ var tests = [
this.notifyObjNew.anchorID = "geo-notification-icon";
this.notificationNew = showNotification(this.notifyObjNew);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObjNew);
// check notifyObjOld anchor icon is removed
@ -92,7 +92,7 @@ var tests = [
dismissNotification(popup);
},
onHidden(popup) {
onHidden: function(popup) {
this.notificationNew.remove();
gBrowser.removeTab(gBrowser.selectedTab);
@ -102,14 +102,14 @@ var tests = [
},
// test security delay - too early
{ id: "Test#4",
run() {
run: function() {
// Set the security delay to 100s
PopupNotifications.buttonDelay = 100000;
this.notifyObj = new BasicNotification(this.id);
showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
triggerMainCommand(popup);
@ -119,21 +119,21 @@ var tests = [
});
},
onHidden(popup) {
onHidden: function(popup) {
ok(!this.notifyObj.mainActionClicked, "mainAction was not clicked because it was too soon");
ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback was triggered");
}
},
// test security delay - after delay
{ id: "Test#5",
run() {
run: function() {
// Set the security delay to 10ms
PopupNotifications.buttonDelay = 10;
this.notifyObj = new BasicNotification(this.id);
showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
// Wait until after the delay to trigger the main action
@ -142,7 +142,7 @@ var tests = [
}, 500);
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.notifyObj.mainActionClicked, "mainAction was clicked after the delay");
ok(!this.notifyObj.dismissalCallbackTriggered, "dismissal callback was not triggered");
PopupNotifications.buttonDelay = PREF_SECURITY_DELAY_INITIAL;
@ -150,7 +150,7 @@ var tests = [
},
// reload removes notification
{ id: "Test#6",
*run() {
run: function* () {
yield promiseTabLoadEvent(gBrowser.selectedTab, "http://example.com/");
let notifyObj = new BasicNotification(this.id);
notifyObj.options.eventCallback = function(eventName) {
@ -167,7 +167,7 @@ var tests = [
},
// location change in background tab removes notification
{ id: "Test#7",
*run() {
run: function* () {
let oldSelectedTab = gBrowser.selectedTab;
let newTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
gBrowser.selectedTab = oldSelectedTab;
@ -192,7 +192,7 @@ var tests = [
},
// Popup notification anchor shouldn't disappear when a notification with the same ID is re-added in a background tab
{ id: "Test#8",
*run() {
run: function* () {
yield promiseTabLoadEvent(gBrowser.selectedTab, "http://example.com/");
let originalTab = gBrowser.selectedTab;
let bgTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
@ -227,7 +227,7 @@ var tests = [
},
// location change in an embedded frame should not remove a notification
{ id: "Test#9",
*run() {
run: function* () {
yield promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html;charset=utf8,<iframe%20id='iframe'%20src='http://example.com/'>");
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.options.eventCallback = function(eventName) {
@ -237,7 +237,7 @@ var tests = [
};
showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
let self = this;
let progressListener = {
onLocationChange: function onLocationChange() {
@ -259,11 +259,11 @@ var tests = [
content.document.getElementById("iframe")
.setAttribute("src", "http://example.org/");
},
onHidden() {}
onHidden: function() {}
},
// Popup Notifications should catch exceptions from callbacks
{ id: "Test#10",
run() {
run: function() {
this.testNotif1 = new BasicNotification(this.id);
this.testNotif1.message += " 1";
this.notification1 = showNotification(this.testNotif1);
@ -285,11 +285,11 @@ var tests = [
};
this.notification2 = showNotification(this.testNotif2);
},
onShown(popup) {
onShown: function(popup) {
is(popup.childNodes.length, 2, "two notifications are shown");
dismissNotification(popup);
},
onHidden() {
onHidden: function() {
this.notification1.remove();
this.notification2.remove();
}

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

@ -14,41 +14,41 @@ function test() {
var tests = [
// Popup Notifications main actions should catch exceptions from callbacks
{ id: "Test#1",
run() {
run: function() {
this.testNotif = new ErrorNotification(this.id);
showNotification(this.testNotif);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.testNotif);
triggerMainCommand(popup);
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.testNotif.mainActionClicked, "main action has been triggered");
}
},
// Popup Notifications secondary actions should catch exceptions from callbacks
{ id: "Test#2",
run() {
run: function() {
this.testNotif = new ErrorNotification(this.id);
showNotification(this.testNotif);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.testNotif);
triggerSecondaryCommand(popup, 0);
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.testNotif.secondaryActionClicked, "secondary action has been triggered");
}
},
// Existing popup notification shouldn't disappear when adding a dismissed notification
{ id: "Test#3",
run() {
run: function() {
this.notifyObj1 = new BasicNotification(this.id);
this.notifyObj1.id += "_1";
this.notifyObj1.anchorID = "default-notification-icon";
this.notification1 = showNotification(this.notifyObj1);
},
onShown(popup) {
onShown: function(popup) {
// Now show a dismissed notification, and check that it doesn't clobber
// the showing one.
this.notifyObj2 = new BasicNotification(this.id);
@ -67,14 +67,14 @@ var tests = [
dismissNotification(popup);
},
onHidden(popup) {
onHidden: function(popup) {
this.notification1.remove();
this.notification2.remove();
}
},
// Showing should be able to modify the popup data
{ id: "Test#4",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
let normalCallback = this.notifyObj.options.eventCallback;
this.notifyObj.options.eventCallback = function(eventName) {
@ -85,18 +85,18 @@ var tests = [
};
showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
// checkPopup checks for the matching label. Note that this assumes that
// this.notifyObj.mainAction is the same as notification.mainAction,
// which could be a problem if we ever decided to deep-copy.
checkPopup(popup, this.notifyObj);
triggerMainCommand(popup);
},
onHidden() { }
onHidden: function() { }
},
// Moving a tab to a new window should remove non-swappable notifications.
{ id: "Test#5",
*run() {
run: function* () {
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
let notifyObj = new BasicNotification(this.id);
@ -124,7 +124,7 @@ var tests = [
},
// Moving a tab to a new window should preserve swappable notifications.
{ id: "Test#6",
*run() {
run: function* () {
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
let notifyObj = new BasicNotification(this.id);
let originalCallback = notifyObj.options.eventCallback;
@ -165,16 +165,16 @@ var tests = [
},
// the main action callback can keep the notification.
{ id: "Test#8",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.mainAction.dismiss = true;
this.notification = showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
triggerMainCommand(popup);
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback was triggered");
ok(!this.notifyObj.removedCallbackTriggered, "removed callback wasn't triggered");
this.notification.remove();
@ -182,16 +182,16 @@ var tests = [
},
// a secondary action callback can keep the notification.
{ id: "Test#9",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.secondaryActions[0].dismiss = true;
this.notification = showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
triggerSecondaryCommand(popup, 0);
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback was triggered");
ok(!this.notifyObj.removedCallbackTriggered, "removed callback wasn't triggered");
this.notification.remove();
@ -199,7 +199,7 @@ var tests = [
},
// returning true in the showing callback should dismiss the notification.
{ id: "Test#10",
run() {
run: function() {
let notifyObj = new BasicNotification(this.id);
let originalCallback = notifyObj.options.eventCallback;
notifyObj.options.eventCallback = function(eventName) {

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

@ -16,11 +16,11 @@ var gNotification;
var tests = [
// panel updates should fire the showing and shown callbacks again.
{ id: "Test#1",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notification = showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
this.notifyObj.showingCallbackTriggered = false;
@ -35,11 +35,11 @@ var tests = [
this.notification.remove();
},
onHidden() { }
onHidden: function() { }
},
// A first dismissed notification shouldn't stop _update from showing a second notification
{ id: "Test#2",
run() {
run: function() {
this.notifyObj1 = new BasicNotification(this.id);
this.notifyObj1.id += "_1";
this.notifyObj1.anchorID = "default-notification-icon";
@ -55,16 +55,16 @@ var tests = [
this.notification2.dismissed = false;
PopupNotifications._update();
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj2);
this.notification1.remove();
this.notification2.remove();
},
onHidden(popup) { }
onHidden: function(popup) { }
},
// The anchor icon should be shown for notifications in background windows.
{ id: "Test#3",
*run() {
run: function* () {
let notifyObj = new BasicNotification(this.id);
notifyObj.options.dismissed = true;
@ -84,7 +84,7 @@ var tests = [
// Test that persistent doesn't allow the notification to persist after
// navigation.
{ id: "Test#4",
*run() {
run: function* () {
this.oldSelectedTab = gBrowser.selectedTab;
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
this.notifyObj = new BasicNotification(this.id);
@ -93,7 +93,7 @@ var tests = [
});
this.notification = showNotification(this.notifyObj);
},
*onShown(popup) {
onShown: function* (popup) {
this.complete = false;
yield promiseTabLoadEvent(gBrowser.selectedTab, "http://example.org/");
@ -105,7 +105,7 @@ var tests = [
this.complete = true;
triggerSecondaryCommand(popup, 0);
},
onHidden(popup) {
onHidden: function(popup) {
ok(!this.complete, "Should have hidden the notification after navigation");
this.notification.remove();
gBrowser.removeTab(gBrowser.selectedTab);
@ -115,7 +115,7 @@ var tests = [
// Test that persistent allows the notification to persist until explicitly
// dismissed.
{ id: "Test#5",
*run() {
run: function* () {
this.oldSelectedTab = gBrowser.selectedTab;
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
this.notifyObj = new BasicNotification(this.id);
@ -124,7 +124,7 @@ var tests = [
});
this.notification = showNotification(this.notifyObj);
},
*onShown(popup) {
onShown: function* (popup) {
this.complete = false;
// Notification should persist after attempt to dismiss by clicking on the
@ -136,7 +136,7 @@ var tests = [
this.complete = true;
triggerSecondaryCommand(popup, 0);
},
onHidden(popup) {
onHidden: function(popup) {
ok(this.complete, "Should have hidden the notification after clicking Not Now");
this.notification.remove();
gBrowser.removeTab(gBrowser.selectedTab);
@ -146,16 +146,16 @@ var tests = [
// Test that persistent panels are still open after switching to another tab
// and back.
{ id: "Test#6a",
*run() {
run: function* () {
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.options.persistent = true;
gNotification = showNotification(this.notifyObj);
},
*onShown(popup) {
onShown: function* (popup) {
this.oldSelectedTab = gBrowser.selectedTab;
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
},
onHidden(popup) {
onHidden: function(popup) {
ok(true, "Should have hidden the notification after tab switch");
gBrowser.removeTab(gBrowser.selectedTab);
gBrowser.selectedTab = this.oldSelectedTab;
@ -164,7 +164,7 @@ var tests = [
// Second part of the previous test that compensates for the limitation in
// runNextTest that expects a single onShown/onHidden invocation per test.
{ id: "Test#6b",
*run() {
run: function* () {
let id = PopupNotifications.panel.firstChild.getAttribute("popupid");
ok(id.endsWith("Test#6a"), "Should have found the notification from Test6a");
ok(PopupNotifications.isPanelOpen, "Should have shown the popup again after getting back to the tab");
@ -176,7 +176,7 @@ var tests = [
// Test that persistent panels are still open after switching to another
// window and back.
{ id: "Test#7",
*run() {
run: function* () {
this.oldSelectedTab = gBrowser.selectedTab;
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
@ -213,7 +213,7 @@ var tests = [
},
// Test that only the first persistent notification is shown on update
{ id: "Test#8",
run() {
run: function() {
this.notifyObj1 = new BasicNotification(this.id);
this.notifyObj1.id += "_1";
this.notifyObj1.anchorID = "default-notification-icon";
@ -228,16 +228,16 @@ var tests = [
PopupNotifications._update();
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj1);
this.notification1.remove();
this.notification2.remove();
},
onHidden(popup) { }
onHidden: function(popup) { }
},
// Test that persistent notifications are shown stacked by anchor on update
{ id: "Test#9",
run() {
run: function() {
this.notifyObj1 = new BasicNotification(this.id);
this.notifyObj1.id += "_1";
this.notifyObj1.anchorID = "default-notification-icon";
@ -258,7 +258,7 @@ var tests = [
PopupNotifications._update();
},
onShown(popup) {
onShown: function(popup) {
let notifications = popup.childNodes;
is(notifications.length, 2, "two notifications displayed");
let [notification1, notification2] = notifications;
@ -269,6 +269,6 @@ var tests = [
this.notification2.remove();
this.notification3.remove();
},
onHidden(popup) { }
onHidden: function(popup) { }
},
];

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

@ -37,25 +37,25 @@ var gNotification;
var tests = [
// Test that passing the checkbox field shows the checkbox.
{ id: "show_checkbox",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.options.checkbox = {
label: "This is a checkbox",
};
gNotification = showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
let notification = popup.childNodes[0];
checkCheckbox(notification.checkbox, "This is a checkbox");
triggerMainCommand(popup);
},
onHidden() { }
onHidden: function() { }
},
// Test checkbox being checked by default
{ id: "checkbox_checked",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.options.checkbox = {
label: "Check this",
@ -63,18 +63,18 @@ var tests = [
};
gNotification = showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
let notification = popup.childNodes[0];
checkCheckbox(notification.checkbox, "Check this", true);
triggerMainCommand(popup);
},
onHidden() { }
onHidden: function() { }
},
// Test checkbox passing the checkbox state on mainAction
{ id: "checkbox_passCheckboxChecked_mainAction",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.mainAction.callback = ({checkboxChecked}) => this.mainActionChecked = checkboxChecked;
this.notifyObj.options.checkbox = {
@ -82,7 +82,7 @@ var tests = [
};
gNotification = showNotification(this.notifyObj);
},
*onShown(popup) {
onShown: function* (popup) {
checkPopup(popup, this.notifyObj);
let notification = popup.childNodes[0];
let checkbox = notification.checkbox;
@ -92,14 +92,14 @@ var tests = [
checkCheckbox(checkbox, "This is a checkbox", true);
triggerMainCommand(popup);
},
onHidden() {
onHidden: function() {
is(this.mainActionChecked, true, "mainAction callback is passed the correct checkbox value");
}
},
// Test checkbox passing the checkbox state on secondaryAction
{ id: "checkbox_passCheckboxChecked_secondaryAction",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.secondaryActions = [{
label: "Test Secondary",
@ -111,7 +111,7 @@ var tests = [
};
gNotification = showNotification(this.notifyObj);
},
*onShown(popup) {
onShown: function* (popup) {
checkPopup(popup, this.notifyObj);
let notification = popup.childNodes[0];
let checkbox = notification.checkbox;
@ -121,14 +121,14 @@ var tests = [
checkCheckbox(checkbox, "This is a checkbox", true);
triggerSecondaryCommand(popup, 0);
},
onHidden() {
onHidden: function() {
is(this.secondaryActionChecked, true, "secondaryAction callback is passed the correct checkbox value");
}
},
// Test checkbox preserving its state through re-opening the doorhanger
{ id: "checkbox_reopen",
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.options.checkbox = {
label: "This is a checkbox",
@ -139,7 +139,7 @@ var tests = [
};
gNotification = showNotification(this.notifyObj);
},
*onShown(popup) {
onShown: function* (popup) {
checkPopup(popup, this.notifyObj);
let notification = popup.childNodes[0];
let checkbox = notification.checkbox;
@ -148,7 +148,7 @@ var tests = [
EventUtils.synthesizeMouseAtCenter(checkbox, {});
dismissNotification(popup);
},
onHidden(popup) {
onHidden: function(popup) {
let icon = document.getElementById("default-notification-icon");
EventUtils.synthesizeMouseAtCenter(icon, {});
let notification = popup.childNodes[0];
@ -165,11 +165,11 @@ var tests = [
[true, false].forEach(function(checked) {
tests.push(
{ id: `checkbox_disableMainAction_${state}_${checked ? 'checked' : 'unchecked'}`,
run() {
run: function() {
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.options.checkbox = {
label: "This is a checkbox",
checked,
checked: checked,
[state]: {
disableMainAction: true,
warningLabel: "Testing disable",
@ -177,7 +177,7 @@ var tests = [
};
gNotification = showNotification(this.notifyObj);
},
*onShown(popup) {
onShown: function* (popup) {
checkPopup(popup, this.notifyObj);
let notification = popup.childNodes[0];
let checkbox = notification.checkbox;
@ -200,7 +200,7 @@ var tests = [
}
triggerMainCommand(popup);
},
onHidden() { }
onHidden: function() { }
}
);
});

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

@ -15,7 +15,7 @@ var tests = [
// Test that popupnotifications are anchored to the identity icon on
// about:blank, where anchor icons are hidden.
{ id: "Test#1",
*run() {
run: function* () {
this.oldSelectedTab = gBrowser.selectedTab;
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
@ -23,7 +23,7 @@ var tests = [
this.notifyObj.anchorID = "geo-notification-icon";
this.notification = showNotification(this.notifyObj);
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
is(document.getElementById("geo-notification-icon").boxObject.width, 0,
"geo anchor shouldn't be visible");
@ -31,7 +31,7 @@ var tests = [
"notification anchored to identity icon");
dismissNotification(popup);
},
onHidden(popup) {
onHidden: function(popup) {
this.notification.remove();
gBrowser.removeTab(gBrowser.selectedTab);
gBrowser.selectedTab = this.oldSelectedTab;
@ -40,7 +40,7 @@ var tests = [
// Test that popupnotifications are anchored to the identity icon after
// navigation to about:blank.
{ id: "Test#2",
*run() {
run: function* () {
this.oldSelectedTab = gBrowser.selectedTab;
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
@ -51,7 +51,7 @@ var tests = [
});
this.notification = showNotification(this.notifyObj);
},
*onShown(popup) {
onShown: function* (popup) {
yield promiseTabLoadEvent(gBrowser.selectedTab, "about:blank");
checkPopup(popup, this.notifyObj);
@ -61,7 +61,7 @@ var tests = [
"notification anchored to identity icon");
dismissNotification(popup);
},
onHidden(popup) {
onHidden: function(popup) {
this.notification.remove();
gBrowser.removeTab(gBrowser.selectedTab);
gBrowser.selectedTab = this.oldSelectedTab;
@ -70,7 +70,7 @@ var tests = [
// Test that dismissed popupnotifications cannot be opened on about:blank, but
// can be opened after navigation.
{ id: "Test#3",
*run() {
run: function* () {
this.oldSelectedTab = gBrowser.selectedTab;
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
@ -92,11 +92,11 @@ var tests = [
EventUtils.synthesizeMouse(document.getElementById("geo-notification-icon"), 0, 0, {});
},
onShown(popup) {
onShown: function(popup) {
checkPopup(popup, this.notifyObj);
dismissNotification(popup);
},
onHidden(popup) {
onHidden: function(popup) {
this.notification.remove();
gBrowser.removeTab(gBrowser.selectedTab);
gBrowser.selectedTab = this.oldSelectedTab;
@ -106,7 +106,7 @@ var tests = [
// editing the URL in the location bar, and restored to their anchors when the
// URL is reverted.
{ id: "Test#4",
*run() {
run: function* () {
this.oldSelectedTab = gBrowser.selectedTab;
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");

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

@ -57,7 +57,7 @@ var gTests = [
{
desc: "Test activation with enable panel",
snippet,
snippet: snippet,
panel: true
},

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

@ -57,26 +57,26 @@ function installListener(next, aManifest) {
});
return {
onInstalling(addon) {
onInstalling: function(addon) {
is(expectEvent, "onInstalling", "install started");
is(addon.manifest.origin, aManifest.origin, "provider about to be installed");
ok(!Services.prefs.prefHasUserValue(prefname), "manifest is not in user-prefs");
expectEvent = "onInstalled";
},
onInstalled(addon) {
onInstalled: function(addon) {
is(addon.manifest.origin, aManifest.origin, "provider installed");
ok(addon.installDate.getTime() > 0, "addon has installDate");
ok(addon.updateDate.getTime() > 0, "addon has updateDate");
ok(Services.prefs.prefHasUserValue(prefname), "manifest is in user-prefs");
expectEvent = "onUninstalling";
},
onUninstalling(addon) {
onUninstalling: function(addon) {
is(expectEvent, "onUninstalling", "uninstall started");
is(addon.manifest.origin, aManifest.origin, "provider about to be uninstalled");
ok(Services.prefs.prefHasUserValue(prefname), "manifest is in user-prefs");
expectEvent = "onUninstalled";
},
onUninstalled(addon) {
onUninstalled: function(addon) {
is(expectEvent, "onUninstalled", "provider has been uninstalled");
is(addon.manifest.origin, aManifest.origin, "provider uninstalled");
ok(!Services.prefs.prefHasUserValue(prefname), "manifest is not in user-prefs");
@ -86,25 +86,25 @@ function installListener(next, aManifest) {
}
var tests = {
testHTTPInstallFailure(next) {
testHTTPInstallFailure: function(next) {
let installFrom = "http://example.com";
is(SocialService.getOriginActivationType(installFrom), "foreign", "testing foriegn install");
let data = {
origin: installFrom,
url: installFrom + "/activate",
manifest,
window
manifest: manifest,
window: window
}
Social.installProvider(data, function(addonManifest) {
ok(!addonManifest, "unable to install provider over http");
next();
});
},
testAddonEnableToggle(next) {
testAddonEnableToggle: function(next) {
let expectEvent;
let prefname = getManifestPrefname(manifest);
let listener = {
onEnabled(addon) {
onEnabled: function(addon) {
is(expectEvent, "onEnabled", "provider onEnabled");
ok(!addon.userDisabled, "provider enabled");
executeSoon(function() {
@ -112,11 +112,11 @@ var tests = {
addon.userDisabled = true;
});
},
onEnabling(addon) {
onEnabling: function(addon) {
is(expectEvent, "onEnabling", "provider onEnabling");
expectEvent = "onEnabled";
},
onDisabled(addon) {
onDisabled: function(addon) {
is(expectEvent, "onDisabled", "provider onDisabled");
ok(addon.userDisabled, "provider disabled");
AddonManager.removeAddonListener(listener);
@ -124,7 +124,7 @@ var tests = {
Services.prefs.clearUserPref(prefname);
executeSoon(next);
},
onDisabling(addon) {
onDisabling: function(addon) {
is(expectEvent, "onDisabling", "provider onDisabling");
expectEvent = "onDisabled";
}
@ -148,7 +148,7 @@ var tests = {
next();
});
},
testProviderEnableToggle(next) {
testProviderEnableToggle: function(next) {
// enable and disabel a provider from the SocialService interface, check
// that the addon manager is updated
@ -156,22 +156,22 @@ var tests = {
let prefname = getManifestPrefname(manifest);
let listener = {
onEnabled(addon) {
onEnabled: function(addon) {
is(expectEvent, "onEnabled", "provider onEnabled");
is(addon.manifest.origin, manifest.origin, "provider enabled");
ok(!addon.userDisabled, "provider !userDisabled");
},
onEnabling(addon) {
onEnabling: function(addon) {
is(expectEvent, "onEnabling", "provider onEnabling");
is(addon.manifest.origin, manifest.origin, "provider about to be enabled");
expectEvent = "onEnabled";
},
onDisabled(addon) {
onDisabled: function(addon) {
is(expectEvent, "onDisabled", "provider onDisabled");
is(addon.manifest.origin, manifest.origin, "provider disabled");
ok(addon.userDisabled, "provider userDisabled");
},
onDisabling(addon) {
onDisabling: function(addon) {
is(expectEvent, "onDisabling", "provider onDisabling");
is(addon.manifest.origin, manifest.origin, "provider about to be disabled");
expectEvent = "onDisabled";
@ -190,7 +190,7 @@ var tests = {
});
});
},
testDirectoryInstall(next) {
testDirectoryInstall: function(next) {
AddonManager.addAddonListener(installListener(next, manifest2));
BrowserTestUtils.waitForEvent(PopupNotifications.panel, "popupshown").then(() => {
@ -205,7 +205,7 @@ var tests = {
origin: manifest2.origin,
url: manifest2.origin + "/directory",
manifest: manifest2,
window
window: window
}
Social.installProvider(data, function(addonManifest) {
Services.prefs.clearUserPref("social.directories");

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