Skip to content

Conversation

zhongqiliang
Copy link
Contributor

@zhongqiliang zhongqiliang commented Jan 17, 2025

  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

@zhongqiliang zhongqiliang force-pushed the js_injection_with_embeded_resource branch 2 times, most recently from 6522cac to bb95b2c Compare January 17, 2025 19:38
@zhongqiliang zhongqiliang changed the title Js injection demo with example.js Integrate js_injection and make java bridge polyfill script work Jan 17, 2025
@zhongqiliang zhongqiliang marked this pull request as ready for review January 17, 2025 19:54
Incorporate Chromium's js_injection module into the Chrobalt codebase to enable JavaScript injection capabilities.
Move the Kabuki polyfill scripts into cobalt/embedded_resources.
Utilize the embed_polyfilled_javascript GN rule to convert the JavaScript files in cobalt/embedded_resources into embedded_js.h.
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.
Override the RunScriptsAtDocumentStart() method in CobaltContentRendererClient to execute the injected polyfill JavaScript code.
This PR is built on top of Kaido 's draft PR youtube#4704.

b/384742721
@zhongqiliang zhongqiliang force-pushed the js_injection_with_embeded_resource branch from bb95b2c to 5f91b04 Compare January 17, 2025 20:02
Copy link
Contributor

@johnxwork johnxwork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

Would you wait for Kaido to take a look since you collaborated on it?

Copy link
Member

@kaidokert kaidokert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks okay

@zhongqiliang zhongqiliang enabled auto-merge (squash) January 19, 2025 16:16
@zhongqiliang zhongqiliang merged commit 73018f4 into youtube:main Jan 19, 2025
87 of 88 checks passed
@zhongqiliang zhongqiliang deleted the js_injection_with_embeded_resource branch January 19, 2025 17:01
kaidokert added a commit to kaidokert/cobalt that referenced this pull request Jun 14, 2025
…tube#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
youtube#4704.

b/384742721

---------

Co-authored-by: Kaido Kert <[email protected]>
Co-authored-by: Colin Liang <[email protected]>
kaidokert added a commit to kaidokert/cobalt that referenced this pull request Jun 14, 2025
…tube#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
youtube#4704.

b/384742721

---------

Co-authored-by: Kaido Kert <[email protected]>
Co-authored-by: Colin Liang <[email protected]>
kaidokert added a commit to kaidokert/cobalt that referenced this pull request Jun 15, 2025
…tube#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
youtube#4704.

b/384742721

---------

Co-authored-by: Kaido Kert <[email protected]>
Co-authored-by: Colin Liang <[email protected]>
briantting pushed a commit that referenced this pull request Jul 1, 2025
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]>
original-hexsha: 73018f4
briantting pushed a commit that referenced this pull request Jul 11, 2025
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]>
original-hexsha: 73018f4
sideb0ard pushed a commit to sideb0ard/cobalt that referenced this pull request Jul 25, 2025
Original Message:
Integrate js_injection and make java bridge polyfill script work (youtube#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
youtube#4704.

b/384742721

---------

Co-authored-by: Kaido Kert <[email protected]>
Co-authored-by: Colin Liang <[email protected]>
original-hexsha: 73018f4


Files with conflicts:
- cobalt/BUILD.gn
sideb0ard pushed a commit to sideb0ard/cobalt that referenced this pull request Jul 26, 2025
…tube#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
youtube#4704.

b/384742721

---------

Co-authored-by: Kaido Kert <[email protected]>
Co-authored-by: Colin Liang <[email protected]>
original-hexsha: 73018f4
sideb0ard pushed a commit to sideb0ard/cobalt that referenced this pull request Jul 30, 2025
…tube#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
youtube#4704.

b/384742721

---------

Co-authored-by: Kaido Kert <[email protected]>
Co-authored-by: Colin Liang <[email protected]>
original-hexsha: 73018f4
sideb0ard pushed a commit to sideb0ard/cobalt that referenced this pull request Aug 12, 2025
…tube#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
youtube#4704.

b/384742721

---------

Co-authored-by: Kaido Kert <[email protected]>
Co-authored-by: Colin Liang <[email protected]>
original-hexsha: 73018f4
briantting pushed a commit that referenced this pull request Aug 15, 2025
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]>
original-hexsha: 73018f4
briantting pushed a commit that referenced this pull request Aug 15, 2025
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]>
original-hexsha: 73018f4
briantting pushed a commit that referenced this pull request Aug 15, 2025
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]>

original-hexsha: 73018f4
briantting pushed a commit that referenced this pull request Aug 15, 2025
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]>

original-hexsha: 73018f4
briantting pushed a commit that referenced this pull request Aug 25, 2025
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]>

original-hexsha: 73018f4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants