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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "core/frame/SubresourceIntegrity.h" | 43 #include "core/frame/SubresourceIntegrity.h" |
44 #include "core/frame/UseCounter.h" | 44 #include "core/frame/UseCounter.h" |
45 #include "core/frame/csp/ContentSecurityPolicy.h" | 45 #include "core/frame/csp/ContentSecurityPolicy.h" |
46 #include "core/html/HTMLScriptElement.h" | 46 #include "core/html/HTMLScriptElement.h" |
47 #include "core/html/imports/HTMLImport.h" | 47 #include "core/html/imports/HTMLImport.h" |
48 #include "core/html/parser/HTMLParserIdioms.h" | 48 #include "core/html/parser/HTMLParserIdioms.h" |
49 #include "core/inspector/ConsoleMessage.h" | 49 #include "core/inspector/ConsoleMessage.h" |
50 #include "core/svg/SVGScriptElement.h" | 50 #include "core/svg/SVGScriptElement.h" |
51 #include "platform/MIMETypeRegistry.h" | 51 #include "platform/MIMETypeRegistry.h" |
52 #include "platform/weborigin/SecurityOrigin.h" | 52 #include "platform/weborigin/SecurityOrigin.h" |
53 #include "public/platform/WebFrameScheduler.h" | |
54 #include "wtf/StdLibExtras.h" | 53 #include "wtf/StdLibExtras.h" |
55 #include "wtf/text/StringBuilder.h" | 54 #include "wtf/text/StringBuilder.h" |
56 #include "wtf/text/StringHash.h" | 55 #include "wtf/text/StringHash.h" |
57 | 56 |
58 namespace blink { | 57 namespace blink { |
59 | 58 |
60 ScriptLoader::ScriptLoader(Element* element, bool parserInserted, bool alreadySt
arted) | 59 ScriptLoader::ScriptLoader(Element* element, bool parserInserted, bool alreadySt
arted) |
61 : m_element(element) | 60 : m_element(element) |
62 , m_resource(0) | 61 , m_resource(0) |
63 , m_startLineNumber(WTF::OrdinalNumber::beforeFirst()) | 62 , m_startLineNumber(WTF::OrdinalNumber::beforeFirst()) |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 m_pendingScript = PendingScript(m_element, m_resource.get()); | 252 m_pendingScript = PendingScript(m_element, m_resource.get()); |
254 contextDocument->scriptRunner()->queueScriptForExecution(this, ScriptRun
ner::IN_ORDER_EXECUTION); | 253 contextDocument->scriptRunner()->queueScriptForExecution(this, ScriptRun
ner::IN_ORDER_EXECUTION); |
255 // Note that watchForLoad can immediately call notifyFinished. | 254 // Note that watchForLoad can immediately call notifyFinished. |
256 m_pendingScript.watchForLoad(this); | 255 m_pendingScript.watchForLoad(this); |
257 } else if (client->hasSourceAttribute()) { | 256 } else if (client->hasSourceAttribute()) { |
258 m_pendingScript = PendingScript(m_element, m_resource.get()); | 257 m_pendingScript = PendingScript(m_element, m_resource.get()); |
259 LocalFrame* frame = m_element->document().frame(); | 258 LocalFrame* frame = m_element->document().frame(); |
260 if (frame) { | 259 if (frame) { |
261 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 260 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
262 if (scriptState->contextIsValid()) | 261 if (scriptState->contextIsValid()) |
263 ScriptStreamer::startStreaming(m_pendingScript, PendingScript::A
sync, frame->settings(), scriptState, frame->frameScheduler()->loadingTaskRunner
()); | 262 ScriptStreamer::startStreaming(m_pendingScript, PendingScript::A
sync, frame->settings(), scriptState); |
264 } | 263 } |
265 contextDocument->scriptRunner()->queueScriptForExecution(this, ScriptRun
ner::ASYNC_EXECUTION); | 264 contextDocument->scriptRunner()->queueScriptForExecution(this, ScriptRun
ner::ASYNC_EXECUTION); |
266 // Note that watchForLoad can immediately call notifyFinished. | 265 // Note that watchForLoad can immediately call notifyFinished. |
267 m_pendingScript.watchForLoad(this); | 266 m_pendingScript.watchForLoad(this); |
268 } else { | 267 } else { |
269 // Reset line numbering for nested writes. | 268 // Reset line numbering for nested writes. |
270 TextPosition position = elementDocument.isInDocumentWrite() ? TextPositi
on() : scriptStartPosition; | 269 TextPosition position = elementDocument.isInDocumentWrite() ? TextPositi
on() : scriptStartPosition; |
271 KURL scriptURL = (!elementDocument.isInDocumentWrite() && m_parserInsert
ed) ? elementDocument.url() : KURL(); | 270 KURL scriptURL = (!elementDocument.isInDocumentWrite() && m_parserInsert
ed) ? elementDocument.url() : KURL(); |
272 if (!executeScript(ScriptSourceCode(scriptContent(), scriptURL, position
))) { | 271 if (!executeScript(ScriptSourceCode(scriptContent(), scriptURL, position
))) { |
273 dispatchErrorEvent(); | 272 dispatchErrorEvent(); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 if (isHTMLScriptLoader(element)) | 496 if (isHTMLScriptLoader(element)) |
498 return toHTMLScriptElement(element)->loader(); | 497 return toHTMLScriptElement(element)->loader(); |
499 | 498 |
500 if (isSVGScriptLoader(element)) | 499 if (isSVGScriptLoader(element)) |
501 return toSVGScriptElement(element)->loader(); | 500 return toSVGScriptElement(element)->loader(); |
502 | 501 |
503 return 0; | 502 return 0; |
504 } | 503 } |
505 | 504 |
506 } // namespace blink | 505 } // namespace blink |
OLD | NEW |