Bug 1123112 - Mark AutoEntryScript as stack class, and clarify the ownership of its members; r=smaug
authorEhsan Akhgari <ehsan@mozilla.com>
Sun, 18 Jan 2015 14:07:02 -0500
changeset 224457 953aecc38f56cf797438209af38be82a574e4d8b
parent 224456 9604119ee9d31d583cb4473e3578c622c43adf26
child 224458 cf2d52a26ec2915bfa34e1ab5a2470f7747c2b0b
push id54233
push usereakhgari@mozilla.com
push dateSun, 18 Jan 2015 23:44:01 +0000
treeherdermozilla-inbound@cf2d52a26ec2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1123112
milestone38.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 1123112 - Mark AutoEntryScript as stack class, and clarify the ownership of its members; r=smaug
dom/base/ScriptSettings.h
--- a/dom/base/ScriptSettings.h
+++ b/dom/base/ScriptSettings.h
@@ -314,18 +314,18 @@ private:
 
   AutoJSAPI(const AutoJSAPI&) = delete;
   AutoJSAPI& operator= (const AutoJSAPI&) = delete;
 };
 
 /*
  * A class that represents a new script entry point.
  */
-class AutoEntryScript : public AutoJSAPI,
-                        protected ScriptSettingsStackEntry {
+class MOZ_STACK_CLASS AutoEntryScript : public AutoJSAPI,
+                                        protected ScriptSettingsStackEntry {
 public:
   explicit AutoEntryScript(nsIGlobalObject* aGlobalObject,
                   bool aIsMainThread = NS_IsMainThread(),
                   // Note: aCx is mandatory off-main-thread.
                   JSContext* aCx = nullptr);
 
   ~AutoEntryScript();
 
@@ -336,20 +336,20 @@ public:
 private:
   // It's safe to make this a weak pointer, since it's the subject principal
   // when we go on the stack, so can't go away until after we're gone.  In
   // particular, this is only used from the CallSetup constructor, and only in
   // the aIsJSImplementedWebIDL case.  And in that case, the subject principal
   // is the principal of the callee function that is part of the CallArgs just a
   // bit up the stack, and which will outlive us.  So we know the principal
   // can't go away until then either.
-  nsIPrincipal* mWebIDLCallerPrincipal;
+  nsIPrincipal* MOZ_NON_OWNING_REF mWebIDLCallerPrincipal;
   friend nsIPrincipal* GetWebIDLCallerPrincipal();
 
-  nsIDocShell* mDocShellForJSRunToCompletion;
+  nsCOMPtr<nsIDocShell> mDocShellForJSRunToCompletion;
 
   bool mIsMainThread;
 };
 
 /*
  * A class that can be used to force a particular incumbent script on the stack.
  */
 class AutoIncumbentScript : protected ScriptSettingsStackEntry {