Bug 851892 part 20. Remove the remaining bits we added to support a mix of WebIDL and non-WebIDL rules. r=peterv
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 13 Jan 2017 10:41:05 -0500
changeset 375440 5b65e31bdffb5fdb7cc48c0eba66b0959ac1c997
parent 375439 8bf7bcdac8d3183f593ea614a112cf24d786c7c3
child 375441 5392e837645f9e1788ac288bb1c8ed0e3c026d20
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs851892
milestone53.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 851892 part 20. Remove the remaining bits we added to support a mix of WebIDL and non-WebIDL rules. r=peterv
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfo.h
dom/bindings/Bindings.conf
layout/style/Rule.h
layout/style/nsCSSRules.cpp
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -64,17 +64,16 @@
 #include "nsIDOMXULButtonElement.h"
 #include "nsIDOMXULCheckboxElement.h"
 #include "nsIDOMXULPopupElement.h"
 
 // Event related includes
 #include "nsIDOMEventTarget.h"
 
 // CSS related includes
-#include "nsCSSRules.h"
 #include "nsIDOMCSSRule.h"
 #include "nsMemory.h"
 
 // includes needed for the prototype chain interfaces
 #include "nsIDOMXULCommandDispatcher.h"
 #include "nsIControllers.h"
 #ifdef MOZ_XUL
 #include "nsITreeSelection.h"
@@ -1888,42 +1887,16 @@ nsEventTargetSH::PreCreate(nsISupports *
 
 void
 nsEventTargetSH::PreserveWrapper(nsISupports *aNative)
 {
   DOMEventTargetHelper* target = DOMEventTargetHelper::FromSupports(aNative);
   target->PreserveWrapper(aNative);
 }
 
-// CSS rule helper
-NS_IMETHODIMP
-nsCSSRuleSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
-                       JSObject *aGlobalObj, JSObject **parentObj)
-{
-  JS::Rooted<JSObject*> globalObj(cx, aGlobalObj);
-  nsCOMPtr<nsIDOMCSSRule> rule = do_QueryInterface(nativeObj);
-  if (!rule) {
-    return NS_ERROR_UNEXPECTED;
-  }
-  css::Rule* cssRule = rule->GetCSSRule();
-  MOZ_ASSERT(cssRule);
-  nsIDocument* doc = cssRule->GetDocument();
-  if (!doc) {
-    *parentObj = globalObj;
-    return NS_OK;
-  }
-
-  nsIGlobalObject* global = doc->GetScopeObject();
-  if (!global) {
-    return NS_ERROR_UNEXPECTED;
-  }
-  *parentObj = global->GetGlobalJSObject();
-  return *parentObj ? NS_OK : NS_ERROR_FAILURE;
-}
-
 // nsIDOMEventListener::HandleEvent() 'this' converter helper
 
 NS_INTERFACE_MAP_BEGIN(nsEventListenerThisTranslator)
   NS_INTERFACE_MAP_ENTRY(nsIXPCFunctionThisTranslator)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 
--- a/dom/base/nsDOMClassInfo.h
+++ b/dom/base/nsDOMClassInfo.h
@@ -177,38 +177,16 @@ protected:
   }
 public:
   NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
                        JSObject *globalObj, JSObject **parentObj) override;
 
   virtual void PreserveWrapper(nsISupports *aNative) override;
 };
 
-// Makes sure that we always create our wrapper in the right global, so we won't
-// cache one from the wrong global.
-class nsCSSRuleSH : public nsDOMGenericSH
-{
-protected:
-  explicit nsCSSRuleSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
-  {
-  }
-
-  virtual ~nsCSSRuleSH()
-  {
-  }
-public:
-  NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
-                       JSObject *globalObj, JSObject **parentObj) override;
-
-  static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
-  {
-    return new nsCSSRuleSH(aData);
-  }
-};
-
 // A place to hang some static methods that we should really consider
 // moving to be nsGlobalWindow member methods.  See bug 1062418.
 class nsWindowSH
 {
 protected:
   static nsresult GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
                                 JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
                                 JS::MutableHandle<JS::PropertyDescriptor> desc);
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -259,17 +259,16 @@ DOMInterfaces = {
     'headerFile': 'nsCSSRules.h',
 },
 
 'CSSPrimitiveValue': {
     'nativeType': 'nsROCSSPrimitiveValue',
 },
 
 'CSSRule': {
-    'hasXPConnectImpls': True,
     'concrete': False,
     'nativeType': 'mozilla::css::Rule'
 },
 
 'CSSStyleDeclaration': {
     'nativeType': 'nsICSSDeclaration'
 },
 
--- a/layout/style/Rule.h
+++ b/layout/style/Rule.h
@@ -137,23 +137,9 @@ protected:
   // Keep the same type so that MSVC packs them.
   uint32_t          mLineNumber;
   uint32_t          mColumnNumber;
 };
 
 } // namespace css
 } // namespace mozilla
 
-// Specialization of the bindings UnwrapArg setup for css::Rule, so we can avoid
-// adding an IID to css::Rule.  This can go away once all css::Rule subclasses
-// are on WebIDL bindings.
-
-#include "js/TypeDecls.h"
-
-namespace mozilla {
-namespace dom {
-template <>
-nsresult
-UnwrapArg(JS::Handle<JSObject*> src, css::Rule** ppArg);
-} // namepace dom
-} // namespace mozilla
-
 #endif /* mozilla_css_Rule_h___ */
--- a/layout/style/nsCSSRules.cpp
+++ b/layout/style/nsCSSRules.cpp
@@ -51,37 +51,16 @@
 #include "nsCCUncollectableMarker.h"
 #include "nsWrapperCacheInlines.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 // base class for all rule types in a CSS style sheet
 
-// Temporary code that can go away once all css::Rules are on WebIDL bindings.
-#include "xpcpublic.h"
-namespace mozilla {
-namespace dom {
-template<>
-nsresult
-UnwrapArg(JS::Handle<JSObject*> src, css::Rule** ppArg)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  nsCOMPtr<nsIDOMCSSRule> rule =
-    do_QueryInterface(xpc::UnwrapReflectorToISupports(src));
-  if (!rule) {
-    return NS_NOINTERFACE;
-  }
-  *ppArg = rule->GetCSSRule();
-  NS_ADDREF(*ppArg);
-  return NS_OK;
-}
-} // namespace dom
-} // namespace mozilla
-
 namespace mozilla {
 namespace css {
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(Rule)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(Rule)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Rule)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY