Bug 980278 - Remove DataContainerEvent dependency from Mochitest. r=jmaher
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Fri, 21 Mar 2014 13:00:00 +0900
changeset 174697 66006ee3eb18d5bc9aa9ea1c951d9b5e47658235
parent 174696 70d66415ada6ab4abe61141ea84863645cc9782f
child 174698 322885ddb693cbe66c2d1acf2e3c4c6b0bb336f9
push id26458
push usercbook@mozilla.com
push dateFri, 21 Mar 2014 14:15:06 +0000
treeherdermozilla-central@584c7a6d5a09 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs980278
milestone31.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 980278 - Remove DataContainerEvent dependency from Mochitest. r=jmaher
testing/mochitest/browser-test.js
testing/mochitest/redirect.html
testing/mochitest/tests/SimpleTest/TestRunner.js
--- a/testing/mochitest/browser-test.js
+++ b/testing/mochitest/browser-test.js
@@ -53,17 +53,17 @@ function testOnLoad() {
 
       // Window is the [ChromeWindow] for messageManager, so we need content.window 
       // Currently chrome tests are run in a content window instead of a ChromeWindow
       var webNav = content.window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                          .getInterface(Components.interfaces.nsIWebNavigation);
       webNav.loadURI(url, null, null, null, null);
     };
 
-    var listener = 'data:,function doLoad(e) { var data=e.getData("data");removeEventListener("contentEvent", function (e) { doLoad(e); }, false, true);sendAsyncMessage("chromeEvent", {"data":data}); };addEventListener("contentEvent", function (e) { doLoad(e); }, false, true);';
+    var listener = 'data:,function doLoad(e) { var data=e.detail&&e.detail.data;removeEventListener("contentEvent", function (e) { doLoad(e); }, false, true);sendAsyncMessage("chromeEvent", {"data":data}); };addEventListener("contentEvent", function (e) { doLoad(e); }, false, true);';
     messageManager.loadFrameScript(listener, true);
     messageManager.addMessageListener("chromeEvent", messageHandler);
   }
   if (gConfig.e10s) {
     e10s_init();
   }
 }
 
--- a/testing/mochitest/redirect.html
+++ b/testing/mochitest/redirect.html
@@ -2,21 +2,24 @@
 <head>
   <title>redirecting...</title>
 
   <script type="text/javascript">
     function redirect(aURL)
     {
       // We create a listener for this event in browser-test.js 
       // which will get picked up when specifying --chrome or --a11y
-      var element = document.createEvent("datacontainerevent");
-      element.initEvent("contentEvent", true, false);
-      element.setData("data", aURL + location.search);
-      element.setData("type", "loadURI");
-      document.dispatchEvent(element);
+      var event = new CustomEvent("contentEvent", {
+        bubbles: true,
+        detail: {
+          "data": aURL + location.search,
+          "type": "loadURI"
+        }
+      });
+      document.dispatchEvent(event);
     }
 
     function onLoad() {
       redirect("chrome://mochikit/content/harness.xul");
     }
   </script>
 </head>
 
--- a/testing/mochitest/tests/SimpleTest/TestRunner.js
+++ b/testing/mochitest/tests/SimpleTest/TestRunner.js
@@ -12,22 +12,25 @@ function getElement(id) {
 
 this.$ = this.getElement;
 
 function contentDispatchEvent(type, data, sync) {
   if (typeof(data) == "undefined") {
     data = {};
   }
 
-  var element = document.createEvent("datacontainerevent");
-  element.initEvent("contentEvent", true, false);
-  element.setData("sync", sync);
-  element.setData("type", type);
-  element.setData("data", JSON.stringify(data));
-  document.dispatchEvent(element);
+  var event = new CustomEvent("contentEvent", {
+    bubbles: true,
+    detail: {
+      "sync": sync,
+      "type": type,
+      "data": JSON.stringify(data)
+    }
+  });
+  document.dispatchEvent(event);
 }
 
 function contentAsyncEvent(type, data) {
   contentDispatchEvent(type, data, 0);
 }
 
 /* Helper Function */
 function extend(obj, /* optional */ skip) {