diff --git a/accessible/jsat/ContentControl.jsm b/accessible/jsat/ContentControl.jsm index 10bdf839e0bc..6d28985c6347 100644 --- a/accessible/jsat/ContentControl.jsm +++ b/accessible/jsat/ContentControl.jsm @@ -502,7 +502,7 @@ this.ContentControl.prototype = { this._autoMove = 0; }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, + QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIMessageListener ]) }; diff --git a/accessible/jsat/EventManager.jsm b/accessible/jsat/EventManager.jsm index ca1c706b099b..10c24dda2803 100644 --- a/accessible/jsat/EventManager.jsm +++ b/accessible/jsat/EventManager.jsm @@ -556,10 +556,7 @@ this.EventManager.prototype = { this.present(Presentation.tabStateChanged(docAcc, "newdoc")); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener, - Ci.nsISupportsWeakReference, - Ci.nsISupports, - Ci.nsIObserver]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener, Ci.nsISupportsWeakReference, Ci.nsIObserver]) }; const AccessibilityEventObserver = { diff --git a/accessible/jsat/Traversal.jsm b/accessible/jsat/Traversal.jsm index c8224febc8ed..a758ec4f8b27 100644 --- a/accessible/jsat/Traversal.jsm +++ b/accessible/jsat/Traversal.jsm @@ -67,7 +67,7 @@ BaseTraversalRule.prototype = { return matchResult; }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIAccessibleTraversalRule]) }; var gSimpleTraversalRoles = diff --git a/accessible/jsat/Utils.jsm b/accessible/jsat/Utils.jsm index 2546d72c66bf..f3090225b09c 100644 --- a/accessible/jsat/Utils.jsm +++ b/accessible/jsat/Utils.jsm @@ -1057,6 +1057,6 @@ PrefCache.prototype = { } }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference]) }; diff --git a/accessible/tests/mochitest/pivot.js b/accessible/tests/mochitest/pivot.js index 983082f6b4f3..b3c02284b8d5 100644 --- a/accessible/tests/mochitest/pivot.js +++ b/accessible/tests/mochitest/pivot.js @@ -34,7 +34,7 @@ var HeadersTraversalRule = return FILTER_MATCH; }, - QueryInterface: XPCOMUtils.generateQI([nsIAccessibleTraversalRule]) + QueryInterface: ChromeUtils.generateQI([nsIAccessibleTraversalRule]) }; /** @@ -62,7 +62,7 @@ var ObjectTraversalRule = return rv; }, - QueryInterface: XPCOMUtils.generateQI([nsIAccessibleTraversalRule]) + QueryInterface: ChromeUtils.generateQI([nsIAccessibleTraversalRule]) }; // ////////////////////////////////////////////////////////////////////////////// diff --git a/browser/base/content/aboutDialog-appUpdater.js b/browser/base/content/aboutDialog-appUpdater.js index e81098a1e898..972c47d8d9db 100644 --- a/browser/base/content/aboutDialog-appUpdater.js +++ b/browser/base/content/aboutDialog-appUpdater.js @@ -301,12 +301,7 @@ appUpdater.prototype = /** * See nsISupports.idl */ - QueryInterface(aIID) { - if (!aIID.equals(Ci.nsIUpdateCheckListener) && - !aIID.equals(Ci.nsISupports)) - throw Cr.NS_ERROR_NO_INTERFACE; - return this; - } + QueryInterface: ChromeUtils.generateQI(["nsIUpdateCheckListener"]), }, /** @@ -427,11 +422,5 @@ appUpdater.prototype = /** * See nsISupports.idl */ - QueryInterface(aIID) { - if (!aIID.equals(Ci.nsIProgressEventSink) && - !aIID.equals(Ci.nsIRequestObserver) && - !aIID.equals(Ci.nsISupports)) - throw Cr.NS_ERROR_NO_INTERFACE; - return this; - } + QueryInterface: ChromeUtils.generateQI(["nsIProgressEventSink", "nsIRequestObserver"]), }; diff --git a/browser/base/content/browser-data-submission-info-bar.js b/browser/base/content/browser-data-submission-info-bar.js index cd4bb37a2abc..9fd96bc48b66 100644 --- a/browser/base/content/browser-data-submission-info-bar.js +++ b/browser/base/content/browser-data-submission-info-bar.js @@ -118,7 +118,7 @@ var gDataNotificationInfoBar = { } }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsIObserver, Ci.nsISupportsWeakReference, ]), diff --git a/browser/base/content/browser-feeds.js b/browser/base/content/browser-feeds.js index 26473c265f2e..f0c3c26c270b 100644 --- a/browser/base/content/browser-feeds.js +++ b/browser/base/content/browser-feeds.js @@ -412,8 +412,8 @@ var FeedHandler = { // nsISupports - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference]), init() { diff --git a/browser/base/content/browser-fullZoom.js b/browser/base/content/browser-fullZoom.js index 796c5893132d..e91a9993be31 100644 --- a/browser/base/content/browser-fullZoom.js +++ b/browser/base/content/browser-fullZoom.js @@ -39,10 +39,7 @@ var FullZoom = { // nsISupports - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsIContentPrefObserver, - Ci.nsISupportsWeakReference, - Ci.nsISupports]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, Ci.nsIContentPrefObserver, Ci.nsISupportsWeakReference]), // Initialization & Destruction diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index 988361f79e8b..56a20aa901c1 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -907,7 +907,7 @@ var PlacesMenuDNDHandler = { this._loadTimer.initWithCallback(() => { this._loadTimer = null; popup.setAttribute("autoopened", "true"); - popup.showPopup(popup); + popup.openPopup(); }, this._springLoadDelayMs, Ci.nsITimer.TYPE_ONE_SHOT); event.preventDefault(); event.stopPropagation(); @@ -1749,7 +1749,7 @@ var BookmarkingUI = { this._uninitView(); }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsINavBookmarkObserver ]) }; diff --git a/browser/base/content/browser-sync.js b/browser/base/content/browser-sync.js index ee3101e538b0..e825ceb90d50 100644 --- a/browser/base/content/browser-sync.js +++ b/browser/base/content/browser-sync.js @@ -690,7 +690,7 @@ var gSync = { } }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsIObserver, Ci.nsISupportsWeakReference ]) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index e39a1a767283..de142f8b15e7 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -4600,15 +4600,10 @@ var XULBrowserWindow = { isBusy: false, busyUI: false, - QueryInterface(aIID) { - if (aIID.equals(Ci.nsIWebProgressListener) || - aIID.equals(Ci.nsIWebProgressListener2) || - aIID.equals(Ci.nsISupportsWeakReference) || - aIID.equals(Ci.nsIXULBrowserWindow) || - aIID.equals(Ci.nsISupports)) - return this; - throw Cr.NS_NOINTERFACE; - }, + QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener", + "nsIWebProgressListener2", + "nsISupportsWeakReference", + "nsIXULBrowserWindow"]), get stopCommand() { delete this.stopCommand; @@ -5384,7 +5379,7 @@ var TabsProgressListener = { function nsBrowserAccess() { } nsBrowserAccess.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIBrowserDOMWindow, Ci.nsISupports]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIBrowserDOMWindow]), _openURIInNewTab(aURI, aReferrer, aReferrerPolicy, aIsPrivate, aIsExternal, aForceNotRemote = false, @@ -7740,8 +7735,8 @@ var RestoreLastSessionObserver = { goSetCommandEnabled("Browser:RestoreLastSession", false); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference]) }; function restoreLastSession() { diff --git a/browser/base/content/content.js b/browser/base/content/content.js index b4a78eaf9ab6..d33b2764cc97 100644 --- a/browser/base/content/content.js +++ b/browser/base/content/content.js @@ -1524,8 +1524,8 @@ let OfflineApps = { } } }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference]), }; addEventListener("MozApplicationManifest", OfflineApps, false); diff --git a/browser/base/content/tab-content.js b/browser/base/content/tab-content.js index bddc5c5a5718..e34a1c9a8640 100644 --- a/browser/base/content/tab-content.js +++ b/browser/base/content/tab-content.js @@ -859,10 +859,7 @@ var RefreshBlocker = { } }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener2, - Ci.nsIWebProgressListener, - Ci.nsISupportsWeakReference, - Ci.nsISupports]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener2, Ci.nsIWebProgressListener, Ci.nsISupportsWeakReference]), }; RefreshBlocker.init(); diff --git a/browser/base/content/tabbrowser.js b/browser/base/content/tabbrowser.js index 80acb201d3d9..7f9b2775b899 100644 --- a/browser/base/content/tabbrowser.js +++ b/browser/base/content/tabbrowser.js @@ -4574,16 +4574,11 @@ class TabProgressListener { return this._callProgressListeners("onRefreshAttempted", [aWebProgress, aURI, aDelay, aSameURI]); } - - QueryInterface(aIID) { - if (aIID.equals(Ci.nsIWebProgressListener) || - aIID.equals(Ci.nsIWebProgressListener2) || - aIID.equals(Ci.nsISupportsWeakReference) || - aIID.equals(Ci.nsISupports)) - return this; - throw Cr.NS_NOINTERFACE; - } } +TabProgressListener.prototype.QueryInterface = ChromeUtils.generateQI( + ["nsIWebProgressListener", + "nsIWebProgressListener2", + "nsISupportsWeakReference"]); var StatusPanel = { get panel() { diff --git a/browser/base/content/test/about/head.js b/browser/base/content/test/about/head.js index f2726b6b1f32..674b12550d30 100644 --- a/browser/base/content/test/about/head.js +++ b/browser/base/content/test/about/head.js @@ -119,7 +119,7 @@ function waitForDocLoadAndStopIt(aExpectedURL, aBrowser = gBrowser.selectedBrows stopContent(contentStopFromProgressListener, chan.originalURI.spec); } }, - QueryInterface: XPCOMUtils.generateQI(["nsISupportsWeakReference"]) + QueryInterface: ChromeUtils.generateQI(["nsISupportsWeakReference"]) }; wp.addProgressListener(progressListener, wp.NOTIFY_STATE_WINDOW); diff --git a/browser/base/content/test/chrome/test_aboutCrashed.xul b/browser/base/content/test/chrome/test_aboutCrashed.xul index 03d6f3f401be..59ba351c5a9d 100644 --- a/browser/base/content/test/chrome/test_aboutCrashed.xul +++ b/browser/base/content/test/chrome/test_aboutCrashed.xul @@ -32,8 +32,8 @@ } }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener, - Ci.nsISupportsWeakReference]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener, + Ci.nsISupportsWeakReference]) }; frame.docShell.QueryInterface(Ci.nsIInterfaceRequestor) diff --git a/browser/base/content/test/general/browser_bug356571.js b/browser/base/content/test/general/browser_bug356571.js index bea74eb5ce66..69ef40f55437 100644 --- a/browser/base/content/test/general/browser_bug356571.js +++ b/browser/base/content/test/general/browser_bug356571.js @@ -22,7 +22,7 @@ var fakePromptServiceFactory = { }; var promptService = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPromptService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPromptService]), alert() { didFail = true; } diff --git a/browser/base/content/test/general/browser_e10s_about_process.js b/browser/base/content/test/general/browser_e10s_about_process.js index ef92805444ce..88e6b5684bca 100644 --- a/browser/base/content/test/general/browser_e10s_about_process.js +++ b/browser/base/content/test/general/browser_e10s_about_process.js @@ -46,7 +46,7 @@ AboutModule.prototype = { return null; }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIAboutModule]) }; var AboutModuleFactory = { @@ -60,7 +60,7 @@ var AboutModuleFactory = { throw Cr.NS_ERROR_NOT_IMPLEMENTED; }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory]) }; add_task(async function init() { diff --git a/browser/base/content/test/general/browser_fullscreen-window-open.js b/browser/base/content/test/general/browser_fullscreen-window-open.js index f3dfeff46fe4..0edc0ada4dca 100644 --- a/browser/base/content/test/general/browser_fullscreen-window-open.js +++ b/browser/base/content/test/general/browser_fullscreen-window-open.js @@ -342,6 +342,5 @@ WindowListener.prototype = { domwindow.addEventListener("load", onLoad, true); }, onCloseWindow(aXULWindow) {}, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWindowMediatorListener, - Ci.nsISupports]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIWindowMediatorListener]), }; diff --git a/browser/base/content/test/general/browser_homeDrop.js b/browser/base/content/test/general/browser_homeDrop.js index 98aef189bfd1..d896b439d447 100644 --- a/browser/base/content/test/general/browser_homeDrop.js +++ b/browser/base/content/test/general/browser_homeDrop.js @@ -29,7 +29,7 @@ add_task(async function() { let setHomepagePromise = new Promise(function(resolve) { let observer = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]), observe(subject, topic, data) { is(topic, "nsPref:changed", "observed correct topic"); is(data, HOMEPAGE_PREF, "observed correct data"); diff --git a/browser/base/content/test/general/head.js b/browser/base/content/test/general/head.js index 4966bfe21414..81da040e2904 100644 --- a/browser/base/content/test/general/head.js +++ b/browser/base/content/test/general/head.js @@ -547,7 +547,7 @@ function promiseOnBookmarkItemAdded(aExpectedURI) { onItemChanged() {}, onItemVisited() {}, onItemMoved() {}, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsINavBookmarkObserver, ]) }; diff --git a/browser/base/content/test/performance/browser_appmenu.js b/browser/base/content/test/performance/browser_appmenu.js index 236144e80bf5..52d4657801d9 100644 --- a/browser/base/content/test/performance/browser_appmenu.js +++ b/browser/base/content/test/performance/browser_appmenu.js @@ -16,14 +16,12 @@ let gCUITestUtils = new CustomizableUITestUtils(window); const EXPECTED_APPMENU_OPEN_REFLOWS = [ { stack: [ - "openPopup@chrome://global/content/bindings/popup.xml", "openPopup/this._openPopupPromise<@resource:///modules/PanelMultiView.jsm", ], }, { stack: [ - "get_alignmentPosition@chrome://global/content/bindings/popup.xml", "adjustArrowPosition@chrome://global/content/bindings/popup.xml", "onxblpopuppositioned@chrome://global/content/bindings/popup.xml", ], @@ -31,21 +29,13 @@ const EXPECTED_APPMENU_OPEN_REFLOWS = [ maxCount: 3, // This number should only ever go down - never up. }, - { - stack: [ - "get_alignmentPosition@chrome://global/content/bindings/popup.xml", - "_calculateMaxHeight@resource:///modules/PanelMultiView.jsm", - "handleEvent@resource:///modules/PanelMultiView.jsm", - ], - }, - { stack: [ "_calculateMaxHeight@resource:///modules/PanelMultiView.jsm", "handleEvent@resource:///modules/PanelMultiView.jsm", ], - maxCount: 6, // This number should only ever go down - never up. + maxCount: 7, // This number should only ever go down - never up. }, ]; diff --git a/browser/base/content/test/performance/browser_urlbar_keyed_search.js b/browser/base/content/test/performance/browser_urlbar_keyed_search.js index 7b4ff80ce763..6c9c91d5e3e8 100644 --- a/browser/base/content/test/performance/browser_urlbar_keyed_search.js +++ b/browser/base/content/test/performance/browser_urlbar_keyed_search.js @@ -23,7 +23,6 @@ const EXPECTED_REFLOWS_FIRST_OPEN = [ "enableOneOffSearches@chrome://browser/content/urlbarBindings.xml", "_enableOrDisableOneOffSearches@chrome://browser/content/urlbarBindings.xml", "urlbar_XBL_Constructor/<@chrome://browser/content/urlbarBindings.xml", - "openPopup@chrome://global/content/bindings/popup.xml", "_openAutocompletePopup@chrome://browser/content/urlbarBindings.xml", "openAutocompletePopup@chrome://browser/content/urlbarBindings.xml", "openPopup@chrome://global/content/bindings/autocomplete.xml", @@ -74,7 +73,6 @@ const EXPECTED_REFLOWS_FIRST_OPEN = [ // Bug 1359989 { stack: [ - "openPopup@chrome://global/content/bindings/popup.xml", "_openAutocompletePopup@chrome://browser/content/urlbarBindings.xml", "openAutocompletePopup@chrome://browser/content/urlbarBindings.xml", "openPopup@chrome://global/content/bindings/autocomplete.xml", diff --git a/browser/base/content/test/performance/browser_urlbar_search.js b/browser/base/content/test/performance/browser_urlbar_search.js index 405700d39cb2..bb38bcf93d79 100644 --- a/browser/base/content/test/performance/browser_urlbar_search.js +++ b/browser/base/content/test/performance/browser_urlbar_search.js @@ -23,7 +23,6 @@ const EXPECTED_REFLOWS_FIRST_OPEN = [ "enableOneOffSearches@chrome://browser/content/urlbarBindings.xml", "_enableOrDisableOneOffSearches@chrome://browser/content/urlbarBindings.xml", "urlbar_XBL_Constructor/<@chrome://browser/content/urlbarBindings.xml", - "openPopup@chrome://global/content/bindings/popup.xml", "_openAutocompletePopup@chrome://browser/content/urlbarBindings.xml", "openAutocompletePopup@chrome://browser/content/urlbarBindings.xml", "openPopup@chrome://global/content/bindings/autocomplete.xml", @@ -74,7 +73,6 @@ const EXPECTED_REFLOWS_FIRST_OPEN = [ // Bug 1359989 { stack: [ - "openPopup@chrome://global/content/bindings/popup.xml", "_openAutocompletePopup@chrome://browser/content/urlbarBindings.xml", "openAutocompletePopup@chrome://browser/content/urlbarBindings.xml", "openPopup@chrome://global/content/bindings/autocomplete.xml", @@ -116,7 +114,6 @@ const EXPECTED_REFLOWS_SECOND_OPEN = [ // Bug 1359989 { stack: [ - "openPopup@chrome://global/content/bindings/popup.xml", "_openAutocompletePopup@chrome://browser/content/urlbarBindings.xml", "openAutocompletePopup@chrome://browser/content/urlbarBindings.xml", "openPopup@chrome://global/content/bindings/autocomplete.xml", diff --git a/browser/base/content/test/performance/head.js b/browser/base/content/test/performance/head.js index 513161d94d28..4ddbb29ff792 100644 --- a/browser/base/content/test/performance/head.js +++ b/browser/base/content/test/performance/head.js @@ -54,8 +54,8 @@ async function recordReflows(testPromise, win = window) { // driver ticking. These are fine. }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIReflowObserver, - Ci.nsISupportsWeakReference]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIReflowObserver, + Ci.nsISupportsWeakReference]) }; let docShell = win.QueryInterface(Ci.nsIInterfaceRequestor) diff --git a/browser/base/content/test/plugins/blocklist_proxy.js b/browser/base/content/test/plugins/blocklist_proxy.js index 384d266e46c6..7612f075292d 100644 --- a/browser/base/content/test/plugins/blocklist_proxy.js +++ b/browser/base/content/test/plugins/blocklist_proxy.js @@ -15,9 +15,9 @@ SimpleTest.requestFlakyTimeout("Need to simulate blocklist calls actually taking var BlocklistProxy = { _uuid: null, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsIBlocklistService, - Ci.nsITimerCallback]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsIBlocklistService, + Ci.nsITimerCallback]), init() { if (!this._uuid) { diff --git a/browser/base/content/test/referrer/browser_referrer_open_link_in_container_tab.js b/browser/base/content/test/referrer/browser_referrer_open_link_in_container_tab.js index 9f32fbdcba81..a22e848b70c4 100644 --- a/browser/base/content/test/referrer/browser_referrer_open_link_in_container_tab.js +++ b/browser/base/content/test/referrer/browser_referrer_open_link_in_container_tab.js @@ -40,7 +40,7 @@ function startNewTabTestCase(aTestNumber) { aContextMenu.hidePopup(); }, {once: true}); - menupopup.showPopup(); + menupopup.openPopup(); }); } diff --git a/browser/base/content/test/referrer/browser_referrer_open_link_in_container_tab3.js b/browser/base/content/test/referrer/browser_referrer_open_link_in_container_tab3.js index 44f327773917..ed3c8c468299 100644 --- a/browser/base/content/test/referrer/browser_referrer_open_link_in_container_tab3.js +++ b/browser/base/content/test/referrer/browser_referrer_open_link_in_container_tab3.js @@ -36,7 +36,7 @@ function startNewTabTestCase(aTestNumber) { aContextMenu.hidePopup(); }, {once: true}); - menupopup.showPopup(); + menupopup.openPopup(); }); } diff --git a/browser/base/content/test/sync/browser_contextmenu_sendpage.js b/browser/base/content/test/sync/browser_contextmenu_sendpage.js index 8c0ab67f6b0a..b837e9ef5261 100644 --- a/browser/base/content/test/sync/browser_contextmenu_sendpage.js +++ b/browser/base/content/test/sync/browser_contextmenu_sendpage.js @@ -237,7 +237,7 @@ async function openContentContextMenu(selector, openSubmenuId = null) { if (openSubmenuId) { const menuPopup = document.getElementById(openSubmenuId).menupopup; const menuPopupPromise = BrowserTestUtils.waitForEvent(menuPopup, "popupshown"); - menuPopup.showPopup(); + menuPopup.openPopup(); await menuPopupPromise; } } diff --git a/browser/base/content/test/urlbar/browser_tabMatchesInAwesomebar.js b/browser/base/content/test/urlbar/browser_tabMatchesInAwesomebar.js index 311800388498..737060851c6d 100644 --- a/browser/base/content/test/urlbar/browser_tabMatchesInAwesomebar.js +++ b/browser/base/content/test/urlbar/browser_tabMatchesInAwesomebar.js @@ -204,7 +204,7 @@ function checkAutocompleteResults(aExpected, aCallback) { setSelectedIndex() {}, get searchCount() { return this.searches.length; }, getSearchAt(aIndex) { return this.searches[aIndex]; }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsIAutoCompleteInput, Ci.nsIAutoCompletePopup, ]) diff --git a/browser/base/content/test/urlbar/browser_urlbar_search_no_speculative_connect_with_client_cert.js b/browser/base/content/test/urlbar/browser_urlbar_search_no_speculative_connect_with_client_cert.js index 131c58b6b0e2..bee01205ebc7 100644 --- a/browser/base/content/test/urlbar/browser_urlbar_search_no_speculative_connect_with_client_cert.js +++ b/browser/base/content/test/urlbar/browser_urlbar_search_no_speculative_connect_with_client_cert.js @@ -32,7 +32,7 @@ const clientAuthDialogs = { return true; }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIClientAuthDialogs]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIClientAuthDialogs]), }; function startServer(cert) { diff --git a/browser/base/content/test/urlbar/head.js b/browser/base/content/test/urlbar/head.js index 3eb27359d205..832120bb609d 100644 --- a/browser/base/content/test/urlbar/head.js +++ b/browser/base/content/test/urlbar/head.js @@ -62,7 +62,7 @@ function waitForDocLoadAndStopIt(aExpectedURL, aBrowser = gBrowser.selectedBrows stopContent(contentStopFromProgressListener, chan.originalURI.spec); } }, - QueryInterface: XPCOMUtils.generateQI(["nsISupportsWeakReference"]) + QueryInterface: ChromeUtils.generateQI(["nsISupportsWeakReference"]) }; wp.addProgressListener(progressListener, wp.NOTIFY_STATE_WINDOW); diff --git a/browser/base/content/web-panels.js b/browser/base/content/web-panels.js index 04d6d6dbad66..0fcbb44b3b0a 100644 --- a/browser/base/content/web-panels.js +++ b/browser/base/content/web-panels.js @@ -47,13 +47,7 @@ var panelProgressListener = { onSecurityChange(aWebProgress, aRequest, aState) { }, - QueryInterface(aIID) { - if (aIID.equals(Ci.nsIWebProgressListener) || - aIID.equals(Ci.nsISupportsWeakReference) || - aIID.equals(Ci.nsISupports)) - return this; - throw Cr.NS_NOINTERFACE; - } + QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener", "nsISupportsWeakReference"]), }; var gLoadFired = false; diff --git a/browser/components/about/nsAboutCapabilities.js b/browser/components/about/nsAboutCapabilities.js index 70b745e22135..6e48a8eefdea 100644 --- a/browser/components/about/nsAboutCapabilities.js +++ b/browser/components/about/nsAboutCapabilities.js @@ -67,8 +67,7 @@ nsAboutCapabilities.prototype = { contractID: "@mozilla.org/aboutcapabilities;1", classID: Components.ID("{4c2b1f46-e637-4a91-8108-8a9fb7aab91d}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, - Ci.nsIDOMGlobalPropertyInitializer]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer]) }; this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsAboutCapabilities]); diff --git a/browser/components/customizableui/PanelMultiView.jsm b/browser/components/customizableui/PanelMultiView.jsm index 94e0190604d8..8ed62bfef5b9 100644 --- a/browser/components/customizableui/PanelMultiView.jsm +++ b/browser/components/customizableui/PanelMultiView.jsm @@ -854,7 +854,7 @@ var PanelMultiView = class extends AssociatedToNode { this._viewContainer.style.height = prevPanelView.knownHeight + "px"; this._viewContainer.style.width = prevPanelView.knownWidth + "px"; // Lock the dimensions of the window that hosts the popup panel. - let rect = this._panel.popupBoxObject.getOuterScreenRect(); + let rect = this._panel.getOuterScreenRect(); this._panel.setAttribute("width", rect.width); this._panel.setAttribute("height", rect.height); diff --git a/browser/components/downloads/DownloadsCommon.jsm b/browser/components/downloads/DownloadsCommon.jsm index 652045bdcce9..d27ab369971a 100644 --- a/browser/components/downloads/DownloadsCommon.jsm +++ b/browser/components/downloads/DownloadsCommon.jsm @@ -75,8 +75,8 @@ const kMaxHistoryResultsForLimitedView = 42; const kPrefBranch = Services.prefs.getBranch("browser.download."); var PrefObserver = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference]), getPref(name) { try { switch (typeof this.prefs[name]) { diff --git a/browser/components/enterprisepolicies/EnterprisePolicies.js b/browser/components/enterprisepolicies/EnterprisePolicies.js index 04263c250ded..be69aa5d0336 100644 --- a/browser/components/enterprisepolicies/EnterprisePolicies.js +++ b/browser/components/enterprisepolicies/EnterprisePolicies.js @@ -69,9 +69,9 @@ function EnterprisePoliciesManager() { EnterprisePoliciesManager.prototype = { // for XPCOM classID: Components.ID("{ea4e1414-779b-458b-9d1f-d18e8efbc145}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference, - Ci.nsIEnterprisePolicies]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference, + Ci.nsIEnterprisePolicies]), // redefine the default factory for XPCOMUtils _xpcom_factory: EnterprisePoliciesFactory, diff --git a/browser/components/enterprisepolicies/EnterprisePoliciesContent.js b/browser/components/enterprisepolicies/EnterprisePoliciesContent.js index 9068bf5e07da..dbc666f50f75 100644 --- a/browser/components/enterprisepolicies/EnterprisePoliciesContent.js +++ b/browser/components/enterprisepolicies/EnterprisePoliciesContent.js @@ -51,7 +51,7 @@ function EnterprisePoliciesManagerContent() { EnterprisePoliciesManagerContent.prototype = { // for XPCOM classID: Components.ID("{dc6358f8-d167-4566-bf5b-4350b5e6a7a2}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIEnterprisePolicies]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIEnterprisePolicies]), // redefine the default factory for XPCOMUtils _xpcom_factory: EnterprisePoliciesFactory, diff --git a/browser/components/enterprisepolicies/helpers/WebsiteFilter.jsm b/browser/components/enterprisepolicies/helpers/WebsiteFilter.jsm index a51a3aada8b1..eb7b82000d3b 100644 --- a/browser/components/enterprisepolicies/helpers/WebsiteFilter.jsm +++ b/browser/components/enterprisepolicies/helpers/WebsiteFilter.jsm @@ -79,8 +79,8 @@ function WebsiteFilter(blocklist, exceptionlist) { } WebsiteFilter.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference]), observe(subject, topic, data) { let channel, isDocument = false; diff --git a/browser/components/enterprisepolicies/tests/browser/browser_policy_search_engine.js b/browser/components/enterprisepolicies/tests/browser/browser_policy_search_engine.js index 740dc798befc..2ab04566a1f7 100644 --- a/browser/components/enterprisepolicies/tests/browser/browser_policy_search_engine.js +++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_search_engine.js @@ -160,11 +160,11 @@ add_task(async function test_AddSearchProvider() { alert() { this.promptCount++; }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPrompt]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPrompt]), }; let windowWatcher = { getNewPrompter: () => mockPrompter, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWindowWatcher]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIWindowWatcher]), }; let origWindowWatcher = Services.ww; Services.ww = windowWatcher; diff --git a/browser/components/extensions/parent/ext-tabs.js b/browser/components/extensions/parent/ext-tabs.js index 5db5e55da9e4..3b06726db4c2 100644 --- a/browser/components/extensions/parent/ext-tabs.js +++ b/browser/components/extensions/parent/ext-tabs.js @@ -1169,7 +1169,7 @@ this.tabs = class extends ExtensionAPI { resolve(retval == 0 ? "not_saved" : "not_replaced"); } }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener]), }; activeTab.linkedBrowser.print(activeTab.linkedBrowser.outerWindowID, printSettings, printProgressListener); diff --git a/browser/components/feeds/FeedConverter.js b/browser/components/feeds/FeedConverter.js index 6c4af4ae670f..b9871e96d63c 100644 --- a/browser/components/feeds/FeedConverter.js +++ b/browser/components/feeds/FeedConverter.js @@ -326,15 +326,10 @@ FeedConverter.prototype = { /** * See nsISupports.idl */ - QueryInterface(iid) { - if (iid.equals(Ci.nsIFeedResultListener) || - iid.equals(Ci.nsIStreamConverter) || - iid.equals(Ci.nsIStreamListener) || - iid.equals(Ci.nsIRequestObserver) || - iid.equals(Ci.nsISupports)) - return this; - throw Cr.NS_ERROR_NO_INTERFACE; - }, + QueryInterface: ChromeUtils.generateQI(["nsIFeedResultListener", + "nsIStreamConverter", + "nsIStreamListener", + "nsIRequestObserver"]), }; /** @@ -456,13 +451,8 @@ FeedResultService.prototype = { return this.QueryInterface(iid); }, - QueryInterface(iid) { - if (iid.equals(Ci.nsIFeedResultService) || - iid.equals(Ci.nsIFactory) || - iid.equals(Ci.nsISupports)) - return this; - throw Cr.NS_ERROR_NOT_IMPLEMENTED; - }, + QueryInterface: ChromeUtils.generateQI(["nsIFeedResultService", + "nsIFactory"]), }; diff --git a/browser/components/feeds/FeedWriter.js b/browser/components/feeds/FeedWriter.js index 83e084427745..64f533abdf82 100644 --- a/browser/components/feeds/FeedWriter.js +++ b/browser/components/feeds/FeedWriter.js @@ -981,8 +981,8 @@ FeedWriter.prototype = { }, classID: FEEDWRITER_CID, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsIDOMGlobalPropertyInitializer]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsIDOMGlobalPropertyInitializer]) }; this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FeedWriter]); diff --git a/browser/components/feeds/WebContentConverter.js b/browser/components/feeds/WebContentConverter.js index 68e5740cdcd3..d3222c9e9979 100644 --- a/browser/components/feeds/WebContentConverter.js +++ b/browser/components/feeds/WebContentConverter.js @@ -48,13 +48,8 @@ WebContentConverter.prototype = { wccr.loadPreferredHandler(request); }, - QueryInterface(iid) { - if (iid.equals(Ci.nsIStreamConverter) || - iid.equals(Ci.nsIStreamListener) || - iid.equals(Ci.nsISupports)) - return this; - throw Cr.NS_ERROR_NO_INTERFACE; - } + QueryInterface: ChromeUtils.generateQI(["nsIStreamConverter", + "nsIStreamListener"]), }; let WebContentConverterFactory = { @@ -64,12 +59,7 @@ let WebContentConverterFactory = { return new WebContentConverter().QueryInterface(iid); }, - QueryInterface(iid) { - if (iid.equals(Ci.nsIFactory) || - iid.equals(Ci.nsISupports)) - return this; - throw Cr.NS_ERROR_NO_INTERFACE; - } + QueryInterface: ChromeUtils.generateQI(["nsIFactory"]), }; function ServiceInfo(contentType, uri, name) { @@ -121,12 +111,7 @@ ServiceInfo.prototype = { return this._uri.replace(/%s/gi, encodeURIComponent(uri)); }, - QueryInterface(iid) { - if (iid.equals(Ci.nsIWebContentHandlerInfo) || - iid.equals(Ci.nsISupports)) - return this; - throw Cr.NS_ERROR_NO_INTERFACE; - } + QueryInterface: ChromeUtils.generateQI(["nsIWebContentHandlerInfo"]), }; const Utils = { @@ -865,7 +850,7 @@ WebContentConverterRegistrar.prototype = { /** * See nsISupports */ - QueryInterface: XPCOMUtils.generateQI( + QueryInterface: ChromeUtils.generateQI( [Ci.nsIWebContentConverterService, Ci.nsIWebContentHandlerRegistrar, Ci.nsIObserver, @@ -1044,7 +1029,7 @@ WebContentConverterRegistrarContent.prototype = { /** * See nsISupports */ - QueryInterface: XPCOMUtils.generateQI( + QueryInterface: ChromeUtils.generateQI( [Ci.nsIWebContentHandlerRegistrar, Ci.nsIWebContentConverterService, Ci.nsIFactory]) diff --git a/browser/components/migration/AutoMigrate.jsm b/browser/components/migration/AutoMigrate.jsm index 39c08632f839..c8da12ee49b1 100644 --- a/browser/components/migration/AutoMigrate.jsm +++ b/browser/components/migration/AutoMigrate.jsm @@ -679,7 +679,7 @@ const AutoMigrate = { chromeWindow.openTrustedLinkIn(url, "tab"); }, - QueryInterface: XPCOMUtils.generateQI( + QueryInterface: ChromeUtils.generateQI( [Ci.nsIObserver, Ci.nsINavBookmarkObserver, Ci.nsISupportsWeakReference] ), diff --git a/browser/components/migration/MigrationUtils.jsm b/browser/components/migration/MigrationUtils.jsm index 68ea4e20f1cd..aba5d5f0fce8 100644 --- a/browser/components/migration/MigrationUtils.jsm +++ b/browser/components/migration/MigrationUtils.jsm @@ -85,7 +85,7 @@ function getMigrationBundle() { * 6. For startup-only migrators, override |startupOnlyMigrator|. */ var MigratorPrototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIBrowserProfileMigrator]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIBrowserProfileMigrator]), /** * OVERRIDE IF AND ONLY IF the source supports multiple profiles. diff --git a/browser/components/migration/ProfileMigrator.js b/browser/components/migration/ProfileMigrator.js index 6bbcaf9bc682..652ceb14093f 100644 --- a/browser/components/migration/ProfileMigrator.js +++ b/browser/components/migration/ProfileMigrator.js @@ -12,7 +12,7 @@ function ProfileMigrator() { ProfileMigrator.prototype = { migrate: MigrationUtils.startupMigration.bind(MigrationUtils), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIProfileMigrator]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIProfileMigrator]), classDescription: "Profile Migrator", contractID: "@mozilla.org/toolkit/profile-migrator;1", classID: Components.ID("6F8BB968-C14F-4D6F-9733-6C6737B35DCE"), diff --git a/browser/components/newtab/aboutNewTabService.js b/browser/components/newtab/aboutNewTabService.js index 79101fb87499..52f7b136ba01 100644 --- a/browser/components/newtab/aboutNewTabService.js +++ b/browser/components/newtab/aboutNewTabService.js @@ -92,7 +92,7 @@ AboutNewTabService.prototype = { willNotifyUser: false, classID: Components.ID("{dfcd2adc-7867-4d3a-ba70-17501f208142}"), - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsIAboutNewTabService, Ci.nsIObserver ]), diff --git a/browser/components/nsBrowserContentHandler.js b/browser/components/nsBrowserContentHandler.js index aabbe2ecd342..623c6b091e0b 100644 --- a/browser/components/nsBrowserContentHandler.js +++ b/browser/components/nsBrowserContentHandler.js @@ -286,10 +286,10 @@ nsBrowserContentHandler.prototype = { }, /* nsISupports */ - QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler, - Ci.nsIBrowserHandler, - Ci.nsIContentHandler, - Ci.nsICommandLineValidator]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICommandLineHandler, + Ci.nsIBrowserHandler, + Ci.nsIContentHandler, + Ci.nsICommandLineValidator]), /* nsICommandLineHandler */ handle: function bch_handle(cmdLine) { @@ -697,13 +697,7 @@ nsDefaultCommandLineHandler.prototype = { classID: Components.ID("{47cd0651-b1be-4a0f-b5c4-10e5a573ef71}"), /* nsISupports */ - QueryInterface: function dch_QI(iid) { - if (!iid.equals(Ci.nsISupports) && - !iid.equals(Ci.nsICommandLineHandler)) - throw Cr.NS_ERROR_NO_INTERFACE; - - return this; - }, + QueryInterface: ChromeUtils.generateQI(["nsICommandLineHandler"]), _haveProfile: false, diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index 5f82c6cdaf79..8ed754d90ff1 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -2729,8 +2729,8 @@ BrowserGlue.prototype = { // for XPCOM classID: Components.ID("{eab9012e-5f74-4cbc-b2b5-a590235513cc}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference]), _xpcom_factory: XPCOMUtils.generateSingletonFactory(BrowserGlue), }; @@ -2789,7 +2789,7 @@ function ContentPermissionPrompt() {} ContentPermissionPrompt.prototype = { classID: Components.ID("{d8903bf6-68d5-4e97-bcd1-e4d3012f721a}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionPrompt]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIContentPermissionPrompt]), /** * This implementation of nsIContentPermissionPrompt.prompt ensures @@ -3042,7 +3042,7 @@ var JawsScreenReaderVersionCheck = { Services.obs.addObserver(this, "a11y-init-or-shutdown", true); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]), observe(subject, topic, data) { if (topic == "a11y-init-or-shutdown" && data == "1") { diff --git a/browser/components/payments/content/paymentDialogWrapper.js b/browser/components/payments/content/paymentDialogWrapper.js index 17f0b5f8c1cf..68b0ce902266 100644 --- a/browser/components/payments/content/paymentDialogWrapper.js +++ b/browser/components/payments/content/paymentDialogWrapper.js @@ -40,7 +40,7 @@ var paymentDialogWrapper = { mm: null, request: null, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsIObserver, Ci.nsISupportsWeakReference, ]), diff --git a/browser/components/payments/paymentUIService.js b/browser/components/payments/paymentUIService.js index e9d57d1f99cb..e09cd2dd09f7 100644 --- a/browser/components/payments/paymentUIService.js +++ b/browser/components/payments/paymentUIService.js @@ -37,7 +37,7 @@ function PaymentUIService() { PaymentUIService.prototype = { classID: Components.ID("{01f8bd55-9017-438b-85ec-7c15d2b35cdc}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPaymentUIService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPaymentUIService]), DIALOG_URL: "chrome://payments/content/paymentDialogWrapper.xhtml", REQUEST_ID_PREFIX: "paymentRequest-", diff --git a/browser/components/places/content/bookmarkProperties.js b/browser/components/places/content/bookmarkProperties.js index ba22abbdb25a..8e65f939f9a8 100644 --- a/browser/components/places/content/bookmarkProperties.js +++ b/browser/components/places/content/bookmarkProperties.js @@ -372,12 +372,7 @@ var BookmarkPropertiesPanel = { }, // nsISupports - QueryInterface: function BPP_QueryInterface(aIID) { - if (aIID.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_NOINTERFACE; - }, + QueryInterface: ChromeUtils.generateQI([]), _element: function BPP__element(aID) { return document.getElementById("editBMPanel_" + aID); diff --git a/browser/components/places/content/browserPlacesViews.js b/browser/components/places/content/browserPlacesViews.js index 2d441da5dcba..c1bb8a014def 100644 --- a/browser/components/places/content/browserPlacesViews.js +++ b/browser/components/places/content/browserPlacesViews.js @@ -19,6 +19,9 @@ function PlacesViewBase(aPlace, aOptions = {}) { this._viewElt.controllers.appendController(this._controller); } +PlacesViewBase.interfaces = [Ci.nsINavHistoryResultObserver, + Ci.nsISupportsWeakReference]; + PlacesViewBase.prototype = { // The xul element that holds the entire view. _viewElt: null, @@ -41,9 +44,8 @@ PlacesViewBase.prototype = { // the native mac menu). _nativeView: false, - QueryInterface: XPCOMUtils.generateQI( - [Ci.nsINavHistoryResultObserver, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI( + PlacesViewBase.interfaces), _place: "", get place() { @@ -1008,12 +1010,8 @@ PlacesToolbar.prototype = { _cbEvents: ["dragstart", "dragover", "dragexit", "dragend", "drop", "mousemove", "mouseover", "mouseout"], - QueryInterface: function PT_QueryInterface(aIID) { - if (aIID.equals(Ci.nsITimerCallback)) - return this; - - return PlacesViewBase.prototype.QueryInterface.apply(this, arguments); - }, + QueryInterface: ChromeUtils.generateQI(["nsITimerCallback", + ...PlacesViewBase.interfaces]), uninit: function PT_uninit() { this._removeEventListeners(this._viewElt, this._cbEvents, false); @@ -1975,10 +1973,6 @@ function PlacesPanelMenuView(aPlace, aViewId, aRootId, aOptions) { PlacesPanelMenuView.prototype = { __proto__: PlacesViewBase.prototype, - QueryInterface: function PAMV_QueryInterface(aIID) { - return PlacesViewBase.prototype.QueryInterface.apply(this, arguments); - }, - uninit: function PAMV_uninit() { PlacesViewBase.prototype.uninit.apply(this, arguments); }, diff --git a/browser/components/places/content/controller.js b/browser/components/places/content/controller.js index 820ba1738593..e2a8bf4ed860 100644 --- a/browser/components/places/content/controller.js +++ b/browser/components/places/content/controller.js @@ -88,7 +88,7 @@ PlacesController.prototype = { // actually organising the trees. disableUserActions: false, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsIClipboardOwner ]), diff --git a/browser/components/places/content/editBookmark.js b/browser/components/places/content/editBookmark.js index cb3ba8a2ad8f..cadace78e8dd 100644 --- a/browser/components/places/content/editBookmark.js +++ b/browser/components/places/content/editBookmark.js @@ -465,7 +465,7 @@ var gEditItemOverlay = { }, QueryInterface: - XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver]), + ChromeUtils.generateQI([Ci.nsINavBookmarkObserver]), _element(aID) { return document.getElementById("editBMPanel_" + aID); diff --git a/browser/components/places/content/menu.xml b/browser/components/places/content/menu.xml index 3bb1ffbb5762..283742283f73 100644 --- a/browser/components/places/content/menu.xml +++ b/browser/components/places/content/menu.xml @@ -216,7 +216,7 @@ if (aTimer == this._folder.openTimer) { // Timer to open a submenu that's being dragged over. this._folder.elt.lastChild.setAttribute("autoopened", "true"); - this._folder.elt.lastChild.showPopup(this._folder.elt); + this._folder.elt.lastChild.openPopup(); this._folder.openTimer = null; } else if (aTimer == this._folder.closeTimer) { // Timer to close a submenu that's been dragged off of. diff --git a/browser/components/places/content/places.js b/browser/components/places/content/places.js index 1862cb665790..a9202ec5eea7 100644 --- a/browser/components/places/content/places.js +++ b/browser/components/places/content/places.js @@ -196,12 +196,7 @@ var PlacesOrganizer = { ContentArea.focus(); }, - QueryInterface: function PO_QueryInterface(aIID) { - if (aIID.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_NOINTERFACE; - }, + QueryInterface: ChromeUtils.generateQI([]), handleEvent: function PO_handleEvent(aEvent) { if (aEvent.type != "AppCommand") diff --git a/browser/components/places/tests/browser/browser_editBookmark_keywords.js b/browser/components/places/tests/browser/browser_editBookmark_keywords.js index 676955ce9c6f..6881ed59fa92 100644 --- a/browser/components/places/tests/browser/browser_editBookmark_keywords.js +++ b/browser/components/places/tests/browser/browser_editBookmark_keywords.js @@ -16,7 +16,7 @@ add_task(async function() { PlacesUtils.bookmarks.removeObserver(this); resolve({ property, value }); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver]) + QueryInterface: ChromeUtils.generateQI([Ci.nsINavBookmarkObserver]) }); }); } diff --git a/browser/components/places/tests/browser/browser_views_liveupdate.js b/browser/components/places/tests/browser/browser_views_liveupdate.js index a4df152bb34d..2bb932405b46 100644 --- a/browser/components/places/tests/browser/browser_views_liveupdate.js +++ b/browser/components/places/tests/browser/browser_views_liveupdate.js @@ -127,7 +127,7 @@ add_task(async function test() { * nodes positions in the affected views. */ var bookmarksObserver = { - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsINavBookmarkObserver, Ci.nsIAnnotationObserver ]), @@ -275,7 +275,7 @@ function getNodeForToolbarItem(aItemId, aValidator) { // different position. Search only folders if (PlacesUtils.nodeIsFolder(child._placesNode)) { var popup = child.lastChild; - popup.showPopup(popup); + popup.openPopup(); var foundNode = findNode(popup); popup.hidePopup(); if (foundNode[0] != null) diff --git a/browser/components/places/tests/unit/head_bookmarks.js b/browser/components/places/tests/unit/head_bookmarks.js index 07dd739d0d4e..8cfe9e6645fe 100644 --- a/browser/components/places/tests/unit/head_bookmarks.js +++ b/browser/components/places/tests/unit/head_bookmarks.js @@ -76,7 +76,7 @@ function rebuildSmartBookmarks() { } do_throw("Got console message: " + aMsg.message); }, - QueryInterface: XPCOMUtils.generateQI([ Ci.nsIConsoleListener ]), + QueryInterface: ChromeUtils.generateQI([ Ci.nsIConsoleListener ]), }; Services.console.reset(); Services.console.registerListener(consoleListener); diff --git a/browser/components/preferences/in-content/main.js b/browser/components/preferences/in-content/main.js index 545b43216316..ad5eb06028ab 100644 --- a/browser/components/preferences/in-content/main.js +++ b/browser/components/preferences/in-content/main.js @@ -1319,7 +1319,7 @@ var gMainPane = { // nsISupports - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]), // nsIObserver @@ -3022,14 +3022,7 @@ FeedHandlerInfo.prototype = { _inner: [], _removed: [], - QueryInterface(aIID) { - if (aIID.equals(Ci.nsIMutableArray) || - aIID.equals(Ci.nsIArray) || - aIID.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - }, + QueryInterface: ChromeUtils.generateQI(["nsIMutableArray", "nsIArray"]), get length() { return this._inner.length; diff --git a/browser/components/preferences/in-content/tests/browser_advanced_update.js b/browser/components/preferences/in-content/tests/browser_advanced_update.js index 911c7349cb3f..040cbdc90ee1 100644 --- a/browser/components/preferences/in-content/tests/browser_advanced_update.js +++ b/browser/components/preferences/in-content/tests/browser_advanced_update.js @@ -18,7 +18,7 @@ const mockUpdateManager = { _originalFactory: null, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIUpdateManager]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIUpdateManager]), createInstance(outer, iiD) { if (outer) { diff --git a/browser/components/preferences/translation.js b/browser/components/preferences/translation.js index 681016891fda..9080802bc5d1 100644 --- a/browser/components/preferences/translation.js +++ b/browser/components/preferences/translation.js @@ -70,7 +70,7 @@ Tree.prototype = { getCellProperties(row, column) { return ""; }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsITreeView]) + QueryInterface: ChromeUtils.generateQI([Ci.nsITreeView]) }; function Lang(aCode, label) { diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js index c678814e1901..d71b5f2ea7e4 100644 --- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js @@ -88,7 +88,7 @@ add_task(async function test_toggleTrackingProtection() { Services.prefs.getBranch("privacy.trackingprotection.pbmode."); let waitForPrefChanged = () => new Promise(resolve => { let prefObserver = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]), observe() { prefBranch.removeObserver("enabled", prefObserver); resolve(); diff --git a/browser/components/search/test/head.js b/browser/components/search/test/head.js index 3ffb6ea51fdc..096981884c4d 100644 --- a/browser/components/search/test/head.js +++ b/browser/components/search/test/head.js @@ -93,8 +93,8 @@ let promiseStateChangeFrameScript = "data:," + encodeURIComponent(`(${ const global = this; const LISTENER = Symbol("listener"); let listener = { - QueryInterface: XPCOMUtils.generateQI(["nsISupportsWeakReference", - "nsIWebProgressListener"]), + QueryInterface: ChromeUtils.generateQI(["nsISupportsWeakReference", + "nsIWebProgressListener"]), onStateChange: function onStateChange(webProgress, req, flags, status) { // Only care about top-level document starts diff --git a/browser/components/sessionstore/ContentRestore.jsm b/browser/components/sessionstore/ContentRestore.jsm index cbb0eb2f92dd..0a8111c4dc66 100644 --- a/browser/components/sessionstore/ContentRestore.jsm +++ b/browser/components/sessionstore/ContentRestore.jsm @@ -371,7 +371,7 @@ function HistoryListener(docShell, callback) { this.callback = callback; } HistoryListener.prototype = { - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsISHistoryListener, Ci.nsISupportsWeakReference ]), @@ -451,7 +451,7 @@ function ProgressListener(docShell, callbacks) { } ProgressListener.prototype = { - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsIWebProgressListener, Ci.nsISupportsWeakReference ]), diff --git a/browser/components/sessionstore/SessionStore.jsm b/browser/components/sessionstore/SessionStore.jsm index 9db2c2a0edc2..f4114b0458dd 100644 --- a/browser/components/sessionstore/SessionStore.jsm +++ b/browser/components/sessionstore/SessionStore.jsm @@ -438,7 +438,7 @@ var SessionStore = { Object.freeze(SessionStore); var SessionStoreInternal = { - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsIObserver, Ci.nsISupportsWeakReference ]), diff --git a/browser/components/sessionstore/content/content-sessionStore.js b/browser/components/sessionstore/content/content-sessionStore.js index b81d48bbaf1d..3c7322afa30d 100644 --- a/browser/components/sessionstore/content/content-sessionStore.js +++ b/browser/components/sessionstore/content/content-sessionStore.js @@ -142,8 +142,8 @@ var StateChangeNotifier = { } }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener, - Ci.nsISupportsWeakReference]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener, + Ci.nsISupportsWeakReference]) }; /** @@ -447,7 +447,7 @@ var SessionHistoryListener = { // Ignore, the method is implemented so that XPConnect doesn't throw! }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsISHistoryListener, Ci.nsISupportsWeakReference ]) @@ -699,8 +699,8 @@ var PrivacyListener = { MessageQueue.push("isPrivate", () => enabled || null); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPrivacyTransitionObserver, - Ci.nsISupportsWeakReference]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIPrivacyTransitionObserver, + Ci.nsISupportsWeakReference]) }; /** diff --git a/browser/components/sessionstore/nsSessionStartup.js b/browser/components/sessionstore/nsSessionStartup.js index 73209a820631..a319603d761f 100644 --- a/browser/components/sessionstore/nsSessionStartup.js +++ b/browser/components/sessionstore/nsSessionStartup.js @@ -356,9 +356,9 @@ SessionStartup.prototype = { }, /* ........ QueryInterface .............. */ - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference, - Ci.nsISessionStartup]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference, + Ci.nsISessionStartup]), classID: Components.ID("{ec7a6c20-e081-11da-8ad9-0800200c9a66}") }; diff --git a/browser/components/sessionstore/test/browser_599909.js b/browser/components/sessionstore/test/browser_599909.js index 9e5aa3b8def3..3c311207232a 100644 --- a/browser/components/sessionstore/test/browser_599909.js +++ b/browser/components/sessionstore/test/browser_599909.js @@ -111,7 +111,7 @@ function checkAutocompleteResults(aExpected, aCallback) { getSearchAt(aIndex) { return this.searches[aIndex]; }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsIAutoCompleteInput, Ci.nsIAutoCompletePopup, ]) diff --git a/browser/components/sessionstore/test/browser_async_remove_tab.js b/browser/components/sessionstore/test/browser_async_remove_tab.js index bbe72bb58cfd..a93e4aa738b0 100644 --- a/browser/components/sessionstore/test/browser_async_remove_tab.js +++ b/browser/components/sessionstore/test/browser_async_remove_tab.js @@ -48,7 +48,7 @@ function promiseNewLocationAndHistoryEntryReplaced(browser, snippet) { resolve(); }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsISHistoryListener, Ci.nsISupportsWeakReference ]) @@ -78,7 +78,7 @@ function promiseHistoryEntryReplacedNonRemote(browser) { executeSoon(resolve); }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsISHistoryListener, Ci.nsISupportsWeakReference ]) diff --git a/browser/components/sessionstore/test/browser_not_collect_when_idle.js b/browser/components/sessionstore/test/browser_not_collect_when_idle.js index b0cf341977c8..c81705ef9311 100644 --- a/browser/components/sessionstore/test/browser_not_collect_when_idle.js +++ b/browser/components/sessionstore/test/browser_not_collect_when_idle.js @@ -25,7 +25,7 @@ var idleService = { } }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIIdleService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIIdleService]), idleTime: 19999, addIdleObserver(observer, time) { diff --git a/browser/components/sessionstore/test/browser_parentProcessRestoreHash.js b/browser/components/sessionstore/test/browser_parentProcessRestoreHash.js index cfcd4c29f423..b435cda4e8aa 100644 --- a/browser/components/sessionstore/test/browser_parentProcessRestoreHash.js +++ b/browser/components/sessionstore/test/browser_parentProcessRestoreHash.js @@ -12,7 +12,7 @@ const TESTURL = "about:testpageforsessionrestore#foo"; let TestAboutPage = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIAboutModule]), getURIFlags(aURI) { // No CAN_ or MUST_LOAD_IN_CHILD means this loads in the parent: return Ci.nsIAboutModule.ALLOW_SCRIPT | diff --git a/browser/components/sessionstore/test/content.js b/browser/components/sessionstore/test/content.js index 3897b807c695..2a7c1d805672 100644 --- a/browser/components/sessionstore/test/content.js +++ b/browser/components/sessionstore/test/content.js @@ -46,7 +46,7 @@ var historyListener = { sendAsyncMessage("ss-test:OnHistoryReplaceEntry"); }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsISHistoryListener, Ci.nsISupportsWeakReference ]) diff --git a/browser/components/shell/HeadlessShell.jsm b/browser/components/shell/HeadlessShell.jsm index fff88305b9bc..3846a49cbcbf 100644 --- a/browser/components/shell/HeadlessShell.jsm +++ b/browser/components/shell/HeadlessShell.jsm @@ -39,8 +39,8 @@ function loadContentWindow(webNavigation, uri) { resolve(contentWindow); }, { once: true }); }, - QueryInterface: XPCOMUtils.generateQI(["nsIWebProgressListener", - "nsISupportsWeakReference"]) + QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener", + "nsISupportsWeakReference"]) }; progressListeners.set(progressListener, progressListener); webProgress.addProgressListener(progressListener, diff --git a/browser/components/tests/browser/browser_contentpermissionprompt.js b/browser/components/tests/browser/browser_contentpermissionprompt.js index c65c07f58a7d..8508eb9f8270 100644 --- a/browser/components/tests/browser/browser_contentpermissionprompt.js +++ b/browser/components/tests/browser/browser_contentpermissionprompt.js @@ -26,7 +26,7 @@ function MockContentPermissionType(type) { } MockContentPermissionType.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionType]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIContentPermissionType]), // We expose the wrappedJSObject so that we can be sure // in some of our tests that we're passing the right // nsIContentPermissionType around. @@ -49,7 +49,7 @@ function MockContentPermissionRequest(typesArray) { } MockContentPermissionRequest.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionRequest]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIContentPermissionRequest]), // We expose the wrappedJSObject so that we can be sure // in some of our tests that we're passing the right // nsIContentPermissionRequest around. @@ -100,7 +100,7 @@ add_task(async function test_multiple_types() { */ add_task(async function test_not_permission_type() { let mockRequest = new MockContentPermissionRequest([ - { QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]) }, + { QueryInterface: ChromeUtils.generateQI([]) }, ]); Assert.throws(() => { ContentPermissionPrompt.prompt(mockRequest); }, diff --git a/browser/components/tests/startupRecorder.js b/browser/components/tests/startupRecorder.js index 253007a411c7..3cc9e4d43785 100644 --- a/browser/components/tests/startupRecorder.js +++ b/browser/components/tests/startupRecorder.js @@ -57,7 +57,7 @@ function startupRecorder() { startupRecorder.prototype = { classID: Components.ID("{11c095b2-e42e-4bdf-9dd0-aed87595f6a4}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]), record(name) { if (!Services.prefs.getBoolPref("browser.startup.record", false)) diff --git a/browser/components/translation/TranslationContentHandler.jsm b/browser/components/translation/TranslationContentHandler.jsm index a4e96f7f91c7..33d238d49263 100644 --- a/browser/components/translation/TranslationContentHandler.jsm +++ b/browser/components/translation/TranslationContentHandler.jsm @@ -105,8 +105,8 @@ TranslationContentHandler.prototype = { }); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener, + Ci.nsISupportsWeakReference]), receiveMessage(msg) { switch (msg.name) { diff --git a/browser/components/uitour/test/browser_UITour.js b/browser/components/uitour/test/browser_UITour.js index 28c45974a68e..955252c5f070 100644 --- a/browser/components/uitour/test/browser_UITour.js +++ b/browser/components/uitour/test/browser_UITour.js @@ -243,7 +243,7 @@ var tests = [ let buttons = document.getElementById("UITourTooltipButtons"); popup.addEventListener("popupshown", function() { - is(popup.popupBoxObject.anchorNode, document.getElementById("urlbar"), "Popup should be anchored to the urlbar"); + is(popup.anchorNode, document.getElementById("urlbar"), "Popup should be anchored to the urlbar"); is(title.textContent, "test title", "Popup should have correct title"); is(desc.textContent, "test text", "Popup should have correct description text"); is(icon.src, "", "Popup should have no icon"); @@ -271,7 +271,7 @@ var tests = [ await showInfoPromise("urlbar", "urlbar title", "urlbar text"); - is(popup.popupBoxObject.anchorNode, document.getElementById("urlbar"), "Popup should be anchored to the urlbar"); + is(popup.anchorNode, document.getElementById("urlbar"), "Popup should be anchored to the urlbar"); is(title.textContent, "urlbar title", "Popup should have correct title"); is(desc.textContent, "urlbar text", "Popup should have correct description text"); is(icon.src, "", "Popup should have no icon"); @@ -284,7 +284,7 @@ var tests = [ await showInfoPromise("search", "search title", "search text"); - is(popup.popupBoxObject.anchorNode, document.getElementById("searchbar"), "Popup should be anchored to the searchbar"); + is(popup.anchorNode, document.getElementById("searchbar"), "Popup should be anchored to the searchbar"); is(title.textContent, "search title", "Popup should have correct title"); is(desc.textContent, "search text", "Popup should have correct description text"); diff --git a/browser/components/uitour/test/browser_UITour_defaultBrowser.js b/browser/components/uitour/test/browser_UITour_defaultBrowser.js index f9aae347ed59..e1df366535b8 100644 --- a/browser/components/uitour/test/browser_UITour_defaultBrowser.js +++ b/browser/components/uitour/test/browser_UITour_defaultBrowser.js @@ -10,7 +10,7 @@ Services.scriptloader function MockShellService() {} MockShellService.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIShellService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIShellService]), isDefaultBrowser(aStartupCheck, aForAllTypes) { return false; }, setDefaultBrowser(aClaimAllTypes, aForAllUsers) { setDefaultBrowserCalled = true; diff --git a/browser/components/uitour/test/browser_fxa.js b/browser/components/uitour/test/browser_fxa.js index c84d9560b941..7b3f1424ae94 100644 --- a/browser/components/uitour/test/browser_fxa.js +++ b/browser/components/uitour/test/browser_fxa.js @@ -36,7 +36,7 @@ var tests = [ await showHighlightPromise("accountStatus"); let highlight = document.getElementById("UITourHighlightContainer"); let expectedTarget = "appMenu-fxa-avatar"; - is(highlight.popupBoxObject.anchorNode.id, expectedTarget, "Anchored on avatar"); + is(highlight.anchorNode.id, expectedTarget, "Anchored on avatar"); is(highlight.getAttribute("targetName"), "accountStatus", "Correct highlight target"); }), ]; diff --git a/browser/components/uitour/test/browser_trackingProtection_tour.js b/browser/components/uitour/test/browser_trackingProtection_tour.js index e5432d3a731a..5290865164e5 100644 --- a/browser/components/uitour/test/browser_trackingProtection_tour.js +++ b/browser/components/uitour/test/browser_trackingProtection_tour.js @@ -72,7 +72,7 @@ async function checkToggleTarget(targetID) { await showInfoPromise(targetID, "This is " + targetID, "My arrow should be on the side"); - is(popup.popupBoxObject.alignmentPosition, "end_before", + is(popup.alignmentPosition, "end_before", "Check " + targetID + " position"); let hideMenuPromise = diff --git a/browser/components/uitour/test/head.js b/browser/components/uitour/test/head.js index 59b44fd54f8c..7203ead58f40 100644 --- a/browser/components/uitour/test/head.js +++ b/browser/components/uitour/test/head.js @@ -118,7 +118,7 @@ function elementHiddenPromise(element, msg) { } function waitForPopupAtAnchor(popup, anchorNode, nextTestFn, msg) { - waitForCondition(() => is_visible(popup) && popup.popupBoxObject.anchorNode == anchorNode, + waitForCondition(() => is_visible(popup) && popup.anchorNode == anchorNode, () => { ok(true, msg); is_element_visible(popup, "Popup should be visible"); diff --git a/browser/extensions/activity-stream/lib/PlacesFeed.jsm b/browser/extensions/activity-stream/lib/PlacesFeed.jsm index 577d8378a94e..5841c78ee2d5 100644 --- a/browser/extensions/activity-stream/lib/PlacesFeed.jsm +++ b/browser/extensions/activity-stream/lib/PlacesFeed.jsm @@ -22,7 +22,7 @@ const PLACES_LINKS_CHANGED_DELAY_TIME = 1000; // time in ms to delay timer for p class Observer { constructor(dispatch, observerInterface) { this.dispatch = dispatch; - this.QueryInterface = XPCOMUtils.generateQI([observerInterface, Ci.nsISupportsWeakReference]); + this.QueryInterface = ChromeUtils.generateQI([observerInterface, Ci.nsISupportsWeakReference]); } } diff --git a/browser/extensions/followonsearch/content/followonsearch-fs.js b/browser/extensions/followonsearch/content/followonsearch-fs.js index a09f7ea91147..01cbb7ff99c4 100644 --- a/browser/extensions/followonsearch/content/followonsearch-fs.js +++ b/browser/extensions/followonsearch/content/followonsearch-fs.js @@ -141,7 +141,7 @@ let searchingGoogle = false; * a progress listener. */ var webProgressListener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener, Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener, Ci.nsISupportsWeakReference]), onLocationChange(aWebProgress, aRequest, aLocation, aFlags) { if (aWebProgress.DOMWindow && (aWebProgress.DOMWindow != content)) { diff --git a/browser/extensions/formautofill/FormAutofillContent.jsm b/browser/extensions/formautofill/FormAutofillContent.jsm index ff6e536478fa..da4ae3d9b3f5 100644 --- a/browser/extensions/formautofill/FormAutofillContent.jsm +++ b/browser/extensions/formautofill/FormAutofillContent.jsm @@ -81,7 +81,7 @@ AutofillProfileAutoCompleteSearch.prototype = { classID: Components.ID("4f9f1e4c-7f2c-439e-9c9e-566b68bc187d"), contractID: "@mozilla.org/autocomplete/search;1?name=autofill-profiles", classDescription: "AutofillProfileAutoCompleteSearch", - QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompleteSearch]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIAutoCompleteSearch]), // Begin nsIAutoCompleteSearch implementation @@ -209,7 +209,7 @@ AutofillProfileAutoCompleteSearch.prototype = { }; let ProfileAutocomplete = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]), lastProfileAutoCompleteResult: null, lastProfileAutoCompleteFocusedInput: null, @@ -324,7 +324,7 @@ let ProfileAutocomplete = { * NOTE: Declares it by "var" to make it accessible in unit tests. */ var FormAutofillContent = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIFormSubmitObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIFormSubmitObserver]), /** * @type {WeakMap} mapping FormLike root HTML elements to FormAutofillHandler objects. */ diff --git a/browser/extensions/formautofill/FormAutofillParent.jsm b/browser/extensions/formautofill/FormAutofillParent.jsm index 9aba0036e588..8d3483e1267b 100644 --- a/browser/extensions/formautofill/FormAutofillParent.jsm +++ b/browser/extensions/formautofill/FormAutofillParent.jsm @@ -69,7 +69,7 @@ function FormAutofillParent() { } FormAutofillParent.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, Ci.nsIObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]), /** * Cache of the Form Autofill status (considering preferences and storage). diff --git a/browser/extensions/formautofill/MasterPassword.jsm b/browser/extensions/formautofill/MasterPassword.jsm index 826e14b4ae62..69f07361a1fc 100644 --- a/browser/extensions/formautofill/MasterPassword.jsm +++ b/browser/extensions/formautofill/MasterPassword.jsm @@ -177,7 +177,7 @@ var MasterPassword = { return new Promise((resolve) => { log.debug("waitForExistingDialog: Observing the open dialog"); let observer = { - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsIObserver, Ci.nsISupportsWeakReference, ]), diff --git a/browser/extensions/formautofill/ProfileAutoCompleteResult.jsm b/browser/extensions/formautofill/ProfileAutoCompleteResult.jsm index de00a3fce878..70141f31a1e1 100644 --- a/browser/extensions/formautofill/ProfileAutoCompleteResult.jsm +++ b/browser/extensions/formautofill/ProfileAutoCompleteResult.jsm @@ -26,7 +26,7 @@ class ProfileAutoCompleteResult { log.debug("Constructing new ProfileAutoCompleteResult:", [...arguments]); // nsISupports - this.QueryInterface = XPCOMUtils.generateQI([Ci.nsIAutoCompleteResult]); + this.QueryInterface = ChromeUtils.generateQI([Ci.nsIAutoCompleteResult]); // The user's query string this.searchString = searchString; diff --git a/browser/extensions/formautofill/test/unit/test_masterPassword.js b/browser/extensions/formautofill/test/unit/test_masterPassword.js index 3ab2b792ead5..5e7ead8e34a2 100644 --- a/browser/extensions/formautofill/test/unit/test_masterPassword.js +++ b/browser/extensions/formautofill/test/unit/test_masterPassword.js @@ -46,14 +46,14 @@ let gMockPrompter = { return true; }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPrompt]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPrompt]), }; // Mock nsIWindowWatcher. PSM calls getNewPrompter on this to get an nsIPrompt // to call promptPassword. We return the mock one, above. let gWindowWatcher = { getNewPrompter: () => gMockPrompter, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWindowWatcher]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIWindowWatcher]), }; // Ensure that the appropriate initialization has happened. diff --git a/browser/extensions/pdfjs/content/PdfJs.jsm b/browser/extensions/pdfjs/content/PdfJs.jsm index c4033ebbafc6..b6fd6c0c523a 100644 --- a/browser/extensions/pdfjs/content/PdfJs.jsm +++ b/browser/extensions/pdfjs/content/PdfJs.jsm @@ -127,7 +127,7 @@ Factory.prototype = { }; var PdfJs = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]), _registered: false, _initialized: false, diff --git a/browser/extensions/pdfjs/content/PdfStreamConverter.jsm b/browser/extensions/pdfjs/content/PdfStreamConverter.jsm index d4c50f431bb6..eccb218ae431 100644 --- a/browser/extensions/pdfjs/content/PdfStreamConverter.jsm +++ b/browser/extensions/pdfjs/content/PdfStreamConverter.jsm @@ -809,12 +809,7 @@ PdfStreamConverter.prototype = { classID2: Components.ID("{d0c5195d-e798-49d4-b1d3-9324328b2292}"), contractID2: "@mozilla.org/streamconv;1?from=application/pdf&to=text/html", - QueryInterface: XPCOMUtils.generateQI([ - Ci.nsISupports, - Ci.nsIStreamConverter, - Ci.nsIStreamListener, - Ci.nsIRequestObserver - ]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIStreamConverter, Ci.nsIStreamListener, Ci.nsIRequestObserver]), /* * This component works as such: diff --git a/browser/extensions/pocket/content/AboutPocket.jsm b/browser/extensions/pocket/content/AboutPocket.jsm index f9e3d78e83a1..31780e68f857 100644 --- a/browser/extensions/pocket/content/AboutPocket.jsm +++ b/browser/extensions/pocket/content/AboutPocket.jsm @@ -31,7 +31,7 @@ function AboutPage(chromeURL, aboutHost, classID, description, uriFlags) { } AboutPage.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIAboutModule]), getURIFlags(aURI) { // eslint-disable-line no-unused-vars return this.uriFlags; }, diff --git a/browser/extensions/webcompat-reporter/content/WebCompatReporter.jsm b/browser/extensions/webcompat-reporter/content/WebCompatReporter.jsm index fc768a4fcd34..5585a79da3ee 100644 --- a/browser/extensions/webcompat-reporter/content/WebCompatReporter.jsm +++ b/browser/extensions/webcompat-reporter/content/WebCompatReporter.jsm @@ -108,7 +108,7 @@ let WebCompatReporter = { if (tabData && tabData.blob) { let browser = gBrowser.getBrowserForTab(tab); let loadedListener = { - QueryInterface: XPCOMUtils.generateQI(["nsIWebProgressListener", + QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener", "nsISupportsWeakReference"]), onStateChange(webProgress, request, flags, status) { let isStopped = flags & Ci.nsIWebProgressListener.STATE_STOP; diff --git a/browser/modules/BrowserUsageTelemetry.jsm b/browser/modules/BrowserUsageTelemetry.jsm index 6e7d902446d7..e9b6da3676f3 100644 --- a/browser/modules/BrowserUsageTelemetry.jsm +++ b/browser/modules/BrowserUsageTelemetry.jsm @@ -227,8 +227,8 @@ let URICountListener = { this._domainSet.clear(); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener, + Ci.nsISupportsWeakReference]), }; let urlbarListener = { @@ -312,8 +312,8 @@ let urlbarListener = { } }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference]), }; let BrowserUsageTelemetry = { @@ -341,8 +341,8 @@ let BrowserUsageTelemetry = { URICountListener.reset(); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference]), uninit() { if (!this._inited) { diff --git a/browser/modules/FormSubmitObserver.jsm b/browser/modules/FormSubmitObserver.jsm index 19c83fbd31a6..24d1fcb1fdc6 100644 --- a/browser/modules/FormSubmitObserver.jsm +++ b/browser/modules/FormSubmitObserver.jsm @@ -227,5 +227,5 @@ FormSubmitObserver.prototype = (target.ownerDocument && target.ownerDocument == this._content.document)); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIFormSubmitObserver]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIFormSubmitObserver]) }; diff --git a/browser/modules/Sanitizer.jsm b/browser/modules/Sanitizer.jsm index adce35c8ae6c..226c267c48f3 100644 --- a/browser/modules/Sanitizer.jsm +++ b/browser/modules/Sanitizer.jsm @@ -269,7 +269,7 @@ var Sanitizer = { } }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsiObserver, Ci.nsISupportsWeakReference ]), diff --git a/browser/modules/SiteDataManager.jsm b/browser/modules/SiteDataManager.jsm index e52de956f32f..118a40ce38fc 100644 --- a/browser/modules/SiteDataManager.jsm +++ b/browser/modules/SiteDataManager.jsm @@ -111,7 +111,7 @@ var SiteDataManager = { this._getCacheSizeObserver = null; }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsICacheStorageConsumptionObserver, Ci.nsISupportsWeakReference ]) diff --git a/browser/modules/WindowsPreviewPerTab.jsm b/browser/modules/WindowsPreviewPerTab.jsm index 0c86315d7c23..67ea487165ae 100644 --- a/browser/modules/WindowsPreviewPerTab.jsm +++ b/browser/modules/WindowsPreviewPerTab.jsm @@ -155,7 +155,7 @@ function PreviewController(win, tab) { } PreviewController.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsITaskbarPreviewController]), + QueryInterface: ChromeUtils.generateQI([Ci.nsITaskbarPreviewController]), destroy() { this.tab.removeEventListener("TabAttrModified", this); @@ -835,7 +835,7 @@ var AeroPeek = { } }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsISupportsWeakReference, Ci.nsINavHistoryObserver, Ci.nsIObserver diff --git a/browser/modules/test/browser/browser_UsageTelemetry_domains.js b/browser/modules/test/browser/browser_UsageTelemetry_domains.js index 4aa2da7fb8e9..7b4a488d0af4 100644 --- a/browser/modules/test/browser/browser_UsageTelemetry_domains.js +++ b/browser/modules/test/browser/browser_UsageTelemetry_domains.js @@ -31,7 +31,7 @@ function browserLocationChanged(browser) { resolve(); } }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsIWebProgressListener, Ci.nsIWebProgressListener2, ]), diff --git a/browser/modules/test/browser/contentSearch.js b/browser/modules/test/browser/contentSearch.js index 379607904288..03fc8eb2591c 100644 --- a/browser/modules/test/browser/contentSearch.js +++ b/browser/modules/test/browser/contentSearch.js @@ -69,7 +69,7 @@ function waitForLoadAndStopIt(expectedURL) { } } }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsIWebProgressListener, Ci.nsISupportsWeakReference, ]), diff --git a/browser/modules/test/browser/formValidation/browser_form_validation.js b/browser/modules/test/browser/formValidation/browser_form_validation.js index 332ae1225c6c..7a36095ebbee 100644 --- a/browser/modules/test/browser/formValidation/browser_form_validation.js +++ b/browser/modules/test/browser/formValidation/browser_form_validation.js @@ -49,7 +49,7 @@ function checkPopupHide() { } var gObserver = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIFormSubmitObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIFormSubmitObserver]), notifyInvalidSubmit(aFormElement, aInvalidElements) { } diff --git a/browser/modules/test/browser/head.js b/browser/modules/test/browser/head.js index 76e8a913bab5..eb14b5f66ad7 100644 --- a/browser/modules/test/browser/head.js +++ b/browser/modules/test/browser/head.js @@ -170,7 +170,7 @@ function checkEvents(events, expectedEvents) { function makeMockPermissionRequest(browser) { let type = { options: [], - QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionType]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIContentPermissionType]), }; let types = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray); types.appendElement(type); @@ -186,7 +186,7 @@ function makeMockPermissionRequest(browser) { allow() { this._allowed = true; }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionRequest]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIContentPermissionRequest]), }; // In the e10s-case, nsIContentPermissionRequest will have diff --git a/chrome/test/unit/test_no_remote_registration.js b/chrome/test/unit/test_no_remote_registration.js index 00590350c8ca..6b45ecb7cb30 100644 --- a/chrome/test/unit/test_no_remote_registration.js +++ b/chrome/test/unit/test_no_remote_registration.js @@ -34,7 +34,7 @@ ProtocolHandler.prototype = }, newChannel2() { throw Cr.NS_ERROR_NOT_IMPLEMENTED; }, newChannel() { throw Cr.NS_ERROR_NOT_IMPLEMENTED; }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsIProtocolHandler ]) }; diff --git a/devtools/client/inspector/boxmodel/components/BoxModelMain.js b/devtools/client/inspector/boxmodel/components/BoxModelMain.js index ad8fd03f2812..e45e0990dd4f 100644 --- a/devtools/client/inspector/boxmodel/components/BoxModelMain.js +++ b/devtools/client/inspector/boxmodel/components/BoxModelMain.js @@ -489,15 +489,15 @@ class BoxModelMain extends PureComponent { { className: "boxmodel-legend", "data-box": "margin", - title: BOXMODEL_L10N.getStr("boxmodel.margin"), + title: "margin", }, - BOXMODEL_L10N.getStr("boxmodel.margin") + "margin" ), dom.div( { className: "boxmodel-margins", "data-box": "margin", - title: BOXMODEL_L10N.getStr("boxmodel.margin"), + title: "margin", ref: div => { this.marginLayout = div; }, @@ -506,15 +506,15 @@ class BoxModelMain extends PureComponent { { className: "boxmodel-legend", "data-box": "border", - title: BOXMODEL_L10N.getStr("boxmodel.border"), + title: "border", }, - BOXMODEL_L10N.getStr("boxmodel.border") + "border" ), dom.div( { className: "boxmodel-borders", "data-box": "border", - title: BOXMODEL_L10N.getStr("boxmodel.border"), + title: "border", ref: div => { this.borderLayout = div; }, @@ -523,15 +523,15 @@ class BoxModelMain extends PureComponent { { className: "boxmodel-legend", "data-box": "padding", - title: BOXMODEL_L10N.getStr("boxmodel.padding"), + title: "padding", }, - BOXMODEL_L10N.getStr("boxmodel.padding") + "padding" ), dom.div( { className: "boxmodel-paddings", "data-box": "padding", - title: BOXMODEL_L10N.getStr("boxmodel.padding"), + title: "padding", ref: div => { this.paddingLayout = div; }, diff --git a/devtools/client/locales/en-US/boxmodel.properties b/devtools/client/locales/en-US/boxmodel.properties index 232dce1c5239..a13d4822635a 100644 --- a/devtools/client/locales/en-US/boxmodel.properties +++ b/devtools/client/locales/en-US/boxmodel.properties @@ -19,18 +19,6 @@ boxmodel.title=Box Model # might be displayed as a label or as a tooltip. boxmodel.position=position -# LOCALIZATION NOTE (boxmodel.margin) This refers to the margin in the box model and -# might be displayed as a label or as a tooltip. -boxmodel.margin=margin - -# LOCALIZATION NOTE (boxmodel.border) This refers to the border in the box model and -# might be displayed as a label or as a tooltip. -boxmodel.border=border - -# LOCALIZATION NOTE (boxmodel.padding) This refers to the padding in the box model and -# might be displayed as a label or as a tooltip. -boxmodel.padding=padding - # LOCALIZATION NOTE (boxmodel.content) This refers to the content in the box model and # might be displayed as a label or as a tooltip. boxmodel.content=content diff --git a/devtools/client/responsive.html/browser/content.js b/devtools/client/responsive.html/browser/content.js index 900818202c15..14bfe4394bbe 100644 --- a/devtools/client/responsive.html/browser/content.js +++ b/devtools/client/responsive.html/browser/content.js @@ -183,14 +183,8 @@ var global = this; } makeScrollbarsFloating(); }, - QueryInterface: function QueryInterface(iid) { - if (iid.equals(Ci.nsIWebProgressListener) || - iid.equals(Ci.nsISupportsWeakReference) || - iid.equals(Ci.nsISupports)) { - return this; - } - throw Cr.NS_ERROR_NO_INTERFACE; - } + QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener", + "nsISupportsWeakReference"]), }; })(); diff --git a/devtools/client/responsive.html/browser/web-navigation.js b/devtools/client/responsive.html/browser/web-navigation.js index c86de60c7a47..b566af0931b9 100644 --- a/devtools/client/responsive.html/browser/web-navigation.js +++ b/devtools/client/responsive.html/browser/web-navigation.js @@ -34,8 +34,7 @@ function BrowserElementWebNavigation(browser) { BrowserElementWebNavigation.prototype = { QueryInterface: XPCOMUtils.generateQI([ - Ci.nsIWebNavigation, - Ci.nsISupports + Ci.nsIWebNavigation ]), get _mm() { diff --git a/devtools/client/webconsole/test/mochitest/browser_webconsole_network_requests_from_chrome.js b/devtools/client/webconsole/test/mochitest/browser_webconsole_network_requests_from_chrome.js index 7485876ea4e2..9636819bac44 100644 --- a/devtools/client/webconsole/test/mochitest/browser_webconsole_network_requests_from_chrome.js +++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_network_requests_from_chrome.js @@ -14,7 +14,7 @@ add_task(async function() { // Start a listener on the console service. let good = true; const listener = { - QueryInterface: XPCOMUtils.generateQI([ Ci.nsIObserver ]), + QueryInterface: ChromeUtils.generateQI([ Ci.nsIObserver ]), observe: function(subject) { if (subject instanceof Ci.nsIScriptError && subject.category === "XPConnect JavaScript" && diff --git a/devtools/client/webconsole/test/mochitest/browser_webconsole_observer_notifications.js b/devtools/client/webconsole/test/mochitest/browser_webconsole_observer_notifications.js index 43203abca3b8..a742dd8d7762 100644 --- a/devtools/client/webconsole/test/mochitest/browser_webconsole_observer_notifications.js +++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_observer_notifications.js @@ -21,10 +21,8 @@ add_task(async function() { }); function setupObserver() { - const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm", {}); - const observer = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]), observe: function observe(subject, topic) { subject = subject.QueryInterface(Ci.nsISupportsString); diff --git a/devtools/server/actors/highlighters.js b/devtools/server/actors/highlighters.js index bebfa9ce4730..b7388fda51ac 100644 --- a/devtools/server/actors/highlighters.js +++ b/devtools/server/actors/highlighters.js @@ -581,8 +581,7 @@ HighlighterEnvironment.prototype = { this.listener = { QueryInterface: XPCOMUtils.generateQI([ Ci.nsIWebProgressListener, - Ci.nsISupportsWeakReference, - Ci.nsISupports + Ci.nsISupportsWeakReference ]), onStateChange: function(progress, request, flag) { diff --git a/devtools/server/actors/inspector/node.js b/devtools/server/actors/inspector/node.js index 10edb20f319d..8aba9923a11a 100644 --- a/devtools/server/actors/inspector/node.js +++ b/devtools/server/actors/inspector/node.js @@ -408,7 +408,7 @@ const NodeActor = protocol.ActorClassWithSpec(nodeSpec, { let url = ""; // If the listener is an object with a 'handleEvent' method, use that. - if (listenerDO.class === "Object" || listenerDO.class === "XULElement") { + if (listenerDO.class === "Object" || /^XUL\w*Element$/.test(listenerDO.class)) { let desc; while (!desc && listenerDO) { diff --git a/devtools/server/actors/tab.js b/devtools/server/actors/tab.js index b68873017457..f8eb49894b80 100644 --- a/devtools/server/actors/tab.js +++ b/devtools/server/actors/tab.js @@ -1508,7 +1508,6 @@ DebuggerProgressListener.prototype = { QueryInterface: XPCOMUtils.generateQI([ Ci.nsIWebProgressListener, Ci.nsISupportsWeakReference, - Ci.nsISupports, ]), destroy() { diff --git a/devtools/server/actors/thread.js b/devtools/server/actors/thread.js index 2abb6f19fdb3..3ab7c4c4b49f 100644 --- a/devtools/server/actors/thread.js +++ b/devtools/server/actors/thread.js @@ -1146,7 +1146,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, { // Get the Debugger.Object for the listener object. let listenerDO = this.globalDebugObject.makeDebuggeeValue(listener); // If the listener is an object with a 'handleEvent' method, use that. - if (listenerDO.class == "Object" || listenerDO.class == "XULElement") { + if (listenerDO.class === "Object" || /^XUL\w*Element$/.test(listenerDO.class)) { // For some events we don't have permission to access the // 'handleEvent' property when running in content scope. if (!listenerDO.unwrap()) { diff --git a/devtools/server/actors/webextension-inspected-window.js b/devtools/server/actors/webextension-inspected-window.js index 4065a80e93e6..afd8cbddcc10 100644 --- a/devtools/server/actors/webextension-inspected-window.js +++ b/devtools/server/actors/webextension-inspected-window.js @@ -113,8 +113,7 @@ function CustomizedReload(params) { CustomizedReload.prototype = { QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener, - Ci.nsISupportsWeakReference, - Ci.nsISupports]), + Ci.nsISupportsWeakReference]), get window() { return this.docShell.DOMWindow; }, diff --git a/devtools/shared/gcli/commands/screenshot.js b/devtools/shared/gcli/commands/screenshot.js index 87465577c13b..9cb0d87f1106 100644 --- a/devtools/shared/gcli/commands/screenshot.js +++ b/devtools/shared/gcli/commands/screenshot.js @@ -491,15 +491,9 @@ function DownloadListener(win, transfer) { } DownloadListener.prototype = { - QueryInterface: function(iid) { - if (iid.equals(Ci.nsIInterfaceRequestor) || - iid.equals(Ci.nsIWebProgressListener) || - iid.equals(Ci.nsIWebProgressListener2) || - iid.equals(Ci.nsISupports)) { - return this; - } - throw Cr.NS_ERROR_NO_INTERFACE; - }, + QueryInterface: ChromeUtils.generateQI(["nsIInterfaceRequestor", + "nsIWebProgressListener", + "nsIWebProgressListener2"]), getInterface: function(iid) { if (iid.equals(Ci.nsIAuthPrompt) || diff --git a/devtools/shared/webconsole/network-monitor.js b/devtools/shared/webconsole/network-monitor.js index d15648586215..b5a939316a29 100644 --- a/devtools/shared/webconsole/network-monitor.js +++ b/devtools/shared/webconsole/network-monitor.js @@ -286,8 +286,7 @@ function NetworkResponseListener(owner, httpActivity) { NetworkResponseListener.prototype = { QueryInterface: XPCOMUtils.generateQI([Ci.nsIStreamListener, Ci.nsIInputStreamCallback, - Ci.nsIRequestObserver, Ci.nsIInterfaceRequestor, - Ci.nsISupports]), + Ci.nsIRequestObserver, Ci.nsIInterfaceRequestor]), // nsIInterfaceRequestor implementation diff --git a/devtools/shared/webconsole/throttle.js b/devtools/shared/webconsole/throttle.js index 78e2bed2f8ab..9bfbd98b8b39 100644 --- a/devtools/shared/webconsole/throttle.js +++ b/devtools/shared/webconsole/throttle.js @@ -42,8 +42,7 @@ function NetworkThrottleListener(queue) { NetworkThrottleListener.prototype = { QueryInterface: - XPCOMUtils.generateQI([Ci.nsIStreamListener, Ci.nsIInterfaceRequestor, - Ci.nsISupports]), + XPCOMUtils.generateQI([Ci.nsIStreamListener, Ci.nsIInterfaceRequestor]), /** * Set the original listener for this object. The original listener diff --git a/devtools/startup/aboutdebugging-registration.js b/devtools/startup/aboutdebugging-registration.js index 642f4a071c70..fccb1db7dea8 100644 --- a/devtools/startup/aboutdebugging-registration.js +++ b/devtools/startup/aboutdebugging-registration.js @@ -21,7 +21,7 @@ AboutDebugging.prototype = { classID: Components.ID("1060afaf-dc9e-43da-8646-23a2faf48493"), contractID: "@mozilla.org/network/protocol/about;1?what=debugging", - QueryInterface: XPCOMUtils.generateQI([nsIAboutModule]), + QueryInterface: ChromeUtils.generateQI([nsIAboutModule]), newChannel: function(uri, loadInfo) { let chan = Services.io.newChannelFromURIWithLoadInfo( diff --git a/devtools/startup/aboutdevtools/aboutdevtools-registration.js b/devtools/startup/aboutdevtools/aboutdevtools-registration.js index b8af8c7e1acf..10f28f48163a 100644 --- a/devtools/startup/aboutdevtools/aboutdevtools-registration.js +++ b/devtools/startup/aboutdevtools/aboutdevtools-registration.js @@ -19,7 +19,7 @@ AboutDevtools.prototype = { classID: Components.ID("3a16d383-92bd-4c24-ac10-0e2bd66883ab"), contractID: "@mozilla.org/network/protocol/about;1?what=devtools", - QueryInterface: XPCOMUtils.generateQI([nsIAboutModule]), + QueryInterface: ChromeUtils.generateQI([nsIAboutModule]), newChannel: function(uri, loadInfo) { let chan = Services.io.newChannelFromURIWithLoadInfo( diff --git a/devtools/startup/aboutdevtoolstoolbox-registration.js b/devtools/startup/aboutdevtoolstoolbox-registration.js index f2b5cf279d4b..1eeef6eb3253 100644 --- a/devtools/startup/aboutdevtoolstoolbox-registration.js +++ b/devtools/startup/aboutdevtoolstoolbox-registration.js @@ -20,7 +20,7 @@ AboutDevtoolsToolbox.prototype = { classID: Components.ID("11342911-3135-45a8-8d71-737a2b0ad469"), contractID: "@mozilla.org/network/protocol/about;1?what=devtools-toolbox", - QueryInterface: XPCOMUtils.generateQI([nsIAboutModule]), + QueryInterface: ChromeUtils.generateQI([nsIAboutModule]), newChannel: function(uri, loadInfo) { let chan = Services.io.newChannelFromURIWithLoadInfo(this.uri, loadInfo); diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 43e54a69d8a6..e58a60cceb2f 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -9594,9 +9594,11 @@ nsDocShell::InternalLoad(nsIURI* aURI, // happen for links. MOZ_ASSERT(!aLoadReplace); MOZ_ASSERT(aPrincipalToInherit == aTriggeringPrincipal); - MOZ_ASSERT(aFlags == INTERNAL_LOAD_FLAGS_NO_OPENER || - aFlags == (INTERNAL_LOAD_FLAGS_NO_OPENER | - INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER)); + MOZ_ASSERT((aFlags & ~INTERNAL_LOAD_FLAGS_IS_USER_TRIGGERED) == + INTERNAL_LOAD_FLAGS_NO_OPENER || + (aFlags & ~INTERNAL_LOAD_FLAGS_IS_USER_TRIGGERED) == + (INTERNAL_LOAD_FLAGS_NO_OPENER | + INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER)); MOZ_ASSERT(!aPostData); MOZ_ASSERT(!aHeadersData); // If OnLinkClickSync was invoked inside the onload handler, the load @@ -13358,6 +13360,7 @@ public: int64_t aPostDataStreamLength, nsIInputStream* aHeadersDataStream, bool aNoOpenerImplied, + bool aIsUserTriggered, bool aIsTrusted, nsIPrincipal* aTriggeringPrincipal); @@ -13376,7 +13379,8 @@ public: mTargetSpec.get(), mFileName, mPostDataStream, mPostDataStreamLength, mHeadersDataStream, mNoOpenerImplied, - nullptr, nullptr, mTriggeringPrincipal); + nullptr, nullptr, mIsUserTriggered, + mTriggeringPrincipal); } return NS_OK; } @@ -13392,6 +13396,7 @@ private: nsCOMPtr mContent; PopupControlState mPopupState; bool mNoOpenerImplied; + bool mIsUserTriggered; bool mIsTrusted; nsCOMPtr mTriggeringPrincipal; }; @@ -13405,6 +13410,7 @@ OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler, int64_t aPostDataStreamLength, nsIInputStream* aHeadersDataStream, bool aNoOpenerImplied, + bool aIsUserTriggered, bool aIsTrusted, nsIPrincipal* aTriggeringPrincipal) : mozilla::Runnable("OnLinkClickEvent") @@ -13418,6 +13424,7 @@ OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler, , mContent(aContent) , mPopupState(mHandler->mScriptGlobal->GetPopupControlState()) , mNoOpenerImplied(aNoOpenerImplied) + , mIsUserTriggered(aIsUserTriggered) , mIsTrusted(aIsTrusted) , mTriggeringPrincipal(aTriggeringPrincipal) { @@ -13431,6 +13438,7 @@ nsDocShell::OnLinkClick(nsIContent* aContent, nsIInputStream* aPostDataStream, int64_t aPostDataStreamLength, nsIInputStream* aHeadersDataStream, + bool aIsUserTriggered, bool aIsTrusted, nsIPrincipal* aTriggeringPrincipal) { @@ -13477,7 +13485,7 @@ nsDocShell::OnLinkClick(nsIContent* aContent, new OnLinkClickEvent(this, aContent, aURI, target.get(), aFileName, aPostDataStream, aPostDataStreamLength, aHeadersDataStream, noOpenerImplied, - aIsTrusted, aTriggeringPrincipal); + aIsUserTriggered, aIsTrusted, aTriggeringPrincipal); return DispatchToTabGroup(TaskCategory::UI, ev.forget()); } @@ -13500,6 +13508,7 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent, bool aNoOpenerImplied, nsIDocShell** aDocShell, nsIRequest** aRequest, + bool aIsUserTriggered, nsIPrincipal* aTriggeringPrincipal) { // Initialize the DocShell / Request @@ -13638,6 +13647,10 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent, GetIsExecutingOnLoadHandler(&inOnLoadHandler); uint32_t loadType = inOnLoadHandler ? LOAD_NORMAL_REPLACE : LOAD_LINK; + if (aIsUserTriggered) { + flags |= INTERNAL_LOAD_FLAGS_IS_USER_TRIGGERED; + } + nsresult rv = InternalLoad(clonedURI, // New URI nullptr, // Original URI Nothing(), // Let the protocol handler assign it diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 7ff0f7040d7b..6e6c26156ea8 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -210,6 +210,7 @@ public: nsIInputStream* aPostDataStream, int64_t aPostDataStreamLength, nsIInputStream* aHeadersDataStream, + bool aIsUserTriggered, bool aIsTrusted, nsIPrincipal* aTriggeringPrincipal) override; NS_IMETHOD OnLinkClickSync(nsIContent* aContent, @@ -222,6 +223,7 @@ public: bool aNoOpenerImplied = false, nsIDocShell** aDocShell = 0, nsIRequest** aRequest = 0, + bool aIsUserTriggered = false, nsIPrincipal* aTriggeringPrincipal = nullptr) override; NS_IMETHOD OnOverLink(nsIContent* aContent, nsIURI* aURI, diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index 4c3035c3ae9b..f02ef43cb582 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -139,6 +139,9 @@ interface nsIDocShell : nsIDocShellTreeItem // Whether a top-level data URI navigation is allowed for that load const long INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI = 0x200; + // Whether the load was triggered by user interaction. + const long INTERNAL_LOAD_FLAGS_IS_USER_TRIGGERED = 0x1000; + /** * Loads the given URI. This method is identical to loadURI(...) except * that its parameter list is broken out instead of being packaged inside diff --git a/docshell/base/nsILinkHandler.h b/docshell/base/nsILinkHandler.h index d28f0b487fb4..eaed03452467 100644 --- a/docshell/base/nsILinkHandler.h +++ b/docshell/base/nsILinkHandler.h @@ -49,6 +49,7 @@ public: nsIInputStream* aPostDataStream, int64_t aPostDataStreamLength, nsIInputStream* aHeadersDataStream, + bool aIsUserTriggered, bool aIsTrusted, nsIPrincipal* aTriggeringPrincipal) = 0; @@ -82,6 +83,7 @@ public: bool aNoOpenerImplied = false, nsIDocShell** aDocShell = 0, nsIRequest** aRequest = 0, + bool aIsUserTriggered = false, nsIPrincipal* aTriggeringPrincipal = nullptr) = 0; /** diff --git a/docshell/test/browser/browser_bug655270.js b/docshell/test/browser/browser_bug655270.js index f8106a8a08fd..7234aeabf8a7 100644 --- a/docshell/test/browser/browser_bug655270.js +++ b/docshell/test/browser/browser_bug655270.js @@ -53,7 +53,7 @@ function test() { onDeleteURI: function() { }, onClearHistory: function() { }, onDeleteVisits: function() { }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsINavHistoryObserver]) + QueryInterface: ChromeUtils.generateQI([Ci.nsINavHistoryObserver]) }; PlacesUtils.history.addObserver(observer); diff --git a/docshell/test/browser/browser_bug670318.js b/docshell/test/browser/browser_bug670318.js index ccec831b2884..eb71a4117a5a 100644 --- a/docshell/test/browser/browser_bug670318.js +++ b/docshell/test/browser/browser_bug670318.js @@ -51,8 +51,8 @@ add_task(async function test() { return true; }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsISHistoryListener, - Ci.nsISupportsWeakReference]) + QueryInterface: ChromeUtils.generateQI([Ci.nsISHistoryListener, + Ci.nsISupportsWeakReference]) }; history.legacySHistory.addSHistoryListener(listener); diff --git a/docshell/test/browser/browser_onbeforeunload_navigation.js b/docshell/test/browser/browser_onbeforeunload_navigation.js index ea33e81bb166..1204bf6a1ccf 100644 --- a/docshell/test/browser/browser_onbeforeunload_navigation.js +++ b/docshell/test/browser/browser_onbeforeunload_navigation.js @@ -155,7 +155,7 @@ var tabStateListener = { onLocationChange: () => {}, onSecurityChange: () => {}, onProgressChange: () => {}, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener]) }; function onTabModalDialogLoaded(node) { diff --git a/docshell/test/browser/file_bug1328501_framescript.js b/docshell/test/browser/file_bug1328501_framescript.js index bbda15f41eb9..1107f5ad4092 100644 --- a/docshell/test/browser/file_bug1328501_framescript.js +++ b/docshell/test/browser/file_bug1328501_framescript.js @@ -14,7 +14,7 @@ let requestObserver = { }); } }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsIObserver ]) } diff --git a/docshell/test/browser/file_bug422543_script.js b/docshell/test/browser/file_bug422543_script.js index 58111f7dfe01..d058748fd506 100644 --- a/docshell/test/browser/file_bug422543_script.js +++ b/docshell/test/browser/file_bug422543_script.js @@ -38,8 +38,8 @@ SHistoryListener.prototype = { OnHistoryReplaceEntry: function (aIndex) {}, - QueryInterface: XPCOMUtils.generateQI([Ci.nsISHistoryListener, - Ci.nsISupportsWeakReference]) + QueryInterface: ChromeUtils.generateQI([Ci.nsISHistoryListener, + Ci.nsISupportsWeakReference]) }; let testAPI = { diff --git a/docshell/test/chrome/test_bug909218.html b/docshell/test/chrome/test_bug909218.html index daa5c52ac9dc..1ea1669467d1 100644 --- a/docshell/test/chrome/test_bug909218.html +++ b/docshell/test/chrome/test_bug909218.html @@ -109,7 +109,7 @@ RequestWatcher = { this.finalize(); } }, - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsIWebProgressListener, Ci.nsISupportsWeakReference, ]) diff --git a/docshell/test/chrome/test_viewsource_forbidden_in_iframe.xul b/docshell/test/chrome/test_viewsource_forbidden_in_iframe.xul index 40a38967c992..f9d8a16c5ee0 100644 --- a/docshell/test/chrome/test_viewsource_forbidden_in_iframe.xul +++ b/docshell/test/chrome/test_viewsource_forbidden_in_iframe.xul @@ -59,8 +59,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=624883 resolve(decodeURIComponent(errorMsg)); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener, - Ci.nsISupportsWeakReference]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener, + Ci.nsISupportsWeakReference]) }; frame.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor) diff --git a/dom/base/DOMRequestHelper.jsm b/dom/base/DOMRequestHelper.jsm index f6b8cf41f852..dd068d8cdead 100644 --- a/dom/base/DOMRequestHelper.jsm +++ b/dom/base/DOMRequestHelper.jsm @@ -42,8 +42,8 @@ DOMRequestIpcHelper.prototype = { * An object which "inherits" from DOMRequestIpcHelper and declares its own * queryInterface method MUST implement Ci.nsISupportsWeakReference. */ - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, - Ci.nsIObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsWeakReference, + Ci.nsIObserver]), /** * 'aMessages' is expected to be an array of either: diff --git a/dom/base/EventSource.cpp b/dom/base/EventSource.cpp index 02fe1d840d4c..57a4d4775531 100644 --- a/dom/base/EventSource.cpp +++ b/dom/base/EventSource.cpp @@ -1454,11 +1454,7 @@ EventSourceImpl::DispatchCurrentMessageEvent() message->mLastEventID.Assign(mLastEventID); } - size_t sizeBefore = mMessagesToDispatch.GetSize(); mMessagesToDispatch.Push(message.release()); - NS_ENSURE_TRUE(mMessagesToDispatch.GetSize() == sizeBefore + 1, - NS_ERROR_OUT_OF_MEMORY); - if (!mGoingToDispatchAllMessages) { nsCOMPtr event = diff --git a/dom/base/ProcessSelector.js b/dom/base/ProcessSelector.js index 66f0e56e686f..b410a1e878fa 100644 --- a/dom/base/ProcessSelector.js +++ b/dom/base/ProcessSelector.js @@ -12,7 +12,7 @@ function RandomSelector() { RandomSelector.prototype = { classID: Components.ID("{c616fcfd-9737-41f1-aa74-cee72a38f91b}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentProcessProvider]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIContentProcessProvider]), provideProcess(aType, aOpener, aProcesses, aCount, aMaxCount) { if (aCount < aMaxCount) { @@ -41,7 +41,7 @@ function MinTabSelector() { MinTabSelector.prototype = { classID: Components.ID("{2dc08eaf-6eef-4394-b1df-a3a927c1290b}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentProcessProvider]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIContentProcessProvider]), provideProcess(aType, aOpener, aProcesses, aCount, aMaxCount) { if (aCount < aMaxCount) { diff --git a/dom/base/SlowScriptDebug.js b/dom/base/SlowScriptDebug.js index f6ac03bfba16..0db76f8615cd 100644 --- a/dom/base/SlowScriptDebug.js +++ b/dom/base/SlowScriptDebug.js @@ -12,7 +12,7 @@ SlowScriptDebug.prototype = { classID: Components.ID("{e740ddb4-18b4-4aac-8ae1-9b0f4320769d}"), classDescription: "Slow script debug handler", contractID: "@mozilla.org/dom/slow-script-debug;1", - QueryInterface: XPCOMUtils.generateQI([Ci.nsISlowScriptDebug]), + QueryInterface: ChromeUtils.generateQI([Ci.nsISlowScriptDebug]), get activationHandler() { return this._activationHandler; }, set activationHandler(cb) { return this._activationHandler = cb; }, diff --git a/dom/base/contentAreaDropListener.js b/dom/base/contentAreaDropListener.js index a0caf1ea8608..2b31738a8f94 100644 --- a/dom/base/contentAreaDropListener.js +++ b/dom/base/contentAreaDropListener.js @@ -18,7 +18,7 @@ function ContentAreaDropListener() { }; ContentAreaDropListener.prototype = { classID: Components.ID("{1f34bc80-1bc7-11d6-a384-d705dd0746fc}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDroppedLinkHandler, Ci.nsISupports]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDroppedLinkHandler]), _addLink : function(links, url, name, type) { diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 5cfc42a05406..84f811c1806a 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -5544,8 +5544,8 @@ nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext, handler->OnLinkClick(aContent, aLinkURI, fileName.IsVoid() ? aTargetSpec.get() : EmptyString().get(), - fileName, nullptr, -1, nullptr, aIsTrusted, - aContent->NodePrincipal()); + fileName, nullptr, -1, nullptr, EventStateManager::IsHandlingUserInput(), + aIsTrusted, aContent->NodePrincipal()); } } @@ -6693,9 +6693,7 @@ nsContentUtils::IsFocusedContent(const nsIContent* aContent) bool nsContentUtils::IsSubDocumentTabbable(nsIContent* aContent) { - //XXXsmaug Shadow DOM spec issue! - // We may need to change this to GetComposedDoc(). - nsIDocument* doc = aContent->GetUncomposedDoc(); + nsIDocument* doc = aContent->GetComposedDoc(); if (!doc) { return false; } @@ -9997,7 +9995,7 @@ nsContentUtils::NewXULOrHTMLElement(Element** aResult, mozilla::dom::NodeInfo* a if (nodeInfo->NamespaceEquals(kNameSpaceID_XHTML)) { NS_IF_ADDREF(*aResult = NS_NewHTMLUnknownElement(nodeInfo.forget(), aFromParser)); } else { - NS_IF_ADDREF(*aResult = new nsXULElement(nodeInfo.forget())); + NS_IF_ADDREF(*aResult = nsXULElement::Construct(nodeInfo.forget())); } } return NS_OK; @@ -10007,7 +10005,7 @@ nsContentUtils::NewXULOrHTMLElement(Element** aResult, mozilla::dom::NodeInfo* a if (nodeInfo->NamespaceEquals(kNameSpaceID_XHTML)) { NS_IF_ADDREF(*aResult = NS_NewHTMLElement(nodeInfo.forget(), aFromParser)); } else { - NS_IF_ADDREF(*aResult = new nsXULElement(nodeInfo.forget())); + NS_IF_ADDREF(*aResult = nsXULElement::Construct(nodeInfo.forget())); } (*aResult)->SetCustomElementData(new CustomElementData(definition->mType)); nsContentUtils::EnqueueUpgradeReaction(*aResult, definition); @@ -10023,7 +10021,7 @@ nsContentUtils::NewXULOrHTMLElement(Element** aResult, mozilla::dom::NodeInfo* a *aResult = CreateHTMLElement(tag, nodeInfo.forget(), aFromParser).take(); } } else { - NS_IF_ADDREF(*aResult = new nsXULElement(nodeInfo.forget())); + NS_IF_ADDREF(*aResult = nsXULElement::Construct(nodeInfo.forget())); } if (!*aResult) { diff --git a/dom/base/nsDOMNavigationTiming.cpp b/dom/base/nsDOMNavigationTiming.cpp index 1c534c639b1d..5f139ad6a9f7 100644 --- a/dom/base/nsDOMNavigationTiming.cpp +++ b/dom/base/nsDOMNavigationTiming.cpp @@ -296,6 +296,33 @@ nsDOMNavigationTiming::NotifyNonBlankPaintForRootContentDocument() } } +void +nsDOMNavigationTiming::NotifyDOMContentFlushedForRootContentDocument() +{ + MOZ_ASSERT(NS_IsMainThread()); + MOZ_ASSERT(!mNavigationStart.IsNull()); + + if (!mDOMContentFlushed.IsNull()) { + return; + } + + mDOMContentFlushed = TimeStamp::Now(); + +#ifdef MOZ_GECKO_PROFILER + if (profiler_is_active()) { + TimeDuration elapsed = mDOMContentFlushed - mNavigationStart; + nsAutoCString spec; + if (mLoadedURI) { + mLoadedURI->GetSpec(spec); + } + nsPrintfCString marker("DOMContentFlushed after %dms for URL %s, %s", + int(elapsed.ToMilliseconds()), spec.get(), + mDocShellHasBeenActiveSinceNavigationStart ? "foreground tab" : "this tab was inactive some of the time between navigation start and DOMContentFlushed"); + profiler_add_marker(marker.get()); + } +#endif +} + void nsDOMNavigationTiming::NotifyDocShellStateChanged(DocShellState aDocShellState) { diff --git a/dom/base/nsDOMNavigationTiming.h b/dom/base/nsDOMNavigationTiming.h index 896df3102e44..942231508011 100644 --- a/dom/base/nsDOMNavigationTiming.h +++ b/dom/base/nsDOMNavigationTiming.h @@ -96,6 +96,10 @@ public: { return TimeStampToDOM(mNonBlankPaint); } + DOMTimeMilliSec GetTimeToDOMContentFlushed() const + { + return TimeStampToDOM(mDOMContentFlushed); + } DOMHighResTimeStamp GetUnloadEventStartHighRes() { @@ -161,6 +165,7 @@ public: void NotifyDOMContentLoadedEnd(nsIURI* aURI); void NotifyNonBlankPaintForRootContentDocument(); + void NotifyDOMContentFlushedForRootContentDocument(); void NotifyDocShellStateChanged(DocShellState aDocShellState); DOMTimeMilliSec TimeStampToDOM(mozilla::TimeStamp aStamp) const; @@ -194,6 +199,7 @@ private: DOMHighResTimeStamp mNavigationStartHighRes; mozilla::TimeStamp mNavigationStart; mozilla::TimeStamp mNonBlankPaint; + mozilla::TimeStamp mDOMContentFlushed; mozilla::TimeStamp mBeforeUnloadStart; mozilla::TimeStamp mUnloadStart; diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 5f7f77ff2cfa..bbe508de20c6 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -256,7 +256,6 @@ #ifdef MOZ_XUL #include "mozilla/dom/ListBoxObject.h" #include "mozilla/dom/MenuBoxObject.h" -#include "mozilla/dom/PopupBoxObject.h" #include "mozilla/dom/ScrollBoxObject.h" #include "mozilla/dom/TreeBoxObject.h" #endif @@ -5465,6 +5464,10 @@ nsIDocument::UnblockDOMContentLoaded() MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug, ("DOCUMENT %p UnblockDOMContentLoaded", this)); mDidFireDOMContentLoaded = true; + if (nsIPresShell* shell = GetShell()) { + shell->GetRefreshDriver()->NotifyDOMContentLoaded(); + } + MOZ_ASSERT(mReadyState == READYSTATE_INTERACTIVE); if (!mSynchronousDOMContentLoaded) { @@ -6576,11 +6579,6 @@ nsIDocument::GetBoxObjectFor(Element* aElement, ErrorResult& aRv) if (namespaceID == kNameSpaceID_XUL) { if (tag == nsGkAtoms::menu) { boxObject = new MenuBoxObject(); - } else if (tag == nsGkAtoms::popup || - tag == nsGkAtoms::menupopup || - tag == nsGkAtoms::panel || - tag == nsGkAtoms::tooltip) { - boxObject = new PopupBoxObject(); } else if (tag == nsGkAtoms::tree) { boxObject = new TreeBoxObject(); } else if (tag == nsGkAtoms::listbox) { diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index f7feb408db58..864c76402cb1 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -3239,9 +3239,11 @@ nsFocusManager::HostOrSlotTabIndexValue(nsIContent* aContent) nsIContent* nsFocusManager::GetNextTabbableContentInScope(nsIContent* aOwner, nsIContent* aStartContent, + nsIContent* aOriginalStartContent, bool aForward, int32_t aCurrentTabIndex, bool aIgnoreTabIndex, + bool aForDocumentNavigation, bool aSkipOwner) { // Return shadow host at first for forward navigation if its tabindex @@ -3361,14 +3363,33 @@ nsFocusManager::GetNextTabbableContentInScope(nsIContent* aOwner, } if (!IsHostOrSlot(iterContent)) { + nsCOMPtr elementInFrame; + bool checkSubDocument = true; + if (aForDocumentNavigation && + TryDocumentNavigation(iterContent, &checkSubDocument, + getter_AddRefs(elementInFrame))) { + return elementInFrame; + } + if (!checkSubDocument) { + continue; + } + + if (TryToMoveFocusToSubDocument(iterContent, aOriginalStartContent, + aForward, aForDocumentNavigation, + getter_AddRefs(elementInFrame))) { + return elementInFrame; + } + // Found content to focus return iterContent; } // Search in scope owned by iterContent nsIContent* contentToFocus = - GetNextTabbableContentInScope(iterContent, iterContent, aForward, + GetNextTabbableContentInScope(iterContent, iterContent, + aOriginalStartContent, aForward, aForward ? 1 : 0, aIgnoreTabIndex, + aForDocumentNavigation, false /* aSkipOwner */); if (contentToFocus) { return contentToFocus; @@ -3402,9 +3423,11 @@ nsFocusManager::GetNextTabbableContentInScope(nsIContent* aOwner, nsIContent* nsFocusManager::GetNextTabbableContentInAncestorScopes( nsIContent** aStartContent, + nsIContent* aOriginalStartContent, bool aForward, int32_t* aCurrentTabIndex, - bool aIgnoreTabIndex) + bool aIgnoreTabIndex, + bool aForDocumentNavigation) { nsIContent* startContent = *aStartContent; while (1) { @@ -3414,8 +3437,9 @@ nsFocusManager::GetNextTabbableContentInAncestorScopes( int32_t tabIndex = 0; startContent->IsFocusable(&tabIndex); nsIContent* contentToFocus = - GetNextTabbableContentInScope(owner, startContent, aForward, - tabIndex, aIgnoreTabIndex, + GetNextTabbableContentInScope(owner, startContent, aOriginalStartContent, + aForward, tabIndex, aIgnoreTabIndex, + aForDocumentNavigation, false /* aSkipOwner */); if (contentToFocus) { return contentToFocus; @@ -3461,8 +3485,10 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell, // search in scope owned by aStartContent if (aForward && IsHostOrSlot(aStartContent)) { nsIContent* contentToFocus = - GetNextTabbableContentInScope(aStartContent, aStartContent, aForward, + GetNextTabbableContentInScope(aStartContent, aStartContent, + aOriginalStartContent, aForward, aForward ? 1 : 0, aIgnoreTabIndex, + aForDocumentNavigation, true /* aSkipOwner */); if (contentToFocus) { NS_ADDREF(*aResultContent = contentToFocus); @@ -3475,9 +3501,12 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell, // search from scope including aStartContent if (aRootContent != FindOwner(aStartContent)) { nsIContent* contentToFocus = - GetNextTabbableContentInAncestorScopes(&aStartContent, aForward, + GetNextTabbableContentInAncestorScopes(&aStartContent, + aOriginalStartContent, + aForward, &aCurrentTabIndex, - aIgnoreTabIndex); + aIgnoreTabIndex, + aForDocumentNavigation); if (contentToFocus) { NS_ADDREF(*aResultContent = contentToFocus); return NS_OK; @@ -3609,8 +3638,10 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell, if (tabIndex >= 0 && (aIgnoreTabIndex || aCurrentTabIndex == tabIndex)) { nsIContent* contentToFocus = - GetNextTabbableContentInScope(currentContent, currentContent, aForward, + GetNextTabbableContentInScope(currentContent, currentContent, + aOriginalStartContent, aForward, aForward ? 1 : 0, aIgnoreTabIndex, + aForDocumentNavigation, true /* aSkipOwner */); if (contentToFocus) { NS_ADDREF(*aResultContent = contentToFocus); @@ -3667,54 +3698,21 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell, // Next, for document navigation, check if this a non-remote child document. bool checkSubDocument = true; - if (aForDocumentNavigation) { - Element* docRoot = GetRootForChildDocument(currentContent); - if (docRoot) { - // If GetRootForChildDocument returned something then call - // FocusFirst to find the root or first element to focus within - // the child document. If this is a frameset though, skip this and - // fall through to the checkSubDocument block below to iterate into - // the frameset's frames and locate the first focusable frame. - if (!docRoot->IsHTMLElement(nsGkAtoms::frameset)) { - return FocusFirst(docRoot, aResultContent); - } - } else { - // Set checkSubDocument to false, as this was neither a frame - // type element or a child document that was focusable. - checkSubDocument = false; - } + if (aForDocumentNavigation && + TryDocumentNavigation(currentContent, &checkSubDocument, + aResultContent)) { + return NS_OK; } if (checkSubDocument) { // found a node with a matching tab index. Check if it is a child // frame. If so, navigate into the child frame instead. - nsIDocument* doc = currentContent->GetComposedDoc(); - NS_ASSERTION(doc, "content not in document"); - nsIDocument* subdoc = doc->GetSubDocumentFor(currentContent); - if (subdoc && !subdoc->EventHandlingSuppressed()) { - if (aForward) { - // when tabbing forward into a frame, return the root - // frame so that the canvas becomes focused. - nsCOMPtr subframe = subdoc->GetWindow(); - if (subframe) { - *aResultContent = GetRootForFocus(subframe, subdoc, false, true); - if (*aResultContent) { - NS_ADDREF(*aResultContent); - return NS_OK; - } - } - } - Element* rootElement = subdoc->GetRootElement(); - nsIPresShell* subShell = subdoc->GetShell(); - if (rootElement && subShell) { - rv = GetNextTabbableContent(subShell, rootElement, - aOriginalStartContent, rootElement, - aForward, (aForward ? 1 : 0), - false, aForDocumentNavigation, aResultContent); - NS_ENSURE_SUCCESS(rv, rv); - if (*aResultContent) - return NS_OK; - } + if (TryToMoveFocusToSubDocument(currentContent, + aOriginalStartContent, + aForward, aForDocumentNavigation, + aResultContent)) { + MOZ_ASSERT(*aResultContent); + return NS_OK; } // otherwise, use this as the next content node to tab to, unless // this was the element we started on. This would happen for @@ -3738,8 +3736,10 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell, nsIContent* contentToFocus = GetNextTabbableContentInScope(currentContent, currentContent, + aOriginalStartContent, aForward, aForward ? 1 : 0, aIgnoreTabIndex, + aForDocumentNavigation, true /* aSkipOwner */); if (contentToFocus) { NS_ADDREF(*aResultContent = contentToFocus); @@ -3803,6 +3803,73 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell, return NS_OK; } +bool +nsFocusManager::TryDocumentNavigation(nsIContent* aCurrentContent, + bool* aCheckSubDocument, + nsIContent** aResultContent) +{ + *aCheckSubDocument = true; + Element* docRoot = GetRootForChildDocument(aCurrentContent); + if (docRoot) { + // If GetRootForChildDocument returned something then call + // FocusFirst to find the root or first element to focus within + // the child document. If this is a frameset though, skip this and + // fall through to normal tab navigation to iterate into + // the frameset's frames and locate the first focusable frame. + if (!docRoot->IsHTMLElement(nsGkAtoms::frameset)) { + *aCheckSubDocument = false; + Unused << FocusFirst(docRoot, aResultContent); + return *aResultContent != nullptr; + } + } else { + // Set aCheckSubDocument to false, as this was neither a frame + // type element or a child document that was focusable. + *aCheckSubDocument = false; + } + + return false; +} + +bool +nsFocusManager::TryToMoveFocusToSubDocument(nsIContent* aCurrentContent, + nsIContent* aOriginalStartContent, + bool aForward, + bool aForDocumentNavigation, + nsIContent** aResultContent) +{ + nsIDocument* doc = aCurrentContent->GetComposedDoc(); + NS_ASSERTION(doc, "content not in document"); + nsIDocument* subdoc = doc->GetSubDocumentFor(aCurrentContent); + if (subdoc && !subdoc->EventHandlingSuppressed()) { + if (aForward) { + // when tabbing forward into a frame, return the root + // frame so that the canvas becomes focused. + nsCOMPtr subframe = subdoc->GetWindow(); + if (subframe) { + *aResultContent = GetRootForFocus(subframe, subdoc, false, true); + if (*aResultContent) { + NS_ADDREF(*aResultContent); + return true; + } + } + } + Element* rootElement = subdoc->GetRootElement(); + nsIPresShell* subShell = subdoc->GetShell(); + if (rootElement && subShell) { + nsresult rv = GetNextTabbableContent(subShell, rootElement, + aOriginalStartContent, rootElement, + aForward, (aForward ? 1 : 0), + false, aForDocumentNavigation, + aResultContent); + NS_ENSURE_SUCCESS(rv, false); + if (*aResultContent) { + return true; + } + } + } + return false; +} + nsIContent* nsFocusManager::GetNextTabbableMapArea(bool aForward, int32_t aCurrentTabIndex, diff --git a/dom/base/nsFocusManager.h b/dom/base/nsFocusManager.h index 83c28dd48538..3efe2a2790b8 100644 --- a/dom/base/nsFocusManager.h +++ b/dom/base/nsFocusManager.h @@ -462,6 +462,9 @@ protected: * * aStartContent is the starting point for this call of this method. * + * aOriginalStartContent is the initial starting point for sequential + * navigation. + * * aForward should be true for forward navigation or false for backward * navigation. * @@ -470,6 +473,9 @@ protected: * aIgnoreTabIndex to ignore the current tabindex and find the element * irrespective or the tab index. * + * aForDocumentNavigation informs whether we're navigating only through + * documents. + * * aSkipOwner to skip owner while searching. The flag is set when caller is * |GetNextTabbableContent| in order to let caller handle owner. * @@ -479,9 +485,11 @@ protected: */ nsIContent* GetNextTabbableContentInScope(nsIContent* aOwner, nsIContent* aStartContent, + nsIContent* aOriginalStartContent, bool aForward, int32_t aCurrentTabIndex, bool aIgnoreTabIndex, + bool aForDocumentNavigation, bool aSkipOwner); /** @@ -494,6 +502,9 @@ protected: * light DOM if the next tabbable element is not found in shadow DOM, * in order to continue searching in light DOM. * + * aOriginalStartContent is the initial starting point for sequential + * navigation. + * * aForward should be true for forward navigation or false for backward * navigation. * @@ -504,15 +515,20 @@ protected: * aIgnoreTabIndex to ignore the current tabindex and find the element * irrespective or the tab index. * + * aForDocumentNavigation informs whether we're navigating only through + * documents. + * * NOTE: * Consider the method searches upwards in all shadow host- or slot-rooted * flattened subtrees that contains aStartContent as non-root, except * the flattened subtree rooted at shadow host in light DOM. */ nsIContent* GetNextTabbableContentInAncestorScopes(nsIContent** aStartContent, + nsIContent* aOriginalStartContent, bool aForward, int32_t* aCurrentTabIndex, - bool aIgnoreTabIndex); + bool aIgnoreTabIndex, + bool aForDocumentNavigation); /** * Retrieve the next tabbable element within a document, using focusability @@ -634,6 +650,16 @@ private: void SetFocusedWindowInternal(nsPIDOMWindowOuter* aWindow); + bool TryDocumentNavigation(nsIContent* aCurrentContent, + bool* aCheckSubDocument, + nsIContent** aResultContent); + + bool TryToMoveFocusToSubDocument(nsIContent* aCurrentContent, + nsIContent* aOriginalStartContent, + bool aForward, + bool aForDocumentNavigation, + nsIContent** aResultContent); + // the currently active and front-most top-most window nsCOMPtr mActiveWindow; diff --git a/dom/base/nsGlobalWindowInner.cpp b/dom/base/nsGlobalWindowInner.cpp index f65eed5c902c..988270e1f97f 100644 --- a/dom/base/nsGlobalWindowInner.cpp +++ b/dom/base/nsGlobalWindowInner.cpp @@ -5204,20 +5204,11 @@ nsGlobalWindowInner::FireOfflineStatusEventIfChanged() } else { name.AssignLiteral("online"); } - // The event is fired at the body element, or if there is no body element, - // at the document. - nsCOMPtr eventTarget = mDoc.get(); - if (mDoc->IsHTMLOrXHTML()) { - if (Element* body = mDoc->GetBody()) { - eventTarget = body; - } - } else { - Element* documentElement = mDoc->GetDocumentElement(); - if (documentElement) { - eventTarget = documentElement; - } - } - nsContentUtils::DispatchTrustedEvent(mDoc, eventTarget, name, true, false); + nsContentUtils::DispatchTrustedEvent(mDoc, + static_cast(this), + name, + false, + false); } class NotifyIdleObserverRunnable : public Runnable diff --git a/dom/base/test/browser_bug1303838.js b/dom/base/test/browser_bug1303838.js index d7d04584e4f4..372f3d246a06 100644 --- a/dom/base/test/browser_bug1303838.js +++ b/dom/base/test/browser_bug1303838.js @@ -166,8 +166,8 @@ function waitForLocationChange(browser, locationChangeNum) { resolve(); } }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener, - Ci.nsISupportsWeakReference]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener, + Ci.nsISupportsWeakReference]) }; browser.addProgressListener(locationChangeListener); }); diff --git a/dom/base/test/browser_promiseDocumentFlushed.js b/dom/base/test/browser_promiseDocumentFlushed.js index b24480c84a62..e40e9457c7b3 100644 --- a/dom/base/test/browser_promiseDocumentFlushed.js +++ b/dom/base/test/browser_promiseDocumentFlushed.js @@ -121,8 +121,8 @@ add_task(async function test_can_get_results_from_callback() { Assert.ok(false, "A reflow should not have occurred."); }, reflowInterruptible() {}, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIReflowObserver, - Ci.nsISupportsWeakReference]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIReflowObserver, + Ci.nsISupportsWeakReference]) }; let docShell = window.QueryInterface(Ci.nsIInterfaceRequestor) diff --git a/dom/base/test/chrome/file_bug549682.xul b/dom/base/test/chrome/file_bug549682.xul index 14224ad61a58..df048a208a3c 100644 --- a/dom/base/test/chrome/file_bug549682.xul +++ b/dom/base/test/chrome/file_bug549682.xul @@ -92,7 +92,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=549682 var weakMessageReceived = false; var weakListener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsWeakReference]), receiveMessage: function(msg) { if (weakMessageReceived) { @@ -108,7 +108,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=549682 }; var weakListener2 = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsWeakReference]), receiveMessage: function(msg) { ok(false, 'Should not have received a message.'); diff --git a/dom/base/test/chrome/test_bug682305.html b/dom/base/test/chrome/test_bug682305.html index 4e67b33be388..0d0872731b0b 100644 --- a/dom/base/test/chrome/test_bug682305.html +++ b/dom/base/test/chrome/test_bug682305.html @@ -93,7 +93,7 @@ CustomChannel.prototype = { resume: function() { throw Cr.NS_ERROR_NOT_IMPLEMENTED; }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIChannel, Ci.nsIRequest]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIChannel, Ci.nsIRequest]) }; @@ -125,9 +125,7 @@ CustomProtocol.prototype = { newChannel: function newChannel(URI) { return newChannel2(URI); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, - Ci.nsISupportsWeakReference, - Ci.nsIProtocolHandler]) + QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIProtocolHandler]) }; var gFactory = { diff --git a/dom/base/test/chrome/test_bug800386.xul b/dom/base/test/chrome/test_bug800386.xul index f403ba14e4a5..97b8f253b55c 100644 --- a/dom/base/test/chrome/test_bug800386.xul +++ b/dom/base/test/chrome/test_bug800386.xul @@ -46,8 +46,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=800386 throw Cr.NS_ERROR_NO_INTERFACE; }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, - Ci.nsIInterfaceRequestor]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIInterfaceRequestor]) }; // HTTP URI so that we get progress callbacks diff --git a/dom/base/test/file_bug1453693.html b/dom/base/test/file_bug1453693.html index b1a45aabdd37..4b5fa3b07956 100644 --- a/dom/base/test/file_bug1453693.html +++ b/dom/base/test/file_bug1453693.html @@ -37,6 +37,11 @@ shadowDate.tabIndex = 1; sr.appendChild(shadowDate); + var shadowIframe = document.createElement("iframe"); + shadowIframe.tabIndex = 1; + sr.appendChild(shadowIframe); + shadowIframe.contentDocument.body.innerHTML = ""; + var input = document.createElement("input"); input.onfocus = focusLogger; input.tabIndex = 1; @@ -61,6 +66,14 @@ synthesizeKey("KEY_Tab"); opener.is(lastFocusTarget, shadowDate, "Should have focused date element in shadow DOM. (3)"); synthesizeKey("KEY_Tab"); + opener.is(shadowIframe.contentDocument.activeElement, + shadowIframe.contentDocument.documentElement, + "Should have focused document element in shadow iframe. (3)"); + synthesizeKey("KEY_Tab"); + opener.is(shadowIframe.contentDocument.activeElement, + shadowIframe.contentDocument.body.firstChild, + "Should have focused input element in shadow iframe. (3)"); + synthesizeKey("KEY_Tab"); opener.is(lastFocusTarget, shadowAnchor, "Should have focused anchor element in shadow DOM. (3)"); synthesizeKey("KEY_Tab"); opener.is(lastFocusTarget, input2, "Should have focused input[2] element. (3)"); @@ -69,6 +82,14 @@ synthesizeKey("KEY_Tab", {shiftKey: true}); opener.is(lastFocusTarget, shadowAnchor, "Should have focused anchor element in shadow DOM. (4)"); synthesizeKey("KEY_Tab", {shiftKey: true}); + opener.is(shadowIframe.contentDocument.activeElement, + shadowIframe.contentDocument.body.firstChild, + "Should have focused input element in shadow iframe. (4)"); + synthesizeKey("KEY_Tab", {shiftKey: true}); + opener.is(shadowIframe.contentDocument.activeElement, + shadowIframe.contentDocument.documentElement, + "Should have focused document element in shadow iframe. (4)"); + synthesizeKey("KEY_Tab", {shiftKey: true}); opener.is(lastFocusTarget, shadowDate, "Should have focused date element in shadow DOM. (4)"); synthesizeKey("KEY_Tab", {shiftKey: true}); opener.is(lastFocusTarget, shadowDate, "Should have focused date element in shadow DOM. (4)"); diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index 6c644282eedb..fcceeec0d3ab 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -3875,7 +3875,8 @@ HTMLConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp, MOZ_ASSERT(nodeInfo); if (ns == kNameSpaceID_XUL) { - element = new nsXULElement(nodeInfo.forget()); + element = nsXULElement::Construct(nodeInfo.forget()); + } else { if (tag == eHTMLTag_userdefined) { // Autonomous custom element. diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index eccec05356df..242c2d5ce0c7 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -107,10 +107,6 @@ DOMInterfaces = { 'headerFile': 'BatteryManager.h' }, -'BoxObject': { - 'resultNotAddRefed': ['element'], -}, - 'Cache': { 'implicitJSContext': [ 'add', 'addAll', 'match', 'matchAll', 'put', 'delete', 'keys' ], @@ -691,10 +687,6 @@ DOMInterfaces = { 'nativeType': 'nsIPluginTag', }, -'PopupBoxObject': { - 'resultNotAddRefed': ['triggerNode', 'anchorNode'], -}, - 'Position': { 'headerFile': 'nsGeoPosition.h' }, diff --git a/dom/bindings/test/TestInterfaceJS.js b/dom/bindings/test/TestInterfaceJS.js index 868ea6bca670..9ca9785f7df3 100644 --- a/dom/bindings/test/TestInterfaceJS.js +++ b/dom/bindings/test/TestInterfaceJS.js @@ -13,9 +13,7 @@ function TestInterfaceJS(anyArg, objectArg) {} TestInterfaceJS.prototype = { classID: Components.ID("{2ac4e026-cf25-47d5-b067-78d553c3cad8}"), contractID: "@mozilla.org/dom/test-interface-js;1", - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, - Ci.nsIDOMGlobalPropertyInitializer, - Ci.mozITestInterfaceJS]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer, Ci.mozITestInterfaceJS]), init: function(win) { this._win = win; }, diff --git a/dom/bindings/test/TestInterfaceJSMaplike.js b/dom/bindings/test/TestInterfaceJSMaplike.js index 044a21fc3fe7..46e030f8e129 100644 --- a/dom/bindings/test/TestInterfaceJSMaplike.js +++ b/dom/bindings/test/TestInterfaceJSMaplike.js @@ -13,8 +13,7 @@ function TestInterfaceJSMaplike() {} TestInterfaceJSMaplike.prototype = { classID: Components.ID("{4bc6f6f3-e005-4f0a-b42d-4d1663a9013a}"), contractID: "@mozilla.org/dom/test-interface-js-maplike;1", - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, - Ci.nsIDOMGlobalPropertyInitializer]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer]), init: function(win) { this._win = win; }, diff --git a/dom/browser-element/BrowserElementChildPreload.js b/dom/browser-element/BrowserElementChildPreload.js index 94770ed89b1a..ceea8b00121b 100644 --- a/dom/browser-element/BrowserElementChildPreload.js +++ b/dom/browser-element/BrowserElementChildPreload.js @@ -123,8 +123,8 @@ function BrowserElementChild() { BrowserElementChild.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference]), _init: function() { debug("Starting up."); @@ -1380,8 +1380,8 @@ BrowserElementChild.prototype = { // The docShell keeps a weak reference to the progress listener, so we need // to keep a strong ref to it ourselves. _progressListener: { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener, + Ci.nsISupportsWeakReference]), _seenLoadStart: false, onLocationChange: function(webProgress, request, location, flags) { diff --git a/dom/browser-element/BrowserElementParent.js b/dom/browser-element/BrowserElementParent.js index daa0e0368716..62612172e5c8 100644 --- a/dom/browser-element/BrowserElementParent.js +++ b/dom/browser-element/BrowserElementParent.js @@ -74,9 +74,9 @@ BrowserElementParent.prototype = { classDescription: "BrowserElementAPI implementation", classID: Components.ID("{9f171ac4-0939-4ef8-b360-3408aedc3060}"), contractID: "@mozilla.org/dom/browser-element-api;1", - QueryInterface: XPCOMUtils.generateQI([Ci.nsIBrowserElementAPI, - Ci.nsIObserver, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIBrowserElementAPI, + Ci.nsIObserver, + Ci.nsISupportsWeakReference]), setFrameLoader: function(frameLoader) { debug("Setting frameLoader"); @@ -728,8 +728,8 @@ BrowserElementParent.prototype = { this.extListener.onDataAvailable(aRequest, aContext, aInputStream, aOffset, aCount); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIStreamListener, - Ci.nsIRequestObserver]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIStreamListener, + Ci.nsIRequestObserver]) }; let referrer = Services.io.newURI(_options.referrer); diff --git a/dom/browser-element/BrowserElementPromptService.jsm b/dom/browser-element/BrowserElementPromptService.jsm index c9fc31e41fbb..409b5f1879c7 100644 --- a/dom/browser-element/BrowserElementPromptService.jsm +++ b/dom/browser-element/BrowserElementPromptService.jsm @@ -25,7 +25,7 @@ function BrowserElementPrompt(win, browserElementChild) { } BrowserElementPrompt.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPrompt]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPrompt]), alert: function(title, text) { this._browserElementChild.showModalPrompt( @@ -212,7 +212,7 @@ function BrowserElementAuthPrompt() { } BrowserElementAuthPrompt.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIAuthPrompt2]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIAuthPrompt2]), promptAuth: function promptAuth(channel, level, authInfo) { throw Cr.NS_ERROR_NOT_IMPLEMENTED; @@ -242,7 +242,7 @@ BrowserElementAuthPrompt.prototype = { } let consumer = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICancelable]), callback: callback, context: context, cancel: function() { @@ -441,7 +441,7 @@ function AuthPromptWrapper(oldImpl, browserElementImpl) { } AuthPromptWrapper.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIAuthPrompt2]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIAuthPrompt2]), promptAuth: function(channel, level, authInfo) { if (this._canGetParentElement(channel)) { return this._browserElementImpl.promptAuth(channel, level, authInfo); @@ -483,7 +483,7 @@ function BrowserElementPromptFactory(toWrap) { BrowserElementPromptFactory.prototype = { classID: Components.ID("{24f3d0cf-e417-4b85-9017-c9ecf8bb1299}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPromptFactory]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPromptFactory]), _mayUseNativePrompt: function() { try { @@ -563,8 +563,8 @@ BrowserElementPromptFactory.prototype = { }; var BrowserElementPromptService = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference]), _initialized: false, diff --git a/dom/console/ConsoleAPIStorage.js b/dom/console/ConsoleAPIStorage.js index 7367a764bcbe..57e42afb6f08 100644 --- a/dom/console/ConsoleAPIStorage.js +++ b/dom/console/ConsoleAPIStorage.js @@ -44,8 +44,8 @@ function ConsoleAPIStorageService() { ConsoleAPIStorageService.prototype = { classID : CONSOLEAPISTORAGE_CID, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIConsoleAPIStorage, - Ci.nsIObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIConsoleAPIStorage, + Ci.nsIObserver]), classInfo: XPCOMUtils.generateCI({ classID: CONSOLEAPISTORAGE_CID, contractID: '@mozilla.org/consoleAPI-storage;1', diff --git a/dom/events/test/test_bug336682.js b/dom/events/test/test_bug336682.js index 1fb8c2199af7..fa2383fda3ae 100644 --- a/dom/events/test/test_bug336682.js +++ b/dom/events/test/test_bug336682.js @@ -16,23 +16,6 @@ function trace(text) { //document.getElementById("display").innerHTML += t; } -// window.ononline and window.onclick shouldn't work -// Right now, sets window.ononline (bug 380618) -// When these start passing, be sure to uncomment the code inside if(0) below. -todo(typeof window.ononline == "undefined", - "window.ononline should be undefined at this point"); -todo(typeof window.onoffline == "undefined", - "window.onoffline should be undefined at this point"); - -if (0) { - window.ononline = function() { - ok(false, "window.ononline shouldn't be called"); - } - window.onoffline = function() { - ok(false, "window.onclick shouldn't be called"); - } -} - /** * Returns a handler function for an online/offline event. The returned handler * ensures the passed event object has expected properties and that the handler @@ -55,11 +38,9 @@ function makeHandler(nameTemplate, eventName, expectedStates) { "gState=" + gState + ", expectedStates=" + expectedStates); ok(e.constructor == Event, "event should be an Event"); ok(e.type == eventName, "event type should be " + eventName); - ok(e.bubbles, "event should bubble"); + ok(!e.bubbles, "event should not bubble"); ok(!e.cancelable, "event should not be cancelable"); - ok(e.target == (document instanceof HTMLDocument - ? document.body : document.documentElement), - "the event target should be the body element"); + ok(e.target == window, "target should be the window"); } } diff --git a/dom/events/test/test_bug336682_1.html b/dom/events/test/test_bug336682_1.html index a5843c936f2f..9ef2ff30cdca 100644 --- a/dom/events/test/test_bug336682_1.html +++ b/dom/events/test/test_bug336682_1.html @@ -28,31 +28,21 @@ http://creativecommons.org/licenses/publicdomain/ function makeBodyHandler(eventName) { return function (aThis, aEvent) { - var handler = makeHandler("", eventName, [3,4]); + var handler = makeHandler("", eventName, [1]); handler(aEvent); } } addLoadEvent(function() { /** @see test_bug336682.js */ - MAX_STATE = 4; + MAX_STATE = 2; for (var event of ["online", "offline"]) { - document.body.addEventListener( - event, - makeHandler("document.body.addEventListener('%1', ..., false)", - event, [1])); - - document.addEventListener( - event, - makeHandler("document.addEventListener('%1', ..., false)", - event, [2])); - window["bodyOn" + event] = makeBodyHandler(event); window.addEventListener( event, makeHandler("window.addEventListener('%1', ..., false)", - event, [3,4])); + event, [2])); } doTest(); diff --git a/dom/events/test/test_bug336682_2.xul b/dom/events/test/test_bug336682_2.xul index 303348c2ec5a..0a66a8afaaba 100644 --- a/dom/events/test/test_bug336682_2.xul +++ b/dom/events/test/test_bug336682_2.xul @@ -29,34 +29,22 @@ Mozilla Bug 336682 (online/offline events) ", eventName, [3,4]); + var handler = makeHandler("", eventName, [1]); handler(aEvent); } } for (var event of ["online", "offline"]) { - document.documentElement.addEventListener( - event, - makeHandler("document.body.addEventListener('%1', ..., false)", - event, [1]), - false); - - document.addEventListener( - event, - makeHandler("document.addEventListener('%1', ..., false)", - event, [2]), - false); - window["windowOn" + event] = makeWindowHandler(event); window.addEventListener( event, makeHandler("window.addEventListener('%1', ..., false)", - event, [3,4]), + event, [2]), false); } diff --git a/dom/html/HTMLFormElement.cpp b/dom/html/HTMLFormElement.cpp index ed56f278448d..2874e596874b 100644 --- a/dom/html/HTMLFormElement.cpp +++ b/dom/html/HTMLFormElement.cpp @@ -784,7 +784,8 @@ HTMLFormElement::SubmitSubmission(HTMLFormSubmission* aFormSubmission) postDataStream, postDataStreamLength, nullptr, false, getter_AddRefs(docShell), - getter_AddRefs(mSubmittingRequest)); + getter_AddRefs(mSubmittingRequest), + EventStateManager::IsHandlingUserInput()); NS_ENSURE_SUBMIT_SUCCESS(rv); } diff --git a/dom/html/htmlMenuBuilder.js b/dom/html/htmlMenuBuilder.js index 3dc32cec3e47..a45023536866 100644 --- a/dom/html/htmlMenuBuilder.js +++ b/dom/html/htmlMenuBuilder.js @@ -30,7 +30,7 @@ function HTMLMenuBuilder() { HTMLMenuBuilder.prototype = { classID: Components.ID("{51c65f5d-0de5-4edc-9058-60e50cef77f8}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIMenuBuilder]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIMenuBuilder]), currentNode: null, root: null, diff --git a/dom/html/test/head.js b/dom/html/test/head.js index e25b98158d10..99c85539391f 100644 --- a/dom/html/test/head.js +++ b/dom/html/test/head.js @@ -38,8 +38,8 @@ function waitForDocLoadComplete(aBrowser=gBrowser) { resolve(); } }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener, - Ci.nsISupportsWeakReference]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener, + Ci.nsISupportsWeakReference]) }; aBrowser.addProgressListener(listener); waitForDocLoadComplete.listeners.add(listener); diff --git a/dom/indexedDB/test/unit/GlobalObjectsComponent.js b/dom/indexedDB/test/unit/GlobalObjectsComponent.js index 0d83aa81e8cd..e835edccabe9 100644 --- a/dom/indexedDB/test/unit/GlobalObjectsComponent.js +++ b/dom/indexedDB/test/unit/GlobalObjectsComponent.js @@ -14,7 +14,7 @@ GlobalObjectsComponent.prototype = { classID: Components.ID("{949ebf50-e0da-44b9-8335-cbfd4febfdcc}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]), + QueryInterface: ChromeUtils.generateQI([]), runTest() { const name = "Splendid Test"; diff --git a/dom/media/IdpSandbox.jsm b/dom/media/IdpSandbox.jsm index e0e3739c305a..61a9fb68f2b8 100644 --- a/dom/media/IdpSandbox.jsm +++ b/dom/media/IdpSandbox.jsm @@ -23,7 +23,7 @@ RedirectHttpsOnly.prototype = { getInterface(iid) { return this.QueryInterface(iid); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIChannelEventSink]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIChannelEventSink]) }; /** This class loads a resource into a single string. ResourceLoader.load() is @@ -77,7 +77,7 @@ ResourceLoader.prototype = { getInterface(iid) { return this.QueryInterface(iid); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIStreamListener]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIStreamListener]) }; /** diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js index 711253788964..694deaa78d26 100644 --- a/dom/media/PeerConnection.js +++ b/dom/media/PeerConnection.js @@ -203,8 +203,8 @@ class GlobalPCList { } } setupPrototype(GlobalPCList, { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference]), classID: PC_MANAGER_CID, _xpcom_factory: { createInstance(outer, iid) { @@ -230,8 +230,7 @@ class RTCIceCandidate { setupPrototype(RTCIceCandidate, { classID: PC_ICE_CID, contractID: PC_ICE_CONTRACT, - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, - Ci.nsIDOMGlobalPropertyInitializer]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer]) }); class RTCSessionDescription { @@ -275,8 +274,7 @@ class RTCSessionDescription { setupPrototype(RTCSessionDescription, { classID: PC_SESSION_CID, contractID: PC_SESSION_CONTRACT, - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, - Ci.nsIDOMGlobalPropertyInitializer]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer]) }); class RTCStatsReport { @@ -330,7 +328,7 @@ class RTCStatsReport { setupPrototype(RTCStatsReport, { classID: PC_STATS_CID, contractID: PC_STATS_CONTRACT, - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]), + QueryInterface: ChromeUtils.generateQI([]), _specToLegacyFieldMapping: { "inbound-rtp": "inboundrtp", "outbound-rtp": "outboundrtp", @@ -1607,8 +1605,7 @@ class RTCPeerConnection { setupPrototype(RTCPeerConnection, { classID: PC_CID, contractID: PC_CONTRACT, - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, - Ci.nsIDOMGlobalPropertyInitializer]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer]), _actions: { offer: Ci.IPeerConnection.kActionOffer, answer: Ci.IPeerConnection.kActionAnswer, @@ -1866,8 +1863,7 @@ class PeerConnectionObserver { setupPrototype(PeerConnectionObserver, { classID: PC_OBS_CID, contractID: PC_OBS_CONTRACT, - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, - Ci.nsIDOMGlobalPropertyInitializer]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer]) }); class RTCPeerConnectionStatic { @@ -1883,8 +1879,7 @@ class RTCPeerConnectionStatic { setupPrototype(RTCPeerConnectionStatic, { classID: PC_STATIC_CID, contractID: PC_STATIC_CONTRACT, - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, - Ci.nsIDOMGlobalPropertyInitializer]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer]) }); class RTCDTMFSender { @@ -1912,7 +1907,7 @@ class RTCDTMFSender { setupPrototype(RTCDTMFSender, { classID: PC_DTMF_SENDER_CID, contractID: PC_DTMF_SENDER_CONTRACT, - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]) + QueryInterface: ChromeUtils.generateQI([]) }); class RTCRtpSender { @@ -2054,7 +2049,7 @@ class RTCRtpSender { setupPrototype(RTCRtpSender, { classID: PC_SENDER_CID, contractID: PC_SENDER_CONTRACT, - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]) + QueryInterface: ChromeUtils.generateQI([]) }); class RTCRtpReceiver { @@ -2224,7 +2219,7 @@ class RTCRtpReceiver { setupPrototype(RTCRtpReceiver, { classID: PC_RECEIVER_CID, contractID: PC_RECEIVER_CONTRACT, - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]) + QueryInterface: ChromeUtils.generateQI([]) }); class RTCRtpTransceiver { @@ -2387,7 +2382,7 @@ class RTCRtpTransceiver { setupPrototype(RTCRtpTransceiver, { classID: PC_TRANSCEIVER_CID, contractID: PC_TRANSCEIVER_CONTRACT, - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]) + QueryInterface: ChromeUtils.generateQI([]) }); class CreateOfferRequest { @@ -2398,7 +2393,7 @@ class CreateOfferRequest { setupPrototype(CreateOfferRequest, { classID: PC_COREQUEST_CID, contractID: PC_COREQUEST_CONTRACT, - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]) + QueryInterface: ChromeUtils.generateQI([]) }); this.NSGetFactory = XPCOMUtils.generateNSGetFactory( diff --git a/dom/media/webvtt/WebVTTParserWrapper.js b/dom/media/webvtt/WebVTTParserWrapper.js index b2c5bb70da7e..5718f94eff79 100644 --- a/dom/media/webvtt/WebVTTParserWrapper.js +++ b/dom/media/webvtt/WebVTTParserWrapper.js @@ -59,7 +59,7 @@ WebVTTParserWrapper.prototype = classDescription: "Wrapper for the JS WebVTT implementation (vtt.js)", classID: Components.ID(WEBVTTPARSERWRAPPER_CID), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebVTTParserWrapper]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebVTTParserWrapper]), classInfo: XPCOMUtils.generateCI({ classID: WEBVTTPARSERWRAPPER_CID, contractID: WEBVTTPARSERWRAPPER_CONTRACTID, diff --git a/dom/notification/NotificationStorage.js b/dom/notification/NotificationStorage.js index 4ed315d35a8d..ab915f1862fd 100644 --- a/dom/notification/NotificationStorage.js +++ b/dom/notification/NotificationStorage.js @@ -256,7 +256,7 @@ NotificationStorage.prototype = { classID : Components.ID(NOTIFICATIONSTORAGE_CID), contractID : NOTIFICATIONSTORAGE_CONTRACTID, - QueryInterface: XPCOMUtils.generateQI([Ci.nsINotificationStorage]), + QueryInterface: ChromeUtils.generateQI([Ci.nsINotificationStorage]), }; diff --git a/dom/payments/test/BasiccardChromeScript.js b/dom/payments/test/BasiccardChromeScript.js index de5a0b3cfca6..0907f805fa93 100644 --- a/dom/payments/test/BasiccardChromeScript.js +++ b/dom/payments/test/BasiccardChromeScript.js @@ -74,7 +74,7 @@ const detailedResponseUI = { completePayment: completePaymentResponse, updatePayment: function(requestId) { }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPaymentUIService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPaymentUIService]), }; const simpleResponseUI = { @@ -102,7 +102,7 @@ const simpleResponseUI = { completePayment: completePaymentResponse, updatePayment: function(requestId) { }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPaymentUIService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPaymentUIService]), }; addMessageListener("set-detailed-ui-service", function() { diff --git a/dom/payments/test/CurrencyAmountValidationChromeScript.js b/dom/payments/test/CurrencyAmountValidationChromeScript.js index 48d60c9f2755..0cbf4e73318a 100644 --- a/dom/payments/test/CurrencyAmountValidationChromeScript.js +++ b/dom/payments/test/CurrencyAmountValidationChromeScript.js @@ -21,7 +21,7 @@ const InvalidDetailsUIService = { }, updatePayment: function(requestId) { }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPaymentUIService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPaymentUIService]), }; diff --git a/dom/payments/test/PMIValidationChromeScript.js b/dom/payments/test/PMIValidationChromeScript.js index 1db966093366..a374686ee515 100644 --- a/dom/payments/test/PMIValidationChromeScript.js +++ b/dom/payments/test/PMIValidationChromeScript.js @@ -39,7 +39,7 @@ const UIService = { ""); // payer phone paymentSrv.respondPayment(showResponse.QueryInterface(Ci.nsIPaymentActionResponse)); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPaymentUIService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPaymentUIService]), }; function emitTestFail(message) { diff --git a/dom/payments/test/RequestShippingChromeScript.js b/dom/payments/test/RequestShippingChromeScript.js index 68dc222d85d6..236c64658c77 100644 --- a/dom/payments/test/RequestShippingChromeScript.js +++ b/dom/payments/test/RequestShippingChromeScript.js @@ -71,7 +71,7 @@ const NormalUIService = { ""); // payer phone paymentSrv.respondPayment(showResponse.QueryInterface(Ci.nsIPaymentActionResponse)); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPaymentUIService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPaymentUIService]), }; addMessageListener("set-normal-ui-service", function() { diff --git a/dom/payments/test/ShippingOptionsChromeScript.js b/dom/payments/test/ShippingOptionsChromeScript.js index fb360a9187e3..0970369468f3 100644 --- a/dom/payments/test/ShippingOptionsChromeScript.js +++ b/dom/payments/test/ShippingOptionsChromeScript.js @@ -74,7 +74,7 @@ const TestingUIService = { paymentSrv.respondPayment(completeResponse.QueryInterface(Ci.nsIPaymentActionResponse)); }, updatePayment: updateRequest, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPaymentUIService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPaymentUIService]), }; paymentSrv.setTestingUIService(TestingUIService.QueryInterface(Ci.nsIPaymentUIService)); diff --git a/dom/payments/test/ShowPaymentChromeScript.js b/dom/payments/test/ShowPaymentChromeScript.js index cdbdd66a9c3d..b0669126cbed 100644 --- a/dom/payments/test/ShowPaymentChromeScript.js +++ b/dom/payments/test/ShowPaymentChromeScript.js @@ -150,7 +150,7 @@ const DummyUIService = { abortPayment: abortRequest, completePayment: completeRequest, updatePayment: updateRequest, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPaymentUIService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPaymentUIService]), }; paymentSrv.setTestingUIService(DummyUIService.QueryInterface(Ci.nsIPaymentUIService)); diff --git a/dom/performance/PerformanceTiming.h b/dom/performance/PerformanceTiming.h index f45bf1094fd1..a1ea918e1669 100644 --- a/dom/performance/PerformanceTiming.h +++ b/dom/performance/PerformanceTiming.h @@ -440,6 +440,20 @@ public: mPerformance->GetRandomTimelineSeed()); } + DOMTimeMilliSec TimeToDOMContentFlushed() const + { + if (!nsContentUtils::IsPerformanceTimingEnabled() || + nsContentUtils::ShouldResistFingerprinting()) { + return 0; + } + if (mPerformance->IsSystemPrincipal()) { + return GetDOMTiming()->GetTimeToDOMContentFlushed(); + } + return nsRFPService::ReduceTimePrecisionAsMSecs( + GetDOMTiming()->GetTimeToDOMContentFlushed(), + mPerformance->GetRandomTimelineSeed()); + } + PerformanceTimingData* Data() const { return mTimingData.get(); diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index e4fd3774cb7b..044d887594ca 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -485,7 +485,9 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, } rv = lh->OnLinkClick(content, uri, unitarget.get(), VoidString(), - aPostStream, -1, headersDataStream, true, triggeringPrincipal); + aPostStream, -1, headersDataStream, + /* isUserTriggered */ false, + /* isTrusted */ true, triggeringPrincipal); return rv; } diff --git a/dom/presentation/PresentationDataChannelSessionTransport.js b/dom/presentation/PresentationDataChannelSessionTransport.js index 7bfe7132866c..6fa7739fd26e 100644 --- a/dom/presentation/PresentationDataChannelSessionTransport.js +++ b/dom/presentation/PresentationDataChannelSessionTransport.js @@ -23,7 +23,7 @@ function PresentationDataChannelDescription(aDataChannelSDP) { } PresentationDataChannelDescription.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationChannelDescription]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationChannelDescription]), get type() { return Ci.nsIPresentationChannelDescription.TYPE_DATACHANNEL; }, @@ -46,9 +46,9 @@ function PresentationTransportBuilder() { PresentationTransportBuilder.prototype = { classID: PRESENTATIONTRANSPORTBUILDER_CID, contractID: PRESENTATIONTRANSPORTBUILDER_CONTRACTID, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransportBuilder, - Ci.nsIPresentationDataChannelSessionTransportBuilder, - Ci.nsITimerCallback]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationSessionTransportBuilder, + Ci.nsIPresentationDataChannelSessionTransportBuilder, + Ci.nsITimerCallback]), buildDataChannelTransport: function(aRole, aWindow, aListener) { if (!aRole || !aWindow || !aListener) { @@ -245,7 +245,7 @@ function PresentationTransport() { PresentationTransport.prototype = { classID: PRESENTATIONTRANSPORT_CID, contractID: PRESENTATIONTRANSPORT_CONTRACTID, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransport]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationSessionTransport]), init: function(aPeerConnection, aDataChannel, aWindow) { log("initWithDataChannel"); diff --git a/dom/presentation/PresentationNetworkHelper.js b/dom/presentation/PresentationNetworkHelper.js index 827e2c826064..068a582da890 100644 --- a/dom/presentation/PresentationNetworkHelper.js +++ b/dom/presentation/PresentationNetworkHelper.js @@ -14,7 +14,7 @@ function PresentationNetworkHelper() {} PresentationNetworkHelper.prototype = { classID: NETWORKHELPER_CID, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationNetworkHelper]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationNetworkHelper]), getWifiIPAddress: function(aListener) { EventDispatcher.instance.sendRequestForResult({type: "Wifi:GetIPAddress"}) diff --git a/dom/presentation/provider/AndroidCastDeviceProvider.js b/dom/presentation/provider/AndroidCastDeviceProvider.js index 68321ba458e4..a00949c19b7d 100644 --- a/dom/presentation/provider/AndroidCastDeviceProvider.js +++ b/dom/presentation/provider/AndroidCastDeviceProvider.js @@ -260,7 +260,7 @@ LocalControlChannel.prototype = { }, classID: Components.ID("{c9be9450-e5c7-4294-a287-376971b017fd}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannel]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlChannel]), }; function ChromecastRemoteDisplayDevice(aProvider, aId, aName, aRole) { @@ -349,10 +349,10 @@ ChromecastRemoteDisplayDevice.prototype = { } }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevice, - Ci.nsIPresentationLocalDevice, - Ci.nsISupportsWeakReference, - Ci.nsIObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDevice, + Ci.nsIPresentationLocalDevice, + Ci.nsISupportsWeakReference, + Ci.nsIObserver]), }; function AndroidCastDeviceProvider() { @@ -463,8 +463,8 @@ AndroidCastDeviceProvider.prototype = { }, classID: Components.ID("{7394f24c-dbc3-48c8-8a47-cd10169b7c6b}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsIPresentationDeviceProvider]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, + Ci.nsIPresentationDeviceProvider]), }; this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AndroidCastDeviceProvider]); diff --git a/dom/presentation/provider/PresentationControlService.js b/dom/presentation/provider/PresentationControlService.js index 9ede4f5ca8f0..b35feab31683 100644 --- a/dom/presentation/provider/PresentationControlService.js +++ b/dom/presentation/provider/PresentationControlService.js @@ -358,9 +358,9 @@ PresentationControlService.prototype = { }, classID: Components.ID("{f4079b8b-ede5-4b90-a112-5b415a931deb}"), - QueryInterface : XPCOMUtils.generateQI([Ci.nsIServerSocketListener, - Ci.nsIPresentationControlService, - Ci.nsIObserver]), + QueryInterface : ChromeUtils.generateQI([Ci.nsIServerSocketListener, + Ci.nsIPresentationControlService, + Ci.nsIObserver]), }; function ChannelDescription(aInit) { @@ -407,7 +407,7 @@ ChannelDescription.prototype = { }, classID: Components.ID("{82507aea-78a2-487e-904a-858a6c5bf4e1}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationChannelDescription]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationChannelDescription]), }; // Helper function: transfer nsIPresentationChannelDescription to json @@ -952,8 +952,8 @@ TCPControlChannel.prototype = { }, classID: Components.ID("{fefb8286-0bdc-488b-98bf-0c11b485c955}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannel, - Ci.nsIStreamListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlChannel, + Ci.nsIStreamListener]), }; this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PresentationControlService]); // jshint ignore:line diff --git a/dom/presentation/tests/mochitest/PresentationDeviceInfoChromeScript.js b/dom/presentation/tests/mochitest/PresentationDeviceInfoChromeScript.js index d2b333ff7321..c01d54a53c85 100644 --- a/dom/presentation/tests/mochitest/PresentationDeviceInfoChromeScript.js +++ b/dom/presentation/tests/mochitest/PresentationDeviceInfoChromeScript.js @@ -9,7 +9,7 @@ const manager = Cc['@mozilla.org/presentation-device/manager;1'] .getService(Ci.nsIPresentationDeviceManager); var testProvider = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDeviceProvider]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDeviceProvider]), forceDiscovery: function() { sendAsyncMessage('force-discovery'); }, @@ -17,7 +17,7 @@ var testProvider = { }; var testDevice = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevice]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDevice]), establishControlChannel: function() { return null; }, @@ -32,7 +32,7 @@ var testDevice = { }; var testDevice1 = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevice]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDevice]), id: 'dummyid', name: 'dummyName', type: 'dummyType', @@ -46,7 +46,7 @@ var testDevice1 = { }; var testDevice2 = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevice]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDevice]), id: 'dummyid', name: 'dummyName', type: 'dummyType', @@ -60,7 +60,7 @@ var testDevice2 = { }; var mockedDeviceWithoutSupportedURL = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevice]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDevice]), id: 'dummyid', name: 'dummyName', type: 'dummyType', @@ -74,7 +74,7 @@ var mockedDeviceWithoutSupportedURL = { }; var mockedDeviceSupportHttpsURL = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevice]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDevice]), id: 'dummyid', name: 'dummyName', type: 'dummyType', diff --git a/dom/presentation/tests/mochitest/PresentationSessionChromeScript.js b/dom/presentation/tests/mochitest/PresentationSessionChromeScript.js index 78eaa6987cef..8039ab6dd8e1 100644 --- a/dom/presentation/tests/mochitest/PresentationSessionChromeScript.js +++ b/dom/presentation/tests/mochitest/PresentationSessionChromeScript.js @@ -54,7 +54,7 @@ const addresses = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray); addresses.appendElement(address); const mockedChannelDescription = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationChannelDescription]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationChannelDescription]), get type() { if (Services.prefs.getBoolPref("dom.presentation.session_transport.data_channel.enable")) { return Ci.nsIPresentationChannelDescription.TYPE_DATACHANNEL; @@ -66,8 +66,8 @@ const mockedChannelDescription = { }; const mockedServerSocket = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIServerSocket, - Ci.nsIFactory]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIServerSocket, + Ci.nsIFactory]), createInstance: function(aOuter, aIID) { if (aOuter) { throw Cr.NS_ERROR_NO_AGGREGATION; @@ -99,11 +99,11 @@ const mockedServerSocket = { }; const mockedSocketTransport = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsISocketTransport]), + QueryInterface: ChromeUtils.generateQI([Ci.nsISocketTransport]), }; const mockedControlChannel = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannel]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlChannel]), set listener(listener) { this._listener = listener; }, @@ -177,7 +177,7 @@ const mockedControlChannel = { }; const mockedDevice = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevice]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDevice]), id: 'id', name: 'name', type: 'type', @@ -192,8 +192,8 @@ const mockedDevice = { }; const mockedDevicePrompt = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevicePrompt, - Ci.nsIFactory]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDevicePrompt, + Ci.nsIFactory]), createInstance: function(aOuter, aIID) { if (aOuter) { throw Cr.NS_ERROR_NO_AGGREGATION; @@ -219,12 +219,12 @@ const mockedDevicePrompt = { }; const mockedSessionTransport = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransport, - Ci.nsIPresentationSessionTransportBuilder, - Ci.nsIPresentationTCPSessionTransportBuilder, - Ci.nsIPresentationDataChannelSessionTransportBuilder, - Ci.nsIPresentationControlChannelListener, - Ci.nsIFactory]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationSessionTransport, + Ci.nsIPresentationSessionTransportBuilder, + Ci.nsIPresentationTCPSessionTransportBuilder, + Ci.nsIPresentationDataChannelSessionTransportBuilder, + Ci.nsIPresentationControlChannelListener, + Ci.nsIFactory]), createInstance: function(aOuter, aIID) { if (aOuter) { throw Cr.NS_ERROR_NO_AGGREGATION; @@ -257,7 +257,7 @@ const mockedSessionTransport = { var addresses = description.QueryInterface(Ci.nsIPresentationChannelDescription).tcpAddress; this._selfAddress = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsINetAddr]), + QueryInterface: ChromeUtils.generateQI([Ci.nsINetAddr]), address: (addresses.length > 0) ? addresses.queryElementAt(0, Ci.nsISupportsCString).data : "", port: description.QueryInterface(Ci.nsIPresentationChannelDescription).tcpPort, @@ -308,7 +308,7 @@ const mockedSessionTransport = { }; const mockedNetworkInfo = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkInfo]), + QueryInterface: ChromeUtils.generateQI([Ci.nsINetworkInfo]), getAddresses: function(ips, prefixLengths) { ips.value = ["127.0.0.1"]; prefixLengths.value = [0]; @@ -317,8 +317,8 @@ const mockedNetworkInfo = { }; const mockedNetworkManager = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkManager, - Ci.nsIFactory]), + QueryInterface: ChromeUtils.generateQI([Ci.nsINetworkManager, + Ci.nsIFactory]), createInstance: function(aOuter, aIID) { if (aOuter) { throw Cr.NS_ERROR_NO_AGGREGATION; @@ -333,8 +333,8 @@ const mockedNetworkManager = { var requestPromise = null; const mockedRequestUIGlue = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationRequestUIGlue, - Ci.nsIFactory]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationRequestUIGlue, + Ci.nsIFactory]), createInstance: function(aOuter, aIID) { if (aOuter) { throw Cr.NS_ERROR_NO_AGGREGATION; diff --git a/dom/presentation/tests/mochitest/PresentationSessionChromeScript1UA.js b/dom/presentation/tests/mochitest/PresentationSessionChromeScript1UA.js index b7cc2072292e..cf125cfccc47 100644 --- a/dom/presentation/tests/mochitest/PresentationSessionChromeScript1UA.js +++ b/dom/presentation/tests/mochitest/PresentationSessionChromeScript1UA.js @@ -23,7 +23,7 @@ var triggerControlChannelError = false; // For simulating error during control c // control channel of sender const mockControlChannelOfSender = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannel]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlChannel]), set listener(listener) { // PresentationControllingInfo::SetControlChannel if (listener) { @@ -93,7 +93,7 @@ const mockControlChannelOfSender = { // control channel of receiver const mockControlChannelOfReceiver = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannel]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlChannel]), set listener(listener) { // PresentationPresentingInfo::SetControlChannel if (listener) { @@ -158,7 +158,7 @@ const mockControlChannelOfReceiver = { }; const mockDevice = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevice]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDevice]), id: 'id', name: 'name', type: 'type', @@ -178,8 +178,8 @@ const mockDevice = { }; const mockDevicePrompt = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevicePrompt, - Ci.nsIFactory]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDevicePrompt, + Ci.nsIFactory]), createInstance: function(aOuter, aIID) { if (aOuter) { throw Cr.NS_ERROR_NO_AGGREGATION; @@ -205,8 +205,8 @@ const mockDevicePrompt = { }; const mockRequestUIGlue = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationRequestUIGlue, - Ci.nsIFactory]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationRequestUIGlue, + Ci.nsIFactory]), set promise(aPromise) { this._promise = aPromise }, diff --git a/dom/presentation/tests/mochitest/test_presentation_datachannel_sessiontransport.html b/dom/presentation/tests/mochitest/test_presentation_datachannel_sessiontransport.html index a9885e5e64f9..afc6fc6e3462 100644 --- a/dom/presentation/tests/mochitest/test_presentation_datachannel_sessiontransport.html +++ b/dom/presentation/tests/mochitest/test_presentation_datachannel_sessiontransport.html @@ -42,7 +42,7 @@ var gResolve; var gReject; const clientCallback = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransportCallback]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationSessionTransportCallback]), notifyTransportReady: function () { info("Client transport ready."); @@ -66,7 +66,7 @@ const clientCallback = { }; const serverCallback = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransportCallback]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationSessionTransportCallback]), notifyTransportReady: function () { info("Server transport ready."); @@ -90,7 +90,7 @@ const serverCallback = { }; const clientListener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransportBuilderListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationSessionTransportBuilderListener]), onSessionTransport: function(aTransport) { info("Client Transport is built."); clientTransport = aTransport; @@ -121,7 +121,7 @@ const clientListener = { } const serverListener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransportBuilderListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationSessionTransportBuilderListener]), onSessionTransport: function(aTransport) { info("Server Transport is built."); serverTransport = aTransport; diff --git a/dom/presentation/tests/xpcshell/test_multicast_dns_device_provider.js b/dom/presentation/tests/xpcshell/test_multicast_dns_device_provider.js index ff47d0d9fd95..34803e57d1f8 100644 --- a/dom/presentation/tests/xpcshell/test_multicast_dns_device_provider.js +++ b/dom/presentation/tests/xpcshell/test_multicast_dns_device_provider.js @@ -64,7 +64,7 @@ MockFactory.prototype = { lockFactory: function(aLock) { throw Cr.NS_ERROR_NOT_IMPLEMENTED; }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory]) }; function ContractHook(aContractID, aClass) { @@ -132,7 +132,7 @@ ContractHook.prototype = { function MockDNSServiceInfo() {} MockDNSServiceInfo.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceInfo]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceInfo]), set host(aHost) { this._host = aHost; @@ -195,8 +195,8 @@ function TestPresentationDeviceListener() { this.devices = {}; } TestPresentationDeviceListener.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDeviceListener, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDeviceListener, + Ci.nsISupportsWeakReference]), addDevice: function(device) { this.devices[device.id] = device; }, removeDevice: function(device) { delete this.devices[device.id]; }, @@ -232,13 +232,13 @@ function registerService() { let deferred = Promise.defer(); let mockObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceDiscovery]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceDiscovery]), startDiscovery: function(serviceType, listener) {}, registerService: function(serviceInfo, listener) { deferred.resolve(); this.serviceRegistered++; return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICancelable]), cancel: () => { this.serviceUnregistered++; } @@ -256,8 +256,8 @@ function registerService() { // Register provider.listener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDeviceListener, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDeviceListener, + Ci.nsISupportsWeakReference]), addDevice: function(device) {}, removeDevice: function(device) {}, updateDevice: function(device) {}, @@ -282,7 +282,7 @@ function noRegisterService() { let deferred = Promise.defer(); let mockObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceDiscovery]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceDiscovery]), startDiscovery: function(serviceType, listener) {}, registerService: function(serviceInfo, listener) { deferred.resolve(); @@ -296,8 +296,8 @@ function noRegisterService() { // Try register provider.listener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDeviceListener, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDeviceListener, + Ci.nsISupportsWeakReference]), addDevice: function(device) {}, removeDevice: function(device) {}, updateDevice: function(device) {}, @@ -321,13 +321,13 @@ function registerServiceDynamically() { let deferred = Promise.defer(); let mockObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceDiscovery]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceDiscovery]), startDiscovery: function(serviceType, listener) {}, registerService: function(serviceInfo, listener) { deferred.resolve(); this.serviceRegistered++; return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICancelable]), cancel: () => { this.serviceUnregistered++; } @@ -345,8 +345,8 @@ function registerServiceDynamically() { // Try Register provider.listener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDeviceListener, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDeviceListener, + Ci.nsISupportsWeakReference]), addDevice: function(device) {}, removeDevice: function(device) {}, updateDevice: function(device) {}, @@ -384,7 +384,7 @@ function addDevice() { "service.name", SERVICE_TYPE); let mockObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceDiscovery]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceDiscovery]), startDiscovery: function(serviceType, listener) { listener.onDiscoveryStarted(serviceType); listener.onServiceFound(createDevice("", @@ -392,7 +392,7 @@ function addDevice() { mockDevice.serviceName, mockDevice.serviceType)); return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICancelable]), cancel: function() {} }; }, @@ -434,7 +434,7 @@ function filterDevice() { "service.name", SERVICE_TYPE); let mockObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceDiscovery]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceDiscovery]), startDiscovery: function(serviceType, listener) { listener.onDiscoveryStarted(serviceType); listener.onServiceFound(createDevice("", @@ -442,7 +442,7 @@ function filterDevice() { mockDevice.serviceName, mockDevice.serviceType)); return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICancelable]), cancel: function() {} }; }, @@ -460,8 +460,8 @@ function filterDevice() { let contractHook = new ContractHook(SD_CONTRACT_ID, mockObj); let provider = Cc[PROVIDER_CONTRACT_ID].createInstance(Ci.nsIPresentationDeviceProvider); let listener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDeviceListener, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDeviceListener, + Ci.nsISupportsWeakReference]), addDevice: function(device) { let tests = [ { requestedUrl: "app://fling-player.gaiamobile.org/index.html", supported: true }, @@ -504,7 +504,7 @@ function handleSessionRequest() { "service.name", SERVICE_TYPE); let mockSDObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceDiscovery]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceDiscovery]), startDiscovery: function(serviceType, listener) { listener.onDiscoveryStarted(serviceType); listener.onServiceFound(createDevice("", @@ -512,7 +512,7 @@ function handleSessionRequest() { mockDevice.serviceName, mockDevice.serviceType)); return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICancelable]), cancel: function() {} }; }, @@ -526,13 +526,13 @@ function handleSessionRequest() { }; let mockServerObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlService]), connect: function(deviceInfo) { this.request = { deviceInfo: deviceInfo, }; return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannel]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlChannel]), }; }, id: "", @@ -546,8 +546,8 @@ function handleSessionRequest() { let contractHookServer = new ContractHook(SERVER_CONTRACT_ID, mockServerObj); let provider = Cc[PROVIDER_CONTRACT_ID].createInstance(Ci.nsIPresentationDeviceProvider); let listener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDeviceListener, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDeviceListener, + Ci.nsISupportsWeakReference]), addDevice: function(device) { this.device = device; }, @@ -576,7 +576,7 @@ function handleOnSessionRequest() { "service.name", SERVICE_TYPE); let mockSDObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceDiscovery]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceDiscovery]), startDiscovery: function(serviceType, listener) { listener.onDiscoveryStarted(serviceType); listener.onServiceFound(createDevice("", @@ -584,7 +584,7 @@ function handleOnSessionRequest() { mockDevice.serviceName, mockDevice.serviceType)); return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICancelable]), cancel: function() {} }; }, @@ -598,7 +598,7 @@ function handleOnSessionRequest() { }; let mockServerObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlService]), startServer: function() {}, sessionRequest: function() {}, close: function() {}, @@ -612,8 +612,8 @@ function handleOnSessionRequest() { let contractHookServer = new ContractHook(SERVER_CONTRACT_ID, mockServerObj); let provider = Cc[PROVIDER_CONTRACT_ID].createInstance(Ci.nsIPresentationDeviceProvider); let listener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDeviceListener, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDeviceListener, + Ci.nsISupportsWeakReference]), addDevice: function(device) {}, removeDevice: function(device) {}, updateDevice: function(device) {}, @@ -630,7 +630,7 @@ function handleOnSessionRequest() { provider.listener = listener; const deviceInfo = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsITCPDeviceInfo]), + QueryInterface: ChromeUtils.generateQI([Ci.nsITCPDeviceInfo]), id: mockDevice.host, address: mockDevice.host, port: 54321, @@ -639,7 +639,7 @@ function handleOnSessionRequest() { const testUrl = "http://example.com"; const testPresentationId = "test-presentation-id"; const testControlChannel = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannel]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlChannel]), }; provider.QueryInterface(Ci.nsIPresentationControlServerListener) .onSessionRequest(deviceInfo, testUrl, testPresentationId, testControlChannel); @@ -658,14 +658,14 @@ function handleOnSessionRequestFromUnknownDevice() { Services.prefs.setBoolPref(PREF_DISCOVERABLE, true); let mockSDObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceDiscovery]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceDiscovery]), startDiscovery: function(serviceType, listener) {}, registerService: function(serviceInfo, listener) {}, resolveService: function(serviceInfo, listener) {} }; let mockServerObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlService]), startServer: function() {}, sessionRequest: function() {}, close: function() {}, @@ -679,8 +679,8 @@ function handleOnSessionRequestFromUnknownDevice() { let contractHookServer = new ContractHook(SERVER_CONTRACT_ID, mockServerObj); let provider = Cc[PROVIDER_CONTRACT_ID].createInstance(Ci.nsIPresentationDeviceProvider); let listener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDeviceListener, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDeviceListener, + Ci.nsISupportsWeakReference]), addDevice: function(device) { Assert.ok(false, "shouldn't create any new device"); }, @@ -703,7 +703,7 @@ function handleOnSessionRequestFromUnknownDevice() { provider.listener = listener; const deviceInfo = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsITCPDeviceInfo]), + QueryInterface: ChromeUtils.generateQI([Ci.nsITCPDeviceInfo]), id: "unknown-device.local", address: "unknown-device.local", port: 12345, @@ -712,7 +712,7 @@ function handleOnSessionRequestFromUnknownDevice() { const testUrl = "http://example.com"; const testPresentationId = "test-presentation-id"; const testControlChannel = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannel]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlChannel]), }; provider.QueryInterface(Ci.nsIPresentationControlServerListener) .onSessionRequest(deviceInfo, testUrl, testPresentationId, testControlChannel); @@ -731,7 +731,7 @@ function noAddDevice() { let mockDevice = createDevice("device.local", 12345, "service.name", SERVICE_TYPE); let mockObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceDiscovery]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceDiscovery]), startDiscovery: function(serviceType, listener) { Assert.ok(false, "shouldn't perform any device discovery"); }, @@ -743,8 +743,8 @@ function noAddDevice() { let provider = Cc[PROVIDER_CONTRACT_ID].createInstance(Ci.nsIPresentationDeviceProvider); let listener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDeviceListener, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDeviceListener, + Ci.nsISupportsWeakReference]), addDevice: function(device) {}, removeDevice: function(device) {}, updateDevice: function(device) {}, @@ -768,7 +768,7 @@ function ignoreIncompatibleDevice() { let deferred = Promise.defer(); let mockSDObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceDiscovery]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceDiscovery]), startDiscovery: function(serviceType, listener) { listener.onDiscoveryStarted(serviceType); listener.onServiceFound(createDevice("", @@ -776,7 +776,7 @@ function ignoreIncompatibleDevice() { mockDevice.serviceName, mockDevice.serviceType)); return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICancelable]), cancel: function() {} }; }, @@ -787,7 +787,7 @@ function ignoreIncompatibleDevice() { mockDevice.serviceName, mockDevice.serviceType)); return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICancelable]), cancel: function() {} }; }, @@ -802,7 +802,7 @@ function ignoreIncompatibleDevice() { }; let mockServerObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlService]), startServer: function() { Services.tm.dispatchToMainThread(() => { this.listener.onServerReady(this.port, this.certFingerprint); @@ -853,7 +853,7 @@ function ignoreSelfDevice() { let deferred = Promise.defer(); let mockSDObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceDiscovery]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceDiscovery]), startDiscovery: function(serviceType, listener) { listener.onDiscoveryStarted(serviceType); listener.onServiceFound(createDevice("", @@ -861,7 +861,7 @@ function ignoreSelfDevice() { mockDevice.serviceName, mockDevice.serviceType)); return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICancelable]), cancel: function() {} }; }, @@ -872,7 +872,7 @@ function ignoreSelfDevice() { mockDevice.serviceName, mockDevice.serviceType)); return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICancelable]), cancel: function() {} }; }, @@ -887,7 +887,7 @@ function ignoreSelfDevice() { }; let mockServerObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlService]), startServer: function() { Services.tm.dispatchToMainThread(() => { this.listener.onServerReady(this.port, this.certFingerprint); @@ -934,7 +934,7 @@ function addDeviceDynamically() { "service.name", SERVICE_TYPE); let mockObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceDiscovery]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceDiscovery]), startDiscovery: function(serviceType, listener) { listener.onDiscoveryStarted(serviceType); listener.onServiceFound(createDevice("", @@ -942,7 +942,7 @@ function addDeviceDynamically() { mockDevice.serviceName, mockDevice.serviceType)); return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICancelable]), cancel: function() {} }; }, @@ -991,7 +991,7 @@ function updateDevice() { let mockObj = { discovered: false, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceDiscovery]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceDiscovery]), startDiscovery: function(serviceType, listener) { listener.onDiscoveryStarted(serviceType); @@ -1003,7 +1003,7 @@ function updateDevice() { this.discovered = true; return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICancelable]), cancel: function() { listener.onDiscoveryStopped(serviceType); } @@ -1025,8 +1025,8 @@ function updateDevice() { let contractHook = new ContractHook(SD_CONTRACT_ID, mockObj); let provider = Cc[PROVIDER_CONTRACT_ID].createInstance(Ci.nsIPresentationDeviceProvider); let listener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDeviceListener, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDeviceListener, + Ci.nsISupportsWeakReference]), addDevice: function(device) { Assert.ok(!this.isDeviceAdded); @@ -1078,7 +1078,7 @@ function diffDiscovery() { let mockObj = { discovered: false, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceDiscovery]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceDiscovery]), startDiscovery: function(serviceType, listener) { listener.onDiscoveryStarted(serviceType); @@ -1092,7 +1092,7 @@ function diffDiscovery() { this.discovered = true; return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICancelable]), cancel: function() { listener.onDiscoveryStopped(serviceType); } @@ -1160,7 +1160,7 @@ function serverClosed() { SERVICE_TYPE); let mockObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceDiscovery]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceDiscovery]), startDiscovery: function(serviceType, listener) { listener.onDiscoveryStarted(serviceType); listener.onServiceFound(createDevice("", @@ -1168,14 +1168,14 @@ function serverClosed() { mockDevice.serviceName, mockDevice.serviceType)); return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICancelable]), cancel: function() {} }; }, registerService: function(serviceInfo, listener) { this.serviceRegistered++; return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]), + QueryInterface: ChromeUtils.generateQI([Ci.nsICancelable]), cancel: () => { this.serviceUnregistered++; } @@ -1200,8 +1200,8 @@ function serverClosed() { // Register let listener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDeviceListener, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDeviceListener, + Ci.nsISupportsWeakReference]), addDevice: function(device) { this.devices.push(device); }, removeDevice: function(device) {}, updateDevice: function(device) {}, @@ -1238,7 +1238,7 @@ function serverRetry() { let isRetrying = false; let mockSDObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDNSServiceDiscovery]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIDNSServiceDiscovery]), startDiscovery: function(serviceType, listener) {}, registerService: function(serviceInfo, listener) { Assert.ok(isRetrying, "register service after retrying startServer"); @@ -1249,7 +1249,7 @@ function serverRetry() { }; let mockServerObj = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlService]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlService]), startServer: function(encrypted, port) { if (!isRetrying) { isRetrying = true; @@ -1276,8 +1276,8 @@ function serverRetry() { let contractHookServer = new ContractHook(SERVER_CONTRACT_ID, mockServerObj); let provider = Cc[PROVIDER_CONTRACT_ID].createInstance(Ci.nsIPresentationDeviceProvider); let listener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDeviceListener, - Ci.nsISupportsWeakReference]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDeviceListener, + Ci.nsISupportsWeakReference]), addDevice: function(device) {}, removeDevice: function(device) {}, updateDevice: function(device) {}, diff --git a/dom/presentation/tests/xpcshell/test_presentation_device_manager.js b/dom/presentation/tests/xpcshell/test_presentation_device_manager.js index 5249c4bbdba9..e9a054b00ed6 100644 --- a/dom/presentation/tests/xpcshell/test_presentation_device_manager.js +++ b/dom/presentation/tests/xpcshell/test_presentation_device_manager.js @@ -16,7 +16,7 @@ function TestPresentationDevice() {} function TestPresentationControlChannel() {} TestPresentationControlChannel.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannel]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlChannel]), sendOffer: function(offer) {}, sendAnswer: function(answer) {}, disconnect: function() {}, @@ -28,7 +28,7 @@ TestPresentationControlChannel.prototype = { }; var testProvider = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDeviceProvider]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDeviceProvider]), forceDiscovery: function() { }, @@ -40,7 +40,7 @@ var testProvider = { const forbiddenRequestedUrl = 'http://example.com'; var testDevice = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationDevice]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationDevice]), id: 'id', name: 'name', type: 'type', diff --git a/dom/presentation/tests/xpcshell/test_presentation_session_transport.js b/dom/presentation/tests/xpcshell/test_presentation_session_transport.js index 1e97e369ca5f..55d0737b9ac3 100644 --- a/dom/presentation/tests/xpcshell/test_presentation_session_transport.js +++ b/dom/presentation/tests/xpcshell/test_presentation_session_transport.js @@ -29,7 +29,7 @@ const addresses = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray); addresses.appendElement(address); const serverChannelDescription = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationChannelDescription]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationChannelDescription]), type: 1, tcpAddress: addresses, }; @@ -40,7 +40,7 @@ var isClientClosed = false; var isServerClosed = false; const clientCallback = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransportCallback]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationSessionTransportCallback]), notifyTransportReady: function () { Assert.ok(true, "Client transport ready."); @@ -64,7 +64,7 @@ const clientCallback = { }; const serverCallback = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransportCallback]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationSessionTransportCallback]), notifyTransportReady: function () { Assert.ok(true, "Server transport ready."); @@ -88,7 +88,7 @@ const serverCallback = { }; const clientListener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransportBuilderListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationSessionTransportBuilderListener]), onSessionTransport(aTransport) { Assert.ok(true, "Client Transport is built."); clientTransport = aTransport; @@ -101,7 +101,7 @@ const clientListener = { } const serverListener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransportBuilderListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationSessionTransportBuilderListener]), onSessionTransport(aTransport) { Assert.ok(true, "Server Transport is built."); serverTransport = aTransport; diff --git a/dom/presentation/tests/xpcshell/test_tcp_control_channel.js b/dom/presentation/tests/xpcshell/test_tcp_control_channel.js index 4f540527cecf..ed90f1c4573b 100644 --- a/dom/presentation/tests/xpcshell/test_tcp_control_channel.js +++ b/dom/presentation/tests/xpcshell/test_tcp_control_channel.js @@ -36,7 +36,7 @@ function TestDescription(aType, aTcpAddress, aTcpPort) { } TestDescription.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationChannelDescription]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationChannelDescription]), } const CONTROLLER_CONTROL_CHANNEL_PORT = 36777; @@ -126,7 +126,7 @@ function testPresentationServer() { this.status = 'closed'; yayFuncs.controllerControlChannelClose(); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannelListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlChannelListener]), }; }, onReconnectRequest: function(deviceInfo, url, presentationId, controlChannel) { @@ -135,7 +135,7 @@ function testPresentationServer() { yayFuncs.presenterControlChannelReconnect(); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlServerListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlServerListener]), }; let presenterDeviceInfo = { @@ -143,7 +143,7 @@ function testPresentationServer() { address: '127.0.0.1', port: PRESENTER_CONTROL_CHANNEL_PORT, certFingerprint: pcs.certFingerprint, - QueryInterface: XPCOMUtils.generateQI([Ci.nsITCPDeviceInfo]), + QueryInterface: ChromeUtils.generateQI([Ci.nsITCPDeviceInfo]), }; let controllerControlChannel = pcs.connect(presenterDeviceInfo); @@ -196,10 +196,10 @@ function testPresentationServer() { notifyReconnected: function() { yayFuncs.controllerControlChannelReconnect(); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannelListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlChannelListener]), }; }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannelListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlChannelListener]), }; } @@ -236,7 +236,7 @@ function terminateRequest() { Assert.equal(aReason, CLOSE_CONTROL_CHANNEL_REASON, 'controllerControlChannel notify disconncted'); yayFuncs.controllerControlChannelDisconnected(); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannelListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlChannelListener]), }; } else { Assert.equal(deviceInfo.id, presenterDeviceInfo.id, 'expected presenter device id'); @@ -245,7 +245,7 @@ function terminateRequest() { presenterControlChannel.disconnect(CLOSE_CONTROL_CHANNEL_REASON); } }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsITCPPresentationServerListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsITCPPresentationServerListener]), }; let presenterDeviceInfo = { @@ -253,7 +253,7 @@ function terminateRequest() { address: '127.0.0.1', port: PRESENTER_CONTROL_CHANNEL_PORT, certFingerprint: pcs.certFingerprint, - QueryInterface: XPCOMUtils.generateQI([Ci.nsITCPDeviceInfo]), + QueryInterface: ChromeUtils.generateQI([Ci.nsITCPDeviceInfo]), }; let presenterControlChannel = pcs.connect(presenterDeviceInfo); @@ -266,7 +266,7 @@ function terminateRequest() { Assert.equal(aReason, CLOSE_CONTROL_CHANNEL_REASON, '4. presenterControlChannel notify disconnected'); yayFuncs.presenterControlChannelDisconnected(); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannelListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlChannelListener]), }; } @@ -295,10 +295,10 @@ function terminateRequestAbnormal() { Assert.equal(aReason, Cr.NS_ERROR_FAILURE, 'controllerControlChannel notify disconncted with error'); yayFuncs.controllerControlChannelDisconnected(); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannelListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlChannelListener]), }; }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsITCPPresentationServerListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsITCPPresentationServerListener]), }; let presenterDeviceInfo = { @@ -306,7 +306,7 @@ function terminateRequestAbnormal() { address: '127.0.0.1', port: PRESENTER_CONTROL_CHANNEL_PORT, certFingerprint: pcs.certFingerprint, - QueryInterface: XPCOMUtils.generateQI([Ci.nsITCPDeviceInfo]), + QueryInterface: ChromeUtils.generateQI([Ci.nsITCPDeviceInfo]), }; let presenterControlChannel = pcs.connect(presenterDeviceInfo); @@ -319,7 +319,7 @@ function terminateRequestAbnormal() { Assert.equal(aReason, Cr.NS_ERROR_FAILURE, '4. presenterControlChannel notify disconnected with error'); yayFuncs.presenterControlChannelDisconnected(); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlChannelListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationControlChannelListener]), }; } diff --git a/dom/push/Push.js b/dom/push/Push.js index c985273e8eba..0eb64ba68259 100644 --- a/dom/push/Push.js +++ b/dom/push/Push.js @@ -37,9 +37,9 @@ Push.prototype = { classID : PUSH_CID, - QueryInterface : XPCOMUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer, - Ci.nsISupportsWeakReference, - Ci.nsIObserver]), + QueryInterface : ChromeUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer, + Ci.nsISupportsWeakReference, + Ci.nsIObserver]), init: function(win) { console.debug("init()"); @@ -182,7 +182,7 @@ Push.prototype = { type: "desktop-notification", access: null, options: [], - QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionType]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIContentPermissionType]), }; let typeArray = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray); typeArray.appendElement(type); @@ -191,7 +191,7 @@ Push.prototype = { let request = { types: typeArray, principal: this._principal, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionRequest]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIContentPermissionRequest]), allow: allowCallback, cancel: cancelCallback, window: this._window, @@ -212,7 +212,7 @@ function PushSubscriptionCallback(pushManager, resolve, reject) { } PushSubscriptionCallback.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPushSubscriptionCallback]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPushSubscriptionCallback]), onPushSubscription: function(ok, subscription) { let {pushManager} = this; diff --git a/dom/push/PushComponents.js b/dom/push/PushComponents.js index 61707528d92e..8738b832a244 100644 --- a/dom/push/PushComponents.js +++ b/dom/push/PushComponents.js @@ -49,7 +49,7 @@ function PushServiceBase() { PushServiceBase.prototype = { classID: Components.ID("{daaa8d73-677e-4233-8acd-2c404bd01658}"), contractID: "@mozilla.org/push/Service;1", - QueryInterface: XPCOMUtils.generateQI([ + QueryInterface: ChromeUtils.generateQI([ Ci.nsIObserver, Ci.nsISupportsWeakReference, Ci.nsIPushService, @@ -459,7 +459,7 @@ function PushSubscription(props) { } PushSubscription.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPushSubscription]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPushSubscription]), /** The URL for sending messages to this subscription. */ get endpoint() { diff --git a/dom/push/PushServiceHttp2.jsm b/dom/push/PushServiceHttp2.jsm index 2997426292c6..66c6e09e87cf 100644 --- a/dom/push/PushServiceHttp2.jsm +++ b/dom/push/PushServiceHttp2.jsm @@ -50,13 +50,8 @@ var PushSubscriptionListener = function(pushService, uri) { PushSubscriptionListener.prototype = { - QueryInterface: function (aIID) { - if (aIID.equals(Ci.nsIHttpPushListener) || - aIID.equals(Ci.nsIStreamListener)) { - return this; - } - throw Cr.NS_ERROR_NO_INTERFACE; - }, + QueryInterface: ChromeUtils.generateQI(["nsIHttpPushListener", + "nsIStreamListener"]), getInterface: function(aIID) { return this.QueryInterface(aIID); diff --git a/dom/push/test/mockpushserviceparent.js b/dom/push/test/mockpushserviceparent.js index a1c90b452ff4..baf2a24caee4 100644 --- a/dom/push/test/mockpushserviceparent.js +++ b/dom/push/test/mockpushserviceparent.js @@ -30,10 +30,7 @@ MockWebSocketParent.prototype = { _listener: null, _context: null, - QueryInterface: XPCOMUtils.generateQI([ - Ci.nsISupports, - Ci.nsIWebSocketChannel - ]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebSocketChannel]), get originalURI() { return this._originalURI; diff --git a/dom/push/test/xpcshell/PushServiceHandler.js b/dom/push/test/xpcshell/PushServiceHandler.js index 1464014b4ecb..8c23becc529d 100644 --- a/dom/push/test/xpcshell/PushServiceHandler.js +++ b/dom/push/test/xpcshell/PushServiceHandler.js @@ -19,7 +19,7 @@ function PushServiceHandler() { PushServiceHandler.prototype = { classID: Components.ID("{bb7c5199-c0f7-4976-9f6d-1306e32c5591}"), - QueryInterface: XPCOMUtils.generateQI([]), + QueryInterface: ChromeUtils.generateQI([]), observe(subject, topic, data) { this.observed.push({ subject, topic, data }); diff --git a/dom/push/test/xpcshell/head.js b/dom/push/test/xpcshell/head.js index 856719317ee8..56a08effcf87 100644 --- a/dom/push/test/xpcshell/head.js +++ b/dom/push/test/xpcshell/head.js @@ -198,10 +198,7 @@ MockWebSocket.prototype = { _listener: null, _context: null, - QueryInterface: XPCOMUtils.generateQI([ - Ci.nsISupports, - Ci.nsIWebSocketChannel - ]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebSocketChannel]), get originalURI() { return this._originalURI; diff --git a/dom/push/test/xpcshell/test_permissions.js b/dom/push/test/xpcshell/test_permissions.js index 8a6093f61760..711a93772d88 100644 --- a/dom/push/test/xpcshell/test_permissions.js +++ b/dom/push/test/xpcshell/test_permissions.js @@ -29,7 +29,7 @@ function promiseUnregister(keyID) { function makePushPermission(url, capability) { return { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIPermission]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIPermission]), capability: Ci.nsIPermissionManager[capability], expireTime: 0, expireType: Ci.nsIPermissionManager.EXPIRE_NEVER, diff --git a/dom/system/NetworkGeolocationProvider.js b/dom/system/NetworkGeolocationProvider.js index f109a35be180..bfa5a2aad851 100644 --- a/dom/system/NetworkGeolocationProvider.js +++ b/dom/system/NetworkGeolocationProvider.js @@ -211,7 +211,7 @@ function WifiGeoCoordsObject(lat, lon, acc, alt, altacc) { } WifiGeoCoordsObject.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPositionCoords]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGeoPositionCoords]) }; function WifiGeoPositionObject(lat, lng, acc) { @@ -221,7 +221,7 @@ function WifiGeoPositionObject(lat, lng, acc) { } WifiGeoPositionObject.prototype = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPosition]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGeoPosition]) }; function WifiGeoPositionProvider() { @@ -244,10 +244,10 @@ function WifiGeoPositionProvider() { WifiGeoPositionProvider.prototype = { classID: Components.ID("{77DA64D3-7458-4920-9491-86CC9914F904}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIGeolocationProvider, - Ci.nsIWifiListener, - Ci.nsITimerCallback, - Ci.nsIObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIGeolocationProvider, + Ci.nsIWifiListener, + Ci.nsITimerCallback, + Ci.nsIObserver]), listener: null, resetTimer: function() { diff --git a/dom/tests/browser/browser_ConsoleAPI_originAttributes.js b/dom/tests/browser/browser_ConsoleAPI_originAttributes.js index 0b464f0383ca..934796a3eca9 100644 --- a/dom/tests/browser/browser_ConsoleAPI_originAttributes.js +++ b/dom/tests/browser/browser_ConsoleAPI_originAttributes.js @@ -10,7 +10,7 @@ const FAKE_ADDON_ID = "test-webext-addon@mozilla.org"; const EXPECTED_CONSOLE_ID = `addon/${FAKE_ADDON_ID}`; const EXPECTED_CONSOLE_MESSAGE_CONTENT = "fake-webext-addon-test-log-message"; const ConsoleObserver = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]), init() { Services.obs.addObserver(this, "console-api-log-event"); diff --git a/dom/tests/browser/browser_ConsoleStorageAPITests.js b/dom/tests/browser/browser_ConsoleStorageAPITests.js index 48c8c3ef62c4..6ec4dad60585 100644 --- a/dom/tests/browser/browser_ConsoleStorageAPITests.js +++ b/dom/tests/browser/browser_ConsoleStorageAPITests.js @@ -33,7 +33,7 @@ add_task(async function() let observerPromise = new Promise(resolve => { let apiCallCount = 0; let ConsoleObserver = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]), observe: function(aSubject, aTopic, aData) { if (aTopic == "console-storage-cache-event") { diff --git a/dom/tests/browser/browser_bug1004814.js b/dom/tests/browser/browser_bug1004814.js index e86149004b1a..c105c2eda3c3 100644 --- a/dom/tests/browser/browser_bug1004814.js +++ b/dom/tests/browser/browser_bug1004814.js @@ -10,7 +10,7 @@ add_task(async function() { return new Promise(resolve => { let ConsoleObserver = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]), observe: function(aSubject, aTopic, aData) { var obj = aSubject.wrappedJSObject; diff --git a/dom/tests/mochitest/general/test_interfaces.js b/dom/tests/mochitest/general/test_interfaces.js index d132195ef497..cec0478ee1ef 100644 --- a/dom/tests/mochitest/general/test_interfaces.js +++ b/dom/tests/mochitest/general/test_interfaces.js @@ -788,8 +788,6 @@ var interfaceNamesInGlobalScope = {name: "PopStateEvent", insecureContext: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "PopupBlockedEvent", insecureContext: true}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "PopupBoxObject", insecureContext: true, xbl: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "Presentation", insecureContext: true, desktop: false, release: false }, // IMPORTANT: Do not change this list without review from a DOM peer! @@ -1268,6 +1266,8 @@ var interfaceNamesInGlobalScope = {name: "XULDocument", insecureContext: true, xbl: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "XULElement", insecureContext: true, xbl: true}, +// IMPORTANT: Do not change this list without review from a DOM peer! + {name: "XULPopupElement", insecureContext: true, xbl: true}, // IMPORTANT: Do not change this list without review from a DOM peer! ]; // IMPORTANT: Do not change the list above without review from a DOM peer! diff --git a/dom/webidl/PerformanceTiming.webidl b/dom/webidl/PerformanceTiming.webidl index 4aa403a50c79..a631e011f95e 100644 --- a/dom/webidl/PerformanceTiming.webidl +++ b/dom/webidl/PerformanceTiming.webidl @@ -39,5 +39,11 @@ interface PerformanceTiming { [Pref="dom.performance.time_to_non_blank_paint.enabled"] readonly attribute unsigned long long timeToNonBlankPaint; + // This is a Mozilla proprietary extension and not part of the + // performance/navigation timing specification. It marks the + // completion of the first presentation flush after DOMContentLoaded. + [Pref="dom.performance.time_to_dom_content_flushed.enabled"] + readonly attribute unsigned long long timeToDOMContentFlushed; + jsonifier; }; diff --git a/dom/webidl/PopupBoxObject.webidl b/dom/webidl/XULPopupElement.webidl similarity index 70% rename from dom/webidl/PopupBoxObject.webidl rename to dom/webidl/XULPopupElement.webidl index cb2c2ff50d68..a6e5b7b2dcff 100644 --- a/dom/webidl/PopupBoxObject.webidl +++ b/dom/webidl/XULPopupElement.webidl @@ -3,42 +3,31 @@ * 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/. */ -[Func="IsChromeOrXBL"] -interface PopupBoxObject : BoxObject +dictionary OpenPopupOptions { + // manner in which to anchor the popup to node + DOMString position = ""; + // horizontal offset + long x = 0; + // vertical offset + long y = 0; + // isContextMenu true for context menus, false for other popups + boolean isContextMenu = false; + // true if popup node attributes override position + boolean attributesOverride = false; + // triggerEvent the event that triggered this popup (mouse click for example) + Event? triggerEvent = null; +}; + +typedef (DOMString or OpenPopupOptions) StringOrOpenPopupOptions; + +[HTMLConstructor, Func="IsChromeOrXBL"] +interface XULPopupElement : XULElement { - /** - * This method is deprecated. Use openPopup or openPopupAtScreen instead. - */ - void showPopup(Element? srcContent, Element popupContent, - long xpos, long ypos, - optional DOMString popupType = "", - optional DOMString anchorAlignment = "", - optional DOMString popupAlignment = ""); - - /** - * Hide the popup if it is open. The cancel argument is used as a hint that - * the popup is being closed because it has been cancelled, rather than - * something being selected within the panel. - * - * @param cancel if true, then the popup is being cancelled. - */ - void hidePopup(optional boolean cancel = false); - /** * Allow the popup to automatically position itself. */ attribute boolean autoPosition; - /** - * Size the popup to the given dimensions - */ - void sizeTo(long width, long height); - - /** - * Move the popup to a point on screen in CSS pixels. - */ - void moveTo(long left, long top); - /** * Open the popup relative to a specified node at a specific location. * @@ -68,20 +57,20 @@ interface PopupBoxObject : BoxObject * this case, position and attributesOverride are ignored. * * @param anchorElement the node to anchor the popup to, may be null - * @param position manner is which to anchor the popup to node + * @param options either options to use, or a string position * @param x horizontal offset * @param y vertical offset * @param isContextMenu true for context menus, false for other popups * @param attributesOverride true if popup node attributes override position * @param triggerEvent the event that triggered this popup (mouse click for example) */ - void openPopup(Element? anchorElement, - optional DOMString position = "", - long x, - long y, - boolean isContextMenu, - boolean attributesOverride, - Event? triggerEvent); + void openPopup(optional Element? anchorElement = null, + optional StringOrOpenPopupOptions options, + optional long x = 0, + optional long y = 0, + optional boolean isContextMenu = false, + optional boolean attributesOverride = false, + optional Event? triggerEvent = null); /** * Open the popup at a specific screen position specified by x and y. This @@ -95,9 +84,9 @@ interface PopupBoxObject : BoxObject * @param y vertical screen position * @param triggerEvent the event that triggered this popup (mouse click for example) */ - void openPopupAtScreen(long x, long y, - boolean isContextMenu, - Event? triggerEvent); + void openPopupAtScreen(optional long x = 0, optional long y = 0, + optional boolean isContextMenu = false, + optional Event? triggerEvent = null); /** * Open the popup anchored at a specific screen rectangle. This function is @@ -106,13 +95,34 @@ interface PopupBoxObject : BoxObject * coordinates. */ void openPopupAtScreenRect(optional DOMString position = "", - long x, - long y, - long width, - long height, - boolean isContextMenu, - boolean attributesOverride, - Event? triggerEvent); + optional long x = 0, + optional long y = 0, + optional long width = 0, + optional long height = 0, + optional boolean isContextMenu = false, + optional boolean attributesOverride = false, + optional Event? triggerEvent = null); + + /** + * Hide the popup if it is open. The cancel argument is used as a hint that + * the popup is being closed because it has been cancelled, rather than + * something being selected within the panel. + * + * @param cancel if true, then the popup is being cancelled. + */ + void hidePopup(optional boolean cancel = false); + + /** + * Attribute getter and setter for label. + */ + [SetterThrows] + attribute DOMString label; + + /** + * Attribute getter and setter for position. + */ + [SetterThrows] + attribute DOMString position; /** * Returns the state of the popup: @@ -121,7 +131,7 @@ interface PopupBoxObject : BoxObject * showing - the popup is in the process of being shown * hiding - the popup is in the process of being hidden */ - readonly attribute DOMString popupState; + readonly attribute DOMString state; /** * The node that triggered the popup. If the popup is not open, will return @@ -141,15 +151,25 @@ interface PopupBoxObject : BoxObject */ DOMRect getOuterScreenRect(); + /** + * Move the popup to a point on screen in CSS pixels. + */ + void moveTo(long left, long top); + /** * Move an open popup to the given anchor position. The arguments have the same * meaning as the corresponding argument to openPopup. This method has no effect * on popups that are not open. */ - void moveToAnchor(Element? anchorElement, + void moveToAnchor(optional Element? anchorElement = null, optional DOMString position = "", - long x, long y, - boolean attributesOverride); + optional long x = 0, optional long y = 0, + optional boolean attributesOverride = false); + + /** + * Size the popup to the given dimensions + */ + void sizeTo(long width, long height); /** Returns the alignment position where the popup has appeared relative to its * anchor node or point, accounting for any flipping that occurred. diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index bfa40c90f954..decc095012ee 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -721,7 +721,6 @@ WEBIDL_FILES = [ 'Plugin.webidl', 'PluginArray.webidl', 'PointerEvent.webidl', - 'PopupBoxObject.webidl', 'Position.webidl', 'PositionError.webidl', 'Presentation.webidl', @@ -953,6 +952,7 @@ WEBIDL_FILES = [ 'XULCommandEvent.webidl', 'XULDocument.webidl', 'XULElement.webidl', + 'XULPopupElement.webidl', ] if CONFIG['MOZ_WEBRTC']: diff --git a/dom/websocket/tests/test_websocket_frame.html b/dom/websocket/tests/test_websocket_frame.html index fd173d2cfb2e..9ced41a4dec0 100644 --- a/dom/websocket/tests/test_websocket_frame.html +++ b/dom/websocket/tests/test_websocket_frame.html @@ -36,7 +36,7 @@ var service = Cc["@mozilla.org/websocketevent/service;1"] ok(!!service, "We have the nsIWebSocketEventService"); var listener = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebSocketEventListener]), + QueryInterface: ChromeUtils.generateQI([Ci.nsIWebSocketEventListener]), webSocketCreated: function(aWebSocketSerialID, aURI, aProtocols) { info("WebSocketCreated"); diff --git a/dom/workers/test/extensions/bootstrap/bootstrap.js b/dom/workers/test/extensions/bootstrap/bootstrap.js index 658fc8e5f54b..594afa0846cb 100644 --- a/dom/workers/test/extensions/bootstrap/bootstrap.js +++ b/dom/workers/test/extensions/bootstrap/bootstrap.js @@ -96,7 +96,7 @@ WorkerTestBootstrap.prototype = { } }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]) }; var gFactory = { diff --git a/dom/workers/test/test_extensionBootstrap.xul b/dom/workers/test/test_extensionBootstrap.xul index 4c504634c333..974a9d58079b 100644 --- a/dom/workers/test/test_extensionBootstrap.xul +++ b/dom/workers/test/test_extensionBootstrap.xul @@ -41,7 +41,7 @@ SimpleTest.finish(); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]) }; var workertestbootstrap = Cc["@mozilla.org/test/workertestbootstrap;1"]. diff --git a/dom/xbl/nsXBLContentSink.cpp b/dom/xbl/nsXBLContentSink.cpp index 803205b44eaa..a7640d260faf 100644 --- a/dom/xbl/nsXBLContentSink.cpp +++ b/dom/xbl/nsXBLContentSink.cpp @@ -874,7 +874,7 @@ nsXBLContentSink::CreateElement(const char16_t** aAtts, uint32_t aAttsCount, AddAttributesToXULPrototype(aAtts, aAttsCount, prototype); Element* result; - nsresult rv = nsXULElement::Create(prototype, mDocument, false, false, &result); + nsresult rv = nsXULElement::CreateFromPrototype(prototype, mDocument, false, false, &result); *aResult = result; return rv; #endif diff --git a/dom/xbl/nsXBLPrototypeBinding.cpp b/dom/xbl/nsXBLPrototypeBinding.cpp index 3f6483d6bb0a..47c9b8f13317 100644 --- a/dom/xbl/nsXBLPrototypeBinding.cpp +++ b/dom/xbl/nsXBLPrototypeBinding.cpp @@ -1300,7 +1300,7 @@ nsXBLPrototypeBinding::ReadContentNode(nsIObjectInputStream* aStream, } nsresult rv = - nsXULElement::Create(prototype, aDocument, false, false, getter_AddRefs(element)); + nsXULElement::CreateFromPrototype(prototype, aDocument, false, false, getter_AddRefs(element)); NS_ENSURE_SUCCESS(rv, rv); } else { #endif diff --git a/dom/xslt/xslt/txEXSLTRegExFunctions.js b/dom/xslt/xslt/txEXSLTRegExFunctions.js index 270617e230cd..c658ca5b67b4 100644 --- a/dom/xslt/xslt/txEXSLTRegExFunctions.js +++ b/dom/xslt/xslt/txEXSLTRegExFunctions.js @@ -16,7 +16,7 @@ var SingletonInstance = null; txEXSLTRegExFunctions.prototype = { classID: EXSLT_REGEXP_CID, - QueryInterface: XPCOMUtils.generateQI([Ci.txIEXSLTRegExFunctions]), + QueryInterface: ChromeUtils.generateQI([Ci.txIEXSLTRegExFunctions]), // txIEXSLTRegExFunctions match: function(str, regex, flags, doc) { diff --git a/dom/xul/XULDocument.cpp b/dom/xul/XULDocument.cpp index 90ac69a82299..874ef9baeb13 100644 --- a/dom/xul/XULDocument.cpp +++ b/dom/xul/XULDocument.cpp @@ -3324,7 +3324,7 @@ XULDocument::CreateElementFromPrototype(nsXULPrototypeElement* aPrototype, if (aPrototype->mNodeInfo->NamespaceEquals(kNameSpaceID_XUL)) { // If it's a XUL element, it'll be lightweight until somebody // monkeys with it. - rv = nsXULElement::Create(aPrototype, this, true, aIsRoot, getter_AddRefs(result)); + rv = nsXULElement::CreateFromPrototype(aPrototype, this, true, aIsRoot, getter_AddRefs(result)); if (NS_FAILED(rv)) return rv; } else { diff --git a/layout/xul/PopupBoxObject.cpp b/dom/xul/XULPopupElement.cpp similarity index 52% rename from layout/xul/PopupBoxObject.cpp rename to dom/xul/XULPopupElement.cpp index 737bc6851617..c4c1245c0693 100644 --- a/layout/xul/PopupBoxObject.cpp +++ b/dom/xul/XULPopupElement.cpp @@ -14,163 +14,165 @@ #include "nsView.h" #include "mozilla/AppUnits.h" #include "mozilla/dom/DOMRect.h" -#include "mozilla/dom/PopupBoxObject.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/Event.h" -#include "mozilla/dom/PopupBoxObjectBinding.h" +#include "mozilla/dom/XULPopupElement.h" +#include "mozilla/dom/XULPopupElementBinding.h" namespace mozilla { namespace dom { -PopupBoxObject::PopupBoxObject() +nsXULElement* +NS_NewXULPopupElement(already_AddRefed&& aNodeInfo) { + return new XULPopupElement(aNodeInfo); } -PopupBoxObject::~PopupBoxObject() +JSObject* +XULPopupElement::WrapNode(JSContext *aCx, JS::Handle aGivenProto) { + return XULPopupElementBinding::Wrap(aCx, this, aGivenProto); } -nsIContent* PopupBoxObject::GetParentObject() const +nsIFrame* +XULPopupElement::GetFrame(bool aFlushLayout) { - return BoxObject::GetParentObject(); -} + nsCOMPtr kungFuDeathGrip = this; // keep a reference -JSObject* PopupBoxObject::WrapObject(JSContext* aCx, JS::Handle aGivenProto) -{ - return PopupBoxObjectBinding::Wrap(aCx, this, aGivenProto); -} - -nsPopupSetFrame* -PopupBoxObject::GetPopupSetFrame() -{ - nsIRootBox* rootBox = nsIRootBox::GetRootBox(GetPresShell(false)); - if (!rootBox) - return nullptr; - - return rootBox->GetPopupSetFrame(); -} - -void -PopupBoxObject::HidePopup(bool aCancel) -{ - nsXULPopupManager* pm = nsXULPopupManager::GetInstance(); - if (pm && mContent) { - pm->HidePopup(mContent, false, true, false, aCancel); + nsCOMPtr doc = GetUncomposedDoc(); + if (doc) { + doc->FlushPendingNotifications(aFlushLayout ? FlushType::Layout : FlushType::Frames); } + + return GetPrimaryFrame(); } void -PopupBoxObject::ShowPopup(Element* aAnchorElement, - Element& aPopupElement, - int32_t aXPos, int32_t aYPos, - const nsAString& aPopupType, - const nsAString& aAnchorAlignment, - const nsAString& aPopupAlignment) +XULPopupElement::OpenPopup(Element* aAnchorElement, + const StringOrOpenPopupOptions& aOptions, + int32_t aXPos, int32_t aYPos, + bool aIsContextMenu, + bool aAttributesOverride, + Event* aTriggerEvent) { - nsXULPopupManager* pm = nsXULPopupManager::GetInstance(); - if (pm && mContent) { - nsCOMPtr anchorContent(do_QueryInterface(aAnchorElement)); - nsAutoString popupType(aPopupType); - nsAutoString anchor(aAnchorAlignment); - nsAutoString align(aPopupAlignment); - pm->ShowPopupWithAnchorAlign(mContent, anchorContent, anchor, align, - aXPos, aYPos, - popupType.EqualsLiteral("context")); + nsAutoString position; + if (aOptions.IsOpenPopupOptions()) { + const OpenPopupOptions& options = aOptions.GetAsOpenPopupOptions(); + position = options.mPosition; + aXPos = options.mX; + aYPos = options.mY; + aIsContextMenu = options.mIsContextMenu; + aAttributesOverride = options.mAttributesOverride; + aTriggerEvent = options.mTriggerEvent; + } + else { + position = aOptions.GetAsString(); } -} -void -PopupBoxObject::OpenPopup(Element* aAnchorElement, - const nsAString& aPosition, - int32_t aXPos, int32_t aYPos, - bool aIsContextMenu, - bool aAttributesOverride, - Event* aTriggerEvent) -{ nsXULPopupManager* pm = nsXULPopupManager::GetInstance(); - if (pm && mContent) { - nsCOMPtr anchorContent(do_QueryInterface(aAnchorElement)); - pm->ShowPopup(mContent, anchorContent, aPosition, aXPos, aYPos, + if (pm) { + // As a special case for popups that are menus when no anchor or position are + // specified, open the popup with ShowMenu instead of ShowPopup so that the + // popup is aligned with the menu. + if (!aAnchorElement && position.IsEmpty() && GetPrimaryFrame()) { + nsMenuFrame* menu = do_QueryFrame(GetPrimaryFrame()->GetParent()); + if (menu) { + pm->ShowMenu(menu->GetContent(), false, false); + return; + } + } + + pm->ShowPopup(this, aAnchorElement, position, aXPos, aYPos, aIsContextMenu, aAttributesOverride, false, aTriggerEvent); } } void -PopupBoxObject::OpenPopupAtScreen(int32_t aXPos, int32_t aYPos, - bool aIsContextMenu, - Event* aTriggerEvent) +XULPopupElement::OpenPopupAtScreen(int32_t aXPos, int32_t aYPos, + bool aIsContextMenu, + Event* aTriggerEvent) { nsXULPopupManager* pm = nsXULPopupManager::GetInstance(); - if (pm && mContent) - pm->ShowPopupAtScreen(mContent, aXPos, aYPos, aIsContextMenu, aTriggerEvent); + if (pm) { + pm->ShowPopupAtScreen(this, aXPos, aYPos, aIsContextMenu, aTriggerEvent); + } } void -PopupBoxObject::OpenPopupAtScreenRect(const nsAString& aPosition, - int32_t aXPos, int32_t aYPos, - int32_t aWidth, int32_t aHeight, - bool aIsContextMenu, - bool aAttributesOverride, - Event* aTriggerEvent) +XULPopupElement::OpenPopupAtScreenRect(const nsAString& aPosition, + int32_t aXPos, int32_t aYPos, + int32_t aWidth, int32_t aHeight, + bool aIsContextMenu, + bool aAttributesOverride, + Event* aTriggerEvent) { nsXULPopupManager* pm = nsXULPopupManager::GetInstance(); - if (pm && mContent) { - pm->ShowPopupAtScreenRect(mContent, aPosition, + if (pm) { + pm->ShowPopupAtScreenRect(this, aPosition, nsIntRect(aXPos, aYPos, aWidth, aHeight), aIsContextMenu, aAttributesOverride, aTriggerEvent); } } void -PopupBoxObject::MoveTo(int32_t aLeft, int32_t aTop) +XULPopupElement::HidePopup(bool aCancel) { - nsMenuPopupFrame *menuPopupFrame = mContent ? do_QueryFrame(mContent->GetPrimaryFrame()) : nullptr; + nsXULPopupManager* pm = nsXULPopupManager::GetInstance(); + if (pm) { + pm->HidePopup(this, false, true, false, aCancel); + } +} + +void +XULPopupElement::MoveTo(int32_t aLeft, int32_t aTop) +{ + nsMenuPopupFrame *menuPopupFrame = do_QueryFrame(GetPrimaryFrame()); if (menuPopupFrame) { menuPopupFrame->MoveTo(CSSIntPoint(aLeft, aTop), true); } } void -PopupBoxObject::MoveToAnchor(Element* aAnchorElement, - const nsAString& aPosition, - int32_t aXPos, int32_t aYPos, - bool aAttributesOverride) +XULPopupElement::MoveToAnchor(Element* aAnchorElement, + const nsAString& aPosition, + int32_t aXPos, int32_t aYPos, + bool aAttributesOverride) { - if (mContent) { - nsCOMPtr anchorContent(do_QueryInterface(aAnchorElement)); - - nsMenuPopupFrame *menuPopupFrame = do_QueryFrame(mContent->GetPrimaryFrame()); - if (menuPopupFrame && menuPopupFrame->IsVisible()) { - menuPopupFrame->MoveToAnchor(anchorContent, aPosition, aXPos, aYPos, aAttributesOverride); - } + nsMenuPopupFrame *menuPopupFrame = do_QueryFrame(GetPrimaryFrame()); + if (menuPopupFrame && menuPopupFrame->IsVisible()) { + menuPopupFrame->MoveToAnchor(aAnchorElement, aPosition, aXPos, aYPos, aAttributesOverride); } } void -PopupBoxObject::SizeTo(int32_t aWidth, int32_t aHeight) +XULPopupElement::SizeTo(int32_t aWidth, int32_t aHeight) { - if (!mContent) - return; - nsAutoString width, height; width.AppendInt(aWidth); height.AppendInt(aHeight); - RefPtr element = mContent->AsElement(); + nsCOMPtr kungFuDeathGrip = this; // keep a reference // We only want to pass aNotify=true to SetAttr once, but must make sure // we pass it when a value is being changed. Thus, we check if the height // is the same and if so, pass true when setting the width. - bool heightSame = element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::height, height, eCaseMatters); + bool heightSame = AttrValueIs(kNameSpaceID_None, nsGkAtoms::height, height, eCaseMatters); - element->SetAttr(kNameSpaceID_None, nsGkAtoms::width, width, heightSame); - element->SetAttr(kNameSpaceID_None, nsGkAtoms::height, height, true); + SetAttr(kNameSpaceID_None, nsGkAtoms::width, width, heightSame); + SetAttr(kNameSpaceID_None, nsGkAtoms::height, height, true); + + // If the popup is open, force a reposition of the popup after resizing it + // with notifications set to true so that the popuppositioned event is fired. + nsMenuPopupFrame *menuPopupFrame = do_QueryFrame(GetPrimaryFrame()); + if (menuPopupFrame && menuPopupFrame->PopupState() == ePopupShown) { + menuPopupFrame->SetPopupPosition(nullptr, false, false, true); + } } bool -PopupBoxObject::AutoPosition() +XULPopupElement::AutoPosition() { - nsMenuPopupFrame *menuPopupFrame = mContent ? do_QueryFrame(mContent->GetPrimaryFrame()) : nullptr; + nsMenuPopupFrame *menuPopupFrame = do_QueryFrame(GetPrimaryFrame()); if (menuPopupFrame) { return menuPopupFrame->GetAutoPosition(); } @@ -178,21 +180,21 @@ PopupBoxObject::AutoPosition() } void -PopupBoxObject::SetAutoPosition(bool aShouldAutoPosition) +XULPopupElement::SetAutoPosition(bool aShouldAutoPosition) { - nsMenuPopupFrame *menuPopupFrame = mContent ? do_QueryFrame(mContent->GetPrimaryFrame()) : nullptr; + nsMenuPopupFrame *menuPopupFrame = do_QueryFrame(GetPrimaryFrame()); if (menuPopupFrame) { menuPopupFrame->SetAutoPosition(aShouldAutoPosition); } } void -PopupBoxObject::GetPopupState(nsString& aState) +XULPopupElement::GetState(nsString& aState) { // set this here in case there's no frame for the popup aState.AssignLiteral("closed"); - nsMenuPopupFrame *menuPopupFrame = mContent ? do_QueryFrame(mContent->GetPrimaryFrame()) : nullptr; + nsMenuPopupFrame *menuPopupFrame = do_QueryFrame(GetPrimaryFrame()); if (menuPopupFrame) { switch (menuPopupFrame->PopupState()) { case ePopupShown: @@ -218,16 +220,16 @@ PopupBoxObject::GetPopupState(nsString& aState) } nsINode* -PopupBoxObject::GetTriggerNode() const +XULPopupElement::GetTriggerNode() const { - nsMenuPopupFrame *menuPopupFrame = mContent ? do_QueryFrame(mContent->GetPrimaryFrame()) : nullptr; + nsMenuPopupFrame *menuPopupFrame = do_QueryFrame(GetPrimaryFrame()); return nsMenuPopupFrame::GetTriggerContent(menuPopupFrame); } Element* -PopupBoxObject::GetAnchorNode() const +XULPopupElement::GetAnchorNode() const { - nsMenuPopupFrame *menuPopupFrame = mContent ? do_QueryFrame(mContent->GetPrimaryFrame()) : nullptr; + nsMenuPopupFrame *menuPopupFrame = do_QueryFrame(GetPrimaryFrame()); if (!menuPopupFrame) { return nullptr; } @@ -237,9 +239,9 @@ PopupBoxObject::GetAnchorNode() const } already_AddRefed -PopupBoxObject::GetOuterScreenRect() +XULPopupElement::GetOuterScreenRect() { - RefPtr rect = new DOMRect(mContent); + RefPtr rect = new DOMRect(ToSupports(this)); // Return an empty rectangle if the popup is not open. nsMenuPopupFrame *menuPopupFrame = do_QueryFrame(GetFrame(false)); @@ -261,7 +263,7 @@ PopupBoxObject::GetOuterScreenRect() } void -PopupBoxObject::GetAlignmentPosition(nsString& positionStr) +XULPopupElement::GetAlignmentPosition(nsString& positionStr) { positionStr.Truncate(); @@ -312,7 +314,7 @@ PopupBoxObject::GetAlignmentPosition(nsString& positionStr) } int32_t -PopupBoxObject::AlignmentOffset() +XULPopupElement::AlignmentOffset() { nsMenuPopupFrame *menuPopupFrame = do_QueryFrame(GetFrame(false)); if (!menuPopupFrame) @@ -328,7 +330,7 @@ PopupBoxObject::AlignmentOffset() } void -PopupBoxObject::SetConstraintRect(dom::DOMRectReadOnly& aRect) +XULPopupElement::SetConstraintRect(dom::DOMRectReadOnly& aRect) { nsMenuPopupFrame *menuPopupFrame = do_QueryFrame(GetFrame(false)); if (menuPopupFrame) { @@ -339,13 +341,3 @@ PopupBoxObject::SetConstraintRect(dom::DOMRectReadOnly& aRect) } // namespace dom } // namespace mozilla - -// Creation Routine /////////////////////////////////////////////////////////////////////// - -nsresult -NS_NewPopupBoxObject(nsIBoxObject** aResult) -{ - *aResult = new mozilla::dom::PopupBoxObject(); - NS_ADDREF(*aResult); - return NS_OK; -} diff --git a/layout/xul/PopupBoxObject.h b/dom/xul/XULPopupElement.h similarity index 63% rename from layout/xul/PopupBoxObject.h rename to dom/xul/XULPopupElement.h index ff59c1337294..5cc0ca618f54 100644 --- a/layout/xul/PopupBoxObject.h +++ b/dom/xul/XULPopupElement.h @@ -4,18 +4,17 @@ * 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 mozilla_dom_PopupBoxObject_h -#define mozilla_dom_PopupBoxObject_h +#ifndef XULPopupElement_h__ +#define XULPopupElement_h__ #include "mozilla/Attributes.h" #include "mozilla/ErrorResult.h" #include "nsCycleCollectionParticipant.h" #include "nsWrapperCache.h" -#include "mozilla/dom/BoxObject.h" #include "nsString.h" +#include "nsXULElement.h" struct JSContext; -class nsPopupSetFrame; namespace mozilla { namespace dom { @@ -23,37 +22,46 @@ namespace dom { class DOMRect; class Element; class Event; +class StringOrOpenPopupOptions; -class PopupBoxObject final : public BoxObject +nsXULElement* +NS_NewXULPopupElement(already_AddRefed&& aNodeInfo); + +class XULPopupElement final : public nsXULElement { +private: + nsIFrame* GetFrame(bool aFlushLayout); + public: - NS_INLINE_DECL_REFCOUNTING_INHERITED(PopupBoxObject, BoxObject) + explicit XULPopupElement(already_AddRefed& aNodeInfo) + : nsXULElement(aNodeInfo) + { + } - PopupBoxObject(); + void GetLabel(DOMString& aValue) const + { + GetXULAttr(nsGkAtoms::label, aValue); + } + void SetLabel(const nsAString& aValue, ErrorResult& rv) + { + SetXULAttr(nsGkAtoms::label, aValue, rv); + } - nsIContent* GetParentObject() const; - virtual JSObject* WrapObject(JSContext* aCx, JS::Handle aGivenProto) override; - - void ShowPopup(Element* aAnchorElement, - Element& aPopupElement, - int32_t aXPos, - int32_t aYPos, - const nsAString& aPopupType, - const nsAString& aAnchorAlignment, - const nsAString& aPopupAlignment); - - void HidePopup(bool aCancel); + void GetPosition(DOMString& aValue) const + { + GetXULAttr(nsGkAtoms::position, aValue); + } + void SetPosition(const nsAString& aValue, ErrorResult& rv) + { + SetXULAttr(nsGkAtoms::position, aValue, rv); + } bool AutoPosition(); void SetAutoPosition(bool aShouldAutoPosition); - void SizeTo(int32_t aWidth, int32_t aHeight); - - void MoveTo(int32_t aLeft, int32_t aTop); - void OpenPopup(Element* aAnchorElement, - const nsAString& aPosition, + const StringOrOpenPopupOptions& aOptions, int32_t aXPos, int32_t aYPos, bool aIsContextMenu, bool aAttributesOverride, @@ -71,7 +79,9 @@ public: bool aAttributesOverride, Event* aTriggerEvent); - void GetPopupState(nsString& aState); + void HidePopup(bool aCancel); + + void GetState(nsString& aState); nsINode* GetTriggerNode() const; @@ -79,26 +89,31 @@ public: already_AddRefed GetOuterScreenRect(); + void MoveTo(int32_t aLeft, int32_t aTop); + void MoveToAnchor(Element* aAnchorElement, const nsAString& aPosition, int32_t aXPos, int32_t aYPos, bool aAttributesOverride); + void SizeTo(int32_t aWidth, int32_t aHeight); + void GetAlignmentPosition(nsString& positionStr); int32_t AlignmentOffset(); - void SetConstraintRect(dom::DOMRectReadOnly& aRect); - -private: - ~PopupBoxObject(); + void SetConstraintRect(DOMRectReadOnly& aRect); protected: - nsPopupSetFrame* GetPopupSetFrame(); + virtual ~XULPopupElement() + { + } + + JSObject* WrapNode(JSContext *aCx, JS::Handle aGivenProto) override; }; } // namespace dom } // namespace mozilla -#endif // mozilla_dom_PopupBoxObject_h +#endif // XULPopupElement_h diff --git a/dom/xul/crashtests/384877-1-inner.xul b/dom/xul/crashtests/384877-1-inner.xul index 9bbfc07bd830..bd75aa87a7ee 100644 --- a/dom/xul/crashtests/384877-1-inner.xul +++ b/dom/xul/crashtests/384877-1-inner.xul @@ -7,9 +7,6 @@ if (d.openPopup) { // alert(d.state); } -if (d.showPopup) - d.showPopup(); -} setTimeout(doe, 200); diff --git a/dom/xul/moz.build b/dom/xul/moz.build index be2272d02bde..cfa4e18bbfcc 100644 --- a/dom/xul/moz.build +++ b/dom/xul/moz.build @@ -23,6 +23,10 @@ if CONFIG['MOZ_XUL']: 'nsXULElement.h', ] + EXPORTS.mozilla.dom += [ + 'XULPopupElement.h', + ] + UNIFIED_SOURCES += [ 'nsXULCommandDispatcher.cpp', 'nsXULContentSink.cpp', @@ -33,6 +37,7 @@ if CONFIG['MOZ_XUL']: 'nsXULPrototypeDocument.cpp', 'nsXULSortService.cpp', 'XULDocument.cpp', + 'XULPopupElement.cpp', ] XPIDL_SOURCES += [ diff --git a/dom/xul/nsXULElement.cpp b/dom/xul/nsXULElement.cpp index 88106e529b57..57cfbc6ae47d 100644 --- a/dom/xul/nsXULElement.cpp +++ b/dom/xul/nsXULElement.cpp @@ -75,6 +75,7 @@ #include "nsCCUncollectableMarker.h" #include "nsICSSDeclaration.h" #include "nsLayoutUtils.h" +#include "XULPopupElement.h" #include "mozilla/dom/XULElementBinding.h" #include "mozilla/dom/BoxObject.h" @@ -128,7 +129,7 @@ NS_INTERFACE_MAP_END_AGGREGATED(mElement) // nsXULElement // -nsXULElement::nsXULElement(already_AddRefed aNodeInfo) +nsXULElement::nsXULElement(already_AddRefed& aNodeInfo) : nsStyledElement(aNodeInfo), mBindingParent(nullptr) { @@ -161,10 +162,32 @@ nsXULElement::MaybeUpdatePrivateLifetime() } } +/* static */ +nsXULElement* NS_NewBasicXULElement(already_AddRefed&& aNodeInfo) +{ + return new nsXULElement(aNodeInfo); +} + + /* static */ +nsXULElement* nsXULElement::Construct(already_AddRefed&& aNodeInfo) +{ + RefPtr nodeInfo = aNodeInfo; + if (nodeInfo->Equals(nsGkAtoms::menupopup) || + nodeInfo->Equals(nsGkAtoms::popup) || + nodeInfo->Equals(nsGkAtoms::panel) || + nodeInfo->Equals(nsGkAtoms::tooltip)) { + return NS_NewXULPopupElement(nodeInfo.forget()); + } + + return NS_NewBasicXULElement(nodeInfo.forget()); +} + /* static */ already_AddRefed -nsXULElement::Create(nsXULPrototypeElement* aPrototype, mozilla::dom::NodeInfo *aNodeInfo, - bool aIsScriptable, bool aIsRoot) +nsXULElement::CreateFromPrototype(nsXULPrototypeElement* aPrototype, + mozilla::dom::NodeInfo *aNodeInfo, + bool aIsScriptable, + bool aIsRoot) { RefPtr ni = aNodeInfo; nsCOMPtr baseElement; @@ -209,11 +232,11 @@ nsXULElement::Create(nsXULPrototypeElement* aPrototype, mozilla::dom::NodeInfo * } nsresult -nsXULElement::Create(nsXULPrototypeElement* aPrototype, - nsIDocument* aDocument, - bool aIsScriptable, - bool aIsRoot, - Element** aResult) +nsXULElement::CreateFromPrototype(nsXULPrototypeElement* aPrototype, + nsIDocument* aDocument, + bool aIsScriptable, + bool aIsRoot, + Element** aResult) { // Create an nsXULElement from a prototype NS_PRECONDITION(aPrototype != nullptr, "null ptr"); @@ -234,8 +257,8 @@ nsXULElement::Create(nsXULPrototypeElement* aPrototype, nodeInfo = aPrototype->mNodeInfo; } - RefPtr element = Create(aPrototype, nodeInfo, - aIsScriptable, aIsRoot); + RefPtr element = CreateFromPrototype(aPrototype, nodeInfo, + aIsScriptable, aIsRoot); element.forget(aResult); return NS_OK; @@ -268,7 +291,7 @@ NS_TrustedNewXULElement(Element** aResult, NS_PRECONDITION(ni, "need nodeinfo for non-proto Create"); // Create an nsXULElement with the specified namespace and tag. - NS_ADDREF(*aResult = new nsXULElement(ni.forget())); + NS_ADDREF(*aResult = nsXULElement::Construct(ni.forget())); } //---------------------------------------------------------------------- @@ -306,7 +329,7 @@ nsXULElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult, *aResult = nullptr; RefPtr ni = aNodeInfo; - RefPtr element = new nsXULElement(ni.forget()); + RefPtr element = Construct(ni.forget()); nsresult rv = element->mAttrsAndChildren.EnsureCapacityToClone(mAttrsAndChildren, aPreallocateChildren); diff --git a/dom/xul/nsXULElement.h b/dom/xul/nsXULElement.h index 0255bd4d959e..01d807cf6ed6 100644 --- a/dom/xul/nsXULElement.h +++ b/dom/xul/nsXULElement.h @@ -332,17 +332,26 @@ ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 2); #undef XUL_ELEMENT_FLAG_BIT -class nsXULElement final : public nsStyledElement, - public nsIDOMNode +class nsXULElement : public nsStyledElement, + public nsIDOMNode { +protected: + // Use Construct to construct elements instead of this constructor. + explicit nsXULElement(already_AddRefed& aNodeInfo); + public: using Element::Blur; using Element::Focus; - explicit nsXULElement(already_AddRefed aNodeInfo); static nsresult - Create(nsXULPrototypeElement* aPrototype, nsIDocument* aDocument, - bool aIsScriptable, bool aIsRoot, mozilla::dom::Element** aResult); + CreateFromPrototype(nsXULPrototypeElement* aPrototype, + nsIDocument* aDocument, + bool aIsScriptable, + bool aIsRoot, + mozilla::dom::Element** aResult); + + // This is the constructor for nsXULElements. + static nsXULElement* Construct(already_AddRefed&& aNodeInfo); NS_IMPL_FROMNODE(nsXULElement, kNameSpaceID_XUL) @@ -723,6 +732,9 @@ protected: void UnregisterAccessKey(const nsAString& aOldValue); bool BoolAttrIsTrue(nsAtom* aName) const; + friend nsXULElement* + NS_NewBasicXULElement(already_AddRefed&& aNodeInfo); + friend nsresult NS_NewXULElement(mozilla::dom::Element** aResult, mozilla::dom::NodeInfo *aNodeInfo, mozilla::dom::FromParser aFromParser, const nsAString* aIs); @@ -730,8 +742,10 @@ protected: NS_TrustedNewXULElement(mozilla::dom::Element** aResult, mozilla::dom::NodeInfo *aNodeInfo); static already_AddRefed - Create(nsXULPrototypeElement* aPrototype, mozilla::dom::NodeInfo *aNodeInfo, - bool aIsScriptable, bool aIsRoot); + CreateFromPrototype(nsXULPrototypeElement* aPrototype, + mozilla::dom::NodeInfo *aNodeInfo, + bool aIsScriptable, + bool aIsRoot); bool IsReadWriteTextElement() const { diff --git a/editor/composer/test/test_bug1266815.html b/editor/composer/test/test_bug1266815.html index c47fcc9f233b..ded408c1b85f 100644 --- a/editor/composer/test/test_bug1266815.html +++ b/editor/composer/test/test_bug1266815.html @@ -38,7 +38,7 @@ var helperAppDlgPromise = new Promise(function(resolve) { registrar.unregisterFactory(MOCK_HELPERAPP_DIALOG_CID, mockHelperAppService); }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIHelperAppLauncherDialog]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIHelperAppLauncherDialog]) }; mockHelperAppService = XPCOMUtils._getFactory(HelperAppLauncherDialog); diff --git a/editor/libeditor/EditorUtils.js b/editor/libeditor/EditorUtils.js index 96acad248ad7..3037bf6b30cb 100644 --- a/editor/libeditor/EditorUtils.js +++ b/editor/libeditor/EditorUtils.js @@ -14,7 +14,7 @@ function EditorUtils() { EditorUtils.prototype = { classID: EDITORUTILS_CID, - QueryInterface: XPCOMUtils.generateQI([ Ci.nsIEditorUtils ]), + QueryInterface: ChromeUtils.generateQI([ Ci.nsIEditorUtils ]), slurpBlob(aBlob, aScope, aListener) { let reader = new aScope.FileReader(); diff --git a/extensions/cookie/test/unit/test_permmanager_migrate_4-7_no_history.js b/extensions/cookie/test/unit/test_permmanager_migrate_4-7_no_history.js index ddaecd01501f..e19e4fa8b9b3 100644 --- a/extensions/cookie/test/unit/test_permmanager_migrate_4-7_no_history.js +++ b/extensions/cookie/test/unit/test_permmanager_migrate_4-7_no_history.js @@ -15,7 +15,7 @@ var factory = { lockFactory: function() { throw Cr.NS_ERROR_NOT_IMPLEMENTED; }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory]) + QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory]) }; var newClassID = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator).generateUUID(); diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index 20b8b6c69556..332f7fd126b2 100644 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -308,7 +308,6 @@ NS_IMPL_ISUPPORTS(D3DSharedTexturesReporter, nsIMemoryReporter) gfxWindowsPlatform::gfxWindowsPlatform() : mRenderMode(RENDER_GDI) - , mUsingDirectWrite(false) { /* * Initialize COM @@ -562,7 +561,6 @@ gfxWindowsPlatform::CreatePlatformFontList() if (IsNotWin7PreRTM() && DWriteEnabled()) { pfl = new gfxDWriteFontList(); if (NS_SUCCEEDED(pfl->InitFontList())) { - mUsingDirectWrite = true; return pfl; } // DWrite font initialization failed! Don't know why this would happen, @@ -573,7 +571,10 @@ gfxWindowsPlatform::CreatePlatformFontList() NS_LITERAL_CSTRING("FEATURE_FAILURE_FONT_FAIL")); } - mUsingDirectWrite = false; + // Ensure this is false, even if the Windows version was recent enough to + // permit it, as we're using GDI fonts. + mHasVariationFontSupport = false; + pfl = new gfxGDIFontList(); if (NS_SUCCEEDED(pfl->InitFontList())) { @@ -2070,6 +2071,6 @@ gfxWindowsPlatform::SupportsPluginDirectDXGIDrawing() bool gfxWindowsPlatform::CheckVariationFontSupport() { - // Variation font support is only on Fall Creators Update or later - return mUsingDirectWrite && IsWin10FallCreatorsUpdateOrLater(); + // Variation font support is only available on Fall Creators Update or later. + return IsWin10FallCreatorsUpdateOrLater(); } diff --git a/gfx/thebes/gfxWindowsPlatform.h b/gfx/thebes/gfxWindowsPlatform.h index 8f227784674a..eb2e48647493 100644 --- a/gfx/thebes/gfxWindowsPlatform.h +++ b/gfx/thebes/gfxWindowsPlatform.h @@ -267,8 +267,6 @@ private: RefPtr mD3D11ReadbackManager; nsTArray mFeatureLevels; - - bool mUsingDirectWrite; }; #endif /* GFX_WINDOWS_PLATFORM_H */ diff --git a/intl/l10n/Localization.jsm b/intl/l10n/Localization.jsm index 25d1536e4f60..63e387bbdd44 100644 --- a/intl/l10n/Localization.jsm +++ b/intl/l10n/Localization.jsm @@ -21,7 +21,6 @@ /* eslint no-console: ["error", { allow: ["warn", "error"] }] */ /* global console */ -const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm", {}); const { L10nRegistry } = ChromeUtils.import("resource://gre/modules/L10nRegistry.jsm", {}); const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm", {}); const { AppConstants } = ChromeUtils.import("resource://gre/modules/AppConstants.jsm", {}); @@ -277,7 +276,7 @@ class Localization { } } -Localization.prototype.QueryInterface = XPCOMUtils.generateQI([ +Localization.prototype.QueryInterface = ChromeUtils.generateQI([ Ci.nsISupportsWeakReference ]); diff --git a/js/src/frontend/BCEParserHandle.h b/js/src/frontend/BCEParserHandle.h new file mode 100644 index 000000000000..e0ae2b9a351c --- /dev/null +++ b/js/src/frontend/BCEParserHandle.h @@ -0,0 +1,30 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sts=4 et sw=4 tw=99: + * 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 frontend_BCEParserHandle_h +#define frontend_BCEParserHandle_h + +#include "frontend/ErrorReporter.h" +#include "frontend/FullParseHandler.h" +#include "frontend/Parser.h" + +namespace js { +namespace frontend { + +struct BCEParserHandle { + virtual ErrorReporter& errorReporter() = 0; + virtual const ErrorReporter& errorReporter() const = 0; + + virtual const JS::ReadOnlyCompileOptions& options() = 0; + + virtual FullParseHandler& astGenerator() = 0; + virtual ObjectBox* newObjectBox(JSObject *obj) = 0; +}; + +} // namespace frontend +} // namespace js + +#endif // frontend_BCEParserHandle_h diff --git a/js/src/frontend/BinSource.cpp b/js/src/frontend/BinSource.cpp index 0a50efd2769d..6d2a87244b80 100644 --- a/js/src/frontend/BinSource.cpp +++ b/js/src/frontend/BinSource.cpp @@ -375,9 +375,41 @@ BinASTParser::reportErrorNoOffsetVA(unsigned errorNumber, va_list args) metadata.filename = getFilename(); metadata.lineNumber = 0; metadata.columnNumber = offset(); + metadata.isMuted = options().mutedErrors(); ReportCompileError(cx_, Move(metadata), nullptr, JSREPORT_ERROR, errorNumber, args); } +template void +BinASTParser::errorAtVA(uint32_t offset, unsigned errorNumber, va_list* args) +{ + ErrorMetadata metadata; + metadata.filename = getFilename(); + metadata.lineNumber = 0; + metadata.columnNumber = offset; + metadata.isMuted = options().mutedErrors(); + ReportCompileError(cx_, Move(metadata), nullptr, JSREPORT_ERROR, errorNumber, *args); +} + +template bool +BinASTParser::reportExtraWarningErrorNumberVA(UniquePtr notes, uint32_t offset, unsigned errorNumber, va_list* args) +{ + if (!options().extraWarningsOption) + return true; + + ErrorMetadata metadata; + metadata.filename = getFilename(); + metadata.lineNumber = 0; + metadata.columnNumber = offset; + metadata.isMuted = options().mutedErrors(); + + if (options().werrorOption) { + ReportCompileError(cx_, Move(metadata), Move(notes), JSREPORT_STRICT, errorNumber, *args); + return false; + } + + return ReportCompileWarning(cx_, Move(metadata), Move(notes), JSREPORT_STRICT | JSREPORT_WARNING, errorNumber, *args); +} + bool BinASTParserBase::hasUsedName(HandlePropertyName name) { diff --git a/js/src/frontend/BinSource.h b/js/src/frontend/BinSource.h index ac6720057ba0..f9c9a07f1d9b 100644 --- a/js/src/frontend/BinSource.h +++ b/js/src/frontend/BinSource.h @@ -229,9 +229,23 @@ class BinASTParser : public BinASTParserBase, public ErrorReporter } virtual void lineAndColumnAt(size_t offset, uint32_t* line, uint32_t* column) const override { - *line = 0; - *column = offset; + *line = lineAt(offset); + *column = columnAt(offset); } + virtual uint32_t lineAt(size_t offset) const override { + return 0; + } + virtual uint32_t columnAt(size_t offset) const override { + return offset; + } + + virtual bool isOnThisLine(size_t offset, uint32_t lineNum, bool *isOnSameLine) const override { + if (lineNum != 0) + return false; + *isOnSameLine = true; + return true; + } + virtual void currentLineAndColumn(uint32_t* line, uint32_t* column) const override { *line = 0; *column = offset(); @@ -246,6 +260,8 @@ class BinASTParser : public BinASTParserBase, public ErrorReporter return tokenizer_.isSome(); } virtual void reportErrorNoOffsetVA(unsigned errorNumber, va_list args) override; + virtual void errorAtVA(uint32_t offset, unsigned errorNumber, va_list* args) override; + virtual bool reportExtraWarningErrorNumberVA(UniquePtr notes, uint32_t offset, unsigned errorNumber, va_list* args) override; virtual const char* getFilename() const override { return this->options_.filename(); } @@ -294,4 +310,4 @@ extern template class BinASTParser; } // namespace frontend } // namespace js -#endif // frontend_BinSource_h \ No newline at end of file +#endif // frontend_BinSource_h diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index 656ec91302ce..f434e1ba5887 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -25,7 +25,6 @@ #include "ds/Nestable.h" #include "frontend/Parser.h" -#include "frontend/TokenStream.h" #include "vm/BytecodeUtil.h" #include "vm/Debugger.h" #include "vm/GeneratorObject.h" @@ -2141,9 +2140,10 @@ class ForOfLoopControl : public LoopControl } }; + BytecodeEmitter::BytecodeEmitter(BytecodeEmitter* parent, - const EitherParser& parser, SharedContext* sc, - HandleScript script, Handle lazyScript, + SharedContext* sc, HandleScript script, + Handle lazyScript, uint32_t lineNum, EmitterMode emitterMode) : sc(sc), cx(sc->context), @@ -2153,7 +2153,6 @@ BytecodeEmitter::BytecodeEmitter(BytecodeEmitter* parent, prologue(cx, lineNum), main(cx, lineNum), current(&main), - parser(parser), atomIndices(cx->frontendCollectionPool()), firstLine(lineNum), maxFixedSlots(0), @@ -2175,19 +2174,35 @@ BytecodeEmitter::BytecodeEmitter(BytecodeEmitter* parent, hasTryFinally(false), emittingRunOnceLambda(false), emitterMode(emitterMode), + scriptStartOffsetSet(false), functionBodyEndPosSet(false) { MOZ_ASSERT_IF(emitterMode == LazyFunction, lazyScript); } BytecodeEmitter::BytecodeEmitter(BytecodeEmitter* parent, - const EitherParser& parser, SharedContext* sc, + BCEParserHandle* handle, SharedContext* sc, HandleScript script, Handle lazyScript, - TokenPos bodyPosition, EmitterMode emitterMode) - : BytecodeEmitter(parent, parser, sc, script, lazyScript, - parser.tokenStream().srcCoords.lineNum(bodyPosition.begin), - emitterMode) + uint32_t lineNum, EmitterMode emitterMode) + : BytecodeEmitter(parent, sc, script, lazyScript, lineNum, emitterMode) { + parser = handle; +} + +BytecodeEmitter::BytecodeEmitter(BytecodeEmitter* parent, + const EitherParser& parser, SharedContext* sc, + HandleScript script, Handle lazyScript, + uint32_t lineNum, EmitterMode emitterMode) + : BytecodeEmitter(parent, sc, script, lazyScript, lineNum, emitterMode) +{ + ep_.emplace(parser); + this->parser = ep_.ptr(); +} + +void +BytecodeEmitter::initFromBodyPosition(TokenPos bodyPosition) +{ + setScriptStartOffsetIfUnset(bodyPosition); setFunctionBodyEndPos(bodyPosition); } @@ -2527,15 +2542,15 @@ LengthOfSetLine(unsigned line) bool BytecodeEmitter::updateLineNumberNotes(uint32_t offset) { - TokenStreamAnyChars* ts = &parser.tokenStream(); + ErrorReporter* er = &parser->errorReporter(); bool onThisLine; - if (!ts->srcCoords.isOnThisLine(offset, currentLine(), &onThisLine)) { - ts->reportErrorNoOffset(JSMSG_OUT_OF_MEMORY); + if (!er->isOnThisLine(offset, currentLine(), &onThisLine)) { + er->reportErrorNoOffset(JSMSG_OUT_OF_MEMORY); return false; } if (!onThisLine) { - unsigned line = ts->srcCoords.lineNum(offset); + unsigned line = er->lineAt(offset); unsigned delta = line - currentLine(); /* @@ -2571,7 +2586,7 @@ BytecodeEmitter::updateSourceCoordNotes(uint32_t offset) if (!updateLineNumberNotes(offset)) return false; - uint32_t columnIndex = parser.tokenStream().srcCoords.columnIndex(offset); + uint32_t columnIndex = parser->errorReporter().columnAt(offset); ptrdiff_t colspan = ptrdiff_t(columnIndex) - ptrdiff_t(current->lastColumn); if (colspan != 0) { // If the column span is so large that we can't store it, then just @@ -3524,46 +3539,6 @@ BytecodeEmitter::needsImplicitThis() return false; } -bool -BytecodeEmitter::maybeSetDisplayURL() -{ - if (tokenStream().hasDisplayURL()) { - if (!parser.ss()->setDisplayURL(cx, tokenStream().displayURL())) - return false; - } - return true; -} - -bool -BytecodeEmitter::maybeSetSourceMap() -{ - if (tokenStream().hasSourceMapURL()) { - MOZ_ASSERT(!parser.ss()->hasSourceMapURL()); - if (!parser.ss()->setSourceMapURL(cx, tokenStream().sourceMapURL())) - return false; - } - - /* - * Source map URLs passed as a compile option (usually via a HTTP source map - * header) override any source map urls passed as comment pragmas. - */ - if (parser.options().sourceMapURL()) { - // Warn about the replacement, but use the new one. - if (parser.ss()->hasSourceMapURL()) { - if (!parser.warningNoOffset(JSMSG_ALREADY_HAS_PRAGMA, - parser.ss()->filename(), "//# sourceMappingURL")) - { - return false; - } - } - - if (!parser.ss()->setSourceMapURL(cx, parser.options().sourceMapURL())) - return false; - } - - return true; -} - void BytecodeEmitter::tellDebuggerAboutCompiledScript(JSContext* cx) { @@ -3578,23 +3553,16 @@ BytecodeEmitter::tellDebuggerAboutCompiledScript(JSContext* cx) Debugger::onNewScript(cx, script); } -inline TokenStreamAnyChars& -BytecodeEmitter::tokenStream() -{ - return parser.tokenStream(); -} - void BytecodeEmitter::reportError(ParseNode* pn, unsigned errorNumber, ...) { - TokenPos pos = pn ? pn->pn_pos : tokenStream().currentToken().pos; + MOZ_ASSERT_IF(!pn, this->scriptStartOffsetSet); + uint32_t offset = pn ? pn->pn_pos.begin : this->scriptStartOffset; va_list args; va_start(args, errorNumber); - ErrorMetadata metadata; - if (parser.computeErrorMetadata(&metadata, pos.begin)) - ReportCompileError(cx, Move(metadata), nullptr, JSREPORT_ERROR, errorNumber, args); + parser->errorReporter().errorAtVA(offset, errorNumber, &args); va_end(args); } @@ -3602,12 +3570,13 @@ BytecodeEmitter::reportError(ParseNode* pn, unsigned errorNumber, ...) bool BytecodeEmitter::reportExtraWarning(ParseNode* pn, unsigned errorNumber, ...) { - TokenPos pos = pn ? pn->pn_pos : tokenStream().currentToken().pos; + MOZ_ASSERT_IF(!pn, this->scriptStartOffsetSet); + uint32_t offset = pn ? pn->pn_pos.begin : this->scriptStartOffset; va_list args; va_start(args, errorNumber); - bool result = parser.reportExtraWarningErrorNumberVA(nullptr, pos.begin, errorNumber, &args); + bool result = parser->errorReporter().reportExtraWarningErrorNumberVA(nullptr, offset, errorNumber, &args); va_end(args); return result; @@ -3649,7 +3618,7 @@ BytecodeEmitter::iteratorResultShape(unsigned* shape) if (!NativeDefineDataProperty(cx, obj, done_id, UndefinedHandleValue, JSPROP_ENUMERATE)) return false; - ObjectBox* objbox = parser.newObjectBox(obj); + ObjectBox* objbox = parser->newObjectBox(obj); if (!objbox) return false; @@ -4470,7 +4439,7 @@ BytecodeEmitter::emitSwitch(ParseNode* pn) // Switch bytecodes run from here till end of final case. uint32_t caseCount = cases->pn_count; if (caseCount > JS_BIT(16)) { - parser.reportError(JSMSG_TOO_MANY_CASES); + reportError(pn, JSMSG_TOO_MANY_CASES); return false; } @@ -4858,7 +4827,9 @@ BytecodeEmitter::emitSetThis(ParseNode* pn) bool BytecodeEmitter::emitScript(ParseNode* body) { - AutoFrontendTraceLog traceLog(cx, TraceLogger_BytecodeEmission, tokenStream(), body); + AutoFrontendTraceLog traceLog(cx, TraceLogger_BytecodeEmission, parser->errorReporter(), body); + + setScriptStartOffsetIfUnset(body->pn_pos); TDZCheckCache tdzCache(this); EmitterScope emitterScope(this); @@ -4916,11 +4887,6 @@ BytecodeEmitter::emitScript(ParseNode* body) if (!JSScript::fullyInitFromEmitter(cx, script, this)) return false; - // URL and source map information must be set before firing - // Debugger::onNewScript. - if (!maybeSetDisplayURL() || !maybeSetSourceMap()) - return false; - tellDebuggerAboutCompiledScript(cx); return true; @@ -4930,7 +4896,9 @@ bool BytecodeEmitter::emitFunctionScript(ParseNode* body) { FunctionBox* funbox = sc->asFunctionBox(); - AutoFrontendTraceLog traceLog(cx, TraceLogger_BytecodeEmission, tokenStream(), funbox); + AutoFrontendTraceLog traceLog(cx, TraceLogger_BytecodeEmission, parser->errorReporter(), funbox); + + setScriptStartOffsetIfUnset(body->pn_pos); // The ordering of these EmitterScopes is important. The named lambda // scope needs to enclose the function scope needs to enclose the extra @@ -4983,15 +4951,7 @@ BytecodeEmitter::emitFunctionScript(ParseNode* body) if (!JSScript::fullyInitFromEmitter(cx, script, this)) return false; - // URL and source map information must be set before firing - // Debugger::onNewScript. Only top-level functions need this, as compiling - // the outer scripts of nested functions already processed the source. - if (emitterMode != LazyFunction && !parent) { - if (!maybeSetDisplayURL() || !maybeSetSourceMap()) - return false; - - tellDebuggerAboutCompiledScript(cx); - } + tellDebuggerAboutCompiledScript(cx); return true; } @@ -6583,7 +6543,7 @@ BytecodeEmitter::emitSingletonInitialiser(ParseNode* pn) MOZ_ASSERT_IF(newKind == SingletonObject, value.toObject().isSingleton()); - ObjectBox* objbox = parser.newObjectBox(&value.toObject()); + ObjectBox* objbox = parser->newObjectBox(&value.toObject()); if (!objbox) return false; @@ -6599,7 +6559,7 @@ BytecodeEmitter::emitCallSiteObject(ParseNode* pn) MOZ_ASSERT(value.isObject()); - ObjectBox* objbox1 = parser.newObjectBox(&value.toObject()); + ObjectBox* objbox1 = parser->newObjectBox(&value.toObject()); if (!objbox1) return false; @@ -6608,7 +6568,7 @@ BytecodeEmitter::emitCallSiteObject(ParseNode* pn) MOZ_ASSERT(value.isObject()); - ObjectBox* objbox2 = parser.newObjectBox(&value.toObject()); + ObjectBox* objbox2 = parser->newObjectBox(&value.toObject()); if (!objbox2) return false; @@ -7123,7 +7083,7 @@ BytecodeEmitter::emitInitializeForInOrOfTarget(ParseNode* forHead) // If the for-in/of loop didn't have a variable declaration, per-loop // initialization is just assigning the iteration value to a target // expression. - if (!parser.isDeclarationList(target)) + if (!parser->astGenerator().isDeclarationList(target)) return emitAssignment(target, ParseNodeKind::Assign, nullptr); // ... ITERVAL // Otherwise, per-loop initialization is (possibly) declaration @@ -7136,7 +7096,7 @@ BytecodeEmitter::emitInitializeForInOrOfTarget(ParseNode* forHead) return false; MOZ_ASSERT(target->isForLoopDeclaration()); - target = parser.singleBindingFromDeclaration(target); + target = parser->astGenerator().singleBindingFromDeclaration(target); if (target->isKind(ParseNodeKind::Name)) { auto emitSwapScopeAndRhs = [](BytecodeEmitter* bce, const NameLocation&, @@ -7376,8 +7336,8 @@ BytecodeEmitter::emitForIn(ParseNode* forInLoop, EmitterScope* headLexicalEmitte // Annex B: Evaluate the var-initializer expression if present. // |for (var i = initializer in expr) { ... }| ParseNode* forInTarget = forInHead->pn_kid1; - if (parser.isDeclarationList(forInTarget)) { - ParseNode* decl = parser.singleBindingFromDeclaration(forInTarget); + if (parser->astGenerator().isDeclarationList(forInTarget)) { + ParseNode* decl = parser->astGenerator().singleBindingFromDeclaration(forInTarget); if (decl->isKind(ParseNodeKind::Name)) { if (ParseNode* initializer = decl->expr()) { MOZ_ASSERT(forInTarget->isKind(ParseNodeKind::Var), @@ -7648,7 +7608,7 @@ BytecodeEmitter::emitCStyleFor(ParseNode* pn, EmitterScope* headLexicalEmitterSc return false; /* Restore the absolute line number for source note readers. */ - uint32_t lineNum = parser.tokenStream().srcCoords.lineNum(pn->pn_pos.end); + uint32_t lineNum = parser->errorReporter().lineAt(pn->pn_pos.end); if (currentLine() != lineNum) { if (!newSrcNote2(SRC_SETLINE, ptrdiff_t(lineNum))) return false; @@ -7804,8 +7764,8 @@ BytecodeEmitter::emitFunction(ParseNode* pn, bool needsProto) // Inherit most things (principals, version, etc) from the // parent. Use default values for the rest. Rooted parent(cx, script); - MOZ_ASSERT(parent->mutedErrors() == parser.options().mutedErrors()); - const TransitiveCompileOptions& transitiveOptions = parser.options(); + MOZ_ASSERT(parent->mutedErrors() == parser->options().mutedErrors()); + const TransitiveCompileOptions& transitiveOptions = parser->options(); CompileOptions options(cx, transitiveOptions); Rooted sourceObject(cx, script->sourceObject()); @@ -8090,8 +8050,8 @@ BytecodeEmitter::emitWhile(ParseNode* pn) // want to emit the line note after the initial goto, so that // "cont" stops on each iteration -- but without a stop before the // first iteration. - if (parser.tokenStream().srcCoords.lineNum(pn->pn_pos.begin) == - parser.tokenStream().srcCoords.lineNum(pn->pn_pos.end)) + if (parser->errorReporter().lineAt(pn->pn_pos.begin) == + parser->errorReporter().lineAt(pn->pn_pos.end)) { if (!updateSourceCoordNotes(pn->pn_pos.begin)) return false; @@ -9180,7 +9140,7 @@ BytecodeEmitter::emitCallee(ParseNode* callee, ParseNode* call, bool* callop) break; case ParseNodeKind::SuperBase: MOZ_ASSERT(call->isKind(ParseNodeKind::SuperCall)); - MOZ_ASSERT(parser.isSuperBase(callee)); + MOZ_ASSERT(parser->astGenerator().isSuperBase(callee)); if (!emit1(JSOP_SUPERFUN)) return false; break; @@ -9251,7 +9211,7 @@ BytecodeEmitter::emitCallOrNew(ParseNode* pn, ValueUsage valueUsage /* = ValueUs uint32_t argc = pn->pn_count - 1; if (argc >= ARGC_LIMIT) { - parser.reportError(callop ? JSMSG_TOO_MANY_FUN_ARGS : JSMSG_TOO_MANY_CON_ARGS); + reportError(pn, callop ? JSMSG_TOO_MANY_FUN_ARGS : JSMSG_TOO_MANY_CON_ARGS); return false; } @@ -9395,7 +9355,7 @@ BytecodeEmitter::emitCallOrNew(ParseNode* pn, ValueUsage valueUsage /* = ValueUs pn->isOp(JSOP_SPREADEVAL) || pn->isOp(JSOP_STRICTSPREADEVAL)) { - uint32_t lineNum = parser.tokenStream().srcCoords.lineNum(pn->pn_pos.begin); + uint32_t lineNum = parser->errorReporter().lineAt(pn->pn_pos.begin); if (!emitUint32Operand(JSOP_LINENO, lineNum)) return false; } @@ -9835,7 +9795,7 @@ BytecodeEmitter::emitObject(ParseNode* pn) bool BytecodeEmitter::replaceNewInitWithNewObject(JSObject* obj, ptrdiff_t offset) { - ObjectBox* objbox = parser.newObjectBox(obj); + ObjectBox* objbox = parser->newObjectBox(obj); if (!objbox) return false; @@ -9884,7 +9844,7 @@ BytecodeEmitter::emitArrayLiteral(ParseNode* pn) MOZ_ASSERT(obj->is() && obj->as().denseElementsAreCopyOnWrite()); - ObjectBox* objbox = parser.newObjectBox(obj); + ObjectBox* objbox = parser->newObjectBox(obj); if (!objbox) return false; @@ -11124,7 +11084,7 @@ bool BytecodeEmitter::setSrcNoteOffset(unsigned index, unsigned which, ptrdiff_t offset) { if (!SN_REPRESENTABLE_OFFSET(offset)) { - parser.reportError(JSMSG_NEED_DIET, js_script_str); + reportError(nullptr, JSMSG_NEED_DIET, js_script_str); return false; } diff --git a/js/src/frontend/BytecodeEmitter.h b/js/src/frontend/BytecodeEmitter.h index 868b8161ab48..e5ce7dad5bfa 100644 --- a/js/src/frontend/BytecodeEmitter.h +++ b/js/src/frontend/BytecodeEmitter.h @@ -12,6 +12,7 @@ #include "mozilla/Attributes.h" #include "ds/InlineTable.h" +#include "frontend/BCEParserHandle.h" #include "frontend/EitherParser.h" #include "frontend/SharedContext.h" #include "frontend/SourceNotes.h" @@ -220,7 +221,10 @@ struct MOZ_STACK_CLASS BytecodeEmitter }; EmitSection prologue, main, *current; - EitherParser parser; + // Private storage for parser wrapper. DO NOT REFERENCE INTERNALLY. May not be initialized. + // Use |parser| instead. + mozilla::Maybe ep_; + BCEParserHandle *parser; PooledMapPtr atomIndices; /* literals indexed for mapping */ unsigned firstLine; /* first line, for JSScript::initFromEmitter */ @@ -281,6 +285,9 @@ struct MOZ_STACK_CLASS BytecodeEmitter const EmitterMode emitterMode; + MOZ_INIT_OUTSIDE_CTOR uint32_t scriptStartOffset; + bool scriptStartOffsetSet; + // The end location of a function body that is being emitted. MOZ_INIT_OUTSIDE_CTOR uint32_t functionBodyEndPos; // Whether functionBodyEndPos was set. @@ -292,29 +299,58 @@ struct MOZ_STACK_CLASS BytecodeEmitter * tempLifoAlloc and save the pointer beyond the next BytecodeEmitter * destruction. */ - BytecodeEmitter(BytecodeEmitter* parent, const EitherParser& parser, - SharedContext* sc, HandleScript script, Handle lazyScript, - uint32_t lineNum, EmitterMode emitterMode = Normal); + private: + // Internal constructor, for delegation use only. + BytecodeEmitter(BytecodeEmitter* parent, SharedContext* sc, HandleScript script, + Handle lazyScript, uint32_t lineNum, EmitterMode emitterMode); + + void initFromBodyPosition(TokenPos bodyPosition); + + public: + + BytecodeEmitter(BytecodeEmitter* parent, BCEParserHandle* parser, SharedContext* sc, + HandleScript script, Handle lazyScript, uint32_t lineNum, + EmitterMode emitterMode = Normal); + + BytecodeEmitter(BytecodeEmitter* parent, const EitherParser& parser, SharedContext* sc, + HandleScript script, Handle lazyScript, uint32_t lineNum, + EmitterMode emitterMode = Normal); template BytecodeEmitter(BytecodeEmitter* parent, Parser* parser, SharedContext* sc, HandleScript script, Handle lazyScript, uint32_t lineNum, EmitterMode emitterMode = Normal) - : BytecodeEmitter(parent, EitherParser(parser), sc, script, lazyScript, + : BytecodeEmitter(parent, EitherParser(parser), sc, script, lazyScript, lineNum, emitterMode) {} // An alternate constructor that uses a TokenPos for the starting // line and that sets functionBodyEndPos as well. - BytecodeEmitter(BytecodeEmitter* parent, const EitherParser& parser, - SharedContext* sc, HandleScript script, Handle lazyScript, - TokenPos bodyPosition, EmitterMode emitterMode = Normal); + BytecodeEmitter(BytecodeEmitter* parent, BCEParserHandle* parser, SharedContext* sc, + HandleScript script, Handle lazyScript, TokenPos bodyPosition, + EmitterMode emitterMode = Normal) + : BytecodeEmitter(parent, parser, sc, script, lazyScript, + parser->errorReporter().lineAt(bodyPosition.begin), + emitterMode) + { + initFromBodyPosition(bodyPosition); + } + + BytecodeEmitter(BytecodeEmitter* parent, const EitherParser& parser, SharedContext* sc, + HandleScript script, Handle lazyScript, TokenPos bodyPosition, + EmitterMode emitterMode = Normal) + : BytecodeEmitter(parent, parser, sc, script, lazyScript, + parser.errorReporter().lineAt(bodyPosition.begin), + emitterMode) + { + initFromBodyPosition(bodyPosition); + } template BytecodeEmitter(BytecodeEmitter* parent, Parser* parser, SharedContext* sc, HandleScript script, Handle lazyScript, TokenPos bodyPosition, EmitterMode emitterMode = Normal) - : BytecodeEmitter(parent, EitherParser(parser), sc, script, lazyScript, + : BytecodeEmitter(parent, EitherParser(parser), sc, script, lazyScript, bodyPosition, emitterMode) {} @@ -381,12 +417,8 @@ struct MOZ_STACK_CLASS BytecodeEmitter bool needsImplicitThis(); - MOZ_MUST_USE bool maybeSetDisplayURL(); - MOZ_MUST_USE bool maybeSetSourceMap(); void tellDebuggerAboutCompiledScript(JSContext* cx); - inline TokenStreamAnyChars& tokenStream(); - BytecodeVector& code() const { return current->code; } jsbytecode* code(ptrdiff_t offset) const { return current->code.begin() + offset; } ptrdiff_t offset() const { return current->code.end() - current->code.begin(); } @@ -417,6 +449,13 @@ struct MOZ_STACK_CLASS BytecodeEmitter functionBodyEndPosSet = true; } + void setScriptStartOffsetIfUnset(TokenPos pos) { + if (!scriptStartOffsetSet) { + scriptStartOffset = pos.begin; + scriptStartOffsetSet = true; + } + } + void reportError(ParseNode* pn, unsigned errorNumber, ...); bool reportExtraWarning(ParseNode* pn, unsigned errorNumber, ...); diff --git a/js/src/frontend/EitherParser.h b/js/src/frontend/EitherParser.h index dcb86bb05196..637065e64fd7 100644 --- a/js/src/frontend/EitherParser.h +++ b/js/src/frontend/EitherParser.h @@ -20,6 +20,7 @@ #include +#include "frontend/BCEParserHandle.h" #include "frontend/Parser.h" #include "frontend/TokenStream.h" @@ -67,14 +68,6 @@ struct GetParser static Parser* get(Parser* parser) { return parser; } }; -template -struct GetParseHandler -{ - static auto get(Parser* parser) -> decltype(&parser->handler) { - return &parser->handler; - } -}; - template struct GetTokenStream { @@ -93,14 +86,6 @@ struct ParserOptions } }; -template -struct TokenStreamComputeErrorMetadata -{ - static constexpr auto get() -> decltype(&TokenStream::computeErrorMetadata) { - return &TokenStream::computeErrorMetadata; - } -}; - template struct ParserNewObjectBox { @@ -109,61 +94,13 @@ struct ParserNewObjectBox } }; -template -struct HandlerSingleBindingFromDeclaration -{ - static constexpr auto get() -> decltype(&Handler::singleBindingFromDeclaration) { - return &Handler::singleBindingFromDeclaration; - } -}; - -template -struct HandlerIsDeclarationList -{ - static constexpr auto get() -> decltype(&Handler::isDeclarationList) { - return &Handler::isDeclarationList; - } -}; - -template -struct HandlerIsSuperBase -{ - static constexpr auto get() -> decltype(&Handler::isSuperBase) { - return &Handler::isSuperBase; - } -}; - -template -struct TokenStreamReportError -{ - static constexpr auto get() -> decltype(&TokenStream::reportError) { - return &TokenStream::reportError; - } -}; - -template -struct TokenStreamReportExtraWarning -{ - static constexpr auto get() -> decltype(&TokenStream::reportExtraWarningErrorNumberVA) { - return &TokenStream::reportExtraWarningErrorNumberVA; - } -}; - // Generic matchers. -struct TokenStreamMatcher +struct ParseHandlerMatcher { template - frontend::TokenStreamAnyChars& match(Parser* parser) { - return parser->anyChars; - } -}; - -struct ScriptSourceMatcher -{ - template - ScriptSource* match(Parser* parser) { - return parser->ss; + frontend::FullParseHandler& match(Parser *parser) { + return parser->handler; } }; @@ -175,16 +112,24 @@ struct ParserBaseMatcher } }; +struct ErrorReporterMatcher +{ + template + frontend::ErrorReporter& match(Parser* parser) { + return parser->tokenStream; + } +}; + } // namespace detail namespace frontend { -template -class EitherParser +class EitherParser : public BCEParserHandle { - mozilla::Variant* const> parser; + // Leave this as a variant, to promote good form until 8-bit parser integration. + mozilla::Variant* const> parser; - using Node = typename ParseHandler::Node; + using Node = typename FullParseHandler::Node; template