Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 26467c4

Browse files
committed
Bug 862404 - Make nsCxPusher MOZ_CRASH if there's no stack. r=gabor
1 parent fe05b3f commit 26467c4

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

content/base/src/nsContentUtils.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3147,7 +3147,9 @@ nsCxPusher::DoPush(JSContext* cx)
31473147
{
31483148
nsIThreadJSContextStack* stack = nsContentUtils::ThreadJSContextStack();
31493149
if (!stack) {
3150-
return;
3150+
// If someone tries to push a cx when we don't have the relevant state,
3151+
// it's probably safest to just crash.
3152+
MOZ_CRASH();
31513153
}
31523154

31533155
if (cx && IsContextOnStack(stack, cx)) {
@@ -3178,7 +3180,8 @@ void
31783180
nsCxPusher::Pop()
31793181
{
31803182
nsIThreadJSContextStack* stack = nsContentUtils::ThreadJSContextStack();
3181-
if (!mPushedSomething || !stack) {
3183+
MOZ_ASSERT(stack);
3184+
if (!mPushedSomething) {
31823185
mScx = nullptr;
31833186
mPushedSomething = false;
31843187

0 commit comments

Comments
 (0)