Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(6087)

Issue 5489103: Inject into script tag, rather than eval, to be more debuggable under Chrome.

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 4 months ago by MarkM
Modified:
12 years, 4 months ago
Reviewers:
Jasvir
CC:
google-caja-discuss_googlegroups.com
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

* refactored startSES.js to separate wrapping from compilation, enabling other ways to recombine them, like script injection (see below). * compileExprLater.js -- Implemented a compileExprLater abstraction, which is like cajaVM.compileExpr, except that it returns a promise which eventually becomes the compiled expr function. This abstraction enables future interoperation with ES5/3, where server-side translation requires an asynchrony barrier. The compileExprLater, if it finds itself in a browser environment, uses script injection rather than "eval", avoiding yet more stratification bugs in Chrome's debugger. * refactored explicit.html to use compileExprLater, to load makeSimpleAMDLoader outside the SES TCB. It is therefore now also multiply instantiable and debuggable. * refactored makeSimpleAMDLoader.js to make use of compileExprLater to load AMD modules, making them also debuggable under the Chrome debugger. * repairES5.js and startSES.js -- The big additional feature in this CL is to "support override by assignment in SES", enabling SES to accept far more legacy best practice JS code. * repairES5.js -- More repairs * debug.js -- A start on being able to report stack traces for errors while still denying untrusted code access to these errors, all without translation. All platforms should be safe, but the stack capture works only on Chrome. * refactored startSES.js so all freezing of primordials is gathered together, as a step toward supporting confined SES (sacrificing defensiveness in exchange for greater legacy compatibility).

Patch Set 1 #

Patch Set 2 : Inject into script tag, rather than eval, to be more debuggable under Chrome. #

Patch Set 3 : Inject into script tag, rather than eval, to be more debuggable under Chrome. #

Patch Set 4 : Inject into script tag, rather than eval, to be more debuggable under Chrome. #

Patch Set 5 : Inject into script tag, rather than eval, to be more debuggable under Chrome. #

Patch Set 6 : Inject into script tag, rather than eval, to be more debuggable under Chrome. #

Patch Set 7 : Inject into script tag, rather than eval, to be more debuggable under Chrome. #

Patch Set 8 : Inject into script tag, rather than eval, to be more debuggable under Chrome. #

Patch Set 9 : Inject into script tag, rather than eval, to be more debuggable under Chrome. #

Total comments: 5

Patch Set 10 : Inject into script tag, rather than eval, to be more debuggable under Chrome. #

Patch Set 11 : Inject into script tag, rather than eval, to be more debuggable under Chrome. #

Patch Set 12 : Inject into script tag, rather than eval, to be more debuggable under Chrome. #

