Bug 1298559 - Enable eslint for /browser/base/content/test/ r=mattn

MozReview-Commit-ID: BZlkPTcLJMB
This commit is contained in:
Jared Wein 2016-08-31 12:53:24 -04:00
parent 5dd9ac0f8c
commit a182a61bce
132 changed files with 2222 additions and 2218 deletions

View file

@ -60,7 +60,8 @@ browser/app/**
browser/base/content/browser-social.js browser/base/content/browser-social.js
browser/base/content/nsContextMenu.js browser/base/content/nsContextMenu.js
browser/base/content/sanitizeDialog.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/base/content/newtab/**
browser/components/downloads/** browser/components/downloads/**
browser/components/feeds/** browser/components/feeds/**

View file

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

View file

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

View file

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

View file

@ -24,7 +24,7 @@ var gFrontProgressListener = {
is(state, gFrontNotifications[gFrontNotificationsPos], "Got a notification for the front notifications listener"); is(state, gFrontNotifications[gFrontNotificationsPos], "Got a notification for the front notifications listener");
gFrontNotificationsPos++; gFrontNotificationsPos++;
}, },
onStatusChange: function (aWebProgress, aRequest, aStatus, aMessage) { onStatusChange: function (aWebProgress, aRequest, aStatus, aMessage) {
}, },
@ -62,7 +62,7 @@ var gAllProgressListener = {
is(state, gAllNotifications[gAllNotificationsPos], "Got a notification for the all notifications listener"); is(state, gAllNotifications[gAllNotificationsPos], "Got a notification for the all notifications listener");
gAllNotificationsPos++; gAllNotificationsPos++;
}, },
onStatusChange: function (aBrowser, aWebProgress, aRequest, aStatus, aMessage) { onStatusChange: function (aBrowser, aWebProgress, aRequest, aStatus, aMessage) {
var state = "onStatusChange"; var state = "onStatusChange";
ok(aBrowser == gTestBrowser, state + " notification came from the correct browser"); 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) { if (tab.soundPlaying == expectPlaying) {
ok(true, "The tab should " + (expectPlaying ? "" : "not ") + "be playing"); ok(true, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
return true; 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) { function* play(tab) {
@ -230,6 +229,7 @@ function* test_swapped_browser_while_playing(oldTab, newBrowser) {
if (event.detail.changed.indexOf("soundplaying") >= 0) { if (event.detail.changed.indexOf("soundplaying") >= 0) {
return (++receivedSoundPlaying == 2); return (++receivedSoundPlaying == 2);
} }
return false;
}); });
ok(newTab.hasAttribute("muted"), "Expected the correct muted attribute on the new tab"); 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. /* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ * http://creativecommons.org/publicdomain/zero/1.0/
*/ */
add_task(function* () { add_task(function* () {
let firstLocation = "http://example.org/browser/browser/base/content/test/general/dummy_page.html"; let firstLocation = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
yield BrowserTestUtils.openNewForegroundTab(gBrowser, firstLocation); yield BrowserTestUtils.openNewForegroundTab(gBrowser, firstLocation);
yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
// Push the state before maximizing the window and clicking below. // Push the state before maximizing the window and clicking below.
content.history.pushState("page2", "page2", "page2"); content.history.pushState("page2", "page2", "page2");
// While in the child process, add a listener for the popstate event here. This // While in the child process, add a listener for the popstate event here. This
// event will fire when the mouse click happens. // event will fire when the mouse click happens.
content.addEventListener("popstate", function onPopState() { content.addEventListener("popstate", function onPopState() {
content.removeEventListener("popstate", onPopState, false); content.removeEventListener("popstate", onPopState, false);
sendAsyncMessage("Test:PopStateOccurred", { location: content.document.location.href }); sendAsyncMessage("Test:PopStateOccurred", { location: content.document.location.href });
}, false); }, false);
}); });
window.maximize(); window.maximize();
// Find where the nav-bar is vertically. // Find where the nav-bar is vertically.
var navBar = document.getElementById("nav-bar"); var navBar = document.getElementById("nav-bar");
var boundingRect = navBar.getBoundingClientRect(); var boundingRect = navBar.getBoundingClientRect();
var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2); var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2);
var xPixel = 0; // Use the first pixel of the screen since it is maximized. var xPixel = 0; // Use the first pixel of the screen since it is maximized.
let resultLocation = yield new Promise(resolve => { let resultLocation = yield new Promise(resolve => {
messageManager.addMessageListener("Test:PopStateOccurred", function statePopped(message) { messageManager.addMessageListener("Test:PopStateOccurred", function statePopped(message) {
messageManager.removeMessageListener("Test:PopStateOccurred", statePopped); messageManager.removeMessageListener("Test:PopStateOccurred", statePopped);
resolve(message.data.location); resolve(message.data.location);
}); });
EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window); EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window);
}); });
is(resultLocation, firstLocation, "Clicking the first pixel should have navigated back."); is(resultLocation, firstLocation, "Clicking the first pixel should have navigated back.");
window.restore(); window.restore();
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
}); });

View file

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

View file

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

View file

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

View file

