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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 | 937 |
938 v8::Local<v8::Context> WebLocalFrameImpl::mainWorldScriptContext() const | 938 v8::Local<v8::Context> WebLocalFrameImpl::mainWorldScriptContext() const |
939 { | 939 { |
940 ScriptState* scriptState = ScriptState::forMainWorld(frame()); | 940 ScriptState* scriptState = ScriptState::forMainWorld(frame()); |
941 ASSERT(scriptState->contextIsValid()); | 941 ASSERT(scriptState->contextIsValid()); |
942 return scriptState->context(); | 942 return scriptState->context(); |
943 } | 943 } |
944 | 944 |
945 bool WebFrame::scriptCanAccess(WebFrame* target) | 945 bool WebFrame::scriptCanAccess(WebFrame* target) |
946 { | 946 { |
947 return BindingSecurity::shouldAllowAccessToFrame(mainThreadIsolate(), callin
gDOMWindow(mainThreadIsolate()), toCoreFrame(target), DoNotReportSecurityError); | 947 return BindingSecurity::shouldAllowAccessToFrame(mainThreadIsolate(), callin
gDOMWindow(mainThreadIsolate()), target->toImplBase()->frame(), DoNotReportSecur
ityError); |
948 } | 948 } |
949 | 949 |
950 void WebLocalFrameImpl::reload(bool ignoreCache) | 950 void WebLocalFrameImpl::reload(bool ignoreCache) |
951 { | 951 { |
952 // TODO(clamy): Remove this function once RenderFrame calls load for all | 952 // TODO(clamy): Remove this function once RenderFrame calls load for all |
953 // requests. | 953 // requests. |
954 reloadWithOverrideURL(KURL(), ignoreCache); | 954 reloadWithOverrideURL(KURL(), ignoreCache); |
955 } | 955 } |
956 | 956 |
957 void WebLocalFrameImpl::reloadWithOverrideURL(const WebURL& overrideUrl, bool ig
noreCache) | 957 void WebLocalFrameImpl::reloadWithOverrideURL(const WebURL& overrideUrl, bool ig
noreCache) |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 DEFINE_TRACE(WebLocalFrameImpl) | 1675 DEFINE_TRACE(WebLocalFrameImpl) |
1676 { | 1676 { |
1677 visitor->trace(m_frameLoaderClientImpl); | 1677 visitor->trace(m_frameLoaderClientImpl); |
1678 visitor->trace(m_frame); | 1678 visitor->trace(m_frame); |
1679 visitor->trace(m_devToolsAgent); | 1679 visitor->trace(m_devToolsAgent); |
1680 visitor->trace(m_textFinder); | 1680 visitor->trace(m_textFinder); |
1681 visitor->trace(m_printContext); | 1681 visitor->trace(m_printContext); |
1682 visitor->trace(m_geolocationClientProxy); | 1682 visitor->trace(m_geolocationClientProxy); |
1683 visitor->template registerWeakMembers<WebFrame, &WebFrame::clearWeakFrames>(
this); | 1683 visitor->template registerWeakMembers<WebFrame, &WebFrame::clearWeakFrames>(
this); |
1684 WebFrame::traceFrames(visitor, this); | 1684 WebFrame::traceFrames(visitor, this); |
| 1685 WebFrameImplBase::trace(visitor); |
1685 } | 1686 } |
1686 #endif | 1687 #endif |
1687 | 1688 |
1688 void WebLocalFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<LocalFrame> frame) | 1689 void WebLocalFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<LocalFrame> frame) |
1689 { | 1690 { |
1690 m_frame = frame; | 1691 m_frame = frame; |
1691 | 1692 |
1692 // FIXME: we shouldn't add overhead to every frame by registering these obje
cts when they're not used. | 1693 // FIXME: we shouldn't add overhead to every frame by registering these obje
cts when they're not used. |
1693 if (m_frame) { | 1694 if (m_frame) { |
1694 if (m_client) | 1695 if (m_client) |
(...skipping 19 matching lines...) Expand all Loading... |
1714 USBController::provideTo(*m_frame, m_client ? m_client->usbClient()
: nullptr); | 1715 USBController::provideTo(*m_frame, m_client ? m_client->usbClient()
: nullptr); |
1715 if (RuntimeEnabledFeatures::webVREnabled()) | 1716 if (RuntimeEnabledFeatures::webVREnabled()) |
1716 VRController::provideTo(*m_frame, m_client ? m_client->webVRClient()
: nullptr); | 1717 VRController::provideTo(*m_frame, m_client ? m_client->webVRClient()
: nullptr); |
1717 if (RuntimeEnabledFeatures::wakeLockEnabled()) | 1718 if (RuntimeEnabledFeatures::wakeLockEnabled()) |
1718 ScreenWakeLock::provideTo(*m_frame, m_client ? m_client->wakeLockCli
ent() : nullptr); | 1719 ScreenWakeLock::provideTo(*m_frame, m_client ? m_client->wakeLockCli
ent() : nullptr); |
1719 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) | 1720 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) |
1720 provideAudioOutputDeviceClientTo(*m_frame, AudioOutputDeviceClientIm
pl::create()); | 1721 provideAudioOutputDeviceClientTo(*m_frame, AudioOutputDeviceClientIm
pl::create()); |
1721 } | 1722 } |
1722 } | 1723 } |
1723 | 1724 |
1724 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::initializeCoreFrame(FrameH
ost* host, FrameOwner* owner, const AtomicString& name, const AtomicString& fall
backName) | 1725 void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name, const AtomicString& fallbackName) |
1725 { | 1726 { |
1726 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(m_frameLoaderClien
tImpl.get(), host, owner); | 1727 setCoreFrame(LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner))
; |
1727 setCoreFrame(frame); | 1728 frame()->tree().setName(name, fallbackName); |
1728 frame->tree().setName(name, fallbackName); | |
1729 // We must call init() after m_frame is assigned because it is referenced | 1729 // We must call init() after m_frame is assigned because it is referenced |
1730 // during init(). Note that this may dispatch JS events; the frame may be | 1730 // during init(). Note that this may dispatch JS events; the frame may be |
1731 // detached after init() returns. | 1731 // detached after init() returns. |
1732 frame->init(); | 1732 frame()->init(); |
1733 return frame; | |
1734 } | 1733 } |
1735 | 1734 |
1736 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra
meLoadRequest& request, | 1735 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra
meLoadRequest& request, |
1737 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) | 1736 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) |
1738 { | 1737 { |
1739 ASSERT(m_client); | 1738 ASSERT(m_client); |
1740 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); | 1739 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); |
1741 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() | 1740 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() |
1742 ? WebTreeScopeType::Document | 1741 ? WebTreeScopeType::Document |
1743 : WebTreeScopeType::Shadow; | 1742 : WebTreeScopeType::Shadow; |
1744 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner
Element->marginWidth(), ownerElement->marginHeight()); | 1743 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner
Element->marginWidth(), ownerElement->marginHeight()); |
1745 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild
Frame(this, scope, name, static_cast<WebSandboxFlags>(ownerElement->sandboxFlags
()), ownerProperties)); | 1744 RefPtrWillBeRawPtr<WebLocalFrameImpl> webframeChild = toWebLocalFrameImpl(m_
client->createChildFrame(this, scope, name, static_cast<WebSandboxFlags>(ownerEl
ement->sandboxFlags()), ownerProperties)); |
1746 if (!webframeChild) | 1745 if (!webframeChild) |
1747 return nullptr; | 1746 return nullptr; |
1748 | 1747 |
1749 // FIXME: Using subResourceAttributeName as fallback is not a perfect | 1748 // FIXME: Using subResourceAttributeName as fallback is not a perfect |
1750 // solution. subResourceAttributeName returns just one attribute name. The | 1749 // solution. subResourceAttributeName returns just one attribute name. The |
1751 // element might not have the attribute, and there might be other attributes | 1750 // element might not have the attribute, and there might be other attributes |
1752 // which can identify the element. | 1751 // which can identify the element. |
1753 RefPtrWillBeRawPtr<LocalFrame> child = webframeChild->initializeCoreFrame(fr
ame()->host(), ownerElement, name, ownerElement->getAttribute(ownerElement->subR
esourceAttributeName())); | 1752 webframeChild->initializeCoreFrame(frame()->host(), ownerElement, name, owne
rElement->getAttribute(ownerElement->subResourceAttributeName())); |
1754 // Initializing the core frame may cause the new child to be detached, since | 1753 // Initializing the core frame may cause the new child to be detached, since |
1755 // it may dispatch a load event in the parent. | 1754 // it may dispatch a load event in the parent. |
1756 if (!child->tree().parent()) | 1755 if (!webframeChild->parent()) |
1757 return nullptr; | 1756 return nullptr; |
1758 | 1757 |
1759 // If we're moving in the back/forward list, we might want to replace the co
ntent | 1758 // If we're moving in the back/forward list, we might want to replace the co
ntent |
1760 // of this child frame with whatever was there at that point. | 1759 // of this child frame with whatever was there at that point. |
1761 RefPtrWillBeRawPtr<HistoryItem> childItem = nullptr; | 1760 RefPtrWillBeRawPtr<HistoryItem> childItem = nullptr; |
1762 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen
t()->loadEventFinished()) | 1761 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen
t()->loadEventFinished()) |
1763 childItem = PassRefPtrWillBeRawPtr<HistoryItem>(webframeChild->client()-
>historyItemForNewChildFrame(webframeChild)); | 1762 childItem = PassRefPtrWillBeRawPtr<HistoryItem>(webframeChild->client()-
>historyItemForNewChildFrame(webframeChild.get())); |
1764 | 1763 |
1765 FrameLoadRequest newRequest = request; | 1764 FrameLoadRequest newRequest = request; |
1766 FrameLoadType loadType = FrameLoadTypeStandard; | 1765 FrameLoadType loadType = FrameLoadTypeStandard; |
1767 if (childItem) { | 1766 if (childItem) { |
1768 newRequest = FrameLoadRequest(request.originDocument(), | 1767 newRequest = FrameLoadRequest(request.originDocument(), |
1769 FrameLoader::resourceRequestFromHistoryItem(childItem.get(), UseProt
ocolCachePolicy)); | 1768 FrameLoader::resourceRequestFromHistoryItem(childItem.get(), UseProt
ocolCachePolicy)); |
1770 loadType = FrameLoadTypeInitialHistoryLoad; | 1769 loadType = FrameLoadTypeInitialHistoryLoad; |
1771 } | 1770 } |
1772 child->loader().load(newRequest, loadType, childItem.get()); | 1771 webframeChild->frame()->loader().load(newRequest, loadType, childItem.get())
; |
1773 | 1772 |
1774 // Note a synchronous navigation (about:blank) would have already processed | 1773 // Note a synchronous navigation (about:blank) would have already processed |
1775 // onload, so it is possible for the child frame to have already been | 1774 // onload, so it is possible for the child frame to have already been |
1776 // detached by script in the page. | 1775 // detached by script in the page. |
1777 if (!child->tree().parent()) | 1776 if (!webframeChild->parent()) |
1778 return nullptr; | 1777 return nullptr; |
1779 return child; | 1778 return webframeChild->frame(); |
1780 } | 1779 } |
1781 | 1780 |
1782 void WebLocalFrameImpl::didChangeContentsSize(const IntSize& size) | 1781 void WebLocalFrameImpl::didChangeContentsSize(const IntSize& size) |
1783 { | 1782 { |
1784 // This is only possible on the main frame. | 1783 // This is only possible on the main frame. |
1785 if (m_textFinder && m_textFinder->totalMatchCount() > 0) { | 1784 if (m_textFinder && m_textFinder->totalMatchCount() > 0) { |
1786 ASSERT(!parent()); | 1785 ASSERT(!parent()); |
1787 m_textFinder->increaseMarkerVersion(); | 1786 m_textFinder->increaseMarkerVersion(); |
1788 } | 1787 } |
1789 } | 1788 } |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1977 // Internally, Blink uses CommittedMultipleRealLoads to track whether the | 1976 // Internally, Blink uses CommittedMultipleRealLoads to track whether the |
1978 // next commit should create a new history item or not. Ensure we have | 1977 // next commit should create a new history item or not. Ensure we have |
1979 // reached that state. | 1978 // reached that state. |
1980 if (frameLoader.stateMachine()->committedMultipleRealLoads()) | 1979 if (frameLoader.stateMachine()->committedMultipleRealLoads()) |
1981 return; | 1980 return; |
1982 frameLoader.stateMachine()->advanceTo(FrameLoaderStateMachine::CommittedMult
ipleRealLoads); | 1981 frameLoader.stateMachine()->advanceTo(FrameLoaderStateMachine::CommittedMult
ipleRealLoads); |
1983 } | 1982 } |
1984 | 1983 |
1985 void WebLocalFrameImpl::initializeToReplaceRemoteFrame(WebRemoteFrame* oldWebFra
me, const WebString& name, WebSandboxFlags flags, const WebFrameOwnerProperties&
frameOwnerProperties) | 1984 void WebLocalFrameImpl::initializeToReplaceRemoteFrame(WebRemoteFrame* oldWebFra
me, const WebString& name, WebSandboxFlags flags, const WebFrameOwnerProperties&
frameOwnerProperties) |
1986 { | 1985 { |
1987 Frame* oldFrame = toCoreFrame(oldWebFrame); | 1986 Frame* oldFrame = oldWebFrame->toImplBase()->frame(); |
1988 // Note: this *always* temporarily sets a frame owner, even for main frames! | 1987 // Note: this *always* temporarily sets a frame owner, even for main frames! |
1989 // When a core Frame is created with no owner, it attempts to set itself as | 1988 // When a core Frame is created with no owner, it attempts to set itself as |
1990 // the main frame of the Page. However, this is a provisional frame, and may | 1989 // the main frame of the Page. However, this is a provisional frame, and may |
1991 // disappear, so Page::m_mainFrame can't be updated just yet. | 1990 // disappear, so Page::m_mainFrame can't be updated just yet. |
1992 OwnPtrWillBeRawPtr<FrameOwner> tempOwner = RemoteBridgeFrameOwner::create(nu
llptr, SandboxNone, WebFrameOwnerProperties()); | 1991 OwnPtrWillBeRawPtr<FrameOwner> tempOwner = RemoteBridgeFrameOwner::create(nu
llptr, SandboxNone, WebFrameOwnerProperties()); |
1993 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(m_frameLoaderClien
tImpl.get(), oldFrame->host(), tempOwner.get()); | 1992 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(m_frameLoaderClien
tImpl.get(), oldFrame->host(), tempOwner.get()); |
1994 frame->setOwner(oldFrame->owner()); | 1993 frame->setOwner(oldFrame->owner()); |
1995 frame->tree().setName(name); | 1994 frame->tree().setName(name); |
1996 setParent(oldWebFrame->parent()); | 1995 setParent(oldWebFrame->parent()); |
1997 setOpener(oldWebFrame->opener()); | 1996 setOpener(oldWebFrame->opener()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2033 | 2032 |
2034 WebDevToolsAgent* WebLocalFrameImpl::devToolsAgent() | 2033 WebDevToolsAgent* WebLocalFrameImpl::devToolsAgent() |
2035 { | 2034 { |
2036 return m_devToolsAgent.get(); | 2035 return m_devToolsAgent.get(); |
2037 } | 2036 } |
2038 | 2037 |
2039 void WebLocalFrameImpl::setFrameOwnerProperties(const WebFrameOwnerProperties& f
rameOwnerProperties) | 2038 void WebLocalFrameImpl::setFrameOwnerProperties(const WebFrameOwnerProperties& f
rameOwnerProperties) |
2040 { | 2039 { |
2041 // At the moment, this is only used to replicate frame owner properties | 2040 // At the moment, this is only used to replicate frame owner properties |
2042 // for frames with a remote owner. | 2041 // for frames with a remote owner. |
2043 FrameOwner* owner = toCoreFrame(this)->owner(); | 2042 FrameOwner* owner = frame()->owner(); |
2044 ASSERT(owner); | 2043 ASSERT(owner); |
2045 toRemoteBridgeFrameOwner(owner)->setScrollingMode(frameOwnerProperties.scrol
lingMode); | 2044 toRemoteBridgeFrameOwner(owner)->setScrollingMode(frameOwnerProperties.scrol
lingMode); |
2046 toRemoteBridgeFrameOwner(owner)->setMarginWidth(frameOwnerProperties.marginW
idth); | 2045 toRemoteBridgeFrameOwner(owner)->setMarginWidth(frameOwnerProperties.marginW
idth); |
2047 toRemoteBridgeFrameOwner(owner)->setMarginHeight(frameOwnerProperties.margin
Height); | 2046 toRemoteBridgeFrameOwner(owner)->setMarginHeight(frameOwnerProperties.margin
Height); |
2048 } | 2047 } |
2049 | 2048 |
2050 void WebLocalFrameImpl::sendPings(const WebNode& contextNode, const WebURL& dest
inationURL) | 2049 void WebLocalFrameImpl::sendPings(const WebNode& contextNode, const WebURL& dest
inationURL) |
2051 { | 2050 { |
2052 ASSERT(frame()); | 2051 ASSERT(frame()); |
2053 Element* anchor = contextNode.constUnwrap<Node>()->enclosingLinkEventParentO
rSelf(); | 2052 Element* anchor = contextNode.constUnwrap<Node>()->enclosingLinkEventParentO
rSelf(); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2212 } | 2211 } |
2213 | 2212 |
2214 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const | 2213 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const |
2215 { | 2214 { |
2216 if (!frame()) | 2215 if (!frame()) |
2217 return WebSandboxFlags::None; | 2216 return WebSandboxFlags::None; |
2218 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); | 2217 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); |
2219 } | 2218 } |
2220 | 2219 |
2221 } // namespace blink | 2220 } // namespace blink |
OLD | NEW |