diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/accessible/interfaces/ia2/IA2Marshal.rc firefox-trunk-81.0~a1~hg20200808r544015/accessible/interfaces/ia2/IA2Marshal.rc --- firefox-trunk-81.0~a1~hg20200807r543684/accessible/interfaces/ia2/IA2Marshal.rc 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/accessible/interfaces/ia2/IA2Marshal.rc 2020-08-09 12:47:55.000000000 +0000 @@ -3,4 +3,3 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1 typelib IA2Typelib.tlb -2 24 IA2Marshal.dll.manifest diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/accessible/interfaces/ia2/Makefile.in firefox-trunk-81.0~a1~hg20200808r544015/accessible/interfaces/ia2/Makefile.in --- firefox-trunk-81.0~a1~hg20200807r543684/accessible/interfaces/ia2/Makefile.in 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/accessible/interfaces/ia2/Makefile.in 2020-08-09 12:47:55.000000000 +0000 @@ -65,8 +65,6 @@ $(MIDL_LIBRARIES:%.idl=%.c) \ $(NULL) -EMBED_MANIFEST_AT = 2 - INSTALL_TARGETS += midl midl_FILES := $(filter %.h %_i.c,$(MIDL_GENERATED_FILES)) midl_DEST = $(DIST)/include diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/accessible/interfaces/msaa/Makefile.in firefox-trunk-81.0~a1~hg20200808r544015/accessible/interfaces/msaa/Makefile.in --- firefox-trunk-81.0~a1~hg20200807r543684/accessible/interfaces/msaa/Makefile.in 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/accessible/interfaces/msaa/Makefile.in 2020-08-09 12:47:55.000000000 +0000 @@ -29,8 +29,6 @@ register:: regsvr32 -s $(DIST)/bin/$(SHARED_LIBRARY) -EMBED_MANIFEST_AT = 2 - midl_exports := \ ISimpleDOM.h \ ISimpleDOM_i.c \ diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/accessible/mac/MOXAccessibleProtocol.h firefox-trunk-81.0~a1~hg20200808r544015/accessible/mac/MOXAccessibleProtocol.h --- firefox-trunk-81.0~a1~hg20200807r543684/accessible/mac/MOXAccessibleProtocol.h 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/accessible/mac/MOXAccessibleProtocol.h 2020-08-09 12:47:55.000000000 +0000 @@ -325,7 +325,7 @@ - (NSArray* _Nullable)moxUIElementsForSearchPredicate:(NSDictionary* _Nonnull)searchPredicate; // AXUIElementCountForSearchPredicate -- (NSUInteger)moxUIElementCountForSearchPredicate:(NSDictionary* _Nonnull)searchPredicate; +- (NSNumber* _Nullable)moxUIElementCountForSearchPredicate:(NSDictionary* _Nonnull)searchPredicate; // AXCellForColumnAndRow - (id _Nullable)moxCellForColumnAndRow:(NSArray* _Nonnull)columnAndRow; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/accessible/mac/MOXWebAreaAccessible.h firefox-trunk-81.0~a1~hg20200808r544015/accessible/mac/MOXWebAreaAccessible.h --- firefox-trunk-81.0~a1~hg20200807r543684/accessible/mac/MOXWebAreaAccessible.h 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/accessible/mac/MOXWebAreaAccessible.h 2020-08-09 12:47:55.000000000 +0000 @@ -30,7 +30,7 @@ - (NSArray*)moxUIElementsForSearchPredicate:(NSDictionary*)searchPredicate; // override -- (NSUInteger)moxUIElementCountForSearchPredicate:(NSDictionary*)searchPredicate; +- (NSNumber*)moxUIElementCountForSearchPredicate:(NSDictionary*)searchPredicate; // overrides - (void)handleAccessibleEvent:(uint32_t)eventType; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/accessible/mac/MOXWebAreaAccessible.mm firefox-trunk-81.0~a1~hg20200808r544015/accessible/mac/MOXWebAreaAccessible.mm --- firefox-trunk-81.0~a1~hg20200807r543684/accessible/mac/MOXWebAreaAccessible.mm 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/accessible/mac/MOXWebAreaAccessible.mm 2020-08-09 12:47:55.000000000 +0000 @@ -76,8 +76,8 @@ return [search performSearch]; } -- (NSUInteger)moxUIElementCountForSearchPredicate:(NSDictionary*)searchPredicate { - return [[self moxUIElementsForSearchPredicate:searchPredicate] count]; +- (NSNumber*)moxUIElementCountForSearchPredicate:(NSDictionary*)searchPredicate { + return [NSNumber numberWithDouble:[[self moxUIElementsForSearchPredicate:searchPredicate] count]]; } - (void)handleAccessibleEvent:(uint32_t)eventType { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/accessible/tests/browser/mac/browser.ini firefox-trunk-81.0~a1~hg20200808r544015/accessible/tests/browser/mac/browser.ini --- firefox-trunk-81.0~a1~hg20200807r543684/accessible/tests/browser/mac/browser.ini 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/accessible/tests/browser/mac/browser.ini 2020-08-09 12:47:55.000000000 +0000 @@ -31,3 +31,4 @@ skip-if = os == 'mac' && !debug #1648813 [browser_text_basics.js] [browser_text_input.js] +[browser_rotor.js] diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/accessible/tests/browser/mac/browser_rotor.js firefox-trunk-81.0~a1~hg20200808r544015/accessible/tests/browser/mac/browser_rotor.js --- firefox-trunk-81.0~a1~hg20200807r543684/accessible/tests/browser/mac/browser_rotor.js 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/accessible/tests/browser/mac/browser_rotor.js 2020-08-09 12:47:55.000000000 +0000 @@ -0,0 +1,52 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +/** + * Test rotor with heading + */ +addAccessibleTask( + `

hello


world


