diff --git a/browser_patches/firefox/BUILD_NUMBER b/browser_patches/firefox/BUILD_NUMBER index 9b75b77391..cca9df410e 100644 --- a/browser_patches/firefox/BUILD_NUMBER +++ b/browser_patches/firefox/BUILD_NUMBER @@ -1,2 +1 @@ -1103 -1104 +1105 diff --git a/browser_patches/firefox/juggler/components/juggler.js b/browser_patches/firefox/juggler/components/juggler.js index c0f6163d5f..30c310925f 100644 --- a/browser_patches/firefox/juggler/components/juggler.js +++ b/browser_patches/firefox/juggler/components/juggler.js @@ -67,6 +67,12 @@ CommandLineHandler.prototype = { }); Services.mm.loadFrameScript(FRAME_SCRIPT, true /* aAllowDelayedLoad */); + if (Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo).isHeadless) { + const styleSheetService = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService); + const ioService = Cc["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); + const uri = ioService.newURI('chrome://juggler/content/content/hidden-scrollbars.css', null, null); + styleSheetService.loadAndRegisterSheet(uri, styleSheetService.AGENT_SHEET); + } dump(`Juggler listening on ws://127.0.0.1:${this._server.port}/${token}\n`); }, diff --git a/browser_patches/firefox/juggler/content/FrameTree.js b/browser_patches/firefox/juggler/content/FrameTree.js index ff00af51c2..7852aabd1d 100644 --- a/browser_patches/firefox/juggler/content/FrameTree.js +++ b/browser_patches/firefox/juggler/content/FrameTree.js @@ -70,6 +70,8 @@ class FrameTree { _frameForWorker(workerDebugger) { if (workerDebugger.type !== Ci.nsIWorkerDebugger.TYPE_DEDICATED) return null; + if (!workerDebugger.window) + return null; const docShell = workerDebugger.window.docShell; return this._docShellToFrame.get(docShell) || null; } diff --git a/browser_patches/firefox/juggler/content/ScrollbarManager.js b/browser_patches/firefox/juggler/content/ScrollbarManager.js deleted file mode 100644 index 9933f0c87b..0000000000 --- a/browser_patches/firefox/juggler/content/ScrollbarManager.js +++ /dev/null @@ -1,89 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -const Ci = Components.interfaces; -const Cr = Components.results; -const Cu = Components.utils; -const Cc = Components.classes; - -const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js'); -const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); - -const HIDDEN_SCROLLBARS = Services.io.newURI('chrome://juggler/content/content/hidden-scrollbars.css'); -const FLOATING_SCROLLBARS = Services.io.newURI('chrome://juggler/content/content/floating-scrollbars.css'); - -const isHeadless = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo).isHeadless; -const helper = new Helper(); - -class ScrollbarManager { - constructor(docShell) { - this._docShell = docShell; - this._customScrollbars = null; - this._contentViewerScrollBars = new Map(); - - if (isHeadless) - this._setCustomScrollbars(HIDDEN_SCROLLBARS); - - const webProgress = this._docShell.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIWebProgress); - - this.QueryInterface = ChromeUtils.generateQI(['nsIWebProgressListener', 'nsISupportsWeakReference']); - this._eventListeners = [ - helper.addProgressListener(webProgress, this, Ci.nsIWebProgress.NOTIFY_ALL), - ]; - } - - onLocationChange(webProgress, request, URI, flags) { - if (flags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT) - return; - this._updateAllDocShells(); - } - - setFloatingScrollbars(enabled) { - if (this._customScrollbars === HIDDEN_SCROLLBARS) - return; - this._setCustomScrollbars(enabled ? FLOATING_SCROLLBARS : null); - } - - _setCustomScrollbars(customScrollbars) { - if (this._customScrollbars === customScrollbars) - return; - this._customScrollbars = customScrollbars; - this._updateAllDocShells(); - } - - _updateAllDocShells() { - const allDocShells = [this._docShell]; - for (let i = 0; i < this._docShell.childCount; i++) - allDocShells.push(this._docShell.getChildAt(i).QueryInterface(Ci.nsIDocShell)); - // At this point, a content viewer might not be loaded for certain docShells. - // Scrollbars will be updated in onLocationChange. - const contentViewers = allDocShells.map(docShell => docShell.contentViewer).filter(contentViewer => !!contentViewer); - - // Update scrollbar stylesheets. - for (const contentViewer of contentViewers) { - const oldScrollbars = this._contentViewerScrollBars.get(contentViewer); - if (oldScrollbars === this._customScrollbars) - continue; - const winUtils = contentViewer.DOMDocument.defaultView.windowUtils; - if (oldScrollbars) - winUtils.removeSheet(oldScrollbars, winUtils.AGENT_SHEET); - if (this._customScrollbars) - winUtils.loadSheet(this._customScrollbars, winUtils.AGENT_SHEET); - } - // Update state for all *existing* docShells. - this._contentViewerScrollBars.clear(); - for (const contentViewer of contentViewers) - this._contentViewerScrollBars.set(contentViewer, this._customScrollbars); - } - - dispose() { - this._setCustomScrollbars(null); - helper.removeListeners(this._eventListeners); - } -} - -var EXPORTED_SYMBOLS = ['ScrollbarManager']; -this.ScrollbarManager = ScrollbarManager; - diff --git a/browser_patches/firefox/juggler/content/floating-scrollbars.css b/browser_patches/firefox/juggler/content/floating-scrollbars.css deleted file mode 100644 index 6df3163f57..0000000000 --- a/browser_patches/firefox/juggler/content/floating-scrollbars.css +++ /dev/null @@ -1,51 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); -@namespace html url("http://www.w3.org/1999/xhtml"); - -/* Restrict all styles to `*|*:not(html|select) > scrollbar` so that scrollbars - inside a . */ -*|*:not(html|select) > scrollbar { - -moz-appearance: none !important; - position: relative; - background-color: transparent; - background-image: none; - z-index: 2147483647; - padding: 2px; - border: none; -} - -/* Scrollbar code will reset the margin to the correct side depending on - where layout actually puts the scrollbar */ -*|*:not(html|select) > scrollbar[orient="vertical"] { - margin-left: -10px; - min-width: 10px; - max-width: 10px; -} - -*|*:not(html|select) > scrollbar[orient="horizontal"] { - margin-top: -10px; - min-height: 10px; - max-height: 10px; -} - -*|*:not(html|select) > scrollbar slider { - -moz-appearance: none !important; -} - -*|*:not(html|select) > scrollbar thumb { - -moz-appearance: none !important; - background-color: rgba(0,0,0,0.2); - border-width: 0px !important; - border-radius: 3px !important; -} - -*|*:not(html|select) > scrollbar scrollbarbutton, -*|*:not(html|select) > scrollbar gripper { - display: none; -} diff --git a/browser_patches/firefox/juggler/content/hidden-scrollbars.css b/browser_patches/firefox/juggler/content/hidden-scrollbars.css index 7363d7603e..26fc0db768 100644 --- a/browser_patches/firefox/juggler/content/hidden-scrollbars.css +++ b/browser_patches/firefox/juggler/content/hidden-scrollbars.css @@ -2,16 +2,6 @@ * 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/. */ -@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); -@namespace html url("http://www.w3.org/1999/xhtml"); - -/* Restrict all styles to `*|*:not(html|select) > scrollbar` so that scrollbars - inside a . */ -*|*:not(html|select) > scrollbar { - -moz-appearance: none !important; - display: none; +* { + scrollbar-width: none !important; } - diff --git a/browser_patches/firefox/juggler/content/main.js b/browser_patches/firefox/juggler/content/main.js index 2379ad978f..630ba41b3e 100644 --- a/browser_patches/firefox/juggler/content/main.js +++ b/browser_patches/firefox/juggler/content/main.js @@ -6,11 +6,9 @@ const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js'); const {FrameTree} = ChromeUtils.import('chrome://juggler/content/content/FrameTree.js'); const {NetworkMonitor} = ChromeUtils.import('chrome://juggler/content/content/NetworkMonitor.js'); -const {ScrollbarManager} = ChromeUtils.import('chrome://juggler/content/content/ScrollbarManager.js'); const {SimpleChannel} = ChromeUtils.import('chrome://juggler/content/SimpleChannel.js'); const {PageAgent} = ChromeUtils.import('chrome://juggler/content/content/PageAgent.js'); -const scrollbarManager = new ScrollbarManager(docShell); let frameTree; let networkMonitor; const helper = new Helper(); @@ -182,7 +180,6 @@ function initialize() { for (const sessionId of sessions.keys()) disposeContentSession(sessionId); - scrollbarManager.dispose(); networkMonitor.dispose(); frameTree.dispose(); }),