Bug 1103946 Part 1: Change --content-sandbox mach / mochitest option to --strict-content-sandbox. r=jmaher
authorBob Owen <bobowencode@gmail.com>
Wed, 10 Dec 2014 09:34:03 +0000
changeset 219067 173bf96bed724c07e7be57d17c3611c2eea236f5
parent 219066 dfcd18d9115941ee89ff4fe7aa908cddd6519300
child 219068 28545193d61d93069c37816dbfd7a8b1eb441641
push id27954
push userryanvm@gmail.com
push dateWed, 10 Dec 2014 21:10:24 +0000
treeherdermozilla-central@0cf461e62ce5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1103946
milestone37.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 1103946 Part 1: Change --content-sandbox mach / mochitest option to --strict-content-sandbox. r=jmaher Also, change tests that are skipped using (contentSandbox != off) to (strictContentSandbox).
dom/media/test/mochitest.ini
dom/media/tests/mochitest/mochitest.ini
dom/media/webaudio/test/mochitest.ini
testing/mochitest/mach_commands.py
testing/mochitest/mochitest_options.py
testing/mochitest/runtests.py
--- a/dom/media/test/mochitest.ini
+++ b/dom/media/test/mochitest.ini
@@ -17,17 +17,17 @@
 # throws an error (and does not cause a crash or hang), just add it to
 # gErrorTests in manifest.js.
 
 # To test for a specific bug in handling a specific resource type, make the
 # test first check canPlayType for the type, and if it's not supported, just
 # do ok(true, "Type not supported") and stop the test.
 
 [DEFAULT]
-skip-if = buildapp == 'mulet' || (os == 'win' && contentSandbox != 'off') # contentSandbox(Bug 1042735)
+skip-if = buildapp == 'mulet' || (os == 'win' && strictContentSandbox) # strictContentSandbox (Bug 1042735)
 support-files =
   320x240.ogv
   320x240.ogv^headers^
   448636.ogv
   448636.ogv^headers^
   VID_0001.ogg
   VID_0001.ogg^headers^
   allowed.sjs
--- a/dom/media/tests/mochitest/mochitest.ini
+++ b/dom/media/tests/mochitest/mochitest.ini
@@ -1,11 +1,11 @@
 [DEFAULT]
-# contentSandbox - bug 1042735, Android 2.3 - bug 981881
-skip-if = (os == 'win' && contentSandbox != 'off') || android_version == '10'
+# strictContentSandbox - bug 1042735, Android 2.3 - bug 981881
+skip-if = (os == 'win' && strictContentSandbox) || android_version == '10'
 support-files =
   head.js
   constraints.js
   mediaStreamPlayback.js
   nonTrickleIce.js
   pc.js
   templates.js
   NetworkPreparationChromeScript.js
--- a/dom/media/webaudio/test/mochitest.ini
+++ b/dom/media/webaudio/test/mochitest.ini
@@ -1,10 +1,10 @@
 [DEFAULT]
-skip-if = ((buildapp == 'mulet' || buildapp == 'b2g') && (toolkit != 'gonk' || debug)) || (os == 'win' && contentSandbox != 'off') #b2g-debug,b2g-desktop(bug 916135); contentSandbox(Bug 1042735)
+skip-if = ((buildapp == 'mulet' || buildapp == 'b2g') && (toolkit != 'gonk' || debug)) || (os == 'win' && strictContentSandbox) #b2g-debug,b2g-desktop(bug 916135); strictContentSandbox(Bug 1042735)
 support-files =
   audio-expected.wav
   audio-mono-expected-2.wav
   audio-mono-expected.wav
   audio-quad.wav
   audio.ogv
   audioBufferSourceNodeNeutered_worker.js
   invalid.txt
