Bug 587931: Don't fire error if a <script> is canceled. r=mrbkap a=jst
authorJonas Sicking <jonas@sicking.cc>
Fri, 17 Sep 2010 16:08:03 -0700
changeset 54283 6ac2d9151492d92e5dc26f8104d2bad81b22f41b
parent 54282 905b39a5523c6461200d1325cc545de891d120d1
child 54284 bb22acd87a0202f79696692e08be75d760ef5196
push id15834
push usersicking@mozilla.com
push dateFri, 17 Sep 2010 23:25:38 +0000
treeherdermozilla-central@6ac2d9151492 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap, jst
bugs587931
milestone2.0b7pre
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 587931: Don't fire error if a <script> is canceled. r=mrbkap a=jst
content/base/src/nsScriptLoader.cpp
content/base/test/test_bug587931.html
--- a/content/base/src/nsScriptLoader.cpp
+++ b/content/base/src/nsScriptLoader.cpp
@@ -719,19 +719,16 @@ nsScriptLoader::ProcessRequest(nsScriptL
     }
     aRequest->mElement->EndEvaluating();
 
     nsContentUtils::DispatchTrustedEvent(scriptElem->GetOwnerDoc(),
                                          scriptElem,
                                          NS_LITERAL_STRING("afterscriptexecute"),
                                          PR_TRUE, PR_FALSE);
   }
-  else {
-    rv = NS_ERROR_ABORT;
-  }
 
   FireScriptEvaluated(rv, aRequest);
 
   return rv;
 }
 
 void
 nsScriptLoader::FireScriptAvailable(nsresult aResult,
--- a/content/base/test/test_bug587931.html
+++ b/content/base/test/test_bug587931.html
@@ -59,23 +59,32 @@ expectedCurrentScriptInAfterScriptExecut
 s = document.createElement("script");
 s.src = "data:text/plain,verifyScript('dom-ext');";
 s.id = "dom-ext";
 document.body.appendChild(s);
 </script>
 
 <!-- Test cancel using beforescriptexecute -->
 <script onbeforescriptexecute="return false;"
-        onafterescriptexecute="window.firedAfterScriptExecuteForCancel = true;"
-        onload="window.firedLoadForCancel = true;">
+        onafterescriptexecute="window.firedAfterScriptExecuteForCancel = true;">
 ok(false, "should have been canceled");
 </script>
 <script>
 isnot(window.firedAfterScriptExecuteForCancel, true, "onafterscriptexecute executed");
-isnot(window.firedLoadForCancel, true, "onload executed");
+</script>
+
+<!-- Test cancel using beforescriptexecute for external -->
+<script onbeforescriptexecute="return false;"
+        onafterescriptexecute="window.extFiredAfterScriptExecuteForCancel = true;"
+        onload="window.extFiredLoadForCancel = true;"
+        src="data:text/plain,ok(false, 'should have been canceled');">
+</script>
+<script>
+isnot(window.extFiredAfterScriptExecuteForCancel, true, "onafterscriptexecute executed");
+is(extFiredLoadForCancel, true, "onload executed");
 </script>
 
 <!-- Test that all events fire -->
 <script onbeforescriptexecute="window.beforeDidExecute = true;"
         onafterscriptexecute="window.afterDidExecute = true;"
         onload="window.loadDidExecute = true"
         onerror="window.errorDidExecute = true"
         src="data:text/plain,