| 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 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 66 } |
| 67 | 67 |
| 68 void HTMLScriptElement::childrenChanged(const ChildrenChange& change) | 68 void HTMLScriptElement::childrenChanged(const ChildrenChange& change) |
| 69 { | 69 { |
| 70 HTMLElement::childrenChanged(change); | 70 HTMLElement::childrenChanged(change); |
| 71 m_loader->childrenChanged(); | 71 m_loader->childrenChanged(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void HTMLScriptElement::didMoveToNewDocument(Document& oldDocument) | 74 void HTMLScriptElement::didMoveToNewDocument(Document& oldDocument) |
| 75 { | 75 { |
| 76 RefPtrWillBeRawPtr<Document> contextDocument = document().contextDocument().
get(); | 76 ScriptRunner::movePendingAsyncScript(oldDocument, document(), m_loader.get()
); |
| 77 if (!contextDocument) { | |
| 78 // Document's contextDocument() method will return no Document if the | |
| 79 // following conditions both hold: | |
| 80 // | |
| 81 // - The Document wasn't created with an explicit context document | |
| 82 // and that document is otherwise kept alive. | |
| 83 // - The Document itself is detached from its frame. | |
| 84 // | |
| 85 // The script element's loader is in that case moved to document() and | |
| 86 // its script runner, which is the non-null Document that contextDocumen
t() | |
| 87 // would return if not detached. | |
| 88 ASSERT(!document().frame()); | |
| 89 contextDocument = &document(); | |
| 90 } | |
| 91 oldDocument.scriptRunner()->movePendingAsyncScript(contextDocument->scriptRu
nner(), m_loader.get()); | |
| 92 HTMLElement::didMoveToNewDocument(oldDocument); | 77 HTMLElement::didMoveToNewDocument(oldDocument); |
| 93 } | 78 } |
| 94 | 79 |
| 95 void HTMLScriptElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) | 80 void HTMLScriptElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) |
| 96 { | 81 { |
| 97 if (name == srcAttr) | 82 if (name == srcAttr) |
| 98 m_loader->handleSourceAttribute(value); | 83 m_loader->handleSourceAttribute(value); |
| 99 else if (name == asyncAttr) | 84 else if (name == asyncAttr) |
| 100 m_loader->handleAsyncAttribute(); | 85 m_loader->handleAsyncAttribute(); |
| 101 else | 86 else |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 return adoptRefWillBeNoop(new HTMLScriptElement(document(), false, m_loader-
>alreadyStarted())); | 211 return adoptRefWillBeNoop(new HTMLScriptElement(document(), false, m_loader-
>alreadyStarted())); |
| 227 } | 212 } |
| 228 | 213 |
| 229 void HTMLScriptElement::trace(Visitor* visitor) | 214 void HTMLScriptElement::trace(Visitor* visitor) |
| 230 { | 215 { |
| 231 visitor->trace(m_loader); | 216 visitor->trace(m_loader); |
| 232 HTMLElement::trace(visitor); | 217 HTMLElement::trace(visitor); |
| 233 } | 218 } |
| 234 | 219 |
| 235 } | 220 } |
| OLD | NEW |