Merge m-c to autoland. a=merge

This commit is contained in:
Ryan VanderMeulen 2016-08-31 22:34:02 -04:00
commit f2ae8f9bce
303 changed files with 4473 additions and 4358 deletions

View File

@ -60,7 +60,8 @@ browser/app/**
browser/base/content/browser-social.js
browser/base/content/nsContextMenu.js
browser/base/content/sanitizeDialog.js
browser/base/content/test/**
browser/base/content/test/general/file_csp_block_all_mixedcontent.html
browser/base/content/test/urlbar/file_blank_but_not_blank.html
browser/base/content/newtab/**
browser/components/downloads/**
browser/components/feeds/**

View File

@ -7,11 +7,15 @@ module.metadata = {
"stability": "unstable"
};
const { Ci } = require("chrome");
const { Ci, Cc, Cu } = require("chrome");
const core = require("../l10n/core");
const { loadSheet, removeSheet } = require("../stylesheet/utils");
const { process, frames } = require("../remote/child");
const { Services } = require("resource://gre/modules/Services.jsm");
var observerService = Cc["@mozilla.org/observer-service;1"]
.getService(Ci.nsIObserverService);
const { ShimWaiver } = Cu.import("resource://gre/modules/ShimWaiver.jsm");
const addObserver = ShimWaiver.getProperty(observerService, "addObserver");
const removeObserver = ShimWaiver.getProperty(observerService, "removeObserver");
const assetsURI = require('../self').data.url();
@ -115,7 +119,7 @@ let enabled = false;
function enable() {
if (enabled)
return;
Services.obs.addObserver(onContentWindow, ON_CONTENT, false);
addObserver(onContentWindow, ON_CONTENT, false);
enabled = true;
}
process.port.on("sdk/l10n/html/enable", enable);
@ -123,7 +127,7 @@ process.port.on("sdk/l10n/html/enable", enable);
function disable() {
if (!enabled)
return;
Services.obs.removeObserver(onContentWindow, ON_CONTENT);
removeObserver(onContentWindow, ON_CONTENT);
enabled = false;
}
process.port.on("sdk/l10n/html/disable", disable);

View File

@ -62,7 +62,6 @@ function WindowTracker(delegate) {
}
this._delegate = delegate;
this._loadingWindows = [];
for (let window of getWindows())
this._regWindow(window);
@ -81,17 +80,12 @@ WindowTracker.prototype = {
if (ignoreWindow(window))
return;
this._loadingWindows.push(window);
window.addEventListener('load', this, true);
},
_unregLoadingWindow: function _unregLoadingWindow(window) {
var index = this._loadingWindows.indexOf(window);
if (index != -1) {
this._loadingWindows.splice(index, 1);
window.removeEventListener('load', this, true);
}
// This may have no effect if we ignored the window in _regLoadingWindow().
window.removeEventListener('load', this, true);
},
_regWindow: function _regWindow(window) {

View File

@ -211,7 +211,7 @@ var TrackingProtection = {
// Ignore the fragment in case the intro is shown on the tour page
// (e.g. if the user manually visited the tour or clicked the link from
// about:privatebrowsing) so we can avoid a reload.
ignoreFragment: true,
ignoreFragment: "whenComparingAndReplace",
});
};

View File

@ -7533,7 +7533,7 @@ var gRemoteTabsUI = {
};
/**
* Switch to a tab that has a given URI, and focusses its browser window.
* Switch to a tab that has a given URI, and focuses its browser window.
* If a matching tab is in this window, it will be switched to. Otherwise, other
* windows will be searched.
*
@ -7549,10 +7549,12 @@ var gRemoteTabsUI = {
* passed via this object.
* This object also allows:
* - 'ignoreFragment' property to be set to true to exclude fragment-portion
* matching when comparing URIs. Fragment will be replaced.
* - 'ignoreQueryString' property to be set to true to exclude query string
* matching when comparing URIs.
* - 'replaceQueryString' property to be set to true to exclude query string
* If set to "whenComparing", the fragment will be unmodified.
* If set to "whenComparingAndReplace", the fragment will be replaced.
* - 'ignoreQueryString' boolean property to be set to true to exclude query string
* matching when comparing URIs.
* - 'replaceQueryString' boolean property to be set to true to exclude query string
* matching when comparing URIs and overwrite the initial query string with
* the one from the new URI.
* @return True if an existing tab was found, false otherwise
@ -7605,16 +7607,18 @@ function switchToTabHavingURI(aURI, aOpenNew, aOpenParams={}) {
// Need to handle nsSimpleURIs here too (e.g. about:...), which don't
// work correctly with URL objects - so treat them as strings
let ignoreFragmentWhenComparing = typeof ignoreFragment == "string" &&
ignoreFragment.startsWith("whenComparing");
let requestedCompare = cleanURL(
aURI.spec, ignoreQueryString || replaceQueryString, ignoreFragment);
aURI.spec, ignoreQueryString || replaceQueryString, ignoreFragmentWhenComparing);
let browsers = aWindow.gBrowser.browsers;
for (let i = 0; i < browsers.length; i++) {
let browser = browsers[i];
let browserCompare = cleanURL(
browser.currentURI.spec, ignoreQueryString || replaceQueryString, ignoreFragment);
browser.currentURI.spec, ignoreQueryString || replaceQueryString, ignoreFragmentWhenComparing);
if (requestedCompare == browserCompare) {
aWindow.focus();
if (ignoreFragment || replaceQueryString) {
if (ignoreFragment == "whenComparingAndReplace" || replaceQueryString) {
browser.loadURI(aURI.spec);
}
aWindow.gBrowser.tabContainer.selectedIndex = i;

View File

@ -221,7 +221,7 @@ var gDropTargetShim = {
*/
_dispatchEvent: function (aEvent, aType, aTarget) {
let node = aTarget.node;
let event = document.createEvent("DragEvents");
let event = document.createEvent("DragEvent");
// The event should not bubble to prevent recursion.
event.initDragEvent(aType, false, true, window, 0, 0, 0, 0, 0, false, false,

View File

@ -66,7 +66,7 @@ var gTests = [
deferred.resolve();
}
});
} catch(e) {
} catch (e) {
ok(false, "Failed to get all commands");
deferred.reject();
}
@ -415,7 +415,7 @@ function test()
{
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
for (let test of gTests) {
info(test.desc);
try {

View File

@ -45,7 +45,7 @@ function fakeTelemetryNow(...args) {
return date;
}
function setupPingArchive() {
function* setupPingArchive() {
let scope = {};
Cu.import("resource://gre/modules/TelemetryController.jsm", scope);
Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader)
@ -86,7 +86,7 @@ var gTests = [
}
}, true);
} catch(e) {
} catch (e) {
ok(false, "Failed to get all commands");
deferred.reject();
}
@ -103,7 +103,7 @@ function test()
// xxxmpc leaving this here until we resolve bug 854038 and bug 854060
requestLongerTimeout(10);
Task.spawn(function () {
Task.spawn(function* () {
for (let test of gTests) {
info(test.desc);
yield test.setup();

View File

@ -1,203 +1,203 @@
"use strict";
const SERVER_URL = "http://example.com/browser/toolkit/crashreporter/test/browser/crashreport.sjs";
const PAGE = "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page.";
const COMMENTS = "Here's my test comment!";
const EMAIL = "foo@privacy.com";
/**
* Sets up the browser to send crash reports to the local crash report
* testing server.
*/
add_task(function* setup() {
// The test harness sets MOZ_CRASHREPORTER_NO_REPORT, which disables crash
// reports. This test needs them enabled. The test also needs a mock
// report server, and fortunately one is already set up by toolkit/
// crashreporter/test/Makefile.in. Assign its URL to MOZ_CRASHREPORTER_URL,
// which CrashSubmit.jsm uses as a server override.
let env = Cc["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment);
let noReport = env.get("MOZ_CRASHREPORTER_NO_REPORT");
let serverUrl = env.get("MOZ_CRASHREPORTER_URL");
env.set("MOZ_CRASHREPORTER_NO_REPORT", "");
env.set("MOZ_CRASHREPORTER_URL", SERVER_URL);
// On debug builds, crashing tabs results in much thinking, which
// slows down the test and results in intermittent test timeouts,
// so we'll pump up the expected timeout for this test.
requestLongerTimeout(2);
registerCleanupFunction(function() {
env.set("MOZ_CRASHREPORTER_NO_REPORT", noReport);
env.set("MOZ_CRASHREPORTER_URL", serverUrl);
});
});
/**
* This function returns a Promise that resolves once the following
* actions have taken place:
*
* 1) A new tab is opened up at PAGE
* 2) The tab is crashed
* 3) The about:tabcrashed page's fields are set in accordance with
* fieldValues
* 4) The tab is restored
* 5) A crash report is received from the testing server
* 6) Any tab crash prefs that were overwritten are reset
*
* @param fieldValues
* An Object describing how to set the about:tabcrashed
* fields. The following properties are accepted:
*
* comments (String)
* The comments to put in the comment textarea
* email (String)
* The email address to put in the email address input
* emailMe (bool)
* The checked value of the "Email me" checkbox
* includeURL (bool)
* The checked value of the "Include URL" checkbox
*
* If any of these fields are missing, the defaults from
* the user preferences are used.
* @param expectedExtra
* An Object describing the expected values that the submitted
* crash report's extra data should contain.
* @returns Promise
*/
function crashTabTestHelper(fieldValues, expectedExtra) {
return BrowserTestUtils.withNewTab({
gBrowser,
url: PAGE,
}, function*(browser) {
let prefs = TabCrashHandler.prefs;
let originalSendReport = prefs.getBoolPref("sendReport");
let originalEmailMe = prefs.getBoolPref("emailMe");
let originalIncludeURL = prefs.getBoolPref("includeURL");
let originalEmail = prefs.getCharPref("email");
let tab = gBrowser.getTabForBrowser(browser);
yield BrowserTestUtils.crashBrowser(browser);
let doc = browser.contentDocument;
// Since about:tabcrashed will run in the parent process, we can safely
// manipulate its DOM nodes directly
let comments = doc.getElementById("comments");
let email = doc.getElementById("email");
let emailMe = doc.getElementById("emailMe");
let includeURL = doc.getElementById("includeURL");
if (fieldValues.hasOwnProperty("comments")) {
comments.value = fieldValues.comments;
}
if (fieldValues.hasOwnProperty("email")) {
email.value = fieldValues.email;
}
if (fieldValues.hasOwnProperty("emailMe")) {
emailMe.checked = fieldValues.emailMe;
}
if (fieldValues.hasOwnProperty("includeURL")) {
includeURL.checked = fieldValues.includeURL;
}
let crashReport = promiseCrashReport(expectedExtra);
let restoreTab = browser.contentDocument.getElementById("restoreTab");
restoreTab.click();
yield BrowserTestUtils.waitForEvent(tab, "SSTabRestored");
yield crashReport;
// Submitting the crash report may have set some prefs regarding how to
// send tab crash reports. Let's reset them for the next test.
prefs.setBoolPref("sendReport", originalSendReport);
prefs.setBoolPref("emailMe", originalEmailMe);
prefs.setBoolPref("includeURL", originalIncludeURL);
prefs.setCharPref("email", originalEmail);
});
}
/**
* Tests what we send with the crash report by default. By default, we do not
* send any comments, the URL of the crashing page, or the email address of
* the user.
*/
add_task(function* test_default() {
yield crashTabTestHelper({}, {
"Comments": null,
"URL": "",
"Email": null,
});
});
/**
* Test just sending a comment.
*/
add_task(function* test_just_a_comment() {
yield crashTabTestHelper({
comments: COMMENTS,
}, {
"Comments": COMMENTS,
"URL": "",
"Email": null,
});
});
/**
* Test that we don't send email if emailMe is unchecked
*/
add_task(function* test_no_email() {
yield crashTabTestHelper({
email: EMAIL,
emailMe: false,
}, {
"Comments": null,
"URL": "",
"Email": null,
});
});
/**
* Test that we can send an email address if emailMe is checked
*/
add_task(function* test_yes_email() {
yield crashTabTestHelper({
email: EMAIL,
emailMe: true,
}, {
"Comments": null,
"URL": "",
"Email": EMAIL,
});
});
/**
* Test that we will send the URL of the page if includeURL is checked.
*/
add_task(function* test_send_URL() {
yield crashTabTestHelper({
includeURL: true,
}, {
"Comments": null,
"URL": PAGE,
"Email": null,
});
});
/**
* Test that we can send comments, the email address, and the URL
*/
add_task(function* test_send_all() {
yield crashTabTestHelper({
includeURL: true,
emailMe: true,
email: EMAIL,
comments: COMMENTS,
}, {
"Comments": COMMENTS,
"URL": PAGE,
"Email": EMAIL,
});
});
"use strict";
const SERVER_URL = "http://example.com/browser/toolkit/crashreporter/test/browser/crashreport.sjs";
const PAGE = "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page.";
const COMMENTS = "Here's my test comment!";
const EMAIL = "foo@privacy.com";
/**
* Sets up the browser to send crash reports to the local crash report
* testing server.
*/
add_task(function* setup() {
// The test harness sets MOZ_CRASHREPORTER_NO_REPORT, which disables crash
// reports. This test needs them enabled. The test also needs a mock
// report server, and fortunately one is already set up by toolkit/
// crashreporter/test/Makefile.in. Assign its URL to MOZ_CRASHREPORTER_URL,
// which CrashSubmit.jsm uses as a server override.
let env = Cc["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment);
let noReport = env.get("MOZ_CRASHREPORTER_NO_REPORT");
let serverUrl = env.get("MOZ_CRASHREPORTER_URL");
env.set("MOZ_CRASHREPORTER_NO_REPORT", "");
env.set("MOZ_CRASHREPORTER_URL", SERVER_URL);
// On debug builds, crashing tabs results in much thinking, which
// slows down the test and results in intermittent test timeouts,
// so we'll pump up the expected timeout for this test.
requestLongerTimeout(2);
registerCleanupFunction(function() {
env.set("MOZ_CRASHREPORTER_NO_REPORT", noReport);
env.set("MOZ_CRASHREPORTER_URL", serverUrl);
});
});
/**
* This function returns a Promise that resolves once the following
* actions have taken place:
*
* 1) A new tab is opened up at PAGE
* 2) The tab is crashed
* 3) The about:tabcrashed page's fields are set in accordance with
* fieldValues
* 4) The tab is restored
* 5) A crash report is received from the testing server
* 6) Any tab crash prefs that were overwritten are reset
*
* @param fieldValues
* An Object describing how to set the about:tabcrashed
* fields. The following properties are accepted:
*
* comments (String)
* The comments to put in the comment textarea
* email (String)
* The email address to put in the email address input
* emailMe (bool)
* The checked value of the "Email me" checkbox
* includeURL (bool)
* The checked value of the "Include URL" checkbox
*
* If any of these fields are missing, the defaults from
* the user preferences are used.
* @param expectedExtra
* An Object describing the expected values that the submitted
* crash report's extra data should contain.
* @returns Promise
*/
function crashTabTestHelper(fieldValues, expectedExtra) {
return BrowserTestUtils.withNewTab({
gBrowser,
url: PAGE,
}, function*(browser) {
let prefs = TabCrashHandler.prefs;
let originalSendReport = prefs.getBoolPref("sendReport");
let originalEmailMe = prefs.getBoolPref("emailMe");
let originalIncludeURL = prefs.getBoolPref("includeURL");
let originalEmail = prefs.getCharPref("email");
let tab = gBrowser.getTabForBrowser(browser);
yield BrowserTestUtils.crashBrowser(browser);
let doc = browser.contentDocument;
// Since about:tabcrashed will run in the parent process, we can safely
// manipulate its DOM nodes directly
let comments = doc.getElementById("comments");
let email = doc.getElementById("email");
let emailMe = doc.getElementById("emailMe");
let includeURL = doc.getElementById("includeURL");
if (fieldValues.hasOwnProperty("comments")) {
comments.value = fieldValues.comments;
}
if (fieldValues.hasOwnProperty("email")) {
email.value = fieldValues.email;
}
if (fieldValues.hasOwnProperty("emailMe")) {
emailMe.checked = fieldValues.emailMe;
}
if (fieldValues.hasOwnProperty("includeURL")) {
includeURL.checked = fieldValues.includeURL;
}
let crashReport = promiseCrashReport(expectedExtra);
let restoreTab = browser.contentDocument.getElementById("restoreTab");
restoreTab.click();
yield BrowserTestUtils.waitForEvent(tab, "SSTabRestored");
yield crashReport;
// Submitting the crash report may have set some prefs regarding how to
// send tab crash reports. Let's reset them for the next test.
prefs.setBoolPref("sendReport", originalSendReport);
prefs.setBoolPref("emailMe", originalEmailMe);
prefs.setBoolPref("includeURL", originalIncludeURL);
prefs.setCharPref("email", originalEmail);
});
}
/**
* Tests what we send with the crash report by default. By default, we do not
* send any comments, the URL of the crashing page, or the email address of
* the user.
*/
add_task(function* test_default() {
yield crashTabTestHelper({}, {
"Comments": null,
"URL": "",
"Email": null,
});
});
/**
* Test just sending a comment.
*/
add_task(function* test_just_a_comment() {
yield crashTabTestHelper({
comments: COMMENTS,
}, {
"Comments": COMMENTS,
"URL": "",
"Email": null,
});
});
/**
* Test that we don't send email if emailMe is unchecked
*/
add_task(function* test_no_email() {
yield crashTabTestHelper({
email: EMAIL,
emailMe: false,
}, {
"Comments": null,
"URL": "",
"Email": null,
});
});
/**
* Test that we can send an email address if emailMe is checked
*/
add_task(function* test_yes_email() {
yield crashTabTestHelper({
email: EMAIL,
emailMe: true,
}, {
"Comments": null,
"URL": "",
"Email": EMAIL,
});
});
/**
* Test that we will send the URL of the page if includeURL is checked.
*/
add_task(function* test_send_URL() {
yield crashTabTestHelper({
includeURL: true,
}, {
"Comments": null,
"URL": PAGE,
"Email": null,
});
});
/**
* Test that we can send comments, the email address, and the URL
*/
add_task(function* test_send_all() {
yield crashTabTestHelper({
includeURL: true,
emailMe: true,
email: EMAIL,
comments: COMMENTS,
}, {
"Comments": COMMENTS,
"URL": PAGE,
"Email": EMAIL,
});
});

View File

@ -24,7 +24,7 @@ var gFrontProgressListener = {
is(state, gFrontNotifications[gFrontNotificationsPos], "Got a notification for the front notifications listener");
gFrontNotificationsPos++;
},
onStatusChange: function (aWebProgress, aRequest, aStatus, aMessage) {
},
@ -62,7 +62,7 @@ var gAllProgressListener = {
is(state, gAllNotifications[gAllNotificationsPos], "Got a notification for the all notifications listener");
gAllNotificationsPos++;
},
onStatusChange: function (aBrowser, aWebProgress, aRequest, aStatus, aMessage) {
var state = "onStatusChange";
ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");

View File

@ -4,16 +4,15 @@ function* wait_for_tab_playing_event(tab, expectPlaying) {
if (tab.soundPlaying == expectPlaying) {
ok(true, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
return true;
} else {
yield BrowserTestUtils.waitForEvent(tab, "TabAttrModified", false, (event) => {
if (event.detail.changed.indexOf("soundplaying") >= 0) {
is(tab.hasAttribute("soundplaying"), expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
is(tab.soundPlaying, expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
return true;
}
return false;
});
}
return yield BrowserTestUtils.waitForEvent(tab, "TabAttrModified", false, (event) => {
if (event.detail.changed.indexOf("soundplaying") >= 0) {
is(tab.hasAttribute("soundplaying"), expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
is(tab.soundPlaying, expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
return true;
}
return false;
});
}
function* play(tab) {
@ -230,6 +229,7 @@ function* test_swapped_browser_while_playing(oldTab, newBrowser) {
if (event.detail.changed.indexOf("soundplaying") >= 0) {
return (++receivedSoundPlaying == 2);
}
return false;
});
ok(newTab.hasAttribute("muted"), "Expected the correct muted attribute on the new tab");

View File

@ -1,42 +1,42 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
add_task(function* () {
let firstLocation = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
yield BrowserTestUtils.openNewForegroundTab(gBrowser, firstLocation);
yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
// Push the state before maximizing the window and clicking below.
content.history.pushState("page2", "page2", "page2");
// While in the child process, add a listener for the popstate event here. This
// event will fire when the mouse click happens.
content.addEventListener("popstate", function onPopState() {
content.removeEventListener("popstate", onPopState, false);
sendAsyncMessage("Test:PopStateOccurred", { location: content.document.location.href });
}, false);
});
window.maximize();
// Find where the nav-bar is vertically.
var navBar = document.getElementById("nav-bar");
var boundingRect = navBar.getBoundingClientRect();
var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2);
var xPixel = 0; // Use the first pixel of the screen since it is maximized.
let resultLocation = yield new Promise(resolve => {
messageManager.addMessageListener("Test:PopStateOccurred", function statePopped(message) {
messageManager.removeMessageListener("Test:PopStateOccurred", statePopped);
resolve(message.data.location);
});
EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window);
});
is(resultLocation, firstLocation, "Clicking the first pixel should have navigated back.");
window.restore();
gBrowser.removeCurrentTab();
});
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
add_task(function* () {
let firstLocation = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
yield BrowserTestUtils.openNewForegroundTab(gBrowser, firstLocation);
yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
// Push the state before maximizing the window and clicking below.
content.history.pushState("page2", "page2", "page2");
// While in the child process, add a listener for the popstate event here. This
// event will fire when the mouse click happens.
content.addEventListener("popstate", function onPopState() {
content.removeEventListener("popstate", onPopState, false);
sendAsyncMessage("Test:PopStateOccurred", { location: content.document.location.href });
}, false);
});
window.maximize();
// Find where the nav-bar is vertically.
var navBar = document.getElementById("nav-bar");
var boundingRect = navBar.getBoundingClientRect();
var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2);
var xPixel = 0; // Use the first pixel of the screen since it is maximized.
let resultLocation = yield new Promise(resolve => {
messageManager.addMessageListener("Test:PopStateOccurred", function statePopped(message) {
messageManager.removeMessageListener("Test:PopStateOccurred", statePopped);
resolve(message.data.location);
});
EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window);
});
is(resultLocation, firstLocation, "Clicking the first pixel should have navigated back.");
window.restore();
gBrowser.removeCurrentTab();
});

View File

@ -81,7 +81,7 @@ function errorPageLoaded() {
return BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
}).then(pinningRemovalLoaded);
});
};
}
// After the pinning information has been removed (successful load) proceed
// to load again with the invalid pin domain.
@ -89,7 +89,7 @@ function pinningRemovalLoaded() {
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "https://" + kBadPinningDomain).then(function() {
return BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
}).then(badPinningPageLoaded);
};
}
// Finally, we should successfully load
// https://bad.include-subdomains.pinning-dynamic.example.com.
@ -98,4 +98,4 @@ function badPinningPageLoaded() {
ok(true, "load complete");
finish();
});
};
}

