Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: third_party/WebKit/Source/core/dom/ScriptLoader.cpp

Issue 1487343002: Set credentials mode "same-origin" when crossOrigin=anonymous is set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 25 matching lines...) Expand all
36 #include "core/dom/Text.h" 36 #include "core/dom/Text.h"
37 #include "core/events/Event.h" 37 #include "core/events/Event.h"
38 #include "core/fetch/AccessControlStatus.h" 38 #include "core/fetch/AccessControlStatus.h"
39 #include "core/fetch/FetchRequest.h" 39 #include "core/fetch/FetchRequest.h"
40 #include "core/fetch/ResourceFetcher.h" 40 #include "core/fetch/ResourceFetcher.h"
41 #include "core/fetch/ScriptResource.h" 41 #include "core/fetch/ScriptResource.h"
42 #include "core/frame/LocalFrame.h" 42 #include "core/frame/LocalFrame.h"
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/CrossOriginAttribute.h"
46 #include "core/html/HTMLScriptElement.h" 47 #include "core/html/HTMLScriptElement.h"
47 #include "core/html/imports/HTMLImport.h" 48 #include "core/html/imports/HTMLImport.h"
48 #include "core/html/parser/HTMLParserIdioms.h" 49 #include "core/html/parser/HTMLParserIdioms.h"
49 #include "core/inspector/ConsoleMessage.h" 50 #include "core/inspector/ConsoleMessage.h"
50 #include "core/svg/SVGScriptElement.h" 51 #include "core/svg/SVGScriptElement.h"
51 #include "platform/MIMETypeRegistry.h" 52 #include "platform/MIMETypeRegistry.h"
52 #include "platform/weborigin/SecurityOrigin.h" 53 #include "platform/weborigin/SecurityOrigin.h"
53 #include "public/platform/WebFrameScheduler.h" 54 #include "public/platform/WebFrameScheduler.h"
54 #include "wtf/StdLibExtras.h" 55 #include "wtf/StdLibExtras.h"
55 #include "wtf/text/StringBuilder.h" 56 #include "wtf/text/StringBuilder.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 ASSERT(m_element); 284 ASSERT(m_element);
284 285
285 RefPtrWillBeRawPtr<Document> elementDocument(m_element->document()); 286 RefPtrWillBeRawPtr<Document> elementDocument(m_element->document());
286 if (!m_element->inDocument() || m_element->document() != elementDocument) 287 if (!m_element->inDocument() || m_element->document() != elementDocument)
287 return false; 288 return false;
288 289
289 ASSERT(!m_resource); 290 ASSERT(!m_resource);
290 if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) { 291 if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) {
291 FetchRequest request(ResourceRequest(elementDocument->completeURL(source Url)), m_element->localName()); 292 FetchRequest request(ResourceRequest(elementDocument->completeURL(source Url)), m_element->localName());
292 293
293 AtomicString crossOriginMode = m_element->fastGetAttribute(HTMLNames::cr ossoriginAttr); 294 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue(m_elem ent->fastGetAttribute(HTMLNames::crossoriginAttr));
294 if (!crossOriginMode.isNull()) 295 if (crossOrigin != CrossOriginAttributeNotSet)
295 request.setCrossOriginAccessControl(elementDocument->securityOrigin( ), crossOriginMode); 296 request.setCrossOriginAccessControl(elementDocument->securityOrigin( ), crossOrigin);
296 request.setCharset(scriptCharset()); 297 request.setCharset(scriptCharset());
297 298
298 bool scriptPassesCSP = elementDocument->contentSecurityPolicy()->allowSc riptWithNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr)); 299 bool scriptPassesCSP = elementDocument->contentSecurityPolicy()->allowSc riptWithNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr));
299 if (scriptPassesCSP) 300 if (scriptPassesCSP)
300 request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy); 301 request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy);
301 request.setDefer(defer); 302 request.setDefer(defer);
302 303
303 String integrityAttr = m_element->fastGetAttribute(HTMLNames::integrityA ttr); 304 String integrityAttr = m_element->fastGetAttribute(HTMLNames::integrityA ttr);
304 IntegrityMetadataSet metadataSet; 305 IntegrityMetadataSet metadataSet;
305 if (!integrityAttr.isEmpty()) { 306 if (!integrityAttr.isEmpty()) {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 if (isHTMLScriptLoader(element)) 519 if (isHTMLScriptLoader(element))
519 return toHTMLScriptElement(element)->loader(); 520 return toHTMLScriptElement(element)->loader();
520 521
521 if (isSVGScriptLoader(element)) 522 if (isSVGScriptLoader(element))
522 return toSVGScriptElement(element)->loader(); 523 return toSVGScriptElement(element)->loader();
523 524
524 return 0; 525 return 0;
525 } 526 }
526 527
527 } // namespace blink 528 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698