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

Issue 10370047: Implement load events for <script>; fix existing script nodes getting rewritten. (Closed)

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

Description

* A <script> element evaluated in the sandbox now fires a 'load' event after successful eval and an 'error' event otherwise. No error details are yet included. * Taming a <script> element which is already in the document does not replace its content with a caja_dynamic_script*___ hook. This includes script elements that are static HTML. The problematic behavior was introduced in r5358. Supporting changes: * The onerror= attribute is now whitelisted everywhere, per HTML5. * Refactoring in html-emitter.js: resolveUntrustedExternal now passes its results to the continuation function rather than taking a separate handler function, and is no longer responsible for providing substitute content on error. Fixes <https://code.google.com/p/google-caja/issues/detail?id=1763>. @r5455

Patch Set 1 #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+163 lines, -48 lines) Patch
M src/com/google/caja/lang/html/html5-attributes-defs.json View 1 chunk +1 line, -0 lines 0 comments Download
M src/com/google/caja/lang/html/html5-attributes-whitelist.json View 1 chunk +1 line, -0 lines 0 comments Download
M src/com/google/caja/plugin/bridal.js View 1 chunk +2 lines, -2 lines 0 comments Download
M src/com/google/caja/plugin/domado.js View 4 chunks +35 lines, -5 lines 2 comments Download
M src/com/google/caja/plugin/html-emitter.js View 13 chunks +46 lines, -27 lines 2 comments Download
M tests/com/google/caja/plugin/es53-test-domado-dom-guest.html View 4 chunks +6 lines, -11 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-domado-global.js View 1 chunk +1 line, -3 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-external-script-guest.html View 1 chunk +70 lines, -0 lines 3 comments Download
A tests/com/google/caja/plugin/es53-test-external-script-onload.js View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 4
kpreid2
12 years, 8 months ago (2013-06-18 19:26:26 UTC) #1
felix8a
lgtm https://codereview.appspot.com/10370047/diff/1/src/com/google/caja/plugin/domado.js File src/com/google/caja/plugin/domado.js (right): https://codereview.appspot.com/10370047/diff/1/src/com/google/caja/plugin/domado.js#newcode6151 src/com/google/caja/plugin/domado.js:6151: postInitCreatedElement.call(tameEl); // Hook for <script> not sure why ...
12 years, 8 months ago (2013-06-19 20:01:18 UTC) #2
kpreid2
https://codereview.appspot.com/10370047/diff/1/src/com/google/caja/plugin/domado.js File src/com/google/caja/plugin/domado.js (right): https://codereview.appspot.com/10370047/diff/1/src/com/google/caja/plugin/domado.js#newcode6151 src/com/google/caja/plugin/domado.js:6151: postInitCreatedElement.call(tameEl); // Hook for <script> On 2013/06/19 20:01:19, felix8a ...
12 years, 8 months ago (2013-06-19 20:33:27 UTC) #3
felix8a
12 years, 8 months ago (2013-06-19 20:50:18 UTC) #4
https://codereview.appspot.com/10370047/diff/1/tests/com/google/caja/plugin/e...
File tests/com/google/caja/plugin/es53-test-external-script-guest.html (right):

https://codereview.appspot.com/10370047/diff/1/tests/com/google/caja/plugin/e...
tests/com/google/caja/plugin/es53-test-external-script-guest.html:115: if
(willRun) {
On 2013/06/19 20:33:27, kpreid2 wrote:
> On 2013/06/19 20:01:19, felix8a wrote:
> > the willRun flag bothers me. this function is very specific to just two
tests,
> > it's not more general than that, and generally I find that factoring out
> common
> > code for just 2 cases obscures logic more than helps. probably not worth
> > worrying about in this case.
> 
> I disagree: there's a lot of subtlety in this checking of event dispatch, and
> having even 15 lines of almost duplicated (but slightly different due to what
> would be willRun) code is too much.
> 
> I think there are other places, too, in our existing test suite where our
tests
> are insufficiently rigorous, simply because we have no abstractions for
testing
> the correct behavior and so doing so in the specific case would be tedious.

I don't disagree that the common code is complex. I'm saying, the weird
specificity of "willRun" seems like maybe the wrong type of abstraction is being
applied. but again, this case is not worth worrying about.
Sign in to reply to this message.

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