From d910b921072837d628b1361b9164c23066cf1f55 Mon Sep 17 00:00:00 2001 From: "mrbkap%gmail.com" Date: Thu, 16 Mar 2006 18:30:36 +0000 Subject: [PATCH] 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 --- dom/src/base/nsDOMClassInfo.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dom/src/base/nsDOMClassInfo.cpp b/dom/src/base/nsDOMClassInfo.cpp index a6ae83a9f359..11c525a89900 100644 --- a/dom/src/base/nsDOMClassInfo.cpp +++ b/dom/src/base/nsDOMClassInfo.cpp @@ -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,9 +8084,12 @@ 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, - ::JS_GetPrototype(cx, obj), - GetGlobalJSObject(cx, obj)); + // 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)); if (!helper) { return NS_ERROR_OUT_OF_MEMORY;