diff --git a/.arcconfig b/.arcconfig new file mode 100644 index 0000000000000..da7538f9bb007 --- /dev/null +++ b/.arcconfig @@ -0,0 +1,3 @@ +{ + "phabricator.uri" : "https://phabricator.services.mozilla.com/" +} diff --git a/browser/components/extensions/ext-chrome-settings-overrides.js b/browser/components/extensions/ext-chrome-settings-overrides.js index 7f2c526cd5e4a..741577b7b70d7 100644 --- a/browser/components/extensions/ext-chrome-settings-overrides.js +++ b/browser/components/extensions/ext-chrome-settings-overrides.js @@ -2,7 +2,7 @@ * 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/. */ - /* globals windowTracker */ +/* globals windowTracker */ "use strict"; @@ -170,8 +170,9 @@ this.chrome_settings_overrides = class extends ExtensionAPI { // Needs to be called every time to handle reenabling, but // only sets default for install or enable. await this.setDefault(engineName); - } else if (ExtensionSettingsStore.hasSetting( - extension.id, DEFAULT_SEARCH_STORE_TYPE, DEFAULT_SEARCH_SETTING_NAME)) { + } else if (ExtensionSettingsStore.hasSetting(extension.id, + DEFAULT_SEARCH_STORE_TYPE, + DEFAULT_SEARCH_SETTING_NAME)) { // is_default has been removed, but we still have a setting. Remove it. chrome_settings_overrides.processDefaultSearchSetting("removeSetting", extension.id); } diff --git a/browser/components/extensions/ext-menus.js b/browser/components/extensions/ext-menus.js index 7e743de0f2523..2b6d6df083f4f 100644 --- a/browser/components/extensions/ext-menus.js +++ b/browser/components/extensions/ext-menus.js @@ -193,8 +193,7 @@ var gMenuBuilder = { } if (item.id && item.extension && item.extension.id) { - element.setAttribute("id", - `${makeWidgetId(item.extension.id)}_${item.id}`); + element.setAttribute("id", `${makeWidgetId(item.extension.id)}_${item.id}`); } if (item.icons) { diff --git a/browser/components/extensions/ext-pkcs11.js b/browser/components/extensions/ext-pkcs11.js index eec619bb6334e..827acf3b9d4a9 100644 --- a/browser/components/extensions/ext-pkcs11.js +++ b/browser/components/extensions/ext-pkcs11.js @@ -6,10 +6,9 @@ XPCOMUtils.defineLazyModuleGetters(this, { OS: "resource://gre/modules/osfile.jsm", }); -XPCOMUtils.defineLazyServiceGetter(this, - "pkcs11db", - "@mozilla.org/security/pkcs11moduledb;1", - "nsIPKCS11ModuleDB"); +XPCOMUtils.defineLazyServiceGetter(this, "pkcs11db", + "@mozilla.org/security/pkcs11moduledb;1", + "nsIPKCS11ModuleDB"); var {DefaultMap} = ExtensionUtils; diff --git a/browser/components/extensions/ext-windows.js b/browser/components/extensions/ext-windows.js index c8240a5eb4905..b5bc13d75ed36 100644 --- a/browser/components/extensions/ext-windows.js +++ b/browser/components/extensions/ext-windows.js @@ -190,8 +190,8 @@ this.windows = class extends ExtensionAPI { if (allowScriptsToClose) { for (let {linkedBrowser} of window.gBrowser.tabs) { onXULFrameLoaderCreated({target: linkedBrowser}); - linkedBrowser.addEventListener( // eslint-disable-line mozilla/balanced-listeners - "XULFrameLoaderCreated", onXULFrameLoaderCreated); + // eslint-disable-next-line mozilla/balanced-listeners + linkedBrowser.addEventListener("XULFrameLoaderCreated", onXULFrameLoaderCreated); } } if (createData.titlePreface !== null) { diff --git a/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js b/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js index ee34a2e51f0b6..da102a9eb3e11 100644 --- a/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js +++ b/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js @@ -32,13 +32,13 @@ add_task(async function testBrowserActionPopupResize() { Assert.lessOrEqual(Math.abs(dims.window.innerHeight - expected), 1, `Panel window should be ${expected}px tall (was ${dims.window.innerHeight})`); is(dims.body.clientHeight, dims.body.scrollHeight, - "Panel body should be tall enough to fit its contents"); + "Panel body should be tall enough to fit its contents"); // Tolerate if it is 1px too wide, as that may happen with the current resizing method. Assert.lessOrEqual(Math.abs(dims.window.innerWidth - expected), 1, `Panel window should be ${expected}px wide`); is(dims.body.clientWidth, dims.body.scrollWidth, - "Panel body should be wide enough to fit its contents"); + "Panel body should be wide enough to fit its contents"); } /* eslint-disable mozilla/no-cpows-in-tests */ @@ -162,7 +162,7 @@ async function testPopupSize(standardsMode, browserWin = window, arrowSide = "to // The 'ViewShown' event is the only way to correctly determine when the extensions' // panelview has finished transitioning and is fully in view. let shownPromise = BrowserTestUtils.waitForEvent(panelMultiView, "ViewShown", - e => (e.originalTarget.id || "").includes(widgetId)); + e => (e.originalTarget.id || "").includes(widgetId)); let browser = await openPanel(extension, browserWin); let origPanelRect = panel.getBoundingClientRect(); diff --git a/browser/components/extensions/test/browser/browser_ext_browserAction_telemetry.js b/browser/components/extensions/test/browser/browser_ext_browserAction_telemetry.js index 36261993f2b8e..021ccfc09309b 100644 --- a/browser/components/extensions/test/browser/browser_ext_browserAction_telemetry.js +++ b/browser/components/extensions/test/browser/browser_ext_browserAction_telemetry.js @@ -56,13 +56,13 @@ add_task(async function testBrowserActionTelemetryTiming() { histogram.clear(); is(histogram.snapshot().sum, 0, - `No data recorded for histogram: ${TIMING_HISTOGRAM}.`); + `No data recorded for histogram: ${TIMING_HISTOGRAM}.`); await extension1.startup(); await extension2.startup(); is(histogram.snapshot().sum, 0, - `No data recorded for histogram after startup: ${TIMING_HISTOGRAM}.`); + `No data recorded for histogram after startup: ${TIMING_HISTOGRAM}.`); clickBrowserAction(extension1); await awaitExtensionPanel(extension1); @@ -117,7 +117,7 @@ add_task(async function testBrowserActionTelemetryResults() { histogram.clear(); is(histogram.snapshot().sum, 0, - `No data recorded for histogram: ${TIMING_HISTOGRAM}.`); + `No data recorded for histogram: ${TIMING_HISTOGRAM}.`); await extension.startup(); diff --git a/browser/components/extensions/test/browser/browser_ext_browsingData_serviceWorkers.js b/browser/components/extensions/test/browser/browser_ext_browsingData_serviceWorkers.js index ff5b61d29f7b6..1e23ae4496914 100644 --- a/browser/components/extensions/test/browser/browser_ext_browsingData_serviceWorkers.js +++ b/browser/components/extensions/test/browser/browser_ext_browsingData_serviceWorkers.js @@ -6,8 +6,8 @@ add_task(async function setup() { await SpecialPowers.pushPrefEnv({ set: [["dom.serviceWorkers.exemptFromPerDomainMax", true], - ["dom.serviceWorkers.enabled", true], - ["dom.serviceWorkers.testing.enabled", true]], + ["dom.serviceWorkers.enabled", true], + ["dom.serviceWorkers.testing.enabled", true]], }); }); diff --git a/browser/components/extensions/test/browser/browser_ext_contextMenus.js b/browser/components/extensions/test/browser/browser_ext_contextMenus.js index 700fb19add093..6857e92acd95a 100644 --- a/browser/components/extensions/test/browser/browser_ext_contextMenus.js +++ b/browser/components/extensions/test/browser/browser_ext_contextMenus.js @@ -486,7 +486,8 @@ add_task(async function test_bookmark_contextmenu() { }); await extension.startup(); await extension.awaitMessage("bookmark-created"); - let menu = await openChromeContextMenu("placesContext", + let menu = await openChromeContextMenu( + "placesContext", "#PersonalToolbar .bookmark-item:last-child"); let menuItem = menu.getElementsByAttribute("label", "Get bookmark")[0]; @@ -515,11 +516,12 @@ add_task(async function test_bookmark_context_requires_permission() { }); await extension.startup(); await extension.awaitMessage("bookmark-created"); - let menu = await openChromeContextMenu("placesContext", + let menu = await openChromeContextMenu( + "placesContext", "#PersonalToolbar .bookmark-item:last-child"); Assert.equal(menu.getElementsByAttribute("label", "Get bookmark").length, 0, - "bookmark context menu not created with `bookmarks` permission."); + "bookmark context menu not created with `bookmarks` permission."); closeChromeContextMenu("placesContext"); diff --git a/browser/components/extensions/test/browser/browser_ext_contextMenus_checkboxes.js b/browser/components/extensions/test/browser/browser_ext_contextMenus_checkboxes.js index 6db571bc3fe74..3aa3804389c43 100644 --- a/browser/components/extensions/test/browser/browser_ext_contextMenus_checkboxes.js +++ b/browser/components/extensions/test/browser/browser_ext_contextMenus_checkboxes.js @@ -3,7 +3,8 @@ "use strict"; add_task(async function() { - let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, + let tab1 = await BrowserTestUtils.openNewForegroundTab( + gBrowser, "http://mochi.test:8888/browser/browser/components/extensions/test/browser/context.html"); gBrowser.selectedTab = tab1; diff --git a/browser/components/extensions/test/browser/browser_ext_contextMenus_onclick.js b/browser/components/extensions/test/browser/browser_ext_contextMenus_onclick.js index 49bcecf563db6..0c1f0d49aee6e 100644 --- a/browser/components/extensions/test/browser/browser_ext_contextMenus_onclick.js +++ b/browser/components/extensions/test/browser/browser_ext_contextMenus_onclick.js @@ -69,10 +69,10 @@ function testScript() { // Sanity check - the pages must be in the same process. let pages = browser.extension.getViews(); browser.test.assertTrue(pages.includes(window), - "Expected this tab to be an extension view"); + "Expected this tab to be an extension view"); pages = pages.filter(w => w !== window); browser.test.assertEq(pages[0], browser.extension.getBackgroundPage(), - "Expected the other page to be a background page"); + "Expected the other page to be a background page"); browser.test.sendMessage("tab.html ready"); } } diff --git a/browser/components/extensions/test/browser/browser_ext_contextMenus_radioGroups.js b/browser/components/extensions/test/browser/browser_ext_contextMenus_radioGroups.js index 56cff688a3c2c..a887d0af2c6cf 100644 --- a/browser/components/extensions/test/browser/browser_ext_contextMenus_radioGroups.js +++ b/browser/components/extensions/test/browser/browser_ext_contextMenus_radioGroups.js @@ -3,7 +3,8 @@ "use strict"; add_task(async function() { - let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, + let tab1 = await BrowserTestUtils.openNewForegroundTab( + gBrowser, "http://mochi.test:8888/browser/browser/components/extensions/test/browser/context.html"); gBrowser.selectedTab = tab1; diff --git a/browser/components/extensions/test/browser/browser_ext_contextMenus_uninstall.js b/browser/components/extensions/test/browser/browser_ext_contextMenus_uninstall.js index a9864448d3a37..96884250b40e6 100644 --- a/browser/components/extensions/test/browser/browser_ext_contextMenus_uninstall.js +++ b/browser/components/extensions/test/browser/browser_ext_contextMenus_uninstall.js @@ -3,7 +3,8 @@ "use strict"; add_task(async function() { - let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, + let tab1 = await BrowserTestUtils.openNewForegroundTab( + gBrowser, "http://mochi.test:8888/browser/browser/components/extensions/test/browser/context.html"); // Install an extension. diff --git a/browser/components/extensions/test/browser/browser_ext_contextMenus_urlPatterns.js b/browser/components/extensions/test/browser/browser_ext_contextMenus_urlPatterns.js index e370e2e44fa4e..24f0dad7eca42 100644 --- a/browser/components/extensions/test/browser/browser_ext_contextMenus_urlPatterns.js +++ b/browser/components/extensions/test/browser/browser_ext_contextMenus_urlPatterns.js @@ -3,7 +3,8 @@ "use strict"; add_task(async function() { - let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, + let tab1 = await BrowserTestUtils.openNewForegroundTab( + gBrowser, "http://mochi.test:8888/browser/browser/components/extensions/test/browser/context.html"); let extension = ExtensionTestUtils.loadExtension({ diff --git a/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow.js b/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow.js index 996f9bb7899f5..ce102d78ee635 100644 --- a/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow.js +++ b/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow.js @@ -49,9 +49,9 @@ add_task(async function test_devtools_inspectedWindow_tabId() { } function devtools_page() { - browser.test.assertEq(undefined, browser.runtime.getBackgroundPage, - "The `runtime.getBackgroundPage` API method should be missing in a devtools_page context" - ); + browser.test.assertEq( + undefined, browser.runtime.getBackgroundPage, + "The `runtime.getBackgroundPage` API method should be missing in a devtools_page context"); try { let tabId = browser.devtools.inspectedWindow.tabId; diff --git a/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow_eval_bindings.js b/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow_eval_bindings.js index ae0c1ee438c6a..898f24c6e024a 100644 --- a/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow_eval_bindings.js +++ b/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow_eval_bindings.js @@ -173,7 +173,7 @@ add_task(async function test_devtools_inspectedWindow_eval_bindings() { const objectPreviewProperties = options.objectActor.preview.ownProperties; is(objectType, "object", "The inspected object has the expected type"); Assert.deepEqual(Object.keys(objectPreviewProperties), ["testkey"], - "The inspected object has the expected preview properties"); + "The inspected object has the expected preview properties"); } })(); diff --git a/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow_reload.js b/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow_reload.js index 2cfbe42c1657d..82eb3f94f6fec 100644 --- a/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow_reload.js +++ b/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow_reload.js @@ -181,7 +181,7 @@ add_task(async function test_devtools_inspectedWindow_reload_custom_user_agent() try { const [text] = await browser.tabs.executeScript(activeTabId, {code}); browser.test.assertEq(expectedContent, text, - `Got the expected userAgent with userAgent=${enabled}`); + `Got the expected userAgent with userAgent=${enabled}`); } catch (err) { browser.test.fail(`Error: ${err.message} - ${err.stack}`); } diff --git a/browser/components/extensions/test/browser/browser_ext_devtools_panel.js b/browser/components/extensions/test/browser/browser_ext_devtools_panel.js index adc887675594b..9e41bdb6c1bb1 100644 --- a/browser/components/extensions/test/browser/browser_ext_devtools_panel.js +++ b/browser/components/extensions/test/browser/browser_ext_devtools_panel.js @@ -31,11 +31,11 @@ async function testThemeSwitching(extension, locations = ["page"]) { await switchTheme(newTheme); for (let location of locations) { is(await extension.awaitMessage(`devtools_theme_changed_${location}`), - newTheme, - `The onThemeChanged event listener fired for the ${location}.`); + newTheme, + `The onThemeChanged event listener fired for the ${location}.`); is(await extension.awaitMessage(`current_theme_${location}`), - newTheme, - `The current theme is reported as expected for the ${location}.`); + newTheme, + `The current theme is reported as expected for the ${location}.`); } } } @@ -80,8 +80,8 @@ add_task(async function test_theme_name_no_panel() { info("developer toolbox opened"); is(await extension.awaitMessage("initial_theme"), - "light", - "The initial theme is reported as expected."); + "light", + "The initial theme is reported as expected."); await testThemeSwitching(extension); @@ -201,8 +201,8 @@ add_task(async function test_devtools_page_panels_create() { await extension.awaitMessage("devtools_panel_created"); is(await extension.awaitMessage("initial_theme_page"), - "light", - "The initial theme is reported as expected from a devtools page."); + "light", + "The initial theme is reported as expected from a devtools page."); const toolboxAdditionalTools = toolbox.getAdditionalTools(); @@ -220,8 +220,8 @@ add_task(async function test_devtools_page_panels_create() { is(devtoolsPanelTabId, devtoolsPageTabId, "Got the same devtools.inspectedWindow.tabId from devtools page and panel"); is(await extension.awaitMessage("initial_theme_panel"), - "light", - "The initial theme is reported as expected from a devtools panel."); + "light", + "The initial theme is reported as expected from a devtools panel."); info("Addon Devtools Panel shown"); await testThemeSwitching(extension, ["page", "panel"]); @@ -282,8 +282,8 @@ add_task(async function test_devtools_page_panels_create() { await gDevTools.showToolbox(target, panelId); await extension.awaitMessage("devtools_panel_shown"); is(await extension.awaitMessage("initial_theme_panel"), - "light", - "The initial theme is reported as expected from a devtools panel."); + "light", + "The initial theme is reported as expected from a devtools panel."); info("Addon Devtools Panel shown - after visibilityswitch toggled"); info("Wait until the Addon Devtools Panel has been loaded - after visibilityswitch toggled"); diff --git a/browser/components/extensions/test/browser/browser_ext_legacy_extension_context_contentscript.js b/browser/components/extensions/test/browser/browser_ext_legacy_extension_context_contentscript.js index 4b8845cbb2100..1bb6556fd5ec5 100644 --- a/browser/components/extensions/test/browser/browser_ext_legacy_extension_context_contentscript.js +++ b/browser/components/extensions/test/browser/browser_ext_legacy_extension_context_contentscript.js @@ -49,7 +49,7 @@ add_task(async function test_legacy_extension_context_contentscript_connection() function contentScript() { browser.runtime.sendMessage("webextension -> legacy_extension message", (reply) => { browser.test.assertEq("legacy_extension -> webextension reply", reply, - "Got the expected reply from the LegacyExtensionContext"); + "Got the expected reply from the LegacyExtensionContext"); browser.test.sendMessage("got-reply-message"); }); diff --git a/browser/components/extensions/test/browser/browser_ext_omnibox.js b/browser/components/extensions/test/browser/browser_ext_omnibox.js index 7e181ca216313..8934017be3247 100644 --- a/browser/components/extensions/test/browser/browser_ext_omnibox.js +++ b/browser/components/extensions/test/browser/browser_ext_omnibox.js @@ -76,11 +76,11 @@ add_task(async function() { let actual = await extension.awaitMessage(event); if (expected.text) { is(actual.text, expected.text, - `Expected "${event}" to have fired with text: "${expected.text}".`); + `Expected "${event}" to have fired with text: "${expected.text}".`); } if (expected.disposition) { is(actual.disposition, expected.disposition, - `Expected "${event}" to have fired with disposition: "${expected.disposition}".`); + `Expected "${event}" to have fired with disposition: "${expected.disposition}".`); } } @@ -205,10 +205,10 @@ add_task(async function() { let item = gURLBar.popup.richlistbox.children[0]; is(item.getAttribute("title"), expectedText, - `Expected heuristic result to have title: "${expectedText}".`); + `Expected heuristic result to have title: "${expectedText}".`); is(item.getAttribute("displayurl"), `${keyword} ${text}`, - `Expected heuristic result to have displayurl: "${keyword} ${text}".`); + `Expected heuristic result to have displayurl: "${keyword} ${text}".`); let promiseEvent = expectEvent("on-input-entered-fired", { text, @@ -250,10 +250,10 @@ add_task(async function() { ok(!!item, "Expected item to exist"); is(item.getAttribute("title"), description, - `Expected suggestion to have title: "${description}".`); + `Expected suggestion to have title: "${description}".`); is(item.getAttribute("displayurl"), `${keyword} ${content}`, - `Expected suggestion to have displayurl: "${keyword} ${content}".`); + `Expected suggestion to have displayurl: "${keyword} ${content}".`); } let text = await startInputSession(info.suggestions.length - 1); diff --git a/browser/components/extensions/test/browser/browser_ext_pageAction_popup_resize.js b/browser/components/extensions/test/browser/browser_ext_pageAction_popup_resize.js index 1b9f8457ee409..5206ab7f2cfbd 100644 --- a/browser/components/extensions/test/browser/browser_ext_pageAction_popup_resize.js +++ b/browser/components/extensions/test/browser/browser_ext_pageAction_popup_resize.js @@ -41,9 +41,9 @@ add_task(async function testPageActionPopupResize() { is(dims.window.innerHeight, expected, `Panel window should be ${expected}px tall`); is(body.clientHeight, body.scrollHeight, - "Panel body should be tall enough to fit its contents"); + "Panel body should be tall enough to fit its contents"); is(root.clientHeight, root.scrollHeight, - "Panel root should be tall enough to fit its contents"); + "Panel root should be tall enough to fit its contents"); // Tolerate if it is 1px too wide, as that may happen with the current resizing method. ok(Math.abs(dims.window.innerWidth - expected) <= 1, `Panel window should be ${expected}px wide`); @@ -141,9 +141,9 @@ add_task(async function testPageActionPopupReflow() { `Panel window height (${dims.window.innerHeight}px) should be taller than two lines of text.`); is(dims.body.clientHeight, dims.body.scrollHeight, - "Panel body should be tall enough to fit its contents"); + "Panel body should be tall enough to fit its contents"); is(dims.root.clientHeight, dims.root.scrollHeight, - "Panel root should be tall enough to fit its contents"); + "Panel root should be tall enough to fit its contents"); await extension.unload(); }); diff --git a/browser/components/extensions/test/browser/browser_ext_sessions_forgetClosedTab.js b/browser/components/extensions/test/browser/browser_ext_sessions_forgetClosedTab.js index 78d7a8dc027d8..53805d5a2ac9b 100644 --- a/browser/components/extensions/test/browser/browser_ext_sessions_forgetClosedTab.js +++ b/browser/components/extensions/test/browser/browser_ext_sessions_forgetClosedTab.js @@ -16,7 +16,7 @@ add_task(async function test_sessions_forget_closed_tab() { }, error => { browser.test.assertEq(error.message, - `Could not find closed tab using sessionId ${sessionId}.`); + `Could not find closed tab using sessionId ${sessionId}.`); browser.test.sendMessage("forget-reject"); } ); @@ -45,8 +45,9 @@ add_task(async function test_sessions_forget_closed_tab() { let recentlyClosedTab = recentlyClosed[0].tab; // Check that forgetting a tab works properly - extension.sendMessage("forget-tab", recentlyClosedTab.windowId, - recentlyClosedTab.sessionId); + extension.sendMessage("forget-tab", + recentlyClosedTab.windowId, + recentlyClosedTab.sessionId); await extension.awaitMessage("forgot-tab"); extension.sendMessage("check-sessions"); let remainingClosed = await extension.awaitMessage("recentlyClosed"); @@ -56,8 +57,9 @@ add_task(async function test_sessions_forget_closed_tab() { "The correct tab was forgotten."); // Check that re-forgetting the same tab fails properly - extension.sendMessage("forget-tab", recentlyClosedTab.windowId, - recentlyClosedTab.sessionId); + extension.sendMessage("forget-tab", + recentlyClosedTab.windowId, + recentlyClosedTab.sessionId); await extension.awaitMessage("forget-reject"); extension.sendMessage("check-sessions"); remainingClosed = await extension.awaitMessage("recentlyClosed"); diff --git a/browser/components/extensions/test/browser/browser_ext_sessions_forgetClosedWindow.js b/browser/components/extensions/test/browser/browser_ext_sessions_forgetClosedWindow.js index 4390b35a5adb7..68c11353d40f5 100644 --- a/browser/components/extensions/test/browser/browser_ext_sessions_forgetClosedWindow.js +++ b/browser/components/extensions/test/browser/browser_ext_sessions_forgetClosedWindow.js @@ -22,8 +22,9 @@ add_task(async function test_sessions_forget_closed_window() { browser.test.sendMessage("forgot-window"); }, error => { - browser.test.assertEq(error.message, - `Could not find closed window using sessionId ${sessionId}.`); + browser.test.assertEq( + error.message, + `Could not find closed window using sessionId ${sessionId}.`); browser.test.sendMessage("forget-reject"); } ); diff --git a/browser/components/extensions/test/browser/browser_ext_sessions_getRecentlyClosed.js b/browser/components/extensions/test/browser/browser_ext_sessions_getRecentlyClosed.js index fcdd3a2634906..b45a6d0356448 100644 --- a/browser/components/extensions/test/browser/browser_ext_sessions_getRecentlyClosed.js +++ b/browser/components/extensions/test/browser/browser_ext_sessions_getRecentlyClosed.js @@ -98,9 +98,11 @@ add_task(async function test_sessions_get_recently_closed_navigated() { function background() { browser.sessions.getRecentlyClosed({maxResults: 1}).then(recentlyClosed => { let tab = recentlyClosed[0].window.tabs[0]; - browser.test.assertEq("http://example.com/", tab.url, + browser.test.assertEq( + "http://example.com/", tab.url, "Tab in closed window has the expected url."); - browser.test.assertTrue(tab.title.includes("mochitest index"), + browser.test.assertTrue( + tab.title.includes("mochitest index"), "Tab in closed window has the expected title."); browser.test.notifyPass("getRecentlyClosed with navigation"); }); diff --git a/browser/components/extensions/test/browser/browser_ext_settings_overrides_search.js b/browser/components/extensions/test/browser/browser_ext_settings_overrides_search.js index 459b28fa2d560..620cf8ec22bd6 100644 --- a/browser/components/extensions/test/browser/browser_ext_settings_overrides_search.js +++ b/browser/components/extensions/test/browser/browser_ext_settings_overrides_search.js @@ -15,10 +15,10 @@ add_task(async function test_extension_adding_engine() { manifest: { "chrome_settings_overrides": { "search_provider": { - "name": "MozSearch", - "keyword": "MozSearch", - "search_url": kSearchEngineURL, - "suggest_url": kSearchSuggestURL, + "name": "MozSearch", + "keyword": "MozSearch", + "search_url": kSearchEngineURL, + "suggest_url": kSearchSuggestURL, }, }, }, @@ -49,9 +49,9 @@ add_task(async function test_extension_adding_engine_with_spaces() { manifest: { "chrome_settings_overrides": { "search_provider": { - "name": "MozSearch ", - "keyword": "MozSearch", - "search_url": "https://example.com/?q={searchTerms}", + "name": "MozSearch ", + "keyword": "MozSearch", + "search_url": "https://example.com/?q={searchTerms}", }, }, }, @@ -75,14 +75,14 @@ add_task(async function test_upgrade_default_position_engine() { manifest: { "chrome_settings_overrides": { "search_provider": { - "name": "MozSearch", - "keyword": "MozSearch", - "search_url": "https://example.com/?q={searchTerms}", + "name": "MozSearch", + "keyword": "MozSearch", + "search_url": "https://example.com/?q={searchTerms}", }, }, "applications": { "gecko": { - "id": "testengine@mozilla.com", + "id": "testengine@mozilla.com", }, }, "version": "0.1", @@ -94,14 +94,14 @@ add_task(async function test_upgrade_default_position_engine() { manifest: { "chrome_settings_overrides": { "search_provider": { - "name": "MozSearch", - "keyword": "MozSearch", - "search_url": "https://example.com/?q={searchTerms}", + "name": "MozSearch", + "keyword": "MozSearch", + "search_url": "https://example.com/?q={searchTerms}", }, }, "applications": { "gecko": { - "id": "testengine@mozilla.com", + "id": "testengine@mozilla.com", }, }, "version": "0.2", diff --git a/browser/components/extensions/test/browser/browser_ext_tabs_captureVisibleTab.js b/browser/components/extensions/test/browser/browser_ext_tabs_captureVisibleTab.js index a55069385468b..7f340784d85c2 100644 --- a/browser/components/extensions/test/browser/browser_ext_tabs_captureVisibleTab.js +++ b/browser/components/extensions/test/browser/browser_ext_tabs_captureVisibleTab.js @@ -142,7 +142,7 @@ add_task(async function testCaptureVisibleTabPermissions() { background() { browser.test.assertEq(undefined, browser.tabs.captureVisibleTab, - 'Extension without "" permission should not have access to captureVisibleTab'); + 'Extension without "" permission should not have access to captureVisibleTab'); browser.test.notifyPass("captureVisibleTabPermissions"); }, }); diff --git a/browser/components/extensions/test/browser/browser_ext_tabs_move_array.js b/browser/components/extensions/test/browser/browser_ext_tabs_move_array.js index 3a4136a54dee4..53d6ae4de7bc5 100644 --- a/browser/components/extensions/test/browser/browser_ext_tabs_move_array.js +++ b/browser/components/extensions/test/browser/browser_ext_tabs_move_array.js @@ -28,9 +28,8 @@ add_task(async function moveMultiple() { async function reset() { let tabs = await browser.tabs.query({url: "http://example.com/*"}); await browser.tabs.move( - tabs.sort((a, b) => (num(a.url) - num(b.url))).map(tab => tab.id), - {index: 0} - ); + tabs.sort((a, b) => (num(a.url) - num(b.url))).map(tab => tab.id), + {index: 0}); } async function move(moveIndexes, moveTo) { diff --git a/browser/components/extensions/test/browser/browser_ext_tabs_onHighlighted.js b/browser/components/extensions/test/browser/browser_ext_tabs_onHighlighted.js index cf6add0b08bd8..b559996bc7629 100644 --- a/browser/components/extensions/test/browser/browser_ext_tabs_onHighlighted.js +++ b/browser/components/extensions/test/browser/browser_ext_tabs_onHighlighted.js @@ -74,7 +74,7 @@ add_task(async function testTabEvents() { */ async function openTab(windowId) { browser.test.assertEq(0, Object.keys(events).length, - "No events remaining before testing openTab."); + "No events remaining before testing openTab."); let tab = await browser.tabs.create({windowId}); @@ -95,7 +95,7 @@ add_task(async function testTabEvents() { */ async function openWindow(urls) { browser.test.assertEq(0, Object.keys(events).length, - "No events remaining before testing openWindow."); + "No events remaining before testing openWindow."); let window = await browser.windows.create({url: urls}); browser.test.log(`Opened new window ${window.id}`); @@ -105,9 +105,9 @@ add_task(async function testTabEvents() { tabIds.push(tab.id); let expectedEvents = [ - "onCreated", - "onActivated", - "onHighlighted", + "onCreated", + "onActivated", + "onHighlighted", ]; if (i !== 0) { expectedEvents.splice(1); @@ -123,7 +123,7 @@ add_task(async function testTabEvents() { */ async function highlightTab(tabId) { browser.test.assertEq(0, Object.keys(events).length, - "No events remaining before testing highlightTab."); + "No events remaining before testing highlightTab."); browser.test.log(`Highlighting tab ${tabId}`); let tab = await browser.tabs.update(tabId, {active: true}); diff --git a/browser/components/extensions/test/browser/browser_ext_tabs_update_url.js b/browser/components/extensions/test/browser/browser_ext_tabs_update_url.js index 53790a8f6c441..551df2d734086 100644 --- a/browser/components/extensions/test/browser/browser_ext_tabs_update_url.js +++ b/browser/components/extensions/test/browser/browser_ext_tabs_update_url.js @@ -154,7 +154,7 @@ add_task(async function test_update_reload() { is(history.entries.length, 1, "Tab history contains the expected number of entries."); is(history.entries[0].url, URL, - `Tab history contains the expected entry: URL.`); + `Tab history contains the expected entry: URL.`); extension.sendMessage("update", tabId, {url: `${URL}1/`}); await Promise.all([ @@ -166,7 +166,7 @@ add_task(async function test_update_reload() { is(history.entries.length, 2, "Tab history contains the expected number of entries."); is(history.entries[1].url, `${URL}1/`, - `Tab history contains the expected entry: ${URL}1/.`); + `Tab history contains the expected entry: ${URL}1/.`); extension.sendMessage("update", tabId, {url: `${URL}2/`, loadReplace: true}); await Promise.all([ @@ -178,7 +178,7 @@ add_task(async function test_update_reload() { is(history.entries.length, 2, "Tab history contains the expected number of entries."); is(history.entries[1].url, `${URL}2/`, - `Tab history contains the expected entry: ${URL}2/.`); + `Tab history contains the expected entry: ${URL}2/.`); await extension.unload(); await BrowserTestUtils.closeWindow(win); diff --git a/browser/components/extensions/test/browser/browser_ext_themes_icons.js b/browser/components/extensions/test/browser/browser_ext_themes_icons.js index b0683076ae9a4..dafd5361aaf50 100644 --- a/browser/components/extensions/test/browser/browser_ext_themes_icons.js +++ b/browser/components/extensions/test/browser/browser_ext_themes_icons.js @@ -2,16 +2,16 @@ const ENCODED_IMAGE_DATA = "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgNjQgNjQiPjxwYXRoIGQ9Im01NS45IDMyLjFsLTIyLjctMTQuOWMwIDAgMTIuOS0xNy40IDE5LjQtMTQuOSAzLjEgMS4xIDUuNCAyNS4xIDMuMyAyOS44IiBmaWxsPSIjM2U0MzQ3Ii8+PHBhdGggZD0ibTU0LjkgMzMuOWwtOS00LjFjMCAwLTUuMy0xNCA2LjEtMjQuMSAyLjQgMiA1LjEgMjUgMi45IDI4LjIiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJtOC4xIDMyLjFsMjIuNi0xNC45YzAgMC0xMi45LTE3LjQtMTkuNC0xNC45LTMgMS4xLTUuMyAyNS4xLTMuMiAyOS44IiBmaWxsPSIjM2U0MzQ3Ii8+PHBhdGggZD0ibTkuMSAzMy45bDktNC4xYzAgMCA1LjMtMTQtNi4xLTI0LjEtMi40IDItNS4xIDI1LTIuOSAyOC4yIiBmaWxsPSIjZmZmIi8+PHBhdGggZD0iTTMyLDEzQzE4LjksMTMsMiwzMy42LDIsNDUuNEMyMC41LDQ1LjQsMTkuNyw2MiwzMiw2MnMxMS41LTE2LjYsMzAtMTYuNkM2MiwzMy42LDQ1LjEsMTMsMzIsMTN6IiBmaWxsPSIjZmY4NzM2Ii8+PGcgZmlsbD0iI2ZmZiI+PHBhdGggZD0iTTMyLDU2LjJjMCw1LjEsOS42LDQuMiw5LjUtMi45YzYuNy05LjQsMTkuOS04LjcsMTkuOS04LjdDMzkuNiwzMi40LDMyLDU2LjIsMzIsNTYuMnoiLz48cGF0aCBkPSJNMzIsNTYuMmMwLDUuMS05LjYsNC4yLTkuNS0yLjlDMTUuOCw0NCwyLjYsNDQuNywyLjYsNDQuN0MyNC40LDMyLjQsMzIsNTYuMiwzMiw1Ni4yeiIvPjwvZz48ZyBmaWxsPSIjZmY4NzM2Ij48cGF0aCBkPSJtNTMuNCAxOC41Yy00IC43LTQuOSA2LjMtNC45IDYuM2w2IDUuM2MtMi4zLTUuOS0xLjEtMTEuNi0xLjEtMTEuNiIvPjxwYXRoIGQ9Im01MS4xIDEzLjVjLTQuNCAzLjktNS4xIDguNy01LjEgOC43bDYgNS4zYy0yLjQtNS44LS45LTE0LS45LTE0Ii8+PHBhdGggZD0ibTEwLjYgMTguNWM0IC43IDQuOSA2LjMgNC45IDYuM2wtNiA1LjNjMi4zLTUuOSAxLjEtMTEuNiAxLjEtMTEuNiIvPjxwYXRoIGQ9Im0xMi45IDEzLjVjNC40IDMuOSA1LjEgOC43IDUuMSA4LjdsLTYgNS4zYzIuNC01LjguOS0xNCAuOS0xNCIvPjwvZz48cGF0aCBkPSJtNTIuOCAzMS4xYy01LjctMS44LTEwLjktMy40LTEzLjguOS0yLjQgMy43LjcgOS40LjcgOS40IDExLjIgMS4yIDEzLjEtMTAuMyAxMy4xLTEwLjMiIGZpbGw9IiMzZTQzNDciLz48ZWxsaXBzZSBjeD0iNDMiIGN5PSIzNi4zIiByeD0iNC4yIiByeT0iNC4xIiBmaWxsPSIjZDVmZjgzIi8+PGcgZmlsbD0iIzNlNDM0NyI+PGVsbGlwc2UgY3g9IjQzIiBjeT0iMzYuMyIgcng9IjIuNyIgcnk9IjIuNyIvPjxwYXRoIGQ9Im0xMS4yIDMxLjFjNS43LTEuOCAxMC45LTMuNCAxMy43LjkgMi40IDMuNy0uNyA5LjQtLjcgOS40LTExLjEgMS4yLTEzLTEwLjMtMTMtMTAuMyIvPjwvZz48ZWxsaXBzZSBjeD0iMjEiIGN5PSIzNi4zIiByeD0iNC4yIiByeT0iNC4xIiBmaWxsPSIjZDVmZjgzIi8+PGcgZmlsbD0iIzNlNDM0NyI+PGVsbGlwc2UgY3g9IjIxIiBjeT0iMzYuMyIgcng9IjIuNyIgcnk9IjIuNyIvPjxwYXRoIGQ9Im00MS4yIDQ3LjljLS43LTIuMy0xLjgtNC40LTMtNi41IDEuMSAyLjEgMiA0LjMgMi41IDYuNi41IDIuMy43IDQuNyAwIDYuOC0uNCAxLTEgMi0xLjggMi42LS44LjYtMS44IDEtMi43IDEtLjkgMC0xLjktLjMtMi41LTEtLjYtLjctLjktMS42LS44LTIuNmwtLjkuMmgtLjljMCAxLS4yIDEuOS0uOCAyLjYtLjYuNy0xLjUgMS0yLjUgMS0uOSAwLTEuOS0uNC0yLjctMS0uOC0uNi0xLjQtMS42LTEuOC0yLjYtLjgtMi4xLS42LTQuNiAwLTYuOC41LTIuMyAxLjUtNC41IDIuNS02LjYtMS4yIDItMi4zIDQuMS0zIDYuNS0uNyAyLjMtMS4xIDQuOC0uNCA3LjMuMyAxLjIgMSAyLjQgMS45IDMuMy45LjkgMi4xIDEuNCAzLjQgMS41IDEuMi4xIDIuNi0uMiAzLjctMS4yLjMtLjIuNS0uNS43LS44LjIuMy40LjYuNy44IDEgMSAyLjQgMS4zIDMuNyAxLjIgMS4zLS4xIDIuNC0uNyAzLjQtMS41LjktLjkgMS42LTIgMS45LTMuMy41LTIuNi4xLTUuMi0uNi03LjUiLz48cGF0aCBkPSJtMzcuNiA1MC4zYy0xLjEtMS4xLTQuNS0xLjItNS42LTEuMi0xIDAtNC41LjEtNS42IDEuMi0uOC44LS4yIDIuOCAxLjkgNC41IDEuMyAxLjEgMi42IDEuNCAzLjYgMS40IDEgMCAyLjMtLjMgMy42LTEuNCAyLjMtMS43IDIuOS0zLjcgMi4xLTQuNSIvPjwvZz48L3N2Zz4="; - /** - * Verifies that the button uses the expected icon. - * - * @param {string} selector The CSS selector used to find the button - * within the DOM. - * @param {boolean} shouldHaveCustomStyling True if the button should - * have custom styling, False otherwise. - * @param {string} message The message that is printed to the console - * by the verifyFn. - */ +/** + * Verifies that the button uses the expected icon. + * + * @param {string} selector The CSS selector used to find the button + * within the DOM. + * @param {boolean} shouldHaveCustomStyling True if the button should + * have custom styling, False otherwise. + * @param {string} message The message that is printed to the console + * by the verifyFn. + */ function verifyButtonProperties(selector, shouldHaveCustomStyling, message) { try { let element = document.querySelector(selector); @@ -23,48 +23,50 @@ function verifyButtonProperties(selector, shouldHaveCustomStyling, message) { } } - /** - * Verifies that the button uses default styling. - * - * @param {string} selector The CSS selector used to find the button - * within the DOM. - * @param {string} message The message that is printed to the console - * by the verifyFn. - */ +/** + * Verifies that the button uses default styling. + * + * @param {string} selector The CSS selector used to find the button + * within the DOM. + * @param {string} message The message that is printed to the console + * by the verifyFn. + */ function verifyButtonWithoutCustomStyling(selector, message) { verifyButtonProperties(selector, false, message); } - /** - * Verifies that the button uses non-default styling. - * - * @param {string} selector The CSS selector used to find the button - * within the DOM. - * @param {string} message The message that is printed to the console - * by the verifyFn. - */ +/** + * Verifies that the button uses non-default styling. + * + * @param {string} selector The CSS selector used to find the button + * within the DOM. + * @param {string} message The message that is printed to the console + * by the verifyFn. + */ function verifyButtonWithCustomStyling(selector, message) { verifyButtonProperties(selector, true, message); } - /** - * Loops through all of the buttons to confirm that they are styled - * as expected (either with or without custom styling). - * - * @param {object} icons Array of an array that specifies which buttons should - * have custom icons. - * @param {object} iconInfo An array of arrays that maps API names to - * CSS selectors. - * @param {string} area The name of the area that the button resides in. - */ +/** + * Loops through all of the buttons to confirm that they are styled + * as expected (either with or without custom styling). + * + * @param {object} icons Array of an array that specifies which buttons should + * have custom icons. + * @param {object} iconInfo An array of arrays that maps API names to + * CSS selectors. + * @param {string} area The name of the area that the button resides in. + */ function checkButtons(icons, iconInfo, area) { for (let button of iconInfo) { let iconInfo = icons.find(arr => arr[0] == button[0]); if (iconInfo[1]) { - verifyButtonWithCustomStyling(button[1], + verifyButtonWithCustomStyling( + button[1], `The ${button[1]} should have its icon customized in the ${area}`); } else { - verifyButtonWithoutCustomStyling(button[1], + verifyButtonWithoutCustomStyling( + button[1], `The ${button[1]} should not have its icon customized in the ${area}`); } } @@ -135,7 +137,8 @@ async function runTestWithIcons(icons) { CustomizableUI.addWidgetToArea(button[2], CustomizableUI.AREA_NAVBAR); } - verifyButtonWithoutCustomStyling(button[1], + verifyButtonWithoutCustomStyling( + button[1], `The ${button[1]} should not have its icon customized when the test starts`); let iconInfo = icons.find(arr => arr[0] == button[0]); @@ -151,7 +154,8 @@ async function runTestWithIcons(icons) { await extension.unload(); for (let button of ICON_INFO) { - verifyButtonWithoutCustomStyling(button[1], + verifyButtonWithoutCustomStyling( + button[1], `The ${button[1]} should not have its icon customized when the theme is unloaded`); } } diff --git a/browser/components/extensions/test/browser/browser_ext_windows.js b/browser/components/extensions/test/browser/browser_ext_windows.js index 7440440a29f70..7438290d4a978 100644 --- a/browser/components/extensions/test/browser/browser_ext_windows.js +++ b/browser/components/extensions/test/browser/browser_ext_windows.js @@ -70,14 +70,14 @@ add_task(async function testWindowTitle() { if (msg === "update") { let win = await browser.windows.get(windowId); browser.test.assertTrue(win.title.startsWith(expected.before.preface), - "Window has the expected title preface before update."); + "Window has the expected title preface before update."); browser.test.assertTrue(win.title.includes(expected.before.text), - "Window has the expected title text before update."); + "Window has the expected title text before update."); win = await browser.windows.update(windowId, options); browser.test.assertTrue(win.title.startsWith(expected.after.preface), - "Window has the expected title preface after update."); + "Window has the expected title preface after update."); browser.test.assertTrue(win.title.includes(expected.after.text), - "Window has the expected title text after update."); + "Window has the expected title text after update."); browser.test.sendMessage("updated", win); } }); diff --git a/browser/components/extensions/test/browser/head.js b/browser/components/extensions/test/browser/head.js index cd71bcd06857a..739c6089819d2 100644 --- a/browser/components/extensions/test/browser/head.js +++ b/browser/components/extensions/test/browser/head.js @@ -144,12 +144,15 @@ function promisePossiblyInaccurateContentDimensions(browser) { } return { - window: copyProps(content, + window: copyProps( + content, ["innerWidth", "innerHeight", "outerWidth", "outerHeight", "scrollX", "scrollY", "scrollMaxX", "scrollMaxY"]), - body: copyProps(content.document.body, + body: copyProps( + content.document.body, ["clientWidth", "clientHeight", "scrollWidth", "scrollHeight"]), - root: copyProps(content.document.documentElement, + root: copyProps( + content.document.documentElement, ["clientWidth", "clientHeight", "scrollWidth", "scrollHeight"]), isStandards: content.document.compatMode !== "BackCompat", }; diff --git a/browser/components/extensions/test/xpcshell/test_ext_bookmarks.js b/browser/components/extensions/test/xpcshell/test_ext_bookmarks.js index f767d7dee10fc..cab469303c70f 100644 --- a/browser/components/extensions/test/xpcshell/test_ext_bookmarks.js +++ b/browser/components/extensions/test/xpcshell/test_ext_bookmarks.js @@ -194,10 +194,9 @@ add_task(async function test_bookmarks() { browser.test.assertEq(1, results.length, "getTree returns one result"); let bookmark = results[0].children.find(bookmarkItem => bookmarkItem.id == unsortedId); browser.test.assertEq( - "Other Bookmarks", - bookmark.title, - "Folder returned from getTree has the expected title" - ); + "Other Bookmarks", + bookmark.title, + "Folder returned from getTree has the expected title"); browser.test.assertEq("folder", bookmark.type, "Folder returned from getTree has the expected type"); @@ -207,9 +206,8 @@ add_task(async function test_bookmarks() { "Expected error thrown when trying to create a bookmark with an invalid parentId" ); browser.test.assertTrue( - error.message.includes(`"parentGuid":"invalid"`), - "Expected error thrown when trying to create a bookmark with an invalid parentId" - ); + error.message.includes(`"parentGuid":"invalid"`), + "Expected error thrown when trying to create a bookmark with an invalid parentId"); }); }).then(() => { return browser.bookmarks.remove(ourId); @@ -695,19 +693,19 @@ add_task(async function test_tree_with_empty_folder() { await browser.bookmarks.create({title: "A bookmark", url: "http://example.com", parentId: nonEmptyFolder.id}); let tree = await browser.bookmarks.getSubTree(nonEmptyFolder.parentId); - browser.test.assertEq(0, - tree[0].children[0].children.length, + browser.test.assertEq( + 0, tree[0].children[0].children.length, "The empty folder returns an empty array for children."); - browser.test.assertEq(1, - tree[0].children[1].children.length, + browser.test.assertEq( + 1, tree[0].children[1].children.length, "The non-empty folder returns a single item array for children."); let children = await browser.bookmarks.getChildren(nonEmptyFolder.parentId); // getChildren should only return immediate children. This is not tested in the // monster test above. for (let child of children) { - browser.test.assertEq(undefined, - child.children, + browser.test.assertEq( + undefined, child.children, "Child from getChildren does not contain any children."); } diff --git a/browser/components/extensions/test/xpcshell/test_ext_browsingData_settings.js b/browser/components/extensions/test/xpcshell/test_ext_browsingData_settings.js index 5b623c8186d91..4a6337bfb3022 100644 --- a/browser/components/extensions/test/xpcshell/test_ext_browsingData_settings.js +++ b/browser/components/extensions/test/xpcshell/test_ext_browsingData_settings.js @@ -32,15 +32,18 @@ add_task(async function testSettingsProperties() { let settings = await extension.awaitMessage("settings"); // Verify that we get the keys back we expect. - deepEqual(Object.keys(settings.dataToRemove).sort(), SETTINGS_LIST, - "dataToRemove contains expected properties."); - deepEqual(Object.keys(settings.dataRemovalPermitted).sort(), SETTINGS_LIST, - "dataToRemove contains expected properties."); + deepEqual(Object.keys(settings.dataToRemove).sort(), + SETTINGS_LIST, + "dataToRemove contains expected properties."); + deepEqual(Object.keys(settings.dataRemovalPermitted).sort(), + SETTINGS_LIST, + "dataToRemove contains expected properties."); let dataTypeSet = settings.dataToRemove; for (let key of Object.keys(dataTypeSet)) { - equal(Preferences.get(`${PREF_DOMAIN}${key.toLowerCase()}`), dataTypeSet[key], - `${key} property of dataToRemove matches the expected pref.`); + equal(Preferences.get(`${PREF_DOMAIN}${key.toLowerCase()}`), + dataTypeSet[key], + `${key} property of dataToRemove matches the expected pref.`); } dataTypeSet = settings.dataRemovalPermitted; diff --git a/browser/components/extensions/test/xpcshell/test_ext_chrome_settings_overrides_update.js b/browser/components/extensions/test/xpcshell/test_ext_chrome_settings_overrides_update.js index 178d56c888bfa..8125334c875f6 100644 --- a/browser/components/extensions/test/xpcshell/test_ext_chrome_settings_overrides_update.js +++ b/browser/components/extensions/test/xpcshell/test_ext_chrome_settings_overrides_update.js @@ -73,9 +73,10 @@ add_task(async function test_overrides_update_removal() { equal(extension.version, "1.0", "The installed addon has the expected version."); ok(getHomePageURL().endsWith(HOMEPAGE_URI), - "Home page url is overriden by the extension."); - equal(Services.search.currentEngine.name, "DuckDuckGo", - "Default engine is overriden by the extension"); + "Home page url is overriden by the extension."); + equal(Services.search.currentEngine.name, + "DuckDuckGo", + "Default engine is overriden by the extension"); extensionInfo.manifest = { "version": "2.0", @@ -91,10 +92,12 @@ add_task(async function test_overrides_update_removal() { await prefPromise; equal(extension.version, "2.0", "The updated addon has the expected version."); - equal(getHomePageURL(), defaultHomepageURL, - "Home page url reverted to the default after update."); - equal(Services.search.currentEngine.name, defaultEngineName, - "Default engine reverted to the default after update."); + equal(getHomePageURL(), + defaultHomepageURL, + "Home page url reverted to the default after update."); + equal(Services.search.currentEngine.name, + defaultEngineName, + "Default engine reverted to the default after update."); await extension.unload(); diff --git a/browser/components/extensions/test/xpcshell/test_ext_geckoProfiler_schema.js b/browser/components/extensions/test/xpcshell/test_ext_geckoProfiler_schema.js index 44aab0e4163c5..e218a137a892e 100644 --- a/browser/components/extensions/test/xpcshell/test_ext_geckoProfiler_schema.js +++ b/browser/components/extensions/test/xpcshell/test_ext_geckoProfiler_schema.js @@ -6,7 +6,8 @@ add_task(async function() { let extension = ExtensionTestUtils.loadExtension({ background: () => { - browser.test.sendMessage("features", + browser.test.sendMessage( + "features", Object.values(browser.geckoProfiler.ProfilerFeature)); }, manifest: { @@ -27,16 +28,16 @@ add_task(async function() { const allFeaturesAcceptedByProfiler = Services.profiler.GetAllFeatures([]); ok(allFeaturesAcceptedByProfiler.length >= 2, - "Either we've massively reduced the profiler's feature set, or something is wrong."); + "Either we've massively reduced the profiler's feature set, or something is wrong."); // Check that the list of available values in the ProfilerFeature enum // matches the list of features supported by the profiler. for (const feature of allFeaturesAcceptedByProfiler) { ok(acceptedFeatures.includes(feature), - `The schema of the geckoProfiler.start() method should accept the "${feature}" feature.`); + `The schema of the geckoProfiler.start() method should accept the "${feature}" feature.`); } for (const feature of acceptedFeatures) { ok(allFeaturesAcceptedByProfiler.includes(feature), - `The schema of the geckoProfiler.start() method mentions a "${feature}" feature which is not supported by the profiler.`); + `The schema of the geckoProfiler.start() method mentions a "${feature}" feature which is not supported by the profiler.`); } }); diff --git a/browser/components/extensions/test/xpcshell/test_ext_history.js b/browser/components/extensions/test/xpcshell/test_ext_history.js index 5bcc93263fd06..55f0dc7375e43 100644 --- a/browser/components/extensions/test/xpcshell/test_ext_history.js +++ b/browser/components/extensions/test/xpcshell/test_ext_history.js @@ -309,8 +309,8 @@ add_task(async function test_add_url() { equal(results.result.title, results.details.title, "URL was added with the correct title"); if (results.details.visitTime) { equal(results.result.lastVisitTime, - Number(ExtensionUtils.normalizeTime(results.details.visitTime)), - "URL was added with the correct date"); + Number(ExtensionUtils.normalizeTime(results.details.visitTime)), + "URL was added with the correct date"); } } diff --git a/browser/components/extensions/test/xpcshell/test_ext_url_overrides_newtab.js b/browser/components/extensions/test/xpcshell/test_ext_url_overrides_newtab.js index 88434deac5770..c6c65199f53c5 100644 --- a/browser/components/extensions/test/xpcshell/test_ext_url_overrides_newtab.js +++ b/browser/components/extensions/test/xpcshell/test_ext_url_overrides_newtab.js @@ -99,13 +99,13 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() { let ext3 = ExtensionTestUtils.loadExtension(extObj); equal(aboutNewTabService.newTabURL, DEFAULT_NEW_TAB_URL, - "newTabURL is set to the default."); + "newTabURL is set to the default."); await promiseStartupManager(); await ext1.startup(); equal(aboutNewTabService.newTabURL, DEFAULT_NEW_TAB_URL, - "newTabURL is still set to the default."); + "newTabURL is still set to the default."); await checkNewTabPageOverride(ext1, aboutNewTabService.newTabURL, NOT_CONTROLLABLE); @@ -147,7 +147,7 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() { await ext3.startup(); ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI_3), - "newTabURL is overriden by the third extension."); + "newTabURL is overriden by the third extension."); await checkNewTabPageOverride(ext2, NEWTAB_URI_3, CONTROLLED_BY_OTHER); // Disable the second extension. @@ -155,7 +155,7 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() { addon.userDisabled = true; await disabledPromise; ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI_3), - "newTabURL is still overriden by the third extension."); + "newTabURL is still overriden by the third extension."); await checkNewTabPageOverride(ext3, NEWTAB_URI_3, CONTROLLED_BY_THIS); // Re-enable the second extension. @@ -163,7 +163,7 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() { addon.userDisabled = false; await enabledPromise; ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI_3), - "newTabURL is still overriden by the third extension."); + "newTabURL is still overriden by the third extension."); await checkNewTabPageOverride(ext3, NEWTAB_URI_3, CONTROLLED_BY_THIS); await ext3.unload(); @@ -173,7 +173,7 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() { await ext2.unload(); equal(aboutNewTabService.newTabURL, DEFAULT_NEW_TAB_URL, - "newTabURL url is reset to the default."); + "newTabURL url is reset to the default."); await promiseShutdownManager(); }); diff --git a/browser/components/sessionstore/SessionStore.jsm b/browser/components/sessionstore/SessionStore.jsm index f97cb9fcb1319..660ca61a7f48f 100644 --- a/browser/components/sessionstore/SessionStore.jsm +++ b/browser/components/sessionstore/SessionStore.jsm @@ -29,6 +29,7 @@ const NOTIFY_INITIATING_MANUAL_RESTORE = "sessionstore-initiating-manual-restore const NOTIFY_CLOSED_OBJECTS_CHANGED = "sessionstore-closed-objects-changed"; const NOTIFY_TAB_RESTORED = "sessionstore-debug-tab-restored"; // WARNING: debug-only +const NOTIFY_DOMWINDOWCLOSED_HANDLED = "sessionstore-debug-domwindowclosed-handled"; // WARNING: debug-only // Maximum number of tabs to restore simultaneously. Previously controlled by // the browser.sessionstore.max_concurrent_tabs pref. @@ -772,6 +773,9 @@ var SessionStoreInternal = { this.onClose(aSubject).then(() => { this._notifyOfClosedObjectsChange(); }); + if (gDebuggingEnabled) { + Services.obs.notifyObservers(null, NOTIFY_DOMWINDOWCLOSED_HANDLED); + } break; case "quit-application-granted": let syncShutdown = aData == "syncShutdown"; diff --git a/browser/components/sessionstore/test/browser_async_window_flushing.js b/browser/components/sessionstore/test/browser_async_window_flushing.js index 7da7bb5027ee2..c0f69308fb48e 100644 --- a/browser/components/sessionstore/test/browser_async_window_flushing.js +++ b/browser/components/sessionstore/test/browser_async_window_flushing.js @@ -42,28 +42,30 @@ add_task(async function test_add_interesting_window() { // it's really not worth restoring. browser.userTypedValue = null; - // Once the domWindowClosed Promise resolves, the window should - // have closed, and SessionStore's onClose handler should have just - // run. - let domWindowClosed = BrowserTestUtils.domWindowClosed(newWin); - // Once this windowClosed Promise resolves, we should have finished // the flush and revisited our decision to put this window into // the closed windows array. let windowClosed = BrowserTestUtils.windowClosed(newWin); + let handled = false; + whenDomWindowClosedHandled(() => { + // SessionStore's onClose handler should have just run. + let currentClosedWindows = ss.getClosedWindowCount(); + is(currentClosedWindows, initialClosedWindows, + "We should not have added the window to the closed windows array"); + + handled = true; + }); + // Ok, let's close the window. newWin.close(); - await domWindowClosed; - // OnClose has just finished running. - let currentClosedWindows = ss.getClosedWindowCount(); - is(currentClosedWindows, initialClosedWindows, - "We should not have added the window to the closed windows array"); - await windowClosed; + + ok(handled, "domwindowclosed should already be handled here"); + // The window flush has finished - currentClosedWindows = ss.getClosedWindowCount(); + let currentClosedWindows = ss.getClosedWindowCount(); is(currentClosedWindows, initialClosedWindows + 1, "We should have added the window to the closed windows array"); @@ -110,28 +112,30 @@ add_task(async function test_remove_uninteresting_window() { sessionHistory.PurgeHistory(sessionHistory.count); }); - // Once the domWindowClosed Promise resolves, the window should - // have closed, and SessionStore's onClose handler should have just - // run. - let domWindowClosed = BrowserTestUtils.domWindowClosed(newWin); - // Once this windowClosed Promise resolves, we should have finished // the flush and revisited our decision to put this window into // the closed windows array. let windowClosed = BrowserTestUtils.windowClosed(newWin); + let handled = false; + whenDomWindowClosedHandled(() => { + // SessionStore's onClose handler should have just run. + let currentClosedWindows = ss.getClosedWindowCount(); + is(currentClosedWindows, initialClosedWindows + 1, + "We should have added the window to the closed windows array"); + + handled = true; + }); + // Ok, let's close the window. newWin.close(); - await domWindowClosed; - // OnClose has just finished running. - let currentClosedWindows = ss.getClosedWindowCount(); - is(currentClosedWindows, initialClosedWindows + 1, - "We should have added the window to the closed windows array"); - await windowClosed; + + ok(handled, "domwindowclosed should already be handled here"); + // The window flush has finished - currentClosedWindows = ss.getClosedWindowCount(); + let currentClosedWindows = ss.getClosedWindowCount(); is(currentClosedWindows, initialClosedWindows, "We should have removed the window from the closed windows array"); diff --git a/browser/components/sessionstore/test/browser_forget_async_closings.js b/browser/components/sessionstore/test/browser_forget_async_closings.js index f7b9d77e1436d..a24e3644263e5 100644 --- a/browser/components/sessionstore/test/browser_forget_async_closings.js +++ b/browser/components/sessionstore/test/browser_forget_async_closings.js @@ -84,21 +84,26 @@ let forgetWinHelper = async function(forgetFn) { // Now close the window and immediately choose to forget it. let windowClosed = BrowserTestUtils.windowClosed(newWin); - let domWindowClosed = BrowserTestUtils.domWindowClosed(newWin); - newWin.close(); - await domWindowClosed; + let handled = false; + whenDomWindowClosedHandled(() => { + // At this point, the window will have closed and the onClose handler + // has run, but the final update to SessionStore hasn't come up yet. + // Now do the oepration that should cause us to forget the window. + forgetFn(); - // At this point, the window will have closed and the onClose handler - // has run, but the final update to SessionStore hasn't come up yet. - // Now do the oepration that should cause us to forget the window. - forgetFn(); + is(ss.getClosedWindowCount(), 0, "Should have forgotten the closed window"); + + handled = true; + }); - is(ss.getClosedWindowCount(), 0, "Should have forgotten the closed window"); + newWin.close(); // Now wait for the final update to come up. await windowClosed; + ok(handled, "domwindowclosed should already be handled here"); + is(ss.getClosedWindowCount(), 0, "Should not have stored the closed window"); }; diff --git a/browser/components/sessionstore/test/head.js b/browser/components/sessionstore/test/head.js index 2607debfefcc1..7ffa10fff7060 100644 --- a/browser/components/sessionstore/test/head.js +++ b/browser/components/sessionstore/test/head.js @@ -564,3 +564,10 @@ async function checkScroll(tab, expected, msg) { let scroll = JSON.parse(ss.getTabState(tab)).scroll || null; is(JSON.stringify(scroll), JSON.stringify(expected), msg); } + +function whenDomWindowClosedHandled(aCallback) { + Services.obs.addObserver(function observer(aSubject, aTopic) { + Services.obs.removeObserver(observer, aTopic); + aCallback(); + }, "sessionstore-debug-domwindowclosed-handled"); +} diff --git a/browser/extensions/pdfjs/README.mozilla b/browser/extensions/pdfjs/README.mozilla index 23a52205e054c..0d71e5dc68528 100644 --- a/browser/extensions/pdfjs/README.mozilla +++ b/browser/extensions/pdfjs/README.mozilla @@ -1,5 +1,5 @@ This is the PDF.js project output, https://github.com/mozilla/pdf.js -Current extension version is: 2.0.185 +Current extension version is: 2.0.197 -Taken from upstream commit: f2994736 +Taken from upstream commit: 371ca514 diff --git a/browser/extensions/pdfjs/content/PdfJs.jsm b/browser/extensions/pdfjs/content/PdfJs.jsm index 3565a7e0421a5..4778ca87e3529 100644 --- a/browser/extensions/pdfjs/content/PdfJs.jsm +++ b/browser/extensions/pdfjs/content/PdfJs.jsm @@ -79,6 +79,7 @@ function isDefaultHandler() { } function initializeDefaultPreferences() { + /* eslint-disable semi */ var DEFAULT_PREFERENCES = { "showPreviousViewOnLoad": true, @@ -101,8 +102,9 @@ function initializeDefaultPreferences() { "enablePrintAutoRotate": false, "disablePageMode": false, "disablePageLabels": false -}; +} + /* eslint-enable semi */ var defaultBranch = Services.prefs.getDefaultBranch(PREF_PREFIX + "."); var defaultValue; diff --git a/browser/extensions/pdfjs/content/PdfjsChromeUtils.jsm b/browser/extensions/pdfjs/content/PdfjsChromeUtils.jsm index 7688d782db782..43b3e61de483b 100644 --- a/browser/extensions/pdfjs/content/PdfjsChromeUtils.jsm +++ b/browser/extensions/pdfjs/content/PdfjsChromeUtils.jsm @@ -33,6 +33,7 @@ XPCOMUtils.defineLazyServiceGetter(Svc, "mime", "@mozilla.org/mime;1", "nsIMIMEService"); +/* eslint-disable semi */ var DEFAULT_PREFERENCES = { "showPreviousViewOnLoad": true, @@ -55,8 +56,9 @@ var DEFAULT_PREFERENCES = "enablePrintAutoRotate": false, "disablePageMode": false, "disablePageLabels": false -}; +} +/* eslint-enable semi */ var PdfjsChromeUtils = { // For security purposes when running remote, we restrict preferences diff --git a/browser/extensions/pdfjs/content/build/pdf.js b/browser/extensions/pdfjs/content/build/pdf.js index 899b2d60594bd..f39bc215e3b9f 100644 --- a/browser/extensions/pdfjs/content/build/pdf.js +++ b/browser/extensions/pdfjs/content/build/pdf.js @@ -98,7 +98,7 @@ return /******/ (function(modules) { // webpackBootstrap Object.defineProperty(exports, "__esModule", { value: true }); -exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.loadJpegStream = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isNodeJS = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.StatTimer = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VERBOSITY_LEVELS = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined; +exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.loadJpegStream = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isNodeJS = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VERBOSITY_LEVELS = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined; __w_pdfjs_require__(9); @@ -904,63 +904,6 @@ function createPromiseCapability() { }); return capability; } -var StatTimer = function StatTimerClosure() { - function rpad(str, pad, length) { - while (str.length < length) { - str += pad; - } - return str; - } - function StatTimer() { - this.started = Object.create(null); - this.times = []; - this.enabled = true; - } - StatTimer.prototype = { - time: function StatTimer_time(name) { - if (!this.enabled) { - return; - } - if (name in this.started) { - warn('Timer is already running for ' + name); - } - this.started[name] = Date.now(); - }, - timeEnd: function StatTimer_timeEnd(name) { - if (!this.enabled) { - return; - } - if (!(name in this.started)) { - warn('Timer has not been started for ' + name); - } - this.times.push({ - 'name': name, - 'start': this.started[name], - 'end': Date.now() - }); - delete this.started[name]; - }, - toString: function StatTimer_toString() { - var i, ii; - var times = this.times; - var out = ''; - var longest = 0; - for (i = 0, ii = times.length; i < ii; ++i) { - var name = times[i]['name']; - if (name.length > longest) { - longest = name.length; - } - } - for (i = 0, ii = times.length; i < ii; ++i) { - var span = times[i]; - var duration = span.end - span.start; - out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n'; - } - return out; - } - }; - return StatTimer; -}(); var createBlob = function createBlob(data, contentType) { if (typeof Blob !== 'undefined') { return new Blob([data], { type: contentType }); @@ -1399,7 +1342,6 @@ exports.NotImplementedException = NotImplementedException; exports.PageViewport = PageViewport; exports.PasswordException = PasswordException; exports.PasswordResponses = PasswordResponses; -exports.StatTimer = StatTimer; exports.StreamType = StreamType; exports.TextRenderingMode = TextRenderingMode; exports.UnexpectedResponseException = UnexpectedResponseException; @@ -1456,7 +1398,7 @@ exports.unreachable = unreachable; Object.defineProperty(exports, "__esModule", { value: true }); -exports.SimpleXMLParser = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.getDefaultSetting = exports.LinkTarget = exports.getFilenameFromUrl = exports.isExternalLinkTargetSet = exports.addLinkAttributes = exports.RenderingCancelledException = exports.CustomStyle = undefined; +exports.DummyStatTimer = exports.StatTimer = exports.SimpleXMLParser = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.getDefaultSetting = exports.LinkTarget = exports.getFilenameFromUrl = exports.isExternalLinkTargetSet = exports.addLinkAttributes = exports.RenderingCancelledException = exports.CustomStyle = undefined; var _util = __w_pdfjs_require__(0); @@ -1805,6 +1747,67 @@ function isExternalLinkTargetSet() { return true; } } +class StatTimer { + constructor(enable = true) { + this.enabled = !!enable; + this.reset(); + } + reset() { + this.started = Object.create(null); + this.times = []; + } + time(name) { + if (!this.enabled) { + return; + } + if (name in this.started) { + (0, _util.warn)('Timer is already running for ' + name); + } + this.started[name] = Date.now(); + } + timeEnd(name) { + if (!this.enabled) { + return; + } + if (!(name in this.started)) { + (0, _util.warn)('Timer has not been started for ' + name); + } + this.times.push({ + 'name': name, + 'start': this.started[name], + 'end': Date.now() + }); + delete this.started[name]; + } + toString() { + let times = this.times; + let out = '', + longest = 0; + for (let i = 0, ii = times.length; i < ii; ++i) { + let name = times[i]['name']; + if (name.length > longest) { + longest = name.length; + } + } + for (let i = 0, ii = times.length; i < ii; ++i) { + let span = times[i]; + let duration = span.end - span.start; + out += `${span['name'].padEnd(longest)} ${duration}ms\n`; + } + return out; + } +} +class DummyStatTimer { + constructor() { + throw new Error('Cannot initialize DummyStatTimer.'); + } + static reset() {} + static time(name) {} + static timeEnd(name) {} + static toString() { + return ''; + } +} exports.CustomStyle = CustomStyle; exports.RenderingCancelledException = RenderingCancelledException; exports.addLinkAttributes = addLinkAttributes; @@ -1817,6 +1820,8 @@ exports.DOMCanvasFactory = DOMCanvasFactory; exports.DOMCMapReaderFactory = DOMCMapReaderFactory; exports.DOMSVGFactory = DOMSVGFactory; exports.SimpleXMLParser = SimpleXMLParser; +exports.StatTimer = StatTimer; +exports.DummyStatTimer = DummyStatTimer; /***/ }), /* 2 */ @@ -1960,7 +1965,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { if (worker.destroyed) { return Promise.reject(new Error('Worker was destroyed')); } - let apiVersion = '2.0.185'; + let apiVersion = '2.0.197'; source.disableRange = (0, _dom_utils.getDefaultSetting)('disableRange'); source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch'); source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream'); @@ -2144,8 +2149,7 @@ var PDFPageProxy = function PDFPageProxyClosure() { this.pageIndex = pageIndex; this.pageInfo = pageInfo; this.transport = transport; - this.stats = new _util.StatTimer(); - this.stats.enabled = (0, _dom_utils.getDefaultSetting)('enableStats'); + this._stats = (0, _dom_utils.getDefaultSetting)('enableStats') ? new _dom_utils.StatTimer() : _dom_utils.DummyStatTimer; this.commonObjs = transport.commonObjs; this.objs = new PDFObjects(); this.cleanupAfterRender = false; @@ -2184,7 +2188,7 @@ var PDFPageProxy = function PDFPageProxyClosure() { return this.annotationsPromise; }, render: function PDFPageProxy_render(params) { - var stats = this.stats; + let stats = this._stats; stats.time('Overall'); this.pendingCleanup = false; var renderingIntent = params.intent === 'print' ? 'print' : 'display'; @@ -2202,7 +2206,7 @@ var PDFPageProxy = function PDFPageProxyClosure() { argsArray: [], lastChunk: false }; - this.stats.time('Page Request'); + stats.time('Page Request'); this.transport.messageHandler.send('RenderPageRequest', { pageIndex: this.pageNumber - 1, intent: renderingIntent, @@ -2335,11 +2339,11 @@ var PDFPageProxy = function PDFPageProxyClosure() { this.pendingCleanup = false; return Promise.all(waitOn); }, - cleanup: function PDFPageProxy_cleanup() { + cleanup(resetStats = false) { this.pendingCleanup = true; - this._tryCleanup(); + this._tryCleanup(resetStats); }, - _tryCleanup: function PDFPageProxy_tryCleanup() { + _tryCleanup(resetStats = false) { if (!this.pendingCleanup || Object.keys(this.intentStates).some(function (intent) { var intentState = this.intentStates[intent]; return intentState.renderTasks.length !== 0 || intentState.receivingOperatorList; @@ -2351,6 +2355,9 @@ var PDFPageProxy = function PDFPageProxyClosure() { }, this); this.objs.clear(); this.annotationsPromise = null; + if (resetStats) { + this._stats.reset(); + } this.pendingCleanup = false; }, _startRenderPage: function PDFPageProxy_startRenderPage(transparency, intent) { @@ -2374,6 +2381,9 @@ var PDFPageProxy = function PDFPageProxyClosure() { intentState.receivingOperatorList = false; this._tryCleanup(); } + }, + get stats() { + return this._stats instanceof _dom_utils.StatTimer ? this._stats : null; } }; return PDFPageProxy; @@ -2804,7 +2814,7 @@ var WorkerTransport = function WorkerTransportClosure() { return; } var page = this.pageCache[data.pageIndex]; - page.stats.timeEnd('Page Request'); + page._stats.timeEnd('Page Request'); page._startRenderPage(data.transparency, data.intent); }, this); messageHandler.on('RenderPageChunk', function transportRender(data) { @@ -3253,8 +3263,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() { }(); var version, build; { - exports.version = version = '2.0.185'; - exports.build = build = 'f2994736'; + exports.version = version = '2.0.197'; + exports.build = build = '371ca514'; } exports.getDocument = getDocument; exports.LoopbackPort = LoopbackPort; @@ -4627,8 +4637,8 @@ exports.SVGGraphics = SVGGraphics; "use strict"; -var pdfjsVersion = '2.0.185'; -var pdfjsBuild = 'f2994736'; +var pdfjsVersion = '2.0.197'; +var pdfjsBuild = '371ca514'; var pdfjsSharedUtil = __w_pdfjs_require__(0); var pdfjsDisplayGlobal = __w_pdfjs_require__(12); var pdfjsDisplayAPI = __w_pdfjs_require__(3); @@ -4664,7 +4674,6 @@ exports.createBlob = pdfjsSharedUtil.createBlob; exports.RenderingCancelledException = pdfjsDisplayDOMUtils.RenderingCancelledException; exports.getFilenameFromUrl = pdfjsDisplayDOMUtils.getFilenameFromUrl; exports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes; -exports.StatTimer = pdfjsSharedUtil.StatTimer; /***/ }), /* 9 */ @@ -7752,8 +7761,8 @@ if (!_global_scope2.default.PDFJS) { } var PDFJS = _global_scope2.default.PDFJS; { - PDFJS.version = '2.0.185'; - PDFJS.build = 'f2994736'; + PDFJS.version = '2.0.197'; + PDFJS.build = '371ca514'; } PDFJS.pdfBug = false; if (PDFJS.verbosity !== undefined) { diff --git a/browser/extensions/pdfjs/content/build/pdf.worker.js b/browser/extensions/pdfjs/content/build/pdf.worker.js index d63c0d0fe287b..9a58eedd55255 100644 --- a/browser/extensions/pdfjs/content/build/pdf.worker.js +++ b/browser/extensions/pdfjs/content/build/pdf.worker.js @@ -98,7 +98,7 @@ return /******/ (function(modules) { // webpackBootstrap Object.defineProperty(exports, "__esModule", { value: true }); -exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.loadJpegStream = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isNodeJS = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.StatTimer = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VERBOSITY_LEVELS = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined; +exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.loadJpegStream = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isNodeJS = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VERBOSITY_LEVELS = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined; __w_pdfjs_require__(20); @@ -904,63 +904,6 @@ function createPromiseCapability() { }); return capability; } -var StatTimer = function StatTimerClosure() { - function rpad(str, pad, length) { - while (str.length < length) { - str += pad; - } - return str; - } - function StatTimer() { - this.started = Object.create(null); - this.times = []; - this.enabled = true; - } - StatTimer.prototype = { - time: function StatTimer_time(name) { - if (!this.enabled) { - return; - } - if (name in this.started) { - warn('Timer is already running for ' + name); - } - this.started[name] = Date.now(); - }, - timeEnd: function StatTimer_timeEnd(name) { - if (!this.enabled) { - return; - } - if (!(name in this.started)) { - warn('Timer has not been started for ' + name); - } - this.times.push({ - 'name': name, - 'start': this.started[name], - 'end': Date.now() - }); - delete this.started[name]; - }, - toString: function StatTimer_toString() { - var i, ii; - var times = this.times; - var out = ''; - var longest = 0; - for (i = 0, ii = times.length; i < ii; ++i) { - var name = times[i]['name']; - if (name.length > longest) { - longest = name.length; - } - } - for (i = 0, ii = times.length; i < ii; ++i) { - var span = times[i]; - var duration = span.end - span.start; - out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n'; - } - return out; - } - }; - return StatTimer; -}(); var createBlob = function createBlob(data, contentType) { if (typeof Blob !== 'undefined') { return new Blob([data], { type: contentType }); @@ -1399,7 +1342,6 @@ exports.NotImplementedException = NotImplementedException; exports.PageViewport = PageViewport; exports.PasswordException = PasswordException; exports.PasswordResponses = PasswordResponses; -exports.StatTimer = StatTimer; exports.StreamType = StreamType; exports.TextRenderingMode = TextRenderingMode; exports.UnexpectedResponseException = UnexpectedResponseException; @@ -17047,7 +16989,7 @@ exports.CFFCompiler = CFFCompiler; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getSupplementalGlyphMapForArialBlack = exports.getGlyphMapForStandardFonts = exports.getSymbolsFonts = exports.getSerifFonts = exports.getNonStdFontMap = exports.getStdFontMap = undefined; +exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getGlyphMapForStandardFonts = exports.getSymbolsFonts = exports.getSerifFonts = exports.getNonStdFontMap = exports.getStdFontMap = undefined; var _util = __w_pdfjs_require__(0); @@ -17110,6 +17052,10 @@ var getStdFontMap = (0, _util.getLookupTableFactory)(function (t) { t['TimesNewRomanPSMT-Italic'] = 'Times-Italic'; }); var getNonStdFontMap = (0, _util.getLookupTableFactory)(function (t) { + t['Calibri'] = 'Helvetica'; + t['Calibri-Bold'] = 'Helvetica-Bold'; + t['Calibri-BoldItalic'] = 'Helvetica-BoldOblique'; + t['Calibri-Italic'] = 'Helvetica-Oblique'; t['CenturyGothic'] = 'Helvetica'; t['CenturyGothic-Bold'] = 'Helvetica-Bold'; t['CenturyGothic-BoldItalic'] = 'Helvetica-BoldOblique'; @@ -17681,12 +17627,99 @@ var getSupplementalGlyphMapForArialBlack = (0, _util.getLookupTableFactory)(func t[264] = 261; t[291] = 346; }); +let getSupplementalGlyphMapForCalibri = (0, _util.getLookupTableFactory)(function (t) { + t[1] = 32; + t[4] = 65; + t[17] = 66; + t[18] = 67; + t[24] = 68; + t[28] = 69; + t[38] = 70; + t[39] = 71; + t[44] = 72; + t[47] = 73; + t[58] = 74; + t[60] = 75; + t[62] = 76; + t[68] = 77; + t[69] = 78; + t[75] = 79; + t[87] = 80; + t[89] = 81; + t[90] = 82; + t[94] = 83; + t[100] = 84; + t[104] = 85; + t[115] = 86; + t[116] = 87; + t[121] = 88; + t[122] = 89; + t[127] = 90; + t[258] = 97; + t[268] = 261; + t[271] = 98; + t[272] = 99; + t[273] = 263; + t[282] = 100; + t[286] = 101; + t[295] = 281; + t[296] = 102; + t[336] = 103; + t[346] = 104; + t[349] = 105; + t[361] = 106; + t[364] = 107; + t[367] = 108; + t[371] = 322; + t[373] = 109; + t[374] = 110; + t[381] = 111; + t[383] = 243; + t[393] = 112; + t[395] = 113; + t[396] = 114; + t[400] = 115; + t[401] = 347; + t[410] = 116; + t[437] = 117; + t[448] = 118; + t[449] = 119; + t[454] = 120; + t[455] = 121; + t[460] = 122; + t[463] = 380; + t[853] = 44; + t[855] = 58; + t[856] = 46; + t[876] = 47; + t[878] = 45; + t[882] = 45; + t[894] = 40; + t[895] = 41; + t[896] = 91; + t[897] = 93; + t[923] = 64; + t[1004] = 48; + t[1005] = 49; + t[1006] = 50; + t[1007] = 51; + t[1008] = 52; + t[1009] = 53; + t[1010] = 54; + t[1011] = 55; + t[1012] = 56; + t[1013] = 57; + t[1081] = 37; + t[1085] = 43; + t[1086] = 45; +}); exports.getStdFontMap = getStdFontMap; exports.getNonStdFontMap = getNonStdFontMap; exports.getSerifFonts = getSerifFonts; exports.getSymbolsFonts = getSymbolsFonts; exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts; exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack; +exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri; /***/ }), /* 16 */ @@ -20728,8 +20761,8 @@ exports.PostScriptCompiler = PostScriptCompiler; "use strict"; -var pdfjsVersion = '2.0.185'; -var pdfjsBuild = 'f2994736'; +var pdfjsVersion = '2.0.197'; +var pdfjsBuild = '371ca514'; var pdfjsCoreWorker = __w_pdfjs_require__(19); exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler; @@ -20924,7 +20957,7 @@ var WorkerMessageHandler = { var cancelXHRs = null; var WorkerTasks = []; let apiVersion = docParams.apiVersion; - let workerVersion = '2.0.185'; + let workerVersion = '2.0.197'; if (apiVersion !== null && apiVersion !== workerVersion) { throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`); } @@ -32329,7 +32362,7 @@ var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() { }; return OpenTypeFileBuilder; }(); -var ProblematicCharRanges = new Int32Array([0x0000, 0x0020, 0x007F, 0x00A1, 0x00AD, 0x00AE, 0x0600, 0x0780, 0x08A0, 0x10A0, 0x1780, 0x1800, 0x1C00, 0x1C50, 0x2000, 0x2010, 0x2011, 0x2012, 0x2028, 0x2030, 0x205F, 0x2070, 0x25CC, 0x25CD, 0x3000, 0x3001, 0x3164, 0x3165, 0xAA60, 0xAA80, 0xFFF0, 0x10000]); +var ProblematicCharRanges = new Int32Array([0x0000, 0x0020, 0x007F, 0x00A1, 0x00AD, 0x00AE, 0x0600, 0x0780, 0x08A0, 0x10A0, 0x1780, 0x1800, 0x1C00, 0x1C50, 0x2000, 0x2010, 0x2011, 0x2012, 0x2028, 0x2030, 0x205F, 0x2070, 0x25CC, 0x25CD, 0x3000, 0x3001, 0x3164, 0x3165, 0xAA60, 0xAA80, 0xD800, 0xE000, 0xFFF0, 0x10000]); var Font = function FontClosure() { function Font(name, file, properties) { var charCode; @@ -32848,6 +32881,11 @@ var Font = function FontClosure() { for (charCode in SupplementalGlyphMapForArialBlack) { map[+charCode] = SupplementalGlyphMapForArialBlack[charCode]; } + } else if (/Calibri/i.test(name)) { + let SupplementalGlyphMapForCalibri = (0, _standard_fonts.getSupplementalGlyphMapForCalibri)(); + for (charCode in SupplementalGlyphMapForCalibri) { + map[+charCode] = SupplementalGlyphMapForCalibri[charCode]; + } } var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap; if (!isIdentityUnicode) { diff --git a/browser/extensions/pdfjs/content/web/viewer.js b/browser/extensions/pdfjs/content/web/viewer.js index 51b220c6de02f..42742e90baf1c 100644 --- a/browser/extensions/pdfjs/content/web/viewer.js +++ b/browser/extensions/pdfjs/content/web/viewer.js @@ -1911,7 +1911,7 @@ function webViewerPageRendered(evt) { let thumbnailView = PDFViewerApplication.pdfThumbnailViewer.getThumbnail(pageIndex); thumbnailView.setImage(pageView); } - if (_pdfjsLib.PDFJS.pdfBug && Stats.enabled && pageView.stats) { + if (_pdfjsLib.PDFJS.pdfBug && typeof Stats !== 'undefined' && Stats.enabled && pageView.stats) { Stats.add(pageNumber, pageView.stats); } if (pageView.error) { @@ -2111,9 +2111,9 @@ function webViewerPageChanging(evt) { if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) { PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(page); } - if (_pdfjsLib.PDFJS.pdfBug && Stats.enabled) { + if (_pdfjsLib.PDFJS.pdfBug && typeof Stats !== 'undefined' && Stats.enabled) { let pageView = PDFViewerApplication.pdfViewer.getPageView(page - 1); - if (pageView.stats) { + if (pageView && pageView.stats) { Stats.add(page, pageView.stats); } } diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 58b423c7a8e6b..0f1817bb2c8c5 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -192,6 +192,9 @@ @RESPATH@/components/dom.xpt @RESPATH@/components/dom_base.xpt @RESPATH@/components/dom_bindings.xpt +#ifdef MOZ_DEBUG +@RESPATH@/components/dom_bindings_test.xpt +#endif @RESPATH@/components/dom_file.xpt @RESPATH@/components/dom_system.xpt @RESPATH@/components/dom_canvas.xpt diff --git a/dom/base/ChildIterator.cpp b/dom/base/ChildIterator.cpp index 00664d9573fa6..ad717889b3177 100644 --- a/dom/base/ChildIterator.cpp +++ b/dom/base/ChildIterator.cpp @@ -12,6 +12,7 @@ #include "nsIAnonymousContentCreator.h" #include "nsIFrame.h" #include "nsCSSAnonBoxes.h" +#include "nsDocument.h" namespace mozilla { namespace dom { @@ -66,7 +67,8 @@ ExplicitChildIterator::ExplicitChildIterator(const nsIContent* aParent, mIsFirst(aStartAtBeginning), mIndexInInserted(0) { - mParentAsSlot = HTMLSlotElement::FromContent(mParent); + mParentAsSlot = nsDocument::IsWebComponentsEnabled(mParent) ? + HTMLSlotElement::FromContent(mParent) : nullptr; } nsIContent* diff --git a/dom/base/NodeInfo.h b/dom/base/NodeInfo.h index 0098e1461e2cc..84195f0f5c4ee 100644 --- a/dom/base/NodeInfo.h +++ b/dom/base/NodeInfo.h @@ -26,6 +26,7 @@ #include "nsString.h" #include "mozilla/Attributes.h" #include "nsAtom.h" +#include "plhash.h" class nsIDocument; class nsNodeInfoManager; diff --git a/dom/base/crashtests/1422931.html b/dom/base/crashtests/1422931.html new file mode 100644 index 0000000000000..9f09f41efdbd7 --- /dev/null +++ b/dom/base/crashtests/1422931.html @@ -0,0 +1,6 @@ + + + + +
+ diff --git a/dom/base/crashtests/crashtests.list b/dom/base/crashtests/crashtests.list index 37b502fd85077..02b02a9c7eb07 100644 --- a/dom/base/crashtests/crashtests.list +++ b/dom/base/crashtests/crashtests.list @@ -236,4 +236,5 @@ load 1406109-1.html pref(dom.webcomponents.enabled,true) load 1324463.html pref(dom.webcomponents.customelements.enabled,true) load 1413815.html load 1411473.html +pref(dom.webcomponents.enabled,false) load 1422931.html pref(dom.webcomponents.enabled,true) load 1419799.html diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 8db11279e86fe..c2a1a84aefc36 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -7534,7 +7534,7 @@ nsContentUtils::IsContentInsertionPoint(nsIContent* aContent) bool nsContentUtils::HasDistributedChildren(nsIContent* aContent) { - if (!aContent) { + if (!aContent || !nsDocument::IsWebComponentsEnabled(aContent)) { return false; } diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index c8a6905e3ef41..de74eeef5ec69 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -1208,7 +1208,8 @@ nsExternalResourceMap::PendingLoad::OnDataAvailable(nsIRequest* aRequest, uint64_t aOffset, uint32_t aCount) { - NS_PRECONDITION(mTargetListener, "Shouldn't be getting called!"); + // mTargetListener might be null if SetupViewer or AddExternalResource failed. + NS_ENSURE_TRUE(mTargetListener, NS_ERROR_FAILURE); if (mDisplayDocument->ExternalResourceMap().HaveShutDown()) { return NS_BINDING_ABORTED; } @@ -1581,6 +1582,10 @@ nsIDocument::nsIDocument() for (auto& cnt : mIncCounters) { cnt = 0; } + + // Set this when document is created and value stays the same for the lifetime + // of the document. + mIsWebComponentsEnabled = nsContentUtils::IsWebComponentsEnabled(); } nsDocument::nsDocument(const char* aContentType) @@ -2720,6 +2725,30 @@ nsDocument::IsSynthesized() { return synthesized; } +bool +nsDocument::IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject) +{ + JS::Rooted obj(aCx, aObject); + + JSAutoCompartment ac(aCx, obj); + JS::Rooted global(aCx, JS_GetGlobalForObject(aCx, obj)); + nsCOMPtr window = + do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(global)); + + nsIDocument* doc = window ? window->GetExtantDoc() : nullptr; + if (!doc) { + return false; + } + + return doc->IsWebComponentsEnabled(); +} + +bool +nsDocument::IsWebComponentsEnabled(const nsINode* aNode) +{ + return aNode->OwnerDoc()->IsWebComponentsEnabled(); +} + nsresult nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup, diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index a31622ea85716..324b31e6bb8c3 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -665,6 +665,11 @@ class nsDocument : public nsIDocument, virtual void ResolveScheduledSVGPresAttrs() override; bool IsSynthesized(); + // Check whether web components are enabled for the global of aObject. + static bool IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject); + // Check whether web components are enabled for the document this node belongs + // to. + static bool IsWebComponentsEnabled(const nsINode* aNode); private: void AddOnDemandBuiltInUASheet(mozilla::StyleSheet* aSheet); void SendToConsole(nsCOMArray& aMessages); diff --git a/dom/base/nsGlobalWindowInner.cpp b/dom/base/nsGlobalWindowInner.cpp index 4c02232f96e5d..28a34798196b9 100644 --- a/dom/base/nsGlobalWindowInner.cpp +++ b/dom/base/nsGlobalWindowInner.cpp @@ -259,6 +259,7 @@ #include "mozilla/dom/ClientManager.h" #include "mozilla/dom/ClientSource.h" +#include "mozilla/dom/ClientState.h" // Apple system headers seem to have a check() macro. #ifdef check @@ -2317,6 +2318,12 @@ nsPIDOMWindowInner::GetClientInfo() const return Move(nsGlobalWindowInner::Cast(this)->GetClientInfo()); } +Maybe +nsPIDOMWindowInner::GetClientState() const +{ + return Move(nsGlobalWindowInner::Cast(this)->GetClientState()); +} + Maybe nsPIDOMWindowInner::GetController() const { @@ -6157,6 +6164,21 @@ nsGlobalWindowInner::GetClientInfo() const return Move(clientInfo); } +Maybe +nsGlobalWindowInner::GetClientState() const +{ + MOZ_ASSERT(NS_IsMainThread()); + Maybe clientState; + if (mClientSource) { + ClientState state; + nsresult rv = mClientSource->SnapshotState(&state); + if (NS_SUCCEEDED(rv)) { + clientState.emplace(state); + } + } + return Move(clientState); +} + Maybe nsGlobalWindowInner::GetController() const { diff --git a/dom/base/nsGlobalWindowInner.h b/dom/base/nsGlobalWindowInner.h index a05698499298f..0b57f30582ea2 100644 --- a/dom/base/nsGlobalWindowInner.h +++ b/dom/base/nsGlobalWindowInner.h @@ -348,6 +348,7 @@ class nsGlobalWindowInner : public mozilla::dom::EventTarget, void SyncStateFromParentWindow(); mozilla::Maybe GetClientInfo() const; + mozilla::Maybe GetClientState() const; mozilla::Maybe GetController() const; virtual nsresult FireDelayedDOMEvents() override; diff --git a/dom/base/nsGlobalWindowOuter.cpp b/dom/base/nsGlobalWindowOuter.cpp index 0aa848283b14b..bfd70005cd331 100644 --- a/dom/base/nsGlobalWindowOuter.cpp +++ b/dom/base/nsGlobalWindowOuter.cpp @@ -5966,24 +5966,26 @@ nsGlobalWindowOuter::CloseOuter(bool aTrustedCaller) // Don't allow scripts from content to close non-neterror windows that // were not opened by script. - nsAutoString url; - nsresult rv = mDoc->GetURL(url); - NS_ENSURE_SUCCESS_VOID(rv); - - if (!StringBeginsWith(url, NS_LITERAL_STRING("about:neterror")) && - !mHadOriginalOpener && !aTrustedCaller) { - bool allowClose = mAllowScriptsToClose || - Preferences::GetBool("dom.allow_scripts_to_close_windows", true); - if (!allowClose) { - // We're blocking the close operation - // report localized error msg in JS console - nsContentUtils::ReportToConsole( - nsIScriptError::warningFlag, - NS_LITERAL_CSTRING("DOM Window"), mDoc, // Better name for the category? - nsContentUtils::eDOM_PROPERTIES, - "WindowCloseBlockedWarning"); - - return; + if (mDoc) { + nsAutoString url; + nsresult rv = mDoc->GetURL(url); + NS_ENSURE_SUCCESS_VOID(rv); + + if (!StringBeginsWith(url, NS_LITERAL_STRING("about:neterror")) && + !mHadOriginalOpener && !aTrustedCaller) { + bool allowClose = mAllowScriptsToClose || + Preferences::GetBool("dom.allow_scripts_to_close_windows", true); + if (!allowClose) { + // We're blocking the close operation + // report localized error msg in JS console + nsContentUtils::ReportToConsole( + nsIScriptError::warningFlag, + NS_LITERAL_CSTRING("DOM Window"), mDoc, // Better name for the category? + nsContentUtils::eDOM_PROPERTIES, + "WindowCloseBlockedWarning"); + + return; + } } } diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index fcbb903a75e86..74294fa0491c8 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -3256,6 +3256,11 @@ class nsIDocument : public nsINode, virtual bool AllowPaymentRequest() const = 0; virtual void SetAllowPaymentRequest(bool aAllowPaymentRequest) = 0; + bool IsWebComponentsEnabled() const + { + return mIsWebComponentsEnabled; + } + protected: bool GetUseCounter(mozilla::UseCounter aUseCounter) { @@ -3612,6 +3617,9 @@ class nsIDocument : public nsINode, // True if the encoding menu should be disabled. bool mEncodingMenuDisabled : 1; + // True if dom.webcomponents.enabled pref is set when document is created. + bool mIsWebComponentsEnabled : 1; + // Whether + + +
+
+ + diff --git a/layout/reftests/svg/as-image/svg-image-visited-1.html b/layout/reftests/svg/as-image/svg-image-visited-1.html deleted file mode 100644 index de162c26c24f7..0000000000000 --- a/layout/reftests/svg/as-image/svg-image-visited-1.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - Test for bug 641731 - - - - - - diff --git a/layout/reftests/svg/as-image/svg-image-visited-1-helper.svg b/layout/reftests/svg/as-image/svg-image-visited-1a-helper.svg similarity index 53% rename from layout/reftests/svg/as-image/svg-image-visited-1-helper.svg rename to layout/reftests/svg/as-image/svg-image-visited-1a-helper.svg index 02b524dc07f01..57478c5c418d1 100644 --- a/layout/reftests/svg/as-image/svg-image-visited-1-helper.svg +++ b/layout/reftests/svg/as-image/svg-image-visited-1a-helper.svg @@ -10,7 +10,7 @@ rect { fill: lime; } - a:visited > rect { fill: red; } + a:visited > rect { fill: purple; } ]]> @@ -20,4 +20,15 @@ + + + + + diff --git a/layout/reftests/svg/as-image/svg-image-visited-1a.html b/layout/reftests/svg/as-image/svg-image-visited-1a.html new file mode 100644 index 0000000000000..53aff74c9b955 --- /dev/null +++ b/layout/reftests/svg/as-image/svg-image-visited-1a.html @@ -0,0 +1,23 @@ + + + + + Test for bug 641731 + + + + + + + + + diff --git a/layout/reftests/svg/as-image/svg-image-visited-2-helper.svg b/layout/reftests/svg/as-image/svg-image-visited-1b-helper.svg similarity index 50% rename from layout/reftests/svg/as-image/svg-image-visited-2-helper.svg rename to layout/reftests/svg/as-image/svg-image-visited-1b-helper.svg index af1bdec506172..451388e37921b 100644 --- a/layout/reftests/svg/as-image/svg-image-visited-2-helper.svg +++ b/layout/reftests/svg/as-image/svg-image-visited-1b-helper.svg @@ -9,7 +9,7 @@ @@ -19,4 +19,15 @@ + + + + + diff --git a/layout/reftests/svg/as-image/svg-image-visited-1b.html b/layout/reftests/svg/as-image/svg-image-visited-1b.html new file mode 100644 index 0000000000000..05227cc85d6a4 --- /dev/null +++ b/layout/reftests/svg/as-image/svg-image-visited-1b.html @@ -0,0 +1,23 @@ + + + + + Test for bug 641731 + + + + + + + + + diff --git a/layout/reftests/svg/as-image/svg-image-visited-1c-helper.svg b/layout/reftests/svg/as-image/svg-image-visited-1c-helper.svg new file mode 100644 index 0000000000000..ca688a2b5544c --- /dev/null +++ b/layout/reftests/svg/as-image/svg-image-visited-1c-helper.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/as-image/svg-image-visited-1c.html b/layout/reftests/svg/as-image/svg-image-visited-1c.html new file mode 100644 index 0000000000000..f016d5cebefc9 --- /dev/null +++ b/layout/reftests/svg/as-image/svg-image-visited-1c.html @@ -0,0 +1,23 @@ + + + + + Test for bug 641731 + + + + + + + + + diff --git a/layout/reftests/svg/as-image/svg-image-visited-1d-helper.svg b/layout/reftests/svg/as-image/svg-image-visited-1d-helper.svg new file mode 100644 index 0000000000000..cc62c3a27cde7 --- /dev/null +++ b/layout/reftests/svg/as-image/svg-image-visited-1d-helper.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/as-image/svg-image-visited-1d.html b/layout/reftests/svg/as-image/svg-image-visited-1d.html new file mode 100644 index 0000000000000..39005b39d3c8e --- /dev/null +++ b/layout/reftests/svg/as-image/svg-image-visited-1d.html @@ -0,0 +1,23 @@ + + + + + Test for bug 641731 + + + + + + + + + diff --git a/layout/reftests/svg/as-image/svg-image-visited-2.html b/layout/reftests/svg/as-image/svg-image-visited-2.html deleted file mode 100644 index f4594be3ad382..0000000000000 --- a/layout/reftests/svg/as-image/svg-image-visited-2.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - Test for bug 641731 - - - - - - diff --git a/layout/reftests/webkit-box/webkit-box-ordinal-group-1.html b/layout/reftests/webkit-box/webkit-box-ordinal-group-1.html index 5b48dfe83f557..58a6447536d1d 100644 --- a/layout/reftests/webkit-box/webkit-box-ordinal-group-1.html +++ b/layout/reftests/webkit-box/webkit-box-ordinal-group-1.html @@ -6,7 +6,7 @@ - CSS Test: -webkit-box-orient inside a -webkit-box + CSS Test: -webkit-box-ordinal-group inside a -webkit-box