Bug 1017424 part 3. Remove the now-unnecessary nsIDocument::WrapObject. r=peterv

This commit is contained in:
Boris Zbarsky 2014-09-05 14:28:44 -04:00
parent 4b7183a1e1
commit b9b5085960
2 changed files with 0 additions and 50 deletions

View File

@ -2349,8 +2349,6 @@ public:
virtual nsHTMLDocument* AsHTMLDocument() { return nullptr; } virtual nsHTMLDocument* AsHTMLDocument() { return nullptr; }
virtual mozilla::dom::SVGDocument* AsSVGDocument() { 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 // Each import tree has exactly one master document which is
// the root of the tree, and owns the browser context. // the root of the tree, and owns the browser context.
virtual already_AddRefed<nsIDocument> MasterDocument() = 0; virtual already_AddRefed<nsIDocument> MasterDocument() = 0;

View File

@ -12258,54 +12258,6 @@ nsDocument::Evaluate(const nsAString& aExpression, nsIDOMNode* aContextNode,
aInResult, aResult); 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* XPathEvaluator*
nsIDocument::XPathEvaluator() nsIDocument::XPathEvaluator()
{ {