Bug 1374333 - Use TalosContentProfiler for profiling in tsvgx tests. r?rwood draft
authorMike Conley <mconley@mozilla.com>
Fri, 16 Jun 2017 18:09:45 -0400
changeset 610828 4e24d4e5e3a142c4b48439b2b8e7b05d1d379fe0
parent 610827 ce09d8d2f93aab89e82a09b28b1c3f93717b227a
child 610829 522b851e7fd05e4a3e87e18ab6bc5742eae58542
push id69002
push usermconley@mozilla.com
push dateTue, 18 Jul 2017 19:11:35 +0000
reviewersrwood
bugs1374333
milestone56.0a1
Bug 1374333 - Use TalosContentProfiler for profiling in tsvgx tests. r?rwood MozReview-Commit-ID: 9auT5RxW2lh
testing/talos/talos/tests/svgx/hixie-001.xml
testing/talos/talos/tests/svgx/hixie-002.xml
testing/talos/talos/tests/svgx/hixie-003.xml
testing/talos/talos/tests/svgx/hixie-004.xml
testing/talos/talos/tests/svgx/hixie-005.xml
testing/talos/talos/tests/svgx/hixie-006.xml
testing/talos/talos/tests/svgx/hixie-007.xml
--- a/testing/talos/talos/tests/svgx/hixie-001.xml
+++ b/testing/talos/talos/tests/svgx/hixie-001.xml
@@ -282,11 +282,26 @@ a circle that only has a fill animates o
    } else {
      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(){ rAF(bounce); });
+  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>
 </svg>
--- a/testing/talos/talos/tests/svgx/hixie-002.xml
+++ b/testing/talos/talos/tests/svgx/hixie-002.xml
@@ -284,11 +284,27 @@ changes to its "cx" and "cy" attributes.
    } else {
      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(){ rAF(bounce); });
+
+  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>
 </svg>
--- a/testing/talos/talos/tests/svgx/hixie-003.xml
+++ b/testing/talos/talos/tests/svgx/hixie-003.xml
@@ -70,11 +70,26 @@ removed from the document.
     } else {
       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(){ rAF(runTest); });
+  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>
 </svg>
--- a/testing/talos/talos/tests/svgx/hixie-004.xml
+++ b/testing/talos/talos/tests/svgx/hixie-004.xml
@@ -71,11 +71,26 @@ removed from the document.
     } else {
       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(){ rAF(runTest); });
+  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>
 </svg>
--- a/testing/talos/talos/tests/svgx/hixie-005.xml
+++ b/testing/talos/talos/tests/svgx/hixie-005.xml
@@ -77,11 +77,26 @@ the previous batches are not removed fro
     } else {
       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(){ rAF(runTest); });
+  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>
 </svg>
--- a/testing/talos/talos/tests/svgx/hixie-006.xml
+++ b/testing/talos/talos/tests/svgx/hixie-006.xml
@@ -77,11 +77,26 @@ the previous batches are not removed fro
     } else {
       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(){ rAF(runTest); });
+  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>
 </svg>
--- a/testing/talos/talos/tests/svgx/hixie-007.xml
+++ b/testing/talos/talos/tests/svgx/hixie-007.xml
@@ -269,11 +269,26 @@ contains many 'path' elements with fill 
     } else {
       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(){ rAF(runTest); });
+  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>
 </svg>