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

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

Issue 2416523002: Expose the initiating origin/URL of a navigation in the Blink public API (Closed)
Patch Set: Use less memory, add tests, etc. Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
6 * (http://www.torchmobile.com/) 6 * (http://www.torchmobile.com/)
7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
10 * Copyright (C) 2011 Google Inc. All rights reserved. 10 * Copyright (C) 2011 Google Inc. All rights reserved.
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 visitor->trace(m_provisionalItem); 214 visitor->trace(m_provisionalItem);
215 visitor->trace(m_deferredHistoryLoad); 215 visitor->trace(m_deferredHistoryLoad);
216 } 216 }
217 217
218 void FrameLoader::init() { 218 void FrameLoader::init() {
219 ResourceRequest initialRequest(KURL(ParsedURLString, emptyString())); 219 ResourceRequest initialRequest(KURL(ParsedURLString, emptyString()));
220 initialRequest.setRequestContext(WebURLRequest::RequestContextInternal); 220 initialRequest.setRequestContext(WebURLRequest::RequestContextInternal);
221 initialRequest.setFrameType(m_frame->isMainFrame() 221 initialRequest.setFrameType(m_frame->isMainFrame()
222 ? WebURLRequest::FrameTypeTopLevel 222 ? WebURLRequest::FrameTypeTopLevel
223 : WebURLRequest::FrameTypeNested); 223 : WebURLRequest::FrameTypeNested);
224 m_provisionalDocumentLoader = 224 m_provisionalDocumentLoader = client()->createDocumentLoader(
225 client()->createDocumentLoader(m_frame, initialRequest, SubstituteData(), 225 m_frame, initialRequest, SubstituteData(),
226 ClientRedirectPolicy::NotClientRedirect); 226 ClientRedirectPolicy::NotClientRedirect, nullptr);
227 m_provisionalDocumentLoader->startLoadingMainResource(); 227 m_provisionalDocumentLoader->startLoadingMainResource();
228 m_frame->document()->cancelParsing(); 228 m_frame->document()->cancelParsing();
229 m_stateMachine.advanceTo( 229 m_stateMachine.advanceTo(
230 FrameLoaderStateMachine::DisplayingInitialEmptyDocument); 230 FrameLoaderStateMachine::DisplayingInitialEmptyDocument);
231 // Self-suspend if created in an already deferred Page. Note that both 231 // Self-suspend if created in an already deferred Page. Note that both
232 // startLoadingMainResource() and cancelParsing() may have already detached 232 // startLoadingMainResource() and cancelParsing() may have already detached
233 // the frame, since they both fire JS events. 233 // the frame, since they both fire JS events.
234 if (m_frame->page() && m_frame->page()->defersLoading()) 234 if (m_frame->page() && m_frame->page()->defersLoading())
235 setDefersLoading(true); 235 setDefersLoading(true);
236 takeObjectSnapshot(); 236 takeObjectSnapshot();
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 // beforeunload fired above, and detaching a DocumentLoader can fire events, 1682 // beforeunload fired above, and detaching a DocumentLoader can fire events,
1683 // which can detach this frame. 1683 // which can detach this frame.
1684 if (!m_frame->host()) 1684 if (!m_frame->host())
1685 return; 1685 return;
1686 1686
1687 m_provisionalDocumentLoader = client()->createDocumentLoader( 1687 m_provisionalDocumentLoader = client()->createDocumentLoader(
1688 m_frame, resourceRequest, 1688 m_frame, resourceRequest,
1689 frameLoadRequest.substituteData().isValid() 1689 frameLoadRequest.substituteData().isValid()
1690 ? frameLoadRequest.substituteData() 1690 ? frameLoadRequest.substituteData()
1691 : defaultSubstituteDataForURL(resourceRequest.url()), 1691 : defaultSubstituteDataForURL(resourceRequest.url()),
1692 frameLoadRequest.clientRedirect()); 1692 frameLoadRequest.clientRedirect(), frameLoadRequest.originDocument());
Mike West 2016/11/23 11:11:20 How will this eventually work in a oopif world?
dcheng 2016/11/23 14:41:44 We'd still have a DocumentLoader in the original r
1693 m_provisionalDocumentLoader->setNavigationType(navigationType); 1693 m_provisionalDocumentLoader->setNavigationType(navigationType);
1694 m_provisionalDocumentLoader->setReplacesCurrentHistoryItem( 1694 m_provisionalDocumentLoader->setReplacesCurrentHistoryItem(
1695 type == FrameLoadTypeReplaceCurrentItem); 1695 type == FrameLoadTypeReplaceCurrentItem);
1696 m_frame->navigationScheduler().cancel(); 1696 m_frame->navigationScheduler().cancel();
1697 m_checkTimer.stop(); 1697 m_checkTimer.stop();
1698 1698
1699 m_loadType = type; 1699 m_loadType = type;
1700 1700
1701 if (frameLoadRequest.form()) 1701 if (frameLoadRequest.form())
1702 client()->dispatchWillSubmitForm(frameLoadRequest.form()); 1702 client()->dispatchWillSubmitForm(frameLoadRequest.form());
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 m_documentLoader ? m_documentLoader->url() : String()); 1952 m_documentLoader ? m_documentLoader->url() : String());
1953 return tracedValue; 1953 return tracedValue;
1954 } 1954 }
1955 1955
1956 inline void FrameLoader::takeObjectSnapshot() const { 1956 inline void FrameLoader::takeObjectSnapshot() const {
1957 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, 1957 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this,
1958 toTracedValue()); 1958 toTracedValue());
1959 } 1959 }
1960 1960
1961 } // namespace blink 1961 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698