зеркало из https://github.com/mozilla/gecko-dev.git
Bug 969030 - Remove support for calling document.all; r=bz
This commit is contained in:
Родитель
6e7f5b1c60
Коммит
2e8d149147
|
@ -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<JSObject*> 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<JSObject*> self(cx, JS_THIS_OBJECT(cx, vp));
|
||||
if (!self) {
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t length;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"use strict";
|
||||
|
||||
try {
|
||||
document.all();
|
||||
document.all.item();
|
||||
} catch (e) {
|
||||
is(typeof e, "object");
|
||||
is(e.filename, location);
|
||||
|
|
Загрузка…
Ссылка в новой задаче