View File

@ -1,257 +1,257 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
* Test opening and closing the bookmarks panel.
*/
let bookmarkPanel = document.getElementById("editBookmarkPanel");
let bookmarkStar = document.getElementById("bookmarks-menu-button");
let bookmarkPanelTitle = document.getElementById("editBookmarkPanelTitle");
StarUI._closePanelQuickForTesting = true;
function* test_bookmarks_popup({isNewBookmark, popupShowFn, popupEditFn,
shouldAutoClose, popupHideFn, isBookmarkRemoved}) {
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:home");
try {
if (!isNewBookmark) {
yield PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: "about:home",
title: "Home Page"
});
}
is(bookmarkStar.hasAttribute("starred"), !isNewBookmark,
"Page should only be starred prior to popupshown if editing bookmark");
is(bookmarkPanel.state, "closed", "Panel should be 'closed' to start test");
let shownPromise = promisePopupShown(bookmarkPanel);
yield popupShowFn(tab.linkedBrowser);
yield shownPromise;
is(bookmarkPanel.state, "open", "Panel should be 'open' after shownPromise is resolved");
if (popupEditFn) {
yield popupEditFn();
}
let bookmarks = [];
yield PlacesUtils.bookmarks.fetch({url: "about:home"}, bm => bookmarks.push(bm));
is(bookmarks.length, 1, "Only one bookmark should exist");
is(bookmarkStar.getAttribute("starred"), "true", "Page is starred");
is(bookmarkPanelTitle.value,
isNewBookmark ?
gNavigatorBundle.getString("editBookmarkPanel.pageBookmarkedTitle") :
gNavigatorBundle.getString("editBookmarkPanel.editBookmarkTitle"),
"title should match isEditingBookmark state");
if (!shouldAutoClose) {
yield new Promise(resolve => setTimeout(resolve, 400));
is(bookmarkPanel.state, "open", "Panel should still be 'open' for non-autoclose");
}
let hiddenPromise = promisePopupHidden(bookmarkPanel);
if (popupHideFn) {
yield popupHideFn();
}
yield hiddenPromise;
is(bookmarkStar.hasAttribute("starred"), !isBookmarkRemoved,
"Page is starred after closing");
} finally {
let bookmark = yield PlacesUtils.bookmarks.fetch({url: "about:home"});
is(!!bookmark, !isBookmarkRemoved,
"bookmark should not be present if a panel action should've removed it");
if (bookmark) {
yield PlacesUtils.bookmarks.remove(bookmark);
}
gBrowser.removeTab(tab);
}
}
add_task(function* panel_shown_for_new_bookmarks_and_autocloses() {
yield test_bookmarks_popup({
isNewBookmark: true,
popupShowFn() {
bookmarkStar.click();
},
shouldAutoClose: true,
isBookmarkRemoved: false,
});
});
add_task(function* panel_shown_for_once_for_doubleclick_on_new_bookmark_star_and_autocloses() {
yield test_bookmarks_popup({
isNewBookmark: true,
popupShowFn() {
EventUtils.synthesizeMouse(bookmarkStar, 10, 10, { clickCount: 2 },
window);
},
shouldAutoClose: true,
isBookmarkRemoved: false,
});
});
add_task(function* panel_shown_once_for_slow_doubleclick_on_new_bookmark_star_and_autocloses() {
todo(false, "bug 1250267, may need to add some tracking state to " +
"browser-places.js for this.");
return;
yield test_bookmarks_popup({
isNewBookmark: true,
*popupShowFn() {
EventUtils.synthesizeMouse(bookmarkStar, 10, 10, window);
yield new Promise(resolve => setTimeout(resolve, 300));
EventUtils.synthesizeMouse(bookmarkStar, 10, 10, window);
},
shouldAutoClose: true,
isBookmarkRemoved: false,
});
});
add_task(function* panel_shown_for_keyboardshortcut_on_new_bookmark_star_and_autocloses() {
yield test_bookmarks_popup({
isNewBookmark: true,
popupShowFn() {
EventUtils.synthesizeKey("D", {accelKey: true}, window);
},
shouldAutoClose: true,
isBookmarkRemoved: false,
});
});
add_task(function* panel_shown_for_new_bookmarks_mousemove_mouseout() {
yield test_bookmarks_popup({
isNewBookmark: true,
popupShowFn() {
bookmarkStar.click();
},
*popupEditFn() {
let mouseMovePromise = BrowserTestUtils.waitForEvent(bookmarkPanel, "mousemove");
EventUtils.synthesizeMouseAtCenter(bookmarkPanel, {type: "mousemove"});
info("Waiting for mousemove event");
yield mouseMovePromise;
info("Got mousemove event");
yield new Promise(resolve => setTimeout(resolve, 400));
is(bookmarkPanel.state, "open", "Panel should still be open on mousemove");
},
*popupHideFn() {
let mouseOutPromise = BrowserTestUtils.waitForEvent(bookmarkPanel, "mouseout");
EventUtils.synthesizeMouse(bookmarkPanel, 0, 0, {type: "mouseout"});
EventUtils.synthesizeMouseAtCenter(document.documentElement, {type: "mousemove"});
info("Waiting for mouseout event");
yield mouseOutPromise;
info("Got mouseout event, should autoclose now");
},
shouldAutoClose: false,
isBookmarkRemoved: false,
});
});
add_task(function* panel_shown_for_new_bookmark_no_autoclose_close_with_ESC() {
yield test_bookmarks_popup({
isNewBookmark: false,
popupShowFn() {
bookmarkStar.click();
},
shouldAutoClose: false,
popupHideFn() {
EventUtils.synthesizeKey("VK_ESCAPE", {accelKey: true}, window);
},
isBookmarkRemoved: false,
});
});
add_task(function* panel_shown_for_editing_no_autoclose_close_with_ESC() {
yield test_bookmarks_popup({
isNewBookmark: false,
popupShowFn() {
bookmarkStar.click();
},
shouldAutoClose: false,
popupHideFn() {
EventUtils.synthesizeKey("VK_ESCAPE", {accelKey: true}, window);
},
isBookmarkRemoved: false,
});
});
add_task(function* panel_shown_for_new_bookmark_keypress_no_autoclose() {
yield test_bookmarks_popup({
isNewBookmark: true,
popupShowFn() {
bookmarkStar.click();
},
popupEditFn() {
EventUtils.sendChar("VK_TAB", window);
},
shouldAutoClose: false,
popupHideFn() {
bookmarkPanel.hidePopup();
},
isBookmarkRemoved: false,
});
});
add_task(function* contextmenu_new_bookmark_keypress_no_autoclose() {
yield test_bookmarks_popup({
isNewBookmark: true,
*popupShowFn(browser) {
let contextMenu = document.getElementById("contentAreaContextMenu");
let awaitPopupShown = BrowserTestUtils.waitForEvent(contextMenu,
"popupshown");
let awaitPopupHidden = BrowserTestUtils.waitForEvent(contextMenu,
"popuphidden");
yield BrowserTestUtils.synthesizeMouseAtCenter("body", {
type: "contextmenu",
button: 2
}, browser);
yield awaitPopupShown;
document.getElementById("context-bookmarkpage").click();
contextMenu.hidePopup();
yield awaitPopupHidden;
},
popupEditFn() {
EventUtils.sendChar("VK_TAB", window);
},
shouldAutoClose: false,
popupHideFn() {
bookmarkPanel.hidePopup();
},
isBookmarkRemoved: false,
});
});
add_task(function* bookmarks_menu_new_bookmark_remove_bookmark() {
yield test_bookmarks_popup({
isNewBookmark: true,
popupShowFn(browser) {
document.getElementById("menu_bookmarkThisPage").doCommand();
},
shouldAutoClose: true,
popupHideFn() {
document.getElementById("editBookmarkPanelRemoveButton").click();
},
isBookmarkRemoved: true,
});
});
add_task(function* ctrl_d_edit_bookmark_remove_bookmark() {
yield test_bookmarks_popup({
isNewBookmark: false,
popupShowFn(browser) {
EventUtils.synthesizeKey("D", {accelKey: true}, window);
},
shouldAutoClose: true,
popupHideFn() {
document.getElementById("editBookmarkPanelRemoveButton").click();
},
isBookmarkRemoved: true,
});
});
registerCleanupFunction(function() {
delete StarUI._closePanelQuickForTesting;
})
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
* Test opening and closing the bookmarks panel.
*/
let bookmarkPanel = document.getElementById("editBookmarkPanel");
let bookmarkStar = document.getElementById("bookmarks-menu-button");
let bookmarkPanelTitle = document.getElementById("editBookmarkPanelTitle");
StarUI._closePanelQuickForTesting = true;
function* test_bookmarks_popup({isNewBookmark, popupShowFn, popupEditFn,
shouldAutoClose, popupHideFn, isBookmarkRemoved}) {
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:home");
try {
if (!isNewBookmark) {
yield PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: "about:home",
title: "Home Page"
});
}
is(bookmarkStar.hasAttribute("starred"), !isNewBookmark,
"Page should only be starred prior to popupshown if editing bookmark");
is(bookmarkPanel.state, "closed", "Panel should be 'closed' to start test");
let shownPromise = promisePopupShown(bookmarkPanel);
yield popupShowFn(tab.linkedBrowser);
yield shownPromise;
is(bookmarkPanel.state, "open", "Panel should be 'open' after shownPromise is resolved");
if (popupEditFn) {
yield popupEditFn();
}
let bookmarks = [];
yield PlacesUtils.bookmarks.fetch({url: "about:home"}, bm => bookmarks.push(bm));
is(bookmarks.length, 1, "Only one bookmark should exist");
is(bookmarkStar.getAttribute("starred"), "true", "Page is starred");
is(bookmarkPanelTitle.value,
isNewBookmark ?
gNavigatorBundle.getString("editBookmarkPanel.pageBookmarkedTitle") :
gNavigatorBundle.getString("editBookmarkPanel.editBookmarkTitle"),
"title should match isEditingBookmark state");
if (!shouldAutoClose) {
yield new Promise(resolve => setTimeout(resolve, 400));
is(bookmarkPanel.state, "open", "Panel should still be 'open' for non-autoclose");
}
let hiddenPromise = promisePopupHidden(bookmarkPanel);
if (popupHideFn) {
yield popupHideFn();
}
yield hiddenPromise;
is(bookmarkStar.hasAttribute("starred"), !isBookmarkRemoved,
"Page is starred after closing");
} finally {
let bookmark = yield PlacesUtils.bookmarks.fetch({url: "about:home"});
is(!!bookmark, !isBookmarkRemoved,
"bookmark should not be present if a panel action should've removed it");
if (bookmark) {
yield PlacesUtils.bookmarks.remove(bookmark);
}
gBrowser.removeTab(tab);
}
}
add_task(function* panel_shown_for_new_bookmarks_and_autocloses() {
yield test_bookmarks_popup({
isNewBookmark: true,
popupShowFn() {
bookmarkStar.click();
},
shouldAutoClose: true,
isBookmarkRemoved: false,
});
});
add_task(function* panel_shown_for_once_for_doubleclick_on_new_bookmark_star_and_autocloses() {
yield test_bookmarks_popup({
isNewBookmark: true,
popupShowFn() {
EventUtils.synthesizeMouse(bookmarkStar, 10, 10, { clickCount: 2 },
window);
},
shouldAutoClose: true,
isBookmarkRemoved: false,
});
});
add_task(function* panel_shown_once_for_slow_doubleclick_on_new_bookmark_star_and_autocloses() {
todo(false, "bug 1250267, may need to add some tracking state to " +
"browser-places.js for this.");
return;
yield test_bookmarks_popup({
isNewBookmark: true,
*popupShowFn() {
EventUtils.synthesizeMouse(bookmarkStar, 10, 10, window);
yield new Promise(resolve => setTimeout(resolve, 300));
EventUtils.synthesizeMouse(bookmarkStar, 10, 10, window);
},
shouldAutoClose: true,
isBookmarkRemoved: false,
});
});
add_task(function* panel_shown_for_keyboardshortcut_on_new_bookmark_star_and_autocloses() {
yield test_bookmarks_popup({
isNewBookmark: true,
popupShowFn() {
EventUtils.synthesizeKey("D", {accelKey: true}, window);
},
shouldAutoClose: true,
isBookmarkRemoved: false,
});
});
add_task(function* panel_shown_for_new_bookmarks_mousemove_mouseout() {
yield test_bookmarks_popup({
isNewBookmark: true,
popupShowFn() {
bookmarkStar.click();
},
*popupEditFn() {
let mouseMovePromise = BrowserTestUtils.waitForEvent(bookmarkPanel, "mousemove");
EventUtils.synthesizeMouseAtCenter(bookmarkPanel, {type: "mousemove"});
info("Waiting for mousemove event");
yield mouseMovePromise;
info("Got mousemove event");
yield new Promise(resolve => setTimeout(resolve, 400));
is(bookmarkPanel.state, "open", "Panel should still be open on mousemove");
},
*popupHideFn() {
let mouseOutPromise = BrowserTestUtils.waitForEvent(bookmarkPanel, "mouseout");
EventUtils.synthesizeMouse(bookmarkPanel, 0, 0, {type: "mouseout"});
EventUtils.synthesizeMouseAtCenter(document.documentElement, {type: "mousemove"});
info("Waiting for mouseout event");
yield mouseOutPromise;
info("Got mouseout event, should autoclose now");
},
shouldAutoClose: false,
isBookmarkRemoved: false,
});
});
add_task(function* panel_shown_for_new_bookmark_no_autoclose_close_with_ESC() {
yield test_bookmarks_popup({
isNewBookmark: false,
popupShowFn() {
bookmarkStar.click();
},
shouldAutoClose: false,
popupHideFn() {
EventUtils.synthesizeKey("VK_ESCAPE", {accelKey: true}, window);
},
isBookmarkRemoved: false,
});
});
add_task(function* panel_shown_for_editing_no_autoclose_close_with_ESC() {
yield test_bookmarks_popup({
isNewBookmark: false,
popupShowFn() {
bookmarkStar.click();
},
shouldAutoClose: false,
popupHideFn() {
EventUtils.synthesizeKey("VK_ESCAPE", {accelKey: true}, window);
},
isBookmarkRemoved: false,
});
});
add_task(function* panel_shown_for_new_bookmark_keypress_no_autoclose() {
yield test_bookmarks_popup({
isNewBookmark: true,
popupShowFn() {
bookmarkStar.click();
},
popupEditFn() {
EventUtils.sendChar("VK_TAB", window);
},
shouldAutoClose: false,
popupHideFn() {
bookmarkPanel.hidePopup();
},
isBookmarkRemoved: false,
});
});
add_task(function* contextmenu_new_bookmark_keypress_no_autoclose() {
yield test_bookmarks_popup({
isNewBookmark: true,
*popupShowFn(browser) {
let contextMenu = document.getElementById("contentAreaContextMenu");
let awaitPopupShown = BrowserTestUtils.waitForEvent(contextMenu,
"popupshown");
let awaitPopupHidden = BrowserTestUtils.waitForEvent(contextMenu,
"popuphidden");
yield BrowserTestUtils.synthesizeMouseAtCenter("body", {
type: "contextmenu",
button: 2
}, browser);
yield awaitPopupShown;
document.getElementById("context-bookmarkpage").click();
contextMenu.hidePopup();
yield awaitPopupHidden;
},
popupEditFn() {
EventUtils.sendChar("VK_TAB", window);
},
shouldAutoClose: false,
popupHideFn() {
bookmarkPanel.hidePopup();
},
isBookmarkRemoved: false,
});
});
add_task(function* bookmarks_menu_new_bookmark_remove_bookmark() {
yield test_bookmarks_popup({
isNewBookmark: true,
popupShowFn(browser) {
document.getElementById("menu_bookmarkThisPage").doCommand();
},
shouldAutoClose: true,
popupHideFn() {
document.getElementById("editBookmarkPanelRemoveButton").click();
},
isBookmarkRemoved: true,
});
});
add_task(function* ctrl_d_edit_bookmark_remove_bookmark() {
yield test_bookmarks_popup({
isNewBookmark: false,
popupShowFn(browser) {
EventUtils.synthesizeKey("D", {accelKey: true}, window);
},
shouldAutoClose: true,
popupHideFn() {
document.getElementById("editBookmarkPanelRemoveButton").click();
},
isBookmarkRemoved: true,
});
});
registerCleanupFunction(function() {
delete StarUI._closePanelQuickForTesting;
})

