| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 #include "platform/mhtml/MHTMLArchive.h" | 75 #include "platform/mhtml/MHTMLArchive.h" |
| 76 #include "platform/network/NetworkStateNotifier.h" | 76 #include "platform/network/NetworkStateNotifier.h" |
| 77 #include "platform/network/NetworkUtils.h" | 77 #include "platform/network/NetworkUtils.h" |
| 78 #include "platform/network/ResourceLoadPriority.h" | 78 #include "platform/network/ResourceLoadPriority.h" |
| 79 #include "platform/network/ResourceTimingInfo.h" | 79 #include "platform/network/ResourceTimingInfo.h" |
| 80 #include "platform/weborigin/SchemeRegistry.h" | 80 #include "platform/weborigin/SchemeRegistry.h" |
| 81 #include "platform/weborigin/SecurityPolicy.h" | 81 #include "platform/weborigin/SecurityPolicy.h" |
| 82 #include "public/platform/WebCachePolicy.h" | 82 #include "public/platform/WebCachePolicy.h" |
| 83 #include "public/platform/WebInsecureRequestPolicy.h" | 83 #include "public/platform/WebInsecureRequestPolicy.h" |
| 84 #include "public/platform/WebViewScheduler.h" | 84 #include "public/platform/WebViewScheduler.h" |
| 85 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.
h" |
| 85 #include "wtf/Vector.h" | 86 #include "wtf/Vector.h" |
| 86 | 87 |
| 87 namespace blink { | 88 namespace blink { |
| 88 | 89 |
| 89 namespace { | 90 namespace { |
| 90 | 91 |
| 91 void emitWarningForDocWriteScripts(const String& url, Document& document) { | 92 void emitWarningForDocWriteScripts(const String& url, Document& document) { |
| 92 String message = | 93 String message = |
| 93 "A Parser-blocking, cross site (i.e. different eTLD+1) script, " + url + | 94 "A Parser-blocking, cross site (i.e. different eTLD+1) script, " + url + |
| 94 ", is invoked via document.write. The network request for this script " | 95 ", is invoked via document.write. The network request for this script " |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 // service workers on a per-request basis. Additionally, it is necessary to | 817 // service workers on a per-request basis. Additionally, it is necessary to |
| 817 // explicitly return |false| here so that it is clear that the SW will be | 818 // explicitly return |false| here so that it is clear that the SW will be |
| 818 // bypassed. In particular, this is important for | 819 // bypassed. In particular, this is important for |
| 819 // ResourceFetcher::getCacheIdentifier(), which will return the SW's cache if | 820 // ResourceFetcher::getCacheIdentifier(), which will return the SW's cache if |
| 820 // the context's isControlledByServiceWorker() returns |true|, and thus will | 821 // the context's isControlledByServiceWorker() returns |true|, and thus will |
| 821 // returned cached resources from the service worker. That would have the | 822 // returned cached resources from the service worker. That would have the |
| 822 // effect of not bypassing the SW. | 823 // effect of not bypassing the SW. |
| 823 if (getSecurityOrigin() && getSecurityOrigin()->hasSuborigin()) | 824 if (getSecurityOrigin() && getSecurityOrigin()->hasSuborigin()) |
| 824 return false; | 825 return false; |
| 825 | 826 |
| 826 return localFrameClient()->isControlledByServiceWorker( | 827 auto* service_worker_network_provider = |
| 827 *masterDocumentLoader()); | 828 masterDocumentLoader()->getServiceWorkerNetworkProvider(); |
| 829 return service_worker_network_provider && |
| 830 service_worker_network_provider->isControlledByServiceWorker(); |
| 828 } | 831 } |
| 829 | 832 |
| 830 int64_t FrameFetchContext::serviceWorkerID() const { | 833 int64_t FrameFetchContext::serviceWorkerID() const { |
| 831 DCHECK(masterDocumentLoader()); | 834 DCHECK(masterDocumentLoader()); |
| 832 return localFrameClient()->serviceWorkerID(*masterDocumentLoader()); | 835 auto* service_worker_network_provider = |
| 836 masterDocumentLoader()->getServiceWorkerNetworkProvider(); |
| 837 return service_worker_network_provider && |
| 838 service_worker_network_provider->serviceWorkerID(); |
| 833 } | 839 } |
| 834 | 840 |
| 835 bool FrameFetchContext::isMainFrame() const { | 841 bool FrameFetchContext::isMainFrame() const { |
| 836 return frame()->isMainFrame(); | 842 return frame()->isMainFrame(); |
| 837 } | 843 } |
| 838 | 844 |
| 839 bool FrameFetchContext::defersLoading() const { | 845 bool FrameFetchContext::defersLoading() const { |
| 840 return frame()->page()->suspended(); | 846 return frame()->page()->suspended(); |
| 841 } | 847 } |
| 842 | 848 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 response); | 1054 response); |
| 1049 } | 1055 } |
| 1050 | 1056 |
| 1051 DEFINE_TRACE(FrameFetchContext) { | 1057 DEFINE_TRACE(FrameFetchContext) { |
| 1052 visitor->trace(m_document); | 1058 visitor->trace(m_document); |
| 1053 visitor->trace(m_documentLoader); | 1059 visitor->trace(m_documentLoader); |
| 1054 FetchContext::trace(visitor); | 1060 FetchContext::trace(visitor); |
| 1055 } | 1061 } |
| 1056 | 1062 |
| 1057 } // namespace blink | 1063 } // namespace blink |
| OLD | NEW |