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

Side by Side Diff: Source/core/html/parser/HTMLScriptRunner.cpp

Issue 1010433007: Fire error event when script integrity check fails. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated comment Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/dom/ScriptLoader.cpp ('k') | Source/core/xml/parser/XMLDocumentParser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // Clear the pending script before possible rentrancy from executeScript() 145 // Clear the pending script before possible rentrancy from executeScript()
146 RefPtrWillBeRawPtr<Element> element = pendingScript.releaseElementAndClear() ; 146 RefPtrWillBeRawPtr<Element> element = pendingScript.releaseElementAndClear() ;
147 double compilationFinishTime = 0; 147 double compilationFinishTime = 0;
148 if (ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element.get())) { 148 if (ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element.get())) {
149 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); 149 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel);
150 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrem enter(m_document); 150 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrem enter(m_document);
151 if (errorOccurred) 151 if (errorOccurred)
152 scriptLoader->dispatchErrorEvent(); 152 scriptLoader->dispatchErrorEvent();
153 else { 153 else {
154 ASSERT(isExecutingScript()); 154 ASSERT(isExecutingScript());
155 scriptLoader->executeScript(sourceCode, &compilationFinishTime); 155 if (!scriptLoader->executeScript(sourceCode, &compilationFinishTime) ) {
156 element->dispatchEvent(createScriptLoadEvent()); 156 scriptLoader->dispatchErrorEvent();
157 } else {
158 element->dispatchEvent(createScriptLoadEvent());
159 }
157 } 160 }
158 } 161 }
159 // The exact value doesn't matter; valid time stamps are much bigger than th is value. 162 // The exact value doesn't matter; valid time stamps are much bigger than th is value.
160 const double epsilon = 1; 163 const double epsilon = 1;
161 if (pendingScriptType == PendingScript::ParsingBlocking && !m_parserBlocking ScriptAlreadyLoaded && compilationFinishTime > epsilon && loadFinishTime > epsil on) { 164 if (pendingScriptType == PendingScript::ParsingBlocking && !m_parserBlocking ScriptAlreadyLoaded && compilationFinishTime > epsilon && loadFinishTime > epsil on) {
162 blink::Platform::current()->histogramCustomCounts("WebCore.Scripts.Parsi ngBlocking.TimeBetweenLoadedAndCompiled", (compilationFinishTime - loadFinishTim e) * 1000, 0, 10000, 50); 165 blink::Platform::current()->histogramCustomCounts("WebCore.Scripts.Parsi ngBlocking.TimeBetweenLoadedAndCompiled", (compilationFinishTime - loadFinishTim e) * 1000, 0, 10000, 50);
163 } 166 }
164 167
165 ASSERT(!isExecutingScript()); 168 ASSERT(!isExecutingScript());
166 } 169 }
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 358
356 DEFINE_TRACE(HTMLScriptRunner) 359 DEFINE_TRACE(HTMLScriptRunner)
357 { 360 {
358 visitor->trace(m_document); 361 visitor->trace(m_document);
359 visitor->trace(m_host); 362 visitor->trace(m_host);
360 visitor->trace(m_parserBlockingScript); 363 visitor->trace(m_parserBlockingScript);
361 visitor->trace(m_scriptsToExecuteAfterParsing); 364 visitor->trace(m_scriptsToExecuteAfterParsing);
362 } 365 }
363 366
364 } 367 }
OLDNEW
« no previous file with comments | « Source/core/dom/ScriptLoader.cpp ('k') | Source/core/xml/parser/XMLDocumentParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698