Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 } | 197 } |
| 198 | 198 |
| 199 void ScriptRunner::notifyScriptLoadError(ScriptLoader* scriptLoader, ExecutionTy pe executionType) | 199 void ScriptRunner::notifyScriptLoadError(ScriptLoader* scriptLoader, ExecutionTy pe executionType) |
| 200 { | 200 { |
| 201 switch (executionType) { | 201 switch (executionType) { |
| 202 case ASYNC_EXECUTION: { | 202 case ASYNC_EXECUTION: { |
| 203 // RELEASE_ASSERT makes us crash in a controlled way in error cases | 203 // RELEASE_ASSERT makes us crash in a controlled way in error cases |
| 204 // where the ScriptLoader is associated with the wrong ScriptRunner | 204 // where the ScriptLoader is associated with the wrong ScriptRunner |
| 205 // (otherwise we'd cause a use-after-free in ~ScriptRunner when it tries | 205 // (otherwise we'd cause a use-after-free in ~ScriptRunner when it tries |
| 206 // to detach). | 206 // to detach). |
| 207 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_pendingAsyncScripts.contains( scriptLoader)); | 207 bool foundLoader = m_pendingAsyncScripts.contains(scriptLoader); |
| 208 foundLoader = foundLoader || (scriptLoader->isDetached() && m_pendingAsy ncScripts.isEmpty()); | |
|
haraken
2016/01/27 08:46:46
I understand the part of 'scriptLoader->isDetached
sof
2016/01/27 09:10:11
It is an indication of the ScriptRunner being in a
haraken
2016/01/27 09:13:07
Thanks, maybe worth adding a comment.
| |
| 209 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(foundLoader); | |
|
haraken
2016/01/27 08:46:46
Nit: I'd write RELEASE_ASSERT_WITH_SECURITY_IMPLIC
sof
2016/01/27 09:10:11
Sorry about the slight confusion - the previous li
| |
| 208 m_pendingAsyncScripts.remove(scriptLoader); | 210 m_pendingAsyncScripts.remove(scriptLoader); |
| 209 break; | 211 break; |
| 210 } | 212 } |
| 211 case IN_ORDER_EXECUTION: | 213 case IN_ORDER_EXECUTION: |
| 212 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(removePendingInOrderScript(scri ptLoader)); | 214 bool foundLoader = removePendingInOrderScript(scriptLoader); |
| 215 foundLoader = foundLoader || (scriptLoader->isDetached() && m_pendingInO rderScripts.isEmpty()); | |
| 216 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(foundLoader); | |
| 213 break; | 217 break; |
| 214 } | 218 } |
| 215 scriptLoader->detach(); | 219 scriptLoader->detach(); |
| 216 m_document->decrementLoadEventDelayCount(); | 220 m_document->decrementLoadEventDelayCount(); |
| 217 } | 221 } |
| 218 | 222 |
| 219 void ScriptRunner::movePendingScript(Document& oldDocument, Document& newDocumen t, ScriptLoader* scriptLoader) | 223 void ScriptRunner::movePendingScript(Document& oldDocument, Document& newDocumen t, ScriptLoader* scriptLoader) |
| 220 { | 224 { |
| 221 RefPtrWillBeRawPtr<Document> newContextDocument = newDocument.contextDocumen t().get(); | 225 RefPtrWillBeRawPtr<Document> newContextDocument = newDocument.contextDocumen t().get(); |
| 222 if (!newContextDocument) { | 226 if (!newContextDocument) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 #if ENABLE(OILPAN) | 293 #if ENABLE(OILPAN) |
| 290 visitor->trace(m_document); | 294 visitor->trace(m_document); |
| 291 visitor->trace(m_pendingInOrderScripts); | 295 visitor->trace(m_pendingInOrderScripts); |
| 292 visitor->trace(m_pendingAsyncScripts); | 296 visitor->trace(m_pendingAsyncScripts); |
| 293 visitor->trace(m_asyncScriptsToExecuteSoon); | 297 visitor->trace(m_asyncScriptsToExecuteSoon); |
| 294 visitor->trace(m_inOrderScriptsToExecuteSoon); | 298 visitor->trace(m_inOrderScriptsToExecuteSoon); |
| 295 #endif | 299 #endif |
| 296 } | 300 } |
| 297 | 301 |
| 298 } // namespace blink | 302 } // namespace blink |
| OLD | NEW |