Index: third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp |
diff --git a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp |
index b5ace80374d6e31587b97471075d98ae087624e5..6a04527c5edf5d454e8aada34bb1b33af081de14 100644 |
--- a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp |
+++ b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp |
@@ -49,6 +49,7 @@ |
#include "core/html/imports/HTMLImportLoader.h" |
#include "core/html/imports/HTMLImportsController.h" |
#include "core/html/parser/TextResourceDecoder.h" |
+#include "core/inspector/AddStringToDigestor.h" |
#include "core/inspector/IdentifiersFactory.h" |
#include "core/inspector/InspectedFrames.h" |
#include "core/inspector/InspectorCSSAgent.h" |
@@ -89,16 +90,6 @@ static const char kAutoAttachToCreatedPages[] = "autoAttachToCreatedPages"; |
namespace { |
-KURL UrlWithoutFragment(const KURL& url) { |
- KURL result = url; |
- result.RemoveFragmentIdentifier(); |
- return result; |
-} |
- |
-String FrameId(LocalFrame* frame) { |
- return frame ? IdentifiersFactory::FrameId(frame) : ""; |
-} |
- |
String DialogTypeToProtocol(ChromeClient::DialogType dialog_type) { |
switch (dialog_type) { |
case ChromeClient::kAlertDialog: |
@@ -438,7 +429,7 @@ Response InspectorPageAgent::enable() { |
// Tell the browser the ids for all existing frames. |
for (LocalFrame* frame : *inspected_frames_) { |
- frame->Client()->SetDevToolsFrameId(FrameId(frame)); |
+ frame->Client()->SetDevToolsFrameId(IdentifiersFactory::FrameId(frame)); |
} |
return Response::OK(); |
} |
@@ -524,7 +515,7 @@ Response InspectorPageAgent::navigate(const String& url, |
Maybe<String> referrer, |
Maybe<String> transitionType, |
String* out_frame_id) { |
- *out_frame_id = FrameId(inspected_frames_->Root()); |
+ *out_frame_id = IdentifiersFactory::FrameId(inspected_frames_->Root()); |
return Response::OK(); |
} |
@@ -746,15 +737,15 @@ void InspectorPageAgent::FrameAttachedToParent(LocalFrame* frame) { |
parent_frame = 0; |
std::unique_ptr<SourceLocation> location = |
SourceLocation::CaptureWithFullStackTrace(); |
- String frame_id = FrameId(frame); |
+ String frame_id = IdentifiersFactory::FrameId(frame); |
frame->Client()->SetDevToolsFrameId(frame_id); |
GetFrontend()->frameAttached( |
- frame_id, FrameId(ToLocalFrame(parent_frame)), |
+ frame_id, IdentifiersFactory::FrameId(ToLocalFrame(parent_frame)), |
location ? location->BuildInspectorObject() : nullptr); |
} |
void InspectorPageAgent::FrameDetachedFromParent(LocalFrame* frame) { |
- GetFrontend()->frameDetached(FrameId(frame)); |
+ GetFrontend()->frameDetached(IdentifiersFactory::FrameId(frame)); |
} |
bool InspectorPageAgent::ScreencastEnabled() { |
@@ -763,23 +754,24 @@ bool InspectorPageAgent::ScreencastEnabled() { |
} |
void InspectorPageAgent::FrameStartedLoading(LocalFrame* frame, FrameLoadType) { |
- GetFrontend()->frameStartedLoading(FrameId(frame)); |
+ GetFrontend()->frameStartedLoading(IdentifiersFactory::FrameId(frame)); |
} |
void InspectorPageAgent::FrameStoppedLoading(LocalFrame* frame) { |
- GetFrontend()->frameStoppedLoading(FrameId(frame)); |
+ GetFrontend()->frameStoppedLoading(IdentifiersFactory::FrameId(frame)); |
} |
void InspectorPageAgent::FrameScheduledNavigation( |
LocalFrame* frame, |
ScheduledNavigation* scheduled_navigation) { |
GetFrontend()->frameScheduledNavigation( |
- FrameId(frame), scheduled_navigation->Delay(), |
+ IdentifiersFactory::FrameId(frame), scheduled_navigation->Delay(), |
ScheduledNavigationReasonToProtocol(scheduled_navigation->GetReason())); |
} |
void InspectorPageAgent::FrameClearedScheduledNavigation(LocalFrame* frame) { |
- GetFrontend()->frameClearedScheduledNavigation(FrameId(frame)); |
+ GetFrontend()->frameClearedScheduledNavigation( |
+ IdentifiersFactory::FrameId(frame)); |
} |
void InspectorPageAgent::WillRunJavaScriptDialog( |
@@ -833,20 +825,24 @@ void InspectorPageAgent::WindowCreated(LocalFrame* created) { |
std::unique_ptr<protocol::Page::Frame> InspectorPageAgent::BuildObjectForFrame( |
LocalFrame* frame) { |
+ KURL nofragment_document_url(frame->GetDocument()->Url()); |
+ nofragment_document_url.RemoveFragmentIdentifier(); |
std::unique_ptr<protocol::Page::Frame> frame_object = |
protocol::Page::Frame::create() |
- .setId(FrameId(frame)) |
+ .setId(IdentifiersFactory::FrameId(frame)) |
.setLoaderId( |
IdentifiersFactory::LoaderId(frame->Loader().GetDocumentLoader())) |
- .setUrl(UrlWithoutFragment(frame->GetDocument()->Url()).GetString()) |
+ .setUrl(nofragment_document_url.GetString()) |
.setMimeType(frame->Loader().GetDocumentLoader()->ResponseMIMEType()) |
.setSecurityOrigin( |
frame->GetDocument()->GetSecurityOrigin()->ToRawString()) |
.build(); |
// FIXME: This doesn't work for OOPI. |
Frame* parent_frame = frame->Tree().Parent(); |
- if (parent_frame && parent_frame->IsLocalFrame()) |
- frame_object->setParentId(FrameId(ToLocalFrame(parent_frame))); |
+ if (parent_frame && parent_frame->IsLocalFrame()) { |
+ frame_object->setParentId( |
+ IdentifiersFactory::FrameId(ToLocalFrame(parent_frame))); |
+ } |
if (frame->DeprecatedLocalOwner()) { |
AtomicString name = frame->DeprecatedLocalOwner()->GetNameAttribute(); |
if (name.IsEmpty()) |
@@ -871,9 +867,11 @@ InspectorPageAgent::BuildObjectForFrameTree(LocalFrame* frame) { |
HeapVector<Member<Resource>> all_resources = |
CachedResourcesForFrame(frame, true); |
for (Resource* cached_resource : all_resources) { |
+ KURL nofragment_cached_resource_url(cached_resource->Url()); |
+ nofragment_cached_resource_url.RemoveFragmentIdentifier(); |
std::unique_ptr<protocol::Page::FrameResource> resource_object = |
protocol::Page::FrameResource::create() |
- .setUrl(UrlWithoutFragment(cached_resource->Url()).GetString()) |
+ .setUrl(nofragment_cached_resource_url.GetString()) |
.setType(CachedResourceTypeJson(*cached_resource)) |
.setMimeType(cached_resource->GetResponse().MimeType()) |
.setContentSize(cached_resource->GetResponse().DecodedBodyLength()) |
@@ -891,9 +889,11 @@ InspectorPageAgent::BuildObjectForFrameTree(LocalFrame* frame) { |
HeapVector<Member<Document>> all_imports = |
InspectorPageAgent::ImportsForFrame(frame); |
for (Document* import : all_imports) { |
+ KURL nofragment_import_url(import->Url()); |
+ nofragment_import_url.RemoveFragmentIdentifier(); |
std::unique_ptr<protocol::Page::FrameResource> resource_object = |
protocol::Page::FrameResource::create() |
- .setUrl(UrlWithoutFragment(import->Url()).GetString()) |
+ .setUrl(nofragment_import_url.GetString()) |
.setType(ResourceTypeJson(InspectorPageAgent::kDocumentResource)) |
.setMimeType(import->SuggestedMIMEType()) |
.build(); |