Bug 1393806 part 3. Change dom::ReparentWrapper to take an ErrorResult. r=peterv

This makes it easier for its consumers to avoid leaving a dangling exception on
the JSContext.

MozReview-Commit-ID: Xep7IkYxSx
This commit is contained in:
Boris Zbarsky
2017-09-13 13:34:55 -04:00
parent 96a4710bc1
commit 2fcd5047d7
9 changed files with 89 additions and 50 deletions

View File

@@ -1724,7 +1724,7 @@ nsHTMLDocument::Open(JSContext* cx,
JS::Rooted<JSObject*> wrapper(cx, GetWrapper());
if (oldScope && newScope != oldScope && wrapper) {
JSAutoCompartment ac(cx, wrapper);
rv = mozilla::dom::ReparentWrapper(cx, wrapper);
mozilla::dom::ReparentWrapper(cx, wrapper, rv);
if (rv.Failed()) {
return nullptr;
}
@@ -1735,7 +1735,7 @@ nsHTMLDocument::Open(JSContext* cx,
JS::Rooted<JSObject*> contentsOwnerWrapper(cx,
mTemplateContentsOwner->GetWrapper());
if (contentsOwnerWrapper) {
rv = mozilla::dom::ReparentWrapper(cx, contentsOwnerWrapper);
mozilla::dom::ReparentWrapper(cx, contentsOwnerWrapper, rv);
if (rv.Failed()) {
return nullptr;
}