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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 bool ScriptElement::requestScript(const String& sourceUrl) | 250 bool ScriptElement::requestScript(const String& sourceUrl) |
251 { | 251 { |
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 | 257 |
258 ASSERT(!m_cachedScript); | 258 ASSERT(!m_cachedScript); |
259 if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) { | 259 if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) { |
260 CachedResourceRequest request(ResourceRequest(m_element->document()->com
pleteURL(sourceUrl))); | 260 CachedResourceRequest request(ResourceRequest(m_element->document()->com
pleteURL(sourceUrl)), element()->localName()); |
261 | 261 |
262 String crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossori
ginAttr); | 262 String crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossori
ginAttr); |
263 if (!crossOriginMode.isNull()) { | 263 if (!crossOriginMode.isNull()) { |
264 m_requestUsesAccessControl = true; | 264 m_requestUsesAccessControl = true; |
265 StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMo
de, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; | 265 StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMo
de, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; |
266 updateRequestForAccessControl(request.mutableResourceRequest(), m_el
ement->document()->securityOrigin(), allowCredentials); | 266 updateRequestForAccessControl(request.mutableResourceRequest(), m_el
ement->document()->securityOrigin(), allowCredentials); |
267 } | 267 } |
268 request.setCharset(scriptCharset()); | 268 request.setCharset(scriptCharset()); |
269 request.setInitiator(element()); | |
270 | 269 |
271 bool isValidScriptNonce = m_element->document()->contentSecurityPolicy()
->allowScriptNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr)); | 270 bool isValidScriptNonce = m_element->document()->contentSecurityPolicy()
->allowScriptNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr)); |
272 if (isValidScriptNonce) | 271 if (isValidScriptNonce) |
273 request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy); | 272 request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy); |
274 | 273 |
275 m_cachedScript = m_element->document()->cachedResourceLoader()->requestS
cript(request); | 274 m_cachedScript = m_element->document()->cachedResourceLoader()->requestS
cript(request); |
276 m_isExternalScript = true; | 275 m_isExternalScript = true; |
277 } | 276 } |
278 | 277 |
279 if (m_cachedScript) { | 278 if (m_cachedScript) { |
(...skipping 142 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 |