Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
6 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
7 XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
9 function oopCommandlineHandler() {
10 }
12 oopCommandlineHandler.prototype = {
13 handle: function(cmdLine) {
14 let oopFlag = cmdLine.handleFlag("oop", false);
15 if (oopFlag) {
16 /**
17 * Manipulate preferences by adding to the *default* branch. Adding
18 * to the default branch means the changes we make won"t get written
19 * back to user preferences.
20 */
21 let prefs = Services.prefs
22 let branch = prefs.getDefaultBranch("");
24 try {
25 // Turn on all OOP services, making desktop run similar to phone
26 // environment
27 branch.setBoolPref("dom.ipc.tabs.disabled", false);
28 branch.setBoolPref("layers.acceleration.disabled", false);
29 branch.setBoolPref("layers.offmainthreadcomposition.enabled", true);
30 branch.setBoolPref("layers.offmainthreadcomposition.async-animations", true);
31 branch.setBoolPref("layers.async-video.enabled", true);
32 branch.setBoolPref("layers.async-pan-zoom.enabled", true);
33 branch.setCharPref("gfx.content.azure.backends", "cairo");
34 } catch (e) { }
36 }
37 if (cmdLine.state == Ci.nsICommandLine.STATE_REMOTE_AUTO) {
38 cmdLine.preventDefault = true;
39 }
40 },
42 helpInfo: " -oop Use out-of-process model in B2G\n",
43 classID: Components.ID("{e30b0e13-2d12-4cb0-bc4c-4e617a1bf76e}"),
44 QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
45 };
47 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([oopCommandlineHandler]);