diff --git a/content/html/document/src/HTMLAllCollection.cpp b/content/html/document/src/HTMLAllCollection.cpp index ca3e92257f6..287b1c54c96 100644 --- a/content/html/document/src/HTMLAllCollection.cpp +++ b/content/html/document/src/HTMLAllCollection.cpp @@ -37,11 +37,10 @@ const JSClass sHTMLDocumentAllClass = { JS_DeletePropertyStub, /* delProperty */ nsHTMLDocumentSH::DocumentAllGetProperty, /* getProperty */ JS_StrictPropertyStub, /* setProperty */ - JS_EnumerateStub, - (JSResolveOp)nsHTMLDocumentSH::DocumentAllNewResolve, - JS_ConvertStub, - nsHTMLDocumentSH::ReleaseDocument, - nsHTMLDocumentSH::CallToGetPropMapper + JS_EnumerateStub, /* enumerate */ + (JSResolveOp)nsHTMLDocumentSH::DocumentAllNewResolve, /* resolve */ + JS_ConvertStub, /* convert */ + nsHTMLDocumentSH::ReleaseDocument /* finalize */ }; namespace mozilla { @@ -372,14 +371,12 @@ bool nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - // Handle document.all("foo") style access to document.all. if (args.length() != 1) { // XXX: Should throw NS_ERROR_XPC_NOT_ENOUGH_ARGS for argc < 1, // and create a new NS_ERROR_XPC_TOO_MANY_ARGS for argc > 1? IE // accepts nothing other than one arg. xpc::Throw(cx, NS_ERROR_INVALID_ARG); - return false; } @@ -389,16 +386,9 @@ nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp) return false; } - // If we are called via document.all(id) instead of document.all.item(i) or - // another method, use the document.all callee object as self. - JS::Rooted self(cx); - if (args.calleev().isObject() && - JS_GetClass(&args.calleev().toObject()) == &sHTMLDocumentAllClass) { - self = &args.calleev().toObject(); - } else { - self = JS_THIS_OBJECT(cx, vp); - if (!self) - return false; + JS::Rooted self(cx, JS_THIS_OBJECT(cx, vp)); + if (!self) { + return false; } size_t length; diff --git a/dom/base/test/test_nondomexception.html b/dom/base/test/test_nondomexception.html index 558db04e7a2..04c669718f6 100644 --- a/dom/base/test/test_nondomexception.html +++ b/dom/base/test/test_nondomexception.html @@ -15,7 +15,7 @@ "use strict"; try { - document.all(); + document.all.item(); } catch (e) { is(typeof e, "object"); is(e.filename, location);