OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2952 // |report_frame_name_changes| is set (used by <webview>). If needed, this | 2952 // |report_frame_name_changes| is set (used by <webview>). If needed, this |
2953 // can be optimized further by only sending the update if there are any | 2953 // can be optimized further by only sending the update if there are any |
2954 // remote frames in the frame tree, or delaying and batching up IPCs if | 2954 // remote frames in the frame tree, or delaying and batching up IPCs if |
2955 // updates are happening too frequently. | 2955 // updates are happening too frequently. |
2956 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() || | 2956 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() || |
2957 render_view_->renderer_preferences_.report_frame_name_changes) { | 2957 render_view_->renderer_preferences_.report_frame_name_changes) { |
2958 Send(new FrameHostMsg_DidChangeName( | 2958 Send(new FrameHostMsg_DidChangeName( |
2959 routing_id_, base::UTF16ToUTF8(base::StringPiece16(name)), | 2959 routing_id_, base::UTF16ToUTF8(base::StringPiece16(name)), |
2960 base::UTF16ToUTF8(base::StringPiece16(unique_name)))); | 2960 base::UTF16ToUTF8(base::StringPiece16(unique_name)))); |
2961 } | 2961 } |
2962 | |
2963 if (!committed_first_load_) | |
2964 name_changed_before_first_commit_ = true; | |
2962 } | 2965 } |
2963 | 2966 |
2964 void RenderFrameImpl::didEnforceInsecureRequestPolicy( | 2967 void RenderFrameImpl::didEnforceInsecureRequestPolicy( |
2965 blink::WebInsecureRequestPolicy policy) { | 2968 blink::WebInsecureRequestPolicy policy) { |
2966 Send(new FrameHostMsg_EnforceInsecureRequestPolicy(routing_id_, policy)); | 2969 Send(new FrameHostMsg_EnforceInsecureRequestPolicy(routing_id_, policy)); |
2967 } | 2970 } |
2968 | 2971 |
2969 void RenderFrameImpl::didUpdateToUniqueOrigin( | 2972 void RenderFrameImpl::didUpdateToUniqueOrigin( |
2970 bool is_potentially_trustworthy_unique_origin) { | 2973 bool is_potentially_trustworthy_unique_origin) { |
2971 Send(new FrameHostMsg_UpdateToUniqueOrigin( | 2974 Send(new FrameHostMsg_UpdateToUniqueOrigin( |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3337 } | 3340 } |
3338 | 3341 |
3339 void RenderFrameImpl::didCommitProvisionalLoad( | 3342 void RenderFrameImpl::didCommitProvisionalLoad( |
3340 blink::WebLocalFrame* frame, | 3343 blink::WebLocalFrame* frame, |
3341 const blink::WebHistoryItem& item, | 3344 const blink::WebHistoryItem& item, |
3342 blink::WebHistoryCommitType commit_type) { | 3345 blink::WebHistoryCommitType commit_type) { |
3343 TRACE_EVENT2("navigation,rail", "RenderFrameImpl::didCommitProvisionalLoad", | 3346 TRACE_EVENT2("navigation,rail", "RenderFrameImpl::didCommitProvisionalLoad", |
3344 "id", routing_id_, | 3347 "id", routing_id_, |
3345 "url", GetLoadingUrl().possibly_invalid_spec()); | 3348 "url", GetLoadingUrl().possibly_invalid_spec()); |
3346 DCHECK_EQ(frame_, frame); | 3349 DCHECK_EQ(frame_, frame); |
3350 | |
3351 // TODO(dcheng): Remove this UMA once we have enough measurements. | |
3352 // Record the number of subframes where window.name changes between the | |
3353 // creation of the frame and the first commit that records a history entry | |
3354 // with a persisted unique name. We'd like to make unique name immutable to | |
3355 // simplify code, but it's unclear if there are site that depend on the | |
3356 // following pattern: | |
3357 // 1. Create a new subframe. | |
3358 // 2. Assign it a window.name. | |
3359 // 3. Navigate it. | |
3360 // | |
3361 // If unique name are immutable, then it's possible that session history would | |
3362 // become less reliable for subframes: | |
3363 // * A subframe with no initial name will receive a generated name that | |
3364 // depends on DOM insertion order instead of using a name baed on the | |
3365 // window.name assigned in step 2. | |
3366 // * A subframe may intentionally try to choose a non-conflicting | |
3367 // window.name if it detects a conflict. Immutability would prevent this | |
3368 // from having the desired effect. | |
3369 // | |
3370 // The logic for when to record the UMA is a bit subtle: | |
3371 // * if |committed_first_load_| is false and |current_history_item_| is | |
3372 // null, then this is being called to commit the initial empty document. | |
3373 // Don't record the UMA yet. |current_history_item_| will be non-null in | |
3374 // subsequent invocations of this callback. | |
3375 // * if |committed_first_load_| is false and |current_history_item_| is | |
3376 // *not* null, then the initial empty document has already committed. | |
3377 // Record if window.name has changed. | |
3378 if (!committed_first_load_ && !current_history_item_.isNull()) { | |
Charlie Reis
2016/10/04 18:15:44
One possible hiccup: I don't think we get a commit
| |
3379 if (!IsMainFrame()) { | |
3380 UMA_HISTOGRAM_BOOLEAN( | |
3381 "SessionRestore.SubFrameUniqueNameChangedBeforeFirstCommit", | |
3382 name_changed_before_first_commit_); | |
3383 } | |
3384 committed_first_load_ = true; | |
3385 } | |
3386 | |
3347 DocumentState* document_state = | 3387 DocumentState* document_state = |
3348 DocumentState::FromDataSource(frame->dataSource()); | 3388 DocumentState::FromDataSource(frame->dataSource()); |
3349 NavigationStateImpl* navigation_state = | 3389 NavigationStateImpl* navigation_state = |
3350 static_cast<NavigationStateImpl*>(document_state->navigation_state()); | 3390 static_cast<NavigationStateImpl*>(document_state->navigation_state()); |
3351 WebURLResponseExtraDataImpl* extra_data = | 3391 WebURLResponseExtraDataImpl* extra_data = |
3352 GetExtraDataFromResponse(frame->dataSource()->response()); | 3392 GetExtraDataFromResponse(frame->dataSource()->response()); |
3353 // Only update the Lo-Fi and effective connection type states for new main | 3393 // Only update the Lo-Fi and effective connection type states for new main |
3354 // frame documents. Subframes inherit from the main frame and should not | 3394 // frame documents. Subframes inherit from the main frame and should not |
3355 // change at commit time. | 3395 // change at commit time. |
3356 if (is_main_frame_ && !navigation_state->WasWithinSamePage()) { | 3396 if (is_main_frame_ && !navigation_state->WasWithinSamePage()) { |
(...skipping 3073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6430 // event target. Potentially a Pepper plugin will receive the event. | 6470 // event target. Potentially a Pepper plugin will receive the event. |
6431 // In order to tell whether a plugin gets the last mouse event and which it | 6471 // In order to tell whether a plugin gets the last mouse event and which it |
6432 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6472 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6433 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6473 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6434 // |pepper_last_mouse_event_target_|. | 6474 // |pepper_last_mouse_event_target_|. |
6435 pepper_last_mouse_event_target_ = nullptr; | 6475 pepper_last_mouse_event_target_ = nullptr; |
6436 #endif | 6476 #endif |
6437 } | 6477 } |
6438 | 6478 |
6439 } // namespace content | 6479 } // namespace content |
OLD | NEW |