Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevTools: Improve named hooks network caching #22198

Merged
merged 11 commits into from
Sep 1, 2021

Commits on Sep 1, 2021

  1. DevTools: Separate named hooks I/O and CPU work by thread

    Keep CPU bound work (parsing source map and AST) in a worker so it doesn't block the main thread but move I/O bound code (fetching files) to the main thread so we can benefit from Network caching for source files.
    
    Note that this change alone is not sufficient to be able to share the Network cache, but it will help making the subsequent work easier.
    Brian Vaughn committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    93d0e48 View commit details
    Browse the repository at this point in the history
  2. Small optimization to avoid serializing runtime source unnecessarily

    For source that have source maps, the original source is retrieved using the source map. We only fall back to parsing the full source code is when there's no source map.
    
    The source is (potentially) very large, so we can avoid the overhead of serializing it unnecessarily to share it with the worker in this case.
    Brian Vaughn committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    92b9ccb View commit details
    Browse the repository at this point in the history
  3. Move source file fetching into content script for better cache utiliz…

    …ation
    
    Network requests made from an extension do not reuse the page's Network cache. To work around that, this commit adds a helper function to the content script (which runs in the page's context) that the extension can communicate with via postMessage. The content script can then fetch cached files for the extension.
    Brian Vaughn committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    fa45ab3 View commit details
    Browse the repository at this point in the history
  4. Optimization: Don't invoke worker code when there are no named hooks

    This waste a good bit of time for nothing.
    Brian Vaughn committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    6f59b58 View commit details
    Browse the repository at this point in the history
  5. Fixed failing test

    Brian Vaughn committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    ac4c95d View commit details
    Browse the repository at this point in the history
  6. Pre-fetch (and cache) source files on component inspection

    This reduces the impact for sites with CORS policies that prevent us from using the Network cache.
    Brian Vaughn committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    1184d5b View commit details
    Browse the repository at this point in the history
  7. Disable __PERFORMANCE_PROFILE__ flag

    Brian Vaughn committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    1335a3e View commit details
    Browse the repository at this point in the history
  8. Use devtools.network.onRequestFinished to cache resources loaded by t…

    …he page
    
    This helps avoid unnecessary duplicate requests when hook names are parsed. Responses with a Vary: 'Origin' migt not match future requests. Caching the requests as they're made lets us avoid a possible (expensive) cache miss.
    Brian Vaughn committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    e659554 View commit details
    Browse the repository at this point in the history
  9. Updated the header comment for loadSourceAndMetadata

    Brian Vaughn committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    14535e1 View commit details
    Browse the repository at this point in the history
  10. Disable fetchFileWithCaching for Firefox

    For some reason in Firefox, chrome.runtime.sendMessage() from a content script never reaches the chrome.runtime.onMessage event listener. So we'll only pass this function through for Chrome (and Edge).
    Brian Vaughn committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    1839d12 View commit details
    Browse the repository at this point in the history
  11. Expanded mime type check for cached files

    Brian Vaughn committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    f9b27a6 View commit details
    Browse the repository at this point in the history