Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 9846017: Make JavaScript sources compile into the library; convert JavaScript files on the fly (Closed)

Created:
March 14, 2013, 10:02 p.m. by Wladimir Palant
Modified:
April 3, 2013, 2:02 p.m.
Reviewers:
Felix Dahlke, Oleksandr
Visibility:
Public.

Description

With this change the dependency on the current directory is gone - the library will work no matter what directory it executes in. Also, our JS sources will always load. Previously the shell had to load them explicitly - I think that shouldn`t be necessary.

Patch Set 1 #

Total comments: 7

Patch Set 2 : Split various fake modules out of the large compat script #

Total comments: 2

Patch Set 3 : Review comments addressed #

Unified diffs Side-by-side diffs Delta from patch set Stats (+404 lines, -3776 lines) Patch
M .hgsub View 2 1 chunk +1 line, -0 lines 0 comments Download
M .hgsubstate View 2 1 chunk +1 line, -0 lines 0 comments Download
A convert_js.py View 1 2 1 chunk +45 lines, -0 lines 0 comments Download
M include/AdblockPlus/JsEngine.h View 1 2 1 chunk +3 lines, -1 line 0 comments Download
R lib/adblockplus.js View 2 1 chunk +0 lines, -3457 lines 0 comments Download
M lib/compat.js View 1 2 3 chunks +7 lines, -311 lines 0 comments Download
A lib/elemHideHitRegistration.js View 1 1 chunk +5 lines, -0 lines 0 comments Download
A lib/info.js View 1 1 chunk +5 lines, -0 lines 0 comments Download
A lib/io.js View 1 1 chunk +168 lines, -0 lines 0 comments Download
A lib/prefs.js View 1 1 chunk +19 lines, -0 lines 0 comments Download
A lib/utils.js View 1 1 chunk +82 lines, -0 lines 0 comments Download
M libadblockplus.gyp View 1 2 1 chunk +42 lines, -2 lines 0 comments Download
M shell/src/Main.cpp View 2 1 chunk +0 lines, -2 lines 0 comments Download
M src/JsEngine.cpp View 1 2 2 chunks +26 lines, -3 lines 0 comments Download

Messages

Total messages: 7
Wladimir Palant
March 14, 2013, 10:02 p.m. (2013-03-14 22:02:41 UTC) #1
Wladimir Palant
March 14, 2013, 10:25 p.m. (2013-03-14 22:25:01 UTC) #2
Felix Dahlke
Would you mind adding Oleksandr as a reviewer? I think it makes sense to keep ...
March 15, 2013, 8:07 a.m. (2013-03-15 08:07:56 UTC) #3
Wladimir Palant
On 2013/03/15 08:07:56, Felix H. Dahlke wrote: > Would you mind adding Oleksandr as a ...
March 15, 2013, 8:31 a.m. (2013-03-15 08:31:14 UTC) #4
Felix Dahlke
http://codereview.adblockplus.org/9846017/diff/1/convert_js.py File convert_js.py (right): http://codereview.adblockplus.org/9846017/diff/1/convert_js.py#newcode5 convert_js.py:5: base_dir = os.path.abspath(os.path.dirname(__file__)) Everything else is named using camel ...
March 15, 2013, 3:18 p.m. (2013-03-15 15:18:35 UTC) #5
Wladimir Palant
New patchset uploaded and I think I created a mess now :-( http://codereview.adblockplus.org/9846017/diff/1/include/AdblockPlus/JsEngine.h File include/AdblockPlus/JsEngine.h ...
March 15, 2013, 4 p.m. (2013-03-15 16:00:41 UTC) #6
Felix Dahlke
March 15, 2013, 5:10 p.m. (2013-03-15 17:10:47 UTC) #7
LGTM

http://codereview.adblockplus.org/9846017/diff/1/include/AdblockPlus/JsEngine.h
File include/AdblockPlus/JsEngine.h (right):

http://codereview.adblockplus.org/9846017/diff/1/include/AdblockPlus/JsEngine...
include/AdblockPlus/JsEngine.h:24: void Evaluate(const char* source, const char*
filename = NULL);
On 2013/03/15 16:00:41, Wladimir Palant wrote:
> On 2013/03/15 15:18:36, Felix H. Dahlke wrote:
> > Have you considered having just one Evaluate function
> > 
> > void Evaluate(const std::string& source, const std::string& filename = "")
> > 
> > and checking for "" instead of NULL?
> 
> I would rather use char* for the main function - we have our JS sources as
char*
> and that's what we are passing to V8, converting to std::string in between
> sounds pointless. Still, I can probably merge the two Evaluate functions using
> std::string.

It's up to you. std::string is obviously more C++-ish than const char*, and this
wouldn't be the only occasion where we (well, I, so far :D) wrap Google's C-y
API in a more C++-y way. The conversion overhead between char* and std::string
is neglectable in most cases.

Powered by Google App Engine
This is Rietveld