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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 << " because user navigated to " << url.spec(); | 484 << " because user navigated to " << url.spec(); |
485 base::debug::AsanCorruptHeap(); | 485 base::debug::AsanCorruptHeap(); |
486 #endif | 486 #endif |
487 } | 487 } |
488 } | 488 } |
489 #endif // ADDRESS_SANITIZER || SYZYASAN | 489 #endif // ADDRESS_SANITIZER || SYZYASAN |
490 | 490 |
491 void MaybeHandleDebugURL(const GURL& url) { | 491 void MaybeHandleDebugURL(const GURL& url) { |
492 if (!url.SchemeIs(kChromeUIScheme)) | 492 if (!url.SchemeIs(kChromeUIScheme)) |
493 return; | 493 return; |
494 if (url == GURL(kChromeUIBadCastCrashURL)) { | 494 if (url == kChromeUIBadCastCrashURL) { |
495 LOG(ERROR) | 495 LOG(ERROR) |
496 << "Intentionally crashing (with bad cast)" | 496 << "Intentionally crashing (with bad cast)" |
497 << " because user navigated to " << url.spec(); | 497 << " because user navigated to " << url.spec(); |
498 BadCastCrashIntentionally(); | 498 BadCastCrashIntentionally(); |
499 } else if (url == GURL(kChromeUICrashURL)) { | 499 } else if (url == kChromeUICrashURL) { |
500 LOG(ERROR) << "Intentionally crashing (with null pointer dereference)" | 500 LOG(ERROR) << "Intentionally crashing (with null pointer dereference)" |
501 << " because user navigated to " << url.spec(); | 501 << " because user navigated to " << url.spec(); |
502 CrashIntentionally(); | 502 CrashIntentionally(); |
503 } else if (url == GURL(kChromeUIDumpURL)) { | 503 } else if (url == kChromeUIDumpURL) { |
504 // This URL will only correctly create a crash dump file if content is | 504 // This URL will only correctly create a crash dump file if content is |
505 // hosted in a process that has correctly called | 505 // hosted in a process that has correctly called |
506 // base::debug::SetDumpWithoutCrashingFunction. Refer to the documentation | 506 // base::debug::SetDumpWithoutCrashingFunction. Refer to the documentation |
507 // of base::debug::DumpWithoutCrashing for more details. | 507 // of base::debug::DumpWithoutCrashing for more details. |
508 base::debug::DumpWithoutCrashing(); | 508 base::debug::DumpWithoutCrashing(); |
509 } else if (url == GURL(kChromeUIKillURL)) { | 509 } else if (url == kChromeUIKillURL) { |
510 LOG(ERROR) << "Intentionally issuing kill signal to current process" | 510 LOG(ERROR) << "Intentionally issuing kill signal to current process" |
511 << " because user navigated to " << url.spec(); | 511 << " because user navigated to " << url.spec(); |
512 base::Process::Current().Terminate(1, false); | 512 base::Process::Current().Terminate(1, false); |
513 } else if (url == GURL(kChromeUIHangURL)) { | 513 } else if (url == kChromeUIHangURL) { |
514 LOG(ERROR) << "Intentionally hanging ourselves with sleep infinite loop" | 514 LOG(ERROR) << "Intentionally hanging ourselves with sleep infinite loop" |
515 << " because user navigated to " << url.spec(); | 515 << " because user navigated to " << url.spec(); |
516 for (;;) { | 516 for (;;) { |
517 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1)); | 517 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1)); |
518 } | 518 } |
519 } else if (url == GURL(kChromeUIShorthangURL)) { | 519 } else if (url == kChromeUIShorthangURL) { |
520 LOG(ERROR) << "Intentionally sleeping renderer for 20 seconds" | 520 LOG(ERROR) << "Intentionally sleeping renderer for 20 seconds" |
521 << " because user navigated to " << url.spec(); | 521 << " because user navigated to " << url.spec(); |
522 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(20)); | 522 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(20)); |
523 } else if (url == GURL(kChromeUIMemoryExhaustURL)) { | 523 } else if (url == kChromeUIMemoryExhaustURL) { |
524 LOG(ERROR) | 524 LOG(ERROR) |
525 << "Intentionally exhausting renderer memory because user navigated to " | 525 << "Intentionally exhausting renderer memory because user navigated to " |
526 << url.spec(); | 526 << url.spec(); |
527 ExhaustMemory(); | 527 ExhaustMemory(); |
528 } | 528 } |
529 | 529 |
530 #if defined(ADDRESS_SANITIZER) || defined(SYZYASAN) | 530 #if defined(ADDRESS_SANITIZER) || defined(SYZYASAN) |
531 MaybeTriggerAsanError(url); | 531 MaybeTriggerAsanError(url); |
532 #endif // ADDRESS_SANITIZER || SYZYASAN | 532 #endif // ADDRESS_SANITIZER || SYZYASAN |
533 } | 533 } |
(...skipping 4258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4792 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { | 4792 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { |
4793 params.method = request.httpMethod().latin1(); | 4793 params.method = request.httpMethod().latin1(); |
4794 if (params.method == "POST") | 4794 if (params.method == "POST") |
4795 params.post_id = post_id; | 4795 params.post_id = post_id; |
4796 } | 4796 } |
4797 | 4797 |
4798 params.frame_unique_name = item.target().utf8(); | 4798 params.frame_unique_name = item.target().utf8(); |
4799 params.item_sequence_number = item.itemSequenceNumber(); | 4799 params.item_sequence_number = item.itemSequenceNumber(); |
4800 params.document_sequence_number = item.documentSequenceNumber(); | 4800 params.document_sequence_number = item.documentSequenceNumber(); |
4801 | 4801 |
4802 params.is_srcdoc = params.url == GURL(content::kAboutSrcDocURL); | 4802 params.is_srcdoc = params.url == content::kAboutSrcDocURL; |
4803 | 4803 |
4804 if (!frame->parent()) { | 4804 if (!frame->parent()) { |
4805 // Top-level navigation. | 4805 // Top-level navigation. |
4806 | 4806 |
4807 // Reset the zoom limits in case a plugin had changed them previously. This | 4807 // Reset the zoom limits in case a plugin had changed them previously. This |
4808 // will also call us back which will cause us to send a message to | 4808 // will also call us back which will cause us to send a message to |
4809 // update WebContentsImpl. | 4809 // update WebContentsImpl. |
4810 render_view_->webview()->zoomLimitsChanged( | 4810 render_view_->webview()->zoomLimitsChanged( |
4811 ZoomFactorToZoomLevel(kMinimumZoomFactor), | 4811 ZoomFactorToZoomLevel(kMinimumZoomFactor), |
4812 ZoomFactorToZoomLevel(kMaximumZoomFactor)); | 4812 ZoomFactorToZoomLevel(kMaximumZoomFactor)); |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5201 // We use the following heuristic to decide whether to fork a new page in its | 5201 // We use the following heuristic to decide whether to fork a new page in its |
5202 // own process: | 5202 // own process: |
5203 // The parent page must open a new tab to about:blank, set the new tab's | 5203 // The parent page must open a new tab to about:blank, set the new tab's |
5204 // window.opener to null, and then redirect the tab to a cross-site URL using | 5204 // window.opener to null, and then redirect the tab to a cross-site URL using |
5205 // JavaScript. | 5205 // JavaScript. |
5206 // | 5206 // |
5207 // TODO(creis): Deprecate this logic once we can rely on rel=noreferrer | 5207 // TODO(creis): Deprecate this logic once we can rely on rel=noreferrer |
5208 // (see below). | 5208 // (see below). |
5209 bool is_fork = | 5209 bool is_fork = |
5210 // Must start from a tab showing about:blank, which is later redirected. | 5210 // Must start from a tab showing about:blank, which is later redirected. |
5211 old_url == GURL(url::kAboutBlankURL) && | 5211 old_url == url::kAboutBlankURL && |
5212 // Must be the first real navigation of the tab. | 5212 // Must be the first real navigation of the tab. |
5213 render_view_->historyBackListCount() < 1 && | 5213 render_view_->historyBackListCount() < 1 && |
5214 render_view_->historyForwardListCount() < 1 && | 5214 render_view_->historyForwardListCount() < 1 && |
5215 // The parent page must have set the child's window.opener to null before | 5215 // The parent page must have set the child's window.opener to null before |
5216 // redirecting to the desired URL. | 5216 // redirecting to the desired URL. |
5217 frame_->opener() == NULL && | 5217 frame_->opener() == NULL && |
5218 // Must be a top-level frame. | 5218 // Must be a top-level frame. |
5219 frame_->parent() == NULL && | 5219 frame_->parent() == NULL && |
5220 // Must not have issued the request from this page. | 5220 // Must not have issued the request from this page. |
5221 is_content_initiated && | 5221 is_content_initiated && |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6561 // event target. Potentially a Pepper plugin will receive the event. | 6561 // event target. Potentially a Pepper plugin will receive the event. |
6562 // In order to tell whether a plugin gets the last mouse event and which it | 6562 // In order to tell whether a plugin gets the last mouse event and which it |
6563 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6563 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6564 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6564 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6565 // |pepper_last_mouse_event_target_|. | 6565 // |pepper_last_mouse_event_target_|. |
6566 pepper_last_mouse_event_target_ = nullptr; | 6566 pepper_last_mouse_event_target_ = nullptr; |
6567 #endif | 6567 #endif |
6568 } | 6568 } |
6569 | 6569 |
6570 } // namespace content | 6570 } // namespace content |
OLD | NEW |