OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. |
6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> | 6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 456 |
457 RefPtrWillBeRawPtr<Document> elementDocument(m_element->document()); | 457 RefPtrWillBeRawPtr<Document> elementDocument(m_element->document()); |
458 RefPtrWillBeRawPtr<Document> contextDocument = elementDocument->contextDocum
ent().get(); | 458 RefPtrWillBeRawPtr<Document> contextDocument = elementDocument->contextDocum
ent().get(); |
459 if (!contextDocument) | 459 if (!contextDocument) |
460 return; | 460 return; |
461 | 461 |
462 ASSERT_UNUSED(resource, resource == m_resource); | 462 ASSERT_UNUSED(resource, resource == m_resource); |
463 | 463 |
464 ScriptRunner::ExecutionType runOrder = m_willExecuteInOrder ? ScriptRunner::
IN_ORDER_EXECUTION : ScriptRunner::ASYNC_EXECUTION; | 464 ScriptRunner::ExecutionType runOrder = m_willExecuteInOrder ? ScriptRunner::
IN_ORDER_EXECUTION : ScriptRunner::ASYNC_EXECUTION; |
465 if (m_resource->errorOccurred()) { | 465 if (m_resource->errorOccurred()) { |
| 466 contextDocument->scriptRunner()->notifyScriptLoadError(this, runOrder); |
466 dispatchErrorEvent(); | 467 dispatchErrorEvent(); |
467 // The error handler can move the HTMLScriptElement to a new document. | 468 detach(); |
468 // In that case, we must notify the ScriptRunner of the new document, | |
469 // not the ScriptRunner of the old docuemnt. | |
470 contextDocument = m_element->document().contextDocument().get(); | |
471 if (!contextDocument) | |
472 return; | |
473 contextDocument->scriptRunner()->notifyScriptLoadError(this, runOrder); | |
474 return; | 469 return; |
475 } | 470 } |
476 contextDocument->scriptRunner()->notifyScriptReady(this, runOrder); | 471 contextDocument->scriptRunner()->notifyScriptReady(this, runOrder); |
477 m_pendingScript->stopWatchingForLoad(); | 472 m_pendingScript->stopWatchingForLoad(); |
478 } | 473 } |
479 | 474 |
480 bool ScriptLoader::ignoresLoadRequest() const | 475 bool ScriptLoader::ignoresLoadRequest() const |
481 { | 476 { |
482 return m_alreadyStarted || m_isExternalScript || m_parserInserted || !elemen
t() || !element()->inDocument(); | 477 return m_alreadyStarted || m_isExternalScript || m_parserInserted || !elemen
t() || !element()->inDocument(); |
483 } | 478 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 if (isHTMLScriptLoader(element)) | 513 if (isHTMLScriptLoader(element)) |
519 return toHTMLScriptElement(element)->loader(); | 514 return toHTMLScriptElement(element)->loader(); |
520 | 515 |
521 if (isSVGScriptLoader(element)) | 516 if (isSVGScriptLoader(element)) |
522 return toSVGScriptElement(element)->loader(); | 517 return toSVGScriptElement(element)->loader(); |
523 | 518 |
524 return 0; | 519 return 0; |
525 } | 520 } |
526 | 521 |
527 } // namespace blink | 522 } // namespace blink |
OLD | NEW |