Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Clear integrity failure bit in PendingScript on release
Browse files Browse the repository at this point in the history
This fixes a bug where a script loaded after a previous script failed
due to an integrity failure would also fail to load. This is because the
PendingScript object was reused for the new script resource, and we
failed to clear out the m_integrityFailure bit. This simply sets that to
false when the old script resource is released.

BUG=570340

Review URL: https://codereview.chromium.org/1569823004

Cr-Commit-Position: refs/heads/master@{#368379}
  • Loading branch information
joelweinberger authored and Commit bot committed Jan 8, 2016
1 parent 0827d11 commit 2a03de6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<!-- Regression test for https://crbug.com/570340 -->
<title>Script loaded after failed integrity check should still load</title>
</head>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var should_fail_test = async_test('should fail');
var should_succeed_test = async_test('should succeed');

function should_fail(loaded) {
should_fail_test.step(function() {
if (loaded)
assert_unreached();
else
this.done();
});
}

function success() {
should_succeed_test.step(function() {
this.done();
});
}
</script>
<script onerror="should_fail(false);" onload="should_fail(true);" src="resources/simple-result.js" integrity="sha256-deadbeef"></script>
<script onerror="assert_unreached();" src="call-success.js"></script>
</body>
</html>
1 change: 1 addition & 0 deletions third_party/WebKit/Source/core/dom/PendingScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ PassRefPtrWillBeRawPtr<Element> PendingScript::releaseElementAndClear()
setScriptResource(0);
m_watchingForLoad = false;
m_startingPosition = TextPosition::belowRangePosition();
m_integrityFailure = false;
if (m_streamer)
m_streamer->cancel();
m_streamer.release();
Expand Down

0 comments on commit 2a03de6

Please sign in to comment.