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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 RefPtr<Document> originalDocument = m_element->document(); | 252 RefPtr<Document> originalDocument = m_element->document(); |
253 if (!m_element->dispatchBeforeLoadEvent(sourceUrl)) | 253 if (!m_element->dispatchBeforeLoadEvent(sourceUrl)) |
254 return false; | 254 return false; |
255 if (!m_element->inDocument() || m_element->document() != originalDocument) | 255 if (!m_element->inDocument() || m_element->document() != originalDocument) |
256 return false; | 256 return false; |
257 if (!m_element->document()->contentSecurityPolicy()->allowScriptNonce(m_elem
ent->fastGetAttribute(HTMLNames::nonceAttr), m_element->document()->url(), m_sta
rtLineNumber, m_element->document()->completeURL(sourceUrl))) | 257 if (!m_element->document()->contentSecurityPolicy()->allowScriptNonce(m_elem
ent->fastGetAttribute(HTMLNames::nonceAttr), m_element->document()->url(), m_sta
rtLineNumber, m_element->document()->completeURL(sourceUrl))) |
258 return false; | 258 return false; |
259 | 259 |
260 ASSERT(!m_cachedScript); | 260 ASSERT(!m_cachedScript); |
261 if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) { | 261 if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) { |
262 CachedResourceRequest request(ResourceRequest(m_element->document()->com
pleteURL(sourceUrl))); | 262 CachedResourceRequest request(ResourceRequest(m_element->document()->com
pleteURL(sourceUrl)), element()->localName()); |
263 | 263 |
264 String crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossori
ginAttr); | 264 String crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossori
ginAttr); |
265 if (!crossOriginMode.isNull()) { | 265 if (!crossOriginMode.isNull()) { |
266 m_requestUsesAccessControl = true; | 266 m_requestUsesAccessControl = true; |
267 StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMo
de, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; | 267 StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMo
de, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; |
268 updateRequestForAccessControl(request.mutableResourceRequest(), m_el
ement->document()->securityOrigin(), allowCredentials); | 268 updateRequestForAccessControl(request.mutableResourceRequest(), m_el
ement->document()->securityOrigin(), allowCredentials); |
269 } | 269 } |
270 request.setCharset(scriptCharset()); | 270 request.setCharset(scriptCharset()); |
271 request.setInitiator(element()); | |
272 | 271 |
273 m_cachedScript = m_element->document()->cachedResourceLoader()->requestS
cript(request); | 272 m_cachedScript = m_element->document()->cachedResourceLoader()->requestS
cript(request); |
274 m_isExternalScript = true; | 273 m_isExternalScript = true; |
275 } | 274 } |
276 | 275 |
277 if (m_cachedScript) { | 276 if (m_cachedScript) { |
278 return true; | 277 return true; |
279 } | 278 } |
280 | 279 |
281 dispatchErrorEvent(); | 280 dispatchErrorEvent(); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 | 421 |
423 #if ENABLE(SVG) | 422 #if ENABLE(SVG) |
424 if (element->isSVGElement() && element->hasTagName(SVGNames::scriptTag)) | 423 if (element->isSVGElement() && element->hasTagName(SVGNames::scriptTag)) |
425 return static_cast<SVGScriptElement*>(element); | 424 return static_cast<SVGScriptElement*>(element); |
426 #endif | 425 #endif |
427 | 426 |
428 return 0; | 427 return 0; |
429 } | 428 } |
430 | 429 |
431 } | 430 } |
OLD | NEW |