Skip to content

Commit

Permalink
Bug 1724718 - fake global.css for android reftests and crashtests, r=…
Browse files Browse the repository at this point in the history
…emilio

Differential Revision: https://phabricator.services.mozilla.com/D122663
  • Loading branch information
gijsk committed Aug 19, 2021
1 parent 4b736bb commit 5824c28
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
12 changes: 6 additions & 6 deletions layout/style/test/test_bug405818.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<link rel="stylesheet" type="text/css" href="data:text/css,%23myDiv{color:green;}">
<link rel="stylesheet" type="text/css" href="chrome://global/skin/global.css">
<link rel="stylesheet" type="text/css" href="chrome://global/skin/tooltip.css">
<!-- Script to make sure sheets gets a chance to load fully in Gecko 1.8 and earlier -->
<script type="text/javascript" src="data:text/javascript,"></script>
<link rel="stylesheet" type="text/css" href="data:text/css,%23myDiv{color:green;}">
<link rel="stylesheet" type="text/css" href="chrome://global/skin/global.css">
<link rel="stylesheet" type="text/css" href="chrome://global/skin/tooltip.css">
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=405818">Mozilla Bug 405818</a>
Expand All @@ -35,10 +35,10 @@
"Unexpected href for later linked sheet before cloning");

is(document.styleSheets[2].href,
"chrome://global/skin/global.css",
"chrome://global/skin/tooltip.css",
"Unexpected href for linked chrome sheet before cloning");
is(document.styleSheets[4].href,
"chrome://global/skin/global.css",
"chrome://global/skin/tooltip.css",
"Unexpected href for later linked chrome sheet before cloning");

// Force cloning of inners
Expand All @@ -53,10 +53,10 @@
"Unexpected href for later linked sheet after cloning");

is(document.styleSheets[2].href,
"chrome://global/skin/global.css",
"chrome://global/skin/tooltip.css",
"Unexpected href for linked chrome sheet after cloning");
is(document.styleSheets[4].href,
"chrome://global/skin/global.css",
"chrome://global/skin/tooltip.css",
"Unexpected href for later linked chrome sheet after cloning");

var myDiv = document.getElementById("myDiv");
Expand Down
16 changes: 14 additions & 2 deletions layout/tools/reftest/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,26 @@ this.reftest = class extends ExtensionAPI {
null,
this.extension.rootURI
);
this.chromeHandle = aomStartup.registerChrome(manifestURI, [

let manifestDirectives = [
[
"content",
"reftest",
"chrome/reftest/content/",
"contentaccessible=yes",
],
]);
];
if (Services.appinfo.OS == "Android") {
manifestDirectives.push([
"override",
"chrome://global/skin/global.css",
"chrome://reftest/content/fake-global.css",
]);
}
this.chromeHandle = aomStartup.registerChrome(
manifestURI,
manifestDirectives
);

// Starting tests is handled quite differently on android and desktop.
// On Android, OnRefTestLoad() takes over the main browser window so
Expand Down
1 change: 1 addition & 0 deletions layout/tools/reftest/fake-global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* This file deliberately left blank. See comment in jar.mn for rationale. */
11 changes: 11 additions & 0 deletions layout/tools/reftest/jar.mn
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,14 @@ reftest.jar:
res/progress.css (../../../layout/reftests/forms/progress/style.css)
* res/manifest.jsm (manifest.jsm)
* res/reftest.jsm (reftest.jsm)

# Android doesn't ship global.css
# Accessing missing non-test chrome:// files crashes, to avoid relying on
# non-existing files.
# A bunch of our older crash- and reftests use it, and it's unclear to what
# extent they rely on it (ie removing the CSS file may stop the tests testing
# what they are supposed to test on OSes that do ship global.css).
# We also would like to move towards shipping less and less XUL/ex-XBL files
# on android, so adding it everywhere doesn't seem like the right direction.
# Instead, add an empty file only for reftests:
content/fake-global.css (fake-global.css)

0 comments on commit 5824c28

Please sign in to comment.