goodbye`, + async (browser, accDoc) => { + const searchPred = { + AXSearchKey: "AXHeadingSearchKey", + AXImmediateDescendants: 1, + AXResultsLimit: -1, + AXDirection: "AXDirectionNext", + }; + + const webArea = accDoc.nativeInterface.QueryInterface( + Ci.nsIAccessibleMacInterface + ); + is( + webArea.getAttributeValue("AXRole"), + "AXWebArea", + "Got web area accessible" + ); + + const headingCount = webArea.getParameterizedAttributeValue( + "AXUIElementCountForSearchPredicate", + NSDictionary(searchPred) + ); + is(2, headingCount, "Found two headings"); + + const headings = webArea.getParameterizedAttributeValue( + "AXUIElementsForSearchPredicate", + NSDictionary(searchPred) + ); + const hello = getNativeInterface(accDoc, "hello"); + const world = getNativeInterface(accDoc, "world"); + is( + hello.getAttributeValue("AXTitle"), + headings[0].getAttributeValue("AXTitle"), + "Found correct first heading" + ); + is( + world.getAttributeValue("AXTitle"), + headings[1].getAttributeValue("AXTitle"), + "Found correct second heading" + ); + } +); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/accessible/tests/browser/shared-head.js firefox-trunk-81.0~a1~hg20200808r544015/accessible/tests/browser/shared-head.js --- firefox-trunk-81.0~a1~hg20200807r543684/accessible/tests/browser/shared-head.js 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/accessible/tests/browser/shared-head.js 2020-08-09 12:47:55.000000000 +0000 @@ -476,8 +476,9 @@ await SimpleTest.promiseFocus(browser); await loadContentScripts(browser, "Common.jsm"); - ok(Services.appinfo.browserTabsRemoteAutostart, "e10s enabled"); - ok(browser.isRemoteBrowser, "Actually remote browser"); + if (Services.appinfo.browserTabsRemoteAutostart) { + ok(browser.isRemoteBrowser, "Actually remote browser"); + } const { accessible: docAccessible } = await onContentDocLoad; let iframeDocAccessible; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/accessible/xpcom/xpcAccessibleMacInterface.mm firefox-trunk-81.0~a1~hg20200808r544015/accessible/xpcom/xpcAccessibleMacInterface.mm --- firefox-trunk-81.0~a1~hg20200807r543684/accessible/xpcom/xpcAccessibleMacInterface.mm 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/accessible/xpcom/xpcAccessibleMacInterface.mm 2020-08-09 12:47:55.000000000 +0000 @@ -10,6 +10,7 @@ #include "nsContentUtils.h" #include "nsIXPConnect.h" #include "mozilla/dom/ToJSValue.h" +#include "nsString.h" #import "mozAccessible.h" @@ -268,6 +269,14 @@ return [NSNumber numberWithInteger:aValue.toInt32()]; } else if (aValue.isBoolean()) { return [NSNumber numberWithBool:aValue.toBoolean()]; + } else if (aValue.isString()) { + nsAutoJSString temp; + if (!temp.init(aCx, aValue)) { + NS_WARNING("cannot init string with given value"); + *aResult = NS_ERROR_FAILURE; + return nil; + } + return nsCocoaUtils::ToNSString(temp); } else if (aValue.isObject()) { JS::Rooted obj(aCx, aValue.toObjectOrNull()); @@ -381,7 +390,7 @@ nsresult* aResult) { *aResult = NS_ERROR_FAILURE; JS::RootedValue objectTypeValue(aCx); - if (!JS_GetProperty(aCx, aObject, "objetType", &objectTypeValue)) { + if (!JS_GetProperty(aCx, aObject, "objectType", &objectTypeValue)) { NS_WARNING("Could not get objectType"); return nil; } @@ -393,11 +402,16 @@ } nsAutoJSString objectType; - if (!objectTypeValue.isString() || !objectType.init(aCx, objectTypeValue)) { + if (!objectTypeValue.isString()) { NS_WARNING("objectType is not a string"); return nil; } + if (!objectType.init(aCx, objectTypeValue)) { + NS_WARNING("cannot init string with object type"); + return nil; + } + bool isObject = objectValue.isObjectOrNull(); if (!isObject) { NS_WARNING("object is not a JSON object"); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/actors/BlockedSiteChild.jsm firefox-trunk-81.0~a1~hg20200808r544015/browser/actors/BlockedSiteChild.jsm --- firefox-trunk-81.0~a1~hg20200807r543684/browser/actors/BlockedSiteChild.jsm 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/actors/BlockedSiteChild.jsm 2020-08-09 12:47:55.000000000 +0000 @@ -94,12 +94,8 @@ .getElementById("report_detection") .setAttribute( "href", - SafeBrowsing.getReportURL("MalwareMistake", blockedInfo) || - "https://www.stopbadware.org/firefox" + SafeBrowsing.getReportURL("MalwareMistake", blockedInfo) ); - doc - .getElementById("learn_more_link") - .setAttribute("href", "https://www.stopbadware.org/firefox"); break; case "unwanted": doc diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/actors/ContentSearchParent.jsm firefox-trunk-81.0~a1~hg20200808r544015/browser/actors/ContentSearchParent.jsm --- firefox-trunk-81.0~a1~hg20200807r543684/browser/actors/ContentSearchParent.jsm 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/actors/ContentSearchParent.jsm 2020-08-09 12:47:55.000000000 +0000 @@ -304,7 +304,7 @@ return result; }, - async addFormHistoryEntry(browser, entry = "") { + async addFormHistoryEntry(browser, entry = null) { let isPrivate = false; try { // isBrowserPrivate assumes that the passed-in browser has all the normal @@ -314,7 +314,7 @@ } catch (err) { return false; } - if (isPrivate || entry === "") { + if (isPrivate || !entry) { return false; } let browserData = this._suggestionDataForBrowser(browser, true); @@ -322,7 +322,8 @@ { op: "bump", fieldname: browserData.controller.formHistoryParam, - value: entry, + value: entry.value, + source: entry.engineName, }, { handleCompletion: () => {}, diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/app/profile/firefox.js firefox-trunk-81.0~a1~hg20200808r544015/browser/app/profile/firefox.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/app/profile/firefox.js 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/app/profile/firefox.js 2020-08-09 12:47:55.000000000 +0000 @@ -1331,11 +1331,11 @@ pref("browser.newtabpage.activity-stream.discoverystream.hardcoded-basic-layout", false); pref("browser.newtabpage.activity-stream.discoverystream.spocs-endpoint", ""); // List of regions that get stories by default. -pref("browser.newtabpage.activity-stream.discoverystream.region-stories-config", "US,DE,CA,GB"); +pref("browser.newtabpage.activity-stream.discoverystream.region-stories-config", "US,DE,CA,GB,IE"); // List of regions that get spocs by default. pref("browser.newtabpage.activity-stream.discoverystream.region-spocs-config", "US,CA"); // List of regions that get the 7 row layout. -pref("browser.newtabpage.activity-stream.discoverystream.region-layout-config", "US,CA,GB,DE"); +pref("browser.newtabpage.activity-stream.discoverystream.region-layout-config", "US,CA,GB,DE,IE"); // Allows Pocket story collections to be dismissed. pref("browser.newtabpage.activity-stream.discoverystream.isCollectionDismissible", true); pref("browser.newtabpage.activity-stream.discoverystream.personalization.version", 2); @@ -1849,6 +1849,8 @@ pref("extensions.formautofill.addresses.enabled", true); pref("extensions.formautofill.addresses.capture.enabled", false); pref("extensions.formautofill.creditCards.enabled", true); +// Enable the checkbox in sync options for credit card data sync service +pref("services.sync.engine.creditcards.available", true); // Pref for shield/heartbeat to recognize users who have used Credit Card // Autofill. The valid values can be: // 0: none diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/app/splash.rc firefox-trunk-81.0~a1~hg20200808r544015/browser/app/splash.rc --- firefox-trunk-81.0~a1~hg20200807r543684/browser/app/splash.rc 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/app/splash.rc 2020-08-09 12:47:55.000000000 +0000 @@ -6,8 +6,6 @@ #include #include "nsNativeAppSupportWin.h" -1 24 "firefox.exe.manifest" - IDI_APPICON ICON FIREFOX_ICO IDI_DOCUMENT ICON DOCUMENT_ICO IDI_APPLICATION ICON FIREFOX_ICO diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/blockedSite.js firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/blockedSite.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/blockedSite.js 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/blockedSite.js 2020-08-09 12:47:55.000000000 +0000 @@ -120,10 +120,16 @@ }); // Add the learn more content: + // Map specific elements to a different message ID, to allow updates to + // existing labels + let stringMapping = { + malware: "safeb-blocked-malware-page-learn-more-sumo", + }; + let learnMore = document.getElementById("learn_more"); document.l10n.setAttributes( learnMore, - "safeb-blocked-" + error + "-page-learn-more" + stringMapping[error] || `safeb-blocked-${error}-page-learn-more` ); // Set sitename to bold by adding class diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/contentSearchUI.js firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/contentSearchUI.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/contentSearchUI.js 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/contentSearchUI.js 2020-08-09 12:47:55.000000000 +0000 @@ -234,7 +234,12 @@ }, addInputValueToFormHistory() { - this._sendMsg("AddFormHistoryEntry", this.input.value); + let entry = { + value: this.input.value, + engineName: this.selectedEngineName, + }; + this._sendMsg("AddFormHistoryEntry", entry); + return entry; }, handleEvent(event) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/test/general/browser_contentSearchUI.js firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/test/general/browser_contentSearchUI.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/test/general/browser_contentSearchUI.js 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/test/general/browser_contentSearchUI.js 2020-08-09 12:47:55.000000000 +0000 @@ -9,9 +9,10 @@ const TEST_MSG = "ContentSearchUIControllerTest"; -let { SearchTestUtils } = ChromeUtils.import( - "resource://testing-common/SearchTestUtils.jsm" -); +XPCOMUtils.defineLazyModuleGetters(this, { + FormHistoryTestUtils: "resource://testing-common/FormHistoryTestUtils.jsm", + SearchTestUtils: "resource://testing-common/SearchTestUtils.jsm", +}); SearchTestUtils.init(Assert, registerCleanupFunction); @@ -541,10 +542,17 @@ }, "satchel-storage-changed"); }); - await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => { - content.gController.addInputValueToFormHistory(); + await FormHistoryTestUtils.clear("searchbar-history"); + let entry = await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => { + return content.gController.addInputValueToFormHistory(); }); await observePromise; + Assert.greater( + await FormHistoryTestUtils.count("searchbar-history", { + source: entry.source, + }), + 0 + ); // Reset the input. state = await msg("reset"); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/test/performance/browser.ini firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/test/performance/browser.ini --- firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/test/performance/browser.ini 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/test/performance/browser.ini 2020-08-09 12:47:55.000000000 +0000 @@ -26,6 +26,13 @@ [browser_startup.js] [browser_startup_content.js] skip-if = !e10s +support-files = + file_empty.html +[browser_startup_content_subframe.js] +skip-if = !fission +support-files = + file_empty.html + StartupContentSubframe.jsm [browser_startup_flicker.js] run-if = debug || devedition || nightly_build # Requires startupRecorder.js, which isn't shipped everywhere by default [browser_startup_hiddenwindow.js] diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/test/performance/browser_startup_content.js firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/test/performance/browser_startup_content.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/test/performance/browser_startup_content.js 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/test/performance/browser_startup_content.js 2020-08-09 12:47:55.000000000 +0000 @@ -39,6 +39,7 @@ "resource:///actors/AboutReaderChild.jsm", "resource:///actors/BrowserTabChild.jsm", "resource:///actors/LinkHandlerChild.jsm", + "resource:///actors/PageStyleChild.jsm", "resource:///actors/SearchTelemetryChild.jsm", "resource://gre/actors/AutoCompleteChild.jsm", "resource://gre/modules/ActorManagerChild.jsm", @@ -112,6 +113,11 @@ let tab = await BrowserTestUtils.openNewForegroundTab({ gBrowser, + url: + getRootDirectory(gTestPath).replace( + "chrome://mochitests/content", + "http://example.com" + ) + "file_empty.html", forceNewProcess: true, }); @@ -177,76 +183,13 @@ loadedInfo.processScripts[uri] = ""; } - let loadedList = {}; - - for (let scriptType in known_scripts) { - loadedList[scriptType] = Object.keys(loadedInfo[scriptType]).filter(c => { - if (!known_scripts[scriptType].has(c)) { - return true; - } - known_scripts[scriptType].delete(c); - return false; - }); - - loadedList[scriptType] = loadedList[scriptType].filter(c => { - return !intermittently_loaded_scripts[scriptType].has(c); - }); - - is( - loadedList[scriptType].length, - 0, - `should have no unexpected ${scriptType} loaded on content process startup` - ); - - for (let script of loadedList[scriptType]) { - record( - false, - `Unexpected ${scriptType} loaded during content process startup: ${script}`, - undefined, - loadedInfo[scriptType][script] - ); - } - - is( - known_scripts[scriptType].size, - 0, - `all known ${scriptType} scripts should have been loaded` - ); - - for (let script of known_scripts[scriptType]) { - ok( - false, - `${scriptType} is expected to load for content process startup but wasn't: ${script}` - ); - } - - if (kDumpAllStacks) { - info(`Stacks for all loaded ${scriptType}:`); - for (let file in loadedInfo[scriptType]) { - if (loadedInfo[scriptType][file]) { - info( - `${file}\n------------------------------------\n` + - loadedInfo[scriptType][file] + - "\n" - ); - } - } - } - } - - for (let scriptType in forbiddenScripts) { - for (let script of forbiddenScripts[scriptType]) { - let loaded = script in loadedInfo[scriptType]; - if (loaded) { - record( - false, - `Forbidden ${scriptType} loaded during content process startup: ${script}`, - undefined, - loadedInfo[scriptType][script] - ); - } - } - } + checkLoadedScripts({ + loadedInfo, + known: known_scripts, + intermittent: intermittently_loaded_scripts, + forbidden: forbiddenScripts, + dumpAllStacks: kDumpAllStacks, + }); BrowserTestUtils.removeTab(tab); }); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/test/performance/browser_startup_content_subframe.js firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/test/performance/browser_startup_content_subframe.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/test/performance/browser_startup_content_subframe.js 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/test/performance/browser_startup_content_subframe.js 2020-08-09 12:47:55.000000000 +0000 @@ -0,0 +1,151 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/* This test records which services, JS components, frame scripts, process + * scripts, and JS modules are loaded when creating a new content process for a + * subframe. + * + * If you made changes that cause this test to fail, it's likely because you + * are loading more JS code during content process startup. Please try to + * avoid this. + * + * If your code isn't strictly required to show an iframe, consider loading it + * lazily. If you can't, consider delaying its load until after we have started + * handling user events. + * + * This test differs from browser_startup_content.js in that it tests a process + * with no toplevel browsers opened, but with a single subframe document + * loaded. This leads to a different set of scripts being loaded. + */ + +"use strict"; + +const actorModuleURI = + getRootDirectory(gTestPath) + "StartupContentSubframe.jsm"; +const subframeURI = + getRootDirectory(gTestPath).replace( + "chrome://mochitests/content", + "http://example.com" + ) + "file_empty.html"; + +// Set this to true only for debugging purpose; it makes the output noisy. +const kDumpAllStacks = false; + +const known_scripts = { + modules: new Set([ + // Loaded by this test + actorModuleURI, + + // General utilities + "resource://gre/modules/AppConstants.jsm", + "resource://gre/modules/DeferredTask.jsm", + "resource://gre/modules/Services.jsm", // bug 1464542 + "resource://gre/modules/XPCOMUtils.jsm", + + // Logging related + "resource://gre/modules/Log.jsm", + + // Browser front-end + "resource:///actors/PageStyleChild.jsm", + "resource://gre/actors/AutoCompleteChild.jsm", + + // Telemetry + "resource://gre/modules/TelemetryControllerBase.jsm", // bug 1470339 + "resource://gre/modules/TelemetryControllerContent.jsm", // bug 1470339 + + // Extensions + "resource://gre/modules/ExtensionProcessScript.jsm", + "resource://gre/modules/ExtensionUtils.jsm", + "resource://gre/modules/MessageChannel.jsm", + ]), + processScripts: new Set([ + "chrome://global/content/process-content.js", + "resource:///modules/ContentObservers.js", + "resource://gre/modules/extensionProcessScriptLoader.js", + ]), +}; + +// Items on this list *might* load when creating the process, as opposed to +// items in the main list, which we expect will always load. +const intermittently_loaded_scripts = { + modules: new Set([ + "resource://gre/modules/nsAsyncShutdown.jsm", + + // Test related + "resource://testing-common/BrowserTestUtilsChild.jsm", + "resource://testing-common/ContentEventListenerChild.jsm", + "resource://specialpowers/SpecialPowersChild.jsm", + "resource://specialpowers/WrapPrivileged.jsm", + ]), + processScripts: new Set([]), +}; + +const forbiddenScripts = { + services: new Set([ + "@mozilla.org/base/telemetry-startup;1", + "@mozilla.org/embedcomp/default-tooltiptextprovider;1", + "@mozilla.org/push/Service;1", + ]), +}; + +add_task(async function() { + SimpleTest.requestCompleteLog(); + + // Increase the maximum number of webIsolated content processes to make sure + // our newly-created iframe is spawned into a new content process. + // + // Unfortunately, we don't have something like `forceNewProcess` for subframe + // loads. + await SpecialPowers.pushPrefEnv({ + set: [["dom.ipc.processCount.webIsolated", 10]], + }); + Services.ppmm.releaseCachedProcesses(); + + // Register a custom window actor which will send us a notification when the + // script loading information is available. + ChromeUtils.registerWindowActor("StartupContentSubframe", { + parent: { + moduleURI: actorModuleURI, + }, + child: { + moduleURI: actorModuleURI, + events: { + load: { mozSystemGroup: true, capture: true }, + }, + }, + matches: [subframeURI], + allFrames: true, + }); + + // Create a tab, and load a remote subframe with the specific URI in it. + let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser); + + SpecialPowers.spawn(tab.linkedBrowser, [subframeURI], uri => { + let iframe = content.document.createElement("iframe"); + iframe.src = uri; + content.document.body.appendChild(iframe); + }); + + // Wait for the reply to come in, remove the XPCOM wrapper, and unregister our actor. + let [subject] = await TestUtils.topicObserved( + "startup-content-subframe-loaded-scripts" + ); + let loadedInfo = subject.wrappedJSObject; + + ChromeUtils.unregisterWindowActor("StartupContentSubframe"); + BrowserTestUtils.removeTab(tab); + + // Gather loaded process scripts. + loadedInfo.processScripts = {}; + for (let [uri] of Services.ppmm.getDelayedProcessScripts()) { + loadedInfo.processScripts[uri] = ""; + } + + checkLoadedScripts({ + loadedInfo, + known: known_scripts, + intermittent: intermittently_loaded_scripts, + forbidden: forbiddenScripts, + dumpAllStacks: kDumpAllStacks, + }); +}); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/test/performance/file_empty.html firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/test/performance/file_empty.html --- firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/test/performance/file_empty.html 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/test/performance/file_empty.html 2020-08-09 12:47:55.000000000 +0000 @@ -0,0 +1 @@ + diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/test/performance/head.js firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/test/performance/head.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/test/performance/head.js 2020-08-07 05:56:01.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/test/performance/head.js 2020-08-09 12:47:55.000000000 +0000 @@ -791,3 +791,111 @@ await BrowserTestUtils.closeWindow(win); } + +/** + * Helper method for checking which scripts are loaded on content process + * startup, used by `browser_startup_content.js` and + * `browser_startup_content_subframe.js`. + * + * Parameters to this function are passed in an object literal to avoid + * confusion about parameter order. + * + * @param loadedInfo (Object) + * Mapping from script type to a set of scripts which have been loaded + * of that type. + * + * @param known (Object) + * Mapping from script type to a set of scripts which must have been + * loaded of that type. + * + * @param intermittent (Object) + * Mapping from script type to a set of scripts which may have been + * loaded of that type. There must be a script type map for every type + * in `known`. + * + * @param forbidden (Object) + * Mapping from script type to a set of scripts which must not have been + * loaded of that type. + * + * @param dumpAllStacks (bool) + * If true, dump the stacks for all loaded modules. Makes the output + * noisy. + */ +function checkLoadedScripts({ + loadedInfo, + known, + intermittent, + forbidden, + dumpAllStacks, +}) { + let loadedList = {}; + + for (let scriptType in known) { + loadedList[scriptType] = Object.keys(loadedInfo[scriptType]).filter(c => { + if (!known[scriptType].has(c)) { + return true; + } + known[scriptType].delete(c); + return false; + }); + + loadedList[scriptType] = loadedList[scriptType].filter(c => { + return !intermittent[scriptType].has(c); + }); + + is( + loadedList[scriptType].length, + 0, + `should have no unexpected ${scriptType} loaded on content process startup` + ); + + for (let script of loadedList[scriptType]) { + record( + false, + `Unexpected ${scriptType} loaded during content process startup: ${script}`, + undefined, + loadedInfo[scriptType][script] + ); + } + + is( + known[scriptType].size, + 0, + `all known ${scriptType} scripts should have been loaded` + ); + + for (let script of known[scriptType]) { + ok( + false, + `${scriptType} is expected to load for content process startup but wasn't: ${script}` + ); + } + + if (dumpAllStacks) { + info(`Stacks for all loaded ${scriptType}:`); + for (let file in loadedInfo[scriptType]) { + if (loadedInfo[scriptType][file]) { + info( + `${file}\n------------------------------------\n` + + loadedInfo[scriptType][file] + + "\n" + ); + } + } + } + } + + for (let scriptType in forbidden) { + for (let script of forbidden[scriptType]) { + let loaded = script in loadedInfo[scriptType]; + if (loaded) { + record( + false, + `Forbidden ${scriptType} loaded during content process startup: ${script}`, + undefined, + loadedInfo[scriptType][script] + ); + } + } + } +} diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/test/performance/StartupContentSubframe.jsm firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/test/performance/StartupContentSubframe.jsm --- firefox-trunk-81.0~a1~hg20200807r543684/browser/base/content/test/performance/StartupContentSubframe.jsm 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/base/content/test/performance/StartupContentSubframe.jsm 2020-08-09 12:47:55.000000000 +0000 @@ -0,0 +1,68 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * test helper JSWindowActors used by the browser_startup_content_subframe.js test. + */ +const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); + +var EXPORTED_SYMBOLS = [ + "StartupContentSubframeParent", + "StartupContentSubframeChild", +]; + +class StartupContentSubframeParent extends JSWindowActorParent { + receiveMessage(msg) { + // Tell the test about the data we received from the content process. + Services.obs.notifyObservers( + msg.data, + "startup-content-subframe-loaded-scripts" + ); + } +} + +class StartupContentSubframeChild extends JSWindowActorChild { + async handleEvent(event) { + // When the remote subframe is loaded, an event will be fired to this actor, + // which will cause us to send the `LoadedScripts` message to the parent + // process. + // Wait a spin of the event loop before doing so to ensure we don't + // miss any scripts loaded immediately after the load event. + await new Promise(resolve => Services.tm.dispatchToMainThread(resolve)); + + const Cm = Components.manager; + Cm.QueryInterface(Ci.nsIServiceManager); + const { AppConstants } = ChromeUtils.import( + "resource://gre/modules/AppConstants.jsm" + ); + let collectStacks = AppConstants.NIGHTLY_BUILD || AppConstants.DEBUG; + + let components = {}; + for (let component of Cu.loadedComponents) { + // Keep only the file name for components, as the path is an absolute file + // URL rather than a resource:// URL like for modules. + components[component.replace(/.*\//, "")] = collectStacks + ? Cu.getComponentLoadStack(component) + : ""; + } + + let modules = {}; + for (let module of Cu.loadedModules) { + modules[module] = collectStacks ? Cu.getModuleImportStack(module) : ""; + } + + let services = {}; + for (let contractID of Object.keys(Cc)) { + try { + if (Cm.isServiceInstantiatedByContractID(contractID, Ci.nsISupports)) { + services[contractID] = ""; + } + } catch (e) {} + } + this.sendAsyncMessage("LoadedScripts", { + components, + modules, + services, + }); + } +} diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/components/newtab/content-src/components/DiscoveryStreamComponents/Navigation/Navigation.jsx firefox-trunk-81.0~a1~hg20200808r544015/browser/components/newtab/content-src/components/DiscoveryStreamComponents/Navigation/Navigation.jsx --- firefox-trunk-81.0~a1~hg20200807r543684/browser/components/newtab/content-src/components/DiscoveryStreamComponents/Navigation/Navigation.jsx 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/components/newtab/content-src/components/DiscoveryStreamComponents/Navigation/Navigation.jsx 2020-08-09 12:47:55.000000000 +0000 @@ -17,9 +17,10 @@ onLinkClick(event) { if (this.props.dispatch) { this.props.dispatch( - ac.ImpressionStats({ + ac.UserEvent({ event: "CLICK", source: "POPULAR_TOPICS", + action_position: 0, value: { topic: event.target.text.toLowerCase().replace(` `, `-`), }, diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/components/newtab/data/content/activity-stream.bundle.js firefox-trunk-81.0~a1~hg20200808r544015/browser/components/newtab/data/content/activity-stream.bundle.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/components/newtab/data/content/activity-stream.bundle.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/components/newtab/data/content/activity-stream.bundle.js 2020-08-09 12:47:55.000000000 +0000 @@ -10678,9 +10678,10 @@ onLinkClick(event) { if (this.props.dispatch) { - this.props.dispatch(common_Actions_jsm__WEBPACK_IMPORTED_MODULE_0__["actionCreators"].ImpressionStats({ + this.props.dispatch(common_Actions_jsm__WEBPACK_IMPORTED_MODULE_0__["actionCreators"].UserEvent({ event: "CLICK", source: "POPULAR_TOPICS", + action_position: 0, value: { topic: event.target.text.toLowerCase().replace(` `, `-`) } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/components/places/content/historySidebar.js firefox-trunk-81.0~a1~hg20200808r544015/browser/components/places/content/historySidebar.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/components/places/content/historySidebar.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/components/places/content/historySidebar.js 2020-08-09 12:47:55.000000000 +0000 @@ -29,7 +29,6 @@ var gHistoryTree; var gSearchBox; var gHistoryGrouping = ""; -var gSearching = false; function HistorySidebarInit() { let uidensity = window.top.document.documentElement.getAttribute("uidensity"); @@ -44,6 +43,11 @@ .getElementById("viewButton") .getAttribute("selectedsort"); + this.groupHistogram = Services.telemetry.getHistogramById( + "HISTORY_SIDEBAR_VIEW_TYPE" + ); + this.groupHistogram.add(gHistoryGrouping); + if (gHistoryGrouping == "site") { document.getElementById("bysite").setAttribute("checked", "true"); } else if (gHistoryGrouping == "visited") { @@ -70,6 +74,9 @@ } function GroupBy(groupingType) { + if (groupingType != gHistoryGrouping) { + this.groupHistogram.add(groupingType); + } gHistoryGrouping = groupingType; searchHistory(gSearchBox.value); } @@ -123,6 +130,7 @@ // call load() on the tree manually // instead of setting the place attribute in historySidebar.xhtml // otherwise, we will end up calling load() twice + Services.telemetry.keyedScalarAdd("sidebar.search", "history", 1); gHistoryTree.load(query, options); if (gHistoryGrouping == "lastvisited") { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/components/places/content/places-tree.js firefox-trunk-81.0~a1~hg20200808r544015/browser/components/places/content/places-tree.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/components/places/content/places-tree.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/components/places/content/places-tree.js 2020-08-09 12:47:55.000000000 +0000 @@ -434,6 +434,7 @@ if (folderRestrict) { query.setParents(folderRestrict); options.queryType = options.QUERY_TYPE_BOOKMARKS; + Services.telemetry.keyedScalarAdd("sidebar.search", "bookmarks", 1); } options.includeHidden = !!includeHidden; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/components/search/content/searchbar.js firefox-trunk-81.0~a1~hg20200808r544015/browser/components/search/content/searchbar.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/components/search/content/searchbar.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/components/search/content/searchbar.js 2020-08-09 12:47:55.000000000 +0000 @@ -385,6 +385,7 @@ doSearch(aData, aWhere, aEngine, aParams, aOneOff) { let textBox = this._textbox; + let engine = aEngine || this.currentEngine; // Save the current value in the form history if ( @@ -397,6 +398,7 @@ op: "bump", fieldname: textBox.getAttribute("autocompletesearchparam"), value: aData, + source: engine.name, }, { handleError(aError) { @@ -408,7 +410,6 @@ ); } - let engine = aEngine || this.currentEngine; let submission = engine.getSubmission(aData, null, "searchbar"); let telemetrySearchDetails = this.telemetrySearchDetails; this.telemetrySearchDetails = null; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/components/search/SearchOneOffs.jsm firefox-trunk-81.0~a1~hg20200808r544015/browser/components/search/SearchOneOffs.jsm --- firefox-trunk-81.0~a1~hg20200807r543684/browser/components/search/SearchOneOffs.jsm 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/components/search/SearchOneOffs.jsm 2020-08-09 12:47:55.000000000 +0000 @@ -789,6 +789,9 @@ * @returns {boolean} True if the one-offs handled the key press. */ handleKeyDown(event, numListItems, allowEmptySelection, textboxUserValue) { + if (!this.hasView) { + return false; + } let handled = this._handleKeyDown( event, numListItems, @@ -1049,6 +1052,13 @@ // Methods for subclasses to override /** + * @returns {boolean} True if the one-offs are connected to a view. + */ + get hasView() { + return !!this.popup; + } + + /** * @returns {boolean} True if the view is open. */ get isViewOpen() { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/components/search/test/browser/browser_426329.js firefox-trunk-81.0~a1~hg20200808r544015/browser/components/search/test/browser/browser_426329.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/components/search/test/browser/browser_426329.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/components/search/test/browser/browser_426329.js 2020-08-09 12:47:55.000000000 +0000 @@ -1,9 +1,7 @@ /* eslint-disable mozilla/no-arbitrary-setTimeout */ -ChromeUtils.defineModuleGetter( - this, - "FormHistory", - "resource://gre/modules/FormHistory.jsm" -); +XPCOMUtils.defineLazyModuleGetters(this, { + FormHistoryTestUtils: "resource://testing-common/FormHistoryTestUtils.jsm", +}); function expectedURL(aSearchTerms) { const ENGINE_HTML_BASE = @@ -60,26 +58,6 @@ ); } -function countEntries(name, value) { - return new Promise(resolve => { - let count = 0; - let obj = name && value ? { fieldname: name, value } : {}; - FormHistory.count(obj, { - handleResult(result) { - count = result; - }, - handleError(error) { - throw error; - }, - handleCompletion(reason) { - if (!reason) { - resolve(count); - } - }, - }); - }); -} - var searchBar; var searchButton; var searchEntries = ["test"]; @@ -287,9 +265,9 @@ add_task(async function testSearchHistory() { let textbox = searchBar._textbox; for (let i = 0; i < searchEntries.length; i++) { - let count = await countEntries( + let count = await FormHistoryTestUtils.count( textbox.getAttribute("autocompletesearchparam"), - searchEntries[i] + { value: searchEntries[i], source: "Bug 426329" } ); ok(count > 0, "form history entry '" + searchEntries[i] + "' should exist"); } @@ -327,7 +305,9 @@ let historyCleared = promiseObserver("satchel-storage-changed"); menuitem.click(); await historyCleared; - let count = await countEntries(); + let count = await FormHistoryTestUtils.count( + textbox.getAttribute("autocompletesearchparam") + ); ok(count == 0, "History cleared"); }); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/components/urlbar/tests/browser/browser_oneOffs.js firefox-trunk-81.0~a1~hg20200808r544015/browser/components/urlbar/tests/browser/browser_oneOffs.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/components/urlbar/tests/browser/browser_oneOffs.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/components/urlbar/tests/browser/browser_oneOffs.js 2020-08-09 12:47:55.000000000 +0000 @@ -52,33 +52,143 @@ }); }); -// Opens the top-sites view, i.e., the view that's shown when the input hasn't -// been edited. The one-offs should be hidden. -add_task(async function topSitesView() { +// Opens the view without showing the one-offs. They should be hidden and arrow +// key selection should work properly. +add_task(async function noOneOffs() { + // Do a search for "@" since we hide the one-offs in that case. + let value = "@"; await UrlbarTestUtils.promiseAutocompleteResultPopup({ window, - value: "", + value, fireInputEvent: true, }); + await TestUtils.waitForCondition( + () => !oneOffSearchButtons._rebuilding, + "Waiting for one-offs to finish rebuilding" + ); + Assert.equal( UrlbarTestUtils.getOneOffSearchButtonsVisible(window), false, "One-offs should be hidden" ); + assertState(-1, -1, value); + + // Get the result count. We don't care what the results are, just what the + // count is so that we can key through them all. + let resultCount = UrlbarTestUtils.getResultCount(window); + + // Key down through all results. + for (let i = 0; i < resultCount; i++) { + EventUtils.synthesizeKey("KEY_ArrowDown"); + assertState(i, -1); + } + + // Key down again. Nothing should be selected. + EventUtils.synthesizeKey("KEY_ArrowDown"); + assertState(-1, -1, value); + + // Key down again. The first result should be selected. + EventUtils.synthesizeKey("KEY_ArrowDown"); + assertState(0, -1); + + // Key up. Nothing should be selected. + EventUtils.synthesizeKey("KEY_ArrowUp"); + assertState(-1, -1, value); + + // Key up through all the results. + for (let i = resultCount - 1; i >= 0; i--) { + EventUtils.synthesizeKey("KEY_ArrowUp"); + assertState(i, -1); + } + + // Key up again. Nothing should be selected. + EventUtils.synthesizeKey("KEY_ArrowUp"); + assertState(-1, -1, value); + + await hidePopup(); +}); + +// The same as the previous task but with update 2 enabled. Opens the view +// without showing the one-offs. Makes sure they're hidden and that arrow key +// selection works properly. +add_task(async function noOneOffsUpdate2() { + // Set the update2 prefs. + await SpecialPowers.pushPrefEnv({ + set: [ + ["browser.urlbar.update2", true], + ["browser.urlbar.update2.localOneOffs", true], + ["browser.urlbar.update2.oneOffsRefresh", true], + ], + }); + + // Do a search for "@" since we hide the one-offs in that case. + let value = "@"; + await UrlbarTestUtils.promiseAutocompleteResultPopup({ + window, + value, + fireInputEvent: true, + }); + await TestUtils.waitForCondition( + () => !oneOffSearchButtons._rebuilding, + "Waiting for one-offs to finish rebuilding" + ); + + Assert.equal( + UrlbarTestUtils.getOneOffSearchButtonsVisible(window), + false, + "One-offs should be hidden" + ); + assertState(-1, -1, value); + + // Get the result count. We don't particularly care what the results are, + // just what the count is so that we can key through them all. + let resultCount = UrlbarTestUtils.getResultCount(window); + + // Key down through all results. + for (let i = 0; i < resultCount; i++) { + EventUtils.synthesizeKey("KEY_ArrowDown"); + assertState(i, -1); + } + + // Key down again. Nothing should be selected. + EventUtils.synthesizeKey("KEY_ArrowDown"); + assertState(-1, -1, value); + + // Key down again. The first result should be selected. + EventUtils.synthesizeKey("KEY_ArrowDown"); + assertState(0, -1); + + // Key up. Nothing should be selected. + EventUtils.synthesizeKey("KEY_ArrowUp"); + assertState(-1, -1, value); + + // Key up through all the results. + for (let i = resultCount - 1; i >= 0; i--) { + EventUtils.synthesizeKey("KEY_ArrowUp"); + assertState(i, -1); + } + + // Key up again. Nothing should be selected. + EventUtils.synthesizeKey("KEY_ArrowUp"); + assertState(-1, -1, value); + await hidePopup(); + await SpecialPowers.popPrefEnv(); }); // Opens the top-sites view with update2 enabled. The one-offs should be shown. -add_task(async function topSitesViewUpdate2() { +add_task(async function topSitesUpdate2() { // Set the update2 prefs. await SpecialPowers.pushPrefEnv({ set: [ ["browser.urlbar.update2", true], + ["browser.urlbar.update2.localOneOffs", true], ["browser.urlbar.update2.oneOffsRefresh", true], ], }); - // Do a search. + // Do a search that shows top sites. await UrlbarTestUtils.promiseAutocompleteResultPopup({ window, value: "", diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/components/urlbar/tests/browser/browser_oneOffs_searchSuggestions.js firefox-trunk-81.0~a1~hg20200808r544015/browser/components/urlbar/tests/browser/browser_oneOffs_searchSuggestions.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/components/urlbar/tests/browser/browser_oneOffs_searchSuggestions.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/components/urlbar/tests/browser/browser_oneOffs_searchSuggestions.js 2020-08-09 12:47:55.000000000 +0000 @@ -16,6 +16,9 @@ port: 20709, // Must be identical to what is in searchSuggestionEngine2.xml }; +var gEngine; +var gEngine2; + add_task(async function init() { await PlacesUtils.history.clear(); await UrlbarTestUtils.formHistory.clear(); @@ -25,16 +28,16 @@ ["browser.urlbar.maxHistoricalSearchSuggestions", 2], ], }); - let engine = await SearchTestUtils.promiseNewSearchEngine( + gEngine = await SearchTestUtils.promiseNewSearchEngine( getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME ); - let engine2 = await SearchTestUtils.promiseNewSearchEngine( + gEngine2 = await SearchTestUtils.promiseNewSearchEngine( getRootDirectory(gTestPath) + TEST_ENGINE2_BASENAME ); let oldDefaultEngine = await Services.search.getDefault(); - await Services.search.moveEngine(engine2, 0); - await Services.search.moveEngine(engine, 0); - await Services.search.setDefault(engine); + await Services.search.moveEngine(gEngine2, 0); + await Services.search.moveEngine(gEngine, 0); + await Services.search.setDefault(gEngine); registerCleanupFunction(async function() { await Services.search.setDefault(oldDefaultEngine); @@ -136,6 +139,7 @@ let entries = ( await UrlbarTestUtils.formHistory.search({ value: "foobar", + source: gEngine.name, }) ).map(entry => entry.value); Assert.ok(entries.includes("foobar")); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/components/urlbar/tests/browser/browser_searchModeIndicator.js firefox-trunk-81.0~a1~hg20200808r544015/browser/components/urlbar/tests/browser/browser_searchModeIndicator.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/components/urlbar/tests/browser/browser_searchModeIndicator.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/components/urlbar/tests/browser/browser_searchModeIndicator.js 2020-08-09 12:47:55.000000000 +0000 @@ -39,6 +39,7 @@ set: [ ["browser.search.separatePrivateDefault.ui.enabled", false], ["browser.urlbar.update2", true], + ["browser.urlbar.update2.localOneOffs", true], ["browser.urlbar.update2.oneOffsRefresh", true], ], }); @@ -292,8 +293,8 @@ await exitSearchMode(window, { clickClose: true, waitForSearch: false }); }); -// Tests that entering search mode invalidates pageproxystate and exits search -// mode. +// Tests that entering search mode invalidates pageproxystate and that +// pageproxystate remains invalid after exiting search mode. add_task(async function invalidate_pageproxystate() { await BrowserTestUtils.withNewTab("about:robots", async function(browser) { await UrlbarTestUtils.promisePopupOpen(window, () => { @@ -331,3 +332,145 @@ UrlbarTestUtils.assertSearchMode(window, null); await SpecialPowers.popPrefEnv(); }); + +// Tests that search mode is stored per tab and restored when switching tabs. +add_task(async function tab_switch() { + // Open three tabs. We'll enter search mode in tabs 0 and 2. + let tabs = []; + for (let i = 0; i < 3; i++) { + let tab = await BrowserTestUtils.openNewForegroundTab({ + gBrowser, + url: "http://example.com/" + i, + }); + tabs.push(tab); + } + + // Switch to tab 0. + await BrowserTestUtils.switchTab(gBrowser, tabs[0]); + + // Do a search and enter search mode. Pass fireInputEvent so that + // userTypedValue is set and restored when we switch back to this tab. This + // isn't really necessary but it simulates the user's typing, and it also + // means that we'll start a search when we switch back to this tab. + await UrlbarTestUtils.promiseAutocompleteResultPopup({ + window, + value: TEST_QUERY, + fireInputEvent: true, + }); + await enterSearchMode(window); + + // Switch to tab 1. Search mode should be exited. + await BrowserTestUtils.switchTab(gBrowser, tabs[1]); + UrlbarTestUtils.assertSearchMode(window, null); + + // Switch back to tab 0. We should do a search (for TEST_QUERY) and re-enter + // search mode. + let searchPromise = UrlbarTestUtils.promiseSearchComplete(window); + await BrowserTestUtils.switchTab(gBrowser, tabs[0]); + await searchPromise; + let oneOffs = UrlbarTestUtils.getOneOffSearchButtons( + window + ).getSelectableButtons(true); + UrlbarTestUtils.assertSearchMode(window, { + source: UrlbarUtils.RESULT_SOURCE.SEARCH, + engineName: oneOffs[0].engine.name, + }); + + // Switch to tab 2. Search mode should be exited. + await BrowserTestUtils.switchTab(gBrowser, tabs[2]); + UrlbarTestUtils.assertSearchMode(window, null); + + // Do another search (in tab 2) and enter search mode. This time, click a + // local one-off just to test a different source. + await UrlbarTestUtils.promiseAutocompleteResultPopup({ + window, + value: TEST_QUERY + " tab 2", + fireInputEvent: true, + }); + let localOneOff = UrlbarTestUtils.getOneOffSearchButtons(window) + .localButtons[0]; + Assert.ok( + localOneOff, + "Sanity check: There should be at least one local one-off" + ); + Assert.ok( + localOneOff.source, + "Sanity check: Local one-off should have a truthy source" + ); + searchPromise = UrlbarTestUtils.promiseSearchComplete(window); + EventUtils.synthesizeMouseAtCenter(localOneOff, {}); + await searchPromise; + Assert.ok(UrlbarTestUtils.isPopupOpen(window), "Urlbar view is still open."); + UrlbarTestUtils.assertSearchMode(window, { + source: localOneOff.source, + }); + + // Switch back to tab 0. We should do a search and still be in search mode. + searchPromise = UrlbarTestUtils.promiseSearchComplete(window); + await BrowserTestUtils.switchTab(gBrowser, tabs[0]); + await searchPromise; + UrlbarTestUtils.assertSearchMode(window, { + source: UrlbarUtils.RESULT_SOURCE.SEARCH, + engineName: oneOffs[0].engine.name, + }); + + // Switch to tab 1. Search mode should be exited. + await BrowserTestUtils.switchTab(gBrowser, tabs[1]); + UrlbarTestUtils.assertSearchMode(window, null); + + // Switch back to tab 2. We should do a search and re-enter search mode. + searchPromise = UrlbarTestUtils.promiseSearchComplete(window); + await BrowserTestUtils.switchTab(gBrowser, tabs[2]); + await searchPromise; + UrlbarTestUtils.assertSearchMode(window, { + source: localOneOff.source, + }); + + // Exit search mode. + await exitSearchMode(window, { clickClose: true }); + + // Switch to tab 0. We should do a search and re-enter search mode. + searchPromise = UrlbarTestUtils.promiseSearchComplete(window); + await BrowserTestUtils.switchTab(gBrowser, tabs[0]); + await searchPromise; + UrlbarTestUtils.assertSearchMode(window, { + source: UrlbarUtils.RESULT_SOURCE.SEARCH, + engineName: oneOffs[0].engine.name, + }); + + // Switch back to tab 2. We should do a search but search mode should be + // exited. + searchPromise = UrlbarTestUtils.promiseSearchComplete(window); + await BrowserTestUtils.switchTab(gBrowser, tabs[2]); + await searchPromise; + UrlbarTestUtils.assertSearchMode(window, null); + + // Switch back to tab 0. We should do a search and re-enter search mode. + searchPromise = UrlbarTestUtils.promiseSearchComplete(window); + await BrowserTestUtils.switchTab(gBrowser, tabs[0]); + await searchPromise; + UrlbarTestUtils.assertSearchMode(window, { + source: UrlbarUtils.RESULT_SOURCE.SEARCH, + engineName: oneOffs[0].engine.name, + }); + + // Exit search mode. + await exitSearchMode(window, { clickClose: true }); + + // Switch back to tab 2. We should do a search but no search mode. + searchPromise = UrlbarTestUtils.promiseSearchComplete(window); + await BrowserTestUtils.switchTab(gBrowser, tabs[2]); + await searchPromise; + UrlbarTestUtils.assertSearchMode(window, null); + + // Switch back to tab 0. We should do a search but no search mode. + searchPromise = UrlbarTestUtils.promiseSearchComplete(window); + await BrowserTestUtils.switchTab(gBrowser, tabs[0]); + await searchPromise; + UrlbarTestUtils.assertSearchMode(window, null); + + await UrlbarTestUtils.promisePopupClose(window); + for (let tab of tabs) { + BrowserTestUtils.removeTab(tab); + } +}); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/components/urlbar/tests/browser/browser_searchSuggestions.js firefox-trunk-81.0~a1~hg20200808r544015/browser/components/urlbar/tests/browser/browser_searchSuggestions.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/components/urlbar/tests/browser/browser_searchSuggestions.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/components/urlbar/tests/browser/browser_searchSuggestions.js 2020-08-09 12:47:55.000000000 +0000 @@ -58,9 +58,9 @@ EventUtils.synthesizeMouseAtCenter(element, {}, window); await loadPromise; - let formHistory = (await UrlbarTestUtils.formHistory.search()).map( - entry => entry.value - ); + let formHistory = ( + await UrlbarTestUtils.formHistory.search({ source: engineName }) + ).map(entry => entry.value); Assert.deepEqual( formHistory, ["foofoo"], @@ -113,9 +113,9 @@ if (!hasExpectedUrl) { await promiseFormHistory; - let formHistory = (await UrlbarTestUtils.formHistory.search()).map( - entry => entry.value - ); + let formHistory = ( + await UrlbarTestUtils.formHistory.search({ source: engineName }) + ).map(entry => entry.value); Assert.deepEqual( formHistory, ["foofoo"], @@ -284,9 +284,11 @@ await loadPromise; await formHistoryPromise; - formHistory = (await UrlbarTestUtils.formHistory.search()).map( - entry => entry.value - ); + formHistory = ( + await UrlbarTestUtils.formHistory.search({ + source: result.searchParams.engine, + }) + ).map(entry => entry.value); Assert.deepEqual( formHistory, ["foo"], diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/components/urlbar/tests/UrlbarTestUtils.jsm firefox-trunk-81.0~a1~hg20200808r544015/browser/components/urlbar/tests/UrlbarTestUtils.jsm --- firefox-trunk-81.0~a1~hg20200807r543684/browser/components/urlbar/tests/UrlbarTestUtils.jsm 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/components/urlbar/tests/UrlbarTestUtils.jsm 2020-08-09 12:47:55.000000000 +0000 @@ -15,7 +15,7 @@ BrowserTestUtils: "resource://testing-common/BrowserTestUtils.jsm", BrowserUtils: "resource://gre/modules/BrowserUtils.jsm", BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm", - FormHistory: "resource://gre/modules/FormHistory.jsm", + FormHistoryTestUtils: "resource://testing-common/FormHistoryTestUtils.jsm", setTimeout: "resource://gre/modules/Timer.jsm", TestUtils: "resource://testing-common/TestUtils.jsm", UrlbarController: "resource:///modules/UrlbarController.jsm", @@ -421,11 +421,13 @@ window.gURLBar._searchModeIndicatorTitle, window.gURLBar._searchModeLabel, ]) { - this.Assert.equal( - element.textContent, - expectedTextContent, - "Expected textContent" - ); + if (expectedTextContent) { + this.Assert.equal( + element.textContent, + expectedTextContent, + "Expected textContent" + ); + } this.Assert.deepEqual( window.document.l10n.getAttributes(element), expectedL10n, @@ -508,57 +510,17 @@ UrlbarTestUtils.formHistory = { /** - * Performs an operation on the urlbar's form history. - * - * @param {object} updateObject - * An object describing the form history operation. See FormHistory.jsm. - * @param {object} window - * The window containing the urlbar. - */ - async update( - updateObject = {}, - window = BrowserWindowTracker.getTopWindow() - ) { - await new Promise((resolve, reject) => { - FormHistory.update( - Object.assign( - { - fieldname: this.getFormHistoryName(window), - }, - updateObject - ), - { - handleError(error) { - reject(error); - }, - handleCompletion(errored) { - if (!errored) { - resolve(); - } - }, - } - ); - }); - }, - - /** * Adds values to the urlbar's form history. * * @param {array} values - * The form history string values to remove. + * The form history entries to remove. * @param {object} window * The window containing the urlbar. + * @returns {Promise} resolved once the operation is complete. */ - async add(values = [], window = BrowserWindowTracker.getTopWindow()) { - for (let value of values) { - await this.update( - { - value, - op: "bump", - }, - window - ); - } + add(values = [], window = BrowserWindowTracker.getTopWindow()) { + let fieldname = this.getFormHistoryName(window); + return FormHistoryTestUtils.add(fieldname, values); }, /** @@ -566,20 +528,14 @@ * history, use clearFormHistory. * * @param {array} values - * The form history string values to remove. + * The form history entries to remove. * @param {object} window * The window containing the urlbar. + * @returns {Promise} resolved once the operation is complete. */ - async remove(values = [], window = BrowserWindowTracker.getTopWindow()) { - for (let value of values) { - await this.update( - { - value, - op: "remove", - }, - window - ); - } + remove(values = [], window = BrowserWindowTracker.getTopWindow()) { + let fieldname = this.getFormHistoryName(window); + return FormHistoryTestUtils.remove(fieldname, values); }, /** @@ -588,9 +544,11 @@ * * @param {object} window * The window containing the urlbar. + * @returns {Promise} resolved once the operation is complete. */ - async clear(window = BrowserWindowTracker.getTopWindow()) { - await this.update({ op: "remove" }, window); + clear(window = BrowserWindowTracker.getTopWindow()) { + let fieldname = this.getFormHistoryName(window); + return FormHistoryTestUtils.clear(fieldname); }, /** @@ -604,31 +562,8 @@ * A promise resolved with an array of found form history entries. */ search(criteria = {}, window = BrowserWindowTracker.getTopWindow()) { - return new Promise((resolve, reject) => { - let results = []; - FormHistory.search( - null, - Object.assign( - { - fieldname: this.getFormHistoryName(window), - }, - criteria - ), - { - handleResult(result) { - results.push(result); - }, - handleError(error) { - reject(error); - }, - handleCompletion(errored) { - if (!errored) { - resolve(results); - } - }, - } - ); - }); + let fieldname = this.getFormHistoryName(window); + return FormHistoryTestUtils.search(fieldname, criteria); }, /** diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/components/urlbar/UrlbarInput.jsm firefox-trunk-81.0~a1~hg20200808r544015/browser/components/urlbar/UrlbarInput.jsm --- firefox-trunk-81.0~a1~hg20200807r543684/browser/components/urlbar/UrlbarInput.jsm 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/components/urlbar/UrlbarInput.jsm 2020-08-09 12:47:55.000000000 +0000 @@ -105,6 +105,7 @@ this._suppressStartQuery = false; this._suppressPrimaryAdjustment = false; this._untrimmedValue = ""; + this._searchModesByBrowser = new WeakMap(); UrlbarPrefs.addObserver(this); @@ -462,7 +463,11 @@ ); this._recordSearch(selectedOneOff.engine, event); - UrlbarUtils.addToFormHistory(this, searchString).catch(Cu.reportError); + UrlbarUtils.addToFormHistory( + this, + searchString, + selectedOneOff.engine.name + ).catch(Cu.reportError); } else { // Use the current value if we don't have a UrlbarResult e.g. because the // view is closed. @@ -758,7 +763,8 @@ if (!result.payload.inPrivateWindow) { UrlbarUtils.addToFormHistory( this, - result.payload.suggestion || result.payload.query + result.payload.suggestion || result.payload.query, + engine.name ).catch(Cu.reportError); } break; @@ -1161,16 +1167,27 @@ } /** - * Sets search mode and shows the search mode indicator. + * Sets search mode and shows the search mode indicator, or exits search mode. * - * @param {nsISearchEngine|SearchEngine|UrlbarUtils.RESULT_SOURCE} engineOrSource - * Either the search engine to restrict to or a UrlbarUtils.RESULT_SOURCE - * value. Exits search mode if null. + * @param {*} value + * A value of one of the following types: + * + * nsISearchEngine|SearchEngine + * The search mode source will be set to UrlbarUtils.RESULT_SOURCE.SEARCH + * using the given engine. + * UrlbarUtils.RESULT_SOURCE + * The search mode source will be set to the given source. + * search mode object + * The search mode will be set to this object. It should be a valid + * search mode object derived from one of the other types above. This is + * useful for re-entering previous search modes. + * null (or any falsey value) + * Search mode will be exited. */ - setSearchMode(engineOrSource) { + setSearchMode(value) { if (!UrlbarPrefs.get("update2")) { // Exit search mode. - engineOrSource = null; + value = null; } this._searchModeIndicatorTitle.textContent = ""; @@ -1178,25 +1195,36 @@ this._searchModeIndicatorTitle.removeAttribute("data-l10n-id"); this._searchModeLabel.removeAttribute("data-l10n-id"); - if (!engineOrSource) { + // First, set this.searchMode based on `value`. + if (!value) { this.searchMode = null; } else if ( - engineOrSource instanceof Ci.nsISearchEngine || - engineOrSource instanceof SearchEngine + value instanceof Ci.nsISearchEngine || + value instanceof SearchEngine ) { this.searchMode = { source: UrlbarUtils.RESULT_SOURCE.SEARCH, - engineName: engineOrSource.name, + engineName: value.name, }; - this._searchModeIndicatorTitle.textContent = engineOrSource.name; - this._searchModeLabel.textContent = engineOrSource.name; - } else if (typeof engineOrSource == "number") { - let sourceName = UrlbarUtils.getResultSourceName(engineOrSource); + } else if (typeof value == "number") { + this.searchMode = { source: value }; + } else if (typeof value == "object") { + this.searchMode = value; + } else { + Cu.reportError(`Unexpected search mode value: ${value}`); + this.searchMode = null; + } + + // Now set the indicator and label strings based on this.searchMode. + if (this.searchMode?.engineName) { + this._searchModeIndicatorTitle.textContent = this.searchMode.engineName; + this._searchModeLabel.textContent = this.searchMode.engineName; + } else if (this.searchMode?.source) { + let sourceName = UrlbarUtils.getResultSourceName(this.searchMode.source); if (!sourceName) { - Cu.reportError(`Unrecognized source: ${engineOrSource}`); + Cu.reportError(`Unrecognized source: ${this.searchMode.source}`); this.searchMode = null; } else { - this.searchMode = { source: engineOrSource }; let l10nID = `urlbar-search-mode-${sourceName}`; this.document.l10n.setAttributes( this._searchModeIndicatorTitle, @@ -1204,8 +1232,9 @@ ); this.document.l10n.setAttributes(this._searchModeLabel, l10nID); } - } else { - Cu.reportError(`Unexpected search mode: ${engineOrSource}`); + } else if (this.searchMode) { + Cu.reportError(`Unexpected search mode object: ${this.searchMode}`); + this.searchMode = null; } if (this.searchMode) { @@ -1215,8 +1244,13 @@ this.value = ""; this.setPageProxyState("invalid", true); } + this._searchModesByBrowser.set( + this.window.gBrowser.selectedBrowser, + this.searchMode + ); } else { this.removeAttribute("searchmode"); + this._searchModesByBrowser.delete(this.window.gBrowser.selectedBrowser); } } @@ -1421,6 +1455,12 @@ this._resetSearchState(); + // Restore the tab's search mode, if any. + let searchMode = this._searchModesByBrowser.get( + this.window.gBrowser.selectedBrowser + ); + this.setSearchMode(searchMode); + // Switching tabs doesn't always change urlbar focus, so we must try to // reopen here too, not just on focus. // We don't use the original TabSelect event because caching it causes diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/components/urlbar/UrlbarSearchOneOffs.jsm firefox-trunk-81.0~a1~hg20200808r544015/browser/components/urlbar/UrlbarSearchOneOffs.jsm --- firefox-trunk-81.0~a1~hg20200807r543684/browser/components/urlbar/UrlbarSearchOneOffs.jsm 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/components/urlbar/UrlbarSearchOneOffs.jsm 2020-08-09 12:47:55.000000000 +0000 @@ -107,6 +107,16 @@ /** * @returns {boolean} + * True if the one-offs are connected to a view. + */ + get hasView() { + // Return true if the one-offs are enabled. We set style.display = "none" + // when they're disabled, so use that to check. + return this.style.display != "none"; + } + + /** + * @returns {boolean} * True if the view is open. */ get isViewOpen() { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/components/urlbar/UrlbarUtils.jsm firefox-trunk-81.0~a1~hg20200808r544015/browser/components/urlbar/UrlbarUtils.jsm --- firefox-trunk-81.0~a1~hg20200807r543684/browser/components/urlbar/UrlbarUtils.jsm 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/components/urlbar/UrlbarUtils.jsm 2020-08-09 12:47:55.000000000 +0000 @@ -795,9 +795,11 @@ * history for the search. * @param {UrlbarInput} input The UrlbarInput object requesting the addition. * @param {string} value The value to add. + * @param {string} [source] The source of the addition, usually + * the name of the engine the search was made with. * @returns {Promise} resolved once the operation is complete */ - addToFormHistory(input, value) { + addToFormHistory(input, value, source) { // If the user types a search engine alias without a search string, // we have an empty search string and we can't bump it. // We also don't want to add history in private browsing mode. @@ -810,6 +812,7 @@ op: "bump", fieldname: input.formHistoryName, value, + source, }, { handleError: reject, diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/extensions/formautofill/FormAutofillContent.jsm firefox-trunk-81.0~a1~hg20200808r544015/browser/extensions/formautofill/FormAutofillContent.jsm --- firefox-trunk-81.0~a1~hg20200807r543684/browser/extensions/formautofill/FormAutofillContent.jsm 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/extensions/formautofill/FormAutofillContent.jsm 2020-08-09 12:47:55.000000000 +0000 @@ -553,14 +553,34 @@ } records.creditCard.forEach(record => { - let totalCount = handler.form.elements.length; - let autofilledCount = Object.keys(record.record).length; - let unmodifiedCount = record.untouchedFields.length; - const extra = { - fields_not_auto: (totalCount - autofilledCount).toString(), - fields_auto: autofilledCount.toString(), - fields_modified: (autofilledCount - unmodifiedCount).toString(), + let extra = { + // Fields which have been filled manually. + fields_not_auto: "0", + // Fields which have been autofilled. + fields_auto: "0", + // Fields which have been autofilled and then modified. + fields_modified: "0", }; + + if (record.guid !== null) { + // If the `guid` is not null, it means we're editing an existing record. + // In that case, all fields in the record are autofilled, and fields in + // `untouchedFields` are unmodified. + let totalCount = handler.form.elements.length; + let autofilledCount = Object.keys(record.record).length; + let unmodifiedCount = record.untouchedFields.length; + + extra.fields_not_auto = (totalCount - autofilledCount).toString(); + extra.fields_auto = autofilledCount.toString(); + extra.fields_modified = (autofilledCount - unmodifiedCount).toString(); + } else { + // If the `guid` is null, we're filling a new form. + // In that case, all not-null fields are manually filled. + extra.fields_not_auto = Array.from(handler.form.elements) + .filter(element => !!element.value.trim().length) + .length.toString(); + } + Services.telemetry.recordEvent( "creditcard", "submitted", diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/extensions/formautofill/FormAutofillHeuristics.jsm firefox-trunk-81.0~a1~hg20200808r544015/browser/extensions/formautofill/FormAutofillHeuristics.jsm --- firefox-trunk-81.0~a1~hg20200807r543684/browser/extensions/formautofill/FormAutofillHeuristics.jsm 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/extensions/formautofill/FormAutofillHeuristics.jsm 2020-08-09 12:47:55.000000000 +0000 @@ -35,6 +35,21 @@ const DEFAULT_SECTION_NAME = "-moz-section-default"; /** + * To help us classify sections, we want to know what fields can appear + * multiple times in a row. + * Such fields, like `address-line{X}`, should not break sections. + */ +const MULTI_FIELD_NAMES = [ + "address-level3", + "address-level2", + "address-level1", + "tel", + "postal-code", + "email", + "street-address", +]; + +/** * A scanner for traversing all elements in a form and retrieving the field * detail with FormAutofillHeuristics.getInfo function. It also provides a * cursor (parsingIndex) to indicate which element is waiting for parsing. @@ -141,7 +156,8 @@ } if ( seenTypes.has(fieldDetail.fieldName) && - previousType != fieldDetail.fieldName + (previousType != fieldDetail.fieldName || + !MULTI_FIELD_NAMES.includes(fieldDetail.fieldName)) ) { seenTypes.clear(); sectionCount++; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_telemetry.js firefox-trunk-81.0~a1~hg20200808r544015/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_telemetry.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_telemetry.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_telemetry.js 2020-08-09 12:47:55.000000000 +0000 @@ -232,9 +232,10 @@ "cc_form", undefined, { - fields_not_auto: "3", - fields_auto: "5", - fields_modified: "5", + // 5 fields plus submit button + fields_not_auto: "6", + fields_auto: "0", + fields_modified: "0", }, ], ]; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/extensions/formautofill/test/browser/creditCard/browser.ini firefox-trunk-81.0~a1~hg20200808r544015/browser/extensions/formautofill/test/browser/creditCard/browser.ini --- firefox-trunk-81.0~a1~hg20200807r543684/browser/extensions/formautofill/test/browser/creditCard/browser.ini 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/extensions/formautofill/test/browser/creditCard/browser.ini 2020-08-09 12:47:55.000000000 +0000 @@ -12,6 +12,7 @@ head_cc.js [browser_creditCard_doorhanger.js] +skip-if = !debug && os == "mac" # perma-fail see Bug 1655601 [browser_creditCard_dropdown_layout.js] skip-if = !debug && os == "mac" # perma-fail see Bug 1600059 [browser_creditCard_fill_cancel_login.js] diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/extensions/formautofill/test/fixtures/third_party/Lush/index.html firefox-trunk-81.0~a1~hg20200808r544015/browser/extensions/formautofill/test/fixtures/third_party/Lush/index.html --- firefox-trunk-81.0~a1~hg20200807r543684/browser/extensions/formautofill/test/fixtures/third_party/Lush/index.html 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/extensions/formautofill/test/fixtures/third_party/Lush/index.html 2020-08-09 12:47:55.000000000 +0000 @@ -0,0 +1,421 @@ + + + + + + + Step 1: Choose your Payment Method + + + + + + + + + + + + + + + + + +
+
+
+
    +
  1. + + + Addresses +
  2. + +
  3. + + + Payment +
  4. + +
