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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!m_scriptsToExecuteInOrder.isEm
pty()); | 140 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!m_scriptsToExecuteInOrder.isEm
pty()); |
139 // Remove; script failed to load and error event has been dispatched. | |
140 ScriptLoader* script = m_scriptsToExecuteInOrder.takeFirst(); | |
141 ASSERT_UNUSED(script, script == scriptLoader); | |
142 break; | 141 break; |
143 } | 142 } |
144 scriptLoader->detach(); | |
145 m_document->decrementLoadEventDelayCount(); | |
146 } | 143 } |
147 | 144 |
148 void ScriptRunner::movePendingAsyncScript(Document& oldDocument, Document& newDo
cument, ScriptLoader* scriptLoader) | 145 void ScriptRunner::movePendingAsyncScript(Document& oldDocument, Document& newDo
cument, ScriptLoader* scriptLoader) |
149 { | 146 { |
150 RefPtrWillBeRawPtr<Document> newContextDocument = newDocument.contextDocumen
t().get(); | 147 RefPtrWillBeRawPtr<Document> newContextDocument = newDocument.contextDocumen
t().get(); |
151 if (!newContextDocument) { | 148 if (!newContextDocument) { |
152 // Document's contextDocument() method will return no Document if the | 149 // Document's contextDocument() method will return no Document if the |
153 // following conditions both hold: | 150 // following conditions both hold: |
154 // | 151 // |
155 // - 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 Loading... |
238 { | 235 { |
239 #if ENABLE(OILPAN) | 236 #if ENABLE(OILPAN) |
240 visitor->trace(m_document); | 237 visitor->trace(m_document); |
241 visitor->trace(m_scriptsToExecuteInOrder); | 238 visitor->trace(m_scriptsToExecuteInOrder); |
242 visitor->trace(m_scriptsToExecuteSoon); | 239 visitor->trace(m_scriptsToExecuteSoon); |
243 visitor->trace(m_pendingAsyncScripts); | 240 visitor->trace(m_pendingAsyncScripts); |
244 #endif | 241 #endif |
245 } | 242 } |
246 | 243 |
247 } | 244 } |
OLD | NEW |