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

Unified Diff: Source/core/inspector/InspectorPageAgent.cpp

Issue 301983003: Make Inspector aware of RemoteFrames in FrameTree (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: yurys' review comment addressed Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/InspectorDOMAgent.cpp ('k') | Source/core/inspector/InspectorResourceAgent.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorPageAgent.cpp
diff --git a/Source/core/inspector/InspectorPageAgent.cpp b/Source/core/inspector/InspectorPageAgent.cpp
index 026838747d05f44f296b7a9e5ae92a9bf9d14b86..34a8ad461adceef33af978b289dcb844776d1e0f 100644
--- a/Source/core/inspector/InspectorPageAgent.cpp
+++ b/Source/core/inspector/InspectorPageAgent.cpp
@@ -589,9 +589,11 @@ void InspectorPageAgent::getCookies(ErrorString*, RefPtr<TypeBuilder::Array<Type
{
ListHashSet<Cookie> rawCookiesList;
- for (LocalFrame* frame = mainFrame(); frame; frame = frame->tree().traverseNext(mainFrame())) {
- Document* document = frame->document();
- Vector<KURL> allURLs = allResourcesURLsForFrame(frame);
+ for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext(mainFrame())) {
+ if (!frame->isLocalFrame())
+ continue;
+ Document* document = toLocalFrame(frame)->document();
+ Vector<KURL> allURLs = allResourcesURLsForFrame(toLocalFrame(frame));
for (Vector<KURL>::const_iterator it = allURLs.begin(); it != allURLs.end(); ++it) {
Vector<Cookie> docCookiesList;
getRawCookies(document, *it, docCookiesList);
@@ -609,8 +611,10 @@ void InspectorPageAgent::getCookies(ErrorString*, RefPtr<TypeBuilder::Array<Type
void InspectorPageAgent::deleteCookie(ErrorString*, const String& cookieName, const String& url)
{
KURL parsedURL(ParsedURLString, url);
- for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext(m_page->mainFrame()))
- WebCore::deleteCookie(frame->document(), parsedURL, cookieName);
+ for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext(m_page->mainFrame())) {
+ if (frame->isLocalFrame())
+ WebCore::deleteCookie(toLocalFrame(frame)->document(), parsedURL, cookieName);
+ }
}
void InspectorPageAgent::getResourceTree(ErrorString*, RefPtr<TypeBuilder::Page::FrameResourceTree>& object)
@@ -873,7 +877,10 @@ void InspectorPageAgent::didCommitLoad(LocalFrame*, DocumentLoader* loader)
void InspectorPageAgent::frameAttachedToParent(LocalFrame* frame)
{
- m_frontend->frameAttached(frameId(frame), frameId(frame->tree().parent()));
+ Frame* parentFrame = frame->tree().parent();
+ if (!parentFrame->isLocalFrame())
+ parentFrame = 0;
+ m_frontend->frameAttached(frameId(frame), frameId(toLocalFrame(parentFrame)));
}
void InspectorPageAgent::frameDetachedFromParent(LocalFrame* frame)
@@ -928,10 +935,13 @@ String InspectorPageAgent::loaderId(DocumentLoader* loader)
LocalFrame* InspectorPageAgent::findFrameWithSecurityOrigin(const String& originRawString)
{
- for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
- RefPtr<SecurityOrigin> documentOrigin = frame->document()->securityOrigin();
+ for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+ // FIXME: RemoteFrame security origins are not yet available.
+ if (!frame->isLocalFrame())
+ continue;
+ RefPtr<SecurityOrigin> documentOrigin = toLocalFrame(frame)->document()->securityOrigin();
if (documentOrigin->toRawString() == originRawString)
- return frame;
+ return toLocalFrame(frame);
}
return 0;
}
@@ -1076,8 +1086,9 @@ PassRefPtr<TypeBuilder::Page::Frame> InspectorPageAgent::buildObjectForFrame(Loc
.setUrl(urlWithoutFragment(frame->document()->url()).string())
.setMimeType(frame->loader().documentLoader()->responseMIMEType())
.setSecurityOrigin(frame->document()->securityOrigin()->toRawString());
- if (frame->tree().parent())
- frameObject->setParentId(frameId(frame->tree().parent()));
+ Frame* parentFrame = frame->tree().parent();
+ if (parentFrame && parentFrame->isLocalFrame())
+ frameObject->setParentId(frameId(toLocalFrame(parentFrame)));
if (frame->ownerElement()) {
AtomicString name = frame->ownerElement()->getNameAttribute();
if (name.isEmpty())
@@ -1122,12 +1133,14 @@ PassRefPtr<TypeBuilder::Page::FrameResourceTree> InspectorPageAgent::buildObject
}
RefPtr<TypeBuilder::Array<TypeBuilder::Page::FrameResourceTree> > childrenArray;
- for (LocalFrame* child = frame->tree().firstChild(); child; child = child->tree().nextSibling()) {
+ for (Frame* child = frame->tree().firstChild(); child; child = child->tree().nextSibling()) {
+ if (!child->isLocalFrame())
+ continue;
if (!childrenArray) {
childrenArray = TypeBuilder::Array<TypeBuilder::Page::FrameResourceTree>::create();
result->setChildFrames(childrenArray);
}
- childrenArray->addItem(buildObjectForFrameTree(child));
+ childrenArray->addItem(buildObjectForFrameTree(toLocalFrame(child)));
}
return result;
}
« no previous file with comments | « Source/core/inspector/InspectorDOMAgent.cpp ('k') | Source/core/inspector/InspectorResourceAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698