Bug 1465457 - Add support for chrome reftests r=dbaron
authorBrian Grinstead <bgrinstead@mozilla.com>
Tue, 26 Feb 2019 17:13:44 +0000
changeset 519113 ec6c7dcf2f315c17d913553bbf0654c091d2622f
parent 519112 3113a6f2e2c35cba3f14e69602f6fdb6726b0e57
child 519114 ed020882a3184d96905bae0100d16a96b9cbcf8f
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1465457
milestone67.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 1465457 - Add support for chrome reftests r=dbaron Differential Revision: https://phabricator.services.mozilla.com/D20585
layout/tools/reftest/manifest.jsm
layout/tools/reftest/reftest-content.js
layout/tools/reftest/reftest/__init__.py
--- a/layout/tools/reftest/manifest.jsm
+++ b/layout/tools/reftest/manifest.jsm
@@ -639,28 +639,30 @@ function ServeTestBase(aURL, depth) {
     return testbase;
 }
 
 function CreateUrls(test) {
     let secMan = Cc[NS_SCRIPTSECURITYMANAGER_CONTRACTID]
                     .getService(Ci.nsIScriptSecurityManager);
 
     let manifestURL = g.ioService.newURI(test.manifest);
-    let principal = secMan.createCodebasePrincipal(manifestURL, {});
 
     let testbase = manifestURL;
     if (test.runHttp)
         testbase = ServeTestBase(manifestURL, test.httpDepth)
 
     function FileToURI(file)
     {
         if (file === null)
             return file;
 
         var testURI = g.ioService.newURI(file, null, testbase);
+        let isChrome = testURI.scheme == "chrome";
+        let principal = isChrome ? secMan.getSystemPrincipal() :
+                                   secMan.createCodebasePrincipal(manifestURL, {});
         secMan.checkLoadURIWithPrincipal(principal, testURI,
                                          Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
         return testURI;
     }
 
     let files = [test.url1, test.url2];
     [test.url1, test.url2] = files.map(FileToURI);
 
--- a/layout/tools/reftest/reftest-content.js
+++ b/layout/tools/reftest/reftest-content.js
@@ -15,16 +15,19 @@ const IO_SERVICE_CONTRACTID = "@mozilla.
 
 // "<!--CLEAR-->"
 const BLANK_URL_FOR_CLEARING = "data:text/html;charset=UTF-8,%3C%21%2D%2DCLEAR%2D%2D%3E";
 
 Cu.import("resource://gre/modules/Timer.jsm");
 Cu.import("resource://reftest/AsyncSpellCheckTestHelper.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
+// This will load chrome Custom Elements inside chrome documents:
+ChromeUtils.import("resource://gre/modules/CustomElementsListener.jsm", null);
+
 var gBrowserIsRemote;
 var gIsWebRenderEnabled;
 var gHaveCanvasSnapshot = false;
 // Plugin layers can be updated asynchronously, so to make sure that all
 // layer surfaces have the right content, we need to listen for explicit
 // "MozPaintWait" and "MozPaintWaitFinished" events that signal when it's OK
 // to take snapshots. We cannot take a snapshot while the number of
 // "MozPaintWait" events fired exceeds the number of "MozPaintWaitFinished"
--- a/layout/tools/reftest/reftest/__init__.py
+++ b/layout/tools/reftest/reftest/__init__.py
@@ -116,17 +116,17 @@ class ReftestManifest(object):
                     tests.append(items[i+1])
                     break
 
                 if item == '==' or item == '!=' or item == 'print':
                     tests.extend(items[i+1:i+3])
                     break
 
             for f in tests:
-                # We can't package about: or data: URIs.
+                # We can't package about:, data:, or chrome: URIs.
                 # Discarding data isn't correct for a parser. But retaining
                 # all data isn't currently a requirement.
                 if RE_PROTOCOL.match(f):
                     continue
 
                 test = os.path.normpath(os.path.join(mdir, urlprefix + f))
                 self.files.add(test)
                 self.dirs.add(os.path.dirname(test))