Fix CefFrame::GetIdentifier value in the render process (fixes issue #2687, see issue #2498)

This commit is contained in:
Marshall Greenblatt 2019-06-19 16:53:31 +02:00
parent 6ad1dea9fa
commit f50b3c2d43
2 changed files with 12 additions and 1 deletions

View File

@ -9,6 +9,7 @@
#include "libcef/renderer/blink_glue.h"
#include "base/logging.h"
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h"
#include "content/renderer/render_frame_impl.h"
#include "third_party/blink/public/web/web_local_frame.h"
@ -20,7 +21,7 @@ int64_t GetIdentifier(blink::WebLocalFrame* frame) {
// routing IDs are unique within a given renderer process.
content::RenderFrame* render_frame =
content::RenderFrame::FromWebFrame(frame);
return frame_util::MakeFrameId(render_frame->GetRenderView()->GetRoutingID(),
return frame_util::MakeFrameId(content::RenderThread::Get()->GetClientId(),
render_frame->GetRoutingID());
}

View File

@ -393,6 +393,11 @@ class FrameNavRendererTest : public ClientAppRenderer::Delegate,
EXPECT_TRUE(args.get());
EXPECT_TRUE(args->SetInt(0, nav_));
EXPECT_TRUE(args->SetBool(1, result));
const int64 frame_id = frame->GetIdentifier();
EXPECT_TRUE(args->SetInt(2, CefInt64GetLow(frame_id)));
EXPECT_TRUE(args->SetInt(3, CefInt64GetHigh(frame_id)));
frame->SendProcessMessage(PID_BROWSER, return_msg);
nav_++;
@ -527,6 +532,11 @@ class FrameNavTestHandler : public TestHandler {
EXPECT_TRUE(expectations_->OnRendererComplete(
browser, frame, args->GetInt(0), args->GetBool(1)))
<< "nav = " << nav_;
// Test that browser and render process frame IDs match.
const int64 frame_id = CefInt64Set(args->GetInt(2), args->GetInt(3));
EXPECT_EQ(frame->GetIdentifier(), frame_id);
return true;
}