Bug 1533617 part 4. Mark virtual methods with CAN_RUN_SCRIPT overrides as CAN_RUN_SCRIPT. r=nika
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 11 Mar 2019 14:20:29 +0000
changeset 524385 005ab4b76f8c43b8a9a1dd792786b65d4dd4d05a
parent 524384 341a6a2e52378e01e33d9ce69aa178a391d3ee1c
child 524386 94ae30387e57697e0044cad778459f751319fe11
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika
bugs1533617
milestone67.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 1533617 part 4. Mark virtual methods with CAN_RUN_SCRIPT overrides as CAN_RUN_SCRIPT. r=nika Differential Revision: https://phabricator.services.mozilla.com/D22838
docshell/base/nsIScrollObserver.h
dom/base/nsDOMWindowUtils.h
dom/base/nsISelectionController.idl
dom/html/input/InputType.h
dom/interfaces/base/nsIDOMWindowUtils.idl
layout/base/AccessibleCaretEventHub.h
testing/gtest/gtest/include/gtest/gtest.h
--- a/docshell/base/nsIScrollObserver.h
+++ b/docshell/base/nsIScrollObserver.h
@@ -26,20 +26,20 @@ class nsIScrollObserver : public nsISupp
    * Called when the scroll position of some element has changed.
    */
   virtual void ScrollPositionChanged() = 0;
 
   /**
    * Called when an async panning/zooming transform has started being applied
    * and passed the scroll offset
    */
-  virtual void AsyncPanZoomStarted(){};
+  MOZ_CAN_RUN_SCRIPT virtual void AsyncPanZoomStarted(){};
 
   /**
    * Called when an async panning/zooming transform is no longer applied
    * and passed the scroll offset
    */
-  virtual void AsyncPanZoomStopped(){};
+  MOZ_CAN_RUN_SCRIPT virtual void AsyncPanZoomStopped(){};
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIScrollObserver, NS_ISCROLLOBSERVER_IID)
 
 #endif /* nsIScrollObserver_h___ */
--- a/dom/base/nsDOMWindowUtils.h
+++ b/dom/base/nsDOMWindowUtils.h
@@ -79,25 +79,25 @@ class nsDOMWindowUtils final : public ns
 
   nsIPresShell* GetPresShell();
   nsPresContext* GetPresContext();
   mozilla::dom::Document* GetDocument();
   mozilla::layers::LayerTransactionChild* GetLayerTransaction();
   mozilla::layers::WebRenderBridgeChild* GetWebRenderBridge();
 
   // Until callers are annotated.
-  MOZ_CAN_RUN_SCRIPT_BOUNDARY
+  MOZ_CAN_RUN_SCRIPT
   NS_IMETHOD SendMouseEventCommon(
       const nsAString& aType, float aX, float aY, int32_t aButton,
       int32_t aClickCount, int32_t aModifiers, bool aIgnoreRootScrollFrame,
       float aPressure, unsigned short aInputSourceArg, uint32_t aIdentifier,
       bool aToWindow, bool* aPreventDefault, bool aIsDOMEventSynthesized,
       bool aIsWidgetEventSynthesized, int32_t aButtons);
 
-  MOZ_CAN_RUN_SCRIPT_BOUNDARY
+  MOZ_CAN_RUN_SCRIPT
   NS_IMETHOD SendTouchEventCommon(const nsAString& aType,
                                   uint32_t* aIdentifiers, int32_t* aXs,
                                   int32_t* aYs, uint32_t* aRxs, uint32_t* aRys,
                                   float* aRotationAngles, float* aForces,
                                   uint32_t aCount, int32_t aModifiers,
                                   bool aIgnoreRootScrollFrame, bool aToWindow,
                                   bool* aPreventDefault);
 };
--- a/dom/base/nsISelectionController.idl
+++ b/dom/base/nsISelectionController.idl
@@ -237,16 +237,17 @@ interface nsISelectionController : nsISe
 
   /** PageMove will move the selection one page forward/backward in the document.
    *  this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
    *  the "point" of selection that is extended is considered the "focus" point.
    *  or the last point adjusted by the selection.
    *  @param aForward forward or backward if PR_FALSE
    *  @param aExtend  should it collapse the selection of extend it?
    */
