From 49e92d12a339c954064b79df51ff8304889c5cf0 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 11 Sep 2013 15:24:09 -0700 Subject: [PATCH] Bug 914325 - Leave ourselves some room to make the call into chrome. r=luke --- js/xpconnect/tests/chrome/test_bug732665.xul | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/js/xpconnect/tests/chrome/test_bug732665.xul b/js/xpconnect/tests/chrome/test_bug732665.xul index f3884038f11..3a77918987c 100644 --- a/js/xpconnect/tests/chrome/test_bug732665.xul +++ b/js/xpconnect/tests/chrome/test_bug732665.xul @@ -59,10 +59,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=732665 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); ]]>