Bug 760070 - Make the __exposedProps__ warning appear as an error. r=bz
authorBobby Holley <bobbyholley@gmail.com>
Thu, 31 May 2012 16:28:09 +0200
changeset 97667 0b607361839a316c371001f5c91d649197ea9d98
parent 97666 fe129d98513ea03d083d8457422cde017a75c693
child 97668 a35f9c1fef546f1b6203577a7091e1dc88807827
push idunknown
push userunknown
push dateunknown
reviewersbz
bugs760070
milestone15.0a1
Bug 760070 - Make the __exposedProps__ warning appear as an error. r=bz
content/base/public/nsIDocument.h
content/base/src/nsDocument.cpp
js/xpconnect/wrappers/AccessCheck.cpp
--- a/content/base/public/nsIDocument.h
+++ b/content/base/public/nsIDocument.h
@@ -1595,17 +1595,17 @@ public:
   void FlushPendingLinkUpdates();
 
 #define DEPRECATED_OPERATION(_op) e##_op,
   enum DeprecatedOperations {
 #include "nsDeprecatedOperationList.h"
     eDeprecatedOperationCount
   };
 #undef DEPRECATED_OPERATION
-  void WarnOnceAbout(DeprecatedOperations aOperation);
+  void WarnOnceAbout(DeprecatedOperations aOperation, bool asError = false);
 
   virtual void PostVisibilityUpdateEvent() = 0;
   
   bool IsSyntheticDocument() { return mIsSyntheticDocument; }
 
   void SetNeedLayoutFlush() {
     mNeedLayoutFlush = true;
     if (mDisplayDocument) {
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -8206,24 +8206,27 @@ nsDocument::FindImageMap(const nsAString
 #define DEPRECATED_OPERATION(_op) #_op "Warning",
 static const char* kWarnings[] = {
 #include "nsDeprecatedOperationList.h"
   nsnull
 };
 #undef DEPRECATED_OPERATION
 
 void
-nsIDocument::WarnOnceAbout(DeprecatedOperations aOperation)
+nsIDocument::WarnOnceAbout(DeprecatedOperations aOperation,
+                           bool asError /* = false */)
 {
   PR_STATIC_ASSERT(eDeprecatedOperationCount <= 64);
   if (mWarnedAbout & (1ull << aOperation)) {
     return;
   }
   mWarnedAbout |= (1ull << aOperation);
-  nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
+  uint32_t flags = asError ? nsIScriptError::errorFlag
+                           : nsIScriptError::warningFlag;
+  nsContentUtils::ReportToConsole(flags,
                                   "DOM Core", this,
                                   nsContentUtils::eDOM_PROPERTIES,
                                   kWarnings[aOperation]);
 }
 
 nsresult
 nsDocument::AddImage(imgIRequest* aImage)
 {
--- a/js/xpconnect/wrappers/AccessCheck.cpp
+++ b/js/xpconnect/wrappers/AccessCheck.cpp
@@ -488,17 +488,18 @@ ExposedPropertiesOnly::check(JSContext *
             if (!innerAc.enter(cx, wrapper))
                 return false;
             nsCOMPtr<nsPIDOMWindow> win =
                 do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(cx, wrapper));
             if (win) {
                 nsCOMPtr<nsIDocument> doc =
                     do_QueryInterface(win->GetExtantDocument());
                 if (doc) {
-                    doc->WarnOnceAbout(nsIDocument::eNoExposedProps);
+                    doc->WarnOnceAbout(nsIDocument::eNoExposedProps,
+                                       /* asError = */ true);
                 }
             }
 
             perm = PermitPropertyAccess;
             return true;
         }
         return PermitIfUniversalXPConnect(cx, id, act, perm); // Deny
     }