зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1357287
- [1.1] Add multiprocess GeckoView setting. r=snorp
This commit is contained in:
Родитель
251c58d506
Коммит
27037fbd73
|
@ -10,7 +10,7 @@
|
|||
windowtype="navigator:browser"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<browser id="content" type="content" primary="true" src="about:blank" flex="1" remote="true"/>
|
||||
<browser id="content" type="content" primary="true" src="about:blank" flex="1"/>
|
||||
|
||||
<script type="application/javascript" src="chrome://geckoview/content/geckoview.js"/>
|
||||
</window>
|
||||
|
|
|
@ -22,10 +22,23 @@ public final class GeckoViewSettings {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Key to enabled and disable tracking protection.
|
||||
*/
|
||||
public static final Key<Boolean> USE_TRACKING_PROTECTION =
|
||||
new Key<Boolean>("useTrackingProtection");
|
||||
/*
|
||||
* Key to enabled and disable private mode browsing.
|
||||
*/
|
||||
public static final Key<Boolean> USE_PRIVATE_MODE =
|
||||
new Key<Boolean>("usePrivateMode");
|
||||
/*
|
||||
* Key to enabled and disable multiprocess browsing (e10s).
|
||||
* Note: can only be set during GeckoView initialization, changes during an
|
||||
* active GeckoView session will be ignored.
|
||||
*/
|
||||
public static final Key<Boolean> USE_MULTIPROCESS =
|
||||
new Key<Boolean>("useMultiprocess");
|
||||
|
||||
private final EventDispatcher mEventDispatcher;
|
||||
private final GeckoBundle mBundle;
|
||||
|
@ -40,6 +53,7 @@ public final class GeckoViewSettings {
|
|||
|
||||
setBoolean(USE_TRACKING_PROTECTION, false);
|
||||
setBoolean(USE_PRIVATE_MODE, false);
|
||||
setBoolean(USE_MULTIPROCESS, true);
|
||||
}
|
||||
|
||||
/* package */ GeckoViewSettings(GeckoViewSettings settings, EventDispatcher eventDispatcher) {
|
||||
|
|
|
@ -23,10 +23,15 @@ function debug(aMsg) {
|
|||
|
||||
// Handles GeckoView settings including:
|
||||
// * tracking protection
|
||||
// * multiprocess
|
||||
class GeckoViewSettings extends GeckoViewModule {
|
||||
init() {
|
||||
this._isSafeBrowsingInit = false;
|
||||
this._useTrackingProtection = false;
|
||||
|
||||
// We only allow to set this setting during initialization, further updates
|
||||
// will be ignored.
|
||||
this.useMultiprocess = !!this.settings.useMultiprocess;
|
||||
}
|
||||
|
||||
onSettingsUpdate() {
|
||||
|
@ -52,4 +57,23 @@ class GeckoViewSettings extends GeckoViewModule {
|
|||
this._useTrackingProtection = aUse;
|
||||
}
|
||||
}
|
||||
|
||||
get useMultiprocess() {
|
||||
return this.browser.getAttribute("remote") == "true";
|
||||
}
|
||||
|
||||
set useMultiprocess(aUse) {
|
||||
if (aUse == this.useMultiprocess) {
|
||||
return;
|
||||
}
|
||||
let parentNode = this.browser.parentNode;
|
||||
parentNode.removeChild(this.browser);
|
||||
|
||||
if (aUse) {
|
||||
this.browser.setAttribute("remote", "true");
|
||||
} else {
|
||||
this.browser.removeAttribute("remote");
|
||||
}
|
||||
parentNode.appendChild(this.browser);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче