Bug 914325 - Leave ourselves some room to make the call into chrome. r=luke
authorBobby Holley <bobbyholley@gmail.com>
Wed, 11 Sep 2013 15:24:09 -0700
changeset 146710 0be65c045f1321042ea043bfccda97632b019cf8
parent 146709 c05f8dce65ca6546c4ddd5ad7363c98aa00232a6
child 146711 4eee1c589bb0fa20cf99b1b01535c69cf4631b43
push id25270
push useremorley@mozilla.com
push dateThu, 12 Sep 2013 11:04:52 +0000
treeherdermozilla-central@b83f6d80af5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs914325
milestone26.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 914325 - Leave ourselves some room to make the call into chrome. r=luke
js/xpconnect/tests/chrome/test_bug732665.xul
--- a/js/xpconnect/tests/chrome/test_bug732665.xul
+++ b/js/xpconnect/tests/chrome/test_bug732665.xul
@@ -54,16 +54,23 @@ https://bugzilla.mozilla.org/show_bug.cg
   chromeSb.ok = contentSb.ok = ok;
   Cu.evalInSandbox(nearNativeStackLimit.toSource(), chromeSb);
   Cu.evalInSandbox(nearNativeStackLimit.toSource(), contentSb);
   var chromeLimit = Cu.evalInSandbox("nearNativeStackLimit(0);", chromeSb);
   var contentLimit = Cu.evalInSandbox("nearNativeStackLimit(0)", contentSb);
   ok(chromeLimit >= contentLimit + 10,
      "Chrome should be able to have at least 10 heavy frames more stack than content: " + chromeLimit + ", " + contentLimit);
 
-  // Exhaust the stack space in content, and then make sure we can still get 10 heavy frames in chrome.
+  // Exhaust the stack space in content, and then make sure we can still get 10
+  // heavy frames in chrome.
+  //
+  // Note that sometimes, if we pass |0| to nearNativeStackLimit, we can end up
+  // so close to the border in content that we can't even get ourselves together
+  // enough to make the cross-compartment call. So rather than exhausting the
+  // stack entirely and then checking for 10 chrome frames, we leave ourselves
+  // one frame's worth, and check for 11.
   contentSb.nnslChrome = chromeSb.nearNativeStackLimit;
-  var nestedLimit = Cu.evalInSandbox("nearNativeStackLimit(0, function() { nestedLimit = nnslChrome(0);}); nestedLimit;", contentSb);
-  ok(nestedLimit >= 10, "Chrome should be invokable from content script with an exhausted stack: " + nestedLimit);
+  var nestedLimit = Cu.evalInSandbox("nearNativeStackLimit(1, function() { nestedLimit = nnslChrome(0);}); nestedLimit;", contentSb);
+  ok(nestedLimit >= 11, "Chrome should be invokable from content script with an exhausted stack: " + nestedLimit);
 
   ]]>
   </script>
 </window>