• Devlin Cronin's avatar
    [Extensions Bindings] Change how we run synchronous JS functions · bba3c453
    Devlin Cronin authored
    Currently, native extension bindings use the same method to execute
    script whether or not JS is suspended at the time. The difference
    instead is that we expect JS to finish synchronously in the sync case.
    This is nice, because it means that we never circumvent script
    suspension.
    
    Unfortunately, this is insufficient. We need to execute script
    synchronously in order to respond to certain JS calls, and script can
    be running at multiple times even though JS is suspended (though it
    perhaps shouldn't be).
    
    Instead, change RunJSFunctionSync() to use APIs that guarantee script
    execution (WebLocalFrame::CallFunctionEvenIfScriptDisabled and
    v8::Function::Call). Since these should only be used in response to
    direct JS entry points, this shouldn't introduce any new areas of
    running script while suspended.
    
    Bug: 786957, 653596
    
    Change-Id: Ibc2f066bd562ab071dbd7cb2bd7de7b46d9d6892
    Reviewed-on: https://chromium-review.googlesource.com/786894
    Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
    Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#520623}
    bba3c453
api_binding_hooks.cc 14 KB