Bug 957688 - Remove checkaccess junk from the XBL compilation scope. r=mrbkap
authorBobby Holley <bobbyholley@gmail.com>
Fri, 24 Jan 2014 16:08:25 -0800
changeset 181209 4030b1beb0d4cc167f5b2ad18f99261b1483b9d9
parent 181208 7ed1607eac3a08eb86f67179fa4e5f37b28fefaa
child 181210 5ac97770b63cb9b72cb5e87a4c582fd9187f61b4
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs957688
milestone29.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 957688 - Remove checkaccess junk from the XBL compilation scope. r=mrbkap I have no idea what this is supposed to be doing, given that the compilation scope doesn't run script. We should make sure this is reviewed by someone who remembers why this was written.
dom/xbl/nsXBLDocumentInfo.cpp
--- a/dom/xbl/nsXBLDocumentInfo.cpp
+++ b/dom/xbl/nsXBLDocumentInfo.cpp
@@ -50,90 +50,28 @@ public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsXBLDocGlobalObject)
 
   JSObject *GetCompilationGlobal();
   void UnmarkCompilationGlobal();
   void Destroy();
   nsIPrincipal* GetPrincipal();
 
-  static bool doCheckAccess(JSContext *cx, JS::Handle<JSObject*> obj,
-                            JS::Handle<jsid> id, uint32_t accessType);
-
   void ClearGlobalObjectOwner();
 
   static const JSClass gSharedGlobalClass;
 
 protected:
   virtual ~nsXBLDocGlobalObject();
 
   JS::Heap<JSObject*> mJSObject;
   nsXBLDocumentInfo* mGlobalObjectOwner; // weak reference
   bool mDestroyed; // Probably not necessary, but let's be safe.
 };
 
-bool
-nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JS::Handle<JSObject*> obj,
-                                    JS::Handle<jsid> id, uint32_t accessType)
-{
-  nsIScriptSecurityManager *ssm = nsContentUtils::GetSecurityManager();
-  if (!ssm) {
-    ::JS_ReportError(cx, "Unable to verify access to a global object property.");
-    return false;
-  }
-
-  // Make sure to actually operate on our object, and not some object further
-  // down on the proto chain.
-  JS::Rooted<JSObject*> base(cx, obj);
-  while (JS_GetClass(base) != &nsXBLDocGlobalObject::gSharedGlobalClass) {
-    if (!::JS_GetPrototype(cx, base, &base)) {
-      return false;
-    }
-    if (!base) {
-      ::JS_ReportError(cx, "Invalid access to a global object property.");
-      return false;
-    }
-  }
-
-  nsresult rv = ssm->CheckPropertyAccess(cx, base, JS_GetClass(base)->name,
-                                         id, accessType);
-  return NS_SUCCEEDED(rv);
-}
-
-static bool
-nsXBLDocGlobalObject_getProperty(JSContext *cx, JS::Handle<JSObject*> obj,
-                                 JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp)
-{
-  return nsXBLDocGlobalObject::
-    doCheckAccess(cx, obj, id, nsIXPCSecurityManager::ACCESS_GET_PROPERTY);
-}
-
-static bool
-nsXBLDocGlobalObject_setProperty(JSContext *cx, JS::Handle<JSObject*> obj,
-                                 JS::Handle<jsid> id, bool strict, JS::MutableHandle<JS::Value> vp)
-{
-  return nsXBLDocGlobalObject::
-    doCheckAccess(cx, obj, id, nsIXPCSecurityManager::ACCESS_SET_PROPERTY);
-}
-
-static bool
-nsXBLDocGlobalObject_checkAccess(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
-                                 JSAccessMode mode, JS::MutableHandle<JS::Value> vp)
-{
-  uint32_t translated;
-  if (mode & JSACC_WRITE) {
-    translated = nsIXPCSecurityManager::ACCESS_SET_PROPERTY;
-  } else {
-    translated = nsIXPCSecurityManager::ACCESS_GET_PROPERTY;
-  }
-
-  return nsXBLDocGlobalObject::
-    doCheckAccess(cx, obj, id, translated);
-}
-
 static void
 nsXBLDocGlobalObject_finalize(JSFreeOp *fop, JSObject *obj)
 {
   nsISupports *nativeThis = (nsISupports*)JS_GetPrivate(obj);
   nsXBLDocGlobalObject* dgo = static_cast<nsXBLDocGlobalObject*>(nativeThis);
 
   if (dgo)
     dgo->Destroy();
@@ -151,20 +89,20 @@ nsXBLDocGlobalObject_resolve(JSContext *
 }
 
 
 const JSClass nsXBLDocGlobalObject::gSharedGlobalClass = {
     "nsXBLPrototypeScript compilation scope",
     JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS |
     JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(0),
     JS_PropertyStub,  JS_DeletePropertyStub,
-    nsXBLDocGlobalObject_getProperty, nsXBLDocGlobalObject_setProperty,
+    JS_PropertyStub, JS_StrictPropertyStub,
     JS_EnumerateStub, nsXBLDocGlobalObject_resolve,
     JS_ConvertStub, nsXBLDocGlobalObject_finalize,
-    nsXBLDocGlobalObject_checkAccess, nullptr, nullptr, nullptr,
+    nullptr, nullptr, nullptr, nullptr,
     nullptr
 };
 
 //----------------------------------------------------------------------
 //
 // nsXBLDocGlobalObject
 //