Patch Set 13 : Inject into script tag, rather than eval, to be more debuggable under Chrome. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1390 lines, -534 lines) Patch
M build.xml View 1 2 3 4 5 6 3 chunks +8 lines, -0 lines 0 comments Download
M src/com/google/caja/ses/StringMap.js View 1 2 3 4 5 6 7 8 1 chunk +38 lines, -31 lines 0 comments Download
M src/com/google/caja/ses/WeakMap.js View 1 2 3 4 2 chunks +10 lines, -1 line 0 comments Download
M src/com/google/caja/ses/amdTest.js View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +5 lines, -1 line 0 comments Download
M src/com/google/caja/ses/amdTest1.js View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -0 lines 0 comments Download
M src/com/google/caja/ses/amdTest3.js View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +13 lines, -3 lines 0 comments Download
M src/com/google/caja/ses/amdTestDir/amdTest2.js View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -0 lines 0 comments Download
M src/com/google/caja/ses/atLeastFreeVarNames.js View 1 2 chunks +2 lines, -1 line 0 comments Download
A src/com/google/caja/ses/compileExprLater.js View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +126 lines, -0 lines 0 comments Download
A src/com/google/caja/ses/debug.js View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +217 lines, -0 lines 0 comments Download
M src/com/google/caja/ses/detect.js View 1 2 3 4 5 6 7 8 9 10 1 chunk +8 lines, -0 lines 0 comments Download
M src/com/google/caja/ses/ejectorsGuardsTrademarks.js View 1 2 3 4 12 chunks +51 lines, -67 lines 0 comments Download
M src/com/google/caja/ses/explicit.html View 1 2 3 4 5 6 7 8 9 10 11 6 chunks +82 lines, -56 lines 0 comments Download
M src/com/google/caja/ses/hookupSES.js View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M src/com/google/caja/ses/hookupSESPlus.js View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M src/com/google/caja/ses/logger.js View 1 2 3 4 5 6 7 8 9 10 5 chunks +46 lines, -10 lines 0 comments Download
M src/com/google/caja/ses/makeFarResourceMaker.js View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +14 lines, -16 lines 0 comments Download
M src/com/google/caja/ses/makeQ.js View 1 2 3 4 5 6 7 8 9 10 11 12 chunks +41 lines, -42 lines 0 comments Download
M src/com/google/caja/ses/makeSimpleAMDLoader.js View 1 2 3 4 5 6 7 8 5 chunks +24 lines, -20 lines 0 comments Download
M src/com/google/caja/ses/repairES5.js View 1 2 3 4 5 6 7 8 9 10 11 22 chunks +452 lines, -125 lines 0 comments Download
M src/com/google/caja/ses/startSES.js View 1 2 3 4 5 6 7 8 9 10 24 chunks +203 lines, -151 lines 0 comments Download
M src/com/google/caja/ses/useHTMLLogger.js View 1 2 3 4 5 6 7 8 9 10 3 chunks +40 lines, -8 lines 0 comments Download
M src/com/google/caja/ses/whitelist.js View 1 2 3 4 2 chunks +4 lines, -0 lines 0 comments Download

Messages

Total messages: 2
MarkM
12 years, 4 months ago (2011-12-23 05:25:35 UTC) #1
Jasvir
12 years, 4 months ago (2011-12-28 04:09:34 UTC) #2
Not finished yet.

http://codereview.appspot.com/5489103/diff/2031/src/com/google/caja/ses/Strin...
File src/com/google/caja/ses/StringMap.js (right):

http://codereview.appspot.com/5489103/diff/2031/src/com/google/caja/ses/Strin...
src/com/google/caja/ses/StringMap.js:31: func.prototype = null;
Please check that new on bound functions works correctly.

http://codereview.appspot.com/5489103/diff/2031/src/com/google/caja/ses/compi...
File src/com/google/caja/ses/compileExprLater.js (right):

http://codereview.appspot.com/5489103/diff/2031/src/com/google/caja/ses/compi...
src/com/google/caja/ses/compileExprLater.js:93: var head =
document.getElementsByTagName("head")[0];
document.body.appendChild(script) will do.

http://codereview.appspot.com/5489103/diff/2031/src/com/google/caja/ses/compi...
src/com/google/caja/ses/compileExprLater.js:106: scriptSrc = '/* from ' +
opt_sourcePosition + ' */ ' + scriptSrc;
NOTE TO SELF: opt_sourcePosition.indexOf("*/") > 0 breaks this.

http://codereview.appspot.com/5489103/diff/2031/src/com/google/caja/ses/detec...
File src/com/google/caja/ses/detect.js (right):

http://codereview.appspot.com/5489103/diff/2031/src/com/google/caja/ses/detec...
src/com/google/caja/ses/detect.js:7: * @author Peter-Paul Koch, with
modifications my Mark S. Miller
s/my/by/

http://codereview.appspot.com/5489103/diff/2031/src/com/google/caja/ses/start...
File src/com/google/caja/ses/startSES.js (right):

http://codereview.appspot.com/5489103/diff/2031/src/com/google/caja/ses/start...
src/com/google/caja/ses/startSES.js:408: // debugger; // Useful for debugging --
to look at programSrc
Consider replacing this with a flag and doing the debugger in a finally instead.
 Rethrowing the error makes the debugger report this line which isnt a useful
line.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b