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 95354 0b607361839a316c371001f5c91d649197ea9d98
parent 95353 fe129d98513ea03d083d8457422cde017a75c693
child 95355 a35f9c1fef546f1b6203577a7091e1dc88807827
push id10076
push userbobbyholley@gmail.com
push dateThu, 31 May 2012 14:28:33 +0000
treeherdermozilla-inbound@0b607361839a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs760070
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
     }