Chromium Code Reviews| Index: third_party/WebKit/Source/core/frame/Frame.cpp |
| diff --git a/third_party/WebKit/Source/core/frame/Frame.cpp b/third_party/WebKit/Source/core/frame/Frame.cpp |
| index 28a96d4a9feb27d840f133551d8a334524fcce92..ab1983fa634498c9f32da348fa242ba999ac643c 100644 |
| --- a/third_party/WebKit/Source/core/frame/Frame.cpp |
| +++ b/third_party/WebKit/Source/core/frame/Frame.cpp |
| @@ -175,10 +175,11 @@ bool Frame::CanNavigate(const Frame& target_frame) { |
| IsLocalFrame() ? ToLocalFrame(this)->HasReceivedUserGesture() : false; |
| // Top navigation in sandbox with or w/o 'allow-top-navigation'. |
| - if (target_frame != this && sandboxed && target_frame == Tree().Top()) { |
| - UseCounter::Count(&target_frame, UseCounter::kTopNavInSandbox); |
| + if (IsLocalFrame() && target_frame != this && sandboxed && |
|
dcheng
2017/05/12 22:15:18
I think this can actually only be called on a loca
Rick Byers
2017/05/25 15:32:31
Good catch, and looks like it wasn't too hard to m
|
| + target_frame == Tree().Top()) { |
| + UseCounter::Count(ToLocalFrame(this), UseCounter::kTopNavInSandbox); |
| if (!has_user_gesture) { |
| - UseCounter::Count(&target_frame, |
| + UseCounter::Count(ToLocalFrame(this), |
| UseCounter::kTopNavInSandboxWithoutGesture); |
| } |
| } |
| @@ -192,15 +193,20 @@ bool Frame::CanNavigate(const Frame& target_frame) { |
| const unsigned kUserGestureBit = 0x1; |
| const unsigned kAllowedBit = 0x2; |
| unsigned framebust_params = 0; |
| - UseCounter::Count(&target_frame, UseCounter::kTopNavigationFromSubFrame); |
| if (has_user_gesture) |
| framebust_params |= kUserGestureBit; |
| - if (sandboxed) { // Sandboxed with 'allow-top-navigation'. |
| - UseCounter::Count(&target_frame, UseCounter::kTopNavInSandboxWithPerm); |
| - if (!has_user_gesture) { |
| - UseCounter::Count(&target_frame, |
| - UseCounter::kTopNavInSandboxWithPermButNoGesture); |
| + |
| + if (IsLocalFrame()) { |
| + UseCounter::Count(ToLocalFrame(this), |
| + UseCounter::kTopNavigationFromSubFrame); |
| + if (sandboxed) { // Sandboxed with 'allow-top-navigation'. |
| + UseCounter::Count(ToLocalFrame(this), |
| + UseCounter::kTopNavInSandboxWithPerm); |
| + if (!has_user_gesture) { |
| + UseCounter::Count(ToLocalFrame(this), |
| + UseCounter::kTopNavInSandboxWithPermButNoGesture); |
| + } |
| } |
| } |