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 337dbbb7094f996c26261b66637ccb83cb057511..31565342a124482ee61aeb5127bf354612e15deb 100644 |
--- a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp |
+++ b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp |
@@ -88,16 +88,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: |
@@ -415,7 +405,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::FrameIdSafe(frame)); |
} |
return Response::OK(); |
} |
@@ -501,7 +491,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::FrameIdSafe(inspected_frames_->Root()); |
return Response::OK(); |
} |
@@ -723,15 +713,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::FrameIdSafe(frame); |
frame->Client()->SetDevToolsFrameId(frame_id); |
GetFrontend()->frameAttached( |
- frame_id, FrameId(ToLocalFrame(parent_frame)), |
+ frame_id, IdentifiersFactory::FrameIdSafe(ToLocalFrame(parent_frame)), |
location ? location->BuildInspectorObject() : nullptr); |
} |
void InspectorPageAgent::FrameDetachedFromParent(LocalFrame* frame) { |
- GetFrontend()->frameDetached(FrameId(frame)); |
+ GetFrontend()->frameDetached(IdentifiersFactory::FrameIdSafe(frame)); |
} |
bool InspectorPageAgent::ScreencastEnabled() { |
@@ -740,20 +730,22 @@ bool InspectorPageAgent::ScreencastEnabled() { |
} |
void InspectorPageAgent::FrameStartedLoading(LocalFrame* frame, FrameLoadType) { |
- GetFrontend()->frameStartedLoading(FrameId(frame)); |
+ GetFrontend()->frameStartedLoading(IdentifiersFactory::FrameIdSafe(frame)); |
} |
void InspectorPageAgent::FrameStoppedLoading(LocalFrame* frame) { |
- GetFrontend()->frameStoppedLoading(FrameId(frame)); |
+ GetFrontend()->frameStoppedLoading(IdentifiersFactory::FrameIdSafe(frame)); |
} |
void InspectorPageAgent::FrameScheduledNavigation(LocalFrame* frame, |
double delay) { |
- GetFrontend()->frameScheduledNavigation(FrameId(frame), delay); |
+ GetFrontend()->frameScheduledNavigation( |
+ IdentifiersFactory::FrameIdSafe(frame), delay); |
} |
void InspectorPageAgent::FrameClearedScheduledNavigation(LocalFrame* frame) { |
- GetFrontend()->frameClearedScheduledNavigation(FrameId(frame)); |
+ GetFrontend()->frameClearedScheduledNavigation( |
+ IdentifiersFactory::FrameIdSafe(frame)); |
} |
void InspectorPageAgent::WillRunJavaScriptDialog( |
@@ -809,7 +801,7 @@ std::unique_ptr<protocol::Page::Frame> InspectorPageAgent::BuildObjectForFrame( |
LocalFrame* frame) { |
std::unique_ptr<protocol::Page::Frame> frame_object = |
protocol::Page::Frame::create() |
- .setId(FrameId(frame)) |
+ .setId(IdentifiersFactory::FrameIdSafe(frame)) |
.setLoaderId( |
IdentifiersFactory::LoaderId(frame->Loader().GetDocumentLoader())) |
.setUrl(UrlWithoutFragment(frame->GetDocument()->Url()).GetString()) |
@@ -819,8 +811,10 @@ std::unique_ptr<protocol::Page::Frame> InspectorPageAgent::BuildObjectForFrame( |
.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::FrameIdSafe(ToLocalFrame(parent_frame))); |
+ } |
if (frame->DeprecatedLocalOwner()) { |
AtomicString name = frame->DeprecatedLocalOwner()->GetNameAttribute(); |
if (name.IsEmpty()) |