v8 extra not work for me

23 views
Skip to first unread message

John Smith

unread,
Apr 23, 2017, 10:29:10 PM4/23/17
to Chromium-dev
i build chromium for android on Ubuntu 14.04, i want add a custom javascript function to chromium,
i type a test.js,and edit $chromium_src/v8/src/v8.gyp. 
 line:
'v8_extra_library_files%': ['js/test.js',],

after built chromium_public.apk ,i open test html,the test.js 's function not work? How can I solve it?

Takeshi Yoshino

unread,
Apr 23, 2017, 11:47:06 PM4/23/17
to j111...@163.com, Domenic Denicola, Chromium-dev
+domenic

Takeshi

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/a6262ba0-8bca-4c59-b4de-f694cf9ee565%40chromium.org.

Jochen Eisinger

unread,
Apr 24, 2017, 5:39:20 AM4/24/17
to tyos...@chromium.org, j111...@163.com, Domenic Denicola, Chromium-dev
by default, chromium doesn't use gyp anymore.

Also, when V8 is embedded in chromium, the set of v8 extras is defined in src/.gn

John Smith

unread,
Apr 27, 2017, 7:58:50 AM4/27/17
to Chromium-dev, tyos...@chromium.org, j111...@163.com, dom...@google.com
Dear Jochen
 
    i found src/.GN include many files.then i found  v8_extra_library_files variable in the v8/src/BUILD.gn
and i add 
 v8_extra_library_files = [ "//test/cctest/test-extra.js","//src/js/test.js" ] in the BUILD.gn, 96 line.

i run chromium app.it's can't run my test javascript? why?




在 2017年4月24日星期一 UTC+8下午5:39:20,Jochen Eisinger写道:

Domenic Denicola

unread,
Apr 27, 2017, 4:42:34 PM4/27/17
to Chromium-dev, tyos...@chromium.org, j111...@163.com, dom...@google.com


On Thursday, April 27, 2017 at 7:58:50 AM UTC-4, John Smith wrote:
Dear Jochen
 
    i found src/.GN include many files.then i found  v8_extra_library_files variable in the v8/src/BUILD.gn
and i add 
 v8_extra_library_files = [ "//test/cctest/test-extra.js","//src/js/test.js" ] in the BUILD.gn, 96 line.

i run chromium app.it's can't run my test javascript? why?

I've updated https://bit.ly/v8-extras to be clearer about how things work in the GN world. See the instructions in the "Adding a V8 Extra" section. In particular, if you're trying to add one to Chrome, you shouldn't be editing V8's .gn file. Instead you should be editing Chrome's.

As for "can't run my test javascript", that's very vague. I'd suggest you start out with something very simple, such as the one in the doc, or perhaps something even simpler, like

(function (global) {
  global.testV8ExtraProp = "test";
});

and see if you can get that working first (i.e., build Chrome with that change, then open up the dev tools console and see if window.testV8Prop exists). Then build up from there.
 

John Smith

unread,
Apr 28, 2017, 3:50:21 AM4/28/17
to Chromium-dev, tyos...@chromium.org, j111...@163.com, dom...@google.com
Thanks very much.

    after read your design doc.
i add test.js to $src/.gn and regenerate the build directory. 
it's working well. thanks.

在 2017年4月28日星期五 UTC+8上午4:42:34,Domenic Denicola写道:
Reply all
Reply to author
Forward
0 new messages