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

Side by Side Diff: Source/core/dom/ScriptRunner.cpp

Issue 1277273002: Revert of Upon load failure, remove sync script from execution queue. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/misc/script-sync-slow-scripts-onerror-expected.txt ('k') | no next file » | 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 void ScriptRunner::notifyScriptLoadError(ScriptLoader* scriptLoader, ExecutionTy pe executionType) 125 void ScriptRunner::notifyScriptLoadError(ScriptLoader* scriptLoader, ExecutionTy pe executionType)
126 { 126 {
127 switch (executionType) { 127 switch (executionType) {
128 case ASYNC_EXECUTION: 128 case ASYNC_EXECUTION:
129 // RELEASE_ASSERT makes us crash in a controlled way in error cases 129 // RELEASE_ASSERT makes us crash in a controlled way in error cases
130 // where the ScriptLoader is associated with the wrong ScriptRunner 130 // where the ScriptLoader is associated with the wrong ScriptRunner
131 // (otherwise we'd cause a use-after-free in ~ScriptRunner when it tries 131 // (otherwise we'd cause a use-after-free in ~ScriptRunner when it tries
132 // to detach). 132 // to detach).
133 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_pendingAsyncScripts.contains( scriptLoader)); 133 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_pendingAsyncScripts.contains( scriptLoader));
134 m_pendingAsyncScripts.remove(scriptLoader); 134 m_pendingAsyncScripts.remove(scriptLoader);
135 scriptLoader->detach();
136 m_document->decrementLoadEventDelayCount();
135 break; 137 break;
136 138
137 case IN_ORDER_EXECUTION: 139 case IN_ORDER_EXECUTION:
138 WillBeHeapDeque<RawPtrWillBeMember<ScriptLoader>>::iterator it = m_scrip tsToExecuteInOrder.begin(); 140 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!m_scriptsToExecuteInOrder.isEm pty());
139 while (it != m_scriptsToExecuteInOrder.end()) {
140 if (*it == scriptLoader) {
141 m_scriptsToExecuteInOrder.remove(it);
142 break;
143 }
144 ++it;
145 }
146 // Verifies same condition as above, but for in-order script loads.
147 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(it != m_scriptsToExecuteInOrder .end());
148 break; 141 break;
149 } 142 }
150 scriptLoader->detach();
151 m_document->decrementLoadEventDelayCount();
152 } 143 }
153 144
154 void ScriptRunner::movePendingAsyncScript(Document& oldDocument, Document& newDo cument, ScriptLoader* scriptLoader) 145 void ScriptRunner::movePendingAsyncScript(Document& oldDocument, Document& newDo cument, ScriptLoader* scriptLoader)
155 { 146 {
156 RefPtrWillBeRawPtr<Document> newContextDocument = newDocument.contextDocumen t().get(); 147 RefPtrWillBeRawPtr<Document> newContextDocument = newDocument.contextDocumen t().get();
157 if (!newContextDocument) { 148 if (!newContextDocument) {
158 // Document's contextDocument() method will return no Document if the 149 // Document's contextDocument() method will return no Document if the
159 // following conditions both hold: 150 // following conditions both hold:
160 // 151 //
161 // - The Document wasn't created with an explicit context document 152 // - The Document wasn't created with an explicit context document
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 { 235 {
245 #if ENABLE(OILPAN) 236 #if ENABLE(OILPAN)
246 visitor->trace(m_document); 237 visitor->trace(m_document);
247 visitor->trace(m_scriptsToExecuteInOrder); 238 visitor->trace(m_scriptsToExecuteInOrder);
248 visitor->trace(m_scriptsToExecuteSoon); 239 visitor->trace(m_scriptsToExecuteSoon);
249 visitor->trace(m_pendingAsyncScripts); 240 visitor->trace(m_pendingAsyncScripts);
250 #endif 241 #endif
251 } 242 }
252 243
253 } 244 }
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/misc/script-sync-slow-scripts-onerror-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698