DevTools: Add runtime functions that allow specific file requests
This CL adds the following functions: * Runtime.getResourceURL: returns the request URL given resource name and request base URL (e.g. devtools://devtools/bundle/ or devtools://devtools/remote/serve_file/@010ddcfda246975d194964ccf20038ebbdec6084/) * (Runtime) module: return Runtime.Module object given module name * (Runtime.Module) fetchResource: make a request to load a script of the given name in the current module. This is in the Runtime.Module class so that the request can be adjusted based on if the module is remote or not. We can leverage these functions to request specific files. I'm planning to use them to request the appropriate locale file for lighthouse in the audits worker, e.g. `await self.runtime.module('audits_worker').fetchResource('lighthouse/locales/zh.json')`. Bug: 941561 Change-Id: Ib5c7bfdc46bef7d98533c89b12c7d365d4a26dfd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1784981Reviewed-by:Yang Guo <yangguo@chromium.org> Reviewed-by:
Paul Irish <paulirish@chromium.org> Commit-Queue: Mandy Chen <mandy.chen@microsoft.com> Cr-Commit-Position: refs/heads/master@{#697719}
Showing
Please register or sign in to comment