View File

@ -10,7 +10,7 @@ var gTab1, gTab2, gLevel1;
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
gTab1 = gBrowser.addTab();
gTab2 = gBrowser.addTab();
@ -21,7 +21,7 @@ function test() {
}
function zoomTab1() {
Task.spawn(function () {
Task.spawn(function* () {
is(gBrowser.selectedTab, gTab1, "Tab 1 is selected");
FullZoomHelper.zoomTest(gTab1, 1, "Initial zoom of tab 1 should be 1");
FullZoomHelper.zoomTest(gTab2, 1, "Initial zoom of tab 2 should be 1");
@ -43,7 +43,7 @@ function zoomTab1() {
}
function finishTest() {
Task.spawn(function () {
Task.spawn(function* () {
yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
yield FullZoom.reset();
yield FullZoomHelper.removeTabAndWaitForLocationChange(gTab1);

View File

@ -70,4 +70,4 @@ add_task(function* test_active_selection_switches_properly()
yield BrowserTestUtils.removeTab(tab1);
yield BrowserTestUtils.removeTab(tab2);
});
});

View File

@ -10,12 +10,12 @@ var gTests = [
{ desc: "Urlbar strips newlines and surrounding whitespace",
element: gURLBar,
expected: kTestString.replace(/\s*\n\s*/g,'')
expected: kTestString.replace(/\s*\n\s*/g, '')
},
{ desc: "Searchbar replaces newlines with spaces",
element: document.getElementById('searchbar'),
expected: kTestString.replace(/\n/g,' ')
expected: kTestString.replace(/\n/g, ' ')
},
];

View File

@ -8,7 +8,7 @@ const FORWARD = 1;
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
gTab1 = gBrowser.addTab(gTestPage);
gTab2 = gBrowser.addTab();
gTab3 = gBrowser.addTab();
@ -20,7 +20,7 @@ function test() {
}
function secondPageLoaded() {
Task.spawn(function () {
Task.spawn(function* () {
FullZoomHelper.zoomTest(gTab1, 1, "Initial zoom of tab 1 should be 1");
FullZoomHelper.zoomTest(gTab2, 1, "Initial zoom of tab 2 should be 1");
FullZoomHelper.zoomTest(gTab3, 1, "Initial zoom of tab 3 should be 1");
@ -39,7 +39,7 @@ function secondPageLoaded() {
}
function thirdPageLoaded() {
Task.spawn(function () {
Task.spawn(function* () {
FullZoomHelper.zoomTest(gTab1, gLevel, "Tab 1 should still be zoomed");
FullZoomHelper.zoomTest(gTab2, 1, "Tab 2 should still not be affected");
FullZoomHelper.zoomTest(gTab3, gLevel, "Tab 3 should have zoomed as it was loading in the background");
@ -55,7 +55,7 @@ function thirdPageLoaded() {
}
function imageLoaded() {
Task.spawn(function () {
Task.spawn(function* () {
FullZoomHelper.zoomTest(gTab1, 1, "Zoom should be 1 when image was loaded in the background");
yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
FullZoomHelper.zoomTest(gTab1, 1, "Zoom should still be 1 when tab with image is selected");
@ -63,7 +63,7 @@ function imageLoaded() {
}
function imageZoomSwitch() {
Task.spawn(function () {
Task.spawn(function* () {
yield FullZoomHelper.navigate(BACK);
yield FullZoomHelper.navigate(FORWARD);
FullZoomHelper.zoomTest(gTab1, 1, "Tab 1 should not be zoomed when an image loads");
@ -75,7 +75,7 @@ function imageZoomSwitch() {
var finishTestStarted = false;
function finishTest() {
Task.spawn(function () {
Task.spawn(function* () {
ok(!finishTestStarted, "finishTest called more than once");
finishTestStarted = true;
yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);

View File

@ -1,6 +1,6 @@
var tabElm, zoomLevel;
function start_test_prefNotSet() {
Task.spawn(function () {
Task.spawn(function* () {
is(ZoomManager.zoom, 1, "initial zoom level should be 1");
FullZoom.enlarge();
@ -13,7 +13,7 @@ function start_test_prefNotSet() {
}
function continue_test_prefNotSet () {
Task.spawn(function () {
Task.spawn(function* () {
is(ZoomManager.zoom, 1, "zoom level pref should not apply to an image");
yield FullZoom.reset();
@ -22,7 +22,7 @@ function continue_test_prefNotSet () {
}
function end_test_prefNotSet() {
Task.spawn(function () {
Task.spawn(function* () {
is(ZoomManager.zoom, zoomLevel, "the zoom level should have persisted");
// Reset the zoom so that other tests have a fresh zoom level
@ -35,7 +35,7 @@ function end_test_prefNotSet() {
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
tabElm = gBrowser.addTab();
yield FullZoomHelper.selectTabAndWaitForLocationChange(tabElm);
yield FullZoomHelper.load(tabElm, "http://mochi.test:8888/browser/browser/base/content/test/general/zoom_test.html");

View File

@ -20,11 +20,11 @@ add_task(function* () {
let popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown");
yield BrowserTestUtils.synthesizeMouse("frame", 5, 5,
{ type: "contextmenu", button: 2}, gBrowser.selectedBrowser);
yield popupShownPromise;
yield popupShownPromise;
ok(document.getElementById("frame-sep").hidden, "'frame-sep' should be hidden if the selection contains only spaces");
let popupHiddenPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popuphidden");
contentAreaContextMenu.hidePopup();
yield popupHiddenPromise;
yield popupHiddenPromise;
});

View File

@ -1,7 +1,7 @@
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
let testPage = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
let tab1 = gBrowser.addTab();
yield FullZoomHelper.selectTabAndWaitForLocationChange(tab1);

View File

@ -13,7 +13,7 @@ function test() {
const TEST_PAGE_URL = 'data:text/html,<body><iframe src=""></iframe></body>';
const TEST_IFRAME_URL = "http://test2.example.org/";
Task.spawn(function () {
Task.spawn(function* () {
// Prepare the test tab
let tab = gBrowser.addTab();
yield FullZoomHelper.selectTabAndWaitForLocationChange(tab);

View File

@ -4,7 +4,7 @@ function test() {
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);

View File

@ -2,14 +2,14 @@ function test() {
waitForExplicitFinish();
let tab = gBrowser.selectedTab = gBrowser.addTab(
"http://mochi.test:8888/browser/browser/base/content/test/general/browser_bug479408_sample.html");
gBrowser.addEventListener("DOMLinkAdded", function(aEvent) {
gBrowser.removeEventListener("DOMLinkAdded", arguments.callee, true);
executeSoon(function() {
ok(!tab.linkedBrowser.engines,
"the subframe's search engine wasn't detected");
gBrowser.removeTab(tab);
finish();
});

View File

@ -4,7 +4,7 @@ function test() {
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);

View File

@ -703,7 +703,7 @@ function test_localfile() {
try {
var path = cr.convertChromeURL(makeURI(CHROMEROOT + "corrupt.xpi")).spec;
} catch (ex) {
var path = CHROMEROOT + "corrupt.xpi";
path = CHROMEROOT + "corrupt.xpi";
}
gBrowser.selectedTab = gBrowser.addTab("about:blank");
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
@ -1133,7 +1133,7 @@ function runNextTest() {
gTestStart = Date.now();
TESTS.shift()();
});
};
}
var XPInstallObserver = {
observe: function (aSubject, aTopic, aData) {

View File

@ -5,7 +5,7 @@ const TEST_PAGE = "/browser/browser/base/content/test/general/dummy_page.html";
var gTestTab, gBgTab, gTestZoom;
function testBackgroundLoad() {
Task.spawn(function () {
Task.spawn(function* () {
is(ZoomManager.zoom, gTestZoom, "opening a background tab should not change foreground zoom");
yield FullZoomHelper.removeTabAndWaitForLocationChange(gBgTab);
@ -17,7 +17,7 @@ function testBackgroundLoad() {
}
function testInitialZoom() {
Task.spawn(function () {
Task.spawn(function* () {
is(ZoomManager.zoom, 1, "initial zoom level should be 1");
FullZoom.enlarge();
@ -32,7 +32,7 @@ function testInitialZoom() {
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
gTestTab = gBrowser.addTab();
yield FullZoomHelper.selectTabAndWaitForLocationChange(gTestTab);
yield FullZoomHelper.load(gTestTab, "http://example.org" + TEST_PAGE);

View File

@ -51,4 +51,4 @@
// Press enter!
EventUtils.synthesizeKey("VK_RETURN", {});
});

View File

@ -12,7 +12,7 @@ function test() {
let uri = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
Task.spawn(function () {
Task.spawn(function* () {
tab = gBrowser.addTab();
yield FullZoomHelper.load(tab, uri);
@ -26,7 +26,7 @@ function test() {
// -------------
// Test clean-up
function endTest() {
Task.spawn(function () {
Task.spawn(function* () {
yield FullZoomHelper.removeTabAndWaitForLocationChange(tab);
tab = null;

View File

@ -34,12 +34,12 @@ function getDocHeader()
{
return "<html><head><meta charset='utf-8'></head><body>" + getEmptyFrame();
}
function getDocFooter()
{
return "</body></html>";
}
function getEmptyFrame()
{
return "<iframe style='width:100px; height:30px; margin:3px; border:1px solid lightgray;' " +

View File

@ -9,7 +9,7 @@ function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
tab1 = gBrowser.addTab();
tab2 = gBrowser.addTab();
yield FullZoomHelper.selectTabAndWaitForLocationChange(tab1);

View File

@ -22,7 +22,7 @@ function test() {
is(gBrowser.tabs.length, 2, "there are two remaining tabs open");
is(gBrowser.tabs[0], testTab2, "pinned tab2 stayed open");
is(gBrowser.tabs[1], testTab1, "tab1 stayed open");
// Cleanup. Close only one tab because we need an opened tab at the end of
// the test.
gBrowser.removeTab(testTab2);

View File

@ -10,16 +10,16 @@ function test() {
function mainPart() {
gBrowser.pinTab(newTab);
gBrowser.selectedTab = newTab;
openUILinkIn("javascript:var x=0;", "current");
is(gBrowser.tabs.length, 2, "Should open in current tab");
openUILinkIn("http://example.com/1", "current");
is(gBrowser.tabs.length, 2, "Should open in current tab");
openUILinkIn("http://example.org/", "current");
is(gBrowser.tabs.length, 3, "Should open in new tab");
gBrowser.removeTab(newTab);
gBrowser.removeTab(gBrowser.tabs[1]); // example.org tab
finish();

View File

@ -41,7 +41,7 @@ function test() {
gBrowser.selectedTab = lastSelectedTab;
testState(false);
gBrowser.selectedTab = pinnedTab;
testState(true);
@ -49,7 +49,7 @@ function test() {
gBrowser.unpinTab(pinnedTab);
testState(false);
gBrowser.pinTab(pinnedTab);
gBrowser.pinTab(pinnedTab);
testState(true);
// Test updating the key state after removing the tab.

View File

@ -101,7 +101,7 @@ function test_hoverOne() {
}
function test_hoverStatePersistence() {
// Test that the afterhovered and beforehovered attributes are still there when
// Test that the afterhovered and beforehovered attributes are still there when
// a tab is selected and then unselected again. See bug 856107.
function assertState() {

View File

@ -7,19 +7,19 @@ function test() {
let tab2 = gBrowser.addTab("about:blank", {skipAnimation: true});
let tab3 = gBrowser.addTab();
gBrowser.selectedTab = tab2;
gBrowser.removeCurrentTab({animate: true});
gBrowser.tabContainer.advanceSelectedTab(-1, true);
is(gBrowser.selectedTab, tab1, "First tab should be selected");
gBrowser.removeTab(tab2);
// test for "null has no properties" fix. See Bug 585830 Comment 13
gBrowser.removeCurrentTab({animate: true});
try {
gBrowser.tabContainer.advanceSelectedTab(-1, false);
} catch(err) {
} catch (err) {
ok(false, "Shouldn't throw");
}
gBrowser.removeTab(tab1);
}

View File

@ -113,7 +113,7 @@ add_task(function* test_file() {
gBrowser.removeTab(newTab);
});
add_task(function test_resource_uri() {
add_task(function* test_resource_uri() {
let oldTab = gBrowser.selectedTab;
let dataURI = "resource://gre/modules/Services.jsm";
@ -130,7 +130,7 @@ add_task(function test_resource_uri() {
gBrowser.removeTab(newTab);
});
add_task(function test_data_uri() {
add_task(function* test_data_uri() {
let oldTab = gBrowser.selectedTab;
let dataURI = "data:text/html,hi"
@ -146,7 +146,7 @@ add_task(function test_data_uri() {
gBrowser.removeTab(newTab);
});
add_task(function test_about_uri() {
add_task(function* test_about_uri() {
let oldTab = gBrowser.selectedTab;
let aboutURI = "about:robots"

View File

@ -136,7 +136,7 @@ function runNextTest() {
info("Running " + TESTS[0].name);
TESTS.shift()();
});
};
}
function test() {
waitForExplicitFinish();

View File

@ -7,29 +7,29 @@ function test() {
// establish initial state
is(gBrowser.tabs.length, 1, "we start with one tab");
// create a tab
let tab = gBrowser.loadOneTab("about:blank");
ok(!tab.hidden, "tab starts out not hidden");
is(gBrowser.tabs.length, 2, "we now have two tabs");
// make sure .hidden is read-only
tab.hidden = true;
tab.hidden = true;
ok(!tab.hidden, "can't set .hidden directly");
// hide the tab
gBrowser.hideTab(tab);
ok(tab.hidden, "tab is hidden");
// now pin it and make sure it gets unhidden
gBrowser.pinTab(tab);
ok(tab.pinned, "tab was pinned");
ok(!tab.hidden, "tab was unhidden");
// try hiding it now that it's pinned; shouldn't be able to
gBrowser.hideTab(tab);
ok(!tab.hidden, "tab did not hide");
// clean up
gBrowser.removeTab(tab);
is(gBrowser.tabs.length, 1, "we finish with one tab");

View File

@ -16,7 +16,7 @@ add_task(function* () {
gURLBar.openPopup();
yield BrowserTestUtils.switchTab(gBrowser, tab2);
ok(!gURLBar.popupOpen, "urlbar focused in tab to switch to, close popup");
// cleanup
gBrowser.removeCurrentTab();
gBrowser.removeCurrentTab();

View File

@ -11,7 +11,7 @@ var gTab1, gTab2, gLevel1, gLevel2;
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
gTab1 = gBrowser.addTab();
gTab2 = gBrowser.addTab();
@ -22,7 +22,7 @@ function test() {
}
function zoomTab1() {
Task.spawn(function () {
Task.spawn(function* () {
is(gBrowser.selectedTab, gTab1, "Tab 1 is selected");
FullZoomHelper.zoomTest(gTab1, 1, "Initial zoom of tab 1 should be 1");
FullZoomHelper.zoomTest(gTab2, 1, "Initial zoom of tab 2 should be 1");
@ -40,7 +40,7 @@ function zoomTab1() {
}
function zoomTab2() {
Task.spawn(function () {
Task.spawn(function* () {
is(gBrowser.selectedTab, gTab2, "Tab 2 is selected");
FullZoom.reduce();
@ -55,7 +55,7 @@ function zoomTab2() {
}
function testNavigation() {
Task.spawn(function () {
Task.spawn(function* () {
yield FullZoomHelper.load(gTab1, TEST_VIDEO);
FullZoomHelper.zoomTest(gTab1, 1, "Zoom should be 1 when a video was loaded");
yield waitForNextTurn(); // trying to fix orange bug 806046
@ -75,7 +75,7 @@ function waitForNextTurn() {
var finishTestStarted = false;
function finishTest() {
Task.spawn(function () {
Task.spawn(function* () {
ok(!finishTestStarted, "finishTest called more than once");
finishTestStarted = true;

View File

@ -20,7 +20,7 @@ function test() {
try {
gFindBar.close();
ok(true, "findbar.close should not throw an exception");
} catch(e) {
} catch (e) {
ok(false, "findbar.close threw exception: " + e);
}
finish();

View File

@ -55,7 +55,7 @@ function MixedTest1B() {
waitForCondition(() => content.document.getElementById('p1').innerHTML == "hello", MixedTest1C, "Waited too long for mixed script to run in Test 1");
}
function MixedTest1C() {
ok(content.document.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 1");
ok(content.document.getElementById('p1').innerHTML == "hello", "Mixed script didn't load in Test 1");
gTestBrowser.removeEventListener("load", MixedTest1B, true);
MixedTest2();
}
@ -95,8 +95,8 @@ function MixedTest3C() {
waitForCondition(() => content.document.getElementById('p2').innerHTML == "bye", MixedTest3D, "Waited too long for mixed image to load in Test 3");
}
function MixedTest3D() {
ok(content.document.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 3");
ok(content.document.getElementById('p2').innerHTML == "bye","Mixed image didn't load in Test 3");
ok(content.document.getElementById('p1').innerHTML == "hello", "Mixed script didn't load in Test 3");
ok(content.document.getElementById('p2').innerHTML == "bye", "Mixed image didn't load in Test 3");
assertMixedContentBlockingState(gTestBrowser, {activeLoaded: true, activeBlocked: false, passiveLoaded: true});
MixedTest4();
}
@ -129,7 +129,7 @@ function MixedTest4C() {
waitForCondition(() => content.document.getElementById('p1').innerHTML == "", MixedTest4D, "Mixed script loaded in test 4 after location change!");
}
function MixedTest4D() {
ok(content.document.getElementById('p1').innerHTML == "","p1.innerHTML changed; mixed script loaded after location change in Test 4");
ok(content.document.getElementById('p1').innerHTML == "", "p1.innerHTML changed; mixed script loaded after location change in Test 4");
MixedTest5();
}
@ -153,7 +153,7 @@ function MixedTest5B() {
waitForCondition(() => content.document.getElementById('p1').innerHTML == "hello", MixedTest5C, "Waited too long for mixed script to run in Test 5");
}
function MixedTest5C() {
ok(content.document.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 5");
ok(content.document.getElementById('p1').innerHTML == "hello", "Mixed script didn't load in Test 5");
MixedTest6();
}
@ -190,7 +190,7 @@ function MixedTest6C() {
}, MixedTest6D, "Waited too long for mixed script to run in Test 6");
}
function MixedTest6D() {
ok(content.document.getElementById('f1').contentDocument.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 6");
ok(content.document.getElementById('f1').contentDocument.getElementById('p1').innerHTML == "hello", "Mixed script didn't load in Test 6");
assertMixedContentBlockingState(gTestBrowser, {activeLoaded: true, activeBlocked: false, passiveLoaded: false});
MixedTestsCompleted();
}

View File

@ -1,36 +1,36 @@
"use strict";
/**
* Tests that the identity-box shows the chromeUI styling
* when viewing about:home in a new window.
*/
add_task(function*(){
let homepage = "about:home";
yield SpecialPowers.pushPrefEnv({
"set": [
["browser.startup.homepage", homepage],
["browser.startup.page", 1],
]
});
let win = OpenBrowserWindow();
yield BrowserTestUtils.waitForEvent(win, "load");
let browser = win.gBrowser.selectedBrowser;
// If we've finished loading about:home already, we can check
// right away - otherwise, we need to wait.
if (browser.contentDocument.readyState == "complete" &&
browser.currentURI.spec == homepage) {
checkIdentityMode(win);
} else {
yield BrowserTestUtils.browserLoaded(browser, false, homepage);
checkIdentityMode(win);
}
yield BrowserTestUtils.closeWindow(win);
});
function checkIdentityMode(win) {
let identityMode = win.document.getElementById("identity-box").className;
is(identityMode, "chromeUI", "Identity state should be chromeUI for about:home in a new window");
}
"use strict";
/**
* Tests that the identity-box shows the chromeUI styling
* when viewing about:home in a new window.
*/
add_task(function*() {
let homepage = "about:home";
yield SpecialPowers.pushPrefEnv({
"set": [
["browser.startup.homepage", homepage],
["browser.startup.page", 1],
]
});
let win = OpenBrowserWindow();
yield BrowserTestUtils.waitForEvent(win, "load");
let browser = win.gBrowser.selectedBrowser;
// If we've finished loading about:home already, we can check
// right away - otherwise, we need to wait.
if (browser.contentDocument.readyState == "complete" &&
browser.currentURI.spec == homepage) {
checkIdentityMode(win);
} else {
yield BrowserTestUtils.browserLoaded(browser, false, homepage);
checkIdentityMode(win);
}
yield BrowserTestUtils.closeWindow(win);
});
function checkIdentityMode(win) {
let identityMode = win.document.getElementById("identity-box").className;
is(identityMode, "chromeUI", "Identity state should be chromeUI for about:home in a new window");
}

View File

@ -65,7 +65,7 @@ add_task(function*() {
yield new Promise((resolve, reject) => {
addEventListener("paste", function copyEvent(event) {
removeEventListener("paste", copyEvent, true);
let clipboardData = event.clipboardData;
let clipboardData = event.clipboardData;
Assert.equal(clipboardData.mozItemCount, 1, "One item on clipboard");
Assert.equal(clipboardData.types.length, 2, "Two types on clipboard");
Assert.equal(clipboardData.types[0], "text/html", "text/html on clipboard");
@ -101,7 +101,7 @@ add_task(function*() {
yield new Promise((resolve, reject) => {
addEventListener("paste", function copyEvent(event) {
removeEventListener("paste", copyEvent, true);
let clipboardData = event.clipboardData;
let clipboardData = event.clipboardData;
Assert.equal(clipboardData.mozItemCount, 1, "One item on clipboard 2");
Assert.equal(clipboardData.types.length, 2, "Two types on clipboard 2");
Assert.equal(clipboardData.types[0], "text/html", "text/html on clipboard 2");

View File

@ -17,7 +17,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
"resource://testing-common/PlacesTestUtils.jsm");
function setup(){
function setup() {
gPrefService.setBoolPref("browser.altClickSave", true);
let testPage =
@ -52,7 +52,7 @@ add_task(function* test_alt_click()
let downloads = [];
let downloadView;
// When 1 download has been attempted then resolve the promise.
let finishedAllDownloads = new Promise( (resolve)=> {
let finishedAllDownloads = new Promise( (resolve) => {
downloadView = {
onDownloadAdded: function (aDownload) {
downloads.push(aDownload);
@ -81,7 +81,7 @@ add_task(function* test_alt_click_on_xlinks()
let downloads = [];
let downloadView;
// When all 2 downloads have been attempted then resolve the promise.
let finishedAllDownloads = new Promise( (resolve)=> {
let finishedAllDownloads = new Promise( (resolve) => {
downloadView = {
onDownloadAdded: function (aDownload) {
downloads.push(aDownload);
@ -104,4 +104,4 @@ add_task(function* test_alt_click_on_xlinks()
is(downloads[1].source.url, "http://mochi.test/moz/", "Downloaded #svgxlink element");
yield* clean_up();
});
});

View File

@ -1,7 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Test for bug 549340.
* Test for browser.js::contentAreaClick() util.
@ -45,7 +45,7 @@ var gTests = [
gPrefService.setBoolPref("browser.altClickSave", true);
},
clean: function() {
gPrefService.clearUserPref("browser.altClickSave");
gPrefService.clearUserPref("browser.altClickSave");
},
event: { shiftKey: true,
altKey: true },
@ -60,7 +60,7 @@ var gTests = [
gPrefService.setBoolPref("browser.altClickSave", true);
},
clean: function() {
gPrefService.clearUserPref("browser.altClickSave");
gPrefService.clearUserPref("browser.altClickSave");
},
event: { shiftKey: true,
altKey: true },
@ -85,7 +85,7 @@ var gTests = [
gPrefService.setBoolPref("browser.altClickSave", true);
},
clean: function() {
gPrefService.clearUserPref("browser.altClickSave");
gPrefService.clearUserPref("browser.altClickSave");
},
event: { altKey: true },
targets: [ "commonlink", "maplink" ],
@ -99,7 +99,7 @@ var gTests = [
gPrefService.setBoolPref("browser.altClickSave", true);
},
clean: function() {
gPrefService.clearUserPref("browser.altClickSave");
gPrefService.clearUserPref("browser.altClickSave");
},
event: { altKey: true },
targets: [ "mathxlink", "svgxlink" ],
@ -215,7 +215,7 @@ var gClickHandler = {
isnot(gInvokedMethods.indexOf(aExpectedMethodName), -1,
gCurrentTest.desc + ":" + aExpectedMethodName + " was invoked");
});
if (gInvokedMethods.length != gCurrentTest.expectedInvokedMethods.length) {
ok(false, "Wrong number of invoked methods");
gInvokedMethods.forEach(method => info(method + " was invoked"));

File diff suppressed because it is too large Load Diff

View File

@ -7,9 +7,9 @@ add_task(function* () {
checkTabs(4);
yield ctrlTabTest([2] , 1, 0);
yield ctrlTabTest([2], 1, 0);
yield ctrlTabTest([2, 3, 1], 2, 2);
yield ctrlTabTest([] , 4, 2);
yield ctrlTabTest([], 4, 2);
{
let selectedIndex = gBrowser.tabContainer.selectedIndex;

View File

@ -96,7 +96,7 @@ var checkInfobarButton = Task.async(function* (aNotification) {
yield promiseNextTick();
});
add_task(function* setup(){
add_task(function* setup() {
const bypassNotification = Preferences.get(PREF_BYPASS_NOTIFICATION, true);
const currentPolicyVersion = Preferences.get(PREF_CURRENT_POLICY_VERSION, 1);
@ -120,7 +120,7 @@ function clearAcceptedPolicy() {
Preferences.reset(PREF_ACCEPTED_POLICY_DATE);
}
add_task(function* test_single_window(){
add_task(function* test_single_window() {
clearAcceptedPolicy();
// Close all the notifications, then try to trigger the data choices infobar.
@ -164,7 +164,7 @@ add_task(function* test_single_window(){
"Date pref set.");
});
add_task(function* test_multiple_windows(){
add_task(function* test_multiple_windows() {
clearAcceptedPolicy();
// Close all the notifications, then try to trigger the data choices infobar.
@ -211,7 +211,7 @@ add_task(function* test_multiple_windows(){
yield BrowserTestUtils.closeWindow(otherWindow);
// Check that we are clear to upload and that the policy data us saved.
Assert.ok(TelemetryReportingPolicy.canUpload(),"User should be allowed to upload now.");
Assert.ok(TelemetryReportingPolicy.canUpload(), "User should be allowed to upload now.");
Assert.equal(TelemetryReportingPolicy.testIsUserNotified(), true,
"User notified about datareporting policy.");
Assert.equal(Preferences.get(PREF_ACCEPTED_POLICY_VERSION, 0), TEST_POLICY_VERSION,

View File

@ -1,97 +1,97 @@
"use strict";
function* test_decoder_doctor_notification(type, notificationMessage, options) {
yield BrowserTestUtils.withNewTab({ gBrowser }, function*(browser) {
let awaitNotificationBar =
BrowserTestUtils.waitForNotificationBar(gBrowser, browser, "decoder-doctor-notification");
yield ContentTask.spawn(browser, type, function*(type) {
Services.obs.notifyObservers(content.window,
"decoder-doctor-notification",
JSON.stringify({type: type,
isSolved: false,
decoderDoctorReportId: "test",
formats: "test"}));
});
let notification;
try {
notification = yield awaitNotificationBar;
} catch (ex) {
ok(false, ex);
return;
}
ok(notification, "Got decoder-doctor-notification notification");
is(notification.getAttribute("label"), notificationMessage,
"notification message should match expectation");
let button = notification.childNodes[0];
if (options && options.noLearnMoreButton) {
ok(!button, "There should not be a Learn More button");
return;
}
is(button.getAttribute("label"), gNavigatorBundle.getString("decoder.noCodecs.button"),
"notification button should be 'Learn more'");
is(button.getAttribute("accesskey"), gNavigatorBundle.getString("decoder.noCodecs.accesskey"),
"notification button should have accesskey");
let baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL");
let url = baseURL + "fix-video-audio-problems-firefox-windows";
let awaitNewTab = BrowserTestUtils.waitForNewTab(gBrowser, url);
button.click();
let sumoTab = yield awaitNewTab;
yield BrowserTestUtils.removeTab(sumoTab);
});
}
add_task(function* test_adobe_cdm_not_found() {
// This is only sent on Windows.
if (AppConstants.platform != "win") {
return;
}
let message;
if (AppConstants.isPlatformAndVersionAtMost("win", "5.9")) {
message = gNavigatorBundle.getFormattedString("emeNotifications.drmContentDisabled.message", [""]);
} else {
message = gNavigatorBundle.getString("decoder.noCodecs.message");
}
yield test_decoder_doctor_notification("adobe-cdm-not-found", message);
});
add_task(function* test_adobe_cdm_not_activated() {
// This is only sent on Windows.
if (AppConstants.platform != "win") {
return;
}
let message;
if (AppConstants.isPlatformAndVersionAtMost("win", "5.9")) {
message = gNavigatorBundle.getString("decoder.noCodecsXP.message");
} else {
message = gNavigatorBundle.getString("decoder.noCodecs.message");
}
yield test_decoder_doctor_notification("adobe-cdm-not-activated", message);
});
add_task(function* test_platform_decoder_not_found() {
// Not sent on Windows XP.
if (AppConstants.isPlatformAndVersionAtMost("win", "5.9")) {
return;
}
let message;
let isLinux = AppConstants.platform == "linux";
if (isLinux) {
message = gNavigatorBundle.getString("decoder.noCodecsLinux.message");
} else {
message = gNavigatorBundle.getString("decoder.noHWAcceleration.message");
}
yield test_decoder_doctor_notification("platform-decoder-not-found",
message,
{noLearnMoreButton: isLinux});
});
"use strict";
function* test_decoder_doctor_notification(type, notificationMessage, options) {
yield BrowserTestUtils.withNewTab({ gBrowser }, function*(browser) {
let awaitNotificationBar =
BrowserTestUtils.waitForNotificationBar(gBrowser, browser, "decoder-doctor-notification");
yield ContentTask.spawn(browser, type, function*(type) {
Services.obs.notifyObservers(content.window,
"decoder-doctor-notification",
JSON.stringify({type: type,
isSolved: false,
decoderDoctorReportId: "test",
formats: "test"}));
});
let notification;
try {
notification = yield awaitNotificationBar;
} catch (ex) {
ok(false, ex);
return;
}
ok(notification, "Got decoder-doctor-notification notification");
is(notification.getAttribute("label"), notificationMessage,
"notification message should match expectation");
let button = notification.childNodes[0];
if (options && options.noLearnMoreButton) {
ok(!button, "There should not be a Learn More button");
return;
}
is(button.getAttribute("label"), gNavigatorBundle.getString("decoder.noCodecs.button"),
"notification button should be 'Learn more'");
is(button.getAttribute("accesskey"), gNavigatorBundle.getString("decoder.noCodecs.accesskey"),
"notification button should have accesskey");
let baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL");
let url = baseURL + "fix-video-audio-problems-firefox-windows";
let awaitNewTab = BrowserTestUtils.waitForNewTab(gBrowser, url);
button.click();
let sumoTab = yield awaitNewTab;
yield BrowserTestUtils.removeTab(sumoTab);
});
}
add_task(function* test_adobe_cdm_not_found() {
// This is only sent on Windows.
if (AppConstants.platform != "win") {
return;
}
let message;
if (AppConstants.isPlatformAndVersionAtMost("win", "5.9")) {
message = gNavigatorBundle.getFormattedString("emeNotifications.drmContentDisabled.message", [""]);
} else {
message = gNavigatorBundle.getString("decoder.noCodecs.message");
}
yield test_decoder_doctor_notification("adobe-cdm-not-found", message);
});
add_task(function* test_adobe_cdm_not_activated() {
// This is only sent on Windows.
if (AppConstants.platform != "win") {
return;
}
let message;
if (AppConstants.isPlatformAndVersionAtMost("win", "5.9")) {
message = gNavigatorBundle.getString("decoder.noCodecsXP.message");
} else {
message = gNavigatorBundle.getString("decoder.noCodecs.message");
}
yield test_decoder_doctor_notification("adobe-cdm-not-activated", message);
});
add_task(function* test_platform_decoder_not_found() {
// Not sent on Windows XP.
if (AppConstants.isPlatformAndVersionAtMost("win", "5.9")) {
return;
}
let message;
let isLinux = AppConstants.platform == "linux";
if (isLinux) {
message = gNavigatorBundle.getString("decoder.noCodecsLinux.message");
} else {
message = gNavigatorBundle.getString("decoder.noHWAcceleration.message");
}
yield test_decoder_doctor_notification("platform-decoder-not-found",
message,
{noLearnMoreButton: isLinux});
});

View File

@ -125,17 +125,17 @@ function runMultipleEnginesTestAndFinalize() {
}
function searchDiscovery() {
var head = doc().getElementById("linkparent");
let head = doc().getElementById("linkparent");
if (searchDiscoveryTests.length) {
setHandlerFunc(runSearchDiscoveryTest);
var test = searchDiscoveryTests[0];
var link = doc().createElement("link");
let test = searchDiscoveryTests[0];
let link = doc().createElement("link");
var rel = test.rel || "search";
var href = test.href || "http://so.not.here.mozilla.com/search.xml";
var type = test.type || "application/opensearchdescription+xml";
var title = test.title || searchDiscoveryTests.length;
let rel = test.rel || "search";
let href = test.href || "http://so.not.here.mozilla.com/search.xml";
let type = test.type || "application/opensearchdescription+xml";
let title = test.title || searchDiscoveryTests.length;
if (test.pass == undefined)
test.pass = true;
@ -148,12 +148,12 @@ function searchDiscovery() {
setHandlerFunc(runMultipleEnginesTestAndFinalize);
setHandlerFunc(runMultipleEnginesTestAndFinalize);
// Test multiple engines with the same title
var link = doc().createElement("link");
let link = doc().createElement("link");
link.rel = "search";
link.href = "http://first.mozilla.com/search.xml";
link.type = "application/opensearchdescription+xml";
link.title = "Test Engine";
var link2 = link.cloneNode(false);
let link2 = link.cloneNode(false);
link2.href = "http://second.mozilla.com/search.xml";
head.appendChild(link);

View File

@ -85,7 +85,7 @@ function* expectFocusOnF6(backward, expectedDocument, expectedElement, onContent
}
}
// Load a page and navigate between it and the chrome window.
// Load a page and navigate between it and the chrome window.
add_task(function* ()
{
let page1Promise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
@ -156,7 +156,7 @@ add_task(function* ()
SidebarUI.toggle('viewBookmarksSidebar');
yield loadPromise;
gURLBar.focus();
yield* expectFocusOnF6(false, "bookmarksPanel",
sidebar.contentDocument.getElementById("search-box").inputField,

View File

@ -1,40 +1,40 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_URL = "http://mochi.test:8888/browser/browser/base/content/test/general/file_favicon_change.html"
add_task(function*() {
let extraTab = gBrowser.selectedTab = gBrowser.addTab();
let tabLoaded = promiseTabLoaded(extraTab);
extraTab.linkedBrowser.loadURI(TEST_URL);
let expectedFavicon = "http://example.org/one-icon";
let haveChanged = new Promise.defer();
let observer = new MutationObserver(function(mutations) {
for (let mut of mutations) {
if (mut.attributeName != "image") {
continue;
}
let imageVal = extraTab.getAttribute("image").replace(/#.*$/, "");
if (!imageVal) {
// The value gets removed because it doesn't load.
continue;
}
is(imageVal, expectedFavicon, "Favicon image should correspond to expected image.");
haveChanged.resolve();
}
});
observer.observe(extraTab, {attributes: true});
yield tabLoaded;
yield haveChanged.promise;
haveChanged = new Promise.defer();
expectedFavicon = "http://example.org/other-icon";
let contentWin = extraTab.linkedBrowser.contentWindow;
let ev = new contentWin.CustomEvent("PleaseChangeFavicon", {});
contentWin.dispatchEvent(ev);
yield haveChanged.promise;
observer.disconnect();
gBrowser.removeTab(extraTab);
});
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_URL = "http://mochi.test:8888/browser/browser/base/content/test/general/file_favicon_change.html"
add_task(function*() {
let extraTab = gBrowser.selectedTab = gBrowser.addTab();
let tabLoaded = promiseTabLoaded(extraTab);
extraTab.linkedBrowser.loadURI(TEST_URL);
let expectedFavicon = "http://example.org/one-icon";
let haveChanged = new Promise.defer();
let observer = new MutationObserver(function(mutations) {
for (let mut of mutations) {
if (mut.attributeName != "image") {
continue;
}
let imageVal = extraTab.getAttribute("image").replace(/#.*$/, "");
if (!imageVal) {
// The value gets removed because it doesn't load.
continue;
}
is(imageVal, expectedFavicon, "Favicon image should correspond to expected image.");
haveChanged.resolve();
}
});
observer.observe(extraTab, {attributes: true});
yield tabLoaded;
yield haveChanged.promise;
haveChanged = new Promise.defer();
expectedFavicon = "http://example.org/other-icon";
let contentWin = extraTab.linkedBrowser.contentWindow;
let ev = new contentWin.CustomEvent("PleaseChangeFavicon", {});
contentWin.dispatchEvent(ev);
yield haveChanged.promise;
observer.disconnect();
gBrowser.removeTab(extraTab);
});

View File

@ -27,7 +27,7 @@ function test () {
});
}
registerCleanupFunction(function(){
registerCleanupFunction(function() {
// Exit browser fullscreen mode.
BrowserFullScreen();
@ -331,7 +331,7 @@ WindowListener.prototype = {
// wait for trasition to fullscreen on OSX Lion later
if (isOSX) {
setTimeout(function(){
setTimeout(function() {
domwindow.close();
executeSoon(this.callBack_onFinalize);
}.bind(this), 3000);

View File

@ -6,7 +6,7 @@
</head>
<body>
<script>
window.onload = function(){
window.onload = function() {
var event = new window.CustomEvent("WebChannelMessageToChrome", {
// Note: This intentionally sends an object instead of a string, to ensure both work
// (see browser_fxa_oauth_with_keys.html for the other test)

View File

@ -308,7 +308,7 @@ function waitForTab(aCallback) {
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
const webchannelWhitelistPref = "webchannel.allowObject.urlWhitelist";
let origWhitelist = Services.prefs.getCharPref(webchannelWhitelistPref);
let newWhitelist = origWhitelist + " http://example.com";

View File

@ -6,7 +6,7 @@
</head>
<body>
<script>
window.onload = function(){
window.onload = function() {
var event = new window.CustomEvent("WebChannelMessageToChrome", {
// Note: This intentionally sends a string instead of an object, to ensure both work
// (see browser_fxa_oauth.html for the other test)

View File

@ -8,10 +8,10 @@
<script>
var webChannelId = "account_updates_test";
window.onload = function(){
window.onload = function() {
var testName = window.location.search.replace(/^\?/, "");
switch(testName) {
switch (testName) {
case "profile_change":
test_profile_change();
break;

View File

@ -198,7 +198,7 @@ function makeObserver(aObserveTopic, aObserveFunc) {
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
for (let test of gTests) {
info("Running: " + test.desc);
yield test.run();

View File

@ -41,7 +41,7 @@ function handleMessageEvents(event) {
var bodyInnerHTML = event.source.document.body.innerHTML;
}
catch (e) {
var bodyInnerHTML = "";
bodyInnerHTML = "";
}
if (cacheCount == 2 || bodyInnerHTML.includes("error")) {
clearInterval(intervalID);

View File

@ -155,7 +155,7 @@ function test_TestEventListeners()
e("MozRotateGestureUpdate", SimpleGestureEvent.ROTATION_COUNTERCLOCKWISE, -13.0, 0);
e("MozRotateGestureUpdate", SimpleGestureEvent.ROTATION_CLOCKWISE, 13.0, 0);
e("MozRotateGesture", SimpleGestureEvent.ROTATION_CLOCKWISE, 33.0, 0);
// Tap and presstap gesture events
test_clicks("MozTapGesture", 1);
test_clicks("MozTapGesture", 2);

View File

@ -1,32 +1,32 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
function test () {
waitForExplicitFinish();
window.maximize();
// Find where the nav-bar is vertically.
var navBar = document.getElementById("nav-bar");
var boundingRect = navBar.getBoundingClientRect();
var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2);
var xPixel = boundingRect.width - 1; // Use the last pixel of the screen since it is maximized.
function onPopupHidden() {
PanelUI.panel.removeEventListener("popuphidden", onPopupHidden);
window.restore();
finish();
}
function onPopupShown() {
PanelUI.panel.removeEventListener("popupshown", onPopupShown);
ok(true, "Clicking at the far edge of the window opened the menu popup.");
PanelUI.panel.addEventListener("popuphidden", onPopupHidden);
PanelUI.hide();
}
registerCleanupFunction(function() {
PanelUI.panel.removeEventListener("popupshown", onPopupShown);
PanelUI.panel.removeEventListener("popuphidden", onPopupHidden);
});
PanelUI.panel.addEventListener("popupshown", onPopupShown);
EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window);
}
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
function test () {
waitForExplicitFinish();
window.maximize();
// Find where the nav-bar is vertically.
var navBar = document.getElementById("nav-bar");
var boundingRect = navBar.getBoundingClientRect();
var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2);
var xPixel = boundingRect.width - 1; // Use the last pixel of the screen since it is maximized.
function onPopupHidden() {
PanelUI.panel.removeEventListener("popuphidden", onPopupHidden);
window.restore();
finish();
}
function onPopupShown() {
PanelUI.panel.removeEventListener("popupshown", onPopupShown);
ok(true, "Clicking at the far edge of the window opened the menu popup.");
PanelUI.panel.addEventListener("popuphidden", onPopupHidden);
PanelUI.hide();
}
registerCleanupFunction(function() {
PanelUI.panel.removeEventListener("popupshown", onPopupShown);
PanelUI.panel.removeEventListener("popuphidden", onPopupHidden);
});
PanelUI.panel.addEventListener("popupshown", onPopupShown);
EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window);
}

View File

@ -15,4 +15,4 @@ add_task(function *() {
window.restore();
yield promiseWaitForCondition(waitForActive);
is(gBrowser.selectedTab.linkedBrowser.docShellIsActive, true, "Docshell should be active again");
});
});

View File

@ -24,7 +24,7 @@ add_task(function *() {
}, resolve);
});
let url = gHttpTestUrl
yield BrowserTestUtils.withNewTab({gBrowser, url}, function*(){
yield BrowserTestUtils.withNewTab({gBrowser, url}, function*() {
gTestBrowser = gBrowser.selectedBrowser;
// check security state is insecure
isSecurityState("insecure");

View File

@ -16,7 +16,7 @@ const gHttpsTestRoot2 = "https://test2.example.com/browser/browser/base/content/
var gTestBrowser = null;
add_task(function *() {
let url = gHttpTestRoot1 + "file_mixedContentFromOnunload.html";
yield BrowserTestUtils.withNewTab({gBrowser, url}, function*(){
yield BrowserTestUtils.withNewTab({gBrowser, url}, function*() {
yield new Promise(resolve => {
SpecialPowers.pushPrefEnv({
"set": [

View File

@ -65,4 +65,4 @@ add_task(function*() {
is(selected.getAttribute("label"), "1", "Should now have stylesheet 1 selected");
yield BrowserTestUtils.removeTab(tab);
});
});

View File

@ -138,7 +138,7 @@ add_task(function *() {
let popupHiddenPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popuphidden");
contentAreaContextMenu.hidePopup();
yield popupHiddenPromise;
yield popupHiddenPromise;
}
gBrowser.removeCurrentTab();

View File

@ -118,7 +118,7 @@ add_task(function* test_reader_view_element_attribute_transform() {
let observer = new MutationObserver((mutations) => {
mutations.forEach( mu => {
let muValue = element.getAttribute(attribute);
if(element.getAttribute(attribute) !== mu.oldValue) {
if (element.getAttribute(attribute) !== mu.oldValue) {
checkFn();
resolve();
observer.disconnect();
@ -134,7 +134,7 @@ add_task(function* test_reader_view_element_attribute_transform() {
triggerFn();
});
};
}
let command = document.getElementById("View:ReaderView");
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser);

View File

@ -1,93 +1,93 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var {WebChannel} = Cu.import("resource://gre/modules/WebChannel.jsm", {});
const TEST_URL_TAIL = "example.com/browser/browser/base/content/test/general/test_remoteTroubleshoot.html"
const TEST_URI_GOOD = Services.io.newURI("https://" + TEST_URL_TAIL, null, null);
const TEST_URI_BAD = Services.io.newURI("http://" + TEST_URL_TAIL, null, null);
const TEST_URI_GOOD_OBJECT = Services.io.newURI("https://" + TEST_URL_TAIL + "?object", null, null);
// Creates a one-shot web-channel for the test data to be sent back from the test page.
function promiseChannelResponse(channelID, originOrPermission) {
return new Promise((resolve, reject) => {
let channel = new WebChannel(channelID, originOrPermission);
channel.listen((id, data, target) => {
channel.stopListening();
resolve(data);
});
});
};
// Loads the specified URI in a new tab and waits for it to send us data on our
// test web-channel and resolves with that data.
function promiseNewChannelResponse(uri) {
let channelPromise = promiseChannelResponse("test-remote-troubleshooting-backchannel",
uri);
let tab = gBrowser.loadOneTab(uri.spec, { inBackground: false });
return promiseTabLoaded(tab).then(
() => channelPromise
).then(data => {
gBrowser.removeTab(tab);
return data;
});
}
add_task(function*() {
// We haven't set a permission yet - so even the "good" URI should fail.
let got = yield promiseNewChannelResponse(TEST_URI_GOOD);
// Should have no data.
Assert.ok(got.message === undefined, "should have failed to get any data");
// Add a permission manager entry for our URI.
Services.perms.add(TEST_URI_GOOD,
"remote-troubleshooting",
Services.perms.ALLOW_ACTION);
registerCleanupFunction(() => {
Services.perms.remove(TEST_URI_GOOD, "remote-troubleshooting");
});
// Try again - now we are expecting a response with the actual data.
got = yield promiseNewChannelResponse(TEST_URI_GOOD);
// Check some keys we expect to always get.
Assert.ok(got.message.extensions, "should have extensions");
Assert.ok(got.message.graphics, "should have graphics");
// Check we have channel and build ID info:
Assert.equal(got.message.application.buildID, Services.appinfo.appBuildID,
"should have correct build ID");
let updateChannel = null;
try {
updateChannel = Cu.import("resource://gre/modules/UpdateUtils.jsm", {}).UpdateUtils.UpdateChannel;
} catch (ex) {}
if (!updateChannel) {
Assert.ok(!('updateChannel' in got.message.application),
"should not have update channel where not available.");
} else {
Assert.equal(got.message.application.updateChannel, updateChannel,
"should have correct update channel.");
}
// And check some keys we know we decline to return.
Assert.ok(!got.message.modifiedPreferences, "should not have a modifiedPreferences key");
Assert.ok(!got.message.crashes, "should not have crash info");
// Now a http:// URI - should get nothing even with the permission setup.
got = yield promiseNewChannelResponse(TEST_URI_BAD);
Assert.ok(got.message === undefined, "should have failed to get any data");
// Check that the page can send an object as well if it's in the whitelist
let webchannelWhitelistPref = "webchannel.allowObject.urlWhitelist";
let origWhitelist = Services.prefs.getCharPref(webchannelWhitelistPref);
let newWhitelist = origWhitelist + " https://example.com";
Services.prefs.setCharPref(webchannelWhitelistPref, newWhitelist);
registerCleanupFunction(() => {
Services.prefs.clearUserPref(webchannelWhitelistPref);
});
got = yield promiseNewChannelResponse(TEST_URI_GOOD_OBJECT);
Assert.ok(got.message, "should have gotten some data back");
});
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var {WebChannel} = Cu.import("resource://gre/modules/WebChannel.jsm", {});
const TEST_URL_TAIL = "example.com/browser/browser/base/content/test/general/test_remoteTroubleshoot.html"
const TEST_URI_GOOD = Services.io.newURI("https://" + TEST_URL_TAIL, null, null);
const TEST_URI_BAD = Services.io.newURI("http://" + TEST_URL_TAIL, null, null);
const TEST_URI_GOOD_OBJECT = Services.io.newURI("https://" + TEST_URL_TAIL + "?object", null, null);
// Creates a one-shot web-channel for the test data to be sent back from the test page.
function promiseChannelResponse(channelID, originOrPermission) {
return new Promise((resolve, reject) => {
let channel = new WebChannel(channelID, originOrPermission);
channel.listen((id, data, target) => {
channel.stopListening();
resolve(data);
});
});
}
// Loads the specified URI in a new tab and waits for it to send us data on our
// test web-channel and resolves with that data.
function promiseNewChannelResponse(uri) {
let channelPromise = promiseChannelResponse("test-remote-troubleshooting-backchannel",
uri);
let tab = gBrowser.loadOneTab(uri.spec, { inBackground: false });
return promiseTabLoaded(tab).then(
() => channelPromise
).then(data => {
gBrowser.removeTab(tab);
return data;
});
}
add_task(function*() {
// We haven't set a permission yet - so even the "good" URI should fail.
let got = yield promiseNewChannelResponse(TEST_URI_GOOD);
// Should have no data.
Assert.ok(got.message === undefined, "should have failed to get any data");
// Add a permission manager entry for our URI.
Services.perms.add(TEST_URI_GOOD,
"remote-troubleshooting",
Services.perms.ALLOW_ACTION);
registerCleanupFunction(() => {
Services.perms.remove(TEST_URI_GOOD, "remote-troubleshooting");
});
// Try again - now we are expecting a response with the actual data.
got = yield promiseNewChannelResponse(TEST_URI_GOOD);
// Check some keys we expect to always get.
Assert.ok(got.message.extensions, "should have extensions");
Assert.ok(got.message.graphics, "should have graphics");
// Check we have channel and build ID info:
Assert.equal(got.message.application.buildID, Services.appinfo.appBuildID,
"should have correct build ID");
let updateChannel = null;
try {
updateChannel = Cu.import("resource://gre/modules/UpdateUtils.jsm", {}).UpdateUtils.UpdateChannel;
} catch (ex) {}
if (!updateChannel) {
Assert.ok(!('updateChannel' in got.message.application),
"should not have update channel where not available.");
} else {
Assert.equal(got.message.application.updateChannel, updateChannel,
"should have correct update channel.");
}
// And check some keys we know we decline to return.
Assert.ok(!got.message.modifiedPreferences, "should not have a modifiedPreferences key");
Assert.ok(!got.message.crashes, "should not have crash info");
// Now a http:// URI - should get nothing even with the permission setup.
got = yield promiseNewChannelResponse(TEST_URI_BAD);
Assert.ok(got.message === undefined, "should have failed to get any data");
// Check that the page can send an object as well if it's in the whitelist
let webchannelWhitelistPref = "webchannel.allowObject.urlWhitelist";
let origWhitelist = Services.prefs.getCharPref(webchannelWhitelistPref);
let newWhitelist = origWhitelist + " https://example.com";
Services.prefs.setCharPref(webchannelWhitelistPref, newWhitelist);
registerCleanupFunction(() => {
Services.prefs.clearUserPref(webchannelWhitelistPref);
});
got = yield promiseNewChannelResponse(TEST_URI_GOOD_OBJECT);
Assert.ok(got.message, "should have gotten some data back");
});

View File

@ -85,7 +85,7 @@ function isBrowserAppTab(browser) {
var restart = Task.async(function*(browser) {
// If the tab isn't remote this would crash the main process so skip it
if (!browser.isRemoteBrowser)
return browser;
return;
// Make sure the main process has all of the current tab state before crashing
yield TabStateFlusher.flush(browser);

View File

@ -79,7 +79,7 @@ function* onHistoryReady() {
// Should test cookies here, but nsICookieManager/nsICookieService
// doesn't let us fake creation times. bug 463127
let s = new Sanitizer();
s.ignoreTimespan = false;
s.prefDomain = "privacy.cpd.";
@ -202,7 +202,7 @@ function* onHistoryReady() {
if (hoursSinceMidnight > 1)
ok((yield downloadExists(publicList, "fakefile-today")), "'Today' download should still be present");
downloadPromise = promiseDownloadRemoved(publicList);
formHistoryPromise = promiseFormHistoryRemoved();
@ -385,7 +385,7 @@ function* onHistoryReady() {
if (minutesSinceMidnight > 250)
yield countEntries("today", "today form entry should still exist", checkOne);
yield countEntries("b4today", "b4today form entry should still exist", checkOne);
ok(!(yield downloadExists(publicList, "fakefile-4-hour-10-minutes")), "4 hour 10 minute download should now be deleted");
ok((yield downloadExists(publicList, "fakefile-old")), "Year old download should still be present");
if (minutesSinceMidnight > 250)
@ -486,7 +486,7 @@ function setupHistory() {
return deferred.promise;
}
function setupFormHistory() {
function* setupFormHistory() {
function searchEntries(terms, params) {
let deferred = Promise.defer();
@ -616,7 +616,7 @@ function setupFormHistory() {
is(checks, 9, "9 checks made");
}
function setupDownloads() {
function* setupDownloads() {
let publicList = yield Downloads.getList(Downloads.PUBLIC);
@ -689,7 +689,7 @@ function setupDownloads() {
download.startTime = today, // 12:00:01 AM this morning
download.canceled = true;
yield publicList.add(download);
// Add "before today" download
let lastYear = new Date();
lastYear.setFullYear(lastYear.getFullYear() - 1);
@ -701,7 +701,7 @@ function setupDownloads() {
download.startTime = lastYear,
download.canceled = true;
yield publicList.add(download);
// Confirm everything worked
let downloads = yield publicList.getAll();
is(downloads.length, 9, "9 Pretend downloads added");
@ -723,13 +723,10 @@ function setupDownloads() {
* @param aID
* The ids of the downloads to check.
*/
function downloadExists(list, path)
{
return Task.spawn(function() {
let listArray = yield list.getAll();
throw new Task.Result(listArray.some(i => i.target.path == path));
});
}
let downloadExists = Task.async(function* (list, path) {
let listArray = yield list.getAll();
return listArray.some(i => i.target.path == path);
});
function isToday(aDate) {
return aDate.getDate() == new Date().getDate();

View File

@ -304,7 +304,7 @@ add_task(function* test_everything_warning() {
let uris = [];
let places = [];
let pURI;
// within past hour, within past two hours, within past four hours and
// within past hour, within past two hours, within past four hours and
// outside past four hours
[10, 70, 130, 250].forEach(function(aValue) {
pURI = makeURI("http://" + aValue + "-minutes-ago.com/");
@ -361,7 +361,7 @@ add_task(function* test_cannot_clear_history() {
ok(cb.length == 1 && !cb[0].disabled, "There is formdata, checkbox to " +
"clear formdata should be enabled.");
var cb = this.win.document.querySelectorAll(
cb = this.win.document.querySelectorAll(
"#itemList > [preference='privacy.cpd.history']");
ok(cb.length == 1 && !cb[0].disabled, "There is history, checkbox to " +
"clear history should be enabled.");
@ -644,7 +644,7 @@ var now_uSec = now_mSec * 1000;
*/
function WindowHelper(aWin) {
this.win = aWin;
this.promiseClosed = new Promise(resolve => {this._resolveClosed = resolve});
this.promiseClosed = new Promise(resolve => { this._resolveClosed = resolve });
}
WindowHelper.prototype = {

View File

@ -118,7 +118,7 @@ function test() {
Services.obs.removeObserver(observer, "http-on-examine-response");
info("Finished running the cleanup code");
});
function observer(subject, topic, state) {
info("observer called with " + topic);
if (topic == "http-on-modify-request") {
@ -142,10 +142,12 @@ function test() {
is(cookies, "foopy=1", "Cookie should be foopy=1");
gNumSet += 1;
info("gNumSet = " + gNumSet);
} catch (ex if ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {
info("onExamineResponse caught NOTAVAIL" + ex);
} catch (ex) {
info("ionExamineResponse caught " + ex);
if (ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {
info("onExamineResponse caught NOTAVAIL" + ex);
} else {
info("ionExamineResponse caught " + ex);
}
}
}
@ -162,10 +164,12 @@ function test() {
// cookie because we are making only 2 requests: one in public mode, and
// one in private mode.
throw "We should never send a cookie in this test";
} catch (ex if ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {
info("onModifyRequest caught NOTAVAIL" + ex);
} catch (ex) {
info("ionModifyRequest caught " + ex);
if (ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {
info("onModifyRequest caught NOTAVAIL" + ex);
} else {
info("ionModifyRequest caught " + ex);
}
}
}

View File

@ -155,7 +155,7 @@ function test() {
Services.prefs.clearUserPref(SAVE_PER_SITE_PREF);
info("Finished running the cleanup code");
});
Services.prefs.setBoolPref(ALWAYS_DOWNLOAD_DIR_PREF, false);
testOnWindow(undefined, function(win) {
let windowGonePromise = promiseWindowWillBeClosed(win);

View File

@ -106,7 +106,7 @@ function getChangeEvents()
});
}
function doSelectTests(contentType, dtd)
function* doSelectTests(contentType, dtd)
{
const pageUrl = "data:" + contentType + "," + escape(dtd + "\n" + PAGECONTENT);
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);

View File

@ -77,7 +77,7 @@ function* testSendReportAutomatically(testURL, suffix, errorURISuffix) {
// Cleanup.
gBrowser.removeTab(tab);
cleanup();
};
}
function* testSetAutomatic(testURL, suffix, errorURISuffix) {
Services.prefs.setBoolPref(PREF_REPORT_ENABLED, true);

View File

@ -137,7 +137,7 @@ function checkButtonsStatus(shouldBeActive) {
]) {
let elt = document.getElementById(eid);
if (shouldBeActive) {
Assert.equal(elt.getAttribute("syncstatus"), "active", `${eid} should be active`);;
Assert.equal(elt.getAttribute("syncstatus"), "active", `${eid} should be active`);
} else {
Assert.ok(!elt.hasAttribute("syncstatus"), `${eid} should have no status attr`);
}

View File

@ -12,7 +12,7 @@ function EventStore() {
this["main-window"] = [];
this["window1"] = [];
this["window2"] = [];
};
}
EventStore.prototype = {
"push": function (event) {
@ -56,11 +56,9 @@ function* getFocusedElementForBrowser(browser, dontCheckExtraFocus = false)
{ dontCheckExtraFocus : dontCheckExtraFocus });
});
}
else {
var focusedWindow = {};
var node = fm.getFocusedElementForWindow(browser.contentWindow, false, focusedWindow);
return "Focus is " + (node ? node.id : "<none>");
}
var focusedWindow = {};
var node = fm.getFocusedElementForWindow(browser.contentWindow, false, focusedWindow);
return "Focus is " + (node ? node.id : "<none>");
}
function focusInChild()

View File

@ -72,7 +72,7 @@ add_task(function*() {
observer.onDownloadFail = observer.onManyLinksChanged;
DirectoryLinksProvider.addObserver(observer);
return deferred.promise;
};
}
let gOrigDirectorySource = Services.prefs.getCharPref(PREF_NEWTAB_DIRECTORYSOURCE);
registerCleanupFunction(() => {

View File

@ -1,49 +1,49 @@
"use strict";
SimpleTest.requestCompleteLog();
SpecialPowers.pushPrefEnv({"set": [["dom.require_user_interaction_for_beforeunload", false]]});
const FIRST_TAB = getRootDirectory(gTestPath) + "close_beforeunload_opens_second_tab.html";
const SECOND_TAB = getRootDirectory(gTestPath) + "close_beforeunload.html";
add_task(function*() {
info("Opening first tab");
let firstTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, FIRST_TAB);
let secondTabLoadedPromise;
let secondTab;
let tabOpened = new Promise(resolve => {
info("Adding tabopen listener");
gBrowser.tabContainer.addEventListener("TabOpen", function tabOpenListener(e) {
info("Got tabopen, removing listener and waiting for load");
gBrowser.tabContainer.removeEventListener("TabOpen", tabOpenListener, false, false);
secondTab = e.target;
secondTabLoadedPromise = BrowserTestUtils.browserLoaded(secondTab.linkedBrowser, false, SECOND_TAB);
resolve();
}, false, false);
});
info("Opening second tab using a click");
yield ContentTask.spawn(firstTab.linkedBrowser, "", function*() {
content.document.getElementsByTagName("a")[0].click();
});
info("Waiting for the second tab to be opened");
yield tabOpened;
info("Waiting for the load in that tab to finish");
yield secondTabLoadedPromise;
let closeBtn = document.getAnonymousElementByAttribute(secondTab, "anonid", "close-button");
let closePromise = BrowserTestUtils.removeTab(secondTab, {dontRemove: true});
info("closing second tab (which will self-close in beforeunload)");
closeBtn.click();
ok(secondTab.closing, "Second tab should be marked as closing synchronously.");
yield closePromise;
ok(secondTab.closing, "Second tab should still be marked as closing");
ok(!secondTab.linkedBrowser, "Second tab's browser should be dead");
ok(!firstTab.closing, "First tab should not be closing");
ok(firstTab.linkedBrowser, "First tab's browser should be alive");
info("closing first tab");
yield BrowserTestUtils.removeTab(firstTab);
ok(firstTab.closing, "First tab should be marked as closing");
ok(!firstTab.linkedBrowser, "First tab's browser should be dead");
});
"use strict";
SimpleTest.requestCompleteLog();
SpecialPowers.pushPrefEnv({"set": [["dom.require_user_interaction_for_beforeunload", false]]});
const FIRST_TAB = getRootDirectory(gTestPath) + "close_beforeunload_opens_second_tab.html";
const SECOND_TAB = getRootDirectory(gTestPath) + "close_beforeunload.html";
add_task(function*() {
info("Opening first tab");
let firstTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, FIRST_TAB);
let secondTabLoadedPromise;
let secondTab;
let tabOpened = new Promise(resolve => {
info("Adding tabopen listener");
gBrowser.tabContainer.addEventListener("TabOpen", function tabOpenListener(e) {
info("Got tabopen, removing listener and waiting for load");
gBrowser.tabContainer.removeEventListener("TabOpen", tabOpenListener, false, false);
secondTab = e.target;
secondTabLoadedPromise = BrowserTestUtils.browserLoaded(secondTab.linkedBrowser, false, SECOND_TAB);
resolve();
}, false, false);
});
info("Opening second tab using a click");
yield ContentTask.spawn(firstTab.linkedBrowser, "", function*() {
content.document.getElementsByTagName("a")[0].click();
});
info("Waiting for the second tab to be opened");
yield tabOpened;
info("Waiting for the load in that tab to finish");
yield secondTabLoadedPromise;
let closeBtn = document.getAnonymousElementByAttribute(secondTab, "anonid", "close-button");
let closePromise = BrowserTestUtils.removeTab(secondTab, {dontRemove: true});
info("closing second tab (which will self-close in beforeunload)");
closeBtn.click();
ok(secondTab.closing, "Second tab should be marked as closing synchronously.");
yield closePromise;
ok(secondTab.closing, "Second tab should still be marked as closing");
ok(!secondTab.linkedBrowser, "Second tab's browser should be dead");
ok(!firstTab.closing, "First tab should not be closing");
ok(firstTab.linkedBrowser, "First tab's browser should be alive");
info("closing first tab");
yield BrowserTestUtils.removeTab(firstTab);
ok(firstTab.closing, "First tab should be marked as closing");
ok(!firstTab.linkedBrowser, "First tab's browser should be dead");
});

View File

@ -137,9 +137,9 @@ add_task(function* testPrivateBrowsing() {
yield tabReloadPromise;
// Sum up all the counts to make sure that nothing got logged
is(getEnabledCounts().reduce((p,c)=>p+c), 0, "Telemetry logging off in PB mode");
is(getEventCounts().reduce((p,c)=>p+c), 0, "Telemetry logging off in PB mode");
is(getShieldCounts().reduce((p,c)=>p+c), 0, "Telemetry logging off in PB mode");
is(getEnabledCounts().reduce((p, c) => p+c), 0, "Telemetry logging off in PB mode");
is(getEventCounts().reduce((p, c) => p+c), 0, "Telemetry logging off in PB mode");
is(getShieldCounts().reduce((p, c) => p+c), 0, "Telemetry logging off in PB mode");
yield promiseWindowClosed(privateWin);
});

View File

@ -72,7 +72,7 @@ function test_eventMatchesKey() {
// Make sure to remove the event listener so future tests don't
// fail when they simulate key presses.
document.removeEventListener("keypress", checkEvent);
};
}
runNextTest();
}

View File

@ -7,7 +7,7 @@ function test() {
// There should be one tab when we start the test
let [origTab] = gBrowser.visibleTabs;
is(gBrowser.visibleTabs.length, 1, "1 tab should be open");
is(gBrowser.visibleTabs.length, 1, "1 tab should be open");
is(Disabled(), true, "Bookmark All Tabs should be disabled");
// Add a tab
@ -25,7 +25,7 @@ function test() {
// Hide the original tab
gBrowser.selectedTab = testTab2;
gBrowser.showOnlyTheseTabs([testTab2]);
is(gBrowser.visibleTabs.length, 1, "1 tab should be visible");
is(gBrowser.visibleTabs.length, 1, "1 tab should be visible");
is(Disabled(), true, "Bookmark All Tabs should be disabled as there is only one visible tab");
// Add a tab that will get pinned
@ -42,7 +42,7 @@ function test() {
let allTabs = Array.from(gBrowser.tabs);
gBrowser.showOnlyTheseTabs(allTabs);
// reset the environment
// reset the environment
gBrowser.removeTab(testTab2);
gBrowser.removeTab(testTab1);
gBrowser.removeTab(pinned);

View File

@ -35,12 +35,12 @@ add_task(function* test() {
gBrowser.selectedTab = testTab;
gBrowser.showOnlyTheseTabs([testTab]);
is(gBrowser.visibleTabs.length, 1, "now there is only one visible tab");
// Check the context menu with one tab.
updateTabContextMenu(testTab);
is(document.getElementById("context_closeTab").disabled, false, "Close Tab is enabled when more than one tab exists");
is(document.getElementById("context_reloadAllTabs").disabled, true, "Reload All Tabs is disabled");
// Add a tab that will get pinned
// So now there's one pinned tab, one visible unpinned tab, and one hidden tab
let pinned = gBrowser.addTab();
@ -60,7 +60,7 @@ add_task(function* test() {
updateTabContextMenu(testTab);
is(document.getElementById("context_closeOtherTabs").disabled, false, "Close Other Tabs is enabled");
is(document.getElementById("context_closeTabsToTheEnd").disabled, true, "Close Tabs To The End is disabled");
// Check the context menu of the original tab
// Close Tabs To The End should now be enabled
updateTabContextMenu(origTab);

View File

@ -11,7 +11,7 @@
window.onload = function() {
var testName = window.location.search.replace(/^\?/, "");
switch(testName) {
switch (testName) {
case "generic":
test_generic();
break;

View File

@ -402,7 +402,7 @@ var gTests = [
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
for (let test of gTests) {
info("Running: " + test.desc);
yield test.run();

View File

@ -10,7 +10,7 @@
window.onload = function() {
var testName = window.location.search.replace(/^\?/, "");
switch(testName) {
switch (testName) {
case "iframe":
test_iframe();
break;

View File

@ -150,15 +150,15 @@ function childFunction()
sendAsyncMessage("Test:ActivateEvent", { ok: !windowGotActivate });
windowGotActivate = false;
});
addEventListener("deactivate", function() {
sendAsyncMessage("Test:DeactivateEvent", { ok: !windowGotDeactivate });
windowGotDeactivate = false;
});
content.addEventListener("activate", function() {
windowGotActivate = true;;
windowGotActivate = true;
});
content.addEventListener("deactivate", function() {
windowGotDeactivate = true;
});

View File

@ -1,8 +1,8 @@
<body>
<p>I will close myself if you close me.</p>
<script>
window.onbeforeunload = function() {
window.close();
};
</script>
</body>
<body>
<p>I will close myself if you close me.</p>
<script>
window.onbeforeunload = function() {
window.close();
};
</script>
</body>

View File

@ -98,7 +98,7 @@ var messageHandlers = {
}
row.addEventListener("mousemove", function handler() {
row.removeEventListener("mousemove", handler);
ack("mousemove");
ack("mousemove");
});
content.synthesizeMouseAtCenter(row, event);
},

View File

@ -10,7 +10,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=822367
<script>
function createDoc()
{
var doc=document.open("text/html","replace");
var doc=document.open("text/html", "replace");
doc.write('<!DOCTYPE html><html><body><p id="p1">This is some content</p><script src="http://example.com/browser/browser/base/content/test/general/file_bug822367_1.js">\<\/script\>\<\/body>\<\/html>');
doc.close();
}

View File

@ -1,4 +1,4 @@
/*
/*
* Once the mixed content blocker is disabled for the page, this scripts loads
* and updates the text inside the div container.
*/

View File

@ -1,13 +1,13 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="icon" href="http://example.org/one-icon" type="image/ico" id="i">
</head>
<body>
<script>
window.addEventListener("PleaseChangeFavicon", function() {
var ico = document.getElementById("i");
ico.setAttribute("href", "http://example.org/other-icon");
});
</script>
</body></html>
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="icon" href="http://example.org/one-icon" type="image/ico" id="i">
</head>
<body>
<script>
window.addEventListener("PleaseChangeFavicon", function() {
var ico = document.getElementById("i");
ico.setAttribute("href", "http://example.org/other-icon");
});
</script>
</body></html>

View File

@ -75,9 +75,9 @@ function updateTabContextMenu(tab, onOpened) {
yield onOpened();
onFinished();
});
} else {
onFinished();
}
onFinished();
return Promise.resolve();
}
function openToolbarCustomizationUI(aCallback, aBrowserWin) {
@ -692,7 +692,7 @@ function assertMixedContentBlockingState(tabbrowser, states = {}) {
throw new Error("assertMixedContentBlockingState requires a browser and a states object");
}
let {passiveLoaded,activeLoaded,activeBlocked} = states;
let {passiveLoaded, activeLoaded, activeBlocked} = states;
let {gIdentityHandler} = tabbrowser.ownerGlobal;
let doc = tabbrowser.ownerDocument;
let identityBox = gIdentityHandler._identityBox;
@ -837,7 +837,7 @@ function is_hidden(element) {
if (style.visibility != "visible")
return true;
if (style.display == "-moz-popup")
return ["hiding","closed"].indexOf(element.state) != -1;
return ["hiding", "closed"].indexOf(element.state) != -1;
// Hiding a parent element will hide all its children
if (element.parentNode != element.ownerDocument)
@ -1023,7 +1023,11 @@ function getPropertyBagValue(bag, key) {
try {
let val = bag.getProperty(key);
return val;
} catch(e if e.result == Cr.NS_ERROR_FAILURE) {}
} catch (e) {
if (e.result != Cr.NS_ERROR_FAILURE) {
throw e;
}
}
return null;
}
@ -1165,6 +1169,7 @@ function getCertExceptionDialog(aLocation) {
}
}
}
return undefined;
}
function setupRemoteClientsFixture(fixture) {

View File

@ -1,50 +1,50 @@
<!DOCTYPE HTML>
<html>
<script>
// This test is run multiple times, once with only strings allowed through the
// WebChannel, and once with objects allowed. This function allows us to handle
// both cases without too much pain.
function makeDetails(object) {
if (window.location.search.indexOf("object") >= 0) {
return object;
}
return JSON.stringify(object)
}
// Add a listener for responses to our remote requests.
window.addEventListener("WebChannelMessageToContent", function (event) {
if (event.detail.id == "remote-troubleshooting") {
// Send what we got back to the test.
var backEvent = new window.CustomEvent("WebChannelMessageToChrome", {
detail: makeDetails({
id: "test-remote-troubleshooting-backchannel",
message: {
message: event.detail.message,
},
}),
});
window.dispatchEvent(backEvent);
// and stick it in our DOM just for good measure/diagnostics.
document.getElementById("troubleshooting").textContent =
JSON.stringify(event.detail.message, null, 2);
}
});
// Make a request for the troubleshooting data as we load.
window.onload = function() {
var event = new window.CustomEvent("WebChannelMessageToChrome", {
detail: makeDetails({
id: "remote-troubleshooting",
message: {
command: "request",
},
}),
});
window.dispatchEvent(event);
}
</script>
<body>
<pre id="troubleshooting"/>
</body>
</html>
<!DOCTYPE HTML>
<html>
<script>
// This test is run multiple times, once with only strings allowed through the
// WebChannel, and once with objects allowed. This function allows us to handle
// both cases without too much pain.
function makeDetails(object) {
if (window.location.search.indexOf("object") >= 0) {
return object;
}
return JSON.stringify(object)
}
// Add a listener for responses to our remote requests.
window.addEventListener("WebChannelMessageToContent", function (event) {
if (event.detail.id == "remote-troubleshooting") {
// Send what we got back to the test.
var backEvent = new window.CustomEvent("WebChannelMessageToChrome", {
detail: makeDetails({
id: "test-remote-troubleshooting-backchannel",
message: {
message: event.detail.message,
},
}),
});
window.dispatchEvent(backEvent);
// and stick it in our DOM just for good measure/diagnostics.
document.getElementById("troubleshooting").textContent =
JSON.stringify(event.detail.message, null, 2);
}
});
// Make a request for the troubleshooting data as we load.
window.onload = function() {
var event = new window.CustomEvent("WebChannelMessageToChrome", {
detail: makeDetails({
id: "remote-troubleshooting",
message: {
command: "request",
},
}),
});
window.dispatchEvent(event);
}
</script>
<body>
<pre id="troubleshooting"/>
</body>
</html>

View File

@ -125,14 +125,10 @@ add_task(function* () {
return aLink2.frecency - aLink1.frecency ||
aLink2.lastVisitDate - aLink1.lastVisitDate;
}
else {
if (aLink2.type == "history") {
return 1;
}
else {
return -1;
}
if (aLink2.type == "history") {
return 1;
}
return -1;
};
// add a row of history tiles, directory tiles will be clipped off, hence no scrollbar

View File

@ -19,7 +19,7 @@ add_task(function* () {
function sendDragEvent(aEventType, aTarget) {
let dataTransfer = new content.DataTransfer(aEventType, false);
let event = content.document.createEvent("DragEvents");
let event = content.document.createEvent("DragEvent");
event.initDragEvent(aEventType, true, true, content, 0, 0, 0, 0, 0,
false, false, false, false, 0, null, dataTransfer);
aTarget.dispatchEvent(event);

View File

@ -12,7 +12,7 @@ add_task(function* () {
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("DragEvents");
let event = content.document.createEvent("DragEvent");
event.initDragEvent("drop", true, true, content, 0, 0, 0, 0, 0,
false, false, false, false, 0, null, dataTransfer);

View File

@ -15,7 +15,7 @@ add_task(function* () {
function sendDropEvent(aCellIndex, aDragData) {
let dataTransfer = new content.DataTransfer("dragstart", false);
dataTransfer.mozSetDataAt("text/x-moz-url", aDragData, 0);
let event = content.document.createEvent("DragEvents");
let event = content.document.createEvent("DragEvent");
event.initDragEvent("drop", true, true, content, 0, 0, 0, 0, 0,
false, false, false, false, 0, null, dataTransfer);

Some files were not shown because too many files have changed in this diff Show More