+
+
+
+
+ +
+
+ + +
+
+ +
+ +
+
+ +
+
+ + + + +

Step 1: Please select your payment method

+ +
+ Total payment amount GBP 31.40 +
+ + +
    + + + + +
  • + + + + + +
    + + + + +

    + + + + + + + + + + + + + + + + +
    Name
    Card Number
    +
    +
    + If there is not enough balance on my card, pay the rest of the payment amount with an other payment method. +
    + +
    + +

    + + + + +
  • + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    Card Number
    Card Holder Name
    + +
    Card Expiry Date
    +
    + +  /  + +
    +
    CVC/CVV/CID
    + +
    + + + + + + + + + + + +
  • + + + + + +
    + + + + + + + + + + + +
    + Pay using your PayPal account. You will be redirected to the PayPal system to complete the payment. +
    + +
    +
    +
  • + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + +
+
+ + + + + + + diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Lush.js firefox-trunk-81.0~a1~hg20200808r544015/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Lush.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Lush.js 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Lush.js 2020-08-09 12:47:55.000000000 +0000 @@ -0,0 +1,56 @@ +/* global runHeuristicsTest */ + +"use strict"; + +runHeuristicsTest( + [ + { + fixturePath: "index.html", + expectedResult: [ + [ + [ + { + section: "", + addressType: "", + contactType: "", + fieldName: "cc-name", + }, + { + section: "", + addressType: "", + contactType: "", + fieldName: "cc-number", + }, + ], + [ + { + section: "", + addressType: "", + contactType: "", + fieldName: "cc-number", + }, + { + section: "", + addressType: "", + contactType: "", + fieldName: "cc-name", + }, + { + section: "", + addressType: "", + contactType: "", + fieldName: "cc-exp-month", + }, + { + section: "", + addressType: "", + contactType: "", + fieldName: "cc-exp-year", + }, + ], + ], + ], + }, + ], + "../../../fixtures/third_party/Lush/" +); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/extensions/formautofill/test/unit/xpcshell.ini firefox-trunk-81.0~a1~hg20200808r544015/browser/extensions/formautofill/test/unit/xpcshell.ini --- firefox-trunk-81.0~a1~hg20200807r543684/browser/extensions/formautofill/test/unit/xpcshell.ini 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/extensions/formautofill/test/unit/xpcshell.ini 2020-08-09 12:47:55.000000000 +0000 @@ -5,21 +5,39 @@ ../fixtures/** [heuristics/test_basic.js] +skip-if = linux && ccov # bug 1614100 [heuristics/test_cc_exp.js] +skip-if = linux && ccov # bug 1614100 [heuristics/test_de_fields.js] +skip-if = linux && ccov # bug 1614100 [heuristics/test_known_strings.js] +skip-if = linux && ccov # bug 1614100 [heuristics/test_multiple_section.js] +skip-if = linux && ccov # bug 1614100 [heuristics/third_party/test_BestBuy.js] +skip-if = linux && ccov # bug 1650904 [heuristics/third_party/test_CDW.js] +skip-if = linux && ccov # bug 1650904 [heuristics/third_party/test_CostCo.js] +skip-if = linux && ccov # bug 1650904 [heuristics/third_party/test_HomeDepot.js] +skip-if = linux && ccov # bug 1650904 [heuristics/third_party/test_Macys.js] +skip-if = linux && ccov # bug 1650904 [heuristics/third_party/test_NewEgg.js] +skip-if = linux && ccov # bug 1650904 [heuristics/third_party/test_OfficeDepot.js] +skip-if = linux && ccov # bug 1650904 [heuristics/third_party/test_QVC.js] +skip-if = linux && ccov # bug 1650904 [heuristics/third_party/test_Sears.js] +skip-if = linux && ccov # bug 1650904 [heuristics/third_party/test_Staples.js] +skip-if = linux && ccov # bug 1650904 [heuristics/third_party/test_Walmart.js] +skip-if = linux && ccov # bug 1650904 +[heuristics/third_party/test_Lush.js] +skip-if = linux && ccov # bug 1650904 [test_activeStatus.js] [test_addressDataLoader.js] [test_addressRecords.js] diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/locales/en-US/browser/safebrowsing/blockedSite.ftl firefox-trunk-81.0~a1~hg20200808r544015/browser/locales/en-US/browser/safebrowsing/blockedSite.ftl --- firefox-trunk-81.0~a1~hg20200807r543684/browser/locales/en-US/browser/safebrowsing/blockedSite.ftl 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/locales/en-US/browser/safebrowsing/blockedSite.ftl 2020-08-09 12:47:55.000000000 +0000 @@ -18,7 +18,7 @@ safeb-blocked-phishing-page-learn-more = Learn more about deceptive sites and phishing at www.antiphishing.org. Learn more about { -brand-short-name }’s Phishing and Malware Protection at support.mozilla.org. safeb-blocked-malware-page-error-desc-override = { $sitename } has been reported as containing malicious software. You can report a detection problem or ignore the risk and go to this unsafe site. safeb-blocked-malware-page-error-desc-no-override = { $sitename } has been reported as containing malicious software. You can report a detection problem. -safeb-blocked-malware-page-learn-more = Learn more about harmful web content including viruses and other malware and how to protect your computer at StopBadware.org. Learn more about { -brand-short-name }’s Phishing and Malware Protection at support.mozilla.org. +safeb-blocked-malware-page-learn-more-sumo = Learn more about { -brand-short-name }’s Phishing and Malware Protection at support.mozilla.org. safeb-blocked-unwanted-page-error-desc-override = { $sitename } has been reported as containing harmful software. You can ignore the risk and go to this unsafe site. safeb-blocked-unwanted-page-error-desc-no-override = { $sitename } has been reported as containing harmful software. safeb-blocked-unwanted-page-learn-more = Learn more about harmful and unwanted software at Unwanted Software Policy. Learn more about { -brand-short-name }’s Phishing and Malware Protection at support.mozilla.org. diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/browser/modules/test/browser/browser_ContentSearch.js firefox-trunk-81.0~a1~hg20200808r544015/browser/modules/test/browser/browser_ContentSearch.js --- firefox-trunk-81.0~a1~hg20200807r543684/browser/modules/test/browser/browser_ContentSearch.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/browser/modules/test/browser/browser_ContentSearch.js 2020-08-09 12:47:55.000000000 +0000 @@ -250,7 +250,10 @@ // Add a form history suggestion and wait for Satchel to notify about it. sendEventToContent(browser, { type: "AddFormHistoryEntry", - data: searchStr + "form", + data: { + value: searchStr + "form", + engineName: engine.name, + }, }); await new Promise(resolve => { Services.obs.addObserver(function onAdd(subj, topic, data) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/build/moz.configure/init.configure firefox-trunk-81.0~a1~hg20200808r544015/build/moz.configure/init.configure --- firefox-trunk-81.0~a1~hg20200807r543684/build/moz.configure/init.configure 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/build/moz.configure/init.configure 2020-08-09 12:47:56.000000000 +0000 @@ -304,7 +304,7 @@ virtualenvs_root = os.path.join(topobjdir, '_virtualenvs') with LineIO(lambda l: log.info(l), 'replace') as out: manager = VirtualenvManager( - topsrcdir, topobjdir, + topsrcdir, os.path.join(virtualenvs_root, 'init_py3'), out, os.path.join(topsrcdir, 'build', 'virtualenv_packages.txt')) diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/build/moz.configure/windows.configure firefox-trunk-81.0~a1~hg20200808r544015/build/moz.configure/windows.configure --- firefox-trunk-81.0~a1~hg20200807r543684/build/moz.configure/windows.configure 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/build/moz.configure/windows.configure 2020-08-09 12:47:56.000000000 +0000 @@ -457,30 +457,6 @@ return result -# allow_missing=True for mingw builds, until bug 1617793 -mt = check_prog('MT', ('mt.exe',), allow_missing=True, paths=sdk_bin_path) - - -# Check that MT is not something unexpected like "magnetic tape manipulation -# utility". -@depends(mt, wine) -@checking('whether MT is really Microsoft Manifest Tool', lambda x: bool(x)) -def valid_mt(path, wine): - if not path: - return None - if wine and path.lower().endswith('.exe'): - out = check_cmd_output(wine, path, onerror=lambda: '').splitlines() - else: - out = check_cmd_output(path, onerror=lambda: '').splitlines() - out = '\n'.join(l for l in out - if 'Microsoft (R) Manifest Tool' in l) - if out: - return path - raise FatalCheckError('%s is not Microsoft Manifest Tool') - - -set_config('MSMANIFEST_TOOL', depends(valid_mt)(lambda x: bool(x))) - js_option(env='LINKER', nargs=1, when=target_is_windows, help='Path to the linker') link = check_prog('LINKER', ('lld-link',), input='LINKER', diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/build/valgrind/mach_commands.py firefox-trunk-81.0~a1~hg20200808r544015/build/valgrind/mach_commands.py --- firefox-trunk-81.0~a1~hg20200807r543684/build/valgrind/mach_commands.py 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/build/valgrind/mach_commands.py 2020-08-09 12:47:56.000000000 +0000 @@ -32,10 +32,6 @@ ''' Run Valgrind tests. ''' - - def __init__(self, context): - MachCommandBase.__init__(self, context) - @Command('valgrind-test', category='testing', conditions=[conditions.is_firefox_or_thunderbird, is_valgrind_build], description='Run the Valgrind test job (memory-related errors).') diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/build/virtualenv_packages.txt firefox-trunk-81.0~a1~hg20200808r544015/build/virtualenv_packages.txt --- firefox-trunk-81.0~a1~hg20200807r543684/build/virtualenv_packages.txt 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/build/virtualenv_packages.txt 2020-08-09 12:47:56.000000000 +0000 @@ -72,7 +72,6 @@ mozilla.pth:third_party/python/yamllint mozilla.pth:third_party/python/zipp mozilla.pth:build -objdir:build mozilla.pth:config mozilla.pth:config/mozunit mozilla.pth:dom/bindings diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/BUILDID firefox-trunk-81.0~a1~hg20200808r544015/BUILDID --- firefox-trunk-81.0~a1~hg20200807r543684/BUILDID 2020-08-07 06:01:14.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/BUILDID 2020-08-09 12:55:13.000000000 +0000 @@ -1 +1 @@ -20200807075315 \ No newline at end of file +20200809144508 \ No newline at end of file diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/config/create_rc.py firefox-trunk-81.0~a1~hg20200808r544015/config/create_rc.py --- firefox-trunk-81.0~a1~hg20200807r543684/config/create_rc.py 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/config/create_rc.py 2020-08-09 12:47:56.000000000 +0000 @@ -0,0 +1,198 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +from datetime import datetime +import io +import os +import sys + +from mozbuild.preprocessor import Preprocessor +import buildconfig + + +TEMPLATE = ''' +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include +#include + +// Note: if you contain versioning information in an included +// RC script, it will be discarded +// Use module.ver to explicitly set these values + +// Do not edit this file. Changes won't affect the build. + +{include} + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +1 VERSIONINFO + FILEVERSION {fileversion} + PRODUCTVERSION {productversion} + FILEFLAGSMASK 0x3fL + FILEFLAGS {fileflags} + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "Comments", "{comment}" + VALUE "LegalCopyright", "{copyright}" + VALUE "CompanyName", "{company}" + VALUE "FileDescription", "{description}" + VALUE "FileVersion", "{mfversion}" + VALUE "ProductVersion", "{mpversion}" + VALUE "InternalName", "{module}" + VALUE "LegalTrademarks", "{trademarks}" + VALUE "OriginalFilename", "{binary}" + VALUE "ProductName", "{productname}" + VALUE "BuildID", "{buildid}" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END + +''' + + +def preprocess(path, defines): + pp = Preprocessor(defines=defines, marker='%') + pp.context.update(defines) + pp.out = io.StringIO() + pp.do_filter('substitution') + pp.do_include(io.open(path, 'r', encoding='latin1')) + pp.out.seek(0) + return pp.out + + +def parse_module_ver(path, defines): + result = {} + for line in preprocess(path, defines): + content, *comment = line.split('#', 1) + if not content.strip(): + continue + entry, value = content.split('=', 1) + result[entry.strip()] = value.strip() + return result + + +def get_buildid(): + path = os.path.join(buildconfig.topobjdir, 'buildid.h') + define, MOZ_BUILDID, buildid = io.open(path, 'r', encoding='utf-8').read().split() + return buildid + + +def days_from_2000_to_buildid(buildid): + start = datetime(2000, 1, 1, 0, 0, 0) + buildid_time = datetime.strptime(buildid, '%Y%m%d%H%M%S') + return (buildid_time - start).days + + +def digits_only(s): + for l in range(len(s), 0, -1): + if s[:l].isdigit(): + return s[:l] + return '0' + + +def split_and_normalize_version(version, len): + return ([digits_only(x) for x in version.split('.')] + ['0'] * len)[:len] + + +def has_manifest(module_rc, manifest_id): + for line in module_rc.splitlines(): + line = line.split(None, 2) + if len(line) < 2: + continue + id, what, *rest = line + if id == manifest_id and what in ('24', 'RT_MANIFEST'): + return True + return False + + +def generate_module_rc(binary='', rcinclude=None): + deps = set() + buildid = get_buildid() + milestone = buildconfig.substs['GRE_MILESTONE'] + app_version = buildconfig.substs.get('MOZ_APP_VERSION') or milestone + app_winversion = ','.join(split_and_normalize_version(app_version, 4)) + milestone_winversion = ','.join(split_and_normalize_version(milestone, 3) + + [str(days_from_2000_to_buildid(buildid))]) + display_name = buildconfig.substs.get('MOZ_APP_DISPLAYNAME', 'Mozilla') + + milestone_string = milestone + + flags = ['0'] + if buildconfig.substs.get('MOZ_DEBUG'): + flags.append('VS_FF_DEBUG') + milestone_string += ' Debug' + if not buildconfig.substs.get('MOZILLA_OFFICIAL'): + flags.append('VS_FF_PRIVATEBUILD') + if buildconfig.substs.get('NIGHTLY_BUILD'): + flags.append('VS_FF_PRERELEASE') + + defines = { + 'MOZ_APP_DISPLAYNAME': display_name, + 'MOZ_APP_VERSION': app_version, + 'MOZ_APP_WINVERSION': app_winversion, + } + + relobjdir = os.path.relpath('.', buildconfig.topobjdir) + srcdir = os.path.join(buildconfig.topsrcdir, relobjdir) + module_ver = os.path.join(srcdir, 'module.ver') + if os.path.exists(module_ver): + deps.add(module_ver) + overrides = parse_module_ver(module_ver, defines) + else: + overrides = {} + + if rcinclude: + include = '// From included resource {}\n{}'.format( + rcinclude, preprocess(rcinclude, defines).read()) + else: + include = '' + + data = TEMPLATE.format( + include=include, + fileversion=overrides.get('WIN32_MODULE_FILEVERSION', milestone_winversion), + productversion=overrides.get('WIN32_MODULE_PRODUCTVERSION', milestone_winversion), + fileflags=' | '.join(flags), + comment=overrides.get('WIN32_MODULE_COMMENT', ''), + copyright=overrides.get('WIN32_MODULE_COPYRIGHT', 'License: MPL 2'), + company=overrides.get('WIN32_MODULE_COMPANYNAME', 'Mozilla Foundation'), + description=overrides.get('WIN32_MODULE_DESCRIPTION', ''), + mfversion=overrides.get('WIN32_MODULE_FILEVERSION_STRING', milestone_string), + mpversion=overrides.get('WIN32_MODULE_PRODUCTVERSION_STRING', milestone_string), + module=overrides.get('WIN32_MODULE_NAME', ''), + trademarks=overrides.get('WIN32_MODULE_TRADEMARKS', 'Mozilla'), + binary=overrides.get('WIN32_MODULE_ORIGINAL_FILENAME', binary), + productname=overrides.get('WIN32_MODULE_PRODUCTNAME', display_name), + buildid=buildid, + ) + + manifest_id = '2' if binary.lower().endswith('.dll') else '1' + if binary and not has_manifest(data, manifest_id): + manifest_path = os.path.join(srcdir, binary + '.manifest') + if os.path.exists(manifest_path): + manifest_path = manifest_path.replace('\\', '\\\\') + data += '\n{} RT_MANIFEST "{}"\n'.format(manifest_id, manifest_path) + + with io.open('{}.rc'.format(binary or 'module'), 'w', encoding='latin1') as fh: + fh.write(data) + + +if __name__ == '__main__': + generate_module_rc(*sys.argv[1:]) diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/config/makefiles/rust.mk firefox-trunk-81.0~a1~hg20200808r544015/config/makefiles/rust.mk --- firefox-trunk-81.0~a1~hg20200807r543684/config/makefiles/rust.mk 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/config/makefiles/rust.mk 2020-08-09 12:47:56.000000000 +0000 @@ -363,9 +363,9 @@ GARBAGE_DIRS += $(RUST_TARGET) -force-cargo-program-build: $(RESFILE) +force-cargo-program-build: $(call resfile,module) $(REPORT_BUILD) - $(call CARGO_BUILD) $(addprefix --bin ,$(RUST_CARGO_PROGRAMS)) $(cargo_target_flag) -- $(if $(RESFILE),-C link-arg=$(CURDIR)/$(RESFILE)) + $(call CARGO_BUILD) $(addprefix --bin ,$(RUST_CARGO_PROGRAMS)) $(cargo_target_flag) -- $(addprefix -C link-arg=$(CURDIR)/,$(call resfile,module)) $(RUST_PROGRAMS): force-cargo-program-build ; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/config/rules.mk firefox-trunk-81.0~a1~hg20200808r544015/config/rules.mk --- firefox-trunk-81.0~a1~hg20200807r543684/config/rules.mk 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/config/rules.mk 2020-08-09 12:47:56.000000000 +0000 @@ -20,10 +20,6 @@ include $(topsrcdir)/config/config.mk endif -ifndef INCLUDED_VERSION_MK -include $(MOZILLA_DIR)/config/version.mk -endif - USE_AUTOTARGETS_MK = 1 include $(MOZILLA_DIR)/config/makefiles/makeutils.mk @@ -103,8 +99,6 @@ MKSHLIB = $(MKCSHLIB) endif -EMBED_MANIFEST_AT=2 - endif # MKSHLIB endif # FORCE_SHARED_LIB @@ -405,6 +399,17 @@ # Dependencies which, if modified, should cause everything to rebuild GLOBAL_DEPS += Makefile $(addprefix $(DEPTH)/config/,$(INCLUDED_AUTOCONF_MK)) $(MOZILLA_DIR)/config/config.mk +ifeq ($(MOZ_WIDGET_TOOLKIT),windows) +# We always build .res files for programs and shared libraries +resfile = $(notdir $1).res +# We also build .res files for simple programs if a corresponding manifest +# exists. We'll generate a .rc file that includes the manifest. +resfile_for_manifest = $(if $(wildcard $(srcdir)/$(notdir $1).manifest),$(call resfile,$1)) +else +resfile = +resfile_for_manifest = +endif + ############################################## ifdef COMPILE_ENVIRONMENT compile:: host target @@ -454,22 +459,12 @@ # PROGRAM = Foo # creates OBJS, links with LIBS to create Foo # -$(PROGRAM): $(PROGOBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(RESFILE) $(GLOBAL_DEPS) $(call mkdir_deps,$(FINAL_TARGET)) +$(PROGRAM): $(PROGOBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(call resfile,$(PROGRAM)) $(GLOBAL_DEPS) $(call mkdir_deps,$(FINAL_TARGET)) $(REPORT_BUILD) - @$(RM) $@.manifest ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) - $(LINKER) -OUT:$@ -PDB:$(LINK_PDBFILE) -IMPLIB:$(basename $(@F)).lib $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $($(notdir $@)_OBJS) $(RESFILE) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS) -ifdef MSMANIFEST_TOOL - @if test -f $@.manifest; then \ - echo "Manifest in objdir is not supported"; \ - exit 1; \ - elif test -f '$(srcdir)/$(notdir $@).manifest'; then \ - echo 'Embedding manifest from $(srcdir_rel)/$(notdir $@).manifest'; \ - $(call WINEWRAP,$(MT)) -NOLOGO -MANIFEST '$(srcdir_rel)/$(notdir $@).manifest' -OUTPUTRESOURCE:$@\;1; \ - fi -endif # MSVC with manifest tool + $(LINKER) -OUT:$@ -PDB:$(LINK_PDBFILE) -IMPLIB:$(basename $(@F)).lib $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $($(notdir $@)_OBJS) $(filter %.res,$^) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS) else # !WINNT || GNU_CC - $(call EXPAND_CC_OR_CXX,$@) -o $@ $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $($(notdir $@)_OBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS) + $(call EXPAND_CC_OR_CXX,$@) -o $@ $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $($(notdir $@)_OBJS) $(filter %.res,$^) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS) $(call py_action,check_binary,--target $@) endif # WINNT && !GNU_CC @@ -484,15 +479,6 @@ $(REPORT_BUILD) ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH)) $(HOST_LINKER) -OUT:$@ -PDB:$(HOST_PDBFILE) $($(notdir $@)_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LINKER_LIBPATHS) $(HOST_LIBS) $(HOST_EXTRA_LIBS) -ifdef MSMANIFEST_TOOL - @if test -f $@.manifest; then \ - echo "Manifest in objdir is not supported"; \ - exit 1; \ - elif test -f '$(srcdir)/$(notdir $@).manifest'; then \ - echo 'Embedding manifest from $(srcdir_rel)/$(notdir $@).manifest'; \ - $(call WINEWRAP,$(MT)) -NOLOGO -MANIFEST '$(srcdir_rel)/$(notdir $@).manifest' -OUTPUTRESOURCE:$@\;1; \ - fi -endif # MSVC with manifest tool else ifeq ($(HOST_CPP_PROG_LINK),1) $(HOST_CXX) -o $@ $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $($(notdir $@)_OBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS) @@ -512,20 +498,17 @@ # SIMPLE_PROGRAMS = Foo Bar # creates Foo.o Bar.o, links with LIBS to create Foo, Bar. # -$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS) +define simple_program_deps +$1: $(1:$(BIN_SUFFIX)=.$(OBJ_SUFFIX)) $(STATIC_LIBS) $(EXTRA_DEPS) $(call resfile_for_manifest,$1) $(GLOBAL_DEPS) +endef +$(foreach p,$(SIMPLE_PROGRAMS),$(eval $(call simple_program_deps,$(p)))) + +$(SIMPLE_PROGRAMS): $(REPORT_BUILD) ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) - $(LINKER) -out:$@ -pdb:$(LINK_PDBFILE) $($@_OBJS) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS) -ifdef MSMANIFEST_TOOL - @if test -f $@.manifest; then \ - echo "Manifest in objdir is not supported"; \ - exit 1; \ - elif test -f '$(srcdir)/$(notdir $@).manifest'; then \ - $(call WINEWRAP,$(MT)) -NOLOGO -MANIFEST '$(srcdir_rel)/$(notdir $@).manifest' -OUTPUTRESOURCE:$@\;1; \ - fi -endif # MSVC with manifest tool + $(LINKER) -out:$@ -pdb:$(LINK_PDBFILE) $($@_OBJS) $(filter %.res,$^) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS) else - $(call EXPAND_CC_OR_CXX,$@) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) -o $@ $($@_OBJS) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS) + $(call EXPAND_CC_OR_CXX,$@) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) -o $@ $($@_OBJS) $(filter %.res,$^) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS) $(call py_action,check_binary,--target $@) endif # WINNT && !GNU_CC @@ -600,26 +583,15 @@ # symlinks back to the originals. The symlinks are a no-op for stabs debugging, # so no need to conditionalize on OS version or debugging format. -$(SHARED_LIBRARY): $(OBJS) $(RESFILE) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS) +$(SHARED_LIBRARY): $(OBJS) $(call resfile,$(SHARED_LIBRARY)) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS) $(REPORT_BUILD) ifndef INCREMENTAL_LINKER $(RM) $@ endif - $(MKSHLIB) $($@_OBJS) $(RESFILE) $(LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) + $(MKSHLIB) $($@_OBJS) $(filter %.res,$^) $(LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(call py_action,check_binary,--target $@) ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) -ifdef MSMANIFEST_TOOL -ifdef EMBED_MANIFEST_AT - @if test -f $@.manifest; then \ - echo "Manifest in objdir is not supported"; \ - exit 1; \ - elif test -f '$(srcdir)/$@.manifest'; then \ - echo 'Embedding manifest from $(srcdir_rel)/$@.manifest'; \ - $(call WINEWRAP,$(MT)) -NOLOGO -MANIFEST '$(srcdir_rel)/$@.manifest' -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \ - fi -endif # EMBED_MANIFEST_AT -endif # MSVC with manifest tool endif # WINNT && !GCC chmod +x $@ ifdef ENABLE_STRIP @@ -863,7 +835,8 @@ endif -$(RESFILE): %.res: $(RCFILE) +# EXTRA_DEPS contains manifests (manually added in Makefile.in ; bug 1498414) +%.res: $(or $(RCFILE),%.rc) $(EXTRA_DEPS) $(REPORT_BUILD) @echo Creating Resource file: $@ ifdef GNU_CC @@ -872,6 +845,9 @@ $(call WINEWRAP,$(RC)) $(RCFLAGS) -r $(DEFINES) $(INCLUDES:-I%=-I$(call relativize,%)) $(OUTOPTION)$@ $(call relativize,$<) endif +$(notdir $(addsuffix .rc,$(PROGRAM) $(SHARED_LIBRARY) $(SIMPLE_PROGRAMS) module)): %.rc: $(RCINCLUDE) $(MOZILLA_DIR)/config/create_rc.py + $(PYTHON3) $(MOZILLA_DIR)/config/create_rc.py '$(if $(filter module,$*),,$*)' '$(RCINCLUDE)' + # Cancel GNU make built-in implicit rules MAKEFLAGS += -r diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/config/version.mk firefox-trunk-81.0~a1~hg20200808r544015/config/version.mk --- firefox-trunk-81.0~a1~hg20200807r543684/config/version.mk 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/config/version.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -ifndef INCLUDED_VERSION_MK -INCLUDED_VERSION_MK=1 - -# Windows gmake build: -# Build default .rc file if $(RESFILE) isn't defined. -# TODO: -# PBI : Private build info. Not used currently. -# Guessing the best way would be to set an env var. -# BINARY : Binary name. Not used currently. -ifeq ($(MOZ_WIDGET_TOOLKIT),windows) -ifndef RESFILE -RCFILE=./module.rc -RESFILE=./module.res -ifdef PROGRAM -_RC_BINARY = $(notdir $(PROGRAM)) -else -ifdef _PROGRAM -_RC_BINARY = $(notdir $(_PROGRAM)) -else -ifdef SHARED_LIBRARY -_RC_BINARY = $(notdir $(SHARED_LIBRARY)) -endif -endif -endif - -GARBAGE += $(RESFILE) $(RCFILE) - -#dummy target so $(RCFILE) doesn't become the default =P -all:: - -$(RCFILE): $(RCINCLUDE) $(MOZILLA_DIR)/config/version_win.py - $(PYTHON3) $(MOZILLA_DIR)/config/version_win.py '$(_RC_BINARY)' '$(RCINCLUDE)' - -endif # RESFILE -endif # Windows - -endif diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/config/version_win.py firefox-trunk-81.0~a1~hg20200808r544015/config/version_win.py --- firefox-trunk-81.0~a1~hg20200807r543684/config/version_win.py 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/config/version_win.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,178 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -from datetime import datetime -import io -import os -import sys - -from mozbuild.preprocessor import Preprocessor -import buildconfig - - -TEMPLATE = ''' -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. - -#include - -// Note: if you contain versioning information in an included -// RC script, it will be discarded -// Use module.ver to explicitly set these values - -// Do not edit this file. Changes won't affect the build. - -{include} - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -1 VERSIONINFO - FILEVERSION {fileversion} - PRODUCTVERSION {productversion} - FILEFLAGSMASK 0x3fL - FILEFLAGS {fileflags} - FILEOS VOS__WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "Comments", "{comment}" - VALUE "LegalCopyright", "{copyright}" - VALUE "CompanyName", "{company}" - VALUE "FileDescription", "{description}" - VALUE "FileVersion", "{mfversion}" - VALUE "ProductVersion", "{mpversion}" - VALUE "InternalName", "{module}" - VALUE "LegalTrademarks", "{trademarks}" - VALUE "OriginalFilename", "{binary}" - VALUE "ProductName", "{productname}" - VALUE "BuildID", "{buildid}" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END -END - -''' - - -def preprocess(path, defines): - pp = Preprocessor(defines=defines, marker='%') - pp.context.update(defines) - pp.out = io.StringIO() - pp.do_filter('substitution') - pp.do_include(io.open(path, 'r', encoding='latin1')) - pp.out.seek(0) - return pp.out - - -def parse_module_ver(path, defines): - result = {} - for line in preprocess(path, defines): - content, *comment = line.split('#', 1) - if not content.strip(): - continue - entry, value = content.split('=', 1) - result[entry.strip()] = value.strip() - return result - - -def get_buildid(): - path = os.path.join(buildconfig.topobjdir, 'buildid.h') - define, MOZ_BUILDID, buildid = io.open(path, 'r', encoding='utf-8').read().split() - return buildid - - -def days_from_2000_to_buildid(buildid): - start = datetime(2000, 1, 1, 0, 0, 0) - buildid_time = datetime.strptime(buildid, '%Y%m%d%H%M%S') - return (buildid_time - start).days - - -def digits_only(s): - for l in range(len(s), 0, -1): - if s[:l].isdigit(): - return s[:l] - return '0' - - -def split_and_normalize_version(version, len): - return ([digits_only(x) for x in version.split('.')] + ['0'] * len)[:len] - - -def generate_module_rc(binary='', rcinclude=None): - deps = set() - buildid = get_buildid() - milestone = buildconfig.substs['GRE_MILESTONE'] - app_version = buildconfig.substs.get('MOZ_APP_VERSION') or milestone - app_winversion = ','.join(split_and_normalize_version(app_version, 4)) - milestone_winversion = ','.join(split_and_normalize_version(milestone, 3) + - [str(days_from_2000_to_buildid(buildid))]) - display_name = buildconfig.substs.get('MOZ_APP_DISPLAYNAME', 'Mozilla') - - milestone_string = milestone - - flags = ['0'] - if buildconfig.substs.get('MOZ_DEBUG'): - flags.append('VS_FF_DEBUG') - milestone_string += ' Debug' - if not buildconfig.substs.get('MOZILLA_OFFICIAL'): - flags.append('VS_FF_PRIVATEBUILD') - if buildconfig.substs.get('NIGHTLY_BUILD'): - flags.append('VS_FF_PRERELEASE') - - defines = { - 'MOZ_APP_DISPLAYNAME': display_name, - 'MOZ_APP_VERSION': app_version, - 'MOZ_APP_WINVERSION': app_winversion, - } - - relobjdir = os.path.relpath('.', buildconfig.topobjdir) - srcdir = os.path.join(buildconfig.topsrcdir, relobjdir) - module_ver = os.path.join(srcdir, 'module.ver') - if os.path.exists(module_ver): - deps.add(module_ver) - overrides = parse_module_ver(module_ver, defines) - else: - overrides = {} - - if rcinclude: - include = '// From included resource {}\n{}'.format( - rcinclude, preprocess(rcinclude, defines).read()) - else: - include = '' - - data = TEMPLATE.format( - include=include, - fileversion=overrides.get('WIN32_MODULE_FILEVERSION', milestone_winversion), - productversion=overrides.get('WIN32_MODULE_PRODUCTVERSION', milestone_winversion), - fileflags=' | '.join(flags), - comment=overrides.get('WIN32_MODULE_COMMENT', ''), - copyright=overrides.get('WIN32_MODULE_COPYRIGHT', 'License: MPL 2'), - company=overrides.get('WIN32_MODULE_COMPANYNAME', 'Mozilla Foundation'), - description=overrides.get('WIN32_MODULE_DESCRIPTION', ''), - mfversion=overrides.get('WIN32_MODULE_FILEVERSION_STRING', milestone_string), - mpversion=overrides.get('WIN32_MODULE_PRODUCTVERSION_STRING', milestone_string), - module=overrides.get('WIN32_MODULE_NAME', ''), - trademarks=overrides.get('WIN32_MODULE_TRADEMARKS', 'Mozilla'), - binary=overrides.get('WIN32_MODULE_ORIGINAL_FILENAME', binary), - productname=overrides.get('WIN32_MODULE_PRODUCTNAME', display_name), - buildid=buildid, - ) - with io.open('module.rc', 'w', encoding='latin1') as fh: - fh.write(data) - - -if __name__ == '__main__': - generate_module_rc(*sys.argv[1:]) diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/debian/changelog firefox-trunk-81.0~a1~hg20200808r544015/debian/changelog --- firefox-trunk-81.0~a1~hg20200807r543684/debian/changelog 2020-08-07 06:06:47.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/debian/changelog 2020-08-09 13:01:26.000000000 +0000 @@ -1,4 +1,4 @@ -firefox-trunk (81.0~a1~hg20200807r543684-0ubuntu0.20.04.1~umd1) focal; urgency=emergency +firefox-trunk (81.0~a1~hg20200808r544015-0ubuntu0.20.04.1~umd1) focal; urgency=emergency * Use clang 11 if available and drop 9 - debian/control{,.in} @@ -6,7 +6,7 @@ * Drop obsolete AppArmor profile and conditionals * New upstream snapshot - -- Rico Tzschichholz Fri, 07 Aug 2020 08:06:47 +0200 + -- Rico Tzschichholz Sun, 09 Aug 2020 15:01:26 +0200 firefox-trunk (80.0~a1~hg20200726r542131-0ubuntu1) groovy; urgency=medium diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/application/src/components/service-workers/Worker.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/application/src/components/service-workers/Worker.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/application/src/components/service-workers/Worker.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/application/src/components/service-workers/Worker.js 2020-08-09 12:47:56.000000000 +0000 @@ -61,6 +61,7 @@ super(props); this.debug = this.debug.bind(this); + this.viewSource = this.viewSource.bind(this); this.start = this.start.bind(this); } @@ -73,6 +74,17 @@ services.openWorkerInDebugger(this.props.worker.workerTargetFront); } + viewSource() { + if (!this.isRunning()) { + console.log( + "Service workers cannot be inspected if they are not running" + ); + return; + } + + services.viewWorkerSource(this.props.worker.workerTargetFront); + } + start() { if (!this.isActive() || this.isRunning()) { console.log("Running or inactive service workers cannot be started"); @@ -124,10 +136,11 @@ return getUnicodeUrlPath(parts[parts.length - 1]); } - renderDebugLink(url) { - // avoid rendering the debug link if service worker debugging is disabled - // or if the worker is stopped - const isDisabled = !this.props.isDebugEnabled || !this.isRunning(); + renderInspectLink(url) { + // avoid rendering the inspect link if sw is not running + const isDisabled = !this.isRunning(); + // view source instead of debugging when debugging sw is not available + const callbackFn = this.props.isDebugEnabled ? this.debug : this.viewSource; const sourceUrl = span( { className: "js-source-url" }, @@ -138,10 +151,10 @@ ? sourceUrl : a( { - onClick: this.debug, + onClick: callbackFn, title: url, href: "#", - className: "js-debug-link", + className: "js-inspect-link", }, sourceUrl, "\u00A0", //   @@ -190,7 +203,7 @@ src: "chrome://devtools/skin/images/debugging-workers.svg", }) ), - p({ className: "worker__source" }, this.renderDebugLink(worker.url)), + p({ className: "worker__source" }, this.renderInspectLink(worker.url)), p( { className: "worker__misc" }, span( diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/application/src/modules/application-services.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/application/src/modules/application-services.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/application/src/modules/application-services.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/application/src/modules/application-services.js 2020-08-09 12:47:56.000000000 +0000 @@ -6,6 +6,9 @@ const Services = require("Services"); +// keyword to use in telemetry, as `reason` parameter +const REASON = "application"; + class ManifestDevToolsError extends Error { constructor(...params) { super(...params); @@ -28,7 +31,7 @@ selectTool(toolId) { this._assertInit(); - return this._toolbox.selectTool(toolId, "application"); + return this._toolbox.selectTool(toolId, REASON); } async openWorkerInDebugger(workerTargetFront) { @@ -36,6 +39,18 @@ debuggerPanel.selectWorker(workerTargetFront); } + async viewWorkerSource(workerTargetFront) { + // NOTE: this falls back to view-source: if the source can't be inspected + // within the debugger. + this._toolbox.viewSourceInDebugger( + workerTargetFront.url, + 1, + 1, + null, + REASON + ); + } + async fetchManifest() { let response; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/application/test/browser/browser_application_panel_debug-service-worker.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/application/test/browser/browser_application_panel_debug-service-worker.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/application/test/browser/browser_application_panel_debug-service-worker.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/application/test/browser/browser_application_panel_debug-service-worker.js 2020-08-09 12:47:56.000000000 +0000 @@ -32,13 +32,13 @@ await waitUntil(() => getWorkerContainers(doc).length === 1); const container = getWorkerContainers(doc)[0]; - info("Wait until the debug link is displayed"); + info("Wait until the inspect link is displayed"); await waitUntil(() => { - return container.querySelector(".js-debug-link"); + return container.querySelector(".js-inspect-link"); }); - info("Click on the debug link and wait for debugger to be ready"); - const debugLink = container.querySelector(".js-debug-link"); + info("Click on the inspect link and wait for debugger to be ready"); + const debugLink = container.querySelector(".js-inspect-link"); debugLink.click(); await waitFor(() => toolbox.getPanel("jsdebugger")); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/application/test/browser/browser_application_panel_telemetry-debug-worker.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/application/test/browser/browser_application_panel_telemetry-debug-worker.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/application/test/browser/browser_application_panel_telemetry-debug-worker.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/application/test/browser/browser_application_panel_telemetry-debug-worker.js 2020-08-09 12:47:56.000000000 +0000 @@ -24,11 +24,11 @@ const container = getWorkerContainers(doc)[0]; info("Wait until the debug link is displayed"); await waitUntil(() => { - return container.querySelector(".js-debug-link"); + return container.querySelector(".js-inspect-link"); }); info("Click on the debug link and wait for debugger to be ready"); - const debugLink = container.querySelector(".js-debug-link"); + const debugLink = container.querySelector(".js-inspect-link"); debugLink.click(); await waitUntil(() => toolbox.getPanel("jsdebugger")); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/application/test/browser/browser_application_panel_viewsource-service-worker.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/application/test/browser/browser_application_panel_viewsource-service-worker.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/application/test/browser/browser_application_panel_viewsource-service-worker.js 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/application/test/browser/browser_application_panel_viewsource-service-worker.js 2020-08-09 12:47:56.000000000 +0000 @@ -0,0 +1,50 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const TAB_URL = URL_ROOT + "resources/service-workers/debug.html"; +const SW_URL = URL_ROOT + "resources/service-workers/debug-sw.js"; + +add_task(async function() { + await enableApplicationPanel(); + + // disable service worker debugging + await pushPref( + "devtools.debugger.features.windowless-service-workers", + false + ); + + const { panel, tab, target } = await openNewTabAndApplicationPanel(TAB_URL); + const doc = panel.panelWin.document; + + selectPage(panel, "service-workers"); + + info("Wait until the service worker appears in the application panel"); + await waitUntil(() => getWorkerContainers(doc).length === 1); + + const container = getWorkerContainers(doc)[0]; + info("Wait until the inspect link is displayed"); + await waitUntil(() => { + return container.querySelector(".js-inspect-link"); + }); + + info("Click on the inspect link and wait for a new view-source: tab open"); + // click on the link and wait for the new tab to open + const onTabLoaded = BrowserTestUtils.waitForNewTab( + gBrowser, + `view-source:${SW_URL}` + ); + const inspectLink = container.querySelector(".js-inspect-link"); + inspectLink.click(); + + const sourceTab = await onTabLoaded; + ok(sourceTab, "The service worker source was opened in a new tab"); + + // clean up + await unregisterAllWorkers(target.client, doc); + // close the tabs + info("Closing the tabs."); + await BrowserTestUtils.removeTab(sourceTab); + await BrowserTestUtils.removeTab(tab); +}); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/application/test/browser/browser.ini firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/application/test/browser/browser.ini --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/application/test/browser/browser.ini 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/application/test/browser/browser.ini 2020-08-09 12:47:56.000000000 +0000 @@ -46,6 +46,8 @@ skip-if = debug # Bug 1559591 [browser_application_panel_unregister-worker.js] skip-if = debug # Bug 1559591 +[browser_application_panel_viewsource-service-worker.js] +skip-if = debug || asan || !serviceworker_e10s # Bug 1559591, 1575578, 1588154 [browser_application_panel_worker-states.js] skip-if = asan || debug || !serviceworker_e10s # Bug 1559487, 1559591, 1608640 # Manifest-related tests diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/application/test/node/components/service-workers/components_application_panel-Worker.test.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/application/test/node/components/service-workers/components_application_panel-Worker.test.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/application/test/node/components/service-workers/components_application_panel-Worker.test.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/application/test/node/components/service-workers/components_application_panel-Worker.test.js 2020-08-09 12:47:56.000000000 +0000 @@ -58,8 +58,8 @@ ); // check that Start button is available expect(wrapper.find(".js-start-button")).toHaveLength(1); - // check that Debug link does not exist - expect(wrapper.find(".js-debug-link")).toHaveLength(0); + // check that inspect link does not exist + expect(wrapper.find(".js-inspect-link")).toHaveLength(0); expect(wrapper).toMatchSnapshot(); }); @@ -101,32 +101,8 @@ // check that Start button is not available expect(wrapper.find(".js-start-button")).toHaveLength(0); // check that Debug link does not exist - expect(wrapper.find(".js-debug-link")).toHaveLength(0); + expect(wrapper.find(".js-inspect-link")).toHaveLength(0); expect(wrapper).toMatchSnapshot(); }); - - it("Shows/hides the debug link depending of debugging being available", () => { - const store = setupStore({}); - - // check disabled debugging - let wrapper = shallow( - Worker({ - isDebugEnabled: false, - worker: WORKER_RUNNING, - store, - }) - ).dive(); - expect(wrapper.find(".js-debug-link")).toHaveLength(0); - - // check enabled debugging - wrapper = shallow( - Worker({ - isDebugEnabled: true, - worker: WORKER_RUNNING, - store, - }) - ).dive(); - expect(wrapper.find(".js-debug-link")).toHaveLength(1); - }); }); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/application/test/node/components/service-workers/__snapshots__/components_application_panel-Worker.test.js.snap firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/application/test/node/components/service-workers/__snapshots__/components_application_panel-Worker.test.js.snap --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/application/test/node/components/service-workers/__snapshots__/components_application_panel-Worker.test.js.snap 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/application/test/node/components/service-workers/__snapshots__/components_application_panel-Worker.test.js.snap 2020-08-09 12:47:56.000000000 +0000 @@ -50,7 +50,7 @@ className="worker__source" > document.querySelector("#debugger-settings-menu-list")); + + const menuItem = document.querySelector(className); + + assertMenuItemChecked(menuItem, isChecked); + + menuItem.click(); + + // Waits for the debugger settings panel to disappear. + await waitFor(() => menuButton.getAttribute("aria-expanded") === "false"); +} + + const { PromiseTestUtils } = ChromeUtils.import( "resource://testing-common/PromiseTestUtils.jsm" ); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/fronts/inspector.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/fronts/inspector.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/fronts/inspector.js 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/fronts/inspector.js 2020-08-09 12:47:56.000000000 +0000 @@ -80,15 +80,8 @@ } async getCompatibilityFront() { - // DevTools supports a Compatibility actor from version FF79 and above. - // This check exists to maintain backwards compatibility with older - // backend. This check can be removed once FF79 hits the release channel. - if (this._compatibility === undefined) { - try { - this._compatibility = await super.getCompatibility(); - } catch (error) { - this._compatibility = null; - } + if (!this._compatibility) { + this._compatibility = await super.getCompatibility(); } return this._compatibility; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/fronts/node.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/fronts/node.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/fronts/node.js 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/fronts/node.js 2020-08-09 12:47:56.000000000 +0000 @@ -317,6 +317,10 @@ return !!this._form.isDocumentElement; } + get isTopLevelDocument() { + return this._form.isTopLevelDocument; + } + get isShadowRoot() { return this._form.isShadowRoot; } @@ -539,17 +543,6 @@ ); return this._remoteFrameTarget; } - - async getAllSelectors() { - if (!this.traits.supportsGetAllSelectors) { - // Backward compatibility: if the server does not support getAllSelectors - // fallback on getUniqueSelector and wrap the response in an array. - // getAllSelectors was added in FF72. - const selector = await super.getUniqueSelector(); - return [selector]; - } - return super.getAllSelectors(); - } } exports.NodeFront = NodeFront; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/fronts/walker.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/fronts/walker.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/fronts/walker.js 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/fronts/walker.js 2020-08-09 12:47:56.000000000 +0000 @@ -263,15 +263,6 @@ const mutations = await super.getMutations(options); const emitMutations = []; for (const change of mutations) { - // Backward compatibility. FF77 or older will send "new root" information - // via mutations. Newer servers use the new-root-available event. - if (change.type === "newRoot") { - const rootNode = types.getType("domnode").read(change.target, this); - this.emit("root-available", rootNode); - // Don't process this as a regular mutation. - continue; - } - // The target is only an actorID, get the associated front. const targetID = change.target; const targetFront = this.getActorByID(targetID); @@ -339,6 +330,10 @@ targetFront._form.numChildren = change.numChildren; } } else if (change.type === "frameLoad") { + // Backward compatibility for FF80 or older. + // The frameLoad mutation was removed in FF81 in favor of the root-node + // resource. + // Nothing we need to do here, except verify that we don't have any // document children, because we should have gotten a documentUnload // first. @@ -352,6 +347,10 @@ } } } else if (change.type === "documentUnload") { + // Backward compatibility for FF80 or older. + // The documentUnload mutation was removed in FF81 in favor of the + // root-node resource. + // We try to give fronts instead of actorIDs, but these fronts need // to be destroyed now. emittedMutation.target = targetFront.actorID; @@ -513,12 +512,7 @@ } if (nodeSelectors.length > 0) { - if (nodeFront.traits.supportsWaitForFrameLoad) { - // Backward compatibility: only FF72 or newer are able to wait for - // iframes to load. After FF72 reaches release we can unconditionally - // call waitForFrameLoad. - await nodeFront.waitForFrameLoad(); - } + await nodeFront.waitForFrameLoad(); const { nodes } = await this.children(nodeFront); @@ -558,12 +552,23 @@ } _onRootNodeAvailable(rootNode) { - this.rootNode = rootNode; + if (this._isTopLevelRootNode(rootNode)) { + this.rootNode = rootNode; + } + } + + _onRootNodeDestroyed(rootNode) { + this._releaseFront(rootNode, true); + if (this._isTopLevelRootNode(rootNode)) { + this.rootNode = null; + } } - _onRootNodeDestroyed() { - this._releaseFront(this.rootNode, true); - this.rootNode = null; + _isTopLevelRootNode(rootNode) { + // When `supportsIsTopLevelDocument` is false, a root-node resource is + // necessarily top level, so we can fallback to true. + const { supportsIsTopLevelDocument } = rootNode.traits; + return supportsIsTopLevelDocument ? rootNode.isTopLevelDocument : true; } async watchRootNode(onRootNodeAvailable) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/inspector/compatibility/actions/compatibility.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/inspector/compatibility/actions/compatibility.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/inspector/compatibility/actions/compatibility.js 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/inspector/compatibility/actions/compatibility.js 2020-08-09 12:47:56.000000000 +0000 @@ -6,12 +6,6 @@ const nodeConstants = require("devtools/shared/dom-node-constants"); -loader.lazyGetter(this, "mdnCompatibility", () => { - const MDNCompatibility = require("devtools/shared/compatibility/MDNCompatibility"); - const cssPropertiesCompatData = require("devtools/shared/compatibility/dataset/css-properties.json"); - return new MDNCompatibility(cssPropertiesCompatData); -}); - const UserSettings = require("devtools/client/inspector/compatibility/UserSettings"); const { @@ -251,44 +245,11 @@ } async function _getNodeIssues(node, targetBrowsers) { - let declarationBlocksIssues = []; const compatibility = await node.inspectorFront.getCompatibilityFront(); - // Starting with FF79, DevTools include a separate CompatibilityActor to - // fetch compatibility issues for the given DOM node. This check exists - // to maintain backwards compatibility with FF version < 79 and can be - // safely removed once FF79 hits the release channel. - if (compatibility) { - declarationBlocksIssues = await compatibility.getNodeCssIssues( - node, - targetBrowsers - ); - } else { - const pageStyle = node.inspectorFront.pageStyle; - const styles = await pageStyle.getApplied(node, { - skipPseudo: false, - }); - - const declarationBlocks = styles - .map(({ rule }) => rule.declarations.filter(d => !d.commentOffsets)) - .filter(declarations => declarations.length); - - declarationBlocksIssues = declarationBlocks - .map(declarationBlock => - mdnCompatibility.getCSSDeclarationBlockIssues( - declarationBlock, - targetBrowsers - ) - ) - .flat() - .reduce((issues, issue) => { - // Get rid of duplicate issue - return issues.find( - i => i.type === issue.type && i.property === issue.property - ) - ? issues - : [...issues, issue]; - }, []); - } + const declarationBlocksIssues = await compatibility.getNodeCssIssues( + node, + targetBrowsers + ); return declarationBlocksIssues; } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/inspector/inspector.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/inspector/inspector.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/inspector/inspector.js 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/inspector/inspector.js 2020-08-09 12:47:56.000000000 +0000 @@ -1297,7 +1297,8 @@ onResourceAvailable: function({ resourceType, targetFront, resource }) { if (resourceType === this.toolbox.resourceWatcher.TYPES.ROOT_NODE) { - if (targetFront.isTopLevel) { + const isTopLevelTarget = !!targetFront.isTopLevel; + if (resource.isTopLevelDocument && isTopLevelTarget) { // Note: the resource (ie the root node here) will be fetched from the // walker later on in _getDefaultNodeForSelection. // We should update the inspector to directly use the node front diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/inspector/markup/markup.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/inspector/markup/markup.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/inspector/markup/markup.js 2020-08-07 05:56:02.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/inspector/markup/markup.js 2020-08-09 12:47:56.000000000 +0000 @@ -1430,6 +1430,10 @@ let target = mutation.target; if (mutation.type === "documentUnload") { + // Backward compatibility for FF80 or older. + // The documentUnload mutation was removed in FF81 in favor of the + // root-node resource. + // Treat this as a childList change of the child (maybe the protocol // should do this). type = "childList"; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/inspector/shared/highlighters-overlay.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/inspector/shared/highlighters-overlay.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/inspector/shared/highlighters-overlay.js 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/inspector/shared/highlighters-overlay.js 2020-08-09 12:47:56.000000000 +0000 @@ -103,6 +103,8 @@ this.onClick = this.onClick.bind(this); this.onDisplayChange = this.onDisplayChange.bind(this); this.onMarkupMutation = this.onMarkupMutation.bind(this); + this._onFrameRootAvailable = this._onFrameRootAvailable.bind(this); + this.onMouseMove = this.onMouseMove.bind(this); this.onMouseOut = this.onMouseOut.bind(this); this.onWillNavigate = this.onWillNavigate.bind(this); @@ -118,6 +120,7 @@ // Add inspector events, not specific to a given view. this.inspector.on("markupmutation", this.onMarkupMutation); + this.inspector.on("frame-root-available", this._onFrameRootAvailable); this.target.on("will-navigate", this.onWillNavigate); this.walker.on("display-change", this.onDisplayChange); @@ -1332,6 +1335,15 @@ } /** + * Handler function called when a new root-node has been added in the + * inspector. Nodes may have been added / removed and highlighters should + * be updated. + */ + async _onFrameRootAvailable() { + await this._updateHighlightersOnMutationOrNavigation(); + } + + /** * Handler function for "markupmutation" events. Hides the flexbox/grid/shapes * highlighter if the flexbox/grid/shapes container is no longer in the DOM tree. */ @@ -1345,6 +1357,10 @@ return; } + await this._updateHighlightersOnMutationOrNavigation(); + } + + async _updateHighlightersOnMutationOrNavigation() { for (const node of this.gridHighlighters.keys()) { await this._hideHighlighterIfDeadNode(node, this.hideGridHighlighter); } @@ -1448,6 +1464,8 @@ */ destroy() { this.inspector.off("markupmutation", this.onMarkupMutation); + this.inspector.off("frame-root-available", this._onFrameRootAvailable); + this.target.off("will-navigate", this.onWillNavigate); this.walker.off("display-change", this.onDisplayChange); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/inspector/test/browser_inspector_fission_frame_navigation.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/inspector/test/browser_inspector_fission_frame_navigation.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/inspector/test/browser_inspector_fission_frame_navigation.js 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/inspector/test/browser_inspector_fission_frame_navigation.js 2020-08-09 12:47:56.000000000 +0000 @@ -119,22 +119,10 @@ const { resourceWatcher, targetList } = inspector.toolbox; const onTargetProcessed = waitForTargetProcessed(targetList, url); - let onNewRoot; - if (isFissionEnabled()) { - // With Fission, the frame navigation will result in a new root-node - // resource. - onNewRoot = waitForResourceOnce( - resourceWatcher, - resourceWatcher.TYPES.ROOT_NODE - ); - } else { - // Without Fission, the frame navigation is handled on the server and will - // create two (fake) mutations: frameLoad + childList. - onNewRoot = Promise.all([ - waitForMutation(inspector, "childList"), - waitForMutation(inspector, "frameLoad"), - ]); - } + const onNewRoot = waitForResourceOnce( + resourceWatcher, + resourceWatcher.TYPES.ROOT_NODE + ); info("Update the src attribute of the iframe tag"); await SpecialPowers.spawn(gBrowser.selectedBrowser, [url], function(_url) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/webconsole/components/Input/JSTerm.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/webconsole/components/Input/JSTerm.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/webconsole/components/Input/JSTerm.js 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/webconsole/components/Input/JSTerm.js 2020-08-09 12:47:57.000000000 +0000 @@ -250,7 +250,7 @@ this.editor = new Editor({ autofocus: true, - enableCodeFolding: false, + enableCodeFolding: this.props.editorMode, lineNumbers: this.props.editorMode, lineWrapping: true, mode: { @@ -575,6 +575,7 @@ if (nextProps.editorMode !== this.props.editorMode) { if (this.editor) { this.editor.setOption("lineNumbers", nextProps.editorMode); + this.editor.setOption("enableCodeFolding", nextProps.editorMode); } if (nextProps.editorMode && nextProps.editorWidth) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/webconsole/test/browser/browser_jsterm_editor_code_folding.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/webconsole/test/browser/browser_jsterm_editor_code_folding.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/webconsole/test/browser/browser_jsterm_editor_code_folding.js 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/webconsole/test/browser/browser_jsterm_editor_code_folding.js 2020-08-09 12:47:56.000000000 +0000 @@ -0,0 +1,73 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Tests for code folding appears in editor mode, does not appear in inline mode, +// and that folded code does not remain folded when switched to inline mode. +// See https://bugzilla.mozilla.org/show_bug.cgi?id=1581641 + +"use strict"; + +const TEST_URI = "data:text/html;charset=utf-8,Test JsTerm editor code folding"; + +add_task(async function() { + await pushPref("devtools.webconsole.input.editor", true); + + const hud = await openNewTabAndConsole(TEST_URI); + + info("Check that code folding gutter & arrow are rendered in editor mode"); + + const multilineExpression = `function() { + // Silence is golden + }`; + await setInputValue(hud, multilineExpression); + + ok( + await waitFor(() => getFoldArrowOpenElement(hud)), + "code folding gutter was rendered in editor mode" + ); + + const foldingArrow = getFoldArrowOpenElement(hud); + ok(foldingArrow, "code folding arrow was rendered in code folding gutter"); + is(getCodeLines(hud).length, 3, "There are 3 lines displayed"); + + info("Check that code folds when gutter marker clicked"); + EventUtils.synthesizeMouseAtCenter( + foldingArrow, + {}, + foldingArrow.ownerDocument.defaultView + ); + await waitFor(() => getCodeLines(hud).length === 1); + ok(true, "The code was folded, there's only one line displayed now"); + + info("Check that folded code is expanded when rendered inline"); + + await toggleLayout(hud); + + is( + getCodeLines(hud).length, + 3, + "folded code is expended when rendered in inline" + ); + + info( + "Check that code folding gutter is hidden when we switch to inline mode" + ); + ok( + !getFoldGutterElement(hud), + "code folding gutter is hidden when we switsch to inline mode" + ); +}); + +function getCodeLines(hud) { + return hud.ui.outputNode.querySelectorAll( + ".CodeMirror-code pre.CodeMirror-line" + ); +} + +function getFoldGutterElement(hud) { + return hud.ui.outputNode.querySelector(".CodeMirror-foldgutter"); +} + +function getFoldArrowOpenElement(hud) { + return hud.ui.outputNode.querySelector(".CodeMirror-foldgutter-open"); +} diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/webconsole/test/browser/_jsterm.ini firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/webconsole/test/browser/_jsterm.ini --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/client/webconsole/test/browser/_jsterm.ini 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/client/webconsole/test/browser/_jsterm.ini 2020-08-09 12:47:56.000000000 +0000 @@ -96,6 +96,7 @@ [browser_jsterm_eager_evaluation_warnings.js] [browser_jsterm_eager_evaluation.js] [browser_jsterm_editor.js] +[browser_jsterm_editor_code_folding.js] [browser_jsterm_editor_disabled_history_nav_with_keyboard.js] [browser_jsterm_editor_enter.js] [browser_jsterm_editor_execute_selection.js] diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/server/actors/inspector/node.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/server/actors/inspector/node.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/server/actors/inspector/node.js 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/server/actors/inspector/node.js 2020-08-09 12:47:57.000000000 +0000 @@ -182,6 +182,7 @@ inlineTextChild: inlineTextChild ? inlineTextChild.form() : undefined, displayType: this.displayType, isScrollable: this.isScrollable, + isTopLevelDocument: this.isTopLevelDocument, causesOverflow: this.walker.overflowCausingElementsSet.has(this.rawNode), // doctype attributes @@ -209,10 +210,7 @@ this.rawNode.ownerDocument.contentType === "text/html", hasEventListeners: this._hasEventListeners, traits: { - // Added in FF72 - supportsGetAllSelectors: true, - // Added in FF72 - supportsWaitForFrameLoad: true, + supportsIsTopLevelDocument: true, }, }; @@ -271,6 +269,10 @@ return isRemoteFrame(this.rawNode); }, + get isTopLevelDocument() { + return this.rawNode === this.walker.rootDoc; + }, + // Estimate the number of children that the walker will return without making // a call to children() if possible. get numChildren() { @@ -753,7 +755,7 @@ items: function(start = 0, end = this.nodeList.length) { const items = Array.prototype.slice .call(this.nodeList, start, end) - .map(item => this.walker._ref(item)); + .map(item => this.walker._getOrCreateNodeActor(item)); return this.walker.attachElements(items); }, diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/server/actors/inspector/walker.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/server/actors/inspector/walker.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/server/actors/inspector/walker.js 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/server/actors/inspector/walker.js 2020-08-09 12:47:57.000000000 +0000 @@ -113,7 +113,7 @@ // Minimum delay between two "new-mutations" events. const MUTATIONS_THROTTLING_DELAY = 100; // List of mutation types that should -not- be throttled. -const IMMEDIATE_MUTATIONS = ["documentUnload", "frameLoad", "pseudoClassLock"]; +const IMMEDIATE_MUTATIONS = ["pseudoClassLock"]; const HIDDEN_CLASS = "__fx-devtools-hide-shortcut__"; @@ -196,7 +196,10 @@ this.targetActor = targetActor; this.rootWin = targetActor.window; this.rootDoc = this.rootWin.document; - this._refMap = new Map(); + + // Map of already created node actors, keyed by their corresponding DOMNode. + this._nodeActorsMap = new Map(); + this._pendingMutations = []; this._activePseudoClassLocks = new Set(); this._mutationBreakpoints = new WeakMap(); @@ -293,7 +296,7 @@ this._isWatchingRootNode = true; if (this.rootNode && this._isRootDocumentReady()) { - this._emitNewRoot(); + this._emitNewRoot(this.rootNode, { isTopLevelDocument: true }); } }, @@ -302,13 +305,17 @@ this._emittedRootNode = null; }, - _emitNewRoot() { - if (!this._isWatchingRootNode || this._emittedRootNode === this.rootNode) { + _emitNewRoot(rootNode, { isTopLevelDocument }) { + const alreadyEmittedTopRootNode = this._emittedRootNode === rootNode; + if (!this._isWatchingRootNode || alreadyEmittedTopRootNode) { return; } - this._emittedRootNode = this.rootNode; - this.emit("root-available", this.rootNode); + if (isTopLevelDocument) { + this._emittedRootNode = this.rootNode; + } + + this.emit("root-available", rootNode); }, _isRootDocumentReady() { @@ -337,7 +344,7 @@ for (const current of changesEnum.enumerate(Ci.nsIEventListenerChange)) { const target = current.target; - if (this._refMap.has(target)) { + if (this._nodeActorsMap.has(target)) { const actor = this.getNode(target); const mutation = { type: "events", @@ -422,7 +429,7 @@ this.layoutHelpers = null; this._orphaned = null; this._retainedOrphans = null; - this._refMap = null; + this._nodeActorsMap = null; this.targetActor.off("will-navigate", this.onFrameUnload); this.targetActor.off("window-ready", this.onFrameLoad); @@ -483,7 +490,7 @@ this.customElementWatcher.unmanageNode(actor); - this._refMap.delete(actor.rawNode); + this._nodeActorsMap.delete(actor.rawNode); } protocol.Actor.prototype.unmanage.call(this, actor); }, @@ -494,7 +501,7 @@ * @return {Boolean} */ hasNode: function(rawNode) { - return this._refMap.has(rawNode); + return this._nodeActorsMap.has(rawNode); }, /** @@ -504,10 +511,23 @@ * @return {NodeActor} */ getNode: function(rawNode) { - return this._refMap.get(rawNode); + return this._nodeActorsMap.get(rawNode); }, - _ref: function(node) { + /** + * Internal helper that will either retrieve the existing NodeActor for the + * provided node or create the actor on the fly if it doesn't exist. + * This method should only be called when we are sure that the node should be + * known by the client and that the parent node is already known. + * + * Otherwise prefer `getNode` to only retrieve known actors or `attachElement` + * to create node actors recursively. + * + * @param {DOMNode} node + * The node for which we want to create or get an actor + * @return {NodeActor} The corresponding NodeActor + */ + _getOrCreateNodeActor: function(node) { let actor = this.getNode(node); if (actor) { return actor; @@ -518,7 +538,7 @@ // Add the node actor as a child of this walker actor, assigning // it an actorID. this.manage(actor); - this._refMap.set(node, actor); + this._nodeActorsMap.set(node, actor); if (node.nodeType === Node.DOCUMENT_NODE) { actor.watchDocument(node, this.onMutations); @@ -556,7 +576,7 @@ const currentOverflowCausingElementsSet = new Set(); - for (const [node, actor] of this._refMap) { + for (const [node, actor] of this._nodeActorsMap) { if (Cu.isDeadWrapper(node)) { continue; } @@ -654,7 +674,7 @@ node = this.getDocumentWalker(node).currentNode; } - node = this._ref(node); + node = this._getOrCreateNodeActor(node); } this.ensurePathToRoot(node, newParents); @@ -678,7 +698,7 @@ */ document: function(node) { const doc = isNodeDead(node) ? this.rootDoc : nodeDocument(node.rawNode); - return this._ref(doc); + return this._getOrCreateNodeActor(doc); }, /** @@ -692,13 +712,13 @@ const elt = isNodeDead(node) ? this.rootDoc.documentElement : nodeDocument(node.rawNode).documentElement; - return this._ref(elt); + return this._getOrCreateNodeActor(elt); }, parentNode: function(node) { const parent = this.rawParentNode(node); if (parent) { - return this._ref(parent); + return this._getOrCreateNodeActor(parent); } return null; @@ -772,7 +792,7 @@ return undefined; } - return this._ref(firstChild); + return this._getOrCreateNodeActor(firstChild); }, /** @@ -856,7 +876,7 @@ return newParents; } // This parent didn't exist, so hasn't been seen by the client yet. - parentActor = this._ref(parent); + parentActor = this._getOrCreateNodeActor(parent); newParents.add(parentActor); parent = this.rawParentNode(parentActor); } @@ -905,16 +925,16 @@ return { hasFirst, hasLast, - nodes: nodes.map(n => this._ref(n)), + nodes: nodes.map(n => this._getOrCreateNodeActor(n)), }; }, /** * Return chidlren of the given node. Contrary to children children(), this method only * returns DOMNodes. Therefore it will not create NodeActor wrappers and will not - * update the refMap for the discovered nodes either. This makes this method safe to - * call when you are not sure if the discovered nodes will be communicated to the - * client. + * update the nodeActors map for the discovered nodes either. This makes this method + * safe to call when you are not sure if the discovered nodes will be communicated to + * the client. * * @param NodeActor node * See JSDoc for children() @@ -1148,7 +1168,7 @@ const walker = this.getDocumentWalker(node.rawNode, options.whatToShow); const sibling = walker.nextSibling(); - return sibling ? this._ref(sibling) : null; + return sibling ? this._getOrCreateNodeActor(sibling) : null; }, /** @@ -1167,7 +1187,7 @@ const walker = this.getDocumentWalker(node.rawNode, options.whatToShow); const sibling = walker.previousSibling(); - return sibling ? this._ref(sibling) : null; + return sibling ? this._getOrCreateNodeActor(sibling) : null; }, /** @@ -1532,7 +1552,7 @@ const walker = this.getDocumentWalker(node.rawNode); let cur; while ((cur = walker.parentNode())) { - const curNode = this._ref(cur); + const curNode = this._getOrCreateNodeActor(cur); this._addPseudoClassLock(curNode, pseudo, enabled); } }, @@ -1611,7 +1631,7 @@ const walker = this.getDocumentWalker(node.rawNode); let cur; while ((cur = walker.parentNode())) { - const curNode = this._ref(cur); + const curNode = this._getOrCreateNodeActor(cur); this._removePseudoClassLock(curNode, pseudo); } }, @@ -2511,6 +2531,7 @@ ); return; } + if (isTopLevel) { // If we initialize the inspector while the document is loading, // we may already have a root document set in the constructor. @@ -2525,27 +2546,17 @@ this.rootWin = window; this.rootDoc = window.document; this.rootNode = this.document(); - this._emitNewRoot(); - return; - } - const frame = getFrameElement(window); - const frameActor = this.getNode(frame); - if (!frameActor) { - return; + this._emitNewRoot(this.rootNode, { isTopLevelDocument: true }); + } else { + const frame = getFrameElement(window); + const frameActor = this.getNode(frame); + if (frameActor) { + // If the parent frame is in the map of known node actors, create the + // actor for the new document and emit a root-available event. + const documentActor = this._getOrCreateNodeActor(window.document); + this._emitNewRoot(documentActor, { isTopLevelDocument: false }); + } } - - this.queueMutation({ - type: "frameLoad", - target: frameActor.actorID, - }); - - // Send a childList mutation on the frame. - this.queueMutation({ - type: "childList", - target: frameActor.actorID, - added: [], - removed: [], - }); }, // Returns true if domNode is in window or a subframe. @@ -2599,40 +2610,18 @@ this._updateMutationBreakpointState("unload", node, null); } + if (this._isWatchingRootNode) { + this.emit("root-destroyed", documentActor); + } + + // Cleanup root doc references if we just unloaded the top level root + // document. if (this.rootDoc === doc) { this.rootDoc = null; - if (this._isWatchingRootNode) { - this.emit("root-destroyed", this.rootNode); - } this.rootNode = null; - this.releaseNode(documentActor, { force: true }); - // XXX: Only top-level "roots" trigger root-available/root-destroyed - // events. When a frame living in the same process as the parent frame - // navigates, we rely on legacy mutations to communicate the update to the - // markup view. - return; - } - - this.queueMutation({ - type: "documentUnload", - target: documentActor.actorID, - }); - - const walker = this.getDocumentWalker(doc); - const parentNode = walker.parentNode(); - if (parentNode) { - // Send a childList mutation on the frame so that clients know - // they should reread the children list. - this.queueMutation({ - type: "childList", - target: this.getNode(parentNode).actorID, - added: [], - removed: [], - }); } - // Need to force a release of this node, because those nodes can't - // be accessed anymore. + // Release the actor for the unloaded document. this.releaseNode(documentActor, { force: true }); }, @@ -2828,7 +2817,7 @@ } const parentGridNode = findGridParentContainerForNode(node.rawNode); - return parentGridNode ? this._ref(parentGridNode) : null; + return parentGridNode ? this._getOrCreateNodeActor(parentGridNode) : null; }, /** @@ -2846,7 +2835,7 @@ return null; } - return this._ref(offsetParent); + return this._getOrCreateNodeActor(offsetParent); }, getEmbedderElement(browsingContextID) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/server/tests/browser/browser.ini firefox-trunk-81.0~a1~hg20200808r544015/devtools/server/tests/browser/browser.ini --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/server/tests/browser/browser.ini 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/server/tests/browser/browser.ini 2020-08-09 12:47:57.000000000 +0000 @@ -116,8 +116,6 @@ [browser_inspector-anonymous.js] [browser_inspector-insert.js] [browser_inspector-mutations-childlist.js] -[browser_inspector-mutations-frameload.js] -skip-if = true # Bug 1593562 [browser_inspector-release.js] [browser_inspector-remove.js] [browser_inspector-retain.js] diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/server/tests/browser/browser_inspector-mutations-frameload.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/server/tests/browser/browser_inspector-mutations-frameload.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/server/tests/browser/browser_inspector-mutations-frameload.js 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/server/tests/browser/browser_inspector-mutations-frameload.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,159 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -/* import-globals-from inspector-helpers.js */ -Services.scriptloader.loadSubScript( - "chrome://mochitests/content/browser/devtools/server/tests/browser/inspector-helpers.js", - this -); - -async function loadChildSelector(walker, selector) { - const frame = await walker.querySelector(walker.rootNode, "#childFrame"); - ok( - frame.numChildren > 0, - "Child frame should consider its loaded document as a child." - ); - const children = await walker.children(frame); - const nodeList = await walker.querySelectorAll(children.nodes[0], selector); - return nodeList.items(); -} - -function getUnloadedDoc(mutations) { - for (const change of mutations) { - if (isUnload(change)) { - return change.target; - } - } - return null; -} - -add_task(async function loadNewChild() { - const { target, walker } = await initInspectorFront( - MAIN_DOMAIN + "inspector-traversal-data.html" - ); - // Load a bunch of fronts for actors inside the child frame. - await loadChildSelector(walker, "#longlist div"); - const onMutations = waitForMutation(walker, isChildList); - await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() { - const childFrame = content.document.querySelector("#childFrame"); - childFrame.src = "data:text/html,new child"; - }); - let mutations = await onMutations; - const unloaded = getUnloadedDoc(mutations); - mutations = assertSrcChange(mutations); - mutations = assertUnload(mutations); - mutations = assertFrameLoad(mutations); - mutations = assertChildList(mutations); - - is(mutations.length, 0, "Got the expected mutations."); - - assertOwnershipTrees(walker); - - return checkMissing(target, unloaded); -}); - -add_task(async function loadNewChild() { - const { walker } = await initInspectorFront( - MAIN_DOMAIN + "inspector-traversal-data.html" - ); - // Load a bunch of fronts for actors inside the child frame. - await loadChildSelector(walker, "#longlist div"); - let onMutations = waitForMutation(walker, isChildList); - await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() { - const childFrame = content.document.querySelector("#childFrame"); - childFrame.src = "data:text/html,new child"; - }); - await onMutations; - - onMutations = waitForMutation(walker, isChildList); - await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() { - // The first load went through as expected (as tested in loadNewChild) - // Now change the source again, but this time we *don't* expect - // an unload, because we haven't seen the new child document yet. - const childFrame = content.document.querySelector("#childFrame"); - childFrame.src = "data:text/html,second new child"; - }); - let mutations = await onMutations; - mutations = assertSrcChange(mutations); - mutations = assertFrameLoad(mutations); - mutations = assertChildList(mutations); - ok(!getUnloadedDoc(mutations), "Should not have gotten an unload."); - - is(mutations.length, 0, "Got the expected mutations."); - - assertOwnershipTrees(walker); -}); - -add_task(async function loadNewChildTwiceAndCareAboutIt() { - const { target, walker } = await initInspectorFront( - MAIN_DOMAIN + "inspector-traversal-data.html" - ); - // Load a bunch of fronts for actors inside the child frame. - await loadChildSelector(walker, "#longlist div"); - let onMutations = waitForMutation(walker, isChildList); - await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() { - const childFrame = content.document.querySelector("#childFrame"); - childFrame.src = "data:text/html,new child"; - }); - await onMutations; - // Read the new child - await loadChildSelector(walker, "#longlist div"); - - onMutations = waitForMutation(walker, isChildList); - await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() { - // Now change the source again, and expect the same results as loadNewChild. - const childFrame = content.document.querySelector("#childFrame"); - childFrame.src = "data:text/html,second new child"; - }); - let mutations = await onMutations; - const unloaded = getUnloadedDoc(mutations); - - mutations = assertSrcChange(mutations); - mutations = assertUnload(mutations); - mutations = assertFrameLoad(mutations); - mutations = assertChildList(mutations); - - is(mutations.length, 0, "Got the expected mutations."); - - assertOwnershipTrees(walker); - - return checkMissing(target, unloaded); -}); - -add_task(async function testBack() { - const { target, walker } = await initInspectorFront( - MAIN_DOMAIN + "inspector-traversal-data.html" - ); - // Load a bunch of fronts for actors inside the child frame. - await loadChildSelector(walker, "#longlist div"); - let onMutations = waitForMutation(walker, isChildList); - await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() { - const childFrame = content.document.querySelector("#childFrame"); - childFrame.src = "data:text/html,new child"; - }); - await onMutations; - - // Read the new child - await loadChildSelector(walker, "#longlist div"); - - onMutations = waitForMutation(walker, isChildList); - await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() { - // Now use history.back to change the source, - // and expect the same results as loadNewChild. - const childFrame = content.document.querySelector("#childFrame"); - childFrame.contentWindow.history.back(); - }); - let mutations = await onMutations; - const unloaded = getUnloadedDoc(mutations); - mutations = assertSrcChange(mutations); - mutations = assertUnload(mutations); - mutations = assertFrameLoad(mutations); - mutations = assertChildList(mutations); - is(mutations.length, 0, "Got the expected mutations."); - - assertOwnershipTrees(walker); - - return checkMissing(target, unloaded); -}); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/server/tests/browser/inspector-helpers.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/server/tests/browser/inspector-helpers.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/server/tests/browser/inspector-helpers.js 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/server/tests/browser/inspector-helpers.js 2020-08-09 12:47:57.000000000 +0000 @@ -4,9 +4,7 @@ "use strict"; /* exported assertOwnershipTrees, checkMissing, waitForMutation, - isSrcChange, isUnretained, isNewRoot, - assertSrcChange, assertUnload, assertFrameLoad, assertChildList, -*/ + isSrcChange, isUnretained, isChildList */ function serverOwnershipTree(walkerArg) { return SpecialPowers.spawn( @@ -31,7 +29,7 @@ } function serverOwnershipSubtree(walker, node) { - const actor = walker._refMap.get(node); + const actor = walker.getNode(node); if (!actor) { return undefined; } @@ -153,25 +151,10 @@ }); } -function assertAndStrip(mutations, message, test) { - const size = mutations.length; - mutations = mutations.filter(test); - ok(mutations.size != size, message); - return mutations; -} - function isSrcChange(change) { return change.type === "attributes" && change.attributeName === "src"; } -function isUnload(change) { - return change.type === "documentUnload"; -} - -function isFrameLoad(change) { - return change.type === "frameLoad"; -} - function isUnretained(change) { return change.type === "unretained"; } @@ -179,47 +162,3 @@ function isChildList(change) { return change.type === "childList"; } - -function isNewRoot(change) { - return change.type === "newRoot"; -} - -// Make sure an iframe's src attribute changed and then -// strip that mutation out of the list. -function assertSrcChange(mutations) { - return assertAndStrip( - mutations, - "Should have had an iframe source change.", - isSrcChange - ); -} - -// Make sure there's an unload in the mutation list and strip -// that mutation out of the list -function assertUnload(mutations) { - return assertAndStrip( - mutations, - "Should have had a document unload change.", - isUnload - ); -} - -// Make sure there's a frame load in the mutation list and strip -// that mutation out of the list -function assertFrameLoad(mutations) { - return assertAndStrip( - mutations, - "Should have had a frame load change.", - isFrameLoad - ); -} - -// Make sure there's a childList change in the mutation list and strip -// that mutation out of the list -function assertChildList(mutations) { - return assertAndStrip( - mutations, - "Should have had a frame load change.", - isChildList - ); -} diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/shared/resources/resource-watcher.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/shared/resources/resource-watcher.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/shared/resources/resource-watcher.js 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/shared/resources/resource-watcher.js 2020-08-09 12:47:57.000000000 +0000 @@ -601,4 +601,6 @@ .CONSOLE_MESSAGE]: require("devtools/shared/resources/transformers/console-messages"), [ResourceWatcher.TYPES .ERROR_MESSAGE]: require("devtools/shared/resources/transformers/error-messages"), + [ResourceWatcher.TYPES + .ROOT_NODE]: require("devtools/shared/resources/transformers/root-node"), }; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/shared/resources/tests/browser_resources_stylesheets.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/shared/resources/tests/browser_resources_stylesheets.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/shared/resources/tests/browser_resources_stylesheets.js 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/shared/resources/tests/browser_resources_stylesheets.js 2020-08-09 12:47:57.000000000 +0000 @@ -80,9 +80,12 @@ EXISTING_RESOURCES.length, "Length of existing resources is correct" ); - for (let i = 0; i < EXISTING_RESOURCES.length; i++) { + for (let i = 0; i < availableResources.length; i++) { const availableResource = availableResources[i]; - const expectedResource = EXISTING_RESOURCES[i]; + // We can not expect the resources to always be forwarded in the same order. + // See intermittent Bug 1655016. + const expectedResource = findMatchingExpectedResource(availableResource); + ok(expectedResource, "Found a matching expected resource for the resource"); await assertResource(availableResource, expectedResource); } @@ -123,15 +126,24 @@ info("Check whether the stylesheet actor is updated correctly or not"); const firstResource = availableResources[0]; await firstResource.styleSheet.update("", false); + const expectedResource = findMatchingExpectedResource(firstResource); await assertResource( availableResources[0], - Object.assign(EXISTING_RESOURCES[0], { styleText: "" }) + Object.assign(expectedResource, { styleText: "" }) ); await targetList.stopListening(); await client.close(); }); +function findMatchingExpectedResource(resource) { + return EXISTING_RESOURCES.find( + expected => + resource.styleSheet.href === expected.href && + resource.styleSheet.nodeHref === expected.nodeHref + ); +} + async function assertResource(resource, expected) { const { resourceType, styleSheet, isNew } = resource; is( diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/shared/resources/transformers/moz.build firefox-trunk-81.0~a1~hg20200808r544015/devtools/shared/resources/transformers/moz.build --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/shared/resources/transformers/moz.build 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/shared/resources/transformers/moz.build 2020-08-09 12:47:57.000000000 +0000 @@ -5,4 +5,5 @@ DevToolsModules( 'console-messages.js', 'error-messages.js', + 'root-node.js', ) diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/devtools/shared/resources/transformers/root-node.js firefox-trunk-81.0~a1~hg20200808r544015/devtools/shared/resources/transformers/root-node.js --- firefox-trunk-81.0~a1~hg20200807r543684/devtools/shared/resources/transformers/root-node.js 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/devtools/shared/resources/transformers/root-node.js 2020-08-09 12:47:57.000000000 +0000 @@ -0,0 +1,21 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +/** + * Transformer for the root node resource. + * + * @param {NodeFront} resource + * @param {TargetFront} targetFront + * @return {NodeFront} the updated resource + */ +module.exports = function({ resource, targetFront }) { + if (!resource.traits.supportsIsTopLevelDocument) { + // When `supportsIsTopLevelDocument` is false, a root-node resource is + // necessarily top level, se we can fallback to true. + resource.isTopLevelDocument = true; + } + return resource; +}; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/docshell/base/nsDocShell.cpp firefox-trunk-81.0~a1~hg20200808r544015/docshell/base/nsDocShell.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/docshell/base/nsDocShell.cpp 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/docshell/base/nsDocShell.cpp 2020-08-09 12:47:57.000000000 +0000 @@ -4572,8 +4572,7 @@ // Tell the nsDOMNavigationTiming about it RefPtr timing = mTiming; if (!timing && mContentViewer) { - Document* doc = mContentViewer->GetDocument(); - if (doc) { + if (Document* doc = mContentViewer->GetDocument()) { timing = doc->GetNavigationTiming(); } } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/docshell/base/WindowContext.cpp firefox-trunk-81.0~a1~hg20200808r544015/docshell/base/WindowContext.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/docshell/base/WindowContext.cpp 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/docshell/base/WindowContext.cpp 2020-08-09 12:47:57.000000000 +0000 @@ -12,6 +12,7 @@ #include "mozilla/dom/BrowsingContext.h" #include "mozilla/StaticPtr.h" #include "mozilla/ClearOnShutdown.h" +#include "nsGlobalWindowInner.h" #include "nsIScriptError.h" #include "nsRefPtrHashtable.h" #include "nsContentUtils.h" @@ -53,6 +54,14 @@ return mBrowsingContext->mCurrentWindowContext != this; } +nsGlobalWindowInner* WindowContext::GetInnerWindow() const { + if (mInProcess) { + // FIXME: Replace this with something more efficient. + return nsGlobalWindowInner::GetInnerWindowWithId(mInnerWindowId); + } + return nullptr; +} + WindowContext* WindowContext::GetParentWindowContext() { return mBrowsingContext->GetParentWindowContext(); } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/docshell/base/WindowContext.h firefox-trunk-81.0~a1~hg20200808r544015/docshell/base/WindowContext.h --- firefox-trunk-81.0~a1~hg20200807r543684/docshell/base/WindowContext.h 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/docshell/base/WindowContext.h 2020-08-09 12:47:57.000000000 +0000 @@ -16,6 +16,8 @@ class nsIGlobalObject; +class nsGlobalWindowInner; + namespace mozilla { class LogModule; @@ -82,7 +84,9 @@ bool IsCached() const; - bool IsInProcess() { return mInProcess; } + bool IsInProcess() const { return mInProcess; } + + nsGlobalWindowInner* GetInnerWindow() const; // Get the parent WindowContext of this WindowContext, taking the BFCache into // account. This will not cross chrome/content boundaries. diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/base/AttrArray.h firefox-trunk-81.0~a1~hg20200808r544015/dom/base/AttrArray.h --- firefox-trunk-81.0~a1~hg20200807r543684/dom/base/AttrArray.h 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/base/AttrArray.h 2020-08-09 12:47:57.000000000 +0000 @@ -178,13 +178,12 @@ return sizeof(Impl) + aAttrCount * sizeof(InternalAttr); } - mozilla::Span NonMappedAttrs() const { - return mozilla::MakeSpan(static_cast(mBuffer), - mAttrCount); + auto NonMappedAttrs() const { + return mozilla::Span{mBuffer, mAttrCount}; } - mozilla::Span NonMappedAttrs() { - return mozilla::MakeSpan(static_cast(mBuffer), mAttrCount); + auto NonMappedAttrs() { + return mozilla::Span{mBuffer, mAttrCount}; } Impl(const Impl&) = delete; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/base/BodyUtil.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/base/BodyUtil.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/base/BodyUtil.cpp 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/base/BodyUtil.cpp 2020-08-09 12:47:57.000000000 +0000 @@ -467,8 +467,8 @@ // static nsresult BodyUtil::ConsumeText(uint32_t aInputLength, uint8_t* aInput, nsString& aText) { - nsresult rv = UTF_8_ENCODING->DecodeWithBOMRemoval( - MakeSpan(aInput, aInputLength), aText); + nsresult rv = + UTF_8_ENCODING->DecodeWithBOMRemoval(Span(aInput, aInputLength), aText); if (NS_FAILED(rv)) { return rv; } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/base/CharacterData.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/base/CharacterData.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/base/CharacterData.cpp 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/base/CharacterData.cpp 2020-08-09 12:47:57.000000000 +0000 @@ -286,7 +286,7 @@ if (aLength) { to.Append(aBuffer, aLength); if (!bidi && (!document || !document->GetBidiEnabled())) { - bidi = HasRTLChars(MakeSpan(aBuffer, aLength)); + bidi = HasRTLChars(Span(aBuffer, aLength)); } } if (endOffset != textLength) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/base/Document.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/base/Document.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/base/Document.cpp 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/base/Document.cpp 2020-08-09 12:47:57.000000000 +0000 @@ -16656,5 +16656,13 @@ return false; } +void Document::GetConnectedShadowRoots( + nsTArray>& aOut) const { + aOut.SetCapacity(mComposedShadowRoots.Count()); + for (const auto& entry : mComposedShadowRoots) { + aOut.AppendElement(entry.GetKey()); + } +} + } // namespace dom } // namespace mozilla diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/base/Document.h firefox-trunk-81.0~a1~hg20200808r544015/dom/base/Document.h --- firefox-trunk-81.0~a1~hg20200807r543684/dom/base/Document.h 2020-08-07 05:56:04.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/base/Document.h 2020-08-09 12:47:57.000000000 +0000 @@ -3086,6 +3086,9 @@ return mComposedShadowRoots; } + // WebIDL method for chrome code. + void GetConnectedShadowRoots(nsTArray>&) const; + // Notifies any responsive content added by AddResponsiveContent upon media // features values changing. void NotifyMediaFeatureValuesChanged(); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/base/DocumentOrShadowRoot.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/base/DocumentOrShadowRoot.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/base/DocumentOrShadowRoot.cpp 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/base/DocumentOrShadowRoot.cpp 2020-08-09 12:47:57.000000000 +0000 @@ -172,7 +172,7 @@ mAdoptedStyleSheets.SetCapacity(aAdoptedStyleSheets.Length()); // Only add sheets that are not already in the common prefix. - for (const auto& sheet : MakeSpan(aAdoptedStyleSheets).From(commonPrefix)) { + for (const auto& sheet : Span(aAdoptedStyleSheets).From(commonPrefix)) { if (MOZ_UNLIKELY(!set.EnsureInserted(sheet))) { // The idea is that this case is rare, so we pay the price of removing the // old sheet from the styles and append it later rather than the other way diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/base/DOMParser.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/base/DOMParser.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/base/DOMParser.cpp 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/base/DOMParser.cpp 2020-08-09 12:47:57.000000000 +0000 @@ -119,7 +119,7 @@ SupportedType aType, ErrorResult& aRv) { aBuf.ComputeState(); - return ParseFromBuffer(MakeSpan(aBuf.Data(), aBuf.Length()), aType, aRv); + return ParseFromBuffer(Span(aBuf.Data(), aBuf.Length()), aType, aRv); } already_AddRefed DOMParser::ParseFromBuffer(Span aBuf, @@ -129,7 +129,7 @@ nsCOMPtr stream; nsresult rv = NS_NewByteInputStream( getter_AddRefs(stream), - MakeSpan(reinterpret_cast(aBuf.Elements()), aBuf.Length()), + Span(reinterpret_cast(aBuf.Elements()), aBuf.Length()), NS_ASSIGNMENT_DEPEND); if (NS_FAILED(rv)) { aRv.Throw(rv); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/base/EventSource.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/base/EventSource.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/base/EventSource.cpp 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/base/EventSource.cpp 2020-08-09 12:47:57.000000000 +0000 @@ -759,8 +759,8 @@ return; } char16_t buffer[1024]; - auto dst = MakeSpan(buffer); - auto src = AsBytes(MakeSpan(aBuffer, aLength)); + auto dst = Span(buffer); + auto src = AsBytes(Span(aBuffer, aLength)); // XXX EOF handling is https://bugzilla.mozilla.org/show_bug.cgi?id=1369018 for (;;) { uint32_t result; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/base/Navigator.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/base/Navigator.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/base/Navigator.cpp 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/base/Navigator.cpp 2020-08-09 12:47:57.000000000 +0000 @@ -1448,26 +1448,23 @@ return nullptr; } - auto shareResolver = [self = RefPtr(this)](nsresult aResult) { - MOZ_ASSERT(self->mSharePromise); - if (NS_SUCCEEDED(aResult)) { - self->mSharePromise->MaybeResolveWithUndefined(); - } else { - self->mSharePromise->MaybeReject(aResult); - } - self->mSharePromise = nullptr; - }; - - auto shareRejector = [self = RefPtr(this)]( - mozilla::ipc::ResponseRejectReason&& aReason) { - // IPC died or maybe page navigated... - if (self->mSharePromise) { - self->mSharePromise = nullptr; - } - }; - // Do the share - wgc->SendShare(data, shareResolver, shareRejector); + wgc->SendShare(data)->Then( + GetCurrentSerialEventTarget(), __func__, + [self = RefPtr{this}]( + PWindowGlobalChild::SharePromise::ResolveOrRejectValue&& aResult) { + if (aResult.IsResolve()) { + if (NS_SUCCEEDED(aResult.ResolveValue())) { + self->mSharePromise->MaybeResolveWithUndefined(); + } else { + self->mSharePromise->MaybeReject(aResult.ResolveValue()); + } + } else if (self->mSharePromise) { + // IPC died + self->mSharePromise->MaybeReject(NS_BINDING_ABORTED); + } + self->mSharePromise = nullptr; + }); return mSharePromise; } @@ -1490,7 +1487,7 @@ if (!mGamepadSecureContextWarningShown && !win->IsSecureContext()) { mGamepadSecureContextWarningShown = true; auto msg = - u"The Gamepad API is only available in " + u"The Gamepad API will only be available in " "secure contexts (e.g., https). Please see " "https://hacks.mozilla.org/2020/07/securing-gamepad-api/ for more " "info."_ns; @@ -1498,11 +1495,14 @@ msg, nsIScriptError::warningFlag, "DOM"_ns, win->GetExtantDoc()); } -#ifdef NIGHTLY_BUILD +#ifdef EARLY_BETA_OR_EARLIER if (!win->IsSecureContext()) { return; } +#endif +#ifdef NIGHTLY_BUILD + // We will move this into Beta in Firefox 82 if (!FeaturePolicyUtils::IsFeatureAllowed(win->GetExtantDoc(), u"gamepad"_ns)) { aRv.ThrowSecurityError( diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/base/nsContentUtils.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/base/nsContentUtils.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/base/nsContentUtils.cpp 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/base/nsContentUtils.cpp 2020-08-09 12:47:57.000000000 +0000 @@ -8301,26 +8301,26 @@ EncodeAttrString(*(u.mString), appender); break; case Unit::eLiteral: - appender.Append(MakeSpan(u.mLiteral, u.mLength)); + appender.Append(Span(u.mLiteral, u.mLength)); break; case Unit::eTextFragment: if (u.mTextFragment->Is2b()) { - appender.Append(MakeSpan(u.mTextFragment->Get2b(), - u.mTextFragment->GetLength())); + appender.Append( + Span(u.mTextFragment->Get2b(), u.mTextFragment->GetLength())); } else { - appender.Append(MakeSpan(u.mTextFragment->Get1b(), - u.mTextFragment->GetLength())); + appender.Append( + Span(u.mTextFragment->Get1b(), u.mTextFragment->GetLength())); } break; case Unit::eTextFragmentWithEncode: if (u.mTextFragment->Is2b()) { - EncodeTextFragment(MakeSpan(u.mTextFragment->Get2b(), - u.mTextFragment->GetLength()), - appender); + EncodeTextFragment( + Span(u.mTextFragment->Get2b(), u.mTextFragment->GetLength()), + appender); } else { - EncodeTextFragment(MakeSpan(u.mTextFragment->Get1b(), - u.mTextFragment->GetLength()), - appender); + EncodeTextFragment( + Span(u.mTextFragment->Get1b(), u.mTextFragment->GetLength()), + appender); } break; default: diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/base/nsDocumentEncoder.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/base/nsDocumentEncoder.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/base/nsDocumentEncoder.cpp 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/base/nsDocumentEncoder.cpp 2020-08-09 12:47:57.000000000 +0000 @@ -113,8 +113,8 @@ } uint8_t buffer[kEncoderBufferSizeInBytes]; - auto src = MakeSpan(mOutputBuffer); - auto bufferSpan = MakeSpan(buffer); + auto src = Span(mOutputBuffer); + auto bufferSpan = Span(buffer); // Reserve space for terminator auto dst = bufferSpan.To(bufferSpan.Length() - 1); for (;;) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/base/nsDOMWindowUtils.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/base/nsDOMWindowUtils.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/base/nsDOMWindowUtils.cpp 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/base/nsDOMWindowUtils.cpp 2020-08-09 12:47:57.000000000 +0000 @@ -558,8 +558,10 @@ return NS_ERROR_INVALID_ARG; } - CSSIntMargin scrollbarSizes = RoundedToInt( - CSSMargin::FromAppUnits(scrollFrame->GetActualScrollbarSizes())); + CSSIntMargin scrollbarSizes = + RoundedToInt(CSSMargin::FromAppUnits(scrollFrame->GetActualScrollbarSizes( + nsIScrollableFrame::ScrollbarSizesOptions:: + INCLUDE_VISUAL_VIEWPORT_SCROLLBARS))); *aOutVerticalScrollbarWidth = scrollbarSizes.LeftRight(); *aOutHorizontalScrollbarHeight = scrollbarSizes.TopBottom(); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/base/nsGlobalWindowOuter.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/base/nsGlobalWindowOuter.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/base/nsGlobalWindowOuter.cpp 2020-08-07 05:56:04.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/base/nsGlobalWindowOuter.cpp 2020-08-09 12:47:57.000000000 +0000 @@ -1948,27 +1948,35 @@ return aOptions.setExistingCompartment(xpc::PrivilegedJunkScope()); } - if (aNewInner->GetOuterWindow()) { - nsGlobalWindowOuter* top = aNewInner->GetInProcessTopInternal(); - if (top == aNewInner->GetOuterWindow()) { - // We're a toplevel load. Use a new zone. This way, when we do - // zone-based compartment sharing we won't share compartments - // across navigations. - return aOptions.setNewCompartmentAndZone(); + BrowsingContext* bc = aNewInner->GetBrowsingContext(); + if (bc->IsTop()) { + // We're a toplevel load. Use a new zone. This way, when we do + // zone-based compartment sharing we won't share compartments + // across navigations. + return aOptions.setNewCompartmentAndZone(); + } + + // Find the in-process ancestor highest in the hierarchy. + nsGlobalWindowInner* ancestor = nullptr; + for (WindowContext* wc = bc->GetParentWindowContext(); wc; + wc = wc->GetParentWindowContext()) { + if (nsGlobalWindowInner* win = wc->GetInnerWindow()) { + ancestor = win; } + } - // If we have a top-level window, use its zone. - if (top && top->GetGlobalJSObject()) { - JS::Zone* zone = JS::GetObjectZone(top->GetGlobalJSObject()); - // Now try to find an existing compartment that's same-origin - // with our principal. - CompartmentFinderState data(aPrincipal); - JS_IterateCompartmentsInZone(aCx, zone, &data, FindSameOriginCompartment); - if (data.compartment) { - return aOptions.setExistingCompartment(data.compartment); - } - return aOptions.setNewCompartmentInExistingZone(top->GetGlobalJSObject()); + // If we have an ancestor window, use its zone. + if (ancestor && ancestor->GetGlobalJSObject()) { + JS::Zone* zone = JS::GetObjectZone(ancestor->GetGlobalJSObject()); + // Now try to find an existing compartment that's same-origin + // with our principal. + CompartmentFinderState data(aPrincipal); + JS_IterateCompartmentsInZone(aCx, zone, &data, FindSameOriginCompartment); + if (data.compartment) { + return aOptions.setExistingCompartment(data.compartment); } + return aOptions.setNewCompartmentInExistingZone( + ancestor->GetGlobalJSObject()); } return aOptions.setNewCompartmentAndZone(); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/base/nsTextFragment.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/base/nsTextFragment.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/base/nsTextFragment.cpp 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/base/nsTextFragment.cpp 2020-08-09 12:47:57.000000000 +0000 @@ -314,8 +314,7 @@ } // Copy data - LossyConvertUtf16toLatin1(MakeSpan(aBuffer, aLength), - MakeSpan(buff, aLength)); + LossyConvertUtf16toLatin1(Span(aBuffer, aLength), Span(buff, aLength)); m1b = buff; mState.mIs2b = false; } @@ -344,7 +343,7 @@ memcpy(aDest, Get2b() + aOffset, sizeof(char16_t) * aCount); } else { const char* cp = m1b + aOffset; - ConvertLatin1toUtf16(MakeSpan(cp, aCount), MakeSpan(aDest, aCount)); + ConvertLatin1toUtf16(Span(cp, aCount), Span(aDest, aCount)); } } } @@ -429,8 +428,7 @@ // Copy data into buff char16_t* data = static_cast(buff->Data()); - ConvertLatin1toUtf16(MakeSpan(m1b, mState.mLength), - MakeSpan(data, mState.mLength)); + ConvertLatin1toUtf16(Span(m1b, mState.mLength), Span(data, mState.mLength)); memcpy(data + mState.mLength, aBuffer, aLength * sizeof(char16_t)); mState.mLength += aLength; @@ -471,8 +469,8 @@ } // Copy aBuffer into buff. - LossyConvertUtf16toLatin1(MakeSpan(aBuffer, aLength), - MakeSpan(buff + mState.mLength, aLength)); + LossyConvertUtf16toLatin1(Span(aBuffer, aLength), + Span(buff + mState.mLength, aLength)); m1b = buff; mState.mLength += aLength; @@ -498,7 +496,7 @@ // every allocation void nsTextFragment::UpdateBidiFlag(const char16_t* aBuffer, uint32_t aLength) { if (mState.mIs2b && !mState.mIsBidi) { - if (HasRTLChars(MakeSpan(aBuffer, aLength))) { + if (HasRTLChars(Span(aBuffer, aLength))) { mState.mIsBidi = true; } } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/base/nsXMLContentSerializer.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/base/nsXMLContentSerializer.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/base/nsXMLContentSerializer.cpp 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/base/nsXMLContentSerializer.cpp 2020-08-09 12:47:57.000000000 +0000 @@ -166,7 +166,7 @@ } } else { nsAutoString utf16; - if (!CopyASCIItoUTF16(MakeSpan(frag->Get1b() + aStartOffset, length), utf16, + if (!CopyASCIItoUTF16(Span(frag->Get1b() + aStartOffset, length), utf16, mozilla::fallible_t())) { return NS_ERROR_OUT_OF_MEMORY; } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/bindings/BindingUtils.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/bindings/BindingUtils.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/bindings/BindingUtils.cpp 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/bindings/BindingUtils.cpp 2020-08-09 12:47:57.000000000 +0000 @@ -2624,7 +2624,7 @@ } char16_t* ptr = aString.BeginWriting(); - auto span = MakeSpan(ptr, len); + auto span = Span(ptr, len); span[upTo] = 0xFFFD; EnsureUtf16ValiditySpan(span.From(upTo + 1)); return true; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/bindings/Codegen.py firefox-trunk-81.0~a1~hg20200808r544015/dom/bindings/Codegen.py --- firefox-trunk-81.0~a1~hg20200807r543684/dom/bindings/Codegen.py 2020-08-07 05:56:03.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/bindings/Codegen.py 2020-08-09 12:47:57.000000000 +0000 @@ -10504,10 +10504,10 @@ static_assert(static_cast(${name}::EndGuard_) == Count, "Mismatch between enum value and enum count"); - inline Span GetString(${name} stringId) { + inline auto GetString(${name} stringId) { MOZ_ASSERT(static_cast<${type}>(stringId) < Count); const EnumEntry& entry = ${entry_array}[static_cast<${type}>(stringId)]; - return MakeSpan(entry.value, entry.length); + return Span{entry.value, entry.length}; } """, entry_array=ENUM_ENTRY_VARIABLE_NAME, diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/bindings/FakeString.h firefox-trunk-81.0~a1~hg20200808r544015/dom/bindings/FakeString.h --- firefox-trunk-81.0~a1~hg20200807r543684/dom/bindings/FakeString.h 2020-08-07 05:56:04.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/bindings/FakeString.h 2020-08-09 12:47:57.000000000 +0000 @@ -79,11 +79,14 @@ operator mozilla::Span() const { MOZ_ASSERT(mDataInitialized); - return mozilla::MakeSpan(mData, Length()); + // Explicitly specify template argument here to avoid instantiating + // Span first and then implicitly converting to Span + return mozilla::Span{mData, Length()}; } operator mozilla::Span() { - return mozilla::MakeSpan(BeginWriting(), Length()); + return mozilla::Span{BeginWriting(), Length()}; } mozilla::BulkWriteHandle BulkWrite(size_type aCapacity, diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/canvas/test/reftest/reftest.list firefox-trunk-81.0~a1~hg20200808r544015/dom/canvas/test/reftest/reftest.list --- firefox-trunk-81.0~a1~hg20200807r543684/dom/canvas/test/reftest/reftest.list 2020-08-07 05:56:04.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/canvas/test/reftest/reftest.list 2020-08-09 12:47:57.000000000 +0000 @@ -44,48 +44,50 @@ # Does we draw the correct colors in the correct places? # Combinations: PowerSet([readback, aa, preserve, premult, alpha]) x [frame=1,frame=6] # This is 2^6 = 64 combinations. -skip-if(Android) == webgl-color-test.html?frame=1&__&________&_______&_____ wrapper.html?colors-no-alpha.png -skip-if(Android) == webgl-color-test.html?frame=1&aa&________&_______&_____ wrapper.html?colors-no-alpha.png -skip-if(Android) == webgl-color-test.html?frame=1&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png -skip-if(Android) == webgl-color-test.html?frame=1&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png -skip-if(Android) == webgl-color-test.html?frame=1&__&________&premult&_____ wrapper.html?colors-no-alpha.png -skip-if(Android) == webgl-color-test.html?frame=1&aa&________&premult&_____ wrapper.html?colors-no-alpha.png -skip-if(Android) == webgl-color-test.html?frame=1&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png -skip-if(Android) == webgl-color-test.html?frame=1&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png -fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) skip-if(Android) == webgl-color-test.html?frame=1&__&________&_______&alpha wrapper.html?colors-non-premult.png -fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) skip-if(Android) == webgl-color-test.html?frame=1&aa&________&_______&alpha wrapper.html?colors-non-premult.png -fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) skip-if(Android) == webgl-color-test.html?frame=1&__&preserve&_______&alpha wrapper.html?colors-non-premult.png -fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) skip-if(Android) == webgl-color-test.html?frame=1&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png +# +# These currently fail with SWGL - Bug 1657771 +skip-if(Android) fails-if(swgl) == webgl-color-test.html?frame=1&__&________&_______&_____ wrapper.html?colors-no-alpha.png +skip-if(Android) fails-if(swgl) == webgl-color-test.html?frame=1&aa&________&_______&_____ wrapper.html?colors-no-alpha.png +skip-if(Android) fails-if(swgl) == webgl-color-test.html?frame=1&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png +skip-if(Android) fails-if(swgl) == webgl-color-test.html?frame=1&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png +skip-if(Android) fails-if(swgl) == webgl-color-test.html?frame=1&__&________&premult&_____ wrapper.html?colors-no-alpha.png +skip-if(Android) fails-if(swgl) == webgl-color-test.html?frame=1&aa&________&premult&_____ wrapper.html?colors-no-alpha.png +skip-if(Android) fails-if(swgl) == webgl-color-test.html?frame=1&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png +skip-if(Android) fails-if(swgl) == webgl-color-test.html?frame=1&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png +fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) skip-if(Android) == webgl-color-test.html?frame=1&__&________&_______&alpha wrapper.html?colors-non-premult.png +fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) skip-if(Android) == webgl-color-test.html?frame=1&aa&________&_______&alpha wrapper.html?colors-non-premult.png +fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) skip-if(Android) == webgl-color-test.html?frame=1&__&preserve&_______&alpha wrapper.html?colors-non-premult.png +fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) skip-if(Android) == webgl-color-test.html?frame=1&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png skip-if(Android) == webgl-color-test.html?frame=1&__&________&premult&alpha wrapper.html?colors-premult.png skip-if(Android) == webgl-color-test.html?frame=1&aa&________&premult&alpha wrapper.html?colors-premult.png skip-if(Android) == webgl-color-test.html?frame=1&__&preserve&premult&alpha wrapper.html?colors-premult.png skip-if(Android) == webgl-color-test.html?frame=1&aa&preserve&premult&alpha wrapper.html?colors-premult.png -skip-if(Android) == webgl-color-test.html?frame=6&__&________&_______&_____ wrapper.html?colors-no-alpha.png -skip-if(Android) == webgl-color-test.html?frame=6&aa&________&_______&_____ wrapper.html?colors-no-alpha.png -skip-if(Android) == webgl-color-test.html?frame=6&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png -skip-if(Android) == webgl-color-test.html?frame=6&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png -skip-if(Android) == webgl-color-test.html?frame=6&__&________&premult&_____ wrapper.html?colors-no-alpha.png -skip-if(Android) == webgl-color-test.html?frame=6&aa&________&premult&_____ wrapper.html?colors-no-alpha.png -skip-if(Android) == webgl-color-test.html?frame=6&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png -skip-if(Android) == webgl-color-test.html?frame=6&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png -fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) skip-if(Android) == webgl-color-test.html?frame=6&__&________&_______&alpha wrapper.html?colors-non-premult.png -fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) skip-if(Android) == webgl-color-test.html?frame=6&aa&________&_______&alpha wrapper.html?colors-non-premult.png -fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) skip-if(Android) == webgl-color-test.html?frame=6&__&preserve&_______&alpha wrapper.html?colors-non-premult.png -fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) skip-if(Android) == webgl-color-test.html?frame=6&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png +skip-if(Android) fails-if(swgl) == webgl-color-test.html?frame=6&__&________&_______&_____ wrapper.html?colors-no-alpha.png +skip-if(Android) fails-if(swgl) == webgl-color-test.html?frame=6&aa&________&_______&_____ wrapper.html?colors-no-alpha.png +skip-if(Android) fails-if(swgl) == webgl-color-test.html?frame=6&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png +skip-if(Android) fails-if(swgl) == webgl-color-test.html?frame=6&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png +skip-if(Android) fails-if(swgl) == webgl-color-test.html?frame=6&__&________&premult&_____ wrapper.html?colors-no-alpha.png +skip-if(Android) fails-if(swgl) == webgl-color-test.html?frame=6&aa&________&premult&_____ wrapper.html?colors-no-alpha.png +skip-if(Android) fails-if(swgl) == webgl-color-test.html?frame=6&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png +skip-if(Android) fails-if(swgl) == webgl-color-test.html?frame=6&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png +fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) skip-if(Android) == webgl-color-test.html?frame=6&__&________&_______&alpha wrapper.html?colors-non-premult.png +fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) skip-if(Android) == webgl-color-test.html?frame=6&aa&________&_______&alpha wrapper.html?colors-non-premult.png +fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) skip-if(Android) == webgl-color-test.html?frame=6&__&preserve&_______&alpha wrapper.html?colors-non-premult.png +fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) skip-if(Android) == webgl-color-test.html?frame=6&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png skip-if(Android) == webgl-color-test.html?frame=6&__&________&premult&alpha wrapper.html?colors-premult.png skip-if(Android) == webgl-color-test.html?frame=6&aa&________&premult&alpha wrapper.html?colors-premult.png skip-if(Android) == webgl-color-test.html?frame=6&__&preserve&premult&alpha wrapper.html?colors-premult.png skip-if(Android) == webgl-color-test.html?frame=6&aa&preserve&premult&alpha wrapper.html?colors-premult.png - pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&_______&_____ wrapper.html?colors-no-alpha.png - pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&_______&_____ wrapper.html?colors-no-alpha.png - pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png - pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png - pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&premult&_____ wrapper.html?colors-no-alpha.png - pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&premult&_____ wrapper.html?colors-no-alpha.png - pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png - pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png + pref(webgl.force-layers-readback,true) fails-if(swgl) == webgl-color-test.html?frame=1&readback&__&________&_______&_____ wrapper.html?colors-no-alpha.png + pref(webgl.force-layers-readback,true) fails-if(swgl) == webgl-color-test.html?frame=1&readback&aa&________&_______&_____ wrapper.html?colors-no-alpha.png + pref(webgl.force-layers-readback,true) fails-if(swgl) == webgl-color-test.html?frame=1&readback&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png + pref(webgl.force-layers-readback,true) fails-if(swgl) == webgl-color-test.html?frame=1&readback&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png + pref(webgl.force-layers-readback,true) fails-if(swgl) == webgl-color-test.html?frame=1&readback&__&________&premult&_____ wrapper.html?colors-no-alpha.png + pref(webgl.force-layers-readback,true) fails-if(swgl) == webgl-color-test.html?frame=1&readback&aa&________&premult&_____ wrapper.html?colors-no-alpha.png + pref(webgl.force-layers-readback,true) fails-if(swgl) == webgl-color-test.html?frame=1&readback&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png + pref(webgl.force-layers-readback,true) fails-if(swgl) == webgl-color-test.html?frame=1&readback&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&_______&alpha wrapper.html?colors-non-premult.png fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&_______&alpha wrapper.html?colors-non-premult.png fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&_______&alpha wrapper.html?colors-non-premult.png @@ -95,14 +97,14 @@ pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&premult&alpha wrapper.html?colors-premult.png pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&premult&alpha wrapper.html?colors-premult.png - pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&_______&_____ wrapper.html?colors-no-alpha.png - pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&_______&_____ wrapper.html?colors-no-alpha.png - pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png - pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png - pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&premult&_____ wrapper.html?colors-no-alpha.png - pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&premult&_____ wrapper.html?colors-no-alpha.png - pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png - pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png + pref(webgl.force-layers-readback,true) fails-if(swgl) == webgl-color-test.html?frame=6&readback&__&________&_______&_____ wrapper.html?colors-no-alpha.png + pref(webgl.force-layers-readback,true) fails-if(swgl) == webgl-color-test.html?frame=6&readback&aa&________&_______&_____ wrapper.html?colors-no-alpha.png + pref(webgl.force-layers-readback,true) fails-if(swgl) == webgl-color-test.html?frame=6&readback&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png + pref(webgl.force-layers-readback,true) fails-if(swgl) == webgl-color-test.html?frame=6&readback&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png + pref(webgl.force-layers-readback,true) fails-if(swgl) == webgl-color-test.html?frame=6&readback&__&________&premult&_____ wrapper.html?colors-no-alpha.png + pref(webgl.force-layers-readback,true) fails-if(swgl) == webgl-color-test.html?frame=6&readback&aa&________&premult&_____ wrapper.html?colors-no-alpha.png + pref(webgl.force-layers-readback,true) fails-if(swgl) == webgl-color-test.html?frame=6&readback&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png + pref(webgl.force-layers-readback,true) fails-if(swgl) == webgl-color-test.html?frame=6&readback&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&_______&alpha wrapper.html?colors-non-premult.png fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&_______&alpha wrapper.html?colors-non-premult.png fuzzy(0-1,0-30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11&&!webrender) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&_______&alpha wrapper.html?colors-non-premult.png diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/encoding/TextDecoder.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/encoding/TextDecoder.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/encoding/TextDecoder.cpp 2020-08-07 05:56:04.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/encoding/TextDecoder.cpp 2020-08-09 12:47:58.000000000 +0000 @@ -116,7 +116,7 @@ data = buf.GetAsArrayBuffer().Data(); length = buf.GetAsArrayBuffer().Length(); } - Decode(MakeSpan(data, length), aOptions.mStream, aOutDecodedString, aRv); + Decode(Span(data, length), aOptions.mStream, aOutDecodedString, aRv); } void TextDecoder::GetEncoding(nsAString& aEncoding) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/encoding/TextEncoder.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/encoding/TextEncoder.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/encoding/TextEncoder.cpp 2020-08-07 05:56:04.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/encoding/TextEncoder.cpp 2020-08-09 12:47:58.000000000 +0000 @@ -34,7 +34,7 @@ size_t read; size_t written; auto maybe = JS_EncodeStringToUTF8BufferPartial( - aCx, aSrc, AsWritableChars(MakeSpan(aDst.Data(), aDst.Length()))); + aCx, aSrc, AsWritableChars(Span(aDst.Data(), aDst.Length()))); if (!maybe) { aError.ReportOOM(); return; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/events/DataTransfer.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/events/DataTransfer.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/events/DataTransfer.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/events/DataTransfer.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -1062,7 +1062,7 @@ type.Length() * sizeof(nsString::char_type), "Why is formatLength off?"); rv = stream->WriteBytes( - AsBytes(MakeSpan(type.BeginReading(), type.Length()))); + AsBytes(Span(type.BeginReading(), type.Length()))); if (NS_WARN_IF(NS_FAILED(rv))) { totalCustomLength = 0; continue; @@ -1076,9 +1076,9 @@ // length of "data" if the variant contained an nsISupportsString // as VTYPE_INTERFACE, say. We used lengthInBytes above for // sizing, so just keep doing that. - rv = stream->WriteBytes(MakeSpan( - reinterpret_cast(data.BeginReading()), - lengthInBytes)); + rv = stream->WriteBytes( + Span(reinterpret_cast(data.BeginReading()), + lengthInBytes)); if (NS_WARN_IF(NS_FAILED(rv))) { totalCustomLength = 0; continue; @@ -1492,8 +1492,7 @@ nsCOMPtr stringStream; NS_NewByteInputStream(getter_AddRefs(stringStream), - MakeSpan(chrs, checkedLen.value()), - NS_ASSIGNMENT_ADOPT); + Span(chrs, checkedLen.value()), NS_ASSIGNMENT_ADOPT); nsCOMPtr stream = NS_NewObjectInputStream(stringStream); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/events/test/mochitest.ini firefox-trunk-81.0~a1~hg20200808r544015/dom/events/test/mochitest.ini --- firefox-trunk-81.0~a1~hg20200807r543684/dom/events/test/mochitest.ini 2020-08-07 05:56:04.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/events/test/mochitest.ini 2020-08-09 12:47:58.000000000 +0000 @@ -122,7 +122,6 @@ skip-if = toolkit == 'android' #CRASH_DUMP, RANDOM [test_bug704423.html] [test_bug741666.html] -skip-if = (xorigin && fission) # Inconsistent pass/fail in treeherder [test_coalesce_touchmove.html] support-files = file_coalesce_touchmove.html skip-if = debug #In order to be able to test touchmoves, the test needs to synthesize touchstart in a way which asserts diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/events/test/pointerevents/pointerevent_on_event_handlers.html firefox-trunk-81.0~a1~hg20200808r544015/dom/events/test/pointerevents/pointerevent_on_event_handlers.html --- firefox-trunk-81.0~a1~hg20200807r543684/dom/events/test/pointerevents/pointerevent_on_event_handlers.html 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/events/test/pointerevents/pointerevent_on_event_handlers.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ - - - - PointerEvent: Constructor test - - - - - - - - -

PointerEvent: Dispatch custom event

-

Test Description: This test checks if on pointer event handlers through attributes works properly using synthetic pointerevents. For valid results, this test must be run without generating real (trusted) events on the black rectangle below.

-
- -
-

The following pointer types were detected: .

-
-
- - diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/fetch/BodyExtractor.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/fetch/BodyExtractor.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/fetch/BodyExtractor.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/fetch/BodyExtractor.cpp 2020-08-09 12:47:58.000000000 +0000 @@ -33,7 +33,7 @@ nsCOMPtr stream; nsresult rv = NS_NewByteInputStream( - getter_AddRefs(stream), MakeSpan(data, aDataLength), NS_ASSIGNMENT_COPY); + getter_AddRefs(stream), Span(data, aDataLength), NS_ASSIGNMENT_COPY); NS_ENSURE_SUCCESS(rv, rv); stream.forget(aResult); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/file/FileReader.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/file/FileReader.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/file/FileReader.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/file/FileReader.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -262,7 +262,7 @@ void PopulateBufferForBinaryString(char16_t* aDest, const char* aSource, uint32_t aCount) { // Zero-extend each char to char16_t. - ConvertLatin1toUtf16(MakeSpan(aSource, aCount), MakeSpan(aDest, aCount)); + ConvertLatin1toUtf16(Span(aSource, aCount), Span(aDest, aCount)); } nsresult ReadFuncBinaryString(nsIInputStream* aInputStream, void* aClosure, @@ -468,7 +468,7 @@ } } - auto data = MakeSpan(reinterpret_cast(aFileData), aDataLen); + auto data = Span(reinterpret_cast(aFileData), aDataLen); nsresult rv; Tie(rv, encoding) = encoding->Decode(data, aResult); return NS_FAILED(rv) ? rv : NS_OK; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/file/MemoryBlobImpl.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/file/MemoryBlobImpl.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/file/MemoryBlobImpl.cpp 2020-08-07 05:56:04.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/file/MemoryBlobImpl.cpp 2020-08-09 12:47:58.000000000 +0000 @@ -56,7 +56,7 @@ rv = NS_NewByteInputStream( getter_AddRefs(stream), - MakeSpan(static_cast(aDataOwner->mData) + aStart, aLength), + Span(static_cast(aDataOwner->mData) + aStart, aLength), NS_ASSIGNMENT_DEPEND); NS_ENSURE_SUCCESS(rv, rv); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/gamepad/GamepadMonitoring.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/gamepad/GamepadMonitoring.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/gamepad/GamepadMonitoring.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/gamepad/GamepadMonitoring.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/dom/GamepadMonitoring.h" -#include "mozilla/dom/GamepadPlatformService.h" -#include "mozilla/ipc/BackgroundParent.h" - -using namespace mozilla::ipc; - -namespace mozilla { -namespace dom { - -void MaybeStopGamepadMonitoring() { - AssertIsOnBackgroundThread(); - RefPtr service = - GamepadPlatformService::GetParentService(); - MOZ_ASSERT(service); - if (service->HasGamepadListeners()) { - return; - } - StopGamepadMonitoring(); - service->ResetGamepadIndexes(); - service->MaybeShutdown(); -} - -} // namespace dom -} // namespace mozilla diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/gamepad/GamepadMonitoring.h firefox-trunk-81.0~a1~hg20200808r544015/dom/gamepad/GamepadMonitoring.h --- firefox-trunk-81.0~a1~hg20200807r543684/dom/gamepad/GamepadMonitoring.h 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/gamepad/GamepadMonitoring.h 2020-08-09 12:47:58.000000000 +0000 @@ -9,9 +9,6 @@ namespace mozilla { namespace dom { -// Functions for platform specific gamepad monitoring. - -void MaybeStopGamepadMonitoring(); // These two functions are implemented in the platform specific service files // (linux/LinuxGamepad.cpp, cocoa/CocoaGamepad.cpp, etc) diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/gamepad/GamepadPlatformService.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/gamepad/GamepadPlatformService.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/gamepad/GamepadPlatformService.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/gamepad/GamepadPlatformService.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -221,6 +221,8 @@ } FlushPendingEvents(); + + StartGamepadMonitoring(); } void GamepadPlatformService::FlushPendingEvents() { @@ -250,18 +252,17 @@ MOZ_ASSERT(mChannelParents.Contains(aParent)); // We use mutex here to prevent race condition with monitor thread - MutexAutoLock autoLock(mMutex); - mChannelParents.RemoveElement(aParent); -} - -bool GamepadPlatformService::HasGamepadListeners() { - // mChannelParents may be accessed by background thread in the - // same time, we use mutex to prevent possible race condtion - AssertIsOnBackgroundThread(); + { + MutexAutoLock autoLock(mMutex); + mChannelParents.RemoveElement(aParent); + if (!mChannelParents.IsEmpty()) { + return; + } + } - // We use mutex here to prevent race condition with monitor thread - MutexAutoLock autoLock(mMutex); - return !mChannelParents.IsEmpty(); + StopGamepadMonitoring(); + ResetGamepadIndexes(); + MaybeShutdown(); } void GamepadPlatformService::MaybeShutdown() { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/gamepad/GamepadPlatformService.h firefox-trunk-81.0~a1~hg20200808r544015/dom/gamepad/GamepadPlatformService.h --- firefox-trunk-81.0~a1~hg20200807r543684/dom/gamepad/GamepadPlatformService.h 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/gamepad/GamepadPlatformService.h 2020-08-09 12:47:59.000000000 +0000 @@ -85,8 +85,6 @@ // Remove IPDL parent instance void RemoveChannelParent(GamepadEventChannelParent* aParent); - bool HasGamepadListeners(); - void MaybeShutdown(); private: diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/gamepad/ipc/GamepadEventChannelParent.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/gamepad/ipc/GamepadEventChannelParent.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/gamepad/ipc/GamepadEventChannelParent.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/gamepad/ipc/GamepadEventChannelParent.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -49,8 +49,6 @@ service->AddChannelParent(this); - StartGamepadMonitoring(); - return true; } @@ -61,8 +59,6 @@ GamepadPlatformService::GetParentService(); MOZ_ASSERT(service); service->RemoveChannelParent(this); - - MaybeStopGamepadMonitoring(); } mozilla::ipc::IPCResult GamepadEventChannelParent::RecvVibrateHaptic( diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/gamepad/moz.build firefox-trunk-81.0~a1~hg20200808r544015/dom/gamepad/moz.build --- firefox-trunk-81.0~a1~hg20200807r543684/dom/gamepad/moz.build 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/gamepad/moz.build 2020-08-09 12:47:58.000000000 +0000 @@ -41,7 +41,6 @@ 'GamepadHapticActuator.cpp', 'GamepadLightIndicator.cpp', 'GamepadManager.cpp', - 'GamepadMonitoring.cpp', 'GamepadPlatformService.cpp', 'GamepadPose.cpp', 'GamepadRemapping.cpp', diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/indexedDB/ActorsParent.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/indexedDB/ActorsParent.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/indexedDB/ActorsParent.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/indexedDB/ActorsParent.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -894,7 +894,7 @@ return NS_ERROR_FILE_CORRUPTED; } - rv = ReadCompressedIndexDataValuesFromBlob(MakeSpan(blobData, blobDataLength), + rv = ReadCompressedIndexDataValuesFromBlob(Span(blobData, blobDataLength), aOutIndexValues); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -3580,8 +3580,7 @@ return rv; } - auto oldIdvOrErr = - ReadOldCompressedIDVFromBlob(MakeSpan(oldBlob, oldBlobLength)); + auto oldIdvOrErr = ReadOldCompressedIDVFromBlob(Span(oldBlob, oldBlobLength)); if (NS_WARN_IF(oldIdvOrErr.isErr())) { return oldIdvOrErr.unwrapErr(); } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/interfaces/base/nsIDOMWindowUtils.idl firefox-trunk-81.0~a1~hg20200808r544015/dom/interfaces/base/nsIDOMWindowUtils.idl --- firefox-trunk-81.0~a1~hg20200807r543684/dom/interfaces/base/nsIDOMWindowUtils.idl 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/interfaces/base/nsIDOMWindowUtils.idl 2020-08-09 12:47:58.000000000 +0000 @@ -205,6 +205,11 @@ * Note that on some platforms, scrollbars don't take up layout space * ("overlay scrollbars"). On such platforms, the returned sizes are * always zero. + * + * Layout scrollbars that normally take up space but were only shown to + * scroll the visual viewport inside the layout viewport (the layout viewport + * cannot be scrolled) do not take up space but they still return their size + * from this function. */ void getScrollbarSizes(in Element aElement, out uint32_t aVerticalScrollbarWidth, diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/ipc/BrowserChild.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/ipc/BrowserChild.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/ipc/BrowserChild.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/ipc/BrowserChild.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -160,8 +160,6 @@ static const char BEFORE_FIRST_PAINT[] = "before-first-paint"; -nsTHashtable>* BrowserChild::sVisibleTabs; - typedef nsDataHashtable BrowserChildMap; static BrowserChildMap* sBrowserChildren; StaticMutex sBrowserChildrenMutex; @@ -943,13 +941,6 @@ BrowserChild::~BrowserChild() { mAnonymousGlobalScopes.Clear(); - if (sVisibleTabs) { - sVisibleTabs->RemoveEntry(this); - if (sVisibleTabs->IsEmpty()) { - delete sVisibleTabs; - sVisibleTabs = nullptr; - } - } DestroyWindow(); @@ -2779,11 +2770,6 @@ return; } - if (!sVisibleTabs) { - sVisibleTabs = new nsTHashtable>(); - } - sVisibleTabs->PutEntry(this); - if (mPuppetWidget) { mPuppetWidget->Show(true); } @@ -2817,12 +2803,6 @@ } void BrowserChild::MakeHidden() { - if (sVisibleTabs) { - sVisibleTabs->RemoveEntry(this); - // We don't delete sVisibleTabs here when it's empty since that - // could cause a lot of churn. Instead, we wait until ~BrowserChild. - } - if (!IsVisible()) { return; } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/ipc/BrowserChild.h firefox-trunk-81.0~a1~hg20200808r544015/dom/ipc/BrowserChild.h --- firefox-trunk-81.0~a1~hg20200807r543684/dom/ipc/BrowserChild.h 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/ipc/BrowserChild.h 2020-08-09 12:47:59.000000000 +0000 @@ -664,20 +664,6 @@ mCancelContentJSEpoch = aEpoch; } - static bool HasVisibleTabs() { - return sVisibleTabs && !sVisibleTabs->IsEmpty(); - } - - // Returns the set of BrowserChilds that are currently rendering layers. There - // can be multiple BrowserChilds in this state if Firefox has multiple windows - // open or is warming tabs up. There can also be zero BrowserChilds in this - // state. Note that this function should only be called if HasVisibleTabs() - // returns true. - static const nsTHashtable>& GetVisibleTabs() { - MOZ_ASSERT(HasVisibleTabs()); - return *sVisibleTabs; - } - bool UpdateSessionStore(uint32_t aFlushId, bool aIsFinal = false); #ifdef XP_WIN @@ -934,12 +920,6 @@ Maybe mWindowSupportsProtectedMedia; #endif - // This state is used to keep track of the current visible tabs (the ones - // rendering layers). There may be more than one if there are multiple browser - // windows open, or tabs are being warmed up. There may be none if this - // process does not host any visible or warming tabs. - static nsTHashtable>* sVisibleTabs; - DISALLOW_EVIL_CONSTRUCTORS(BrowserChild); }; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/ipc/ContentChild.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/ipc/ContentChild.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/ipc/ContentChild.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/ipc/ContentChild.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -1330,7 +1330,7 @@ nsCOMPtr ucsURL = std::move(aXPCOMInit.userContentSheetURL()); GlobalStyleSheetCache::SetUserContentCSSURL(ucsURL); - GfxInfoBase::SetFeatureStatus(aXPCOMInit.gfxFeatureStatus()); + GfxInfoBase::SetFeatureStatus(std::move(aXPCOMInit.gfxFeatureStatus())); DataStorage::SetCachedStorageEntries(aXPCOMInit.dataStorage()); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/ipc/ContentParent.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/ipc/ContentParent.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/ipc/ContentParent.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/ipc/ContentParent.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -2672,7 +2672,7 @@ nsCOMPtr gfxInfo = services::GetGfxInfo(); if (gfxInfo) { GfxInfoBase* gfxInfoRaw = static_cast(gfxInfo.get()); - gfxInfoRaw->GetAllFeatures(xpcomInit); + xpcomInit.gfxFeatureStatus() = gfxInfoRaw->GetAllFeatures(); } #ifdef XP_WIN diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/ipc/PContent.ipdl firefox-trunk-81.0~a1~hg20200808r544015/dom/ipc/PContent.ipdl --- firefox-trunk-81.0~a1~hg20200807r543684/dom/ipc/PContent.ipdl 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/ipc/PContent.ipdl 2020-08-09 12:47:59.000000000 +0000 @@ -289,13 +289,6 @@ GMPAPITags[] capabilities; }; -struct GfxInfoFeatureStatus -{ - int32_t feature; - int32_t status; - nsCString failureId; -}; - struct XPCOMInitData { bool isOffline; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/jsurl/nsJSProtocolHandler.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/jsurl/nsJSProtocolHandler.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/jsurl/nsJSProtocolHandler.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/jsurl/nsJSProtocolHandler.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -337,7 +337,7 @@ aChannel->SetContentCharset(*charset); if (bytes) rv = NS_NewByteInputStream(getter_AddRefs(mInnerStream), - mozilla::MakeSpan(bytes, bytesLen), + mozilla::Span(bytes, bytesLen), NS_ASSIGNMENT_ADOPT); else rv = NS_ERROR_OUT_OF_MEMORY; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/media/AudioStream.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/media/AudioStream.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/media/AudioStream.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/media/AudioStream.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -606,8 +606,8 @@ } auto writer = AudioBufferWriter( - MakeSpan(reinterpret_cast(aBuffer), - mOutChannels * aFrames), + Span(reinterpret_cast(aBuffer), + mOutChannels * aFrames), mOutChannels, aFrames); if (mPrefillQuirk) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/media/DynamicResampler.h firefox-trunk-81.0~a1~hg20200808r544015/dom/media/DynamicResampler.h --- firefox-trunk-81.0~a1~hg20200807r543684/dom/media/DynamicResampler.h 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/media/DynamicResampler.h 2020-08-09 12:47:58.000000000 +0000 @@ -134,7 +134,7 @@ } if (mInRate == mOutRate) { - mInternalInBuffer[aChannelIndex].Read(MakeSpan(aOutBuffer, *aOutFrames)); + mInternalInBuffer[aChannelIndex].Read(Span(aOutBuffer, *aOutFrames)); // Workaround to avoid discontinuity when the speex resampler operates // again. Feed it with the last 20 frames to warm up the internal memory // of the resampler and then skip memory equals to resampler's input @@ -176,7 +176,7 @@ MOZ_ASSERT(aChannelIndex >= 0); MOZ_ASSERT(aChannelIndex <= mChannels); MOZ_ASSERT((uint32_t)aChannelIndex <= mInternalInBuffer.Length()); - mInternalInBuffer[aChannelIndex].Write(MakeSpan(aInBuffer, aInFrames)); + mInternalInBuffer[aChannelIndex].Write(Span(aInBuffer, aInFrames)); } void WarmUpResampler(bool aSkipLatency); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/media/gmp/ChromiumCDMParent.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/media/gmp/ChromiumCDMParent.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/media/gmp/ChromiumCDMParent.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/media/gmp/ChromiumCDMParent.cpp 2020-08-09 12:47:58.000000000 +0000 @@ -608,9 +608,9 @@ } for (size_t i = 0; i < mDecrypts.Length(); i++) { if (mDecrypts[i]->mId == aId) { - mDecrypts[i]->PostResult(ToDecryptStatus(aStatus), - MakeSpan(aShmem.get(), - aShmem.Size())); + mDecrypts[i]->PostResult( + ToDecryptStatus(aStatus), + Span(aShmem.get(), aShmem.Size())); mDecrypts.RemoveElementAt(i); break; } @@ -768,7 +768,7 @@ } RefPtr v = CreateVideoFrame( - aFrame, MakeSpan(aShmem.get(), aShmem.Size())); + aFrame, Span(aShmem.get(), aShmem.Size())); if (!v) { mDecodePromise.RejectIfExists( MediaResult(NS_ERROR_OUT_OF_MEMORY, diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/media/gtest/TestAudioRingBuffer.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/media/gtest/TestAudioRingBuffer.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/media/gtest/TestAudioRingBuffer.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/media/gtest/TestAudioRingBuffer.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -25,7 +25,7 @@ EXPECT_EQ(ringBuffer.AvailableRead(), 4); float in[4] = {.1, .2, .3, .4}; - rv = ringBuffer.Write(MakeSpan(in, 4)); + rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -39,7 +39,7 @@ EXPECT_EQ(ringBuffer.AvailableWrite(), 0); EXPECT_EQ(ringBuffer.AvailableRead(), 10); - rv = ringBuffer.Write(MakeSpan(in, 4)); + rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 0); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(ringBuffer.IsFull()); @@ -47,7 +47,7 @@ EXPECT_EQ(ringBuffer.AvailableRead(), 10); float out[4] = {}; - rv = ringBuffer.Read(MakeSpan(out, 4)); + rv = ringBuffer.Read(Span(out, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -57,7 +57,7 @@ EXPECT_FLOAT_EQ(f, 0.0); } - rv = ringBuffer.Read(MakeSpan(out, 4)); + rv = ringBuffer.Read(Span(out, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -67,7 +67,7 @@ EXPECT_FLOAT_EQ(in[i], out[i]); } - rv = ringBuffer.Read(MakeSpan(out, 4)); + rv = ringBuffer.Read(Span(out, 4)); EXPECT_EQ(rv, 2); EXPECT_TRUE(ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -103,7 +103,7 @@ EXPECT_EQ(ringBuffer.AvailableRead(), 4); short in[4] = {1, 2, 3, 4}; - rv = ringBuffer.Write(MakeSpan(in, 4)); + rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -117,7 +117,7 @@ EXPECT_EQ(ringBuffer.AvailableWrite(), 0); EXPECT_EQ(ringBuffer.AvailableRead(), 10); - rv = ringBuffer.Write(MakeSpan(in, 4)); + rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 0); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(ringBuffer.IsFull()); @@ -125,7 +125,7 @@ EXPECT_EQ(ringBuffer.AvailableRead(), 10); short out[4] = {}; - rv = ringBuffer.Read(MakeSpan(out, 4)); + rv = ringBuffer.Read(Span(out, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -135,7 +135,7 @@ EXPECT_EQ(f, 0); } - rv = ringBuffer.Read(MakeSpan(out, 4)); + rv = ringBuffer.Read(Span(out, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -145,7 +145,7 @@ EXPECT_EQ(in[i], out[i]); } - rv = ringBuffer.Read(MakeSpan(out, 4)); + rv = ringBuffer.Read(Span(out, 4)); EXPECT_EQ(rv, 2); EXPECT_TRUE(ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -174,14 +174,14 @@ EXPECT_EQ(ringBuffer.AvailableRead(), 0); float in[4] = {.1, .2, .3, .4}; - int rv = ringBuffer.Write(MakeSpan(in, 4)); + int rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); EXPECT_EQ(ringBuffer.AvailableWrite(), 6); EXPECT_EQ(ringBuffer.AvailableRead(), 4); - rv = ringBuffer.Write(MakeSpan(in, 4)); + rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -189,7 +189,7 @@ EXPECT_EQ(ringBuffer.AvailableRead(), 8); float out[4] = {}; - rv = ringBuffer.Read(MakeSpan(out, 4)); + rv = ringBuffer.Read(Span(out, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -200,14 +200,14 @@ } // WriteIndex = 12 - rv = ringBuffer.Write(MakeSpan(in, 4)); + rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); EXPECT_EQ(ringBuffer.AvailableWrite(), 2); EXPECT_EQ(ringBuffer.AvailableRead(), 8); - rv = ringBuffer.Read(MakeSpan(out, 4)); + rv = ringBuffer.Read(Span(out, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -217,7 +217,7 @@ EXPECT_FLOAT_EQ(in[i], out[i]); } - rv = ringBuffer.Read(MakeSpan(out, 8)); + rv = ringBuffer.Read(Span(out, 8)); EXPECT_EQ(rv, 4); EXPECT_TRUE(ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -227,7 +227,7 @@ EXPECT_FLOAT_EQ(in[i], out[i]); } - rv = ringBuffer.Read(MakeSpan(out, 8)); + rv = ringBuffer.Read(Span(out, 8)); EXPECT_EQ(rv, 0); EXPECT_TRUE(ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -238,28 +238,28 @@ } // WriteIndex = 16 - rv = ringBuffer.Write(MakeSpan(in, 4)); + rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); EXPECT_EQ(ringBuffer.AvailableWrite(), 6); EXPECT_EQ(ringBuffer.AvailableRead(), 4); - rv = ringBuffer.Write(MakeSpan(in, 4)); + rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); EXPECT_EQ(ringBuffer.AvailableWrite(), 2); EXPECT_EQ(ringBuffer.AvailableRead(), 8); - rv = ringBuffer.Write(MakeSpan(in, 4)); + rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 2); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(ringBuffer.IsFull()); EXPECT_EQ(ringBuffer.AvailableWrite(), 0); EXPECT_EQ(ringBuffer.AvailableRead(), 10); - rv = ringBuffer.Write(MakeSpan(in, 4)); + rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 0); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(ringBuffer.IsFull()); @@ -278,14 +278,14 @@ EXPECT_EQ(ringBuffer.AvailableRead(), 0); int16_t in[4] = {1, 2, 3, 4}; - int rv = ringBuffer.Write(MakeSpan(in, 4)); + int rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); EXPECT_EQ(ringBuffer.AvailableWrite(), 6); EXPECT_EQ(ringBuffer.AvailableRead(), 4); - rv = ringBuffer.Write(MakeSpan(in, 4)); + rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -293,7 +293,7 @@ EXPECT_EQ(ringBuffer.AvailableRead(), 8); int16_t out[4] = {}; - rv = ringBuffer.Read(MakeSpan(out, 4)); + rv = ringBuffer.Read(Span(out, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -304,14 +304,14 @@ } // WriteIndex = 12 - rv = ringBuffer.Write(MakeSpan(in, 4)); + rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); EXPECT_EQ(ringBuffer.AvailableWrite(), 2); EXPECT_EQ(ringBuffer.AvailableRead(), 8); - rv = ringBuffer.Read(MakeSpan(out, 4)); + rv = ringBuffer.Read(Span(out, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -321,7 +321,7 @@ EXPECT_EQ(in[i], out[i]); } - rv = ringBuffer.Read(MakeSpan(out, 8)); + rv = ringBuffer.Read(Span(out, 8)); EXPECT_EQ(rv, 4); EXPECT_TRUE(ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -331,7 +331,7 @@ EXPECT_EQ(in[i], out[i]); } - rv = ringBuffer.Read(MakeSpan(out, 8)); + rv = ringBuffer.Read(Span(out, 8)); EXPECT_EQ(rv, 0); EXPECT_TRUE(ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -342,28 +342,28 @@ } // WriteIndex = 16 - rv = ringBuffer.Write(MakeSpan(in, 4)); + rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); EXPECT_EQ(ringBuffer.AvailableWrite(), 6); EXPECT_EQ(ringBuffer.AvailableRead(), 4); - rv = ringBuffer.Write(MakeSpan(in, 4)); + rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 4); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); EXPECT_EQ(ringBuffer.AvailableWrite(), 2); EXPECT_EQ(ringBuffer.AvailableRead(), 8); - rv = ringBuffer.Write(MakeSpan(in, 4)); + rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 2); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(ringBuffer.IsFull()); EXPECT_EQ(ringBuffer.AvailableWrite(), 0); EXPECT_EQ(ringBuffer.AvailableRead(), 10); - rv = ringBuffer.Write(MakeSpan(in, 4)); + rv = ringBuffer.Write(Span(in, 4)); EXPECT_EQ(rv, 0); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(ringBuffer.IsFull()); @@ -377,7 +377,7 @@ ringBuffer.SetSampleFormat(AUDIO_FORMAT_FLOAT32); float in[8] = {.0, .1, .2, .3, .4, .5, .6, .7}; - ringBuffer.Write(MakeSpan(in, 6)); + ringBuffer.Write(Span(in, 6)); // v ReadIndex // [x0: .0, x1: .1, x2: .2, x3: .3, x4: .4, // x5: .5, x6: .0, x7: .0, x8: .0, x9: .0, x10: .0] @@ -399,7 +399,7 @@ EXPECT_FLOAT_EQ(out[i], in[i]); } - ringBuffer.Write(MakeSpan(in, 8)); + ringBuffer.Write(Span(in, 8)); // Now the buffer contains: // [x0: .5, x1: .6, x2: .2, x3: .3, x4: .4, // x5: .5, x6: .0, x7: .1, x8: .2, x9: .3, x10: .4 @@ -426,7 +426,7 @@ ringBuffer.SetSampleFormat(AUDIO_FORMAT_S16); short in[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - ringBuffer.Write(MakeSpan(in, 6)); + ringBuffer.Write(Span(in, 6)); // v ReadIndex // [x0: 0, x1: 1, x2: 2, x3: 3, x4: 4, // x5: 5, x6: 0, x7: 0, x8: 0, x9: 0, x10: 0] @@ -448,7 +448,7 @@ EXPECT_EQ(out[i], in[i]); } - ringBuffer.Write(MakeSpan(in, 8)); + ringBuffer.Write(Span(in, 8)); // Now the buffer contains: // [x0: 5, x1: 6, x2: 2, x3: 3, x4: 4, // x5: 5, x6: 0, x7: 1, x8: 2, x9: 3, x10: 4 @@ -475,7 +475,7 @@ ringBuffer.SetSampleFormat(AUDIO_FORMAT_FLOAT32); float in[8] = {.0, .1, .2, .3, .4, .5, .6, .7}; - ringBuffer.Write(MakeSpan(in, 6)); + ringBuffer.Write(Span(in, 6)); // v ReadIndex // [x0: .0, x1: .1, x2: .2, x3: .3, x4: .4, // x5: .5, x6: .0, x7: .0, x8: .0, x9: .0, x10: .0] @@ -525,7 +525,7 @@ EXPECT_FLOAT_EQ(out[i + 3], in[i + 3]); } - ringBuffer.Write(MakeSpan(in, 8)); + ringBuffer.Write(Span(in, 8)); // Now the buffer contains: // [x0: .5, x1: .6, x2: .7, x3: .3, x4: .4, // x5: .5, x6: .0, x7: .1, x8: .2, x9: .3, x10: .4 @@ -607,7 +607,7 @@ ringBuffer.SetSampleFormat(AUDIO_FORMAT_S16); short in[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - ringBuffer.Write(MakeSpan(in, 6)); + ringBuffer.Write(Span(in, 6)); // v ReadIndex // [x0: 0, x1: 1, x2: 2, x3: 3, x4: 4, // x5: 5, x6: 0, x7: 0, x8: 0, x9: 0, x10: 0] @@ -657,7 +657,7 @@ EXPECT_EQ(out[i + 3], in[i + 3]); } - ringBuffer.Write(MakeSpan(in, 8)); + ringBuffer.Write(Span(in, 8)); // Now the buffer contains: // [x0: 5, x1: 6, x2: 7, x3: 3, x4: 4, // x5: 5, x6: 0, x7: 1, x8: 2, x9: 3, x10: 4 @@ -739,7 +739,7 @@ ringBuffer.SetSampleFormat(AUDIO_FORMAT_FLOAT32); float in[8] = {.0, .1, .2, .3, .4, .5, .6, .7}; - ringBuffer.Write(MakeSpan(in, 8)); + ringBuffer.Write(Span(in, 8)); int rv = ringBuffer.Discard(3); EXPECT_EQ(rv, 3); @@ -749,7 +749,7 @@ EXPECT_EQ(ringBuffer.AvailableRead(), 5); float out[8] = {}; - rv = ringBuffer.Read(MakeSpan(out, 3)); + rv = ringBuffer.Read(Span(out, 3)); EXPECT_EQ(rv, 3); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -781,7 +781,7 @@ ringBuffer.SetSampleFormat(AUDIO_FORMAT_S16); short in[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - ringBuffer.Write(MakeSpan(in, 8)); + ringBuffer.Write(Span(in, 8)); int rv = ringBuffer.Discard(3); EXPECT_EQ(rv, 3); @@ -791,7 +791,7 @@ EXPECT_EQ(ringBuffer.AvailableRead(), 5); short out[8] = {}; - rv = ringBuffer.Read(MakeSpan(out, 3)); + rv = ringBuffer.Read(Span(out, 3)); EXPECT_EQ(rv, 3); EXPECT_TRUE(!ringBuffer.IsEmpty()); EXPECT_TRUE(!ringBuffer.IsFull()); @@ -901,7 +901,7 @@ ringBuffer1.SetSampleFormat(AUDIO_FORMAT_S16); short in[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - int rv = ringBuffer1.Write(MakeSpan(in, 8)); + int rv = ringBuffer1.Write(Span(in, 8)); EXPECT_EQ(rv, 8); AudioRingBuffer ringBuffer2(11 * sizeof(short)); @@ -913,7 +913,7 @@ EXPECT_EQ(ringBuffer1.AvailableRead(), 8); short out[4] = {}; - rv = ringBuffer2.Read(MakeSpan(out, 4)); + rv = ringBuffer2.Read(Span(out, 4)); for (int i = 0; i < rv; ++i) { EXPECT_EQ(out[i], in[i]); } @@ -930,7 +930,7 @@ EXPECT_EQ(ringBuffer1.AvailableRead(), 4); short out2[8] = {}; - rv = ringBuffer2.Read(MakeSpan(out2, 8)); + rv = ringBuffer2.Read(Span(out2, 8)); for (int i = 0; i < rv; ++i) { EXPECT_EQ(out2[i], in[i]); } @@ -942,7 +942,7 @@ ringBuffer1.SetSampleFormat(AUDIO_FORMAT_FLOAT32); float in[8] = {.0, .1, .2, .3, .4, .5, .6, .7}; - int rv = ringBuffer1.Write(MakeSpan(in, 8)); + int rv = ringBuffer1.Write(Span(in, 8)); EXPECT_EQ(rv, 8); AudioRingBuffer ringBuffer2(11 * sizeof(float)); @@ -954,7 +954,7 @@ EXPECT_EQ(ringBuffer1.AvailableRead(), 8); float out[4] = {}; - rv = ringBuffer2.Read(MakeSpan(out, 4)); + rv = ringBuffer2.Read(Span(out, 4)); for (int i = 0; i < rv; ++i) { EXPECT_FLOAT_EQ(out[i], in[i]); } @@ -971,7 +971,7 @@ EXPECT_EQ(ringBuffer1.AvailableRead(), 4); float out2[8] = {}; - rv = ringBuffer2.Read(MakeSpan(out2, 8)); + rv = ringBuffer2.Read(Span(out2, 8)); for (int i = 0; i < rv; ++i) { EXPECT_FLOAT_EQ(out2[i], in[i]); } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/media/MediaCache.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/media/MediaCache.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/media/MediaCache.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/media/MediaCache.cpp 2020-08-09 12:47:58.000000000 +0000 @@ -2009,13 +2009,13 @@ // True if we commit any blocks to the cache. bool cacheUpdated = false; - auto source = MakeSpan(aData, aCount); + auto source = Span(aData, aCount); // We process the data one block (or part of a block) at a time while (!source.IsEmpty()) { // The data we've collected so far in the partial block. - auto partial = MakeSpan(mPartialBlockBuffer.get(), - OffsetInBlock(mChannelOffset)); + auto partial = Span(mPartialBlockBuffer.get(), + OffsetInBlock(mChannelOffset)); if (partial.IsEmpty()) { // We've just started filling this buffer so now is a good time @@ -2037,8 +2037,8 @@ cacheUpdated = true; } else { // The buffer to be filled in the partial block. - auto buf = MakeSpan(mPartialBlockBuffer.get() + partial.Length(), - remaining); + auto buf = Span(mPartialBlockBuffer.get() + partial.Length(), + remaining); memcpy(buf.Elements(), source.Elements(), source.Length()); mChannelOffset += source.Length(); break; @@ -2078,7 +2078,7 @@ // Write back the partial block memset(mPartialBlockBuffer.get() + blockOffset, 0, BLOCK_SIZE - blockOffset); - auto data = MakeSpan(mPartialBlockBuffer.get(), BLOCK_SIZE); + auto data = Span(mPartialBlockBuffer.get(), BLOCK_SIZE); mMediaCache->AllocateAndWriteBlock( aLock, this, blockIndex, mMetadataInPartialBlockBuffer ? MODE_METADATA : MODE_PLAYBACK, data); @@ -2458,7 +2458,7 @@ return 0; } - auto source = MakeSpan( + auto source = Span( mPartialBlockBuffer.get() + OffsetInBlock(aOffset), OffsetInBlock(mChannelOffset) - OffsetInBlock(aOffset)); // We have |source.Length() <= BLOCK_SIZE < INT32_MAX| to guarantee @@ -2529,7 +2529,7 @@ auto streamOffset = mStreamOffset; // The buffer we are about to fill. - auto buffer = MakeSpan(aBuffer, aCount); + auto buffer = Span(aBuffer, aCount); // Read one block (or part of a block) at a time while (!buffer.IsEmpty()) { @@ -2634,7 +2634,7 @@ AutoLock lock(mMediaCache->Monitor()); // The buffer we are about to fill. - auto buffer = MakeSpan(aBuffer, aCount); + auto buffer = Span(aBuffer, aCount); // Read one block (or part of a block) at a time int64_t streamOffset = aOffset; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/media/MediaData.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/media/MediaData.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/media/MediaData.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/media/MediaData.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -55,7 +55,7 @@ mFrames(mAudioData.Length() / aChannels) {} Span AudioData::Data() const { - return MakeSpan(GetAdjustedData(), mFrames * mChannels); + return Span{GetAdjustedData(), mFrames * mChannels}; } bool AudioData::AdjustForStartTime(const media::TimeUnit& aStartTime) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/media/MediaData.h firefox-trunk-81.0~a1~hg20200808r544015/dom/media/MediaData.h --- firefox-trunk-81.0~a1~hg20200807r543684/dom/media/MediaData.h 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/media/MediaData.h 2020-08-09 12:47:59.000000000 +0000 @@ -627,7 +627,7 @@ mAlphaBuffer.ComputedSizeOfExcludingThis(); } // Access the buffer as a Span. - operator Span() { return MakeSpan(Data(), Size()); } + operator Span() { return Span{Data(), Size()}; } const CryptoSample& mCrypto; RefPtr mExtraData; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/media/mp4/MP4Demuxer.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/media/mp4/MP4Demuxer.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/media/mp4/MP4Demuxer.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/media/mp4/MP4Demuxer.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -422,7 +422,7 @@ } } else if (mType == kVP9 && !sample->mCrypto.IsEncrypted()) { bool keyframe = VPXDecoder::IsKeyframe( - MakeSpan(sample->Data(), sample->Size()), + Span(sample->Data(), sample->Size()), VPXDecoder::Codec::VP9); if (sample->mKeyframe != keyframe) { NS_WARNING(nsPrintfCString( diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/media/platforms/agnostic/bytestreams/H264.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/media/platforms/agnostic/bytestreams/H264.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/media/platforms/agnostic/bytestreams/H264.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/media/platforms/agnostic/bytestreams/H264.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -1321,8 +1321,8 @@ WriteExtraData( extraData, aProfile, aConstraints, aLevel, - MakeSpan(encodedSPS->Elements(), encodedSPS->Length()), - MakeSpan(PPS, sizeof(PPS))); + Span(encodedSPS->Elements(), encodedSPS->Length()), + Span(PPS, sizeof(PPS))); return extraData.forget(); } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/media/platforms/android/AndroidDataEncoder.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/media/platforms/android/AndroidDataEncoder.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/media/platforms/android/AndroidDataEncoder.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/media/platforms/android/AndroidDataEncoder.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -243,7 +243,7 @@ // Convert to avcC. nsTArray paramSets; AnnexB::ParseNALEntries( - MakeSpan(annexB->Elements(), annexB->Length()), paramSets); + Span(annexB->Elements(), annexB->Length()), paramSets); auto avcc = MakeRefPtr(); AnnexB::NALEntry& sps = paramSets.ElementAt(0); @@ -251,8 +251,8 @@ const uint8_t* spsPtr = annexB->Elements() + sps.mOffset; H264::WriteExtraData( avcc, spsPtr[1], spsPtr[2], spsPtr[3], - MakeSpan(spsPtr, sps.mSize), - MakeSpan(annexB->Elements() + pps.mOffset, pps.mSize)); + Span(spsPtr, sps.mSize), + Span(annexB->Elements() + pps.mOffset, pps.mSize)); return avcc; } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/media/platforms/wmf/WMFVideoMFTManager.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/media/platforms/wmf/WMFVideoMFTManager.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/media/platforms/wmf/WMFVideoMFTManager.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/media/platforms/wmf/WMFVideoMFTManager.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -727,7 +727,7 @@ // Check the VP9 profile. the VP9 MFT can only handle correctly profile 0 // and 2 (yuv420 8/10/12 bits) int profile = - VPXDecoder::GetVP9Profile(MakeSpan(aSample->Data(), aSample->Size())); + VPXDecoder::GetVP9Profile(Span(aSample->Data(), aSample->Size())); if (profile != 0 && profile != 2) { return E_FAIL; } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/media/platforms/wrappers/MediaChangeMonitor.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/media/platforms/wrappers/MediaChangeMonitor.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/media/platforms/wrappers/MediaChangeMonitor.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/media/platforms/wrappers/MediaChangeMonitor.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -169,7 +169,7 @@ return NS_OK; } - auto dataSpan = MakeSpan(aSample->Data(), aSample->Size()); + auto dataSpan = Span(aSample->Data(), aSample->Size()); VPXDecoder::VPXStreamInfo info; if (!VPXDecoder::GetStreamInfo(dataSpan, info, mCodec)) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/media/webaudio/AudioNodeTrack.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/media/webaudio/AudioNodeTrack.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/media/webaudio/AudioNodeTrack.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/media/webaudio/AudioNodeTrack.cpp 2020-08-09 12:48:00.000000000 +0000 @@ -533,10 +533,8 @@ &finished); } else { mEngine->ProcessBlocksOnPorts( - this, aFrom, - MakeSpan(mInputChunks.Elements(), mEngine->InputCount()), - MakeSpan(mLastChunks.Elements(), mEngine->OutputCount()), - &finished); + this, aFrom, Span(mInputChunks.Elements(), mEngine->InputCount()), + Span(mLastChunks.Elements(), mEngine->OutputCount()), &finished); } } for (uint16_t i = 0; i < outputCount; ++i) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/media/webaudio/AudioWorkletNode.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/media/webaudio/AudioWorkletNode.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/media/webaudio/AudioWorkletNode.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/media/webaudio/AudioWorkletNode.cpp 2020-08-09 12:48:00.000000000 +0000 @@ -85,8 +85,8 @@ bool* aFinished) override { MOZ_ASSERT(InputCount() <= 1); MOZ_ASSERT(OutputCount() <= 1); - ProcessBlocksOnPorts(aTrack, aFrom, MakeSpan(&aInput, InputCount()), - MakeSpan(aOutput, OutputCount()), aFinished); + ProcessBlocksOnPorts(aTrack, aFrom, Span(&aInput, InputCount()), + Span(aOutput, OutputCount()), aFinished); } void ProcessBlocksOnPorts(AudioNodeTrack* aTrack, GraphTime aFrom, diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/media/webm/WebMDemuxer.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/media/webm/WebMDemuxer.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/media/webm/WebMDemuxer.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/media/webm/WebMDemuxer.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -638,8 +638,8 @@ packetEncryption == NESTEGG_PACKET_HAS_SIGNAL_BYTE_UNENCRYPTED || packetEncryption == NESTEGG_PACKET_HAS_SIGNAL_BYTE_FALSE, "Unencrypted packet expected"); - auto sample = MakeSpan(data, length); - auto alphaSample = MakeSpan(alphaData, alphaLength); + auto sample = Span(data, length); + auto alphaSample = Span(alphaData, alphaLength); switch (mVideoCodec) { case NESTEGG_CODEC_VP8: diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/plugins/test/testplugin/testplugin.mozbuild firefox-trunk-81.0~a1~hg20200808r544015/dom/plugins/test/testplugin/testplugin.mozbuild --- firefox-trunk-81.0~a1~hg20200807r543684/dom/plugins/test/testplugin/testplugin.mozbuild 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/plugins/test/testplugin/testplugin.mozbuild 2020-08-09 12:48:00.000000000 +0000 @@ -41,7 +41,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': RCFILE = 'nptest.rc' - RESFILE = 'nptest.res' DEFFILE = 'nptest.def' if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' and CONFIG['TARGET_CPU'] == 'x86_64': diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/presentation/PresentationRequest.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/presentation/PresentationRequest.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/presentation/PresentationRequest.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/presentation/PresentationRequest.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -199,7 +199,7 @@ char buffer[NSID_LENGTH]; uuid.ToProvidedString(buffer); nsAutoString id; - CopyASCIItoUTF16(MakeSpan(buffer, NSID_LENGTH - 1), id); + CopyASCIItoUTF16(Span(buffer, NSID_LENGTH - 1), id); nsCOMPtr service = do_GetService(PRESENTATION_SERVICE_CONTRACTID); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/quota/test/gtest/TestEncryptedStream.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/quota/test/gtest/TestEncryptedStream.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/quota/test/gtest/TestEncryptedStream.cpp 2020-08-07 05:56:06.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/quota/test/gtest/TestEncryptedStream.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -412,7 +412,7 @@ return; } - const auto encryptedDataSpan = AsBytes(MakeSpan(encryptedDataStream->Data())); + const auto encryptedDataSpan = AsBytes(Span(encryptedDataStream->Data())); const auto plainTestData = MakeTestData(testParams.DataSize()); auto encryptedBlock = EncryptedBlock::DecodeInto( - unicodeDecoder, data, MakeSpan(aBufOut, bufferLength.value()), + unicodeDecoder, data, Span(aBufOut, bufferLength.value()), /* aEndOfSource = */ true); return NS_OK; } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/script/ScriptLoadHandler.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/script/ScriptLoadHandler.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/script/ScriptLoadHandler.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/script/ScriptLoadHandler.cpp 2020-08-09 12:48:00.000000000 +0000 @@ -66,8 +66,8 @@ } size_t written = ScriptDecoding::DecodeInto( - mDecoder, MakeSpan(aData, aDataLength), - MakeSpan(scriptText.begin() + haveRead, needed.value()), aEndOfStream); + mDecoder, Span(aData, aDataLength), + Span(scriptText.begin() + haveRead, needed.value()), aEndOfStream); MOZ_ASSERT(written <= needed.value()); haveRead += written; @@ -182,7 +182,7 @@ // Do BOM detection. const Encoding* encoding; size_t bomLength; - Tie(encoding, bomLength) = Encoding::ForBOM(MakeSpan(aData, aDataLength)); + Tie(encoding, bomLength) = Encoding::ForBOM(Span(aData, aDataLength)); if (encoding) { mDecoder = encoding->NewDecoderWithBOMRemoval(); return true; diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/security/nsContentSecurityUtils.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/security/nsContentSecurityUtils.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/security/nsContentSecurityUtils.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/security/nsContentSecurityUtils.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -233,6 +233,10 @@ static constexpr auto kExtensionRegex = u"extensions/(.+)@(.+)!(.+)$"_ns; static constexpr auto kSingleFileRegex = u"^[a-zA-Z0-9.?]+$"_ns; + if (fileName.IsEmpty()) { + return FilenameTypeAndDetails(kOther, Nothing()); + } + // resource:// and chrome:// if (StringBeginsWith(fileName, u"chrome://"_ns)) { return FilenameTypeAndDetails(kChromeURI, Some(fileName)); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/security/test/gtest/TestUnexpectedPrivilegedLoads.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/security/test/gtest/TestUnexpectedPrivilegedLoads.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/security/test/gtest/TestUnexpectedPrivilegedLoads.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/security/test/gtest/TestUnexpectedPrivilegedLoads.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -93,13 +93,27 @@ "other"_ns, "TYPE_SCRIPT"_ns, "web"_ns, "unknown"_ns #endif }}, + {// test for cases where finalURI is empty + ""_ns, + nsIContentPolicy::TYPE_IMAGE, + "web"_ns, + {"other"_ns, "TYPE_IMAGE"_ns, "web"_ns, "unknown"_ns}}, + {// test for cases where finalURI is null, due to the struct layout, we'll + // override the URL with nullptr in loop below. + "URLWillResultInNullPtr"_ns, + nsIContentPolicy::TYPE_FONT, + "web"_ns, + {"other"_ns, "TYPE_FONT"_ns, "web"_ns, "unknown"_ns}}, }; int i = 0; for (auto const& currentTest : myTestCases) { nsCOMPtr uri; - NS_NewURI(getter_AddRefs(uri), currentTest.urlstring); + // special-casing for a case where the uri is null + if (!currentTest.urlstring.Equals("URLWillResultInNullPtr")) { + NS_NewURI(getter_AddRefs(uri), currentTest.urlstring); + } // this will record the event nsContentSecurityManager::MeasureUnexpectedPrivilegedLoads( uri, currentTest.contentType, currentTest.remoteType); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGAnimatedEnumeration.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGAnimatedEnumeration.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGAnimatedEnumeration.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGAnimatedEnumeration.cpp 2020-08-09 12:48:00.000000000 +0000 @@ -14,13 +14,8 @@ NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGAnimatedEnumeration, mSVGElement) -NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGAnimatedEnumeration) -NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGAnimatedEnumeration) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGAnimatedEnumeration) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGAnimatedEnumeration, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGAnimatedEnumeration, Release) JSObject* DOMSVGAnimatedEnumeration::WrapObject( JSContext* aCx, JS::Handle aGivenProto) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGAnimatedEnumeration.h firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGAnimatedEnumeration.h --- firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGAnimatedEnumeration.h 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGAnimatedEnumeration.h 2020-08-09 12:47:59.000000000 +0000 @@ -14,10 +14,10 @@ namespace mozilla { namespace dom { -class DOMSVGAnimatedEnumeration : public nsISupports, public nsWrapperCache { +class DOMSVGAnimatedEnumeration : public nsWrapperCache { public: - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGAnimatedEnumeration) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGAnimatedEnumeration) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGAnimatedEnumeration) SVGElement* GetParentObject() const { return mSVGElement; } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGAnimatedInteger.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGAnimatedInteger.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGAnimatedInteger.cpp 2020-08-07 05:56:06.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGAnimatedInteger.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -14,13 +14,8 @@ NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGAnimatedInteger, mSVGElement) -NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGAnimatedInteger) -NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGAnimatedInteger) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGAnimatedInteger) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGAnimatedInteger, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGAnimatedInteger, Release) JSObject* DOMSVGAnimatedInteger::WrapObject(JSContext* aCx, JS::Handle aGivenProto) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGAnimatedInteger.h firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGAnimatedInteger.h --- firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGAnimatedInteger.h 2020-08-07 05:56:06.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGAnimatedInteger.h 2020-08-09 12:47:59.000000000 +0000 @@ -14,10 +14,10 @@ namespace mozilla { namespace dom { -class DOMSVGAnimatedInteger : public nsISupports, public nsWrapperCache { +class DOMSVGAnimatedInteger : public nsWrapperCache { public: - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGAnimatedInteger) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGAnimatedInteger) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGAnimatedInteger) SVGElement* GetParentObject() const { return mSVGElement; } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGAnimatedNumber.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGAnimatedNumber.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGAnimatedNumber.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGAnimatedNumber.cpp 2020-08-09 12:48:00.000000000 +0000 @@ -14,13 +14,8 @@ NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGAnimatedNumber, mSVGElement) -NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGAnimatedNumber) -NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGAnimatedNumber) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGAnimatedNumber) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGAnimatedNumber, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGAnimatedNumber, Release) JSObject* DOMSVGAnimatedNumber::WrapObject(JSContext* aCx, JS::Handle aGivenProto) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGAnimatedNumber.h firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGAnimatedNumber.h --- firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGAnimatedNumber.h 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGAnimatedNumber.h 2020-08-09 12:47:59.000000000 +0000 @@ -15,10 +15,10 @@ namespace mozilla { namespace dom { -class DOMSVGAnimatedNumber : public nsISupports, public nsWrapperCache { +class DOMSVGAnimatedNumber : public nsWrapperCache { public: - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGAnimatedNumber) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGAnimatedNumber) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGAnimatedNumber) SVGElement* GetParentObject() const { return mSVGElement; } diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGLength.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGLength.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGLength.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGLength.cpp 2020-08-09 12:48:00.000000000 +0000 @@ -50,14 +50,8 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER NS_IMPL_CYCLE_COLLECTION_TRACE_END -NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGLength) -NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGLength) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGLength) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(DOMSVGLength) // pseudo-interface - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGLength, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGLength, Release) DOMSVGLength::DOMSVGLength(DOMSVGLengthList* aList, uint8_t aAttrEnum, uint32_t aListIndex, bool aIsAnimValItem) diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGLength.h firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGLength.h --- firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGLength.h 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGLength.h 2020-08-09 12:47:59.000000000 +0000 @@ -15,18 +15,6 @@ #include "mozilla/Attributes.h" #include "nsWrapperCache.h" -// We make DOMSVGLength a pseudo-interface to allow us to QI to it in order to -// check that the objects that scripts pass to DOMSVGLengthList methods are our -// *native* length objects. -// -// {A8468350-7F7B-4976-9A7E-3765A1DADF9A} -#define MOZILLA_DOMSVGLENGTH_IID \ - { \ - 0xA8468350, 0x7F7B, 0x4976, { \ - 0x9A, 0x7E, 0x37, 0x65, 0xA1, 0xDA, 0xDF, 0x9A \ - } \ - } - #define MOZ_SVG_LIST_INDEX_BIT_COUNT 22 // supports > 4 million list items namespace mozilla { @@ -78,7 +66,7 @@ * if-else as appropriate. The bug for doing that work is: * https://bugzilla.mozilla.org/show_bug.cgi?id=571734 */ -class DOMSVGLength final : public nsISupports, public nsWrapperCache { +class DOMSVGLength final : public nsWrapperCache { template friend class AutoChangeLengthListNotifier; @@ -92,9 +80,8 @@ ~DOMSVGLength(); public: - NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOMSVGLENGTH_IID) - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGLength) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGLength) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGLength) /** * Generic ctor for DOMSVGLength objects that are created for an attribute. @@ -239,8 +226,6 @@ RefPtr mSVGElement; }; -NS_DEFINE_STATIC_IID_ACCESSOR(DOMSVGLength, MOZILLA_DOMSVGLENGTH_IID) - } // namespace dom } // namespace mozilla diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGLengthList.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGLengthList.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGLengthList.cpp 2020-08-07 05:56:06.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGLengthList.cpp 2020-08-09 12:47:59.000000000 +0000 @@ -10,7 +10,6 @@ #include "DOMSVGLength.h" #include "nsError.h" #include "SVGAnimatedLengthList.h" -#include "nsCOMPtr.h" #include "mozilla/dom/SVGLengthListBinding.h" #include @@ -293,7 +292,7 @@ MaybeRemoveItemFromAnimValListAt(index); // We have to return the removed item, so get it, creating it if necessary: - nsCOMPtr result = GetItemAt(index); + RefPtr result = GetItemAt(index); // Notify the DOM item of removal *before* modifying the lists so that the // DOM item can copy its *old* value: diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGNumber.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGNumber.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGNumber.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGNumber.cpp 2020-08-09 12:48:00.000000000 +0000 @@ -42,13 +42,8 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER NS_IMPL_CYCLE_COLLECTION_TRACE_END -NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGNumber) -NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGNumber) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGNumber) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGNumber, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGNumber, Release) DOMSVGNumber::DOMSVGNumber(DOMSVGNumberList* aList, uint8_t aAttrEnum, uint32_t aListIndex, bool aIsAnimValItem) diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGNumber.h firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGNumber.h --- firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/DOMSVGNumber.h 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/DOMSVGNumber.h 2020-08-09 12:48:00.000000000 +0000 @@ -37,7 +37,7 @@ * * See the comment in DOMSVGLength.h (yes, LENGTH), which applies here too. */ -class DOMSVGNumber final : public nsISupports, public nsWrapperCache { +class DOMSVGNumber final : public nsWrapperCache { template friend class AutoChangeNumberListNotifier; @@ -51,8 +51,8 @@ } public: - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGNumber) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGNumber) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGNumber) /** * Generic ctor for DOMSVGNumber objects that are created for an attribute. diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/SVGAnimatedPreserveAspectRatio.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/SVGAnimatedPreserveAspectRatio.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/SVGAnimatedPreserveAspectRatio.cpp 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/SVGAnimatedPreserveAspectRatio.cpp 2020-08-09 12:48:00.000000000 +0000 @@ -24,13 +24,9 @@ NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED( DOMSVGAnimatedPreserveAspectRatio, mSVGElement) -NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGAnimatedPreserveAspectRatio) -NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGAnimatedPreserveAspectRatio) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGAnimatedPreserveAspectRatio) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGAnimatedPreserveAspectRatio, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGAnimatedPreserveAspectRatio, + Release) JSObject* DOMSVGAnimatedPreserveAspectRatio::WrapObject( JSContext* aCx, JS::Handle aGivenProto) { diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/SVGAnimatedPreserveAspectRatio.h firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/SVGAnimatedPreserveAspectRatio.h --- firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/SVGAnimatedPreserveAspectRatio.h 2020-08-07 05:56:05.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/SVGAnimatedPreserveAspectRatio.h 2020-08-09 12:47:59.000000000 +0000 @@ -105,12 +105,12 @@ }; namespace dom { -class DOMSVGAnimatedPreserveAspectRatio final : public nsISupports, - public nsWrapperCache { +class DOMSVGAnimatedPreserveAspectRatio final : public nsWrapperCache { ~DOMSVGAnimatedPreserveAspectRatio(); - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS( + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING( + DOMSVGAnimatedPreserveAspectRatio) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS( DOMSVGAnimatedPreserveAspectRatio) DOMSVGAnimatedPreserveAspectRatio(SVGAnimatedPreserveAspectRatio* aVal, diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/SVGPreserveAspectRatio.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/SVGPreserveAspectRatio.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/SVGPreserveAspectRatio.cpp 2020-08-07 05:56:06.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/SVGPreserveAspectRatio.cpp 2020-08-09 12:48:00.000000000 +0000 @@ -19,13 +19,8 @@ NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGPreserveAspectRatio, mSVGElement) -NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGPreserveAspectRatio) -NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGPreserveAspectRatio) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGPreserveAspectRatio) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGPreserveAspectRatio, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGPreserveAspectRatio, Release) static const char* sAlignStrings[] = { "none", "xMinYMin", "xMidYMin", "xMaxYMin", "xMinYMid", diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/SVGPreserveAspectRatio.h firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/SVGPreserveAspectRatio.h --- firefox-trunk-81.0~a1~hg20200807r543684/dom/svg/SVGPreserveAspectRatio.h 2020-08-07 05:56:06.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/svg/SVGPreserveAspectRatio.h 2020-08-09 12:48:00.000000000 +0000 @@ -81,11 +81,10 @@ namespace dom { -class DOMSVGPreserveAspectRatio final : public nsISupports, - public nsWrapperCache { +class DOMSVGPreserveAspectRatio final : public nsWrapperCache { public: - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGPreserveAspectRatio) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGPreserveAspectRatio) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGPreserveAspectRatio) DOMSVGPreserveAspectRatio(SVGAnimatedPreserveAspectRatio* aVal, SVGElement* aSVGElement, bool aIsBaseValue) diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/system/IOUtils.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/system/IOUtils.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/system/IOUtils.cpp 2020-08-07 05:56:06.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/system/IOUtils.cpp 2020-08-09 12:48:00.000000000 +0000 @@ -268,7 +268,7 @@ // Process arguments. aData.ComputeState(); - auto buf = Buffer::CopyFrom(MakeSpan(aData.Data(), aData.Length())); + auto buf = Buffer::CopyFrom(Span(aData.Data(), aData.Length())); if (buf.isNothing()) { promise->MaybeRejectWithOperationError("Out of memory"); return promise.forget(); diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/webauthn/WebAuthnUtil.cpp firefox-trunk-81.0~a1~hg20200808r544015/dom/webauthn/WebAuthnUtil.cpp --- firefox-trunk-81.0~a1~hg20200807r543684/dom/webauthn/WebAuthnUtil.cpp 2020-08-07 05:56:06.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/webauthn/WebAuthnUtil.cpp 2020-08-09 12:48:00.000000000 +0000 @@ -260,7 +260,7 @@ return NS_ERROR_INVALID_ARG; } - Span rspView = MakeSpan(aResponse); + Span rspView = Span(aResponse); aFlags = rspView[0]; if (NS_WARN_IF(!aCounterBuf.AppendElements(rspView.FromTo(1, 5), diff -Nru firefox-trunk-81.0~a1~hg20200807r543684/dom/webidl/Document.webidl firefox-trunk-81.0~a1~hg20200808r544015/dom/webidl/Document.webidl --- firefox-trunk-81.0~a1~hg20200807r543684/dom/webidl/Document.webidl 2020-08-07 05:56:06.000000000 +0000 +++ firefox-trunk-81.0~a1~hg20200808r544015/dom/webidl/Document.webidl 2020-08-09 12:48:01.000000000 +0000 @@ -482,6 +482,15 @@ readonly attribute long popupRangeOffset; [ChromeOnly] attribute Node? tooltipNode; + + /** + * Returns all the shadow roots connected to the document, in no particular + * order, and without regard to open/closed-ness. Also returns UA widgets + * (like