browser(firefox): Browser.setScrollbarsHidden (#6457)
This commit is contained in:
parent
2b887bf835
commit
5b223f92c8
|
|
@ -1,2 +1,2 @@
|
|||
1251
|
||||
Changed: lushnikov@chromium.org Wed 12 May 2021 04:13:18 PM PDT
|
||||
1252
|
||||
Changed: joel.einbinder@gmail.com Fri 14 May 2021 08:01:19 AM PDT
|
||||
|
|
|
|||
|
|
@ -45,12 +45,6 @@ CommandLineHandler.prototype = {
|
|||
|
||||
const loadFrameScript = () => {
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
// Force create hidden window here, otherwise its creation later closes the web socket!
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ class FrameTree {
|
|||
Ci.nsISupportsWeakReference,
|
||||
]);
|
||||
|
||||
this._addedScrollbarsStylesheetSymbol = Symbol('_addedScrollbarsStylesheetSymbol');
|
||||
|
||||
this._wdm = Cc["@mozilla.org/dom/workers/workerdebuggermanager;1"].createInstance(Ci.nsIWorkerDebuggerManager);
|
||||
this._wdmListener = {
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIWorkerDebuggerManagerListener]),
|
||||
|
|
@ -103,12 +105,24 @@ class FrameTree {
|
|||
}
|
||||
|
||||
_onDOMWindowCreated(window) {
|
||||
if (!window[this._addedScrollbarsStylesheetSymbol] && this.scrollbarsHidden) {
|
||||
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);
|
||||
const sheet = styleSheetService.preloadSheet(uri, styleSheetService.AGENT_SHEET);
|
||||
window.windowUtils.addSheet(sheet, styleSheetService.AGENT_SHEET);
|
||||
window[this._addedScrollbarsStylesheetSymbol] = true;
|
||||
}
|
||||
const frame = this._docShellToFrame.get(window.docShell) || null;
|
||||
if (!frame)
|
||||
return;
|
||||
frame._onGlobalObjectCleared();
|
||||
}
|
||||
|
||||
setScrollbarsHidden(hidden) {
|
||||
this.scrollbarsHidden = hidden;
|
||||
}
|
||||
|
||||
_onWorkerCreated(workerDebugger) {
|
||||
// Note: we do not interoperate with firefox devtools.
|
||||
if (workerDebugger.isInitialized)
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ class PageAgent {
|
|||
const docShell = frameTree.mainFrame().docShell();
|
||||
this._docShell = docShell;
|
||||
this._initialDPPX = docShell.contentViewer.overrideDPPX;
|
||||
this._customScrollbars = null;
|
||||
this._dragging = false;
|
||||
|
||||
// Dispatch frameAttached events for all initial frames
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@ const applySetting = {
|
|||
docShell.allowJavascript = !javaScriptDisabled;
|
||||
},
|
||||
|
||||
scrollbarsHidden: (hidden) => {
|
||||
frameTree.setScrollbarsHidden(hidden);
|
||||
},
|
||||
|
||||
colorScheme: (colorScheme) => {
|
||||
frameTree.setColorScheme(colorScheme);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -233,6 +233,10 @@ class BrowserHandler {
|
|||
await this._targetRegistry.browserContextForId(browserContextId).setDefaultViewport(nullToUndefined(viewport));
|
||||
}
|
||||
|
||||
async ['Browser.setScrollbarsHidden']({browserContextId, hidden}) {
|
||||
await this._targetRegistry.browserContextForId(browserContextId).applySetting('scrollbarsHidden', nullToUndefined(hidden));
|
||||
}
|
||||
|
||||
async ['Browser.addScriptToEvaluateOnNewDocument']({browserContextId, script}) {
|
||||
await this._targetRegistry.browserContextForId(browserContextId).addScriptToEvaluateOnNewDocument(script);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -364,6 +364,12 @@ const Browser = {
|
|||
viewport: t.Nullable(pageTypes.Viewport),
|
||||
}
|
||||
},
|
||||
'setScrollbarsHidden': {
|
||||
params: {
|
||||
browserContextId: t.Optional(t.String),
|
||||
hidden: t.Boolean,
|
||||
}
|
||||
},
|
||||
'addScriptToEvaluateOnNewDocument': {
|
||||
params: {
|
||||
browserContextId: t.Optional(t.String),
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
1261
|
||||
Changed: lushnikov@chromium.org Wed 12 May 2021 04:12:52 PM PDT
|
||||
1262
|
||||
Changed: joel.einbinder@gmail.com Fri 14 May 2021 08:00:09 AM PDT
|
||||
|
|
|
|||
|
|
@ -45,12 +45,6 @@ CommandLineHandler.prototype = {
|
|||
|
||||
const loadFrameScript = () => {
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
// Force create hidden window here, otherwise its creation later closes the web socket!
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ class FrameTree {
|
|||
Ci.nsISupportsWeakReference,
|
||||
]);
|
||||
|
||||
this._addedScrollbarsStylesheetSymbol = Symbol('_addedScrollbarsStylesheetSymbol');
|
||||
|
||||
this._wdm = Cc["@mozilla.org/dom/workers/workerdebuggermanager;1"].createInstance(Ci.nsIWorkerDebuggerManager);
|
||||
this._wdmListener = {
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIWorkerDebuggerManagerListener]),
|
||||
|
|
@ -103,12 +105,24 @@ class FrameTree {
|
|||
}
|
||||
|
||||
_onDOMWindowCreated(window) {
|
||||
if (!window[this._addedScrollbarsStylesheetSymbol] && this.scrollbarsHidden) {
|
||||
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);
|
||||
const sheet = styleSheetService.preloadSheet(uri, styleSheetService.AGENT_SHEET);
|
||||
window.windowUtils.addSheet(sheet, styleSheetService.AGENT_SHEET);
|
||||
window[this._addedScrollbarsStylesheetSymbol] = true;
|
||||
}
|
||||
const frame = this._docShellToFrame.get(window.docShell) || null;
|
||||
if (!frame)
|
||||
return;
|
||||
frame._onGlobalObjectCleared();
|
||||
}
|
||||
|
||||
setScrollbarsHidden(hidden) {
|
||||
this.scrollbarsHidden = hidden;
|
||||
}
|
||||
|
||||
_onWorkerCreated(workerDebugger) {
|
||||
// Note: we do not interoperate with firefox devtools.
|
||||
if (workerDebugger.isInitialized)
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ class PageAgent {
|
|||
const docShell = frameTree.mainFrame().docShell();
|
||||
this._docShell = docShell;
|
||||
this._initialDPPX = docShell.contentViewer.overrideDPPX;
|
||||
this._customScrollbars = null;
|
||||
this._dragging = false;
|
||||
|
||||
// Dispatch frameAttached events for all initial frames
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@ const applySetting = {
|
|||
docShell.allowJavascript = !javaScriptDisabled;
|
||||
},
|
||||
|
||||
scrollbarsHidden: (hidden) => {
|
||||
frameTree.setScrollbarsHidden(hidden);
|
||||
},
|
||||
|
||||
colorScheme: (colorScheme) => {
|
||||
frameTree.setColorScheme(colorScheme);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -233,6 +233,10 @@ class BrowserHandler {
|
|||
await this._targetRegistry.browserContextForId(browserContextId).setDefaultViewport(nullToUndefined(viewport));
|
||||
}
|
||||
|
||||
async ['Browser.setScrollbarsHidden']({browserContextId, hidden}) {
|
||||
await this._targetRegistry.browserContextForId(browserContextId).applySetting('scrollbarsHidden', nullToUndefined(hidden));
|
||||
}
|
||||
|
||||
async ['Browser.addScriptToEvaluateOnNewDocument']({browserContextId, script}) {
|
||||
await this._targetRegistry.browserContextForId(browserContextId).addScriptToEvaluateOnNewDocument(script);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -364,6 +364,12 @@ const Browser = {
|
|||
viewport: t.Nullable(pageTypes.Viewport),
|
||||
}
|
||||
},
|
||||
'setScrollbarsHidden': {
|
||||
params: {
|
||||
browserContextId: t.Optional(t.String),
|
||||
hidden: t.Boolean,
|
||||
}
|
||||
},
|
||||
'addScriptToEvaluateOnNewDocument': {
|
||||
params: {
|
||||
browserContextId: t.Optional(t.String),
|
||||
|
|
|
|||
Loading…
Reference in a new issue