Bug 1435434 - remove usage of enablePrivilege in talos which was solely for calling loadSubScript; r?mccr8
MozReview-Commit-ID: AiFNzMZ2tIN
--- a/testing/talos/talos/pageloader/chrome/pageloader.js
+++ b/testing/talos/talos/pageloader/chrome/pageloader.js
@@ -235,16 +235,17 @@ function plInit() {
content.selectedBrowser.messageManager.loadFrameScript("chrome://pageloader/content/lh_moz.js", false, true);
} else if (useHero) {
content.selectedBrowser.messageManager.loadFrameScript("chrome://pageloader/content/lh_hero.js", false, true);
} else {
content.selectedBrowser.messageManager.loadFrameScript("chrome://pageloader/content/lh_dummy.js", false, true);
}
content.selectedBrowser.messageManager.loadFrameScript("chrome://pageloader/content/talos-content.js", false);
+ content.selectedBrowser.messageManager.loadFrameScript("chrome://talos-powers-content/content/TalosContentProfiler.js", false, true);
content.selectedBrowser.messageManager.loadFrameScript("chrome://pageloader/content/tscroll.js", false, true);
content.selectedBrowser.messageManager.loadFrameScript("chrome://pageloader/content/Profiler.js", false, true);
setTimeout(plLoadPage, 100);
}, 500);
};
browserWindow.addEventListener("load", browserLoadFunc, true);
--- a/testing/talos/talos/pageloader/chrome/tscroll.js
+++ b/testing/talos/talos/pageloader/chrome/tscroll.js
@@ -1,21 +1,12 @@
// Note: This file is used at both tscrollx and tp5o_scroll. With the former as
// unprivileged code.
// - Please make sure that any changes apply cleanly to all use cases.
-if (typeof(TalosContentProfiler) == "undefined") {
- try {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- } catch (e) {}
- /* eslint-disable mozilla/use-chromeutils-import */
- Components.utils.import("resource://gre/modules/Services.jsm");
- Services.scriptloader.loadSubScript("chrome://talos-powers-content/content/TalosContentProfiler.js");
-}
-
function testScroll(target, stepSize, opt_reportFunc, opt_numSteps) {
var win;
if (target == "content") {
target = content.wrappedJSObject;
win = content;
} else {
win = window;
}
--- a/testing/talos/talos/tests/gfx/benchmarks/rasterflood_gradient.html
+++ b/testing/talos/talos/tests/gfx/benchmarks/rasterflood_gradient.html
@@ -100,29 +100,18 @@ function setup() {
function startTest() {
setup();
gStart = performance.now();
window.requestAnimationFrame(runFrame);
}
addEventListener("load", function() {
try {
- // Outside of talos, this throws a security exception which no-op this file.
- // (It's not required nor allowed for addons since Firefox 17)
- // It's used inside talos from non-privileged pages (like during tscroll),
- // and it works because talos disables all/most security measures.
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- } catch (e) {}
-
- try {
- /* eslint-disable mozilla/use-chromeutils-import */
- Components.utils.import("resource://gre/modules/Services.jsm");
- Services.scriptloader.loadSubScript("chrome://talos-powers-content/content/TalosContentProfiler.js");
-
TalosContentProfiler.resume("rasterflood_gradient.html loaded", true).then(() => {
startTest();
});
} catch (e) {
startTest();
}
});
</script>
+<script type="text/javascript" src="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
</html>
--- a/testing/talos/talos/tests/gfx/benchmarks/rasterflood_svg.html
+++ b/testing/talos/talos/tests/gfx/benchmarks/rasterflood_svg.html
@@ -127,30 +127,19 @@ function runFrame() {
function startTest() {
gStart = performance.now();
window.requestAnimationFrame(runFrame);
}
addEventListener("load", function() {
try {
- // Outside of talos, this throws a security exception which no-op this file.
- // (It's not required nor allowed for addons since Firefox 17)
- // It's used inside talos from non-privileged pages (like during tscroll),
- // and it works because talos disables all/most security measures.
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- } catch (e) {}
-
- try {
- /* eslint-disable mozilla/use-chromeutils-import */
- Components.utils.import("resource://gre/modules/Services.jsm");
- Services.scriptloader.loadSubScript("chrome://talos-powers-content/content/TalosContentProfiler.js");
-
TalosContentProfiler.resume("rasterflood_svg.html loaded", true).then(() => {
startTest();
});
} catch (e) {
startTest();
}
});
</script>
+<script type="text/javascript" src="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
</body></html>
--- a/testing/talos/talos/tests/layout/benchmarks/displaylist_mutate.html
+++ b/testing/talos/talos/tests/layout/benchmarks/displaylist_mutate.html
@@ -42,28 +42,17 @@ function runFrame() {
}
return;
}
window.requestAnimationFrame(runFrame);
}
addEventListener("load", function() {
- try {
- // Outside of talos, this throws a security exception which no-op this file.
- // (It's not required nor allowed for addons since Firefox 17)
- // It's used inside talos from non-privileged pages (like during tscroll),
- // and it works because talos disables all/most security measures.
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- } catch (e) {}
-
- /* eslint-disable mozilla/use-chromeutils-import */
- Components.utils.import("resource://gre/modules/Services.jsm");
- Services.scriptloader.loadSubScript("chrome://talos-powers-content/content/TalosContentProfiler.js");
-
TalosContentProfiler.resume("displaylist_mutate.html loaded", true).then(() => {
start = performance.now();
window.requestAnimationFrame(runFrame);
});
});
</script>
+<script type="text/javascript" src="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
</html>
--- a/testing/talos/talos/tests/scroll/iframe.svg
+++ b/testing/talos/talos/tests/scroll/iframe.svg
@@ -29,11 +29,11 @@
}
}
</script>
<foreignObject x="5%" height="85%" width="90%">
<iframe onload="iframeLoad();" id="ifrm" width="99%" height="99%" xmlns="http://www.w3.org/1999/xhtml" src="drac.htm"/>
</foreignObject>
<!-- this has to come after the iframe for some reason -->
<script type="text/javascript" xlink:href="../../scripts/talos-debug.js"/>
- <script language="Javascript" type="text/javascript" src="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
+ <script type="text/javascript" xlink:href="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
<script type="text/javascript" xlink:href="../../pageloader/chrome/tscroll.js"/>
</svg>
--- a/testing/talos/talos/tests/svgx/hixie-001.xml
+++ b/testing/talos/talos/tests/svgx/hixie-001.xml
@@ -1,9 +1,9 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="-200 -200 600 600">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-200 -200 600 600">
<!--
This test attempts to test how fast an SVG implementation can repaint as
a circle that only has a fill animates over complex SVG via changes to its
"cx" and "cy" attributes.
-->
<script type="text/javascript">
var start = new Date();
</script>
@@ -283,25 +283,15 @@ a circle that only has a fill animates o
var end = new Date();
var elapsed = (end - start) / 1000;
t.firstChild.data = 'Test completed in ' + elapsed.toFixed(2) + 's.';
if (window.tpRecordTime) window.tpRecordTime(end - start, start);
if (parent.reportResults) parent.reportResults(end - start, start);
}
}
addEventListener("load", function() {
- try {
- // Outside of talos, this throws a security exception which no-op this file.
- // (It's not required nor allowed for addons since Firefox 17)
- // It's used inside talos from non-privileged pages (like during tscroll),
- // and it works because talos disables all/most security measures.
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- } catch (e) {}
-
- Components.utils.import("resource://gre/modules/Services.jsm");
- Services.scriptloader.loadSubScript("chrome://talos-powers-content/content/TalosContentProfiler.js");
-
TalosContentProfiler.resume("hixie-001.xml loaded", true).then(() => {
rAF(bounce);
});
});
]]></script>
+ <script type="text/javascript" xlink:href="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
</svg>
--- a/testing/talos/talos/tests/svgx/hixie-002.xml
+++ b/testing/talos/talos/tests/svgx/hixie-002.xml
@@ -1,9 +1,9 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="-200 -200 600 600">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-200 -200 600 600">
<!--
This test attempts to test how fast an SVG implementation can repaint as a
circle that has a fill and fill-opacity animates over complex SVG via
changes to its "cx" and "cy" attributes.
(Note the "fill" vs "fill and fill-opacity" difference.)
-->
<script type="text/javascript">
@@ -286,25 +286,15 @@ changes to its "cx" and "cy" attributes.
var elapsed = (end - start) / 1000;
t.firstChild.data = 'Test completed in ' + elapsed.toFixed(2) + 's.';
if (window.tpRecordTime) window.tpRecordTime(end - start, start);
if (parent.reportResults) parent.reportResults(end - start, start);
}
}
addEventListener("load", function() {
- try {
- // Outside of talos, this throws a security exception which no-op this file.
- // (It's not required nor allowed for addons since Firefox 17)
- // It's used inside talos from non-privileged pages (like during tscroll),
- // and it works because talos disables all/most security measures.
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- } catch (e) {}
-
- Components.utils.import("resource://gre/modules/Services.jsm");
- Services.scriptloader.loadSubScript("chrome://talos-powers-content/content/TalosContentProfiler.js");
-
TalosContentProfiler.resume("hixie-002.xml loaded", true).then(() => {
rAF(bounce);
});
});
]]></script>
+ <script type="text/javascript" xlink:href="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
</svg>
--- a/testing/talos/talos/tests/svgx/hixie-003.xml
+++ b/testing/talos/talos/tests/svgx/hixie-003.xml
@@ -1,9 +1,9 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" width="400" height="400">
<!--
This test attempts to test how fast batches of individually transformed 'text'
elements can be created, added to the document and repainted. The time required
for each new batch is expected to increase since the previous batches are not
removed from the document.
-->
<script type="text/javascript">
var start = new Date();
@@ -71,25 +71,15 @@ removed from the document.
var end = new Date();
var elapsed = (end - start) / 1000;
t.firstChild.data = 'Test completed in ' + elapsed.toFixed(2) + 's.';
if (window.tpRecordTime) window.tpRecordTime(end - start, start);
if (parent.reportResults) parent.reportResults(end - start, start);
}
}
addEventListener("load", function() {
- try {
- // Outside of talos, this throws a security exception which no-op this file.
- // (It's not required nor allowed for addons since Firefox 17)
- // It's used inside talos from non-privileged pages (like during tscroll),
- // and it works because talos disables all/most security measures.
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- } catch (e) {}
-
- Components.utils.import("resource://gre/modules/Services.jsm");
- Services.scriptloader.loadSubScript("chrome://talos-powers-content/content/TalosContentProfiler.js");
-
TalosContentProfiler.resume("hixie-003.xml loaded", true).then(() => {
rAF(runTest);
});
});
]]></script>
+ <script type="text/javascript" xlink:href="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
</svg>
--- a/testing/talos/talos/tests/svgx/hixie-004.xml
+++ b/testing/talos/talos/tests/svgx/hixie-004.xml
@@ -1,9 +1,9 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" width="400" height="400">
<!--
This test attempts to test how fast batches of individually transformed 'image'
elements can be created, added to the document and repainted. The time required
for each new batch is expected to increase since the previous batches are not
removed from the document.
-->
<script type="text/javascript">
var start = new Date();
@@ -72,25 +72,15 @@ removed from the document.
var end = new Date();
var elapsed = (end - start) / 1000;
t.firstChild.data = 'Test completed in ' + elapsed.toFixed(2) + 's.';
if (window.tpRecordTime) window.tpRecordTime(end - start, start);
if (parent.reportResults) parent.reportResults(end - start, start);
}
}
addEventListener("load", function() {
- try {
- // Outside of talos, this throws a security exception which no-op this file.
- // (It's not required nor allowed for addons since Firefox 17)
- // It's used inside talos from non-privileged pages (like during tscroll),
- // and it works because talos disables all/most security measures.
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- } catch (e) {}
-
- Components.utils.import("resource://gre/modules/Services.jsm");
- Services.scriptloader.loadSubScript("chrome://talos-powers-content/content/TalosContentProfiler.js");
-
TalosContentProfiler.resume("hixie-004.xml loaded", true).then(() => {
rAF(runTest);
});
});
]]></script>
+ <script type="text/javascript" xlink:href="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
</svg>
--- a/testing/talos/talos/tests/svgx/hixie-005.xml
+++ b/testing/talos/talos/tests/svgx/hixie-005.xml
@@ -1,9 +1,9 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" width="400" height="400">
<!--
This test attempts to test how fast batches of individually transformed 'rect'
elements with a linearGradient fill can be created, added to the document and
repainted. The time required for each new batch is expected to increase since
the previous batches are not removed from the document.
-->
<script type="text/javascript">
var start = new Date();
@@ -78,25 +78,15 @@ the previous batches are not removed fro
var end = new Date();
var elapsed = (end - start) / 1000;
t.firstChild.data = 'Test completed in ' + elapsed.toFixed(2) + 's.';
if (window.tpRecordTime) window.tpRecordTime(end - start, start);
if (parent.reportResults) parent.reportResults(end - start, start);
}
}
addEventListener("load", function() {
- try {
- // Outside of talos, this throws a security exception which no-op this file.
- // (It's not required nor allowed for addons since Firefox 17)
- // It's used inside talos from non-privileged pages (like during tscroll),
- // and it works because talos disables all/most security measures.
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- } catch (e) {}
-
- Components.utils.import("resource://gre/modules/Services.jsm");
- Services.scriptloader.loadSubScript("chrome://talos-powers-content/content/TalosContentProfiler.js");
-
TalosContentProfiler.resume("hixie-005.xml loaded", true).then(() => {
rAF(runTest);
});
});
]]></script>
+ <script type="text/javascript" xlink:href="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
</svg>
--- a/testing/talos/talos/tests/svgx/hixie-006.xml
+++ b/testing/talos/talos/tests/svgx/hixie-006.xml
@@ -1,9 +1,9 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" width="400" height="400">
<!--
This test attempts to test how fast batches of individually transformed 'rect'
elements with a radialGradient fill can be created, be added to the document and
repainted. The time required for each new batch is expected to increase since
the previous batches are not removed from the document.
-->
<script type="text/javascript">
var start = new Date();
@@ -78,25 +78,15 @@ the previous batches are not removed fro
var end = new Date();
var elapsed = (end - start) / 1000;
t.firstChild.data = 'Test completed in ' + elapsed.toFixed(2) + 's.';
if (window.tpRecordTime) window.tpRecordTime(end - start, start);
if (parent.reportResults) parent.reportResults(end - start, start);
}
}
addEventListener("load", function() {
- try {
- // Outside of talos, this throws a security exception which no-op this file.
- // (It's not required nor allowed for addons since Firefox 17)
- // It's used inside talos from non-privileged pages (like during tscroll),
- // and it works because talos disables all/most security measures.
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- } catch (e) {}
-
- Components.utils.import("resource://gre/modules/Services.jsm");
- Services.scriptloader.loadSubScript("chrome://talos-powers-content/content/TalosContentProfiler.js");
-
TalosContentProfiler.resume("hixie-006.xml loaded", true).then(() => {
rAF(runTest);
});
});
]]></script>
+ <script type="text/javascript" xlink:href="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
</svg>
--- a/testing/talos/talos/tests/svgx/hixie-007.xml
+++ b/testing/talos/talos/tests/svgx/hixie-007.xml
@@ -1,9 +1,9 @@
-<svg viewBox="0 0 800 400" width="800" xmlns="http://www.w3.org/2000/svg" xmlns:country="http://example.com/">
+<svg viewBox="0 0 800 400" width="800" xmlns="http://www.w3.org/2000/svg" xmlns:country="http://example.com/" xmlns:xlink="http://www.w3.org/1999/xlink" >
<!--
This test attempts to test how fast an implementation can repaint for changes
to the "width" attributes of a root-<svg> with a viewBox and that
contains many 'path' elements with fill and stroke.
-->
<script type="text/javascript">
var start = new Date();
</script>
@@ -270,25 +270,15 @@ contains many 'path' elements with fill
var end = new Date();
var elapsed = (end - start) / 1000;
t.firstChild.data = 'Result: ' + elapsed.toFixed(2) + 's';
if (window.tpRecordTime) window.tpRecordTime(end - start, start);
if (parent.reportResults) parent.reportResults(end - start, start);
}
}
addEventListener("load", function() {
- try {
- // Outside of talos, this throws a security exception which no-op this file.
- // (It's not required nor allowed for addons since Firefox 17)
- // It's used inside talos from non-privileged pages (like during tscroll),
- // and it works because talos disables all/most security measures.
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- } catch (e) {}
-
- Components.utils.import("resource://gre/modules/Services.jsm");
- Services.scriptloader.loadSubScript("chrome://talos-powers-content/content/TalosContentProfiler.js");
-
TalosContentProfiler.resume("hixie-007.xml loaded", true).then(() => {
rAF(runTest);
});
});
]]></script>
+ <script type="text/javascript" xlink:href="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
</svg>