• Jason Chase's avatar
    Allow origin trials to be enabled in worklets · 362fee3f
    Jason Chase authored
    As first seen in bug 799092, the AudioWorklet trial uncovered problems where
    [OriginTrialEnabled] interfaces were not being exposed for module scripts in
    worklets.
    
    The root cause is that WorkletGlobalScopes are defined to have a unique, opaque
    origin. This defeats the trial token validation which requires both a secure
    context, and that the origin for the context matches the origin in the token.
    
    For the purposes of origin trials, we believe it is sufficient to consider the
    context of the document that created the worklet. If the document is secure, and
    has valid token(s), the origin trial should be enabled. Analogous to this thread:
    https://github.com/whatwg/fetch/pull/527#issuecomment-335677387
    
    This CL changes so that any tokens from the document are passed along to the
    worklet, and the origin of the document is used to validate any tokens. This
    applies to all types of worklets, although the problem was initially found for
    AudioWorklet.
    
    As well the AudioWorkletProcessor interface has the [OriginTrialEnabled]
    attribute reinstated (was removed in a previous CL as a short-term workaround).
    
    Bug: 799960
    Change-Id: I98cca05a7710e463a10dcd8c17f302f311f531b3
    Reviewed-on: https://chromium-review.googlesource.com/862257
    Commit-Queue: Jason Chase <chasej@chromium.org>
    Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
    Reviewed-by: default avatarIan Clelland <iclelland@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#533035}
    362fee3f
PaintWorkletGlobalScopeProxy.cpp 2.81 KB