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