-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate js_injection and make java bridge polyfill script work (#4715)
1. Incorporate Chromium's js_injection module into the Chrobalt codebase to enable JavaScript injection capabilities. 2. Move the Kabuki polyfill scripts into cobalt/embedded_resources. 3. Utilize the embed_polyfilled_javascript GN rule to convert the JavaScript files in cobalt/embedded_resources into embedded_js.h. 4. In the CobaltWebContentsObserver constructor, load the embedded JavaScript from embedded_js.h into the GeneratedResourceMap. Use AddDocumentStartJavaScript() to inject the polyfill code into web pages. This ensures the polyfills are executed early in the page lifecycle. 5. Override the RunScriptsAtDocumentStart() method in CobaltContentRendererClient to execute the injected polyfill JavaScript code. This PR is built on top of Kaido 's draft PR #4704. b/384742721 --------- Co-authored-by: Kaido Kert <[email protected]> Co-authored-by: Colin Liang <[email protected]>
- Loading branch information
1 parent
454cedb
commit 73018f4
Showing
14 changed files
with
96 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
cobalt/android/apk/app/src/kabuki_polyfill/amati_device_inspector.js
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
cobalt/android/apk/app/src/kabuki_polyfill/chrobalt_preload.js
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
cobalt/android/apk/app/src/kabuki_polyfill/html_media_element_extension.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
cobalt/embedded_resources/html_media_element_extension_on_java_bridge.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright The Cobalt Authors. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
if (typeof HTMLMediaElementExtension !== 'undefined') { | ||
HTMLMediaElement.prototype.canPlayType = HTMLMediaElementExtension.canPlayType; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters