Bug 808856 - Make not overriding WrapObject fail to build. r=ehsan.
authorPeter Van der Beken <peterv@propagandism.org>
Tue, 07 Oct 2014 11:44:48 +0200
changeset 209160 b2238670c5bfadfe00fe080a225d7bf3446e03de
parent 209159 ab230e36399bdf43f572a6e759bdff4ffdb2d65c
child 209161 609e5f79d4fddcb85f57b23f4f0921a31339d60e
push id9203
push userryanvm@gmail.com
push dateTue, 07 Oct 2014 20:14:36 +0000
treeherderfx-team@d15aba695f0c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs808856
milestone35.0a1
Bug 808856 - Make not overriding WrapObject fail to build. r=ehsan.
content/base/src/Attr.cpp
content/base/src/Attr.h
content/base/src/nsInProcessTabChildGlobal.h
dom/base/nsWindowRoot.h
dom/base/nsWrapperCache.h
dom/ipc/TabChild.h
js/xpconnect/public/SandboxPrivate.h
--- a/content/base/src/Attr.cpp
+++ b/content/base/src/Attr.cpp
@@ -383,15 +383,15 @@ Attr::Initialize()
 
 void
 Attr::Shutdown()
 {
   sInitialized = false;
 }
 
 JSObject*
-Attr::WrapObject(JSContext* aCx)
+Attr::WrapNode(JSContext* aCx)
 {
   return AttrBinding::Wrap(aCx, this);
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/content/base/src/Attr.h
+++ b/content/base/src/Attr.h
@@ -77,17 +77,17 @@ public:
   static void Shutdown();
 
   NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Attr,
                                                                    nsIAttribute)
 
   virtual nsIDOMNode* AsDOMNode() { return this; }
 
   // WebIDL
-  virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
+  virtual JSObject* WrapNode(JSContext* aCx) MOZ_OVERRIDE;
 
   // XPCOM GetName() is OK
   // XPCOM GetValue() is OK
 
   void SetValue(const nsAString& aValue, ErrorResult& aRv);
 
   bool Specified() const;
 
--- a/content/base/src/nsInProcessTabChildGlobal.h
+++ b/content/base/src/nsInProcessTabChildGlobal.h
@@ -149,16 +149,20 @@ public:
 
   virtual JSObject* GetGlobalJSObject() MOZ_OVERRIDE {
     if (!mGlobal) {
       return nullptr;
     }
 
     return mGlobal->GetJSObject();
   }
+  virtual JSObject* WrapObject(JSContext* cx) MOZ_OVERRIDE
+  {
+    MOZ_CRASH("nsInProcessTabChildGlobal doesn't use DOM bindings!");
+  }
 protected:
   virtual ~nsInProcessTabChildGlobal();
 
   nsresult Init();
   nsresult InitTabChildGlobal();
   nsCOMPtr<nsIContentFrameMessageManager> mMessageManager;
   nsCOMPtr<nsIDocShell> mDocShell;
   bool mInitialized;
--- a/dom/base/nsWindowRoot.h
+++ b/dom/base/nsWindowRoot.h
@@ -56,16 +56,21 @@ public:
 
   virtual void SetParentTarget(mozilla::dom::EventTarget* aTarget) MOZ_OVERRIDE
   {
     mParent = aTarget;
   }
   virtual mozilla::dom::EventTarget* GetParentTarget() MOZ_OVERRIDE { return mParent; }
   virtual nsIDOMWindow* GetOwnerGlobal() MOZ_OVERRIDE;
 
+  virtual JSObject* WrapObject(JSContext* cx) MOZ_OVERRIDE
+  {
+    MOZ_CRASH("nsWindowRoot doesn't use DOM bindings!");
+  }
+
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsWindowRoot,
                                                          nsIDOMEventTarget)
 
 protected:
   virtual ~nsWindowRoot();
 
   // Members
   nsCOMPtr<nsPIDOMWindow> mWindow;
--- a/dom/base/nsWrapperCache.h
+++ b/dom/base/nsWrapperCache.h
@@ -145,21 +145,17 @@ public:
   {
     return HasWrapperFlag(WRAPPER_IS_DOM_BINDING);
   }
 
   /**
    * Wrap the object corresponding to this wrapper cache. If non-null is
    * returned, the object has already been stored in the wrapper cache.
    */
-  virtual JSObject* WrapObject(JSContext* cx)
-  {
-    MOZ_ASSERT(!IsDOMBinding(), "Someone forgot to override WrapObject");
-    return nullptr;
-  }
+  virtual JSObject* WrapObject(JSContext* cx) = 0;
 
   /**
    * Returns true if the object has a non-gray wrapper.
    */
   bool IsBlack();
 
   /**
    * Returns true if the object has a black wrapper,
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -133,16 +133,21 @@ public:
     aVisitor.mForceContentDispatch = true;
     return NS_OK;
   }
 
   virtual JSContext* GetJSContextForEventHandlers() MOZ_OVERRIDE;
   virtual nsIPrincipal* GetPrincipal() MOZ_OVERRIDE;
   virtual JSObject* GetGlobalJSObject() MOZ_OVERRIDE;
 
+  virtual JSObject* WrapObject(JSContext* cx) MOZ_OVERRIDE
+  {
+    MOZ_CRASH("TabChildGlobal doesn't use DOM bindings!");
+  }
+
   nsCOMPtr<nsIContentFrameMessageManager> mMessageManager;
   nsRefPtr<TabChildBase> mTabChild;
 
 protected:
   ~TabChildGlobal();
 };
 
 class ContentListener MOZ_FINAL : public nsIDOMEventListener
--- a/js/xpconnect/public/SandboxPrivate.h
+++ b/js/xpconnect/public/SandboxPrivate.h
@@ -44,15 +44,20 @@ public:
         return GetWrapper();
     }
 
     void ForgetGlobalObject()
     {
         ClearWrapper();
     }
 
+    virtual JSObject* WrapObject(JSContext* cx) MOZ_OVERRIDE
+    {
+        MOZ_CRASH("SandboxPrivate doesn't use DOM bindings!");
+    }
+
 private:
     virtual ~SandboxPrivate() { }
 
     nsCOMPtr<nsIPrincipal> mPrincipal;
 };
 
 #endif // __SANDBOXPRIVATE_H__