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

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

Issue 2774843002: Pass AccessControlStatus to compileModule() (Closed)
Patch Set: const Created 3 years, 8 months 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 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 7 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 return false; 729 return false;
730 } 730 }
731 731
732 logScriptMIMEType(frame, resource, mimeType); 732 logScriptMIMEType(frame, resource, mimeType);
733 } 733 }
734 734
735 AccessControlStatus accessControlStatus = NotSharableCrossOrigin; 735 AccessControlStatus accessControlStatus = NotSharableCrossOrigin;
736 if (!m_isExternalScript) { 736 if (!m_isExternalScript) {
737 accessControlStatus = SharableCrossOrigin; 737 accessControlStatus = SharableCrossOrigin;
738 } else if (sourceCode.resource()) { 738 } else if (sourceCode.resource()) {
739 if (sourceCode.resource()->response().wasFetchedViaServiceWorker()) { 739 accessControlStatus = sourceCode.resource()->calculateAccessControlStatus(
740 if (sourceCode.resource()->response().serviceWorkerResponseType() == 740 m_element->document().getSecurityOrigin());
741 WebServiceWorkerResponseTypeOpaque)
742 accessControlStatus = OpaqueResource;
743 else
744 accessControlStatus = SharableCrossOrigin;
745 } else if (sourceCode.resource()->passesAccessControlCheck(
746 m_element->document().getSecurityOrigin())) {
747 accessControlStatus = SharableCrossOrigin;
748 }
749 } 741 }
750 742
751 const bool isImportedScript = contextDocument != elementDocument; 743 const bool isImportedScript = contextDocument != elementDocument;
752 744
753 // 3. "If the script is from an external file, 745 // 3. "If the script is from an external file,
754 // or the script's type is module", 746 // or the script's type is module",
755 // then increment the ignore-destructive-writes counter of the 747 // then increment the ignore-destructive-writes counter of the
756 // script element's node document. Let neutralized doc be that Document." 748 // script element's node document. Let neutralized doc be that Document."
757 // TODO(hiroshige): Implement "module" case. 749 // TODO(hiroshige): Implement "module" case.
758 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrementer( 750 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrementer(
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 // then abort these steps at this point. The script is not executed. 863 // then abort these steps at this point. The script is not executed.
872 return equalIgnoringCase(eventAttribute, "onload") || 864 return equalIgnoringCase(eventAttribute, "onload") ||
873 equalIgnoringCase(eventAttribute, "onload()"); 865 equalIgnoringCase(eventAttribute, "onload()");
874 } 866 }
875 867
876 String ScriptLoader::scriptContent() const { 868 String ScriptLoader::scriptContent() const {
877 return m_element->textFromChildren(); 869 return m_element->textFromChildren();
878 } 870 }
879 871
880 } // namespace blink 872 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698