| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 ScriptState* scriptState = ScriptState::forMainWorld(frame()); | 843 ScriptState* scriptState = ScriptState::forMainWorld(frame()); |
| 844 DCHECK(scriptState); | 844 DCHECK(scriptState); |
| 845 return scriptState->context(); | 845 return scriptState->context(); |
| 846 } | 846 } |
| 847 | 847 |
| 848 bool WebFrame::scriptCanAccess(WebFrame* target) | 848 bool WebFrame::scriptCanAccess(WebFrame* target) |
| 849 { | 849 { |
| 850 return BindingSecurity::shouldAllowAccessToFrame(mainThreadIsolate(), callin
gDOMWindow(mainThreadIsolate()), target->toImplBase()->frame(), DoNotReportSecur
ityError); | 850 return BindingSecurity::shouldAllowAccessToFrame(mainThreadIsolate(), callin
gDOMWindow(mainThreadIsolate()), target->toImplBase()->frame(), DoNotReportSecur
ityError); |
| 851 } | 851 } |
| 852 | 852 |
| 853 void WebLocalFrameImpl::reload(bool ignoreCache) | 853 void WebLocalFrameImpl::reload(WebFrameLoadType loadType) |
| 854 { | 854 { |
| 855 // TODO(clamy): Remove this function once RenderFrame calls load for all | 855 // TODO(clamy): Remove this function once RenderFrame calls load for all |
| 856 // requests. | 856 // requests. |
| 857 reloadWithOverrideURL(KURL(), ignoreCache); | 857 reloadWithOverrideURL(KURL(), loadType); |
| 858 } | 858 } |
| 859 | 859 |
| 860 void WebLocalFrameImpl::reloadWithOverrideURL(const WebURL& overrideUrl, bool ig
noreCache) | 860 void WebLocalFrameImpl::reloadWithOverrideURL(const WebURL& overrideUrl, WebFram
eLoadType loadType) |
| 861 { | 861 { |
| 862 // TODO(clamy): Remove this function once RenderFrame calls load for all | 862 // TODO(clamy): Remove this function once RenderFrame calls load for all |
| 863 // requests. | 863 // requests. |
| 864 DCHECK(frame()); | 864 DCHECK(frame()); |
| 865 WebFrameLoadType loadType = ignoreCache ? | 865 DCHECK(loadType == WebFrameLoadType::Reload || loadType == WebFrameLoadType:
:ReloadBypassingCache); |
| 866 WebFrameLoadType::ReloadBypassingCache : WebFrameLoadType::Reload; | |
| 867 WebURLRequest request = requestForReload(loadType, overrideUrl); | 866 WebURLRequest request = requestForReload(loadType, overrideUrl); |
| 868 if (request.isNull()) | 867 if (request.isNull()) |
| 869 return; | 868 return; |
| 870 load(request, loadType, WebHistoryItem(), WebHistoryDifferentDocumentLoad, f
alse); | 869 load(request, loadType, WebHistoryItem(), WebHistoryDifferentDocumentLoad, f
alse); |
| 871 } | 870 } |
| 872 | 871 |
| 873 void WebLocalFrameImpl::reloadImage(const WebNode& webNode) | 872 void WebLocalFrameImpl::reloadImage(const WebNode& webNode) |
| 874 { | 873 { |
| 875 const Node* node = webNode.constUnwrap<Node>(); | 874 const Node* node = webNode.constUnwrap<Node>(); |
| 876 if (isHTMLImageElement(*node)) { | 875 if (isHTMLImageElement(*node)) { |
| (...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1921 const ResourceRequest& resourceRequest = request.toResourceRequest(); | 1920 const ResourceRequest& resourceRequest = request.toResourceRequest(); |
| 1922 | 1921 |
| 1923 if (resourceRequest.url().protocolIs("javascript") | 1922 if (resourceRequest.url().protocolIs("javascript") |
| 1924 && webFrameLoadType == WebFrameLoadType::Standard) { | 1923 && webFrameLoadType == WebFrameLoadType::Standard) { |
| 1925 loadJavaScriptURL(resourceRequest.url()); | 1924 loadJavaScriptURL(resourceRequest.url()); |
| 1926 return; | 1925 return; |
| 1927 } | 1926 } |
| 1928 | 1927 |
| 1929 FrameLoadRequest frameRequest = FrameLoadRequest(nullptr, resourceRequest); | 1928 FrameLoadRequest frameRequest = FrameLoadRequest(nullptr, resourceRequest); |
| 1930 if (isClientRedirect) | 1929 if (isClientRedirect) |
| 1931 frameRequest.setClientRedirect(ClientRedirect); | 1930 frameRequest.setClientRedirect(ClientRedirectPolicy::ClientRedirect); |
| 1932 RawPtr<HistoryItem> historyItem = RawPtr<HistoryItem>(item); | 1931 RawPtr<HistoryItem> historyItem = RawPtr<HistoryItem>(item); |
| 1933 frame()->loader().load( | 1932 frame()->loader().load( |
| 1934 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem.
get(), | 1933 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem.
get(), |
| 1935 static_cast<HistoryLoadType>(webHistoryLoadType)); | 1934 static_cast<HistoryLoadType>(webHistoryLoadType)); |
| 1936 } | 1935 } |
| 1937 | 1936 |
| 1938 void WebLocalFrameImpl::loadData(const WebData& data, const WebString& mimeType, | 1937 void WebLocalFrameImpl::loadData(const WebData& data, const WebString& mimeType, |
| 1939 const WebString& textEncoding, const WebURL& baseURL, const WebURL& unreacha
bleURL, bool replace, | 1938 const WebString& textEncoding, const WebURL& baseURL, const WebURL& unreacha
bleURL, bool replace, |
| 1940 WebFrameLoadType webFrameLoadType, const WebHistoryItem& item, | 1939 WebFrameLoadType webFrameLoadType, const WebHistoryItem& item, |
| 1941 WebHistoryLoadType webHistoryLoadType, bool isClientRedirect) | 1940 WebHistoryLoadType webHistoryLoadType, bool isClientRedirect) |
| 1942 { | 1941 { |
| 1943 DCHECK(frame()); | 1942 DCHECK(frame()); |
| 1944 | 1943 |
| 1945 // If we are loading substitute data to replace an existing load, then | 1944 // If we are loading substitute data to replace an existing load, then |
| 1946 // inherit all of the properties of that original request. This way, | 1945 // inherit all of the properties of that original request. This way, |
| 1947 // reload will re-attempt the original request. It is essential that | 1946 // reload will re-attempt the original request. It is essential that |
| 1948 // we only do this when there is an unreachableURL since a non-empty | 1947 // we only do this when there is an unreachableURL since a non-empty |
| 1949 // unreachableURL informs FrameLoader::reload to load unreachableURL | 1948 // unreachableURL informs FrameLoader::reload to load unreachableURL |
| 1950 // instead of the currently loaded URL. | 1949 // instead of the currently loaded URL. |
| 1951 ResourceRequest request; | 1950 ResourceRequest request; |
| 1952 if (replace && !unreachableURL.isEmpty() && frame()->loader().provisionalDoc
umentLoader()) | 1951 if (replace && !unreachableURL.isEmpty() && frame()->loader().provisionalDoc
umentLoader()) |
| 1953 request = frame()->loader().provisionalDocumentLoader()->originalRequest
(); | 1952 request = frame()->loader().provisionalDocumentLoader()->originalRequest
(); |
| 1954 request.setURL(baseURL); | 1953 request.setURL(baseURL); |
| 1955 request.setCheckForBrowserSideNavigation(false); | 1954 request.setCheckForBrowserSideNavigation(false); |
| 1956 | 1955 |
| 1957 FrameLoadRequest frameRequest(0, request, SubstituteData(data, mimeType, tex
tEncoding, unreachableURL)); | 1956 FrameLoadRequest frameRequest(0, request, SubstituteData(data, mimeType, tex
tEncoding, unreachableURL)); |
| 1958 DCHECK(frameRequest.substituteData().isValid()); | 1957 DCHECK(frameRequest.substituteData().isValid()); |
| 1959 frameRequest.setReplacesCurrentItem(replace); | 1958 frameRequest.setReplacesCurrentItem(replace); |
| 1960 if (isClientRedirect) | 1959 if (isClientRedirect) |
| 1961 frameRequest.setClientRedirect(ClientRedirect); | 1960 frameRequest.setClientRedirect(ClientRedirectPolicy::ClientRedirect); |
| 1962 | 1961 |
| 1963 RawPtr<HistoryItem> historyItem = RawPtr<HistoryItem>(item); | 1962 RawPtr<HistoryItem> historyItem = RawPtr<HistoryItem>(item); |
| 1964 frame()->loader().load( | 1963 frame()->loader().load( |
| 1965 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem.
get(), | 1964 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem.
get(), |
| 1966 static_cast<HistoryLoadType>(webHistoryLoadType)); | 1965 static_cast<HistoryLoadType>(webHistoryLoadType)); |
| 1967 } | 1966 } |
| 1968 | 1967 |
| 1969 bool WebLocalFrameImpl::isLoading() const | 1968 bool WebLocalFrameImpl::isLoading() const |
| 1970 { | 1969 { |
| 1971 if (!frame() || !frame()->document()) | 1970 if (!frame() || !frame()->document()) |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2173 return WebSandboxFlags::None; | 2172 return WebSandboxFlags::None; |
| 2174 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); | 2173 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); |
| 2175 } | 2174 } |
| 2176 | 2175 |
| 2177 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) | 2176 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) |
| 2178 { | 2177 { |
| 2179 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); | 2178 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); |
| 2180 } | 2179 } |
| 2181 | 2180 |
| 2182 } // namespace blink | 2181 } // namespace blink |
| OLD | NEW |