Bug 649475 - [android-tests-only] remote jsreftests fail because user.js forces prompt for elevated privileges r=ctalbert
authorJoel Maher <jmaher@mozilla.com>
Tue, 19 Apr 2011 15:17:02 -0700
changeset 68335 d93dea97b533f4a5d8eb4dc15297c7a1767cf724
parent 68334 bad2a5a169f5dd39ade2ca51bad7949e51722d05
child 68336 deee3852caafda96c264d6be29fe5c2fc8564951
push id19594
push userctalbert@mozilla.com
push dateTue, 19 Apr 2011 22:17:56 +0000
treeherdermozilla-central@d93dea97b533 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersctalbert
bugs649475
milestone6.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 649475 - [android-tests-only] remote jsreftests fail because user.js forces prompt for elevated privileges r=ctalbert
layout/tools/reftest/remotereftest.py
--- a/layout/tools/reftest/remotereftest.py
+++ b/layout/tools/reftest/remotereftest.py
@@ -97,16 +97,20 @@ class RemoteOptions(ReftestOptions):
                     help = "Port for https traffic to the web server")
         defaults["sslPort"] = automation.DEFAULT_SSL_PORT
 
         self.add_option("--remote-logfile", action="store",
                     type = "string", dest = "remoteLogFile",
                     help = "Name of log file on the device relative to device root.  PLEASE USE ONLY A FILENAME.")
         defaults["remoteLogFile"] = None
 
+        self.add_option("--enable-privilege", action="store_true", dest = "enablePrivilege",
+                    help = "add webserver and port to the user.js file for remote script access and universalXPConnect")
+        defaults["enablePrivilege"] = False
+
         self.add_option("--pidfile", action = "store",
                     type = "string", dest = "pidFile",
                     help = "name of the pidfile to generate")
         defaults["pidFile"] = ""
 
         defaults["localLogName"] = None
 
         self.set_defaults(**defaults)
@@ -311,16 +315,25 @@ class RemoteReftest(RefTest):
         options.utilityPath = remoteUtilityPath
          
     def stopWebServer(self, options):
         self.server.stop()
 
     def createReftestProfile(self, options, profileDir):
         RefTest.createReftestProfile(self, options, profileDir, server=options.remoteWebServer)
 
+        #workaround for jsreftests.
+        if options.enablePrivilege:
+          fhandle = open(os.path.join(profileDir, "user.js"), 'a')
+          fhandle.write("""
+user_pref("capability.principal.codebase.p2.granted", "UniversalPreferencesWrite UniversalXPConnect UniversalBrowserWrite UniversalPreferencesRead UniversalBrowserRead");
+user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
+""" % (options.remoteWebServer, options.httpPort))
+          fhandle.close()
+
         if (self._devicemanager.pushDir(profileDir, options.remoteProfile) == None):
             raise devicemanager.FileError("Failed to copy profiledir to device")
 
     def copyExtraFilesToProfile(self, options, profileDir):
         RefTest.copyExtraFilesToProfile(self, options, profileDir)
         if (self._devicemanager.pushDir(profileDir, options.remoteProfile) == None):
             raise devicemanager.FileError("Failed to copy extra files to device")