Bug 778072 - Add pref for reftests to use iframe mozbrowser. r=cjones
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Fri, 17 Aug 2012 11:45:39 -0400
changeset 102972 6945a923ce83a686ca91889d6facfcf05951b1d7
parent 102971 56f288230d5a9d3519e30abfa4da9344ced351d0
child 102973 4e5692e129b21409254e3022d2e17ec0153634ba
push id23319
push useremorley@mozilla.com
push dateWed, 22 Aug 2012 09:28:21 +0000
treeherdermozilla-central@4d59eb5ac2c6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs778072
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 778072 - Add pref for reftests to use iframe mozbrowser. r=cjones
layout/tools/reftest/reftest.js
layout/tools/reftest/runreftestb2g.py
--- a/layout/tools/reftest/reftest.js
+++ b/layout/tools/reftest/reftest.js
@@ -46,16 +46,18 @@ var gThisChunk = 0;
 var gContainingWindow = null;
 
 // "<!--CLEAR-->"
 const BLANK_URL_FOR_CLEARING = "data:text/html,%3C%21%2D%2DCLEAR%2D%2D%3E";
 
 var gBrowser;
 // Are we testing web content loaded in a separate process?
 var gBrowserIsRemote;           // bool
+// Are we using <iframe mozbrowser>?
+var gBrowserIsIframe;           // bool
 var gBrowserMessageManager;
 var gCanvas1, gCanvas2;
 // gCurrentCanvas is non-null between InitCurrentCanvasWithSnapshot and the next
 // RecordResult.
 var gCurrentCanvas = null;
 var gURLs;
 // Map from URI spec to the number of times it remains to be used
 var gURIUseCounts;
@@ -214,24 +216,35 @@ function OnRefTestLoad(win)
     var prefs = Components.classes["@mozilla.org/preferences-service;1"].
                 getService(Components.interfaces.nsIPrefBranch);
     try {
         gBrowserIsRemote = prefs.getBoolPref("browser.tabs.remote");
     } catch (e) {
         gBrowserIsRemote = false;
     }
 
+    try {
+      gBrowserIsIframe = prefs.getBoolPref("reftest.browser.iframe.enabled");
+    } catch (e) {
+      gBrowserIsIframe = false;
+    }
+
     if (win === undefined || win == null) {
       win = window;
     }
     if (gContainingWindow == null && win != null) {
       gContainingWindow = win;
     }
 
-    gBrowser = gContainingWindow.document.createElementNS(XUL_NS, "xul:browser");
+    if (gBrowserIsIframe) {
+      gBrowser = gContainingWindow.document.createElementNS(XHTML_NS, "iframe");
+      gBrowser.setAttribute("mozbrowser", "");
+    } else {
+      gBrowser = gContainingWindow.document.createElementNS(XUL_NS, "xul:browser");
+    }
     gBrowser.setAttribute("id", "browser");
     gBrowser.setAttribute("type", "content-primary");
     gBrowser.setAttribute("remote", gBrowserIsRemote ? "true" : "false");
     // Make sure the browser element is exactly 800x1000, no matter
     // what size our window is
     gBrowser.setAttribute("style", "min-width: 800px; min-height: 1000px; max-width: 800px; max-height: 1000px");
 
 #if BOOTSTRAP
--- a/layout/tools/reftest/runreftestb2g.py
+++ b/layout/tools/reftest/runreftestb2g.py
@@ -360,25 +360,31 @@ class B2GReftest(RefTest):
 
     def createReftestProfile(self, options, profileDir, reftestlist):
         print "profileDir: " + str(profileDir)
         retVal = RefTest.createReftestProfile(self, options, profileDir, reftestlist, server=options.remoteWebServer)
 
         # Turn off the locale picker screen
         fhandle = open(os.path.join(profileDir, "user.js"), 'a')
         fhandle.write("""
-user_pref("browser.homescreenURL", "data:text/html,<h1>reftests should start soon</h1>");
-user_pref("browser.manifestURL", "dummy (bug 772307)");
 user_pref("browser.firstrun.show.localepicker", false);
-user_pref("browser.dom.window.dump.enabled", true);
+user_pref("browser.homescreenURL","app://system.gaiamobile.org");\n
+user_pref("browser.manifestURL","app://system.gaiamobile.org/manifest.webapp");\n
+user_pref("browser.tabs.remote", true);\n
+user_pref("dom.ipc.browser_frames.oop_by_default", true);\n
+user_pref("dom.ipc.tabs.disabled", false);\n
+user_pref("dom.mozBrowserFramesEnabled", true);\n
+user_pref("dom.mozBrowserFramesWhitelist","app://system.gaiamobile.org");\n
+user_pref("network.dns.localDomains","app://system.gaiamobile.org");\n
 user_pref("font.size.inflation.emPerLine", 0);
 user_pref("font.size.inflation.minTwips", 0);
+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("reftest.uri", "%s");
 """ % reftestlist)
 
         #workaround for jsreftests.
         if getattr(options, 'enablePrivilege', False):
             fhandle.write("""
 user_pref("capability.principal.codebase.p2.granted", "UniversalXPConnect");
 user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
 """ % (options.remoteWebServer, options.httpPort))