Skip to content
  • Masayuki Nakano's avatar
    Bug 1543315 - part 21: Mark `PresShell::DidCauseReflow()` as `MOZ_CAN_RUN_SCRIPT` r=smaug · 487e463b
    Masayuki Nakano authored
    It removes a script blocker.  Therefore, although it depends on the caller
    whether it causes running script or not.  However, we should mark it as
    `MOZ_CAN_RUN_SCRIPT` for safer code.
    
    It's called only by the destructor of `nsAutoCauseReflowNotifier`.  Therefore,
    this patch also marks its constructor as `MOZ_CAN_RUN_SCRIPT` for making
    each creator method marked as `MOZ_CAN_RUN_SCRIPT` or
    `MOZ_CAN_RUN_SCRIPT_BOUNDARY`.
    
    Most of the creators is mutation listener methods.  However, `PresShell`
    does nothing after destroying `nsAutoCauseReflowNotifier`.  Therefore,
    this patch does not change the callers in MutationObserver.cpp to use
    `RefPtr<PresShell>` at calling them because changing it may cause performance
    regression.
    
    Perhaps, we should create another methods of `WillCauseReflow()` and
    `DidCauseReflow()` to avoid unnecessary `MOZ_CAN_RUN_SCRIPT` marking.
    However, I'm not sure whether most callers may run script or not because
    of outside of my knowledge.
    
    Differential Revision: https://phabricator.services.mozilla.com/D55805
    
    --HG--
    extra : moz-landing-system : lando
    487e463b