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

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp

Issue 2026983002: Only block http or https doc.written scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 if (!document.settings()) 88 if (!document.settings())
89 return false; 89 return false;
90 90
91 if (!document.frame()) 91 if (!document.frame())
92 return false; 92 return false;
93 93
94 // Only block synchronously loaded (parser blocking) scripts. 94 // Only block synchronously loaded (parser blocking) scripts.
95 if (defer != FetchRequest::NoDefer) 95 if (defer != FetchRequest::NoDefer)
96 return false; 96 return false;
97 97
98 if (!request.url().protocolIsInHTTPFamily())
99 return false;
100
98 // Avoid blocking same origin scripts, as they may be used to render main 101 // Avoid blocking same origin scripts, as they may be used to render main
99 // page content, whereas cross-origin scripts inserted via document.write 102 // page content, whereas cross-origin scripts inserted via document.write
100 // are likely to be third party content. 103 // are likely to be third party content.
101 if (request.url().host() == document.getSecurityOrigin()->domain()) 104 if (request.url().host() == document.getSecurityOrigin()->domain())
102 return false; 105 return false;
103 106
104 // Do not block scripts if it is a page reload. This is to enable pages to 107 // Do not block scripts if it is a page reload. This is to enable pages to
105 // recover if blocking of a script is leading to a page break and the user 108 // recover if blocking of a script is leading to a page break and the user
106 // reloads the page. 109 // reloads the page.
107 const FrameLoadType loadType = document.frame()->loader().loadType(); 110 const FrameLoadType loadType = document.frame()->loader().loadType();
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 } 816 }
814 817
815 DEFINE_TRACE(FrameFetchContext) 818 DEFINE_TRACE(FrameFetchContext)
816 { 819 {
817 visitor->trace(m_document); 820 visitor->trace(m_document);
818 visitor->trace(m_documentLoader); 821 visitor->trace(m_documentLoader);
819 FetchContext::trace(visitor); 822 FetchContext::trace(visitor);
820 } 823 }
821 824
822 } // namespace blink 825 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698