Only warn about invalid uses of document.all once per document instead of one time per use to avoid the console service flooding the event queue with error events. bug 330623, r+sr=jst

This commit is contained in:
mrbkap%gmail.com 2006-03-16 18:30:36 +00:00
Родитель 964b8e781b
Коммит d910b92107
1 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -7893,9 +7893,6 @@ nsHTMLDocumentSH::DocumentAllHelperGetProperty(JSContext *cx, JSObject *obj,
// document.all is not being detected, and it resolved with a
// qualified name. Expose the document.all collection.
// Print a warning so developers can stop using document.all
PrintWarningOnConsole(cx, "DocumentAllUsed");
if (!JSVAL_IS_OBJECT(*vp)) {
// First time through, create the collection, and set the
// document as its private nsISupports data.
@ -8060,7 +8057,7 @@ nsHTMLDocumentSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *proto = ::JS_GetPrototype(cx, helper ? helper : obj);
// Check if the property all is defined on obj's (or helper's
// if obj doesn't exist) prototype, it it is, don't expose our
// if obj doesn't exist) prototype, if it is, don't expose our
// document.all helper.
JSBool hasAll = JS_FALSE;
@ -8087,7 +8084,10 @@ nsHTMLDocumentSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
// already defined on our prototype, create a helper.
if (!helper && flags & JSRESOLVE_QUALIFIED &&
!(flags & JSRESOLVE_DETECTING) && !hasAll) {
helper = JS_NewObject(cx, &sHTMLDocumentAllHelperClass,
// Print a warning so developers can stop using document.all
PrintWarningOnConsole(cx, "DocumentAllUsed");
helper = ::JS_NewObject(cx, &sHTMLDocumentAllHelperClass,
::JS_GetPrototype(cx, obj),
GetGlobalJSObject(cx, obj));