Bug 815807 - Part 3: Load marionette early in the B2G startup process if relevant pref is set, otherwise load it late, r=ahal

This commit is contained in:
Jonathan Griffin 2012-11-29 19:46:39 -08:00
Родитель 936f3894c8
Коммит bc268a8264
4 изменённых файлов: 21 добавлений и 11 удалений

Просмотреть файл

@ -406,6 +406,7 @@ user_pref("reftest.browser.iframe.enabled", true);
user_pref("reftest.remote", true);
user_pref("reftest.uri", "%s");
user_pref("toolkit.telemetry.prompted", true);
user_pref("marionette.loadearly", true);
""" % reftestlist)
#workaround for jsreftests.

Просмотреть файл

@ -330,11 +330,11 @@ waitFor(
def add_prefs_to_profile(self, prefs=None):
if not prefs:
prefs = ["user_pref('marionette.loadearly', true);"]
prefs = ['user_pref("marionette.loadearly", true);']
local_user_js = tempfile.mktemp(prefix='localuserjs')
self.dm.getFile(self.remote_user_js, local_user_js)
with open(local_user_js, 'a') as f:
f.write('/n'.join(prefs))
f.write('%s\n' % '\n'.join(prefs))
self.dm.pushFile(local_user_js, self.remote_user_js)
def start(self):
@ -379,10 +379,6 @@ waitFor(
self._run_adb(['shell', 'setprop', 'net.dns1', '10.0.2.3'])
def setup(self, marionette, gecko_path=None, load_early=False):
# Wait for the system-message-listener-ready event, otherwise
# Bad Things happen.
self.wait_for_system_message(marionette)
if gecko_path:
if load_early:
# Inject prefs into the profile now, since we have to restart
@ -393,9 +389,7 @@ waitFor(
self.add_prefs_to_profile()
self.restart_b2g()
#if load_early:
# Temporarily enable this always until part 2 of bug 815807 lands
if True:
if load_early:
# If we're loading early, we have to wait for the
# system-message-listener-ready event again after restarting B2G.
# If we're not loading early, we skip this because Marionette

Просмотреть файл

@ -8,6 +8,7 @@ const MARIONETTE_CONTRACTID = "@mozilla.org/marionette;1";
const MARIONETTE_CID = Components.ID("{786a1369-dca5-4adc-8486-33d23c88010a}");
const DEBUGGER_ENABLED_PREF = 'devtools.debugger.remote-enabled';
const MARIONETTE_ENABLED_PREF = 'marionette.defaultPrefs.enabled';
const MARIONETTE_LOADEARLY_PREF = 'marionette.loadearly';
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
@ -39,21 +40,34 @@ MarionetteComponent.prototype = {
switch (aTopic) {
case "profile-after-change":
let enabled = false;
let loadearly = false;
try {
enabled = Services.prefs.getBoolPref(MARIONETTE_ENABLED_PREF);
loadearly = Services.prefs.getBoolPref(MARIONETTE_LOADEARLY_PREF);
} catch(e) {}
if (enabled) {
this.logger.info("marionette enabled");
this.logger.info("marionette enabled, loadearly: " + loadearly);
//add observers
observerService.addObserver(this, "final-ui-startup", false);
if (loadearly) {
observerService.addObserver(this, "final-ui-startup", false);
}
else {
observerService.addObserver(this, "system-message-listener-ready", false);
}
observerService.addObserver(this, "xpcom-shutdown", false);
}
else {
this.logger.info("marionette not enabled");
}
break;
case "system-message-listener-ready":
this.logger.info("marionette initializing at system-message-listener-ready");
observerService.removeObserver(this, "system-message-listener-ready");
this.init();
break;
case "final-ui-startup":
this.logger.info("marionette initializing at final-ui-startup");
observerService.removeObserver(this, "final-ui-startup");
this.init();
break;

Просмотреть файл

@ -429,6 +429,7 @@ user_pref("dom.ipc.tabs.disabled", false);
user_pref("dom.ipc.browser_frames.oop_by_default", false);
user_pref("dom.mozBrowserFramesWhitelist","app://test-container.gaiamobile.org,http://mochi.test:8888");
user_pref("network.dns.localDomains","app://test-container.gaiamobile.org");
user_pref("marionette.loadearly", true);
""")
f.close()