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 if (RefPtrWillBeRawPtr<Document> contextDocument = document().contextDocumen t().get()) | 76 RefPtrWillBeRawPtr<Document> contextDocument = document().contextDocument(). get(); |
77 oldDocument.scriptRunner()->movePendingAsyncScript(contextDocument->scri ptRunner(), m_loader.get()); | 77 if (!contextDocument) { |
haraken
2014/12/18 14:30:22
I'd slightly prefer:
RefPtrWillBeRawPtr<Document>
sof
2014/12/30 11:00:51
Thanks for bringing this up. That wouldn't be quit
| |
78 ASSERT(!document().frame()); | |
79 // A frame-detached document is handled as having no context | |
80 // document - it would be the document if not detached. The | |
81 // newly moved script element needs to be the latter here as | |
82 // the script loader for the pending script must also move to | |
83 // reside with that document and its script runner. | |
84 contextDocument = &document(); | |
marja
2014/12/18 10:27:47
In this case, is oldDocument also the same as docu
sof
2014/12/18 10:29:37
No, higher up in the node adoption handling checks
| |
85 } | |
86 oldDocument.scriptRunner()->movePendingAsyncScript(contextDocument->scriptRu nner(), m_loader.get()); | |
78 HTMLElement::didMoveToNewDocument(oldDocument); | 87 HTMLElement::didMoveToNewDocument(oldDocument); |
79 } | 88 } |
80 | 89 |
81 void HTMLScriptElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) | 90 void HTMLScriptElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) |
82 { | 91 { |
83 if (name == srcAttr) | 92 if (name == srcAttr) |
84 m_loader->handleSourceAttribute(value); | 93 m_loader->handleSourceAttribute(value); |
85 else if (name == asyncAttr) | 94 else if (name == asyncAttr) |
86 m_loader->handleAsyncAttribute(); | 95 m_loader->handleAsyncAttribute(); |
87 else | 96 else |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 return adoptRefWillBeNoop(new HTMLScriptElement(document(), false, m_loader- >alreadyStarted())); | 221 return adoptRefWillBeNoop(new HTMLScriptElement(document(), false, m_loader- >alreadyStarted())); |
213 } | 222 } |
214 | 223 |
215 void HTMLScriptElement::trace(Visitor* visitor) | 224 void HTMLScriptElement::trace(Visitor* visitor) |
216 { | 225 { |
217 visitor->trace(m_loader); | 226 visitor->trace(m_loader); |
218 HTMLElement::trace(visitor); | 227 HTMLElement::trace(visitor); |
219 } | 228 } |
220 | 229 |
221 } | 230 } |
OLD | NEW |