mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1017424 part 3. Remove the now-unnecessary nsIDocument::WrapObject. r=peterv
This commit is contained in:
parent
4b7183a1e1
commit
b9b5085960
@ -2349,8 +2349,6 @@ public:
|
||||
virtual nsHTMLDocument* AsHTMLDocument() { return nullptr; }
|
||||
virtual mozilla::dom::SVGDocument* AsSVGDocument() { return nullptr; }
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *aCx) MOZ_OVERRIDE;
|
||||
|
||||
// Each import tree has exactly one master document which is
|
||||
// the root of the tree, and owns the browser context.
|
||||
virtual already_AddRefed<nsIDocument> MasterDocument() = 0;
|
||||
|
@ -12258,54 +12258,6 @@ nsDocument::Evaluate(const nsAString& aExpression, nsIDOMNode* aContextNode,
|
||||
aInResult, aResult);
|
||||
}
|
||||
|
||||
// This is just a hack around the fact that window.document is not
|
||||
// [Unforgeable] yet.
|
||||
JSObject*
|
||||
nsIDocument::WrapObject(JSContext *aCx)
|
||||
{
|
||||
MOZ_ASSERT(IsDOMBinding());
|
||||
|
||||
JS::Rooted<JSObject*> obj(aCx, nsINode::WrapObject(aCx));
|
||||
if (!obj) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(GetInnerWindow());
|
||||
if (!win ||
|
||||
static_cast<nsGlobalWindow*>(win.get())->IsDOMBinding()) {
|
||||
// No window or window on new DOM binding, nothing else to do here.
|
||||
return obj;
|
||||
}
|
||||
|
||||
if (this != win->GetExtantDoc()) {
|
||||
// We're not the current document; we're also done here
|
||||
return obj;
|
||||
}
|
||||
|
||||
JSAutoCompartment ac(aCx, obj);
|
||||
|
||||
JS::Rooted<JS::Value> winVal(aCx);
|
||||
nsresult rv = nsContentUtils::WrapNative(aCx, win, &NS_GET_IID(nsIDOMWindow),
|
||||
&winVal,
|
||||
false);
|
||||
if (NS_FAILED(rv)) {
|
||||
Throw(aCx, rv);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_STRING(doc_str, "document");
|
||||
|
||||
JS::Rooted<JSObject*> winObj(aCx, &winVal.toObject());
|
||||
if (!JS_DefineUCProperty(aCx, winObj, doc_str.get(),
|
||||
doc_str.Length(), obj,
|
||||
JSPROP_READONLY | JSPROP_ENUMERATE,
|
||||
JS_PropertyStub, JS_StrictPropertyStub)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
XPathEvaluator*
|
||||
nsIDocument::XPathEvaluator()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user