mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
Bug 952840, part 1 - Eliminate goto in XPCWrappedNative::FindTearOff. r=bholley
This commit is contained in:
parent
2dff4ccc3f
commit
243ffdd612
@ -1496,7 +1496,9 @@ XPCWrappedNative::FindTearOff(XPCNativeInterface* aInterface,
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
goto return_result;
|
||||
if (pError)
|
||||
*pError = rv;
|
||||
return to;
|
||||
}
|
||||
if (!firstAvailable && to->IsAvailable())
|
||||
firstAvailable = to;
|
||||
@ -1506,18 +1508,13 @@ XPCWrappedNative::FindTearOff(XPCNativeInterface* aInterface,
|
||||
to = firstAvailable;
|
||||
|
||||
if (!to) {
|
||||
XPCWrappedNativeTearOffChunk* newChunk =
|
||||
new XPCWrappedNativeTearOffChunk();
|
||||
if (!newChunk) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto return_result;
|
||||
}
|
||||
auto newChunk = new XPCWrappedNativeTearOffChunk();
|
||||
lastChunk->mNextChunk = newChunk;
|
||||
to = newChunk->mTearOffs;
|
||||
}
|
||||
|
||||
{
|
||||
// Scope keeps |tearoff| from leaking across the return_result: label
|
||||
// Scope keeps |tearoff| from leaking across the rest of the function.
|
||||
AutoMarkingWrappedNativeTearOffPtr tearoff(cx, to);
|
||||
rv = InitTearOff(to, aInterface, needJSObject);
|
||||
// During shutdown, we don't sweep tearoffs. So make sure to unmark
|
||||
@ -1528,8 +1525,6 @@ XPCWrappedNative::FindTearOff(XPCNativeInterface* aInterface,
|
||||
to = nullptr;
|
||||
}
|
||||
|
||||
return_result:
|
||||
|
||||
if (pError)
|
||||
*pError = rv;
|
||||
return to;
|
||||
|
Loading…
Reference in New Issue
Block a user