Bug 569629 - Don't use a constructor for nsDOMWorkerPrincipal. r=bent,a=bsmedberg
authorMike Hommey <mh+mozilla@glandium.org>
Sun, 07 Nov 2010 09:25:39 +0100
changeset 57053 0a9ee83b1093b8641fb42a2801628b721d1dce2d
parent 57052 df36c2dcf88f521e8132a5b8da2e63037133a4ee
child 57054 97aca07b7f320e62f9dcbcbfb93dbaf1acdfd620
push id16768
push usermh@glandium.org
push dateSun, 07 Nov 2010 08:26:25 +0000
treeherdermozilla-central@0a9ee83b1093 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent, bsmedberg
bugs569629
milestone2.0b8pre
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 569629 - Don't use a constructor for nsDOMWorkerPrincipal. r=bent,a=bsmedberg
dom/src/threads/nsDOMWorkerSecurityManager.cpp
--- a/dom/src/threads/nsDOMWorkerSecurityManager.cpp
+++ b/dom/src/threads/nsDOMWorkerSecurityManager.cpp
@@ -44,38 +44,35 @@
 // Other includes
 #include "jsapi.h"
 
 // DOMWorker includes
 #include "nsDOMThreadService.h"
 
 #define LOG(_args) PR_LOG(gDOMThreadsLog, PR_LOG_DEBUG, _args)
 
-class nsDOMWorkerPrincipal : public JSPrincipals
+class nsDOMWorkerPrincipal
 {
 public:
-  nsDOMWorkerPrincipal() {
-    codebase = "domworkerthread";
-    getPrincipalArray = NULL;
-    globalPrivilegesEnabled = NULL;
-    refcount = 1;
-    destroy = nsDOMWorkerPrincipal::Destroy;
-    subsume = nsDOMWorkerPrincipal::Subsume;
-  }
-
   static void Destroy(JSContext*, JSPrincipals*) {
     // nothing
   }
 
   static JSBool Subsume(JSPrincipals*, JSPrincipals*) {
     return JS_TRUE;
   }
 };
 
-static nsDOMWorkerPrincipal gWorkerPrincipal;
+static JSPrincipals gWorkerPrincipal =
+{ "domworkerthread" /* codebase */,
+  NULL /* getPrincipalArray */,
+  NULL /* globalPrivilegesEnabled */,
+  1 /* refcount */,
+  nsDOMWorkerPrincipal::Destroy /* destroy */,
+  nsDOMWorkerPrincipal::Subsume /* subsume */ };
 
 NS_IMPL_THREADSAFE_ISUPPORTS1(nsDOMWorkerSecurityManager,
                               nsIXPCSecurityManager)
 
 NS_IMETHODIMP
 nsDOMWorkerSecurityManager::CanCreateWrapper(JSContext* aJSContext,
                                              const nsIID& aIID,
                                              nsISupports* aObj,