Bug 850676 - test_mixed_content_blocker_bug803225.html is causing docshell/test/navigation tests to fail. r=tanvi, a=akeybl
authorBlake Kaplan <mrbkap@gmail.com>
Tue, 23 Apr 2013 11:27:43 +0200
changeset 132632 5f7ba4e3664f5a48f355d3842f1e63e51c83cd12
parent 132631 09dd98056595b43b152e6a66bd68f24f78c7c1c8
child 132633 fc0b144921d043ff0d08f1f412ab57bcdf3bdf1f
push id2394
push usermcsmurf@mcsmurf.de
push dateTue, 23 Apr 2013 09:29:11 +0000
treeherdermozilla-beta@5f7ba4e3664f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstanvi, akeybl
bugs850676, 803225
milestone21.0
Bug 850676 - test_mixed_content_blocker_bug803225.html is causing docshell/test/navigation tests to fail. r=tanvi, a=akeybl
content/base/test/file_mixed_content_main_bug803225.html
--- a/content/base/test/file_mixed_content_main_bug803225.html
+++ b/content/base/test/file_mixed_content_main_bug803225.html
@@ -50,16 +50,19 @@ https://bugzilla.mozilla.org/show_bug.cg
       data = {"test": protocols[i][0], "msg": "resource with " + protocols[i][0] + " protocol did not load"};
       parent.postMessage(data, "http://mochi.test:8888");
     }.bind(generic_frame, i);
 
     testContent.appendChild(generic_frame, i);
   }
 
   // Test 3: for resource within a script tag
+  // Note: the script we load throws an exception, but the script element's
+  // onload listener is called after we successfully fetch the script,
+  // independently of whether it throws an exception.
   var resource_script=document.createElement("script");
   resource_script.src = "resource://gre/modules/XPCOMUtils.jsm";
   resource_script.name = "resource_protocol";
   resource_script.onload = function() {
     parent.postMessage({"test": "resource", "msg": "resource with resource protocol loaded"}, "http://mochi.test:8888");
   }
   resource_script.onerror = function() {
     parent.postMessage({"test": "resource", "msg": "resource with resource protocol did not load"}, "http://mochi.test:8888");
@@ -112,26 +115,27 @@ https://bugzilla.mozilla.org/show_bug.cg
   webHandler.uriTemplate = "http://example.com/tests/content/base/test/bug803225_test_mailto.html?s=%";
 
   var uri = ioService.newURI("mailto:foo@bar.com", null, null);
   webHandler.launchWithURI(uri);
 
   var mailto = false;
 
   // listen for a messages from a new window
+  var os = SpecialPowers.Cc["@mozilla.org/observer-service;1"].
+     getService(SpecialPowers.Components.interfaces.nsIObserverService);
   var observer = {
     observe: function(subject, topic, data) {
       if(topic == "content-document-global-created" && data =="http://example.com") {
          parent.postMessage({"test": "mailto", "msg": "resource with mailto protocol loaded"}, "http://mochi.test:8888");
+         os.removeObserver(observer, "content-document-global-created");
          mailto = true;
       }
     }
   }
-  var os = SpecialPowers.Cc["@mozilla.org/observer-service;1"].
-     getService(SpecialPowers.Components.interfaces.nsIObserverService);
   os.addObserver(observer, "content-document-global-created", false);
 
   function mailtoProtocolStatus() {
     if(!mailto) {
       //There is no onerror event associated with the WebHandler, and hence we need a setTimeout to check the status
       setTimeout(mailtoProtocolStatus, TIMEOUT_INTERVAL);
     }
   }