+    [can_run_script]
     void pageMove(in boolean forward, in boolean extend);
 
   /** CompleteScroll will move page view to the top or bottom of the document
    *  @param aForward forward or backward if PR_FALSE
    */
     void completeScroll(in boolean forward);
 
   /** CompleteMove will move page view to the top or bottom of the document
--- a/dom/html/input/InputType.h
+++ b/dom/html/input/InputType.h
@@ -62,17 +62,17 @@ class InputType {
       nsAString& aValidationMessage,
       nsIConstraintValidation::ValidityStateType aType);
   virtual nsresult GetValueMissingMessage(nsAString& aMessage);
   virtual nsresult GetTypeMismatchMessage(nsAString& aMessage);
   virtual nsresult GetRangeOverflowMessage(nsAString& aMessage);
   virtual nsresult GetRangeUnderflowMessage(nsAString& aMessage);
   virtual nsresult GetBadInputMessage(nsAString& aMessage);
 
-  virtual nsresult MinMaxStepAttrChanged();
+  MOZ_CAN_RUN_SCRIPT virtual nsresult MinMaxStepAttrChanged();
 
   /**
    * Convert a string to a Decimal number in a type specific way,
    * http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#concept-input-value-string-number
    * ie parse a date string to a timestamp if type=date,
    * or parse a number string to its value if type=number.
    * @param aValue the string to be parsed.
    * @param aResultValue the number as a Decimal.
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -308,17 +308,17 @@ interface nsIDOMWindowUtils : nsISupport
    *                               defaults to true
    * @param aIsWidgetEventSynthesized controls WidgetMouseEvent.mReason value
    *                                  defaults to false (WidgetMouseEvent::eReal)
    * @param aIdentifier A unique identifier for the pointer causing the event,
    *                    defaulting to nsIDOMWindowUtils::DEFAULT_MOUSE_POINTER_ID.
    *
    * returns true if the page called prevent default on this event
    */
