Followup for bug 1246091 to fix the naming for PopulateConsoleNotificationInTheTargetScope, r=me
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 24 Mar 2016 09:29:08 +0100
changeset 290279 7b617908d5430b944b1f61f9e50d28e9e0a93c7b
parent 290278 7b686e0a9ce4c5f1970b30ffbc4885a9ff29b9bf
child 290280 3062d172679fce065fa8d84dcc7a279cc8119954
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1246091
milestone48.0a1
Followup for bug 1246091 to fix the naming for PopulateConsoleNotificationInTheTargetScope, r=me
dom/base/Console.cpp
dom/base/Console.h
--- a/dom/base/Console.cpp
+++ b/dom/base/Console.cpp
@@ -1447,19 +1447,19 @@ Console::ProcessCallData(JSContext* aCx,
   // further, passing untrusted objects to system code is likely to run afoul of
   // Object Xrays.  So we want to wrap in a system-principal scope here.  But
   // which one?  We could cheat and try to get the underlying JSObject* of
   // mStorage, but that's a bit fragile.  Instead, we just use the junk scope,
   // with explicit permission from the XPConnect module owner.  If you're
   // tempted to do that anywhere else, talk to said module owner first.
 
   // aCx and aArguments are in the same compartment.
-  if (NS_WARN_IF(!PopulateConsoleObjectInTheTargetScope(aCx, aArguments,
-                                                        xpc::PrivilegedJunkScope(),
-                                                        &eventValue, aData))) {
+  if (NS_WARN_IF(!PopulateConsoleNotificationInTheTargetScope(aCx, aArguments,
+                                                              xpc::PrivilegedJunkScope(),
+                                                              &eventValue, aData))) {
     return;
   }
 
   if (!mStorage) {
     mStorage = do_GetService("@mozilla.org/consoleAPI-storage;1");
   }
 
   if (!mStorage) {
@@ -1480,21 +1480,21 @@ Console::ProcessCallData(JSContext* aCx,
   }
 
   if (NS_FAILED(mStorage->RecordEvent(innerID, outerID, eventValue))) {
     NS_WARNING("Failed to record a console event.");
   }
 }
 
 bool
-Console::PopulateConsoleObjectInTheTargetScope(JSContext* aCx,
-                                               const Sequence<JS::Value>& aArguments,
-                                               JSObject* aTargetScope,
-                                               JS::MutableHandle<JS::Value> aEventValue,
-                                               ConsoleCallData* aData) const
+Console::PopulateConsoleNotificationInTheTargetScope(JSContext* aCx,
+                                                     const Sequence<JS::Value>& aArguments,
+                                                     JSObject* aTargetScope,
+                                                     JS::MutableHandle<JS::Value> aEventValue,
+                                                     ConsoleCallData* aData) const
 {
   MOZ_ASSERT(aCx);
   MOZ_ASSERT(aData);
   MOZ_ASSERT(aTargetScope);
 
   JS::Rooted<JSObject*> targetScope(aCx, aTargetScope);
 
   ConsoleStackEntry frame;
@@ -2265,19 +2265,20 @@ Console::NotifyHandler(JSContext* aCx, c
     return;
   }
 
   JS::Rooted<JS::Value> value(aCx);
 
   // aCx and aArguments are in the same compartment because this method is
   // called directly when a Console.something() runs.
   // mConsoleEventNotifier->Callable() is the scope where value will be sent to.
-  if (NS_WARN_IF(!PopulateConsoleObjectInTheTargetScope(aCx, aArguments,
-                                                        mConsoleEventNotifier->Callable(),
-                                                        &value, aCallData))) {
+  if (NS_WARN_IF(!PopulateConsoleNotificationInTheTargetScope(aCx, aArguments,
+                                                              mConsoleEventNotifier->Callable(),
+                                                              &value,
+                                                              aCallData))) {
     return;
   }
 
   JS::Rooted<JS::Value> ignored(aCx);
   mConsoleEventNotifier->Call(value, &ignored);
 }
 
 void
@@ -2303,19 +2304,20 @@ Console::RetrieveConsoleEvents(JSContext
     if (!mCallDataStorage[i]->PopulateArgumentsSequence(sequence)) {
       aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
       return;
     }
 
     // Here we have aCx and sequence in the same compartment.
     // targetScope is the destination scope and value will be populated in its
     // compartment.
-    if (NS_WARN_IF(!PopulateConsoleObjectInTheTargetScope(aCx, sequence,
-                                                          targetScope, &value,
-                                                          mCallDataStorage[i]))) {
+    if (NS_WARN_IF(!PopulateConsoleNotificationInTheTargetScope(aCx, sequence,
+                                                                targetScope,
+                                                                &value,
+                                                                mCallDataStorage[i]))) {
       aRv.Throw(NS_ERROR_FAILURE);
       return;
     }
 
     aEvents.AppendElement(value);
   }
 }
 
--- a/dom/base/Console.h
+++ b/dom/base/Console.h
@@ -180,33 +180,33 @@ private:
   ReleaseCallData(ConsoleCallData* aCallData);
 
   // aCx and aArguments must be in the same JS compartment.
   void
   NotifyHandler(JSContext* aCx,
                 const Sequence<JS::Value>& aArguments,
                 ConsoleCallData* aData) const;
 
-  // PopulateConsoleObjectInTheTargetScope receives aCx and aArguments in the
-  // same JS compartment and populates the ConsoleEvent object (aValue) in the
-  // aTargetScope.
+  // PopulateConsoleNotificationInTheTargetScope receives aCx and aArguments in
+  // the same JS compartment and populates the ConsoleEvent object (aValue) in
+  // the aTargetScope.
   // aTargetScope can be:
   // - the system-principal scope when we want to dispatch the ConsoleEvent to
   //   nsIConsoleAPIStorage (See the comment in Console.cpp about the use of
   //   xpc::PrivilegedJunkScope()
   // - the mConsoleEventNotifier->Callable() scope when we want to notify this
   //   handler about a new ConsoleEvent.
   // - It can be the global from the JSContext when RetrieveConsoleEvents is
   //   called.
   bool
-  PopulateConsoleObjectInTheTargetScope(JSContext* aCx,
-                                        const Sequence<JS::Value>& aArguments,
-                                        JSObject* aTargetScope,
-                                        JS::MutableHandle<JS::Value> aValue,
-                                        ConsoleCallData* aData) const;
+  PopulateConsoleNotificationInTheTargetScope(JSContext* aCx,
+                                              const Sequence<JS::Value>& aArguments,
+                                              JSObject* aTargetScope,
+                                              JS::MutableHandle<JS::Value> aValue,
+                                              ConsoleCallData* aData) const;
 
   // If the first JS::Value of the array is a string, this method uses it to
   // format a string. The supported sequences are:
   //   %s    - string
   //   %d,%i - integer
   //   %f    - double
   //   %o,%O - a JS object.
   //   %c    - style string.