• Robert Knight's avatar
    Simplify login popup creation flow · 9bf96c31
    Robert Knight authored
    The process of creating and navigating the login popup used to involve two
    steps, first creating a blank window and then navigating it to the final
    authorization URL. This was needed because, in Firefox, the popup window had to
    be created in the same turn of the event loop as the user's click on the "Log
    in" button (otherwise the popup blocker would trigger) but generating the
    authorization URL involved an async "fetch" of API links.
    
    The major browsers have now all settled on a more flexible model for allowing
    popups in response to user gestures, where the popup must be opened within a
    certain time window of the gesture. In practice the timeout seems to be ~1000ms
    in Safari and longer than that in other browsers.
    
    In this context we expect the async delay between the user clicking the "Log in"
    button and us creating the popup to be ~0ms, since the API links should already
    have been fetched at this point and so we're just fetching locally cached values.
    
    Based on this assumption, the flow for creating the login popup window has been
    simplified to create the popup window at the final URL immediately, removing the
    need to open a blank window as a first step.
    
    Simplifying the code here will make it easier to change how the popup window and
    sidebar communicate, eg. to resolve an issue with the new
    Cross-Origin-Opener-Policy header [1].
    
    [1] https://github.com/hypothesis/product-backlog/issues/1333
    9bf96c31
Name
Last commit
Last update
..
annotator Loading commit data...
boot Loading commit data...
images/icons Loading commit data...
shared Loading commit data...
sidebar Loading commit data...
styles Loading commit data...
test-util Loading commit data...
types Loading commit data...
.eslintrc Loading commit data...
karma.config.js Loading commit data...
tsconfig.json Loading commit data...
tsconfig.no-any.json Loading commit data...