-  [optional_argc]
+  [optional_argc, can_run_script]
   boolean sendMouseEvent(in AString aType,
                          in float aX,
                          in float aY,
                          in long aButton,
                          in long aClickCount,
                          in long aModifiers,
                          [optional] in boolean aIgnoreRootScrollFrame,
                          [optional] in float aPressure,
@@ -349,32 +349,33 @@ interface nsIDOMWindowUtils : nsISupport
    * @param forces array of forces (floats from 0 to 1) for each touch to be sent
    * @param count number of touches in this set
    * @param aModifiers modifiers pressed, using constants defined as MODIFIER_*
    * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds
    *                           during dispatch
    *
    * returns true if the page called prevent default on this touch event
    */
+  [can_run_script]
   boolean sendTouchEvent(in AString aType,
                          [array, size_is(count)] in uint32_t aIdentifiers,
                          [array, size_is(count)] in int32_t aXs,
                          [array, size_is(count)] in int32_t aYs,
                          [array, size_is(count)] in uint32_t aRxs,
                          [array, size_is(count)] in uint32_t aRys,
                          [array, size_is(count)] in float aRotationAngles,
                          [array, size_is(count)] in float aForces,
                          in uint32_t count,
                          in long aModifiers,
                          [optional] in boolean aIgnoreRootScrollFrame);
 
   /** The same as sendMouseEvent but ensures that the event is dispatched to
    *  this DOM window or one of its children.
    */
-  [optional_argc]
+  [optional_argc, can_run_script]
   void sendMouseEventToWindow(in AString aType,
                               in float aX,
                               in float aY,
                               in long aButton,
                               in long aClickCount,
                               in long aModifiers,
                               [optional] in boolean aIgnoreRootScrollFrame,
                               [optional] in float aPressure,
@@ -382,16 +383,17 @@ interface nsIDOMWindowUtils : nsISupport
                               [optional] in boolean aIsDOMEventSynthesized,
                               [optional] in boolean aIsWidgetEventSynthesized,
                               [optional] in long aButtons,
                               [optional] in unsigned long aIdentifier);
 
   /** The same as sendTouchEvent but ensures that the event is dispatched to
    *  this DOM window or one of its children.
    */
+  [can_run_script]
   boolean sendTouchEventToWindow(in AString aType,
                                  [array, size_is(count)] in uint32_t aIdentifiers,
                                  [array, size_is(count)] in int32_t aXs,
                                  [array, size_is(count)] in int32_t aYs,
                                  [array, size_is(count)] in uint32_t aRxs,
                                  [array, size_is(count)] in uint32_t aRys,
                                  [array, size_is(count)] in float aRotationAngles,
                                  [array, size_is(count)] in float aForces,
--- a/layout/base/AccessibleCaretEventHub.h
+++ b/layout/base/AccessibleCaretEventHub.h
@@ -182,44 +182,54 @@ class AccessibleCaretEventHub : public n
 // The base class for concrete states. A concrete state should inherit from this
 // class, and override the methods to handle the events or callbacks. A concrete
 // state is also responsible for transforming itself to the next concrete state.
 //
 class AccessibleCaretEventHub::State {
  public:
   virtual const char* Name() const { return ""; }
 
+  MOZ_CAN_RUN_SCRIPT
   virtual nsEventStatus OnPress(AccessibleCaretEventHub* aContext,
                                 const nsPoint& aPoint, int32_t aTouchId,
                                 EventClassID aEventClass) {
     return nsEventStatus_eIgnore;
   }
 
+  MOZ_CAN_RUN_SCRIPT
   virtual nsEventStatus OnMove(AccessibleCaretEventHub* aContext,
                                const nsPoint& aPoint) {
     return nsEventStatus_eIgnore;
   }
 
+  MOZ_CAN_RUN_SCRIPT
   virtual nsEventStatus OnRelease(AccessibleCaretEventHub* aContext) {
     return nsEventStatus_eIgnore;
   }
 
+  MOZ_CAN_RUN_SCRIPT
   virtual nsEventStatus OnLongTap(AccessibleCaretEventHub* aContext,
                                   const nsPoint& aPoint) {
     return nsEventStatus_eIgnore;
   }
 
+  MOZ_CAN_RUN_SCRIPT
   virtual void OnScrollStart(AccessibleCaretEventHub* aContext) {}
+  MOZ_CAN_RUN_SCRIPT
   virtual void OnScrollEnd(AccessibleCaretEventHub* aContext) {}
+  MOZ_CAN_RUN_SCRIPT
   virtual void OnScrollPositionChanged(AccessibleCaretEventHub* aContext) {}
+  MOZ_CAN_RUN_SCRIPT
   virtual void OnBlur(AccessibleCaretEventHub* aContext,
                       bool aIsLeavingDocument) {}
+  MOZ_CAN_RUN_SCRIPT
   virtual void OnSelectionChanged(AccessibleCaretEventHub* aContext,
                                   dom::Document* aDoc, dom::Selection* aSel,
                                   int16_t aReason) {}
+  MOZ_CAN_RUN_SCRIPT
   virtual void OnReflow(AccessibleCaretEventHub* aContext) {}
   virtual void Enter(AccessibleCaretEventHub* aContext) {}
   virtual void Leave(AccessibleCaretEventHub* aContext) {}
 
   explicit State() = default;
   virtual ~State() = default;
   State(const State&) = delete;
   State& operator=(const State&) = delete;
--- a/testing/gtest/gtest/include/gtest/gtest.h
+++ b/testing/gtest/gtest/include/gtest/gtest.h
@@ -59,16 +59,17 @@
 #include "gtest/internal/gtest-string.h"
 #include "gtest/gtest-death-test.h"
 #include "gtest/gtest-message.h"
 #include "gtest/gtest-param-test.h"
 #include "gtest/gtest-printers.h"
 #include "gtest/gtest_prod.h"
 #include "gtest/gtest-test-part.h"
 #include "gtest/gtest-typed-test.h"
+#include "mozilla/Attributes.h"
 
 // Depending on the platform, different string classes are available.
 // On Linux, in addition to ::std::string, Google also makes use of
 // class ::string, which has the same interface as ::std::string, but
 // has a different implementation.
 //
 // You can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that
 // ::string is available AND is a distinct type to ::std::string, or
@@ -438,17 +439,17 @@ class GTEST_API_ Test {
   static bool HasSameFixtureClass();
 
   // Runs the test after the test fixture has been set up.
   //
   // A sub-class must implement this to define the test logic.
   //
   // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.
   // Instead, use the TEST or TEST_F macro.
-  virtual void TestBody() = 0;
+  MOZ_CAN_RUN_SCRIPT virtual void TestBody() = 0;
 
   // Sets up, executes, and tears down the test.
   void Run();
 
   // Deletes self.  We deliberately pick an unusual name for this
   // internal method to avoid clashing with names used in user TESTs.
   void DeleteSelf_() { delete this; }