--- a/testing/mochitest/mach_commands.py
+++ b/testing/mochitest/mach_commands.py
@@ -186,17 +186,17 @@ class MochitestRunner(MozbuildObject):
         options.xrePath = xre_path
         return mochitest.run_remote_mochitests(parser, options)
 
     def run_desktop_test(self, context, suite=None, test_paths=None, debugger=None,
         debugger_args=None, slowscript=False, screenshot_on_fail = False, shuffle=False, closure_behaviour='auto',
         rerun_failures=False, no_autorun=False, repeat=0, run_until_failure=False,
         slow=False, chunk_by_dir=0, total_chunks=None, this_chunk=None, extraPrefs=[],
         jsdebugger=False, debug_on_failure=False, start_at=None, end_at=None,
-        e10s=False, content_sandbox='off', dmd=False, dump_output_directory=None,
+        e10s=False, strict_content_sandbox=False, dmd=False, dump_output_directory=None,
         dump_about_memory_after_test=False, dump_dmd_after_test=False,
         install_extension=None, quiet=False, environment=[], app_override=None, bisectChunk=None, runByDir=False,
         useTestMediaDevices=False, timeout=None, **kwargs):
         """Runs a mochitest.
 
         test_paths are path to tests. They can be a relative path from the
         top source directory, an absolute filename, or a directory containing
         test files.
@@ -308,19 +308,17 @@ class MochitestRunner(MozbuildObject):
         options.chunkByDir = chunk_by_dir
         options.totalChunks = total_chunks
         options.thisChunk = this_chunk
         options.jsdebugger = jsdebugger
         options.debugOnFailure = debug_on_failure
         options.startAt = start_at
         options.endAt = end_at
         options.e10s = e10s
-        options.contentSandbox = content_sandbox
-        if options.contentSandbox != 'off':
-            options.e10s = True
+        options.strictContentSandbox = strict_content_sandbox
         options.dumpAboutMemoryAfterTest = dump_about_memory_after_test
         options.dumpDMDAfterTest = dump_dmd_after_test
         options.dumpOutputDirectory = dump_output_directory
         options.quiet = quiet
         options.environment = environment
         options.extraPrefs = extraPrefs
         options.bisectChunk = bisectChunk
         options.runByDir = runByDir
@@ -497,23 +495,23 @@ def MochitestCommand(func):
 					 metavar='PREF=VALUE', dest='extraPrefs',
 					 help='defines an extra user preference')
     func = setpref(func)
 
     jsdebugger = CommandArgument('--jsdebugger', action='store_true',
         help='Start the browser JS debugger before running the test. Implies --no-autorun.')
     func = jsdebugger(func)
 
-    this_chunk = CommandArgument('--e10s', action='store_true',
+    e10s = CommandArgument('--e10s', action='store_true',
         help='Run tests with electrolysis preferences and test filtering enabled.')
-    func = this_chunk(func)
+    func = e10s(func)
 
-    this_chunk = CommandArgument('--content-sandbox', default='off', choices=['off', 'warn', 'on'],
-        help='Run tests with the content sandbox enabled or in warn only mode (Windows only). --e10s is assumed.')
-    func = this_chunk(func)
+    strict_content_sandbox = CommandArgument('--strict-content-sandbox', action='store_true',
+        help='Run tests with a more strict content sandbox (Windows only).')
+    func = strict_content_sandbox(func)
 
     dmd = CommandArgument('--dmd', action='store_true',
         help='Run tests with DMD active.')
     func = dmd(func)
 
     dumpAboutMemory = CommandArgument('--dump-about-memory-after-test', action='store_true',
         help='Dump an about:memory log after every test.')
     func = dumpAboutMemory(func)
--- a/testing/mochitest/mochitest_options.py
+++ b/testing/mochitest/mochitest_options.py
@@ -358,21 +358,21 @@ class MochitestOptions(optparse.OptionPa
           "help": "breaks execution and enters the JS debugger on a test failure. Should be used together with --jsdebugger."
         }],
         [["--e10s"],
         { "action": "store_true",
           "default": False,
           "dest": "e10s",
           "help": "Run tests with electrolysis preferences and test filtering enabled.",
         }],
-        [["--content-sandbox"],
-        { "choices": ["off", "warn", "on"],
-          "default": "off",
-          "dest": "contentSandbox",
-          "help": "Run tests with the content sandbox enabled or in warn only mode (Windows only). --e10s is assumed.",
+        [["--strict-content-sandbox"],
+        { "action": "store_true",
+          "default": False,
+          "dest": "strictContentSandbox",
+          "help": "Run tests with a more strict content sandbox (Windows only).",
         }],
         [["--dmd-path"],
          { "action": "store",
            "default": None,
            "dest": "dmdPath",
            "help": "Specifies the path to the directory containing the shared library for DMD.",
         }],
         [["--dump-output-directory"],
@@ -474,21 +474,18 @@ class MochitestOptions(optparse.OptionPa
             if "default" in value and isinstance(value["default"], list):
                 value["default"] = []
             self.add_option(*option, **value)
         self.set_usage(self.__doc__)
 
     def verifyOptions(self, options, mochitest):
         """ verify correct options and cleanup paths """
 
-        if options.contentSandbox != 'off':
-            options.e10s = True
-
         mozinfo.update({"e10s": options.e10s}) # for test manifest parsing.
-        mozinfo.update({"contentSandbox": options.contentSandbox}) # for test manifest parsing.
+        mozinfo.update({"strictContentSandbox": options.strictContentSandbox}) # for test manifest parsing.
 
         if options.app is None:
             if build_obj is not None:
                 options.app = build_obj.get_binary_path()
             else:
                 self.error("could not find the application path, --appname must be specified")
 
         if options.totalChunks is not None and options.thisChunk is None:
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -1154,17 +1154,18 @@ class Mochitest(MochitestUtilsMixin):
     os.unlink(pwfilePath)
     return 0
 
   def buildProfile(self, options):
     """ create the profile and add optional chrome bits and files if requested """
     if options.browserChrome and options.timeout:
       options.extraPrefs.append("testing.browserTestHarness.timeout=%d" % options.timeout)
     options.extraPrefs.append("browser.tabs.remote.autostart=%s" % ('true' if options.e10s else 'false'))
-    options.extraPrefs.append("browser.tabs.remote.sandbox=%s" % options.contentSandbox)
+    if options.strictContentSandbox:
+        options.extraPrefs.append("security.sandbox.windows.content.moreStrict=true")
 
     # get extensions to install
     extensions = self.getExtensionsToInstall(options)
 
     # web apps
     appsPath = os.path.join(SCRIPT_DIR, 'profile_data', 'webapps_mochitest.json')
     if os.path.exists(appsPath):
       with open(appsPath) as apps_file: