Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Issue 353873003: Clean up usage of CSP functions (Closed)

Created:
6 years, 6 months ago by eseidel
Modified:
6 years, 5 months ago
CC:
abarth-chromium, arv+blink, blink-reviews, blink-reviews-bindings_chromium.org, blink-reviews-dom_chromium.org, blink-reviews-events_chromium.org, dglazkov+blink, eae+blinkwatch, gavinp+loader_chromium.org, Nate Chapin, rwlbuis, sof
Project:
blink
Visibility:
Public.

Description

Clean up usage of CSP functions I was very confused by the ScriptLoader code which called CSP::allowScriptNonce and the corresponding variable which was called isValidScriptNonce. I searched around for nonce functions and found that they only checked the nonce (not all policies) and I originally thought this was an error! However after further investigation I found that allowScriptNonce actually checks all active CSPs and returns true only if they all pass, thus making the following line (which disables further CSP checks on the load) OK. I renamed these allowScriptNonce and allowStyleNonce functions to have a 'With' in their name and added a comment in the header explaining their behavior. While making this change, I also reduced the verbosity of several repeated uses of the string ContentSecurityPolicy. I think most blink hackers would be able to look up that CSP refers to ContentSecurityPolicy. I removed several redundant calls to Document::contentSecurityPolicy (again just caused the lines to be needlessly verbose). Finally I made ScriptLoader::executeScript use the preferred early-return pattern instead of a long indented block for the !frame case. I suspect that the !frame check can actually be moved much earlier in the function or even turned into an ASSERT. This is still my long yack-shave to actually make the preloader correct so I can fix the bugs which my patch to make the HTML parser yield more agressively (and thus not starve the preloader) possible to land: https://codereview.chromium.org/258013009/ BUG=356292 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=177065

Patch Set 1 #

Patch Set 2 : Fixed null crash #

Patch Set 3 : Fix compile #

Patch Set 4 : Fix to apply #

Unified diffs Side-by-side diffs Delta from patch set Stats (+77 lines, -54 lines) Patch
M Source/bindings/v8/ScriptController.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/bindings/v8/ScriptController.cpp View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/dom/ScriptLoader.cpp View 3 chunks +28 lines, -22 lines 0 comments Download
M Source/core/dom/StyleElement.cpp View 1 chunk +7 lines, -2 lines 0 comments Download
M Source/core/fetch/ResourceFetcher.cpp View 1 2 3 4 chunks +17 lines, -9 lines 0 comments Download
M Source/core/frame/csp/ContentSecurityPolicy.h View 1 chunk +8 lines, -4 lines 0 comments Download
M Source/core/frame/csp/ContentSecurityPolicy.cpp View 2 chunks +5 lines, -5 lines 0 comments Download
M Source/core/loader/ImageLoader.cpp View 2 chunks +4 lines, -4 lines 0 comments Download
M Source/core/page/EventSource.cpp View 1 chunk +3 lines, -3 lines 0 comments Download
M Source/modules/websockets/WebSocket.cpp View 1 chunk +3 lines, -3 lines 0 comments Download

Messages

Total messages: 25 (0 generated)
eseidel
6 years, 6 months ago (2014-06-25 19:10:43 UTC) #1
abarth-chromium
lgtm
6 years, 6 months ago (2014-06-25 19:34:10 UTC) #2
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/eseidel@chromium.org/353873003/1
6 years, 6 months ago (2014-06-25 19:34:21 UTC) #3
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_blink_dbg on tryserver.blink ...
6 years, 6 months ago (2014-06-25 20:26:09 UTC) #4
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 6 months ago (2014-06-25 20:33:20 UTC) #5
commit-bot: I haz the power
Try jobs failed on following builders: linux_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/13334) mac_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/mac_blink_rel/builds/12804)
6 years, 6 months ago (2014-06-25 20:33:21 UTC) #6
eseidel
The CQ bit was checked by eseidel@chromium.org
6 years, 6 months ago (2014-06-26 00:19:57 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/eseidel@chromium.org/353873003/1
6 years, 6 months ago (2014-06-26 00:20:59 UTC) #8
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_blink_dbg on tryserver.blink ...
6 years, 6 months ago (2014-06-26 00:41:25 UTC) #9
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 6 months ago (2014-06-26 00:47:06 UTC) #10
commit-bot: I haz the power
Try jobs failed on following builders: linux_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/13366)
6 years, 6 months ago (2014-06-26 00:47:07 UTC) #11
eseidel
The CQ bit was checked by eseidel@chromium.org
6 years, 6 months ago (2014-06-26 16:34:22 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/eseidel@chromium.org/353873003/20001
6 years, 6 months ago (2014-06-26 16:36:07 UTC) #13
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: android_blink_compile_dbg on tryserver.blink ...
6 years, 6 months ago (2014-06-26 17:45:20 UTC) #14
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 6 months ago (2014-06-26 17:55:03 UTC) #15
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_gn_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_chromium_gn_rel/builds/1829)
6 years, 6 months ago (2014-06-26 17:55:04 UTC) #16
eseidel
The CQ bit was checked by eseidel@chromium.org
6 years, 6 months ago (2014-06-26 19:28:43 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/eseidel@chromium.org/353873003/40001
6 years, 6 months ago (2014-06-26 19:29:34 UTC) #18
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: android_blink_compile_dbg on tryserver.blink ...
6 years, 6 months ago (2014-06-26 22:36:44 UTC) #19
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 6 months ago (2014-06-26 22:38:20 UTC) #20
commit-bot: I haz the power
Try jobs failed on following builders: mac_blink_compile_dbg on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/mac_blink_compile_dbg/builds/10470)
6 years, 6 months ago (2014-06-26 22:38:21 UTC) #21
eseidel
The CQ bit was checked by eseidel@chromium.org
6 years, 5 months ago (2014-06-27 03:08:13 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/eseidel@chromium.org/353873003/60001
6 years, 5 months ago (2014-06-27 03:09:20 UTC) #23
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_chromium_gn_rel on tryserver.blink ...
6 years, 5 months ago (2014-06-27 04:08:25 UTC) #24
commit-bot: I haz the power
6 years, 5 months ago (2014-06-27 04:53:35 UTC) #25
Message was sent while issue was closed.
Change committed as 177065

Powered by Google App Engine
This is Rietveld 408576698