@ -10,12 +10,12 @@ var gTests = [
{ desc: "Urlbar strips newlines and surrounding whitespace", { desc: "Urlbar strips newlines and surrounding whitespace",
element: gURLBar, element: gURLBar,
expected: kTestString.replace(/\s*\n\s*/g,'') expected: kTestString.replace(/\s*\n\s*/g, '')
}, },
{ desc: "Searchbar replaces newlines with spaces", { desc: "Searchbar replaces newlines with spaces",
element: document.getElementById('searchbar'), 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() { function test() {
waitForExplicitFinish(); waitForExplicitFinish();
Task.spawn(function () { Task.spawn(function* () {
gTab1 = gBrowser.addTab(gTestPage); gTab1 = gBrowser.addTab(gTestPage);
gTab2 = gBrowser.addTab(); gTab2 = gBrowser.addTab();
gTab3 = gBrowser.addTab(); gTab3 = gBrowser.addTab();
@ -20,7 +20,7 @@ function test() {
} }
function secondPageLoaded() { function secondPageLoaded() {
Task.spawn(function () { Task.spawn(function* () {
FullZoomHelper.zoomTest(gTab1, 1, "Initial zoom of tab 1 should be 1"); 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(gTab2, 1, "Initial zoom of tab 2 should be 1");
FullZoomHelper.zoomTest(gTab3, 1, "Initial zoom of tab 3 should be 1"); FullZoomHelper.zoomTest(gTab3, 1, "Initial zoom of tab 3 should be 1");
@ -39,7 +39,7 @@ function secondPageLoaded() {
} }
function thirdPageLoaded() { function thirdPageLoaded() {
Task.spawn(function () { Task.spawn(function* () {
FullZoomHelper.zoomTest(gTab1, gLevel, "Tab 1 should still be zoomed"); FullZoomHelper.zoomTest(gTab1, gLevel, "Tab 1 should still be zoomed");
FullZoomHelper.zoomTest(gTab2, 1, "Tab 2 should still not be affected"); 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"); FullZoomHelper.zoomTest(gTab3, gLevel, "Tab 3 should have zoomed as it was loading in the background");
@ -55,7 +55,7 @@ function thirdPageLoaded() {
} }
function imageLoaded() { function imageLoaded() {
Task.spawn(function () { Task.spawn(function* () {
FullZoomHelper.zoomTest(gTab1, 1, "Zoom should be 1 when image was loaded in the background"); FullZoomHelper.zoomTest(gTab1, 1, "Zoom should be 1 when image was loaded in the background");
yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1); yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
FullZoomHelper.zoomTest(gTab1, 1, "Zoom should still be 1 when tab with image is selected"); FullZoomHelper.zoomTest(gTab1, 1, "Zoom should still be 1 when tab with image is selected");
@ -63,7 +63,7 @@ function imageLoaded() {
} }
function imageZoomSwitch() { function imageZoomSwitch() {
Task.spawn(function () { Task.spawn(function* () {
yield FullZoomHelper.navigate(BACK); yield FullZoomHelper.navigate(BACK);
yield FullZoomHelper.navigate(FORWARD); yield FullZoomHelper.navigate(FORWARD);
FullZoomHelper.zoomTest(gTab1, 1, "Tab 1 should not be zoomed when an image loads"); FullZoomHelper.zoomTest(gTab1, 1, "Tab 1 should not be zoomed when an image loads");
@ -75,7 +75,7 @@ function imageZoomSwitch() {
var finishTestStarted = false; var finishTestStarted = false;
function finishTest() { function finishTest() {
Task.spawn(function () { Task.spawn(function* () {
ok(!finishTestStarted, "finishTest called more than once"); ok(!finishTestStarted, "finishTest called more than once");
finishTestStarted = true; finishTestStarted = true;
yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1); yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);

View file

@ -1,6 +1,6 @@
var tabElm, zoomLevel; var tabElm, zoomLevel;
function start_test_prefNotSet() { function start_test_prefNotSet() {
Task.spawn(function () { Task.spawn(function* () {
is(ZoomManager.zoom, 1, "initial zoom level should be 1"); is(ZoomManager.zoom, 1, "initial zoom level should be 1");
FullZoom.enlarge(); FullZoom.enlarge();
@ -13,7 +13,7 @@ function start_test_prefNotSet() {
} }
function continue_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"); is(ZoomManager.zoom, 1, "zoom level pref should not apply to an image");
yield FullZoom.reset(); yield FullZoom.reset();
@ -22,7 +22,7 @@ function continue_test_prefNotSet () {
} }
function end_test_prefNotSet() { function end_test_prefNotSet() {
Task.spawn(function () { Task.spawn(function* () {
is(ZoomManager.zoom, zoomLevel, "the zoom level should have persisted"); is(ZoomManager.zoom, zoomLevel, "the zoom level should have persisted");
// Reset the zoom so that other tests have a fresh zoom level // Reset the zoom so that other tests have a fresh zoom level
@ -35,7 +35,7 @@ function end_test_prefNotSet() {
function test() { function test() {
waitForExplicitFinish(); waitForExplicitFinish();
Task.spawn(function () { Task.spawn(function* () {
tabElm = gBrowser.addTab(); tabElm = gBrowser.addTab();
yield FullZoomHelper.selectTabAndWaitForLocationChange(tabElm); yield FullZoomHelper.selectTabAndWaitForLocationChange(tabElm);
yield FullZoomHelper.load(tabElm, "http://mochi.test:8888/browser/browser/base/content/test/general/zoom_test.html"); 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"); let popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown");
yield BrowserTestUtils.synthesizeMouse("frame", 5, 5, yield BrowserTestUtils.synthesizeMouse("frame", 5, 5,
{ type: "contextmenu", button: 2}, gBrowser.selectedBrowser); { 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"); ok(document.getElementById("frame-sep").hidden, "'frame-sep' should be hidden if the selection contains only spaces");
let popupHiddenPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popuphidden"); let popupHiddenPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popuphidden");
contentAreaContextMenu.hidePopup(); contentAreaContextMenu.hidePopup();
yield popupHiddenPromise; yield popupHiddenPromise;
}); });

View file

@ -1,7 +1,7 @@
function test() { function test() {
waitForExplicitFinish(); waitForExplicitFinish();
Task.spawn(function () { Task.spawn(function* () {
let testPage = "http://example.org/browser/browser/base/content/test/general/dummy_page.html"; let testPage = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
let tab1 = gBrowser.addTab(); let tab1 = gBrowser.addTab();
yield FullZoomHelper.selectTabAndWaitForLocationChange(tab1); 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_PAGE_URL = 'data:text/html,<body><iframe src=""></iframe></body>';
const TEST_IFRAME_URL = "http://test2.example.org/"; const TEST_IFRAME_URL = "http://test2.example.org/";
Task.spawn(function () { Task.spawn(function* () {
// Prepare the test tab // Prepare the test tab
let tab = gBrowser.addTab(); let tab = gBrowser.addTab();
yield FullZoomHelper.selectTabAndWaitForLocationChange(tab); yield FullZoomHelper.selectTabAndWaitForLocationChange(tab);

View file

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

View file

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

View file

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

View file

@ -703,7 +703,7 @@ function test_localfile() {
try { try {
var path = cr.convertChromeURL(makeURI(CHROMEROOT + "corrupt.xpi")).spec; var path = cr.convertChromeURL(makeURI(CHROMEROOT + "corrupt.xpi")).spec;
} catch (ex) { } catch (ex) {
var path = CHROMEROOT + "corrupt.xpi"; path = CHROMEROOT + "corrupt.xpi";
} }
gBrowser.selectedTab = gBrowser.addTab("about:blank"); gBrowser.selectedTab = gBrowser.addTab("about:blank");
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => { BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
@ -1133,7 +1133,7 @@ function runNextTest() {
gTestStart = Date.now(); gTestStart = Date.now();
TESTS.shift()(); TESTS.shift()();
}); });
}; }
var XPInstallObserver = { var XPInstallObserver = {
observe: function (aSubject, aTopic, aData) { 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; var gTestTab, gBgTab, gTestZoom;
function testBackgroundLoad() { function testBackgroundLoad() {
Task.spawn(function () { Task.spawn(function* () {
is(ZoomManager.zoom, gTestZoom, "opening a background tab should not change foreground zoom"); is(ZoomManager.zoom, gTestZoom, "opening a background tab should not change foreground zoom");
yield FullZoomHelper.removeTabAndWaitForLocationChange(gBgTab); yield FullZoomHelper.removeTabAndWaitForLocationChange(gBgTab);
@ -17,7 +17,7 @@ function testBackgroundLoad() {
} }
function testInitialZoom() { function testInitialZoom() {
Task.spawn(function () { Task.spawn(function* () {
is(ZoomManager.zoom, 1, "initial zoom level should be 1"); is(ZoomManager.zoom, 1, "initial zoom level should be 1");
FullZoom.enlarge(); FullZoom.enlarge();
@ -32,7 +32,7 @@ function testInitialZoom() {
function test() { function test() {
waitForExplicitFinish(); waitForExplicitFinish();
Task.spawn(function () { Task.spawn(function* () {
gTestTab = gBrowser.addTab(); gTestTab = gBrowser.addTab();
yield FullZoomHelper.selectTabAndWaitForLocationChange(gTestTab); yield FullZoomHelper.selectTabAndWaitForLocationChange(gTestTab);
yield FullZoomHelper.load(gTestTab, "http://example.org" + TEST_PAGE); yield FullZoomHelper.load(gTestTab, "http://example.org" + TEST_PAGE);

View file

@ -51,4 +51,4 @@
// Press enter! // Press enter!
EventUtils.synthesizeKey("VK_RETURN", {}); 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"; let uri = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
Task.spawn(function () { Task.spawn(function* () {
tab = gBrowser.addTab(); tab = gBrowser.addTab();
yield FullZoomHelper.load(tab, uri); yield FullZoomHelper.load(tab, uri);
@ -26,7 +26,7 @@ function test() {
// ------------- // -------------
// Test clean-up // Test clean-up
function endTest() { function endTest() {
Task.spawn(function () { Task.spawn(function* () {
yield FullZoomHelper.removeTabAndWaitForLocationChange(tab); yield FullZoomHelper.removeTabAndWaitForLocationChange(tab);
tab = null; tab = null;

View file

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

View file

@ -9,7 +9,7 @@ function test() {
waitForExplicitFinish(); waitForExplicitFinish();
Task.spawn(function () { Task.spawn(function* () {
tab1 = gBrowser.addTab(); tab1 = gBrowser.addTab();
tab2 = gBrowser.addTab(); tab2 = gBrowser.addTab();
yield FullZoomHelper.selectTabAndWaitForLocationChange(tab1); 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.length, 2, "there are two remaining tabs open");
is(gBrowser.tabs[0], testTab2, "pinned tab2 stayed open"); is(gBrowser.tabs[0], testTab2, "pinned tab2 stayed open");
is(gBrowser.tabs[1], testTab1, "tab1 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 // Cleanup. Close only one tab because we need an opened tab at the end of
// the test. // the test.
gBrowser.removeTab(testTab2); gBrowser.removeTab(testTab2);

View file

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

View file

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

View file

@ -101,7 +101,7 @@ function test_hoverOne() {
} }
function test_hoverStatePersistence() { 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. // a tab is selected and then unselected again. See bug 856107.
function assertState() { function assertState() {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -20,7 +20,7 @@ function test() {
try { try {
gFindBar.close(); gFindBar.close();
ok(true, "findbar.close should not throw an exception"); ok(true, "findbar.close should not throw an exception");
} catch(e) { } catch (e) {
ok(false, "findbar.close threw exception: " + e); ok(false, "findbar.close threw exception: " + e);
} }
finish(); 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"); waitForCondition(() => content.document.getElementById('p1').innerHTML == "hello", MixedTest1C, "Waited too long for mixed script to run in Test 1");
} }
function MixedTest1C() { 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); gTestBrowser.removeEventListener("load", MixedTest1B, true);
MixedTest2(); 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"); waitForCondition(() => content.document.getElementById('p2').innerHTML == "bye", MixedTest3D, "Waited too long for mixed image to load in Test 3");
} }
function MixedTest3D() { function MixedTest3D() {
ok(content.document.getElementById('p1').innerHTML == "hello","Mixed script 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"); ok(content.document.getElementById('p2').innerHTML == "bye", "Mixed image didn't load in Test 3");
assertMixedContentBlockingState(gTestBrowser, {activeLoaded: true, activeBlocked: false, passiveLoaded: true}); assertMixedContentBlockingState(gTestBrowser, {activeLoaded: true, activeBlocked: false, passiveLoaded: true});
MixedTest4(); MixedTest4();
} }
@ -129,7 +129,7 @@ function MixedTest4C() {
waitForCondition(() => content.document.getElementById('p1').innerHTML == "", MixedTest4D, "Mixed script loaded in test 4 after location change!"); waitForCondition(() => content.document.getElementById('p1').innerHTML == "", MixedTest4D, "Mixed script loaded in test 4 after location change!");
} }
function MixedTest4D() { 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(); 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"); waitForCondition(() => content.document.getElementById('p1').innerHTML == "hello", MixedTest5C, "Waited too long for mixed script to run in Test 5");
} }
function MixedTest5C() { 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(); MixedTest6();
} }
@ -190,7 +190,7 @@ function MixedTest6C() {
}, MixedTest6D, "Waited too long for mixed script to run in Test 6"); }, MixedTest6D, "Waited too long for mixed script to run in Test 6");
} }
function MixedTest6D() { 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}); assertMixedContentBlockingState(gTestBrowser, {activeLoaded: true, activeBlocked: false, passiveLoaded: false});
MixedTestsCompleted(); MixedTestsCompleted();
} }

View file

@ -1,36 +1,36 @@
"use strict"; "use strict";
/** /**
* Tests that the identity-box shows the chromeUI styling * Tests that the identity-box shows the chromeUI styling
* when viewing about:home in a new window. * when viewing about:home in a new window.
*/ */
add_task(function*(){ add_task(function*() {
let homepage = "about:home"; let homepage = "about:home";
yield SpecialPowers.pushPrefEnv({ yield SpecialPowers.pushPrefEnv({
"set": [ "set": [
["browser.startup.homepage", homepage], ["browser.startup.homepage", homepage],
["browser.startup.page", 1], ["browser.startup.page", 1],
] ]
}); });
let win = OpenBrowserWindow(); let win = OpenBrowserWindow();
yield BrowserTestUtils.waitForEvent(win, "load"); yield BrowserTestUtils.waitForEvent(win, "load");
let browser = win.gBrowser.selectedBrowser; let browser = win.gBrowser.selectedBrowser;
// If we've finished loading about:home already, we can check // If we've finished loading about:home already, we can check
// right away - otherwise, we need to wait. // right away - otherwise, we need to wait.
if (browser.contentDocument.readyState == "complete" && if (browser.contentDocument.readyState == "complete" &&
browser.currentURI.spec == homepage) { browser.currentURI.spec == homepage) {
checkIdentityMode(win); checkIdentityMode(win);
} else { } else {
yield BrowserTestUtils.browserLoaded(browser, false, homepage); yield BrowserTestUtils.browserLoaded(browser, false, homepage);
checkIdentityMode(win); checkIdentityMode(win);
} }
yield BrowserTestUtils.closeWindow(win); yield BrowserTestUtils.closeWindow(win);
}); });
function checkIdentityMode(win) { function checkIdentityMode(win) {
let identityMode = win.document.getElementById("identity-box").className; let identityMode = win.document.getElementById("identity-box").className;
is(identityMode, "chromeUI", "Identity state should be chromeUI for about:home in a new window"); 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) => { yield new Promise((resolve, reject) => {
addEventListener("paste", function copyEvent(event) { addEventListener("paste", function copyEvent(event) {
removeEventListener("paste", copyEvent, true); removeEventListener("paste", copyEvent, true);
let clipboardData = event.clipboardData; let clipboardData = event.clipboardData;
Assert.equal(clipboardData.mozItemCount, 1, "One item on clipboard"); Assert.equal(clipboardData.mozItemCount, 1, "One item on clipboard");
Assert.equal(clipboardData.types.length, 2, "Two types on clipboard"); Assert.equal(clipboardData.types.length, 2, "Two types on clipboard");
Assert.equal(clipboardData.types[0], "text/html", "text/html 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) => { yield new Promise((resolve, reject) => {
addEventListener("paste", function copyEvent(event) { addEventListener("paste", function copyEvent(event) {
removeEventListener("paste", copyEvent, true); 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.mozItemCount, 1, "One item on clipboard 2");
Assert.equal(clipboardData.types.length, 2, "Two types 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"); 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", XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
"resource://testing-common/PlacesTestUtils.jsm"); "resource://testing-common/PlacesTestUtils.jsm");
function setup(){ function setup() {
gPrefService.setBoolPref("browser.altClickSave", true); gPrefService.setBoolPref("browser.altClickSave", true);
let testPage = let testPage =
@ -52,7 +52,7 @@ add_task(function* test_alt_click()
let downloads = []; let downloads = [];
let downloadView; let downloadView;
// When 1 download has been attempted then resolve the promise. // When 1 download has been attempted then resolve the promise.
let finishedAllDownloads = new Promise( (resolve)=> { let finishedAllDownloads = new Promise( (resolve) => {
downloadView = { downloadView = {
onDownloadAdded: function (aDownload) { onDownloadAdded: function (aDownload) {
downloads.push(aDownload); downloads.push(aDownload);
@ -81,7 +81,7 @@ add_task(function* test_alt_click_on_xlinks()
let downloads = []; let downloads = [];
let downloadView; let downloadView;
// When all 2 downloads have been attempted then resolve the promise. // When all 2 downloads have been attempted then resolve the promise.
let finishedAllDownloads = new Promise( (resolve)=> { let finishedAllDownloads = new Promise( (resolve) => {
downloadView = { downloadView = {
onDownloadAdded: function (aDownload) { onDownloadAdded: function (aDownload) {
downloads.push(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"); is(downloads[1].source.url, "http://mochi.test/moz/", "Downloaded #svgxlink element");
yield* clean_up(); yield* clean_up();
}); });

View file

@ -1,7 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/** /**
* Test for bug 549340. * Test for bug 549340.
* Test for browser.js::contentAreaClick() util. * Test for browser.js::contentAreaClick() util.
@ -45,7 +45,7 @@ var gTests = [
gPrefService.setBoolPref("browser.altClickSave", true); gPrefService.setBoolPref("browser.altClickSave", true);
}, },
clean: function() { clean: function() {
gPrefService.clearUserPref("browser.altClickSave"); gPrefService.clearUserPref("browser.altClickSave");
}, },
event: { shiftKey: true, event: { shiftKey: true,
altKey: true }, altKey: true },
@ -60,7 +60,7 @@ var gTests = [
gPrefService.setBoolPref("browser.altClickSave", true); gPrefService.setBoolPref("browser.altClickSave", true);
}, },
clean: function() { clean: function() {
gPrefService.clearUserPref("browser.altClickSave"); gPrefService.clearUserPref("browser.altClickSave");
}, },
event: { shiftKey: true, event: { shiftKey: true,
altKey: true }, altKey: true },
@ -85,7 +85,7 @@ var gTests = [
gPrefService.setBoolPref("browser.altClickSave", true); gPrefService.setBoolPref("browser.altClickSave", true);
}, },
clean: function() { clean: function() {
gPrefService.clearUserPref("browser.altClickSave"); gPrefService.clearUserPref("browser.altClickSave");
}, },
event: { altKey: true }, event: { altKey: true },
targets: [ "commonlink", "maplink" ], targets: [ "commonlink", "maplink" ],
@ -99,7 +99,7 @@ var gTests = [
gPrefService.setBoolPref("browser.altClickSave", true); gPrefService.setBoolPref("browser.altClickSave", true);
}, },
clean: function() { clean: function() {
gPrefService.clearUserPref("browser.altClickSave"); gPrefService.clearUserPref("browser.altClickSave");
}, },
event: { altKey: true }, event: { altKey: true },
targets: [ "mathxlink", "svgxlink" ], targets: [ "mathxlink", "svgxlink" ],
@ -215,7 +215,7 @@ var gClickHandler = {
isnot(gInvokedMethods.indexOf(aExpectedMethodName), -1, isnot(gInvokedMethods.indexOf(aExpectedMethodName), -1,
gCurrentTest.desc + ":" + aExpectedMethodName + " was invoked"); gCurrentTest.desc + ":" + aExpectedMethodName + " was invoked");
}); });
if (gInvokedMethods.length != gCurrentTest.expectedInvokedMethods.length) { if (gInvokedMethods.length != gCurrentTest.expectedInvokedMethods.length) {
ok(false, "Wrong number of invoked methods"); ok(false, "Wrong number of invoked methods");
gInvokedMethods.forEach(method => info(method + " was invoked")); 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); checkTabs(4);
yield ctrlTabTest([2] , 1, 0); yield ctrlTabTest([2], 1, 0);
yield ctrlTabTest([2, 3, 1], 2, 2); yield ctrlTabTest([2, 3, 1], 2, 2);
yield ctrlTabTest([] , 4, 2); yield ctrlTabTest([], 4, 2);
{ {
let selectedIndex = gBrowser.tabContainer.selectedIndex; let selectedIndex = gBrowser.tabContainer.selectedIndex;

View file

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

View file

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

View file

@ -125,17 +125,17 @@ function runMultipleEnginesTestAndFinalize() {
} }
function searchDiscovery() { function searchDiscovery() {
var head = doc().getElementById("linkparent"); let head = doc().getElementById("linkparent");
if (searchDiscoveryTests.length) { if (searchDiscoveryTests.length) {
setHandlerFunc(runSearchDiscoveryTest); setHandlerFunc(runSearchDiscoveryTest);
var test = searchDiscoveryTests[0]; let test = searchDiscoveryTests[0];
var link = doc().createElement("link"); let link = doc().createElement("link");
var rel = test.rel || "search"; let rel = test.rel || "search";
var href = test.href || "http://so.not.here.mozilla.com/search.xml"; let href = test.href || "http://so.not.here.mozilla.com/search.xml";
var type = test.type || "application/opensearchdescription+xml"; let type = test.type || "application/opensearchdescription+xml";
var title = test.title || searchDiscoveryTests.length; let title = test.title || searchDiscoveryTests.length;
if (test.pass == undefined) if (test.pass == undefined)
test.pass = true; test.pass = true;
@ -148,12 +148,12 @@ function searchDiscovery() {
setHandlerFunc(runMultipleEnginesTestAndFinalize); setHandlerFunc(runMultipleEnginesTestAndFinalize);
setHandlerFunc(runMultipleEnginesTestAndFinalize); setHandlerFunc(runMultipleEnginesTestAndFinalize);
// Test multiple engines with the same title // Test multiple engines with the same title
var link = doc().createElement("link"); let link = doc().createElement("link");
link.rel = "search"; link.rel = "search";
link.href = "http://first.mozilla.com/search.xml"; link.href = "http://first.mozilla.com/search.xml";
link.type = "application/opensearchdescription+xml"; link.type = "application/opensearchdescription+xml";
link.title = "Test Engine"; link.title = "Test Engine";
var link2 = link.cloneNode(false); let link2 = link.cloneNode(false);
link2.href = "http://second.mozilla.com/search.xml"; link2.href = "http://second.mozilla.com/search.xml";
head.appendChild(link); 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* () add_task(function* ()
{ {
let page1Promise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); let page1Promise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
@ -156,7 +156,7 @@ add_task(function* ()
SidebarUI.toggle('viewBookmarksSidebar'); SidebarUI.toggle('viewBookmarksSidebar');
yield loadPromise; yield loadPromise;
gURLBar.focus(); gURLBar.focus();
yield* expectFocusOnF6(false, "bookmarksPanel", yield* expectFocusOnF6(false, "bookmarksPanel",
sidebar.contentDocument.getElementById("search-box").inputField, sidebar.contentDocument.getElementById("search-box").inputField,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -118,7 +118,7 @@ add_task(function* test_reader_view_element_attribute_transform() {
let observer = new MutationObserver((mutations) => { let observer = new MutationObserver((mutations) => {
mutations.forEach( mu => { mutations.forEach( mu => {
let muValue = element.getAttribute(attribute); let muValue = element.getAttribute(attribute);
if(element.getAttribute(attribute) !== mu.oldValue) { if (element.getAttribute(attribute) !== mu.oldValue) {
checkFn(); checkFn();
resolve(); resolve();
observer.disconnect(); observer.disconnect();
@ -134,7 +134,7 @@ add_task(function* test_reader_view_element_attribute_transform() {
triggerFn(); triggerFn();
}); });
}; }
let command = document.getElementById("View:ReaderView"); let command = document.getElementById("View:ReaderView");
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser); 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 /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var {WebChannel} = Cu.import("resource://gre/modules/WebChannel.jsm", {}); 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_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_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_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); 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. // Creates a one-shot web-channel for the test data to be sent back from the test page.
function promiseChannelResponse(channelID, originOrPermission) { function promiseChannelResponse(channelID, originOrPermission) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let channel = new WebChannel(channelID, originOrPermission); let channel = new WebChannel(channelID, originOrPermission);
channel.listen((id, data, target) => { channel.listen((id, data, target) => {
channel.stopListening(); channel.stopListening();
resolve(data); resolve(data);
}); });
}); });
}; }
// Loads the specified URI in a new tab and waits for it to send us data on our // 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. // test web-channel and resolves with that data.
function promiseNewChannelResponse(uri) { function promiseNewChannelResponse(uri) {
let channelPromise = promiseChannelResponse("test-remote-troubleshooting-backchannel", let channelPromise = promiseChannelResponse("test-remote-troubleshooting-backchannel",
uri); uri);
let tab = gBrowser.loadOneTab(uri.spec, { inBackground: false }); let tab = gBrowser.loadOneTab(uri.spec, { inBackground: false });
return promiseTabLoaded(tab).then( return promiseTabLoaded(tab).then(
() => channelPromise () => channelPromise
).then(data => { ).then(data => {
gBrowser.removeTab(tab); gBrowser.removeTab(tab);
return data; return data;
}); });
} }
add_task(function*() { add_task(function*() {
// We haven't set a permission yet - so even the "good" URI should fail. // We haven't set a permission yet - so even the "good" URI should fail.
let got = yield promiseNewChannelResponse(TEST_URI_GOOD); let got = yield promiseNewChannelResponse(TEST_URI_GOOD);
// Should have no data. // Should have no data.
Assert.ok(got.message === undefined, "should have failed to get any data"); Assert.ok(got.message === undefined, "should have failed to get any data");
// Add a permission manager entry for our URI. // Add a permission manager entry for our URI.
Services.perms.add(TEST_URI_GOOD, Services.perms.add(TEST_URI_GOOD,
"remote-troubleshooting", "remote-troubleshooting",
Services.perms.ALLOW_ACTION); Services.perms.ALLOW_ACTION);
registerCleanupFunction(() => { registerCleanupFunction(() => {
Services.perms.remove(TEST_URI_GOOD, "remote-troubleshooting"); Services.perms.remove(TEST_URI_GOOD, "remote-troubleshooting");
}); });
// Try again - now we are expecting a response with the actual data. // Try again - now we are expecting a response with the actual data.
got = yield promiseNewChannelResponse(TEST_URI_GOOD); got = yield promiseNewChannelResponse(TEST_URI_GOOD);
// Check some keys we expect to always get. // Check some keys we expect to always get.
Assert.ok(got.message.extensions, "should have extensions"); Assert.ok(got.message.extensions, "should have extensions");
Assert.ok(got.message.graphics, "should have graphics"); Assert.ok(got.message.graphics, "should have graphics");
// Check we have channel and build ID info: // Check we have channel and build ID info:
Assert.equal(got.message.application.buildID, Services.appinfo.appBuildID, Assert.equal(got.message.application.buildID, Services.appinfo.appBuildID,
"should have correct build ID"); "should have correct build ID");
let updateChannel = null; let updateChannel = null;
try { try {
updateChannel = Cu.import("resource://gre/modules/UpdateUtils.jsm", {}).UpdateUtils.UpdateChannel; updateChannel = Cu.import("resource://gre/modules/UpdateUtils.jsm", {}).UpdateUtils.UpdateChannel;
} catch (ex) {} } catch (ex) {}
if (!updateChannel) { if (!updateChannel) {
Assert.ok(!('updateChannel' in got.message.application), Assert.ok(!('updateChannel' in got.message.application),
"should not have update channel where not available."); "should not have update channel where not available.");
} else { } else {
Assert.equal(got.message.application.updateChannel, updateChannel, Assert.equal(got.message.application.updateChannel, updateChannel,
"should have correct update channel."); "should have correct update channel.");
} }
// And check some keys we know we decline to return. // 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.modifiedPreferences, "should not have a modifiedPreferences key");
Assert.ok(!got.message.crashes, "should not have crash info"); Assert.ok(!got.message.crashes, "should not have crash info");
// Now a http:// URI - should get nothing even with the permission setup. // Now a http:// URI - should get nothing even with the permission setup.
got = yield promiseNewChannelResponse(TEST_URI_BAD); got = yield promiseNewChannelResponse(TEST_URI_BAD);
Assert.ok(got.message === undefined, "should have failed to get any data"); 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 // Check that the page can send an object as well if it's in the whitelist
let webchannelWhitelistPref = "webchannel.allowObject.urlWhitelist"; let webchannelWhitelistPref = "webchannel.allowObject.urlWhitelist";
let origWhitelist = Services.prefs.getCharPref(webchannelWhitelistPref); let origWhitelist = Services.prefs.getCharPref(webchannelWhitelistPref);
let newWhitelist = origWhitelist + " https://example.com"; let newWhitelist = origWhitelist + " https://example.com";
Services.prefs.setCharPref(webchannelWhitelistPref, newWhitelist); Services.prefs.setCharPref(webchannelWhitelistPref, newWhitelist);
registerCleanupFunction(() => { registerCleanupFunction(() => {
Services.prefs.clearUserPref(webchannelWhitelistPref); Services.prefs.clearUserPref(webchannelWhitelistPref);
}); });
got = yield promiseNewChannelResponse(TEST_URI_GOOD_OBJECT); got = yield promiseNewChannelResponse(TEST_URI_GOOD_OBJECT);
Assert.ok(got.message, "should have gotten some data back"); 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) { var restart = Task.async(function*(browser) {
// If the tab isn't remote this would crash the main process so skip it // If the tab isn't remote this would crash the main process so skip it
if (!browser.isRemoteBrowser) if (!browser.isRemoteBrowser)
return browser; return;
// Make sure the main process has all of the current tab state before crashing // Make sure the main process has all of the current tab state before crashing
yield TabStateFlusher.flush(browser); yield TabStateFlusher.flush(browser);

View file

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

View file

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

View file

@ -118,7 +118,7 @@ function test() {
Services.obs.removeObserver(observer, "http-on-examine-response"); Services.obs.removeObserver(observer, "http-on-examine-response");
info("Finished running the cleanup code"); info("Finished running the cleanup code");
}); });
function observer(subject, topic, state) { function observer(subject, topic, state) {
info("observer called with " + topic); info("observer called with " + topic);
if (topic == "http-on-modify-request") { if (topic == "http-on-modify-request") {
@ -142,10 +142,12 @@ function test() {
is(cookies, "foopy=1", "Cookie should be foopy=1"); is(cookies, "foopy=1", "Cookie should be foopy=1");
gNumSet += 1; gNumSet += 1;
info("gNumSet = " + gNumSet); info("gNumSet = " + gNumSet);
} catch (ex if ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {
info("onExamineResponse caught NOTAVAIL" + ex);
} catch (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 // cookie because we are making only 2 requests: one in public mode, and
// one in private mode. // one in private mode.
throw "We should never send a cookie in this test"; 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) { } 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); Services.prefs.clearUserPref(SAVE_PER_SITE_PREF);
info("Finished running the cleanup code"); info("Finished running the cleanup code");
}); });
Services.prefs.setBoolPref(ALWAYS_DOWNLOAD_DIR_PREF, false); Services.prefs.setBoolPref(ALWAYS_DOWNLOAD_DIR_PREF, false);
testOnWindow(undefined, function(win) { testOnWindow(undefined, function(win) {
let windowGonePromise = promiseWindowWillBeClosed(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); const pageUrl = "data:" + contentType + "," + escape(dtd + "\n" + PAGECONTENT);
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl); let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,7 +10,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=822367
<script> <script>
function createDoc() 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.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(); doc.close();
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -39,7 +39,7 @@ add_task(function* () {
}); });
var windowsToClose = []; var windowsToClose = [];
function testOnWindow(options) { function* testOnWindow(options) {
let newWindowPromise = BrowserTestUtils.waitForNewWindow(); let newWindowPromise = BrowserTestUtils.waitForNewWindow();
var win = OpenBrowserWindow(options); var win = OpenBrowserWindow(options);
windowsToClose.push(win); windowsToClose.push(win);

View file

@ -214,7 +214,7 @@ add_task(function* () {
NewTabUtils.allPages.enabled = false; NewTabUtils.allPages.enabled = false;
EventUtils.synthesizeKey("k", { accelKey: true }); EventUtils.synthesizeKey("k", { accelKey: true });
let aboutHomeLoaded = new Promise(resolve => { let aboutHomeLoaded = new Promise(resolve => {
tab.linkedBrowser.addEventListener("AboutHomeLoadSnippetsCompleted", function loadListener(event) { tab.linkedBrowser.addEventListener("AboutHomeLoadSnippetsCompleted", function loadListener(event) {
tab.linkedBrowser.removeEventListener("AboutHomeLoadSnippetsCompleted", loadListener, true); tab.linkedBrowser.removeEventListener("AboutHomeLoadSnippetsCompleted", loadListener, true);

View file

@ -37,11 +37,11 @@ add_task(function* () {
function* undo() { function* undo() {
let updatedPromise = whenPagesUpdated(); let updatedPromise = whenPagesUpdated();
yield BrowserTestUtils.synthesizeMouseAtCenter("#newtab-undo-button", {}, gBrowser.selectedBrowser); yield BrowserTestUtils.synthesizeMouseAtCenter("#newtab-undo-button", {}, gBrowser.selectedBrowser);
yield updatedPromise; yield updatedPromise;
} }
function* undoAll() { function* undoAll() {
let updatedPromise = whenPagesUpdated(); let updatedPromise = whenPagesUpdated();
yield BrowserTestUtils.synthesizeMouseAtCenter("#newtab-undo-restore-button", {}, gBrowser.selectedBrowser); yield BrowserTestUtils.synthesizeMouseAtCenter("#newtab-undo-restore-button", {}, gBrowser.selectedBrowser);
yield updatedPromise; yield updatedPromise;
} }

View file

@ -109,7 +109,7 @@ function watchLinksChangeOnce() {
observer.onDownloadFail = observer.onManyLinksChanged; observer.onDownloadFail = observer.onManyLinksChanged;
DirectoryLinksProvider.addObserver(observer); DirectoryLinksProvider.addObserver(observer);
}); });
}; }
add_task(function* setup() { add_task(function* setup() {
registerCleanupFunction(function() { registerCleanupFunction(function() {
@ -250,6 +250,7 @@ function setPinnedLinks(aLinks) {
return {url: "http://example" + (id != "-1" ? id : "") + ".com/", return {url: "http://example" + (id != "-1" ? id : "") + ".com/",
title: "site#" + id, title: "site#" + id,
type: "history"}; type: "history"};
return undefined;
}); });
} }

View file

@ -32,7 +32,7 @@ add_task(function* () {
// check plugin state // check plugin state
let pluginInfo = yield promiseForPluginInfo("test", gBrowser.selectedBrowser); let pluginInfo = yield promiseForPluginInfo("test", gBrowser.selectedBrowser);
ok(!pluginInfo.activated, "plugin should not be activated"); ok(!pluginInfo.activated, "plugin should not be activated");
// Display a context menu on the test plugin so we can test // Display a context menu on the test plugin so we can test
// activation menu options. // activation menu options.
yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {

View file

@ -18,7 +18,7 @@ const PLUGIN_SMALL_PAGE = gTestRoot + "plugin_small.html";
function convertPropertyBag(aBag) { function convertPropertyBag(aBag) {
let result = {}; let result = {};
let enumerator = aBag.enumerator; let enumerator = aBag.enumerator;
while(enumerator.hasMoreElements()) { while (enumerator.hasMoreElements()) {
let { name, value } = enumerator.getNext().QueryInterface(Ci.nsIProperty); let { name, value } = enumerator.getNext().QueryInterface(Ci.nsIProperty);
if (value instanceof Ci.nsIPropertyBag) { if (value instanceof Ci.nsIPropertyBag) {
value = convertPropertyBag(value); value = convertPropertyBag(value);
@ -95,7 +95,7 @@ add_task(function*() {
try { try {
Components.utils.waiveXrays(plugin).crash(); Components.utils.waiveXrays(plugin).crash();
} catch(e) { } catch (e) {
} }
let doc = plugin.ownerDocument; let doc = plugin.ownerDocument;
@ -116,8 +116,8 @@ add_task(function*() {
// Make sure the UI matches our expectations... // Make sure the UI matches our expectations...
let style = content.getComputedStyle(getUI("pleaseSubmit")); let style = content.getComputedStyle(getUI("pleaseSubmit"));
if (style.display != "block") { if (style.display != "block") {
return Promise.reject(`Submission UI visibility is not correct. ` + throw new Error(`Submission UI visibility is not correct. ` +
`Expected block style, got ${style.display}.`); `Expected block style, got ${style.display}.`);
} }
// Fill the crash report in with some test values that we'll test for in // Fill the crash report in with some test values that we'll test for in
@ -125,7 +125,7 @@ add_task(function*() {
getUI("submitComment").value = "a test comment"; getUI("submitComment").value = "a test comment";
let optIn = getUI("submitURLOptIn"); let optIn = getUI("submitURLOptIn");
if (!optIn.checked) { if (!optIn.checked) {
return Promise.reject("URL opt-in should default to true."); throw new Error("URL opt-in should default to true.");
} }
// Submit the report. // Submit the report.
@ -197,7 +197,7 @@ add_task(function*() {
try { try {
Components.utils.waiveXrays(plugin).crash(); Components.utils.waiveXrays(plugin).crash();
} catch(e) {} } catch (e) {}
}); });
// Wait for the notification bar to be displayed. // Wait for the notification bar to be displayed.

View file

@ -252,4 +252,4 @@ add_task(function* () {
pluginInfo = yield promiseForPluginInfo("test"); pluginInfo = yield promiseForPluginInfo("test");
ok(pluginInfo.activated, "Test 4a, plugin should be activated"); ok(pluginInfo.activated, "Test 4a, plugin should be activated");
}); });
*/ */

View file

@ -54,7 +54,7 @@ add_task(function* () {
pluginItem = item; pluginItem = item;
} }
} }
// Choose "Allow now" for the test plugin // Choose "Allow now" for the test plugin
pluginItem.value = "allownow"; pluginItem.value = "allownow";
PopupNotifications.panel.firstChild._primaryButton.click(); PopupNotifications.panel.firstChild._primaryButton.click();

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