diff --git a/DEPS b/DEPS index 38743fe..a6bfe97 100644 --- a/DEPS +++ b/DEPS
@@ -209,7 +209,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': 'c669bf5296197840ab86ee8ca1a2832b69849097', + 'angle_revision': '2f5d646c928eb989467cf53ed17e2e8d7e7ad357', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -217,7 +217,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': 'b8a27ae001c2300051b94ba31408c676b61786c7', + 'pdfium_revision': '6823afb28ceb5aee566d007670180643653e85b6', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling BoringSSL # and whatever else without interference from each other. @@ -272,7 +272,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': 'b7e7aba113f5d75686d1580b796632aa1c300877', + 'devtools_frontend_revision': 'f0f1260631455b3484c3fff75fb8a80d9aecd9de', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. @@ -324,7 +324,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': 'f2bc3b3edd6f3a8424b230b17f844f59768d53b8', + 'dawn_revision': 'd98e8b70bbb198ebd665a570880ccc7b20e56198', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -352,7 +352,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling nearby # and whatever else without interference from each other. - 'nearby_revision': '7df0f96a015af09bb7b9b0b42b2b3637d428f012', + 'nearby_revision': '2097279b66bfec0f36970973d2b69357d2ff49b4', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling securemessage # and whatever else without interference from each other. @@ -907,7 +907,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'd4e6fb6573e0955110a2c69be29557f6626d9ae6', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '9abde8c3f3a2c0cfb2b78f772655352e094e612e', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), @@ -1341,7 +1341,7 @@ 'packages': [ { 'package': 'fuchsia/third_party/aemu/linux-amd64', - 'version': 'FwzgY9X10eGIOA-l6ukRroKmBYo1As7yOiPDRfc6PxAC' + 'version': 'ZJSAA8Pwi2mDf7nU7eRK7e3lmUHyrNUgCmzdRwsMbnMC' }, ], 'condition': 'host_os == "linux" and checkout_fuchsia', @@ -1578,7 +1578,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@bde2c3c32a2bbe15dfffe1e03db42efa5c23419b', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@2e8c7015c00a5ba3ff188f02a19ca4b7b3b312b6', 'condition': 'checkout_src_internal', },
diff --git a/WATCHLISTS b/WATCHLISTS index 4718f18b..fdfc949 100644 --- a/WATCHLISTS +++ b/WATCHLISTS
@@ -1619,11 +1619,6 @@ '|chrome/browser/renderer_context_menu/quick_answers.*'\ '|chromeos/components/quick_answers/' }, - 'reading_list': { - 'filepath': 'components/reading_list|'\ - 'ios/chrome/browser/reading_list|'\ - 'ios/chrome/browser/ui/reading_list', - }, 'relaunch_notification': { 'filepath': 'chrome/browser/ui/views/relaunch_notification' }, @@ -2730,7 +2725,6 @@ 'print_preview': ['print-reviews+preview@chromium.org'], 'push_messaging': ['peter@chromium.org'], 'quick_answers': ['croissant-eng+reviews@chromium.org'], - 'reading_list': ['stkhapugin@chromium.org'], 'relaunch_notification': ['grt+watch@chromium.org'], 'remoteplayback': ['mfoltz+watch@chromium.org'], 'remoting': ['chromoting-reviews@chromium.org'],
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 0583cb0c..d13f2bf 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -2256,7 +2256,6 @@ "wm/container_finder_unittest.cc", "wm/default_window_resizer_unittest.cc", "wm/desks/autotest_desks_api_unittests.cc", - "wm/desks/desk_animation_impl_unittest.cc", "wm/desks/desks_unittests.cc", "wm/desks/root_window_desk_switch_animator_unittest.cc", "wm/drag_window_resizer_unittest.cc",
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index fa7a80a..ea5689a 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -284,8 +284,8 @@ <message name="IDS_ASH_STATUS_TRAY_EXIT_PUBLIC" desc="The label used for the button in the status tray to terminate a public account session. If the label is long, indicate where it may be broken into two lines by inserting \n instead of a whitespace. [CHAR_LIMIT=20]"> Exit session </message> - <message name="IDS_ASH_STATUS_TRAY_PUBLIC_LABEL" desc="Text of the the ash system bubble's user card when the current session is a managed session."> - <ph name="DISPLAY_NAME">$1<ex>Internet kiosk</ex></ph> is a managed session managed by <ph name="DOMAIN">$2<ex>yourdomain.com</ex></ph> + <message name="IDS_ASH_STATUS_TRAY_PUBLIC_LABEL" desc="Text of the the ash system bubble's user card when the current session is a managed session. MANAGER can be a domain or an email address."> + <ph name="DISPLAY_NAME">$1<ex>Internet kiosk</ex></ph> is a managed session managed by <ph name="MANAGER">$2<ex>yourdomain.com</ex></ph> </message> <message name="IDS_ASH_STATUS_TRAY_LOCK" desc="The label used for the button in the status tray to lock the screen."> Lock @@ -2298,8 +2298,8 @@ <message name="IDS_ASH_PIN_KEYBOARD_DELETE_ACCESSIBLE_NAME" desc="Text to be spoken when the focus is set to the delete button of the PIN keyboard."> Delete </message> - <message name="IDS_ASH_LOGIN_MANAGED_DEVICE_INDICATOR" desc="Template for text shown as a bottom status on the login screen, informing the user that this device is managed."> - <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> managed by <ph name="DOMAIN">$2<ex>yourdomain.com</ex></ph> + <message name="IDS_ASH_LOGIN_MANAGED_DEVICE_INDICATOR" desc="Template for text shown as a bottom status on the login screen, informing the user that this device is managed. MANAGER can be a domain or an email address."> + <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> managed by <ph name="MANAGER">$2<ex>yourdomain.com</ex></ph> </message> <message name="IDS_ASH_LOGIN_POD_MANAGED_ACCESSIBLE_NAME" desc="Text to be spoken when the focus is set to the user pod when the user is managed."> <ph name="USER_EMAIL_ADDRESS">$1<ex>john.doe@example.com</ex></ph> Managed user @@ -2328,9 +2328,12 @@ <message name="IDS_ASH_LOGIN_POD_REMOVE_ACCOUNT_DIALOG_ACCESSIBLE_DESCRIPTION" desc="Text to be spoken to describe a way to close the dialog."> Press escape to close </message> - <message name="IDS_ASH_LOGIN_POD_REMOVE_ACCOUNT_DIALOG_BUTTON_ACCESSIBLE_NAME" desc="Text to be spoken when the focus is set to the button that opens the remove account dialog for a given user."> + <message name="IDS_ASH_LOGIN_POD_REMOVE_ACCOUNT_DIALOG_BUTTON_ACCESSIBLE_NAME" desc="Text to be spoken when the focus is set to the button that opens the info dialog for a given user, when the option to also remove the account is present, e.g. on the login screen."> Open remove dialog for <ph name="USER_EMAIL_ADDRESS">$1<ex>john.doe@example.com</ex></ph> </message> + <message name="IDS_ASH_LOGIN_POD_ACCOUNT_DIALOG_BUTTON_ACCESSIBLE_NAME" desc="Text to be spoken when the focus is set to the button that opens the account info dialog for a given user, when the remove option is not present, e.g. on the lock screen."> + Open info dialog for <ph name="USER_EMAIL_ADDRESS">$1<ex>john.doe@example.com</ex></ph> + </message> <message name="IDS_ASH_LOGIN_PUBLIC_ACCOUNT_MONITORING_WARNING" desc="Template for text shown in the public account user pod, informing the user that this is a public, managed account."> The device admin may monitor your browsing activity. </message>
diff --git a/ash/ash_strings_grd/IDS_ASH_LOGIN_POD_ACCOUNT_DIALOG_BUTTON_ACCESSIBLE_NAME.png.sha1 b/ash/ash_strings_grd/IDS_ASH_LOGIN_POD_ACCOUNT_DIALOG_BUTTON_ACCESSIBLE_NAME.png.sha1 new file mode 100644 index 0000000..72b7566 --- /dev/null +++ b/ash/ash_strings_grd/IDS_ASH_LOGIN_POD_ACCOUNT_DIALOG_BUTTON_ACCESSIBLE_NAME.png.sha1
@@ -0,0 +1 @@ +4584517669ee8b6bae4cf324180ea8e7c6a21596 \ No newline at end of file
diff --git a/ash/ash_strings_grd/IDS_ASH_STATUS_TRAY_PUBLIC_LABEL.png.sha1 b/ash/ash_strings_grd/IDS_ASH_STATUS_TRAY_PUBLIC_LABEL.png.sha1 new file mode 100644 index 0000000..43c28f6 --- /dev/null +++ b/ash/ash_strings_grd/IDS_ASH_STATUS_TRAY_PUBLIC_LABEL.png.sha1
@@ -0,0 +1 @@ +f6f8ef7763e2aa28e49f18a0946ec9766de0b802 \ No newline at end of file
diff --git a/ash/login/ui/login_user_view.cc b/ash/login/ui/login_user_view.cc index 0d911b6..0451ab5 100644 --- a/ash/login/ui/login_user_view.cc +++ b/ash/login/ui/login_user_view.cc
@@ -606,8 +606,14 @@ } tap_button_->SetAccessibleName(accessible_name); if (dropdown_) { - dropdown_->SetAccessibleName(l10n_util::GetStringFUTF16( - IDS_ASH_LOGIN_POD_REMOVE_ACCOUNT_DIALOG_BUTTON_ACCESSIBLE_NAME, email)); + // The accessible name for the dropdown depends on whether it also contains + // the remove user button for the user in question. + accessible_name = l10n_util::GetStringFUTF16( + current_user_.can_remove + ? IDS_ASH_LOGIN_POD_REMOVE_ACCOUNT_DIALOG_BUTTON_ACCESSIBLE_NAME + : IDS_ASH_LOGIN_POD_ACCOUNT_DIALOG_BUTTON_ACCESSIBLE_NAME, + email); + dropdown_->SetAccessibleName(accessible_name); } user_image_->UpdateForUser(current_user_);
diff --git a/ash/wm/desks/desk_animation_base.cc b/ash/wm/desks/desk_animation_base.cc index b0ba911..7f1d7d7 100644 --- a/ash/wm/desks/desk_animation_base.cc +++ b/ash/wm/desks/desk_animation_base.cc
@@ -128,9 +128,6 @@ for (auto& observer : controller_->observers_) observer.OnDeskSwitchAnimationFinished(); - if (skip_notify_controller_on_animation_finished_for_testing_) - return; - controller_->OnAnimationFinished(this); // `this` is now deleted. }
diff --git a/ash/wm/desks/desk_animation_base.h b/ash/wm/desks/desk_animation_base.h index 684d193..b485f492 100644 --- a/ash/wm/desks/desk_animation_base.h +++ b/ash/wm/desks/desk_animation_base.h
@@ -5,7 +5,6 @@ #ifndef ASH_WM_DESKS_DESK_ANIMATION_BASE_H_ #define ASH_WM_DESKS_DESK_ANIMATION_BASE_H_ -#include "ash/ash_export.h" #include "ash/public/cpp/metrics_util.h" #include "ash/wm/desks/desks_histogram_enums.h" #include "ash/wm/desks/root_window_desk_switch_animator.h" @@ -20,8 +19,7 @@ // such as DeskActivationAnimation and DeskRemovalAnimation implement the // abstract interface of this class to handle the unique operations specific to // each animation type. -class ASH_EXPORT DeskAnimationBase - : public RootWindowDeskSwitchAnimator::Delegate { +class DeskAnimationBase : public RootWindowDeskSwitchAnimator::Delegate { public: DeskAnimationBase(DesksController* controller, int ending_desk_index, @@ -58,10 +56,6 @@ void OnDeskSwitchAnimationFinished() override; void OnVisibleDeskChanged() override; - void set_skip_notify_controller_on_animation_finished_for_testing(bool val) { - skip_notify_controller_on_animation_finished_for_testing_ = val; - } - RootWindowDeskSwitchAnimator* GetFirstDeskSwitchAnimatorForTesting() const; protected: @@ -103,12 +97,6 @@ // ThroughputTracker used for measuring this animation smoothness. ui::ThroughputTracker throughput_tracker_; - - // If true, do not notify |controller_| when - // OnDeskSwitchAnimationFinished() is called. This class and - // DeskController are tied together in production code, but may not be in a - // test scenario. - bool skip_notify_controller_on_animation_finished_for_testing_ = false; }; } // namespace ash
diff --git a/ash/wm/desks/desk_animation_impl.cc b/ash/wm/desks/desk_animation_impl.cc index dc02657..71e28281 100644 --- a/ash/wm/desks/desk_animation_impl.cc +++ b/ash/wm/desks/desk_animation_impl.cc
@@ -182,8 +182,9 @@ // and update their ending desk index. When the animation is finished we will // activate that desk. for (const auto& animator : desk_switch_animators_) - ending_desk_index_ = animator->EndSwipeAnimation(); + animator->EndSwipeAnimation(); + ending_desk_index_ = desk_switch_animators_[0]->ending_desk_index(); return true; }
diff --git a/ash/wm/desks/desk_animation_impl.h b/ash/wm/desks/desk_animation_impl.h index 21c386b..c73da9f 100644 --- a/ash/wm/desks/desk_animation_impl.h +++ b/ash/wm/desks/desk_animation_impl.h
@@ -5,7 +5,6 @@ #ifndef ASH_WM_DESKS_DESK_ANIMATION_IMPL_H_ #define ASH_WM_DESKS_DESK_ANIMATION_IMPL_H_ -#include "ash/ash_export.h" #include "ash/public/cpp/metrics_util.h" #include "ash/wm/desks/desk_animation_base.h" #include "ash/wm/desks/desks_histogram_enums.h" @@ -15,7 +14,7 @@ class DesksController; class PresentationTimeRecorder; -class ASH_EXPORT DeskActivationAnimation : public DeskAnimationBase { +class DeskActivationAnimation : public DeskAnimationBase { public: DeskActivationAnimation(DesksController* controller, int starting_desk_index,
diff --git a/ash/wm/desks/desk_animation_impl_unittest.cc b/ash/wm/desks/desk_animation_impl_unittest.cc deleted file mode 100644 index e8f9206..0000000 --- a/ash/wm/desks/desk_animation_impl_unittest.cc +++ /dev/null
@@ -1,36 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ash/wm/desks/desk_animation_impl.h" - -#include "ash/public/cpp/ash_features.h" -#include "ash/test/ash_test_base.h" -#include "ash/wm/desks/desks_controller.h" -#include "ash/wm/desks/desks_histogram_enums.h" -#include "base/test/scoped_feature_list.h" - -namespace ash { - -using DeskActivationAnimationTest = AshTestBase; - -// Tests that there is no crash when ending a swipe animation before the -// starting screenshot has been taken. Regression test for -// https://crbug.com/1148607. -TEST_F(DeskActivationAnimationTest, EndSwipeBeforeStartingScreenshot) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature(features::kEnhancedDeskAnimations); - - auto* desks_controller = DesksController::Get(); - desks_controller->NewDesk(DesksCreationRemovalSource::kButton); - - DeskActivationAnimation animation(desks_controller, 0, 1, - DesksSwitchSource::kDeskSwitchTouchpad, - /*update_window_activation=*/false); - animation.set_skip_notify_controller_on_animation_finished_for_testing(true); - animation.Launch(); - animation.UpdateSwipeAnimation(10); - animation.EndSwipeAnimation(); -} - -} // namespace ash
diff --git a/ash/wm/desks/root_window_desk_switch_animator.cc b/ash/wm/desks/root_window_desk_switch_animator.cc index d1623850..468beaa5 100644 --- a/ash/wm/desks/root_window_desk_switch_animator.cc +++ b/ash/wm/desks/root_window_desk_switch_animator.cc
@@ -75,8 +75,6 @@ viz::CopyOutputRequest::ResultFormat::RGBA_TEXTURE, std::move(on_screenshot_taken)); screenshot_request->set_area(request_bounds); - screenshot_request->set_result_task_runner( - base::SequencedTaskRunnerHandle::Get()); screenshot_layer->RequestCopyOfOutput(std::move(screenshot_request)); } @@ -327,7 +325,7 @@ return true; } -int RootWindowDeskSwitchAnimator::EndSwipeAnimation() { +void RootWindowDeskSwitchAnimator::EndSwipeAnimation() { // If the starting screenshot has not finished, just let our delegate know // that the desk animation is finished (and |this| will soon be deleted), and // go back to the starting desk. @@ -335,7 +333,7 @@ animation_finished_ = true; ending_desk_index_ = starting_desk_index_; delegate_->OnDeskSwitchAnimationFinished(); - return ending_desk_index_; + return; } // If the ending desk screenshot has not finished, |visible_desk_index_| will @@ -346,7 +344,6 @@ ending_desk_index_ = visible_desk_index_; StartAnimation(); - return ending_desk_index_; } void RootWindowDeskSwitchAnimator::OnImplicitAnimationsCompleted() {
diff --git a/ash/wm/desks/root_window_desk_switch_animator.h b/ash/wm/desks/root_window_desk_switch_animator.h index 45b574f1..b110fbb2 100644 --- a/ash/wm/desks/root_window_desk_switch_animator.h +++ b/ash/wm/desks/root_window_desk_switch_animator.h
@@ -266,8 +266,8 @@ bool UpdateSwipeAnimation(float scroll_delta_x); // Called when a user ends a touchpad swipe. This will animate to the most - // visible desk, whose index is also returned. - int EndSwipeAnimation(); + // visible desk. + void EndSwipeAnimation(); // ui::ImplicitAnimationObserver: void OnImplicitAnimationsCompleted() override;
diff --git a/base/BUILD.gn b/base/BUILD.gn index de4f51e..5cc89ad6 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -2196,6 +2196,7 @@ deps += [ "//base/tracing/protos:chrome_track_event", + "//base/tracing/protos:chrome_track_event_zero", "//third_party/perfetto/include/perfetto/protozero", ] @@ -3477,6 +3478,7 @@ nocompile_test("base_nocompile_tests") { sources = [ "bind_post_task_unittest.nc", + "bind_unittest.nc", "callback_list_unittest.nc", "callback_unittest.nc", "containers/buffer_iterator_unittest.nc", @@ -3497,11 +3499,6 @@ "traits_bag_unittest.nc", ] - if (!llvm_force_head_revision) { - # TODO(crbug.com/1148761): Update test expectations in next Clang roll. - sources += [ "bind_unittest.nc" ] - } - deps = [ ":base", ":base_unittests_tasktraits",
diff --git a/base/allocator/partition_allocator/partition_root.cc b/base/allocator/partition_allocator/partition_root.cc index d4c2780..67b479b 100644 --- a/base/allocator/partition_allocator/partition_root.cc +++ b/base/allocator/partition_allocator/partition_root.cc
@@ -9,6 +9,7 @@ #include "base/allocator/partition_allocator/partition_bucket.h" #include "base/allocator/partition_allocator/partition_cookie.h" #include "base/allocator/partition_allocator/partition_oom.h" +#include "base/allocator/partition_allocator/pcscan.h" #include "build/build_config.h" namespace base { @@ -607,6 +608,12 @@ template <bool thread_safe> void PartitionRoot<thread_safe>::PurgeMemory(int flags) { + // TODO(chromium:1129751): Change to LIKELY once PCScan is enabled by default. + if (UNLIKELY(pcscan)) { + pcscan->PerformScan( + internal::PCScan<thread_safe>::InvocationMode::kBlocking); + } + { ScopedGuard guard{lock_}; if (flags & PartitionPurgeDecommitEmptySlotSpans)
diff --git a/base/allocator/partition_allocator/partition_root.h b/base/allocator/partition_allocator/partition_root.h index 28b70e5..94904369 100644 --- a/base/allocator/partition_allocator/partition_root.h +++ b/base/allocator/partition_allocator/partition_root.h
@@ -303,27 +303,11 @@ void EnablePCScan() { PA_CHECK(scannable && !pcscan.has_value()); - - { - // Setting |pcscan| and committing bitmaps has to be done under the lock - // to avoid racing with PartitionBucket::AllocNewSlotSpan. - internal::ScopedGuard<thread_safe> guard{lock_}; - - size_t quarantine_bitmaps_size_to_commit = - internal::CommittedQuarantineBitmapsSize(); - for (auto* super_page_extent = first_extent; super_page_extent; - super_page_extent = super_page_extent->next) { - for (char* super_page = super_page_extent->super_page_base; - super_page != super_page_extent->super_pages_end; - super_page += kSuperPageSize) { - SetSystemPagesAccess(internal::SuperPageQuarantineBitmaps(super_page), - quarantine_bitmaps_size_to_commit, - PageReadWrite); - } - } - - pcscan.emplace(this); - } + // Setting |pcscan| and committing bitmaps has to be done under the lock to + // avoid racing with PartitionBucket::AllocNewSlotSpan and avoid racing on + // |pcscan| ifself during free calls. + internal::ScopedGuard<thread_safe> guard{lock_}; + pcscan.emplace(this); } static PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR ALWAYS_INLINE size_t
diff --git a/base/allocator/partition_allocator/pcscan.cc b/base/allocator/partition_allocator/pcscan.cc index 006249e34..73c55967 100644 --- a/base/allocator/partition_allocator/pcscan.cc +++ b/base/allocator/partition_allocator/pcscan.cc
@@ -107,18 +107,31 @@ using SlotSpan = SlotSpanMetadata<thread_safe>; struct ScanArea { - uintptr_t* begin = nullptr; - uintptr_t* end = nullptr; + ScanArea(uintptr_t* begin, uintptr_t* end) : begin(begin), end(end) {} + + uintptr_t* begin; + uintptr_t* end; }; using ScanAreas = std::vector<ScanArea, MetadataAllocator<ScanArea>>; + // Large scan areas have their slot size recorded which allows to iterate + // based on objects, potentially skipping over objects if possible. + struct LargeScanArea : public ScanArea { + LargeScanArea(uintptr_t* begin, uintptr_t* end, size_t slot_size) + : ScanArea(begin, end), slot_size(slot_size) {} + + size_t slot_size = 0; + }; + using LargeScanAreas = + std::vector<LargeScanArea, MetadataAllocator<LargeScanArea>>; + // Super pages only correspond to normal buckets. // TODO(bikineev): Consider flat containers since the number of elements is // relatively small. This requires making base containers allocator-aware. using SuperPages = std::set<uintptr_t, std::less<>, MetadataAllocator<uintptr_t>>; - QuarantineBitmap* FindScannerBitmapForPointer(uintptr_t maybe_ptr) const; + QuarantineBitmap* TryFindScannerBitmapForPointer(uintptr_t maybe_ptr) const; // Lookup and marking functions. Return size of the object if marked or zero // otherwise. @@ -128,9 +141,13 @@ void ClearQuarantinedObjects() const; // Scans the partition and marks reachable quarantined objects. Returns the - // size of marked objects. The function race-fully reads the heap and - // therefore tsan is disabled for it. - size_t ScanPartition() NO_SANITIZE("thread"); + // size of marked objects. + size_t ScanPartition(); + + // Scans a range of addresses and marks reachable quarantined objects. Returns + // the size of marked objects. The function race-fully reads the heap and + // therefore TSAN is disabled for it. + size_t ScanRange(uintptr_t* begin, uintptr_t* end) NO_SANITIZE("thread"); // Sweeps (frees) unreachable quarantined entries. Returns the size of swept // objects. @@ -140,11 +157,13 @@ PartitionRoot<thread_safe>& root_; ScanAreas scan_areas_; + LargeScanAreas large_scan_areas_; SuperPages super_pages_; }; template <bool thread_safe> -QuarantineBitmap* PCScan<thread_safe>::PCScanTask::FindScannerBitmapForPointer( +QuarantineBitmap* +PCScan<thread_safe>::PCScanTask::TryFindScannerBitmapForPointer( uintptr_t maybe_ptr) const { // TODO(bikineev): Consider using the bitset in AddressPoolManager::Pool to // quickly find a super page. @@ -178,7 +197,7 @@ size_t PCScan<thread_safe>::PCScanTask::TryMarkObjectInNormalBucketPool( uintptr_t maybe_ptr) { // Check if maybe_ptr points somewhere to the heap. - auto* bitmap = FindScannerBitmapForPointer(maybe_ptr); + auto* bitmap = TryFindScannerBitmapForPointer(maybe_ptr); if (!bitmap) return 0; @@ -231,48 +250,82 @@ } template <bool thread_safe> -size_t NO_SANITIZE("thread") PCScan<thread_safe>::PCScanTask::ScanPartition() { +size_t NO_SANITIZE("thread") PCScan<thread_safe>::PCScanTask::ScanRange( + uintptr_t* begin, + uintptr_t* end) { static_assert(alignof(uintptr_t) % alignof(void*) == 0, "Alignment of uintptr_t must be at least as strict as " "alignment of a pointer type."); size_t new_quarantine_size = 0; - for (auto scan_area : scan_areas_) { - for (uintptr_t* payload = scan_area.begin; payload < scan_area.end; - ++payload) { - PA_DCHECK(reinterpret_cast<uintptr_t>(payload) % alignof(void*) == 0); - auto maybe_ptr = *payload; - if (!maybe_ptr) - continue; - size_t slot_size = 0; + for (uintptr_t* payload = begin; payload < end; ++payload) { + PA_DCHECK(reinterpret_cast<uintptr_t>(payload) % alignof(void*) == 0); + auto maybe_ptr = *payload; + if (!maybe_ptr) + continue; + size_t slot_size = 0; // TODO(bikineev): Remove the preprocessor condition after 32bit GigaCage is // implemented. #if defined(PA_HAS_64_BITS_POINTERS) - // On partitions without extras (partitions with aligned allocations), - // memory is not allocated from the GigaCage. - if (root_.UsesGigaCage()) { - // With GigaCage, we first do a fast bitmask check to see if the pointer - // points to the normal bucket pool. - if (!PartitionAddressSpace::IsInNormalBucketPool( - reinterpret_cast<void*>(maybe_ptr))) - continue; - // Otherwise, search in the list of super pages. - slot_size = TryMarkObjectInNormalBucketPool(maybe_ptr); - // TODO(bikineev): Check IsInDirectBucketPool. - } else + // On partitions without extras (partitions with aligned allocations), + // memory is not allocated from the GigaCage. + if (root_.UsesGigaCage()) { + // With GigaCage, we first do a fast bitmask check to see if the + // pointer points to the normal bucket pool. + if (!PartitionAddressSpace::IsInNormalBucketPool( + reinterpret_cast<void*>(maybe_ptr))) + continue; + // Otherwise, search in the list of super pages. + slot_size = TryMarkObjectInNormalBucketPool(maybe_ptr); + // TODO(bikineev): Check IsInDirectBucketPool. + } else #endif - { - slot_size = TryMarkObjectInNormalBucketPool(maybe_ptr); - } - - new_quarantine_size += slot_size; + { + slot_size = TryMarkObjectInNormalBucketPool(maybe_ptr); } + + new_quarantine_size += slot_size; } return new_quarantine_size; } template <bool thread_safe> +size_t PCScan<thread_safe>::PCScanTask::ScanPartition() { + size_t new_quarantine_size = 0; + + // For scanning large areas, it's worthwhile checking whether the range that + // is scanned contains quarantined objects. + for (auto scan_area : large_scan_areas_) { + // The bitmap is (a) always guaranteed to exist and (b) the same for all + // objects in a given slot span. + // TODO(chromium:1129751): Check mutator bitmap as well if performance + // allows. + auto* bitmap = QuarantineBitmapFromPointer( + QuarantineBitmapType::kScanner, pcscan_.quarantine_data_.epoch(), + reinterpret_cast<char*>(scan_area.begin)); + for (uintptr_t current_slot = reinterpret_cast<uintptr_t>(scan_area.begin); + current_slot < reinterpret_cast<uintptr_t>(scan_area.end); + current_slot += scan_area.slot_size) { + // It is okay to skip objects as their payload has been zapped at this + // point which means that the pointers no longer retain other objects. + if (bitmap->CheckBit(current_slot)) { + continue; + } + uintptr_t* payload_end = + reinterpret_cast<uintptr_t*>(current_slot + scan_area.slot_size); + PA_DCHECK(payload_end <= scan_area.end); + new_quarantine_size += + ScanRange(reinterpret_cast<uintptr_t*>(current_slot), payload_end); + } + } + for (auto scan_area : scan_areas_) { + new_quarantine_size += ScanRange(scan_area.begin, scan_area.end); + } + return new_quarantine_size; +} + +template <bool thread_safe> size_t PCScan<thread_safe>::PCScanTask::SweepQuarantine() { size_t swept_bytes = 0; @@ -295,6 +348,9 @@ template <bool thread_safe> PCScan<thread_safe>::PCScanTask::PCScanTask(PCScan& pcscan, Root& root) : pcscan_(pcscan), root_(root) { + // Threshold for which bucket size it is worthwhile in checking whether the + // object is a quarantined object and can be skipped. + static constexpr size_t kLargeScanAreaThreshold = 8192; // Take a snapshot of all allocated non-empty slot spans. static constexpr size_t kScanAreasReservationSlack = 10; const size_t kScanAreasReservationSize = @@ -319,7 +375,12 @@ auto* payload_end = payload_begin + (slot_span->bucket->get_bytes_per_span() / sizeof(uintptr_t)); - scan_areas_.push_back({payload_begin, payload_end}); + if (slot_span->bucket->slot_size >= kLargeScanAreaThreshold) { + large_scan_areas_.push_back( + {payload_begin, payload_end, slot_span->bucket->slot_size}); + } else { + scan_areas_.push_back({payload_begin, payload_end}); + } }); super_pages_.insert(reinterpret_cast<uintptr_t>(super_page)); } @@ -332,6 +393,22 @@ PCScan<thread_safe>::~PCScan() = default; template <bool thread_safe> +PCScan<thread_safe>::PCScan(Root* root) : root_(root) { + root->lock_.AssertAcquired(); + // Commit quarantine bitmaps. + size_t quarantine_bitmaps_size_to_commit = CommittedQuarantineBitmapsSize(); + for (auto* super_page_extent = root->first_extent; super_page_extent; + super_page_extent = super_page_extent->next) { + for (char* super_page = super_page_extent->super_page_base; + super_page != super_page_extent->super_pages_end; + super_page += kSuperPageSize) { + SetSystemPagesAccess(internal::SuperPageQuarantineBitmaps(super_page), + quarantine_bitmaps_size_to_commit, PageReadWrite); + } + } +} + +template <bool thread_safe> void PCScan<thread_safe>::PCScanTask::RunOnce() && { TRACE_EVENT0("partition_alloc", "PCScan"); @@ -354,7 +431,7 @@ } template <bool thread_safe> -void PCScan<thread_safe>::ScheduleTask(TaskType task_type) { +void PCScan<thread_safe>::PerformScan(InvocationMode invocation_mode) { PA_DCHECK(root_); PA_DCHECK(root_->pcscan); @@ -370,7 +447,7 @@ // Post PCScan task. const auto callback = [](PCScanTask task) { std::move(task).RunOnce(); }; - if (UNLIKELY(task_type == TaskType::kBlockingForTesting)) { + if (UNLIKELY(invocation_mode == InvocationMode::kBlocking)) { // Blocking is only used for testing. callback(std::move(task)); } else if (LIKELY(base::ThreadPoolInstance::Get())) { @@ -379,6 +456,7 @@ base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN, base::BindOnce(callback, std::move(task))); } else { + PA_DCHECK(InvocationMode::kNonBlocking == invocation_mode); // Otherwise, retreat to kernel threads. TODO(bikineev): Use base's threads. std::thread{callback, std::move(task)}.detach(); }
diff --git a/base/allocator/partition_allocator/pcscan.h b/base/allocator/partition_allocator/pcscan.h index 61247659..af122c1 100644 --- a/base/allocator/partition_allocator/pcscan.h +++ b/base/allocator/partition_allocator/pcscan.h
@@ -8,6 +8,7 @@ #include <atomic> #include "base/allocator/partition_allocator/object_bitmap.h" +#include "base/allocator/partition_allocator/page_allocator.h" #include "base/allocator/partition_allocator/partition_alloc_forward.h" #include "base/allocator/partition_allocator/partition_direct_map_extent.h" #include "base/allocator/partition_allocator/partition_page.h" @@ -38,7 +39,12 @@ using Root = PartitionRoot<thread_safe>; using SlotSpan = SlotSpanMetadata<thread_safe>; - explicit PCScan(Root* root) : root_(root) {} + enum class InvocationMode { + kBlocking, + kNonBlocking, + }; + + explicit PCScan(Root* root); PCScan(const PCScan&) = delete; PCScan& operator=(const PCScan&) = delete; @@ -47,6 +53,8 @@ ALWAYS_INLINE void MoveToQuarantine(void* ptr, SlotSpan* slot_span); + void PerformScan(InvocationMode invocation_mode); + private: class PCScanTask; friend class PCScanTest; @@ -74,9 +82,6 @@ size_t last_size_ = 0; }; - enum class TaskType { kNonBlocking, kBlockingForTesting }; - void ScheduleTask(TaskType); - Root* root_; QuarantineData quarantine_data_; std::atomic<bool> in_progress_{false}; @@ -120,8 +125,8 @@ const bool is_limit_reached = quarantine_data_.Account(slot_span->bucket->slot_size); if (is_limit_reached) { - // Post a background task to not block the current thread. - ScheduleTask(TaskType::kNonBlocking); + // Avoid blocking the current thread for regular scans. + PerformScan(InvocationMode::kNonBlocking); } }
diff --git a/base/allocator/partition_allocator/pcscan_unittest.cc b/base/allocator/partition_allocator/pcscan_unittest.cc index 1d538d34..fa971cb6 100644 --- a/base/allocator/partition_allocator/pcscan_unittest.cc +++ b/base/allocator/partition_allocator/pcscan_unittest.cc
@@ -27,8 +27,7 @@ } void RunPCScan() { - root().pcscan->ScheduleTask( - PCScan<ThreadSafe>::TaskType::kBlockingForTesting); + root().pcscan->PerformScan(PCScan<ThreadSafe>::InvocationMode::kBlocking); } bool IsInQuarantine(void* ptr) const {
diff --git a/base/bind_unittest.nc b/base/bind_unittest.nc index 0fcef725..2079fff 100644 --- a/base/bind_unittest.nc +++ b/base/bind_unittest.nc
@@ -238,7 +238,7 @@ BindRepeating(&VoidPolymorphic1<int>); } -#elif defined(NCTEST_DISALLOW_CAPTURING_LAMBDA) // [r"fatal error: implicit instantiation of undefined template 'base::internal::FunctorTraits<\(lambda at (\.\./)+base/bind_unittest.nc:[0-9]+:[0-9]+\), void>'"] +#elif defined(NCTEST_DISALLOW_CAPTURING_LAMBDA) // [r"fatal error: implicit instantiation of undefined template 'base::internal::FunctorTraits<\(lambda at (\.\./)+base/bind_unittest.nc:[0-9]+:[0-9]+\)>'"] void WontCompile() { int i = 0, j = 0; @@ -306,7 +306,7 @@ BindRepeating(&TakesMoveOnly, std::move(x)); } -#elif defined(NCTEST_BIND_NON_EMPTY_FUNCTOR) // [r"fatal error: implicit instantiation of undefined template 'base::internal::FunctorTraits<base::NonEmptyFunctor, void>'"] +#elif defined(NCTEST_BIND_NON_EMPTY_FUNCTOR) // [r"fatal error: implicit instantiation of undefined template 'base::internal::FunctorTraits<base::NonEmptyFunctor>'"] void WontCompile() { BindRepeating(NonEmptyFunctor());
diff --git a/base/trace_event/typed_macros.h b/base/trace_event/typed_macros.h index 8b792c4..47c98c9 100644 --- a/base/trace_event/typed_macros.h +++ b/base/trace_event/typed_macros.h
@@ -12,8 +12,8 @@ // Needed not for this file, but for every user of the TRACE_EVENT macros for // the lambda definition. So included here for convenience. +#include "base/tracing/protos/chrome_track_event.pbzero.h" #include "third_party/perfetto/include/perfetto/tracing/event_context.h" -#include "third_party/perfetto/protos/perfetto/trace/track_event/track_event.pbzero.h" #if defined(TRACE_EVENT_BEGIN) #error "Another copy of perfetto tracing macros have been included"
diff --git a/base/tracing/protos/BUILD.gn b/base/tracing/protos/BUILD.gn index 78b0a32..f951e8f 100644 --- a/base/tracing/protos/BUILD.gn +++ b/base/tracing/protos/BUILD.gn
@@ -20,6 +20,8 @@ perfetto_root_path = "//third_party/perfetto/" sources = [ "chrome_track_event.proto" ] import_dirs = [ "//third_party/perfetto/" ] + generator_plugin_options = "wrapper_namespace=pbzero" + omit_protozero_dep = true } grit("chrome_track_event_resources") {
diff --git a/base/tracing/protos/chrome_track_event.proto b/base/tracing/protos/chrome_track_event.proto index ad5187f..158715f 100644 --- a/base/tracing/protos/chrome_track_event.proto +++ b/base/tracing/protos/chrome_track_event.proto
@@ -4,7 +4,7 @@ syntax = "proto2"; -import "protos/perfetto/trace/track_event/track_event.proto"; +import public "protos/perfetto/trace/track_event/track_event.proto"; package perfetto.protos;
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 84a6e615..d438e091 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -0.20201116.3.1 +0.20201117.1.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 84a6e615..d438e091 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -0.20201116.3.1 +0.20201117.1.1
diff --git a/cc/paint/paint_worklet_input.cc b/cc/paint/paint_worklet_input.cc index 2e156bf..7d671c6 100644 --- a/cc/paint/paint_worklet_input.cc +++ b/cc/paint/paint_worklet_input.cc
@@ -4,10 +4,47 @@ #include "cc/paint/paint_worklet_input.h" -#include <utility> - namespace cc { +PaintWorkletInput::PropertyKey::PropertyKey( + const std::string& custom_property_name, + ElementId element_id) + : custom_property_name(custom_property_name), element_id(element_id) {} + +PaintWorkletInput::PropertyKey::PropertyKey( + NativePropertyType native_property_type, + ElementId element_id) + : native_property_type(native_property_type), element_id(element_id) {} + +PaintWorkletInput::PropertyKey::PropertyKey(const PropertyKey& other) = default; + +PaintWorkletInput::PropertyKey::~PropertyKey() = default; + +bool PaintWorkletInput::PropertyKey::operator==( + const PropertyKey& other) const { + return custom_property_name == other.custom_property_name && + native_property_type == other.native_property_type && + element_id == other.element_id; +} + +bool PaintWorkletInput::PropertyKey::operator!=( + const PropertyKey& other) const { + return !(*this == other); +} + +bool PaintWorkletInput::PropertyKey::operator<(const PropertyKey& other) const { + if (custom_property_name.has_value() && + !other.custom_property_name.has_value()) + return true; + if (!custom_property_name.has_value() && + other.custom_property_name.has_value()) + return false; + if (custom_property_name.has_value() && + other.custom_property_name.has_value()) + return custom_property_name.value() < other.custom_property_name.value(); + return native_property_type.value() < other.native_property_type.value(); +} + PaintWorkletInput::PropertyValue::PropertyValue() = default; PaintWorkletInput::PropertyValue::PropertyValue(float value)
diff --git a/cc/paint/paint_worklet_input.h b/cc/paint/paint_worklet_input.h index 0f8eaec..33c03c5a 100644 --- a/cc/paint/paint_worklet_input.h +++ b/cc/paint/paint_worklet_input.h
@@ -5,6 +5,10 @@ #ifndef CC_PAINT_PAINT_WORKLET_INPUT_H_ #define CC_PAINT_PAINT_WORKLET_INPUT_H_ +#include <string> +#include <utility> +#include <vector> + #include "base/containers/flat_map.h" #include "base/memory/ref_counted.h" #include "base/optional.h" @@ -23,15 +27,38 @@ class CC_PAINT_EXPORT PaintWorkletInput : public base::RefCountedThreadSafe<PaintWorkletInput> { public: + enum class NativePropertyType { + kBackgroundColor, + kMaxType, + }; // Uniquely identifies a property from the animation system, so that a // PaintWorkletInput can specify the properties it depends on to be painted // (and for which it must be repainted if their values change). // - // PropertyKey is designed to support both native and custom properties. The - // same ElementId will be produced for all custom properties for a given - // element. As such we require the custom property name as an additional key - // to uniquely identify custom properties. - using PropertyKey = std::pair<std::string, ElementId>; + // PropertyKey is designed to support both native and custom properties. + // 1. Custom properties: The same ElementId will be produced for all custom + // properties for a given element. As such we require the custom property + // name as an additional key to uniquely identify custom properties. + // 2. Native properties: When fetching the current value of a native + // property from property tree, we need the ElementId, plus knowing which + // tree to fetch the value from, and that's why we need the + // |native_property_type|. + // One property key should have either |custom_property_name| or + // |native_property_type|, and should never have both or neither. + struct CC_PAINT_EXPORT PropertyKey { + PropertyKey(const std::string& custom_property_name, ElementId element_id); + PropertyKey(NativePropertyType native_property_type, ElementId element_id); + PropertyKey(const PropertyKey&); + ~PropertyKey(); + + bool operator==(const PropertyKey& other) const; + bool operator!=(const PropertyKey& other) const; + bool operator<(const PropertyKey&) const; + + base::Optional<std::string> custom_property_name; + base::Optional<NativePropertyType> native_property_type; + ElementId element_id; + }; // A structure that can hold either a float or color type value, depending // on the type of custom property. Only one of |float_val| and |color_val|
diff --git a/cc/paint/paint_worklet_job.h b/cc/paint/paint_worklet_job.h index e83c0629..ccba901 100644 --- a/cc/paint/paint_worklet_job.h +++ b/cc/paint/paint_worklet_job.h
@@ -5,6 +5,8 @@ #ifndef CC_PAINT_PAINT_WORKLET_JOB_H_ #define CC_PAINT_PAINT_WORKLET_JOB_H_ +#include <vector> + #include "base/containers/flat_map.h" #include "base/memory/scoped_refptr.h" #include "cc/paint/paint_export.h" @@ -24,7 +26,8 @@ // For a custom property, its name is sufficient to uniquely identify it. // TODO(xidachen): support more property types such as color. using AnimatedPropertyValues = - base::flat_map<std::string, PaintWorkletInput::PropertyValue>; + base::flat_map<PaintWorkletInput::PropertyKey, + PaintWorkletInput::PropertyValue>; PaintWorkletJob(int layer_id, scoped_refptr<const PaintWorkletInput> input, AnimatedPropertyValues animated_property_values);
diff --git a/cc/trees/animated_paint_worklet_tracker.cc b/cc/trees/animated_paint_worklet_tracker.cc index 36b6d18f..b2d9f0f5 100644 --- a/cc/trees/animated_paint_worklet_tracker.cc +++ b/cc/trees/animated_paint_worklet_tracker.cc
@@ -4,6 +4,10 @@ #include "cc/trees/animated_paint_worklet_tracker.h" +#include <string> +#include <utility> +#include <vector> + #include "cc/layers/picture_layer_impl.h" namespace cc { @@ -30,7 +34,7 @@ PaintWorkletInput::PropertyValue custom_property_value) { // This function is called to update custom property value only. DCHECK(!custom_property_name.empty()); - PaintWorkletInput::PropertyKey key{custom_property_name, element_id}; + PaintWorkletInput::PropertyKey key(custom_property_name, element_id); auto iter = input_properties_.find(key); // OnCustomPropertyMutated is called for all composited custom property // animations, but there may not be a matching PaintWorklet, and thus no entry
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 9efdf67..0676b6f 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -745,16 +745,16 @@ PaintWorkletJob::AnimatedPropertyValues animated_property_values; for (const auto& element : input->GetPropertyKeys()) { - // We should not have multiple property ids with the same name. - DCHECK(!animated_property_values.contains(element.first)); + DCHECK(!animated_property_values.contains(element)); + // TODO(xidachen): extend this to support two cases: custom property and + // native property. + DCHECK(element.custom_property_name.has_value()); const PaintWorkletInput::PropertyValue& animated_property_value = paint_worklet_tracker_.GetPropertyAnimationValue(element); // No value indicates that the input property was not mutated by CC // animation. - if (animated_property_value.has_value()) { - animated_property_values.emplace(element.first, - animated_property_value); - } + if (animated_property_value.has_value()) + animated_property_values.emplace(element, animated_property_value); } job_vector->data.emplace_back(layer->id(), input,
diff --git a/chrome/android/chrome_test_java_sources.gni b/chrome/android/chrome_test_java_sources.gni index 53c8b16..ff27c0f3a 100644 --- a/chrome/android/chrome_test_java_sources.gni +++ b/chrome/android/chrome_test_java_sources.gni
@@ -142,6 +142,7 @@ "javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java", "javatests/src/org/chromium/chrome/browser/customtabs/DetachedResourceRequestTest.java", "javatests/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabActivityRenderTest.java", + "javatests/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabActivityTestRule.java", "javatests/src/org/chromium/chrome/browser/customtabs/RequestThrottlerTest.java", "javatests/src/org/chromium/chrome/browser/customtabs/TrustedCdnPublisherUrlTest.java", "javatests/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityTabControllerTest.java",
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/PriceTrackingUtilities.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/PriceTrackingUtilities.java new file mode 100644 index 0000000..928279d --- /dev/null +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/PriceTrackingUtilities.java
@@ -0,0 +1,38 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.tasks.tab_management; + +import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; +import org.chromium.chrome.browser.preferences.SharedPreferencesManager; + +/** + * A class to handle whether price tracking-related features are turned on by users, + * including tracking prices on tabs and price drop alerts. + * Whether the feature is available is controlled by {@link + * TabUiFeatureUtilities#ENABLE_PRICE_TRACKING}. + */ +public class PriceTrackingUtilities { + private static final String TRACK_PRICES_ON_TABS = + ChromePreferenceKeys.PRICE_TRACKING_TRACK_PRICES_ON_TABS; + + private static final SharedPreferencesManager SHARED_PREFERENCES_MANAGER = + SharedPreferencesManager.getInstance(); + + /** + * Update SharedPreferences when users turn on/off the feature tracking prices on tabs. + */ + public static void flipTrackPricesOnTabs() { + final boolean enableTrackPricesOnTabs = + SHARED_PREFERENCES_MANAGER.readBoolean(TRACK_PRICES_ON_TABS, false); + SHARED_PREFERENCES_MANAGER.writeBoolean(TRACK_PRICES_ON_TABS, !enableTrackPricesOnTabs); + } + + /** + * @return Whether the track prices on tabs is turned on by users. + */ + public static boolean isTrackPricesOnTabsEnabled() { + return SHARED_PREFERENCES_MANAGER.readBoolean(TRACK_PRICES_ON_TABS, false); + } +}
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherCoordinator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherCoordinator.java index 6ce5e5f7..4ebc7fb 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherCoordinator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherCoordinator.java
@@ -132,6 +132,9 @@ .getTabsWithNoOtherRelatedTabs()); RecordUserAction.record("MobileMenuGroupTabs"); return true; + } else if (id == R.id.track_prices_id || id == R.id.track_prices_check_id) { + PriceTrackingUtilities.flipTrackPricesOnTabs(); + return true; } return false; }
diff --git a/chrome/android/features/tab_ui/tab_management_java_sources.gni b/chrome/android/features/tab_ui/tab_management_java_sources.gni index e1968b5..c64705e 100644 --- a/chrome/android/features/tab_ui/tab_management_java_sources.gni +++ b/chrome/android/features/tab_ui/tab_management_java_sources.gni
@@ -13,6 +13,7 @@ "//chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/pseudotab/TabAttributeCache.java", "//chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_groups/EmptyTabGroupModelFilterObserver.java", "//chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_groups/TabGroupModelFilter.java", + "//chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/PriceTrackingUtilities.java", "//chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUi.java", "//chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabManagementDelegate.java", "//chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabManagementModuleProvider.java",
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java index 8e6c69d..76daf15 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java
@@ -52,6 +52,7 @@ import org.chromium.chrome.browser.share.ShareUtils; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.TabModelSelector; +import org.chromium.chrome.browser.tasks.tab_management.PriceTrackingUtilities; import org.chromium.chrome.browser.tasks.tab_management.TabUiFeatureUtilities; import org.chromium.chrome.browser.toolbar.ToolbarManager; import org.chromium.chrome.browser.translate.TranslateUtils; @@ -577,6 +578,10 @@ if (item.getItemId() == R.id.track_prices_row_menu_id) { item.setVisible(isPriceTrackingVisible); item.setEnabled(isPriceTrackingEnabled); + if (isPriceTrackingVisible) { + menu.findItem(R.id.track_prices_check_id) + .setChecked(PriceTrackingUtilities.isTrackPricesOnTabsEnabled()); + } } if (item.getItemId() == R.id.close_all_tabs_menu_id) { boolean hasTabs = mTabModelSelector.getTotalTabCount() > 0;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabIntentDataProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabIntentDataProvider.java index b7a338b..5c504403 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabIntentDataProvider.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabIntentDataProvider.java
@@ -25,6 +25,7 @@ import org.chromium.base.IntentUtils; import org.chromium.chrome.R; +import org.chromium.chrome.browser.ChromeApplication; import org.chromium.chrome.browser.IntentHandler; import org.chromium.chrome.browser.browserservices.BrowserServicesIntentDataProvider; import org.chromium.chrome.browser.flags.ActivityType; @@ -117,11 +118,19 @@ return (isTrustedIntent(intent) && (requestedUiType == CustomTabsUiType.READER_MODE)); } + private static boolean isVerifiedFirstPartyIntent(Intent intent) { + CustomTabsSessionToken sessionToken = + CustomTabsSessionToken.getSessionTokenFromIntent(intent); + String sendersPackageName = + CustomTabsConnection.getInstance().getClientPackageNameForSession(sessionToken); + return !TextUtils.isEmpty(sendersPackageName) + && ChromeApplication.getComponent().resolveExternalAuthUtils().isGoogleSigned( + sendersPackageName); + } + private static boolean isTrustedIntent(Intent intent) { - CustomTabsSessionToken session = CustomTabsSessionToken.getSessionTokenFromIntent(intent); - boolean isOpenedByChrome = - IntentUtils.safeGetBooleanExtra(intent, EXTRA_IS_OPENED_BY_CHROME, false); - return isTrustedCustomTab(intent, session) && isOpenedByChrome; + if (IntentHandler.wasIntentSenderChrome(intent)) return true; + return isVerifiedFirstPartyIntent(intent); } private static boolean isAllowedToAddCustomMenuItem(Intent intent) { @@ -150,6 +159,7 @@ // incognito CCT request for all apps. public static boolean isValidIncognitoIntent(Intent intent) { if (!isIncognitoRequested(intent)) return false; + if (!isTrustedIntent(intent)) return false; // Incognito requests for payments flow are supported without // INCOGNITO_CCT flag as an exceptional case that can use Chrome // incognito profile.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ChromePaymentRequestService.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ChromePaymentRequestService.java index 46f6e68..0e48a5f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ChromePaymentRequestService.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ChromePaymentRequestService.java
@@ -24,7 +24,6 @@ import org.chromium.components.payments.Event; import org.chromium.components.payments.JourneyLogger; import org.chromium.components.payments.MethodStrings; -import org.chromium.components.payments.NotShownReason; import org.chromium.components.payments.PackageManagerDelegate; import org.chromium.components.payments.PaymentApp; import org.chromium.components.payments.PaymentAppService; @@ -261,7 +260,7 @@ // Implements BrowserPaymentRequest: @Override - public void triggerPaymentAppUiSkipIfApplicable() { + public String triggerPaymentAppUiSkipIfApplicable() { // If we are skipping showing the Payment Request UI, we should call into the payment app // immediately after we determine the apps are ready and UI is shown. if ((mPaymentUiService.shouldSkipShowingPaymentRequestUi() || mSkipToGPayHelper != null) @@ -273,15 +272,7 @@ if (isMinimalUiApplicable()) { ChromeActivity chromeActivity = ChromeActivity.fromWebContents(mWebContents); - if (chromeActivity == null) { - mJourneyLogger.setNotShown(NotShownReason.OTHER); - disconnectFromClientWithDebugMessage(ErrorStrings.ACTIVITY_NOT_FOUND); - if (PaymentRequestService.getObserverForTest() != null) { - PaymentRequestService.getObserverForTest() - .onPaymentRequestServiceShowFailed(); - } - return; - } + if (chromeActivity == null) return ErrorStrings.ACTIVITY_NOT_FOUND; if (mPaymentUiService.triggerMinimalUI(chromeActivity, mSpec.getRawTotal(), this::onMinimalUIReady, this::onMinimalUiConfirmed, /*dismissObserver=*/ @@ -290,10 +281,10 @@ ErrorStrings.USER_CANCELLED))) { mDidRecordShowEvent = true; mJourneyLogger.setEventOccurred(Event.SHOWN); + return null; } else { - disconnectFromClientWithDebugMessage(ErrorStrings.MINIMAL_UI_SUPPRESSED); + return ErrorStrings.MINIMAL_UI_SUPPRESSED; } - return; } assert !mPaymentUiService.getPaymentMethodsSection().isEmpty(); @@ -311,6 +302,7 @@ invokePaymentApp(null /* selectedShippingAddress */, null /* selectedShippingOption */, selectedApp); } + return null; } /** @return Whether the minimal UI should be shown. */ @@ -418,13 +410,9 @@ // Implements BrowserPaymentRequest: @Override - public void continueShow() { + public String continueShow() { ChromeActivity chromeActivity = ChromeActivity.fromWebContents(mWebContents); - if (chromeActivity == null) { - mJourneyLogger.setNotShown(NotShownReason.OTHER); - disconnectFromClientWithDebugMessage(ErrorStrings.ACTIVITY_NOT_FOUND); - return; - } + if (chromeActivity == null) return ErrorStrings.ACTIVITY_NOT_FOUND; mPaymentUiService.updateDetailsOnPaymentRequestUI(mSpec.getPaymentDetails()); @@ -447,7 +435,8 @@ mSpec.getRawTotal().amount.value, false /*completed*/); } - triggerPaymentAppUiSkipIfApplicable(); + String error = triggerPaymentAppUiSkipIfApplicable(); + if (error != null) return error; if (mPaymentRequestService.isFinishedQueryingPaymentApps() && !mPaymentUiService.shouldSkipShowingPaymentRequestUi()) { @@ -455,6 +444,7 @@ mPaymentUiService.enableAndUpdatePaymentRequestUIWithPaymentInfo(); if (providedInformationToPaymentRequestUI) recordShowEventAndTransactionAmount(); } + return null; } // Implement BrowserPaymentRequest: @@ -599,7 +589,14 @@ mPaymentRequestService.close(); mPaymentRequestService = null; - closeUIAndDestroyNativeObjects(); + mPaymentUiService.close(); + SettingsAutofillAndPaymentsObserver.getInstance().unregisterObserver(mPaymentUiService); + + if (mPaymentHandlerHost != null) { + mPaymentHandlerHost.destroy(); + mPaymentHandlerHost = null; + } + PaymentDetailsUpdateServiceHelper.getInstance().reset(); } // Implements BrowserPaymentRequest: @@ -734,28 +731,6 @@ } } - /** - * Closes the UI and destroys native objects. If the client is still connected, then it's - * notified of UI hiding. This ChromePaymentRequestService object can't be reused after this - * function is called. - */ - private void closeUIAndDestroyNativeObjects() { - mPaymentUiService.close(); - SettingsAutofillAndPaymentsObserver.getInstance().unregisterObserver(mPaymentUiService); - - // Destroy native objects. - mJourneyLogger.destroy(); - if (mPaymentHandlerHost != null) { - mPaymentHandlerHost.destroy(); - mPaymentHandlerHost = null; - } - - if (mSpec != null) { - mSpec.destroy(); - } - PaymentDetailsUpdateServiceHelper.getInstance().reset(); - } - // Implement PaymentUiService.Delegate: @Override public void dispatchPayerDetailChangeEventIfNeeded(PayerDetail detail) {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityIncognitoTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityIncognitoTest.java index 504ce69..1225843 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityIncognitoTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityIncognitoTest.java
@@ -72,13 +72,15 @@ @RunWith(ChromeJUnit4ClassRunner.class) @CommandLineFlags.Add({ChromeSwitches.FORCE_FIRST_RUN_FLOW_COMPLETE_FOR_TESTING}) public class CustomTabActivityIncognitoTest { - private String mTestPage; private static final String TEST_PAGE = "/chrome/test/data/android/google.html"; private static final String TEST_MENU_TITLE = "testMenuTitle"; private static int sIdToIncrement = 1; + private String mTestPage; + @Rule - public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule(); + public IncognitoCustomTabActivityTestRule mCustomTabActivityTestRule = + new IncognitoCustomTabActivityTestRule(); @Rule public TestRule mProcessor = new Features.InstrumentationProcessor(); @@ -89,7 +91,6 @@ @Before public void setUp() throws TimeoutException { mTestPage = mEmbeddedTestServerRule.getServer().getURL(TEST_PAGE); - // Ensuring native is initialized before we access the CCT_INCOGNITO feature flag. IncognitoDataTestUtils.fireAndWaitForCctWarmup(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabActivityRenderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabActivityRenderTest.java index 6214d5bd..36b1dc99 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabActivityRenderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabActivityRenderTest.java
@@ -56,8 +56,8 @@ private Intent mIntent; @Rule - public final CustomTabActivityTestRule mCustomTabActivityTestRule = - new CustomTabActivityTestRule(); + public final IncognitoCustomTabActivityTestRule mCustomTabActivityTestRule = + new IncognitoCustomTabActivityTestRule(); @Rule public final EmbeddedTestServerRule mEmbeddedTestServerRule = new EmbeddedTestServerRule();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabActivityTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabActivityTestRule.java new file mode 100644 index 0000000..7eb3b6cb --- /dev/null +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabActivityTestRule.java
@@ -0,0 +1,79 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.customtabs; + +import android.content.Intent; + +import androidx.browser.customtabs.CustomTabsSessionToken; + +import org.junit.Assert; +import org.junit.Rule; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import org.chromium.chrome.browser.AppHooksModule; +import org.chromium.chrome.browser.IntentHandler; +import org.chromium.chrome.browser.dependency_injection.ModuleOverridesRule; +import org.chromium.chrome.browser.externalauth.ExternalAuthUtils; + +import java.util.concurrent.TimeoutException; + +/** + * Custom ActivityTestRule for all instrumentation tests that require a regular or Incognito {@link + * CustomTabActivity}. + */ +public class IncognitoCustomTabActivityTestRule extends CustomTabActivityTestRule { + @Rule + private final TestRule mModuleOverridesRule = new ModuleOverridesRule().setOverride( + AppHooksModule.Factory.class, AppHooksModuleForTest::new); + + /** + * To load a fake module in tests we need to bypass a check if package name of module + * is Google-signed. This class overrides this check for testing. + */ + class AppHooksModuleForTest extends AppHooksModule { + @Override + public ExternalAuthUtils provideExternalAuthUtils() { + return new ExternalAuthUtils() { + @Override + public boolean isGoogleSigned(String packageName) { + return true; + } + }; + } + } + + private static void createNewCustomTabSessionForIntent(Intent intent) throws TimeoutException { + // To emulate first party we create a new session with the session token provided by the + // |intent|. The session is needed in order to verify if the embedder is 1P or not. + CustomTabsConnection connection = CustomTabsTestUtils.warmUpAndWait(); + CustomTabsSessionToken token = CustomTabsSessionToken.getSessionTokenFromIntent(intent); + connection.newSession(token); + } + + private static boolean isIntentIncognito(Intent intent) { + return intent.getBooleanExtra(IntentHandler.EXTRA_OPEN_NEW_INCOGNITO_TAB, false); + } + + @Override + public void startCustomTabActivityWithIntent(Intent intent) { + if (isIntentIncognito(intent)) { + try { + createNewCustomTabSessionForIntent(intent); + } catch (TimeoutException e) { + Assert.fail(); + } + } + super.startCustomTabActivityWithIntent(intent); + } + + @Override + public Statement apply(Statement base, Description description) { + // ModuleOverridesRule must be an outer rule. + Statement moduleOverridesStatement = mModuleOverridesRule.apply(base, description); + return super.apply(moduleOverridesStatement, description); + } +} \ No newline at end of file
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoCookieLeakageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoCookieLeakageTest.java index a3a1398..5d368d6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoCookieLeakageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoCookieLeakageTest.java
@@ -26,7 +26,7 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Criteria; import org.chromium.base.test.util.CriteriaHelper; -import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; +import org.chromium.chrome.browser.customtabs.IncognitoCustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.incognito.IncognitoDataTestUtils.ActivityType; @@ -53,17 +53,17 @@ @EnableFeatures({ChromeFeatureList.CCT_INCOGNITO}) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class IncognitoCookieLeakageTest { + private static final String COOKIES_SETTING_PATH = "/chrome/test/data/android/cookie.html"; private String mCookiesTestPage; private EmbeddedTestServer mTestServer; - private static final String COOKIES_SETTING_PATH = "/chrome/test/data/android/cookie.html"; - @Rule public ChromeTabbedActivityTestRule mChromeActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule - public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule(); + public IncognitoCustomTabActivityTestRule mCustomTabActivityTestRule = + new IncognitoCustomTabActivityTestRule(); @Before public void setUp() throws TimeoutException {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoDataTestUtils.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoDataTestUtils.java index a356dcb..4172baec 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoDataTestUtils.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoDataTestUtils.java
@@ -6,7 +6,11 @@ import static org.junit.Assert.assertEquals; +import static org.chromium.chrome.browser.customtabs.CustomTabsTestUtils.createMinimalCustomTabIntent; +import static org.chromium.chrome.browser.customtabs.CustomTabsTestUtils.createMinimalIncognitoCustomTabIntent; + import android.app.Activity; +import android.content.Context; import android.content.Intent; import android.support.test.InstrumentationRegistry; @@ -19,11 +23,9 @@ import org.chromium.base.test.util.Criteria; import org.chromium.base.test.util.CriteriaHelper; import org.chromium.chrome.browser.ChromeTabbedActivity; -import org.chromium.chrome.browser.IntentHandler; import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.customtabs.CustomTabsConnection; -import org.chromium.chrome.browser.customtabs.CustomTabsTestUtils; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; @@ -157,15 +159,11 @@ private static Tab launchUrlInCCT( CustomTabActivityTestRule testRule, String url, boolean incognito) { - Intent intent = CustomTabsTestUtils.createMinimalCustomTabIntent( - InstrumentationRegistry.getContext(), url); - - if (incognito) { - intent.putExtra(IntentHandler.EXTRA_OPEN_NEW_INCOGNITO_TAB, true); - } + Context context = InstrumentationRegistry.getContext(); + Intent intent = incognito ? createMinimalIncognitoCustomTabIntent(context, url) + : createMinimalCustomTabIntent(context, url); testRule.startCustomTabActivityWithIntent(intent); - Tab tab = testRule.getActivity().getActivityTab(); // Giving time to the WebContents to be ready.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoDownloadLeakageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoDownloadLeakageTest.java index c6b3a9b..0cd56ef 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoDownloadLeakageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoDownloadLeakageTest.java
@@ -27,7 +27,7 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisabledTest; -import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; +import org.chromium.chrome.browser.customtabs.IncognitoCustomTabActivityTestRule; import org.chromium.chrome.browser.download.DownloadItem; import org.chromium.chrome.browser.download.DownloadManagerService; import org.chromium.chrome.browser.download.DownloadPromptStatus; @@ -129,7 +129,8 @@ new ChromeTabbedActivityTestRule(); @Rule - public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule(); + public IncognitoCustomTabActivityTestRule mCustomTabActivityTestRule = + new IncognitoCustomTabActivityTestRule(); @Before public void setUp() throws Exception {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoHistoryLeakageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoHistoryLeakageTest.java index e6fa0387..fe908df 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoHistoryLeakageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoHistoryLeakageTest.java
@@ -27,7 +27,7 @@ import org.chromium.base.test.util.Criteria; import org.chromium.base.test.util.CriteriaHelper; import org.chromium.base.test.util.DisabledTest; -import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; +import org.chromium.chrome.browser.customtabs.IncognitoCustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.history.BrowsingHistoryBridge; @@ -58,19 +58,20 @@ @EnableFeatures({ChromeFeatureList.CCT_INCOGNITO}) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class IncognitoHistoryLeakageTest { + private static final String TEST_PAGE_1 = "/chrome/test/data/android/google.html"; + private static final String TEST_PAGE_2 = "/chrome/test/data/android/test.html"; + private EmbeddedTestServer mTestServer; private String mTestPage1; private String mTestPage2; - private static final String TEST_PAGE_1 = "/chrome/test/data/android/google.html"; - private static final String TEST_PAGE_2 = "/chrome/test/data/android/test.html"; - @Rule public ChromeTabbedActivityTestRule mChromeActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule - public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule(); + public IncognitoCustomTabActivityTestRule mCustomTabActivityTestRule = + new IncognitoCustomTabActivityTestRule(); @Before public void setUp() throws TimeoutException {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoPermissionLeakageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoPermissionLeakageTest.java index a0ce4b0d..0856a36 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoPermissionLeakageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoPermissionLeakageTest.java
@@ -37,7 +37,7 @@ import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.FlakyTest; import org.chromium.chrome.R; -import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; +import org.chromium.chrome.browser.customtabs.IncognitoCustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.incognito.IncognitoDataTestUtils.ActivityType; @@ -68,18 +68,19 @@ @EnableFeatures({ChromeFeatureList.CCT_INCOGNITO}) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class IncognitoPermissionLeakageTest { - private String mPermissionTestPage; - private EmbeddedTestServer mTestServer; - private static final String PERMISSION_HTML_PATH = "/content/test/data/android/geolocation.html"; + private String mPermissionTestPage; + private EmbeddedTestServer mTestServer; + @Rule public ChromeTabbedActivityTestRule mChromeActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule - public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule(); + public IncognitoCustomTabActivityTestRule mCustomTabActivityTestRule = + new IncognitoCustomTabActivityTestRule(); @Before public void setUp() throws TimeoutException {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoStorageLeakageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoStorageLeakageTest.java index 68195e9..d1a2d658 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoStorageLeakageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoStorageLeakageTest.java
@@ -25,7 +25,7 @@ import org.chromium.base.test.util.Criteria; import org.chromium.base.test.util.CriteriaHelper; import org.chromium.base.test.util.DisabledTest; -import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; +import org.chromium.chrome.browser.customtabs.IncognitoCustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.incognito.IncognitoDataTestUtils.ActivityType; @@ -53,21 +53,22 @@ @EnableFeatures({ChromeFeatureList.CCT_INCOGNITO}) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class IncognitoStorageLeakageTest { - private String mSiteDataTestPage; - private EmbeddedTestServer mTestServer; - private static final String SITE_DATA_HTML_PATH = "/content/test/data/browsing_data/site_data.html"; private static final List<String> sSiteData = Arrays.asList( "LocalStorage", "ServiceWorker", "CacheStorage", "IndexedDb", "FileSystem", "WebSql"); + private String mSiteDataTestPage; + private EmbeddedTestServer mTestServer; + @Rule public ChromeTabbedActivityTestRule mChromeActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule - public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule(); + public IncognitoCustomTabActivityTestRule mCustomTabActivityTestRule = + new IncognitoCustomTabActivityTestRule(); @Before public void setUp() throws TimeoutException {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarDataProviderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarDataProviderTest.java index 8969e62..7013dbf 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarDataProviderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarDataProviderTest.java
@@ -23,8 +23,8 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Restriction; import org.chromium.chrome.R; -import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.customtabs.CustomTabsTestUtils; +import org.chromium.chrome.browser.customtabs.IncognitoCustomTabActivityTestRule; import org.chromium.chrome.browser.customtabs.features.toolbar.CustomTabToolbar; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; @@ -56,7 +56,8 @@ public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule - public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule(); + public IncognitoCustomTabActivityTestRule mCustomTabActivityTestRule = + new IncognitoCustomTabActivityTestRule(); @Rule public BlankCTATabInitialStateRule mBlankCTATabInitialStateRule =
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp index b950d4b..15e8b13 100644 --- a/chrome/app/chromeos_strings.grdp +++ b/chrome/app/chromeos_strings.grdp
@@ -3418,8 +3418,8 @@ <message name="IDS_ENTERPRISE_ENROLLMENT_SUCCESS_ILLUSTRATION_TITLE" desc="Accessible title of the enterprise enrollment screen illustration depicting successful enrollment."> Successful enrollment illustration </message> - <message name="IDS_ENTERPRISE_ENROLLMENT_SUCCESS_DOMAIN" desc="Success message to be shown once enterprise enrollment completes."> - This <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> will be managed by <ph name="DOMAIN">$2<ex>acmecorp.com</ex></ph>. + <message name="IDS_ENTERPRISE_ENROLLMENT_SUCCESS_DOMAIN" desc="Success message to be shown once enterprise enrollment completes. MANAGER can be a domain or an email address."> + This <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> will be managed by <ph name="MANAGER">$2<ex>acmecorp.com</ex></ph>. </message> <message name="IDS_ENTERPRISE_ENROLLMENT_ASSET_ID_LABEL" desc="Label for asset id text box on the device naming screen in the enterprise enrollment dialog."> Asset Identifier @@ -5588,6 +5588,9 @@ <message name="IDS_BOREALIS_INSTALLER_NOT_ALLOWED_MESSAGE" desc="" translateable="false"> <ph name="APP_NAME">$1<ex>BOREALIS</ex></ph> isn't allowed on this device. Contact your administrator. Error code: <ph name="ERROR_CODE">$2<ex>7</ex></ph>. </message> + <message name="IDS_BOREALIS_INSTALLER_OFFLINE_MESSAGE" desc="" translateable="false"> + Your device is offline, please connect to the internet and try again. + </message> <message name="IDS_BOREALIS_DLC_INTERNAL_FAILED_MESSAGE" desc="" translateable="false"> Your device needs to be updated before you can use <ph name="APP_NAME">$1<ex>BOREALIS</ex></ph>. </message>
diff --git a/chrome/app/chromeos_strings_grdp/IDS_ENTERPRISE_ENROLLMENT_SUCCESS_DOMAIN.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_ENTERPRISE_ENROLLMENT_SUCCESS_DOMAIN.png.sha1 new file mode 100644 index 0000000..242d236 --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_ENTERPRISE_ENROLLMENT_SUCCESS_DOMAIN.png.sha1
@@ -0,0 +1 @@ +ca0bc516f28be79794ebc4653c0fd0fe55ca787c \ No newline at end of file
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 5b60a97..4217c74 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -1275,8 +1275,8 @@ <message name="IDS_MANAGED" desc="The text label of the 'Managed by' UI in the app menu, for enterprise users" formatter_data="android_java"> Managed by your organization </message> - <message name="IDS_MANAGED_BY" desc="The text label of the 'Managed by' UI in the app menu, for enterprise users"> - Managed by <ph name="ENROLLMENT_DOMAIN">$1<ex>example.com</ex></ph> + <message name="IDS_MANAGED_BY" desc="The text label of the 'Managed by' UI in the app menu, for enterprise users. MANAGER can be a domain or an email address."> + Managed by <ph name="MANAGER">$1<ex>example.com</ex></ph> </message> <if expr="not use_titlecase"> <message name="IDS_IMPORT_SETTINGS_MENU_LABEL" desc="In sentence case: The app menu label to import bookmarks and settings."> @@ -7579,8 +7579,8 @@ <message name="IDS_MANAGED_WITH_HYPERLINK" desc="Message to end users in Enterprise/EDU, with a link for more info (non-ChromeOS)"> Your <ph name="BEGIN_LINK"><a href="$1"></ph>browser is managed<ph name="END_LINK"></a></ph> by your organization </message> - <message name="IDS_MANAGED_BY_WITH_HYPERLINK" desc="Message to end users in Enterprise/EDU, with a link for more info (non-ChromeOS)"> - Your <ph name="BEGIN_LINK"><a href="$1"></ph>browser is managed<ph name="END_LINK"></a></ph> by <ph name="ENROLLMENT_DOMAIN">$2<ex>example.com</ex></ph> + <message name="IDS_MANAGED_BY_WITH_HYPERLINK" desc="Message to end users in Enterprise/EDU, with a link for more info (non-ChromeOS). MANAGER can be a domain or an email address."> + Your <ph name="BEGIN_LINK"><a href="$1"></ph>browser is managed<ph name="END_LINK"></a></ph> by <ph name="MANAGER">$2<ex>example.com</ex></ph> </message> </if>
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 02db0b6..26ececb 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -98,18 +98,6 @@ generate_python = false } -source_set("browser_process") { - sources = [ - "browser_process.cc", - "browser_process.h", - ] - deps = [ - "//base", - "//chrome/common:buildflags", - "//media:media_buildflags", - ] -} - # Use a static library here because many test binaries depend on this but don't # require many files from it.This makes linking more efficient. static_library("browser") { @@ -218,6 +206,8 @@ "browser_about_handler.h", "browser_features.cc", "browser_features.h", + "browser_process.cc", + "browser_process.h", "browser_process_impl.cc", "browser_process_impl.h", "browser_process_platform_part.h", @@ -1763,6 +1753,8 @@ "subresource_redirect/https_image_compression_bypass_decider.h", "subresource_redirect/https_image_compression_infobar_decider.cc", "subresource_redirect/https_image_compression_infobar_decider.h", + "subresource_redirect/origin_robots_rules.cc", + "subresource_redirect/origin_robots_rules.h", "subresource_redirect/subresource_redirect_observer.cc", "subresource_redirect/subresource_redirect_observer.h", "subresource_redirect/subresource_redirect_util.cc", @@ -1933,7 +1925,6 @@ "//chrome/app/resources:platform_locale_settings", "//chrome/app/theme:theme_resources", "//chrome/app/vector_icons", - "//chrome/browser:browser_process", "//chrome/browser/devtools", "//chrome/browser/image_decoder", "//chrome/browser/media:media_engagement_preload_proto", @@ -6622,7 +6613,6 @@ deps = [ "//chrome/app/theme:theme_resources", "//chrome/browser", - "//chrome/browser:browser_process", "//chrome/common", "//chrome/common/safe_browsing:proto", "//components/consent_auditor:test_support", @@ -6887,7 +6877,6 @@ deps = [ ":browser", "//chrome:browser_tests_pak", - "//chrome/browser:browser_process", "//chrome/common:mojo_bindings", "//chrome/test/data:web_ui_test_bindings", "//components/metrics:test_support",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 53d1851..1b020be 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -2698,6 +2698,10 @@ FEATURE_VALUE_TYPE(display::features::kUseHDRTransferFunction)}, #endif // OS_CHROMEOS #if defined(OS_CHROMEOS) + {"account-management-flows-v2", + flag_descriptions::kAccountManagementFlowsV2Name, + flag_descriptions::kAccountManagementFlowsV2Description, kOsCrOS, + FEATURE_VALUE_TYPE(chromeos::features::kAccountManagementFlowsV2)}, {"dark-light-mode", flag_descriptions::kDarkLightTestName, flag_descriptions::kDarkLightTestDescription, kOsCrOS, FEATURE_VALUE_TYPE(ash::features::kDarkLightMode)},
diff --git a/chrome/browser/android/vr/BUILD.gn b/chrome/browser/android/vr/BUILD.gn index c3e0f3a..e9a4669 100644 --- a/chrome/browser/android/vr/BUILD.gn +++ b/chrome/browser/android/vr/BUILD.gn
@@ -70,7 +70,6 @@ "//base", "//cc", "//chrome/android/features/vr:jni_headers", - "//chrome/browser:browser_process", "//chrome/browser/ui", "//chrome/browser/vr:vr_common", "//chrome/common",
diff --git a/chrome/browser/apps/app_shim/BUILD.gn b/chrome/browser/apps/app_shim/BUILD.gn index 0b8afefef..8e811f3 100644 --- a/chrome/browser/apps/app_shim/BUILD.gn +++ b/chrome/browser/apps/app_shim/BUILD.gn
@@ -24,7 +24,6 @@ deps = [ "//apps", - "//chrome/browser:browser_process", "//chrome/browser/web_applications:web_applications", "//chrome/browser/web_applications/components", "//chrome/common",
diff --git a/chrome/browser/apps/platform_apps/BUILD.gn b/chrome/browser/apps/platform_apps/BUILD.gn index f126569d..2112a1ed 100644 --- a/chrome/browser/apps/platform_apps/BUILD.gn +++ b/chrome/browser/apps/platform_apps/BUILD.gn
@@ -51,7 +51,6 @@ deps = [ "//chrome/app:command_ids", - "//chrome/browser:browser_process", "//chrome/browser/extensions", "//chrome/browser/media/router/discovery", "//chrome/browser/sharing/proto:proto",
diff --git a/chrome/browser/apps/platform_apps/api/BUILD.gn b/chrome/browser/apps/platform_apps/api/BUILD.gn index aec7a4c858..2c049ba 100644 --- a/chrome/browser/apps/platform_apps/api/BUILD.gn +++ b/chrome/browser/apps/platform_apps/api/BUILD.gn
@@ -48,7 +48,6 @@ # TODO(https://crbug.com/883570): It'd be nice to have more APIs here # extracted into their own BUILD files (so they are easy to audit, add, or # remove), but any that depend on //chrome/browser:browser can't. - "//chrome/browser:browser_process", "//chrome/browser/apps/platform_apps/api/music_manager_private", "//chrome/browser/extensions", "//chrome/common",
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index 4a16d802..49af09c8 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd
@@ -45,6 +45,8 @@ <structure name="IDR_OOBE_COMPONENTS_HD_IRON_ICON_HTML" file="resources/chromeos/login/components/hd_iron_icon/hd_iron_icon.html" type="chrome_html" /> <structure name="IDR_OOBE_COMPONENTS_HD_IRON_ICON_JS" file="resources/chromeos/login/components/hd_iron_icon/hd_iron_icon.js" type="chrome_html" /> + <structure name="IDR_OOBE_COMPONENTS_OOBE_DIALOG_HTML" file="resources/chromeos/login/components/oobe_dialog/oobe_dialog.html" type="chrome_html" /> + <structure name="IDR_OOBE_COMPONENTS_OOBE_DIALOG_JS" file="resources/chromeos/login/components/oobe_dialog/oobe_dialog.js" type="chrome_html" /> <structure name="IDR_OOBE_COMPONENTS_OOBE_CAROUSEL_HTML" file="resources/chromeos/login/components/oobe_carousel/oobe_carousel.html" type="chrome_html" /> <structure name="IDR_OOBE_COMPONENTS_OOBE_CAROUSEL_JS" file="resources/chromeos/login/components/oobe_carousel/oobe_carousel.js" type="chrome_html" /> <structure name="IDR_OOBE_COMPONENTS_OOBE_SLIDE_HTML" file="resources/chromeos/login/components/oobe_slide/oobe_slide.html" type="chrome_html" />
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index c00add0..61f4bd4 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -2431,8 +2431,7 @@ } else if (process_type == switches::kGpuProcess) { // If --ignore-gpu-blocklist is passed in, don't send in crash reports // because GPU is expected to be unreliable. - if ((browser_command_line.HasSwitch(switches::kIgnoreGpuBlocklist) || - browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist)) && + if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlocklist) && !command_line->HasSwitch(switches::kDisableBreakpad)) command_line->AppendSwitch(switches::kDisableBreakpad); }
diff --git a/chrome/browser/chrome_notification_types.h b/chrome/browser/chrome_notification_types.h index 6bfaac57..f5b5b6a 100644 --- a/chrome/browser/chrome_notification_types.h +++ b/chrome/browser/chrome_notification_types.h
@@ -171,12 +171,6 @@ // NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, - // Send when kiosk auto-launch warning screen is visible. - NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, - - // Send when kiosk auto-launch warning screen had completed. - NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, - // Send when consumer kiosk has been enabled. NOTIFICATION_KIOSK_ENABLED,
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 4e474d06..98a3047 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -77,7 +77,6 @@ "//build:branding_buildflags", "//chrome/app:command_ids", "//chrome/app/vector_icons", - "//chrome/browser:browser_process", "//chrome/browser:theme_properties", "//chrome/browser/apps/platform_apps", "//chrome/browser/apps/platform_apps/api", @@ -601,8 +600,12 @@ "arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.h", "arc/cast_receiver/arc_cast_receiver_service.cc", "arc/cast_receiver/arc_cast_receiver_service.h", + "arc/enterprise/arc_data_snapshotd_delegate.cc", + "arc/enterprise/arc_data_snapshotd_delegate.h", "arc/enterprise/arc_enterprise_reporting_service.cc", "arc/enterprise/arc_enterprise_reporting_service.h", + "arc/enterprise/arc_force_installed_apps_tracker.cc", + "arc/enterprise/arc_force_installed_apps_tracker.h", "arc/enterprise/cert_store/arc_cert_installer.cc", "arc/enterprise/cert_store/arc_cert_installer.h", "arc/enterprise/cert_store/arc_cert_installer_utils.cc", @@ -3270,6 +3273,8 @@ "arc/bluetooth/arc_bluetooth_bridge_unittest.cc", "arc/bluetooth/arc_bluetooth_task_queue_unittest.cc", "arc/boot_phase_monitor/arc_boot_phase_monitor_bridge_unittest.cc", + "arc/enterprise/arc_data_snapshotd_delegate_unittest.cc", + "arc/enterprise/arc_force_installed_apps_tracker_unittest.cc", "arc/enterprise/cert_store/arc_cert_installer_unittest.cc", "arc/enterprise/cert_store/arc_smart_card_manager_bridge_unittest.cc", "arc/enterprise/cert_store/security_token_operation_bridge_unittest.cc",
diff --git a/chrome/browser/chromeos/arc/enterprise/arc_data_snapshotd_delegate.cc b/chrome/browser/chromeos/arc/enterprise/arc_data_snapshotd_delegate.cc new file mode 100644 index 0000000..91b86fa --- /dev/null +++ b/chrome/browser/chromeos/arc/enterprise/arc_data_snapshotd_delegate.cc
@@ -0,0 +1,85 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/arc/enterprise/arc_data_snapshotd_delegate.h" +#include "chrome/browser/chromeos/arc/arc_util.h" +#include "chrome/browser/chromeos/arc/session/arc_session_manager.h" + +namespace arc { +namespace data_snapshotd { + +namespace { + +// Returns true if ARC is active and running. +bool IsArcActive(arc::ArcSessionManager::State state) { + return state == ArcSessionManager::State::ACTIVE; +} + +// Returns true if ARC is stopped. +bool IsArcStopped(arc::ArcSessionManager::State state) { + return state == ArcSessionManager::State::STOPPED; +} + +} // namespace + +ArcDataSnapshotdDelegate::ArcDataSnapshotdDelegate() + : arc_session_manager_(arc::ArcSessionManager::Get()) { + DCHECK(arc_session_manager_); +} + +ArcDataSnapshotdDelegate::~ArcDataSnapshotdDelegate() { + if (!arc_stopped_callback_.is_null()) + NotifyArcStopped(false /* success */); +} + +void ArcDataSnapshotdDelegate::RequestStopArcInstance( + base::OnceCallback<void(bool)> stopped_callback) { + DCHECK(!stopped_callback.is_null()); + if (!arc_stopped_callback_.is_null()) { + // Previous request to stop ARC has not been satisfied yet. + LOG(WARNING) << "Requested to stop ARC twice."; + // Report failure to both callbacks. + NotifyArcStopped(false /* success */); + std::move(stopped_callback).Run(false /* success */); + return; + } + if (!IsArcActive(arc_session_manager_->state())) { + if (!stopped_callback.is_null()) + std::move(stopped_callback).Run(false /* success */); + return; + } + + arc_stopped_callback_ = std::move(stopped_callback); + arc_session_manager_->AddObserver(this); + + // ARC is expected to be active and running here. + arc_session_manager_->RequestDisable(); +} + +void ArcDataSnapshotdDelegate::OnArcSessionStopped(arc::ArcStopReason reason) { + switch (reason) { + case arc::ArcStopReason::SHUTDOWN: + // This shutdown is triggered only by RequestStopArcInstance. + // It is guaranteed that user is not able to influence ArcEnabled pref. + // If ARC is disabled by policy, the ARC snapshot feature gets disabled. + DCHECK(IsArcStopped(arc_session_manager_->state())); + NotifyArcStopped(true /* success */); + return; + case arc::ArcStopReason::GENERIC_BOOT_FAILURE: + case arc::ArcStopReason::CRASH: + case arc::ArcStopReason::LOW_DISK_SPACE: + NotifyArcStopped(false /* success */); + return; + } +} + +void ArcDataSnapshotdDelegate::NotifyArcStopped(bool success) { + DCHECK(!arc_stopped_callback_.is_null()); + std::move(arc_stopped_callback_).Run(success); + + arc_session_manager_->RemoveObserver(this); +} + +} // namespace data_snapshotd +} // namespace arc
diff --git a/chrome/browser/chromeos/arc/enterprise/arc_data_snapshotd_delegate.h b/chrome/browser/chromeos/arc/enterprise/arc_data_snapshotd_delegate.h new file mode 100644 index 0000000..39f30d7 --- /dev/null +++ b/chrome/browser/chromeos/arc/enterprise/arc_data_snapshotd_delegate.h
@@ -0,0 +1,49 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_ARC_ENTERPRISE_ARC_DATA_SNAPSHOTD_DELEGATE_H_ +#define CHROME_BROWSER_CHROMEOS_ARC_ENTERPRISE_ARC_DATA_SNAPSHOTD_DELEGATE_H_ + +#include "base/callback.h" +#include "chrome/browser/chromeos/arc/session/arc_session_manager_observer.h" +#include "components/arc/enterprise/arc_data_snapshotd_manager.h" +#include "components/arc/session/arc_stop_reason.h" + +namespace arc { + +class ArcSessionManager; + +namespace data_snapshotd { + +// This class performs delegated actions from ArcDataSnapshotdManager. +class ArcDataSnapshotdDelegate : public ArcDataSnapshotdManager::Delegate, + public arc::ArcSessionManagerObserver { + public: + ArcDataSnapshotdDelegate(); + ArcDataSnapshotdDelegate(const ArcDataSnapshotdDelegate&) = delete; + ArcDataSnapshotdDelegate& operator=(const ArcDataSnapshotdDelegate&) = delete; + ~ArcDataSnapshotdDelegate() override; + + // ArcDataSnapshotdManager::Delegate overrides: + void RequestStopArcInstance( + base::OnceCallback<void(bool)> stopped_callback) override; + + // arc::ArcSessionManagerObserver overrides: + void OnArcSessionStopped(arc::ArcStopReason reason) override; + + private: + // Notifies via |arc_stopped_callback_| that ARC is successfully stopped + // starting from ACTIVE state. Otherwise returns false. + // |arc_stopped_callback_| should never be null when calling this method. + void NotifyArcStopped(bool success); + + // Not owned. Owned by ArcServiceLauncher. Should never be nullptr. + arc::ArcSessionManager* const arc_session_manager_; + base::OnceCallback<void(bool)> arc_stopped_callback_; +}; + +} // namespace data_snapshotd +} // namespace arc + +#endif // CHROME_BROWSER_CHROMEOS_ARC_ENTERPRISE_ARC_DATA_SNAPSHOTD_DELEGATE_H_
diff --git a/chrome/browser/chromeos/arc/enterprise/arc_data_snapshotd_delegate_unittest.cc b/chrome/browser/chromeos/arc/enterprise/arc_data_snapshotd_delegate_unittest.cc new file mode 100644 index 0000000..eab7f78 --- /dev/null +++ b/chrome/browser/chromeos/arc/enterprise/arc_data_snapshotd_delegate_unittest.cc
@@ -0,0 +1,208 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/arc/enterprise/arc_data_snapshotd_delegate.h" +#include "base/command_line.h" +#include "base/run_loop.h" +#include "base/test/bind.h" +#include "chrome/browser/chromeos/arc/arc_util.h" +#include "chrome/browser/chromeos/arc/session/arc_session_manager.h" +#include "chrome/browser/chromeos/arc/test/test_arc_session_manager.h" +#include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" +#include "chrome/test/base/testing_profile.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "components/arc/arc_prefs.h" +#include "components/arc/arc_util.h" +#include "components/arc/test/fake_arc_session.h" +#include "components/prefs/pref_service.h" +#include "components/user_manager/scoped_user_manager.h" +#include "components/user_manager/user_manager.h" +#include "content/public/test/browser_task_environment.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace arc { +namespace data_snapshotd { + +namespace { + +// This class is observer of ArcSessionManager. It makes sure that all ARC +// started/stopped events are tracked. +class TestObserver : public arc::ArcSessionManagerObserver { + public: + TestObserver() = default; + TestObserver(const TestObserver&) = delete; + TestObserver& operator=(const TestObserver&) = delete; + + // arc::ArcSessionManagerObserver overrides: + void OnArcStarted() override { + EXPECT_FALSE(start_closure_.is_null()); + std::move(start_closure_).Run(); + } + void OnArcSessionStopped(arc::ArcStopReason reason) override { + EXPECT_FALSE(stop_closure_.is_null()); + std::move(stop_closure_).Run(); + } + + void set_start_closure(base::OnceClosure closure) { + start_closure_ = std::move(closure); + } + void set_stop_closure(base::OnceClosure closure) { + stop_closure_ = std::move(closure); + } + + private: + base::OnceClosure start_closure_; + base::OnceClosure stop_closure_; +}; + +} // namespace + +class ArcDataSnapshotdDelegateTest : public testing::Test { + public: + ArcDataSnapshotdDelegateTest() + : user_manager_enabler_( + std::make_unique<chromeos::FakeChromeUserManager>()) { + SetArcAvailableCommandLineForTesting( + base::CommandLine::ForCurrentProcess()); + ArcSessionManager::EnableCheckAndroidManagementForTesting(false); + + chromeos::DBusThreadManager::Initialize(); + chromeos::SessionManagerClient::InitializeFakeInMemory(); + + TestingProfile::Builder profile_builder; + profile_builder.SetProfileName("user@gmail.com"); + testing_profile_ = profile_builder.Build(); + + const AccountId account_id(AccountId::FromUserEmailGaiaId( + testing_profile_->GetProfileUserName(), "1234567890")); + GetFakeUserManager()->AddUser(account_id); + GetFakeUserManager()->LoginUser(account_id); + } + + ArcDataSnapshotdDelegateTest(const ArcDataSnapshotdDelegateTest&) = delete; + ArcDataSnapshotdDelegateTest& operator=(const ArcDataSnapshotdDelegateTest&) = + delete; + + ~ArcDataSnapshotdDelegateTest() override { + chromeos::SessionManagerClient::Shutdown(); + chromeos::DBusThreadManager::Shutdown(); + } + + void SetUp() override { + arc_session_manager_ = + arc::CreateTestArcSessionManager(std::make_unique<ArcSessionRunner>( + base::BindRepeating(FakeArcSession::Create))); + + arc_session_manager_->SetProfile(testing_profile_.get()); + + PrefService* const prefs = testing_profile_->GetPrefs(); + prefs->SetBoolean(prefs::kArcEnabled, true); + + arc_session_manager_->Initialize(); + arc_session_manager_->AddObserver(&test_observer_); + + delegate_ = std::make_unique<ArcDataSnapshotdDelegate>(); + } + + void TearDown() override { + delegate_.reset(); + arc_session_manager_->RemoveObserver(&test_observer_); + arc_session_manager_.reset(); + } + + void EnableArc() { + base::RunLoop run_loop; + test_observer_.set_start_closure(run_loop.QuitClosure()); + arc_session_manager_->StartArcForTesting(); + run_loop.Run(); + EXPECT_TRUE( + IsArcPlayStoreEnabledForProfile(arc_session_manager_->profile())); + } + + void DisableArcPref() { + PrefService* const prefs = testing_profile_->GetPrefs(); + prefs->SetBoolean(prefs::kArcEnabled, false); + EXPECT_FALSE( + IsArcPlayStoreEnabledForProfile(arc_session_manager_->profile())); + } + + void ExpectArcStopped(base::OnceClosure closure) { + test_observer_.set_stop_closure(std::move(closure)); + } + + ArcDataSnapshotdDelegate* delegate() { return delegate_.get(); } + + private: + chromeos::FakeChromeUserManager* GetFakeUserManager() const { + return static_cast<chromeos::FakeChromeUserManager*>( + user_manager::UserManager::Get()); + } + + content::BrowserTaskEnvironment task_environment_; + TestObserver test_observer_; + user_manager::ScopedUserManager user_manager_enabler_; + std::unique_ptr<TestingProfile> testing_profile_; + std::unique_ptr<ArcDataSnapshotdDelegate> delegate_; + std::unique_ptr<arc::ArcSessionManager> arc_session_manager_; +}; + +// Tests ARC was stopped before the request. +TEST_F(ArcDataSnapshotdDelegateTest, BasicArcPreStopped) { + EXPECT_EQ(arc::ArcSessionManager::State::STOPPED, + arc::ArcSessionManager::Get()->state()); + base::RunLoop run_loop; + delegate()->RequestStopArcInstance( + base::BindLambdaForTesting([&run_loop](bool success) { + EXPECT_FALSE(success); + run_loop.Quit(); + })); + run_loop.Run(); +} + +// Tests ARC is running and then stopped scenario. +TEST_F(ArcDataSnapshotdDelegateTest, BasicArcActive) { + EnableArc(); + EXPECT_EQ(arc::ArcSessionManager::State::ACTIVE, + arc::ArcSessionManager::Get()->state()); + + base::RunLoop run_loop; + ExpectArcStopped(run_loop.QuitClosure()); + delegate()->RequestStopArcInstance( + base::BindLambdaForTesting([](bool success) { EXPECT_TRUE(success); })); + run_loop.Run(); +} + +// Tests ARC is running and RequestStopArcInstance is called twice before ARC is +// stopped. +// RequestDisable() is a sync way of stopping ARC, need to interfere from +// test_observer and re-enable ARC to fake this scenario. +TEST_F(ArcDataSnapshotdDelegateTest, DoubleArcStop) { + EnableArc(); + EXPECT_EQ(arc::ArcSessionManager::State::ACTIVE, + arc::ArcSessionManager::Get()->state()); + + base::RunLoop run_loop; + // Expect ARC to be stopped for the first time. + ExpectArcStopped(base::BindLambdaForTesting([&]() { + // Request ARC to be stopped for the second time. + delegate()->RequestStopArcInstance( + base::BindLambdaForTesting([&run_loop](bool success) { + // ARC is requested to be stopped for the second time. It is + // an incorrect scenario, both callbacks return failures. + EXPECT_FALSE(success); + run_loop.Quit(); + })); + })); + // Request ARC to be stooped the first time. + delegate()->RequestStopArcInstance( + base::BindLambdaForTesting([](bool success) { + // ARC is requested to be stopped twice. It is an incorrect scenario, + // both callbacks return failures. + EXPECT_FALSE(success); + })); + run_loop.Run(); +} + +} // namespace data_snapshotd +} // namespace arc
diff --git a/chrome/browser/chromeos/arc/enterprise/arc_force_installed_apps_tracker.cc b/chrome/browser/chromeos/arc/enterprise/arc_force_installed_apps_tracker.cc new file mode 100644 index 0000000..5c4daa87 --- /dev/null +++ b/chrome/browser/chromeos/arc/enterprise/arc_force_installed_apps_tracker.cc
@@ -0,0 +1,237 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/arc/enterprise/arc_force_installed_apps_tracker.h" + +#include <algorithm> +#include <vector> + +#include "base/containers/flat_map.h" +#include "base/stl_util.h" +#include "base/values.h" +#include "chrome/browser/chromeos/arc/policy/arc_policy_util.h" +#include "chrome/browser/chromeos/arc/session/arc_session_manager.h" +#include "chrome/browser/policy/profile_policy_connector.h" +#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" +#include "components/policy/core/common/policy_map.h" +#include "components/policy/core/common/policy_namespace.h" +#include "components/policy/core/common/policy_service.h" +#include "components/policy/policy_constants.h" + +namespace arc { +namespace data_snapshotd { + +namespace { + +// Gets the profile from ArcSessionManager. +Profile* GetProfile() { + auto* session_manager = ArcSessionManager::Get(); + DCHECK(session_manager); + return session_manager->profile(); +} + +} // namespace + +// This class starts observing force-installed/required ARC apps installation +// steps on creation and stops on destruction. +// It notifies back the caller via passed |update_callback| if the number of +// installed observing apps changes. +class ArcForceInstalledAppsObserver : public ArcAppListPrefs::Observer, + public policy::PolicyService::Observer { + public: + ArcForceInstalledAppsObserver( + ArcAppListPrefs* prefs, + policy::PolicyService* policy_service, + base::RepeatingCallback<void(int)> update_callback); + ArcForceInstalledAppsObserver(const ArcForceInstalledAppsObserver&) = delete; + ArcForceInstalledAppsObserver& operator=( + const ArcForceInstalledAppsObserver&) = delete; + ~ArcForceInstalledAppsObserver() override; + + // ArcAppListPrefs::Observer overrides: + void OnPackageInstalled( + const arc::mojom::ArcPackageInfo& package_info) override; + void OnPackageRemoved(const std::string& package_name, + bool uninstalled) override; + + // PolicyService::Observer overrides. + void OnPolicyUpdated(const policy::PolicyNamespace& ns, + const policy::PolicyMap& previous, + const policy::PolicyMap& current) override; + + private: + // Update the list of installed packages if the list of tracking packages is + // changed. + void UpdateInstalledPackages(); + + // Returns a [0..100] number - the percentage of installed packages among + // tracking packages. + // If there are no tracking packages, returns 100%, since no packages are + // awaited to be installed. + int CalculateInstallationProgress(); + + // Not owned singleton. Initialized in ctor. + ArcAppListPrefs* prefs_ = nullptr; + // Not owned singleton. Initialized in ctor. + policy::PolicyService* policy_service_ = nullptr; + // This callback is invoked when the number of installed tracking packages is + // changed. The floored percentage of installed tracking packages is passed to + // the callback. + base::RepeatingCallback<void(int)> update_callback_; + + // Maps tracking package names into whether the package is installed. + base::flat_map<std::string, bool> tracking_packages_; + // Number of installed packages among tracking packages. + int installed_packages_num_ = 0; +}; + +ArcForceInstalledAppsObserver::ArcForceInstalledAppsObserver( + ArcAppListPrefs* prefs, + policy::PolicyService* policy_service, + base::RepeatingCallback<void(int)> update_callback) + : prefs_(prefs), + policy_service_(policy_service), + update_callback_(std::move(update_callback)) { + DCHECK(prefs_); + DCHECK(policy_service_); + prefs_->AddObserver(this); + policy_service_->AddObserver(policy::POLICY_DOMAIN_CHROME, this); + // Initialize the tracking and installed packages lists. + const policy::PolicyNamespace policy_namespace(policy::POLICY_DOMAIN_CHROME, + std::string()); + OnPolicyUpdated(policy_namespace, policy::PolicyMap(), + policy_service_->GetPolicies(policy_namespace)); +} + +ArcForceInstalledAppsObserver::~ArcForceInstalledAppsObserver() { + prefs_->RemoveObserver(this); + policy_service_->RemoveObserver(policy::POLICY_DOMAIN_CHROME, this); +} + +void ArcForceInstalledAppsObserver::OnPackageInstalled( + const arc::mojom::ArcPackageInfo& package_info) { + auto iter = tracking_packages_.find(package_info.package_name); + if (iter == tracking_packages_.end()) { + // Installed non-required/force-installed ARC system package. + VLOG(1) << "Installed not tracking package " << package_info.package_name; + return; + } + bool& installed = iter->second; + if (!installed) { + // If installed package is among tracking packages and not yet installed, + // mark it as installed. + installed = true; + installed_packages_num_++; + update_callback_.Run(CalculateInstallationProgress()); + } +} + +void ArcForceInstalledAppsObserver::OnPackageRemoved( + const std::string& package_name, + bool uninstalled) { + auto iter = tracking_packages_.find(package_name); + if (uninstalled && iter != tracking_packages_.end() && iter->second) { + // If an installed package is removed, proceed. + iter->second = false; + installed_packages_num_--; + update_callback_.Run(CalculateInstallationProgress()); + } +} + +void ArcForceInstalledAppsObserver::OnPolicyUpdated( + const policy::PolicyNamespace& ns, + const policy::PolicyMap& previous, + const policy::PolicyMap& current) { + if (ns.domain != policy::POLICY_DOMAIN_CHROME) + return; + const base::Value* const arc_policy = + current.GetValue(policy::key::kArcPolicy); + tracking_packages_.clear(); + + // Track packages only if ArcPolicy is set. + if (arc_policy && arc_policy->is_string()) { + // Get the required packages from ArcPolicy. + auto required_packages = + arc::policy_util::GetRequestedPackagesFromArcPolicy( + arc_policy->GetString()); + std::vector<std::pair<std::string, bool>> required_packages_vector; + // Mark all required packages not yet installed in |tracking_packages_|. + std::transform( + required_packages.begin(), required_packages.end(), + std::back_inserter(required_packages_vector), + [](const std::string& v) { return std::make_pair(v, false); }); + tracking_packages_ = + base::flat_map<std::string, bool>(std::move(required_packages_vector)); + } + UpdateInstalledPackages(); +} + +void ArcForceInstalledAppsObserver::UpdateInstalledPackages() { + DCHECK(prefs_); + installed_packages_num_ = 0; + auto all_installed_packages = prefs_->GetPackagesFromPrefs(); + for (const auto& package_name : all_installed_packages) { + auto package = tracking_packages_.find(package_name); + if (package != tracking_packages_.end() && !package->second) { + // If tracking this package, mark it as installed. + package->second = true; + installed_packages_num_++; + } + } + if (!update_callback_.is_null()) + update_callback_.Run(CalculateInstallationProgress()); +} + +int ArcForceInstalledAppsObserver::CalculateInstallationProgress() { + return tracking_packages_.empty() + ? 100 + : installed_packages_num_ * 100 / tracking_packages_.size(); +} + +ArcForceInstalledAppsTracker::ArcForceInstalledAppsTracker() = default; + +ArcForceInstalledAppsTracker::~ArcForceInstalledAppsTracker() = default; + +// static +std::unique_ptr<ArcForceInstalledAppsTracker> +ArcForceInstalledAppsTracker::CreateForTesting( + ArcAppListPrefs* prefs, + policy::PolicyService* policy_service) { + return base::WrapUnique( + new ArcForceInstalledAppsTracker(prefs, policy_service)); +} + +void ArcForceInstalledAppsTracker::StartTracking( + base::RepeatingCallback<void(int)> update_callback) { + DCHECK(!observer_); + Initialize(); + observer_ = std::make_unique<ArcForceInstalledAppsObserver>( + prefs_, policy_service_, std::move(update_callback)); +} + +void ArcForceInstalledAppsTracker::StopTracking() { + observer_.reset(); +} + +ArcForceInstalledAppsTracker::ArcForceInstalledAppsTracker( + ArcAppListPrefs* prefs, + policy::PolicyService* policy_service) + : prefs_(prefs), policy_service_(policy_service) {} + +void ArcForceInstalledAppsTracker::Initialize() { + if (prefs_ && policy_service_) + return; + auto* profile = GetProfile(); + DCHECK(profile); + + prefs_ = ArcAppListPrefs::Get(profile); + + auto* profile_policy_connector = profile->GetProfilePolicyConnector(); + DCHECK(profile_policy_connector); + + policy_service_ = profile_policy_connector->policy_service(); +} + +} // namespace data_snapshotd +} // namespace arc
diff --git a/chrome/browser/chromeos/arc/enterprise/arc_force_installed_apps_tracker.h b/chrome/browser/chromeos/arc/enterprise/arc_force_installed_apps_tracker.h new file mode 100644 index 0000000..c339f05 --- /dev/null +++ b/chrome/browser/chromeos/arc/enterprise/arc_force_installed_apps_tracker.h
@@ -0,0 +1,65 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_ARC_ENTERPRISE_ARC_FORCE_INSTALLED_APPS_TRACKER_H_ +#define CHROME_BROWSER_CHROMEOS_ARC_ENTERPRISE_ARC_FORCE_INSTALLED_APPS_TRACKER_H_ + +#include <memory> +#include <string> + +#include "base/callback.h" +#include "components/arc/enterprise/arc_apps_tracker.h" + +class ArcAppListPrefs; + +namespace policy { + +class PolicyService; + +} // namespace policy + +namespace arc { +namespace data_snapshotd { + +class ArcForceInstalledAppsObserver; + +// This class tracks ARC apps that are required to be installed by ArcPolicy. +class ArcForceInstalledAppsTracker : public ArcAppsTracker { + public: + ArcForceInstalledAppsTracker(); + ArcForceInstalledAppsTracker(const ArcForceInstalledAppsTracker&) = delete; + ArcForceInstalledAppsTracker& operator=(const ArcForceInstalledAppsTracker&) = + delete; + ~ArcForceInstalledAppsTracker() override; + + // Creates instance for testing. + static std::unique_ptr<ArcForceInstalledAppsTracker> CreateForTesting( + ArcAppListPrefs* prefs, + policy::PolicyService* policy_service); + + // ArcAppsTracker overrides: + void StartTracking( + base::RepeatingCallback<void(int)> update_callback) override; + void StopTracking() override; + + private: + ArcForceInstalledAppsTracker(ArcAppListPrefs* prefs, + policy::PolicyService* policy_service); + + // Helper method to initialize |prefs_| and |policy_service_|. + void Initialize(); + + // Not owned singleton. Initialized in StartTracking. + ArcAppListPrefs* prefs_ = nullptr; + // Not owned singleton. Initialized in StartTracking. + policy::PolicyService* policy_service_ = nullptr; + + // Created/destroyed in Start/StopTracking respectively. + std::unique_ptr<ArcForceInstalledAppsObserver> observer_; +}; + +} // namespace data_snapshotd +} // namespace arc + +#endif // CHROME_BROWSER_CHROMEOS_ARC_ENTERPRISE_ARC_FORCE_INSTALLED_APPS_TRACKER_H_
diff --git a/chrome/browser/chromeos/arc/enterprise/arc_force_installed_apps_tracker_unittest.cc b/chrome/browser/chromeos/arc/enterprise/arc_force_installed_apps_tracker_unittest.cc new file mode 100644 index 0000000..20b46e1 --- /dev/null +++ b/chrome/browser/chromeos/arc/enterprise/arc_force_installed_apps_tracker_unittest.cc
@@ -0,0 +1,252 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <string> + +#include "base/barrier_closure.h" +#include "base/run_loop.h" +#include "base/test/bind.h" +#include "chrome/browser/chromeos/arc/enterprise/arc_force_installed_apps_tracker.h" +#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" +#include "chrome/browser/ui/app_list/arc/arc_app_test.h" +#include "chrome/test/base/testing_profile.h" +#include "components/policy/core/common/mock_policy_service.h" +#include "components/policy/core/common/policy_map.h" +#include "components/policy/core/common/policy_service.h" +#include "components/policy/policy_constants.h" +#include "content/public/test/browser_task_environment.h" +#include "testing/gtest/include/gtest/gtest.h" + +using testing::_; +using testing::ReturnRef; + +namespace arc { +namespace data_snapshotd { + +namespace { + +constexpr char kBasicPackageName[] = "basic.package"; +constexpr char kBasicPackageName2[] = "basic.package.2"; +constexpr char kFakePackageName[] = "fake.package"; +constexpr char kArcPolicyValue[] = + "{\"applications\":" + "[{\"packageName\":\"basic.package\"," + "\"installType\":\"FORCE_INSTALLED\"," + "}]}"; +constexpr char kArcPolicyValue2[] = + "{\"applications\":" + "[{\"packageName\":\"basic.package\"," + "\"installType\":\"FORCE_INSTALLED\"," + "}," + "{\"packageName\":\"basic.package.2\"," + "\"installType\":\"REQUIRED\"," + "}]}"; + +} // namespace + +class ArcForceInstalledAppsTrackerTest : public testing::Test { + public: + ArcForceInstalledAppsTrackerTest() = default; + ArcForceInstalledAppsTrackerTest(const ArcForceInstalledAppsTrackerTest&) = + delete; + ArcForceInstalledAppsTrackerTest& operator=( + const ArcForceInstalledAppsTrackerTest&) = delete; + + void SetUp() override { + profile_ = std::make_unique<TestingProfile>(); + arc_app_test_.SetUp(profile_.get()); + tracker_ = ArcForceInstalledAppsTracker::CreateForTesting(prefs(), + policy_service()); + } + + void TearDown() override { + arc_app_test_.TearDown(); + profile_.reset(); + policy_map_.Clear(); + tracker_.reset(); + } + + void InstallPackage(const std::string& package_name) { + auto package_info = mojom::ArcPackageInfo::New(); + package_info->package_name = package_name; + app_host()->OnPackageAdded(std::move(package_info)); + } + + void UninstallPackage(const std::string package_name) { + app_host()->OnPackageRemoved(package_name); + } + + void SetArcPolicyValue(const std::string& arc_policy_value) { + policy_map().Set(policy::key::kArcPolicy, policy::POLICY_LEVEL_MANDATORY, + policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, + base::Value(arc_policy_value), nullptr); + } + + policy::PolicyMap& policy_map() { return policy_map_; } + policy::MockPolicyService* policy_service() { return &policy_service_; } + ArcForceInstalledAppsTracker* tracker() { return tracker_.get(); } + + private: + ArcAppListPrefs* prefs() { return arc_app_test_.arc_app_list_prefs(); } + arc::mojom::AppHost* const app_host() { return prefs(); } + + content::BrowserTaskEnvironment task_environment_; + std::unique_ptr<TestingProfile> profile_; + ArcAppTest arc_app_test_; + policy::MockPolicyService policy_service_; + std::unique_ptr<ArcForceInstalledAppsTracker> tracker_; + policy::PolicyMap policy_map_; +}; + +TEST_F(ArcForceInstalledAppsTrackerTest, InvalidUpdateCallback) { + EXPECT_CALL(*policy_service(), AddObserver(_, _)); + EXPECT_CALL(*policy_service(), GetPolicies(_)) + .WillOnce(ReturnRef(policy_map())); + tracker()->StartTracking(base::NullCallback()); + + EXPECT_CALL(*policy_service(), RemoveObserver(_, _)); + tracker()->StopTracking(); +} + +TEST_F(ArcForceInstalledAppsTrackerTest, EmptyPolicy) { + EXPECT_CALL(*policy_service(), AddObserver(_, _)); + EXPECT_CALL(*policy_service(), GetPolicies(_)) + .WillOnce(ReturnRef(policy_map())); + base::RunLoop run_loop; + tracker()->StartTracking(base::BindLambdaForTesting([&run_loop](int percent) { + // All tracking apps are installed. + EXPECT_EQ(100, percent); + run_loop.Quit(); + })); + run_loop.Run(); + + EXPECT_CALL(*policy_service(), RemoveObserver(_, _)); + tracker()->StopTracking(); +} + +TEST_F(ArcForceInstalledAppsTrackerTest, Basic) { + SetArcPolicyValue(kArcPolicyValue2); + EXPECT_CALL(*policy_service(), AddObserver(_, _)); + EXPECT_CALL(*policy_service(), GetPolicies(_)) + .WillOnce(ReturnRef(policy_map())); + base::RunLoop run_loop; + base::RepeatingClosure closure = + base::BarrierClosure(3, run_loop.QuitClosure()); + int package_number = 0; + tracker()->StartTracking( + base::BindLambdaForTesting([&closure, &package_number](int percent) { + EXPECT_EQ(package_number * 50, percent); + package_number++; + closure.Run(); + })); + + // Install not required package. + InstallPackage(kFakePackageName); + // Install 2 required packages. + InstallPackage(kBasicPackageName); + InstallPackage(kBasicPackageName2); + + run_loop.Run(); + + EXPECT_CALL(*policy_service(), RemoveObserver(_, _)); + tracker()->StopTracking(); +} + +TEST_F(ArcForceInstalledAppsTrackerTest, AlreadyInstalledPackages) { + InstallPackage(kBasicPackageName); + + SetArcPolicyValue(kArcPolicyValue2); + EXPECT_CALL(*policy_service(), AddObserver(_, _)); + EXPECT_CALL(*policy_service(), GetPolicies(_)) + .WillOnce(ReturnRef(policy_map())); + + base::RunLoop run_loop; + base::RepeatingClosure closure = + base::BarrierClosure(2, run_loop.QuitClosure()); + int package_number = 1; + tracker()->StartTracking( + base::BindLambdaForTesting([&closure, &package_number](int percent) { + EXPECT_EQ(package_number * 50, percent); + package_number++; + closure.Run(); + })); + + InstallPackage(kBasicPackageName2); + + run_loop.Run(); + + EXPECT_CALL(*policy_service(), RemoveObserver(_, _)); + tracker()->StopTracking(); +} + +// Tests the case when tracking packages list changes. +TEST_F(ArcForceInstalledAppsTrackerTest, OnPolicyUpdated) { + SetArcPolicyValue(kArcPolicyValue2); + policy::PolicyService::Observer* observer = nullptr; + EXPECT_CALL(*policy_service(), AddObserver(_, _)) + .WillOnce(testing::SaveArg<1>(&observer)); + EXPECT_CALL(*policy_service(), GetPolicies(_)) + .WillRepeatedly(ReturnRef(policy_map())); + base::RunLoop run_loop; + base::RepeatingClosure closure = + base::BarrierClosure(4, run_loop.QuitClosure()); + int package_number = 0; + int max_package_number = 2; + tracker()->StartTracking(base::BindLambdaForTesting( + [&closure, &package_number, &max_package_number](int percent) { + EXPECT_EQ(package_number * 100 / max_package_number, percent); + package_number++; + closure.Run(); + })); + + InstallPackage(kBasicPackageName2); + + SetArcPolicyValue(kArcPolicyValue); + package_number = 0; + max_package_number = 1; + EXPECT_TRUE(observer); + + const policy::PolicyNamespace policy_namespace(policy::POLICY_DOMAIN_CHROME, + std::string()); + observer->OnPolicyUpdated(policy_namespace, policy::PolicyMap(), + policy_service()->GetPolicies(policy_namespace)); + + InstallPackage(kBasicPackageName); + + run_loop.Run(); + + EXPECT_CALL(*policy_service(), RemoveObserver(_, _)); + tracker()->StopTracking(); +} + +// Tests the uninstall tracking package scenario. +TEST_F(ArcForceInstalledAppsTrackerTest, UninstalledPackages) { + SetArcPolicyValue(kArcPolicyValue); + EXPECT_CALL(*policy_service(), AddObserver(_, _)); + EXPECT_CALL(*policy_service(), GetPolicies(_)) + .WillOnce(ReturnRef(policy_map())); + base::RunLoop run_loop; + base::RepeatingClosure closure = + base::BarrierClosure(4, run_loop.QuitClosure()); + int package_number = 0; + tracker()->StartTracking( + base::BindLambdaForTesting([&closure, &package_number](int percent) { + EXPECT_EQ(package_number * 100, percent); + package_number++; + closure.Run(); + })); + + InstallPackage(kBasicPackageName); + package_number = 0; + UninstallPackage(kBasicPackageName); + package_number = 1; + InstallPackage(kBasicPackageName); + run_loop.Run(); + + EXPECT_CALL(*policy_service(), RemoveObserver(_, _)); + tracker()->StopTracking(); +} + +} // namespace data_snapshotd +} // namespace arc
diff --git a/chrome/browser/chromeos/arc/policy/arc_policy_bridge.cc b/chrome/browser/chromeos/arc/policy/arc_policy_bridge.cc index 4b0aee42..100215c 100644 --- a/chrome/browser/chromeos/arc/policy/arc_policy_bridge.cc +++ b/chrome/browser/chromeos/arc/policy/arc_policy_bridge.cc
@@ -626,8 +626,8 @@ if (!sign_in_start_time.is_null()) { UpdateFirstComplianceSinceSignInTiming(now - sign_in_start_time); } else { - UpdateFirstComplianceSinceStartupTiming( - now - session_manager->arc_start_time()); + UpdateFirstComplianceSinceStartupTiming(now - + session_manager->start_time()); } first_compliance_timing_reported_ = true; }
diff --git a/chrome/browser/chromeos/arc/session/arc_session_manager.cc b/chrome/browser/chromeos/arc/session/arc_session_manager.cc index 9f59000c..4166ad0 100644 --- a/chrome/browser/chromeos/arc/session/arc_session_manager.cc +++ b/chrome/browser/chromeos/arc/session/arc_session_manager.cc
@@ -901,6 +901,8 @@ } void ArcSessionManager::ResetArcState() { + pre_start_time_ = base::TimeTicks(); + start_time_ = base::TimeTicks(); arc_sign_in_timer_.Stop(); playstore_launcher_.reset(); terms_of_service_negotiator_.reset(); @@ -1050,7 +1052,6 @@ const bool start_arc_directly = signed_in || ShouldArcAlwaysStart() || IsRobotOrOfflineDemoAccountMode() || IsArcOptInVerificationDisabled(); - // When ARC is blocked because of filesystem compatibility, do not proceed // to starting ARC nor follow further state transitions. if (IsArcBlockedDueToIncompatibleFileSystem(profile_)) { @@ -1218,6 +1219,10 @@ profile_->GetPrefs(), support_host_.get()); } + // Start the mini-container here to save time starting the container if the + // user decides to opt-in. + StartMiniArc(); + if (!terms_of_service_negotiator_) { // The only case reached here is when g_ui_enabled is false so // 1. ARC support host is not created in SetProfile(), and @@ -1234,10 +1239,6 @@ return; } - // Start the mini-container here to save time starting the container if the - // user decides to opt-in. - arc_session_runner_->RequestStartMiniInstance(); - terms_of_service_negotiator_->StartNegotiation( base::BindOnce(&ArcSessionManager::OnTermsOfServiceNegotiated, weak_ptr_factory_.GetWeakPtr())); @@ -1386,7 +1387,10 @@ for (auto& observer : observer_list_) observer.OnArcStarted(); - arc_start_time_ = base::TimeTicks::Now(); + start_time_ = base::TimeTicks::Now(); + // In case ARC started without mini-ARC |pre_start_time_| is not set. + if (pre_start_time_.is_null()) + pre_start_time_ = start_time_; provisioning_reported_ = false; std::string locale; @@ -1515,6 +1519,11 @@ weak_ptr_factory_.GetWeakPtr())); } +void ArcSessionManager::StartMiniArc() { + pre_start_time_ = base::TimeTicks::Now(); + arc_session_runner_->RequestStartMiniInstance(); +} + void ArcSessionManager::OnWindowClosed() { CancelAuthCode(); } @@ -1599,7 +1608,7 @@ if (!IsArcAvailable()) return; - arc_session_runner_->RequestStartMiniInstance(); + StartMiniArc(); } void ArcSessionManager::ExpandPropertyFilesAndReadSalt() {
diff --git a/chrome/browser/chromeos/arc/session/arc_session_manager.h b/chrome/browser/chromeos/arc/session/arc_session_manager.h index 61dc6c7..dc983d7 100644 --- a/chrome/browser/chromeos/arc/session/arc_session_manager.h +++ b/chrome/browser/chromeos/arc/session/arc_session_manager.h
@@ -222,14 +222,18 @@ // A helper function that calls ArcSessionRunner's SetUserInfo. void SetUserInfo(); + // Returns the time when ARC was pre-started (mini-ARC start), or a null time + // if ARC has not been pre-started yet. + base::TimeTicks pre_start_time() const { return pre_start_time_; } + + // Returns the time when ARC was about to start, or a null time if ARC has + // not been started yet. + base::TimeTicks start_time() const { return start_time_; } + // Returns the time when the sign in process started, or a null time if // signing in didn't happen during this session. base::TimeTicks sign_in_start_time() const { return sign_in_start_time_; } - // Returns the time when ARC was about to start, or a null time if ARC has not - // been started yet. - base::TimeTicks arc_start_time() const { return arc_start_time_; } - // Returns true if ARC requested to start. bool enable_requested() const { return enable_requested_; } @@ -376,6 +380,9 @@ // successfully. void MaybeStartTimer(); + // Starts mini-ARC and updates related information. + void StartMiniArc(); + // Requests the support host (if it exists) to show the error, and notifies // the observers. void ShowArcSupportHostError(ArcSupportHost::Error error, @@ -423,8 +430,11 @@ // The time when the sign in process started. base::TimeTicks sign_in_start_time_; + // The time when ARC was pre-started (mini-ARC start). + base::TimeTicks pre_start_time_; // The time when ARC was about to start. - base::TimeTicks arc_start_time_; + base::TimeTicks start_time_; + base::RepeatingClosure attempt_user_exit_callback_; ArcAppIdProviderImpl app_id_provider_;
diff --git a/chrome/browser/chromeos/arc/session/arc_session_manager_unittest.cc b/chrome/browser/chromeos/arc/session/arc_session_manager_unittest.cc index 67c1d045..0db5b86 100644 --- a/chrome/browser/chromeos/arc/session/arc_session_manager_unittest.cc +++ b/chrome/browser/chromeos/arc/session/arc_session_manager_unittest.cc
@@ -368,19 +368,32 @@ TEST_F(ArcSessionManagerTest, BaseWorkflow) { EXPECT_TRUE(arc_session_manager()->sign_in_start_time().is_null()); - EXPECT_TRUE(arc_session_manager()->arc_start_time().is_null()); + EXPECT_TRUE(arc_session_manager()->pre_start_time().is_null()); + EXPECT_TRUE(arc_session_manager()->start_time().is_null()); arc_session_manager()->SetProfile(profile()); arc_session_manager()->Initialize(); // By default ARC is not enabled. EXPECT_EQ(ArcSessionManager::State::STOPPED, arc_session_manager()->state()); + EXPECT_TRUE(arc_session_manager()->pre_start_time().is_null()); + EXPECT_TRUE(arc_session_manager()->start_time().is_null()); + + const base::TimeTicks enabled_time = base::TimeTicks::Now(); // Enables ARC. First time, ToS negotiation should start. arc_session_manager()->RequestEnable(); base::RunLoop().RunUntilIdle(); ASSERT_EQ(ArcSessionManager::State::NEGOTIATING_TERMS_OF_SERVICE, arc_session_manager()->state()); + const base::TimeTicks after_enabled_time = base::TimeTicks::Now(); + + const base::TimeTicks pre_start_time = + arc_session_manager()->pre_start_time(); + EXPECT_FALSE(pre_start_time.is_null()); + EXPECT_GE(pre_start_time, enabled_time); + EXPECT_GE(after_enabled_time, pre_start_time); + EXPECT_TRUE(arc_session_manager()->start_time().is_null()); arc_session_manager()->OnTermsOfServiceNegotiatedForTesting(true); ASSERT_EQ(ArcSessionManager::State::CHECKING_ANDROID_MANAGEMENT, @@ -388,12 +401,17 @@ EXPECT_TRUE(arc_session_manager()->sign_in_start_time().is_null()); arc_session_manager()->StartArcForTesting(); + const base::TimeTicks start_time = arc_session_manager()->start_time(); EXPECT_FALSE(arc_session_manager()->sign_in_start_time().is_null()); - EXPECT_FALSE(arc_session_manager()->arc_start_time().is_null()); - + EXPECT_EQ(pre_start_time, arc_session_manager()->pre_start_time()); + EXPECT_FALSE(start_time.is_null()); + EXPECT_GE(start_time, after_enabled_time); ASSERT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state()); arc_session_manager()->Shutdown(); + + EXPECT_TRUE(arc_session_manager()->pre_start_time().is_null()); + EXPECT_TRUE(arc_session_manager()->start_time().is_null()); } // Tests that tying to enable ARC++ with an incompatible file system fails and @@ -557,7 +575,8 @@ PrefService* const prefs = profile()->GetPrefs(); EXPECT_TRUE(arc_session_manager()->sign_in_start_time().is_null()); - EXPECT_TRUE(arc_session_manager()->arc_start_time().is_null()); + EXPECT_TRUE(arc_session_manager()->pre_start_time().is_null()); + EXPECT_TRUE(arc_session_manager()->start_time().is_null()); EXPECT_FALSE(arc_session_manager()->IsPlaystoreLaunchRequestedForTesting()); ASSERT_FALSE(prefs->GetBoolean(prefs::kArcSignedIn)); @@ -579,7 +598,8 @@ // Here, provisining is not yet completed, so kArcSignedIn should be false. EXPECT_FALSE(prefs->GetBoolean(prefs::kArcSignedIn)); - EXPECT_FALSE(arc_session_manager()->arc_start_time().is_null()); + EXPECT_FALSE(arc_session_manager()->pre_start_time().is_null()); + EXPECT_FALSE(arc_session_manager()->start_time().is_null()); EXPECT_FALSE(arc_session_manager()->IsPlaystoreLaunchRequestedForTesting()); // Emulate successful provisioning. @@ -1138,7 +1158,8 @@ TEST_F(ArcSessionManagerArcAlwaysStartTest, BaseWorkflow) { // TODO(victorhsieh): Consider also tracking sign-in activity, which is // initiated from the Android side. - EXPECT_TRUE(arc_session_manager()->arc_start_time().is_null()); + EXPECT_TRUE(arc_session_manager()->pre_start_time().is_null()); + EXPECT_TRUE(arc_session_manager()->start_time().is_null()); arc_session_manager()->SetProfile(profile()); arc_session_manager()->Initialize(); @@ -1151,7 +1172,8 @@ arc_session_manager()->RequestEnable(); base::RunLoop().RunUntilIdle(); ASSERT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state()); - EXPECT_FALSE(arc_session_manager()->arc_start_time().is_null()); + EXPECT_FALSE(arc_session_manager()->pre_start_time().is_null()); + EXPECT_FALSE(arc_session_manager()->start_time().is_null()); arc_session_manager()->Shutdown(); }
diff --git a/chrome/browser/chromeos/borealis/borealis_installer_impl.cc b/chrome/browser/chromeos/borealis/borealis_installer_impl.cc index 218015f..3631d17a 100644 --- a/chrome/browser/chromeos/borealis/borealis_installer_impl.cc +++ b/chrome/browser/chromeos/borealis/borealis_installer_impl.cc
@@ -12,6 +12,7 @@ #include "chrome/browser/profiles/profile.h" #include "components/prefs/pref_service.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/network_service_instance.h" namespace borealis { @@ -41,6 +42,12 @@ InstallationEnded(BorealisInstallResult::kBorealisInstallInProgress); return; } + + if (content::GetNetworkConnectionTracker()->IsOffline()) { + InstallationEnded(BorealisInstallResult::kOffline); + return; + } + installation_start_tick_ = base::TimeTicks::Now(); progress_ = 0;
diff --git a/chrome/browser/chromeos/borealis/borealis_installer_unittest.cc b/chrome/browser/chromeos/borealis/borealis_installer_unittest.cc index 4df5886..5bf2f22 100644 --- a/chrome/browser/chromeos/borealis/borealis_installer_unittest.cc +++ b/chrome/browser/chromeos/borealis/borealis_installer_unittest.cc
@@ -19,7 +19,9 @@ #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/dlcservice/fake_dlcservice_client.h" #include "components/prefs/pref_service.h" +#include "content/public/browser/network_service_instance.h" #include "content/public/test/browser_task_environment.h" +#include "services/network/test/test_network_connection_tracker.h" #include "testing/gmock/include/gmock/gmock.h" namespace borealis { @@ -147,6 +149,23 @@ BorealisService::GetForProfile(profile_.get())->Features().IsEnabled()); } +TEST_F(BorealisInstallerTest, DeviceOfflineInstallationFails) { + feature_list_.InitAndEnableFeature(features::kBorealis); + std::unique_ptr<network::TestNetworkConnectionTracker> + network_connection_tracker = + network::TestNetworkConnectionTracker::CreateInstance(); + network::TestNetworkConnectionTracker::GetInstance()->SetConnectionType( + network::mojom::ConnectionType::CONNECTION_NONE); + + EXPECT_CALL(*observer_, OnInstallationEnded(BorealisInstallResult::kOffline)); + + StartAndRunToCompletion(); + UpdateCurrentDlcs(); + ASSERT_EQ(current_dlcs_.dlc_infos_size(), 0); + EXPECT_FALSE( + BorealisService::GetForProfile(profile_.get())->Features().IsEnabled()); +} + TEST_F(BorealisInstallerTest, SucessfulInstallation) { feature_list_.InitAndEnableFeature(features::kBorealis); fake_dlcservice_client_->set_install_error(dlcservice::kErrorNone);
diff --git a/chrome/browser/chromeos/borealis/borealis_metrics.h b/chrome/browser/chromeos/borealis/borealis_metrics.h index 4d7af54..b3549fb 100644 --- a/chrome/browser/chromeos/borealis/borealis_metrics.h +++ b/chrome/browser/chromeos/borealis/borealis_metrics.h
@@ -29,7 +29,8 @@ kDlcNeedRebootError = 7, kDlcNeedSpaceError = 8, kDlcUnknownError = 9, - kMaxValue = kDlcUnknownError, + kOffline = 10, + kMaxValue = kOffline, }; // These values are persisted to logs. Entries should not be renumbered and
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index 74d7672..1dcd5f3 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -42,6 +42,8 @@ #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" #include "chrome/browser/chromeos/app_mode/kiosk_mode_idle_app_name_notification.h" #include "chrome/browser/chromeos/app_mode/web_app/web_kiosk_app_manager.h" +#include "chrome/browser/chromeos/arc/enterprise/arc_data_snapshotd_delegate.h" +#include "chrome/browser/chromeos/arc/enterprise/arc_force_installed_apps_tracker.h" #include "chrome/browser/chromeos/arc/session/arc_service_launcher.h" #include "chrome/browser/chromeos/boot_times_recorder.h" #include "chrome/browser/chromeos/crosapi/browser_manager.h" @@ -686,6 +688,8 @@ arc_data_snapshotd_manager_ = std::make_unique<arc::data_snapshotd::ArcDataSnapshotdManager>( g_browser_process->local_state(), + std::make_unique<arc::data_snapshotd::ArcDataSnapshotdDelegate>(), + std::make_unique<arc::data_snapshotd::ArcForceInstalledAppsTracker>(), base::BindOnce(chrome::AttemptUserExit)); if (base::FeatureList::IsEnabled(::features::kWilcoDtc)) wilco_dtc_supportd_manager_ = std::make_unique<WilcoDtcSupportdManager>();
diff --git a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc index 2ef65ae..e88725a 100644 --- a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc +++ b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc
@@ -1520,10 +1520,9 @@ if (!arc_session_manager) return RespondNow(Error("Could not find ARC session manager")); - double start_time = - (arc_session_manager->arc_start_time() - base::TimeTicks()) - .InMillisecondsF(); - return RespondNow(OneArgument(base::Value(start_time))); + const double start_ticks = + (arc_session_manager->start_time() - base::TimeTicks()).InMillisecondsF(); + return RespondNow(OneArgument(base::Value(start_ticks))); } /////////////////////////////////////////////////////////////////////////////// @@ -1542,8 +1541,26 @@ if (!arc::IsArcAllowedForProfile(profile)) return RespondNow(Error("ARC is not available for the current user")); + arc::ArcSessionManager* const arc_session_manager = + arc::ArcSessionManager::Get(); + if (!arc_session_manager) + return RespondNow(Error("Could not find ARC session manager")); + + const base::Time now_time = base::Time::Now(); + const base::TimeTicks now_ticks = base::TimeTicks::Now(); + const base::TimeTicks pre_start_time = arc_session_manager->pre_start_time(); + const base::TimeTicks start_time = arc_session_manager->start_time(); + arc_state.provisioned = arc::IsArcProvisioned(profile); arc_state.tos_needed = arc::IsArcTermsOfServiceNegotiationNeeded(profile); + arc_state.pre_start_time = + pre_start_time.is_null() + ? 0 + : (now_time - (now_ticks - pre_start_time)).ToJsTime(); + arc_state.start_time = start_time.is_null() + ? 0 + : (now_time - (now_ticks - start_time)).ToJsTime(); + return RespondNow( OneArgument(base::Value::FromUniquePtrValue(arc_state.ToValue()))); }
diff --git a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_apitest.cc b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_apitest.cc index dba5c17..9bda32dc 100644 --- a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_apitest.cc +++ b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_apitest.cc
@@ -89,11 +89,15 @@ ArcAppListPrefs* const prefs = ArcAppListPrefs::Get(browser()->profile()); ASSERT_TRUE(prefs); + // Having ARC Terms accepted automatically bypasses TOS stage. + // Set it before |arc::SetArcPlayStoreEnabledForProfile| + browser()->profile()->GetPrefs()->SetBoolean(arc::prefs::kArcTermsAccepted, + true); arc::SetArcPlayStoreEnabledForProfile(profile(), true); // Provisioning is completed. browser()->profile()->GetPrefs()->SetBoolean(arc::prefs::kArcSignedIn, true); - browser()->profile()->GetPrefs()->SetBoolean(arc::prefs::kArcTermsAccepted, - true); + // Start ARC + arc::ArcSessionManager::Get()->StartArcForTesting(); std::unique_ptr<arc::FakeAppInstance> app_instance; app_instance.reset(new arc::FakeAppInstance(prefs));
diff --git a/chrome/browser/chromeos/file_manager/file_manager_jstest.cc b/chrome/browser/chromeos/file_manager/file_manager_jstest.cc index 4eaf6ab..dcd15cc 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_jstest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_jstest.cc
@@ -34,7 +34,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ContentMetadataProvider) { RunTestURL( - "foreground/js/metadata/content_metadata_provider_unittest_gen.html"); + "foreground/js/metadata/content_metadata_provider_unittest.m_gen.html"); } IN_PROC_BROWSER_TEST_F(FileManagerJsTest, Crostini) { @@ -193,11 +193,11 @@ } IN_PROC_BROWSER_TEST_F(FileManagerJsTest, MetadataCacheSet) { - RunTestURL("foreground/js/metadata/metadata_cache_set_unittest_gen.html"); + RunTestURL("foreground/js/metadata/metadata_cache_set_unittest.m_gen.html"); } IN_PROC_BROWSER_TEST_F(FileManagerJsTest, MetadataModel) { - RunTestURL("foreground/js/metadata/metadata_model_unittest_gen.html"); + RunTestURL("foreground/js/metadata/metadata_model_unittest.m_gen.html"); } IN_PROC_BROWSER_TEST_F(FileManagerJsTest, MetadataProxyTest) { @@ -214,7 +214,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, MultiMetadataProvider) { RunTestURL( - "foreground/js/metadata/multi_metadata_provider_unittest_gen.html"); + "foreground/js/metadata/multi_metadata_provider_unittest.m_gen.html"); } IN_PROC_BROWSER_TEST_F(FileManagerJsTest, NavigationListModelTest) { @@ -242,7 +242,7 @@ } IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ThumbnailLoader) { - RunTestURL("foreground/js/thumbnail_loader_unittest_gen.html"); + RunTestURL("foreground/js/thumbnail_loader_unittest.m_gen.html"); } IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ThumbnailModel) {
diff --git a/chrome/browser/chromeos/login/app_mode/kiosk_browsertest.cc b/chrome/browser/chromeos/login/app_mode/kiosk_browsertest.cc index 14ceb350..61f886d9 100644 --- a/chrome/browser/chromeos/login/app_mode/kiosk_browsertest.cc +++ b/chrome/browser/chromeos/login/app_mode/kiosk_browsertest.cc
@@ -835,6 +835,10 @@ } } + void WaitForAuthLaunchWarning(bool visibility) { + test::OobeJS().CreateVisibilityWaiter(visibility, {"autolaunch"})->Wait(); + } + MockUserManager* mock_user_manager() { return mock_user_manager_.get(); } void set_test_app_id(const std::string& test_app_id) { @@ -1146,18 +1150,12 @@ wizard_controller->SkipToLoginForTesting(); // Wait for the auto launch warning come up. - content::WindowedNotificationObserver( - chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, - content::NotificationService::AllSources()) - .Wait(); + WaitForAuthLaunchWarning(/*visibility=*/true); GetLoginUI()->CallJavascriptFunctionUnsafe( "login.AutolaunchScreen.confirmAutoLaunchForTesting", base::Value(false)); // Wait for the auto launch warning to go away. - content::WindowedNotificationObserver( - chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, - content::NotificationService::AllSources()) - .Wait(); + WaitForAuthLaunchWarning(/*visibility=*/false); EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); } @@ -1179,18 +1177,13 @@ wizard_controller->SkipToLoginForTesting(); // Wait for the auto launch warning come up. - content::WindowedNotificationObserver( - chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, - content::NotificationService::AllSources()) - .Wait(); + WaitForAuthLaunchWarning(/*visibility=*/true); + GetLoginUI()->CallJavascriptFunctionUnsafe( "login.AutolaunchScreen.confirmAutoLaunchForTesting", base::Value(true)); // Wait for the auto launch warning to go away. - content::WindowedNotificationObserver( - chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, - content::NotificationService::AllSources()) - .Wait(); + WaitForAuthLaunchWarning(/*visibility=*/false); EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); EXPECT_TRUE(KioskAppManager::Get()->IsAutoLaunchEnabled()); @@ -1341,10 +1334,7 @@ wizard_controller->AdvanceToScreen(WelcomeView::kScreenId); ReloadAutolaunchKioskApps(); wizard_controller->SkipToLoginForTesting(); - content::WindowedNotificationObserver( - chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, - content::NotificationService::AllSources()) - .Wait(); + WaitForAuthLaunchWarning(/*visibility=*/true); GetLoginUI()->CallJavascriptFunctionUnsafe( "login.AutolaunchScreen.confirmAutoLaunchForTesting", base::Value(true)); @@ -2828,10 +2818,7 @@ EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); // Wait for the auto launch warning come up. - content::WindowedNotificationObserver( - chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, - content::NotificationService::AllSources()) - .Wait(); + WaitForAuthLaunchWarning(/*visibility=*/true); // Wait for the wallpaper to load. WaitForWallpaper();
diff --git a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc index af0b447..9a68f33 100644 --- a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc +++ b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc
@@ -22,6 +22,8 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/timer/timer.h" #include "chrome/browser/chrome_notification_types.h" +#include "chrome/browser/chromeos/arc/arc_util.h" +#include "chrome/browser/chromeos/arc/session/arc_session_manager.h" #include "chrome/browser/chromeos/authpolicy/authpolicy_credentials_manager.h" #include "chrome/browser/chromeos/login/existing_user_controller.h" #include "chrome/browser/chromeos/login/help_app_launcher.h" @@ -47,6 +49,7 @@ #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.h" @@ -65,6 +68,7 @@ #include "chromeos/settings/cros_settings_names.h" #include "chromeos/settings/cros_settings_provider.h" #include "chromeos/strings/grit/chromeos_strings.h" +#include "components/arc/arc_util.h" #include "components/arc/enterprise/arc_data_snapshotd_manager.h" #include "components/password_manager/core/common/password_manager_pref_names.h" #include "components/policy/core/common/cloud/cloud_policy_constants.h" @@ -158,6 +162,17 @@ return path.Append("kerberos").Append("krb5cc"); } +void EnableArcForProfile(Profile* profile) { + arc::SetArcAvailableCommandLineForTesting( + base::CommandLine::ForCurrentProcess()); + arc::ResetArcAllowedCheckForTesting(profile); + arc::SetArcPlayStoreEnabledForProfile(profile, true); + + ArcAppListPrefsFactory::GetInstance()->RecreateServiceInstanceForTesting( + profile); + arc::ArcSessionManager::Get()->SetProfile(profile); +} + arc::data_snapshotd::ArcDataSnapshotdManager* arc_data_snapshotd_manager() { return arc::data_snapshotd::ArcDataSnapshotdManager::Get(); } @@ -763,6 +778,10 @@ // Start auto-login and wait for login tasks to complete. content::RunAllPendingInMessageLoop(); + // Setup profile before changing the state. + EXPECT_TRUE(user_manager::UserManager::Get()->IsLoggedInAsPublicAccount()); + EnableArcForProfile(ProfileManager::GetActiveUserProfile()); + arc_data_snapshotd_manager()->OnSessionStateChanged(); EXPECT_TRUE(auto_login_account_id().is_valid());
diff --git a/chrome/browser/chromeos/login/screens/mock_eula_screen.h b/chrome/browser/chromeos/login/screens/mock_eula_screen.h index 3727d9d..76ad017 100644 --- a/chrome/browser/chromeos/login/screens/mock_eula_screen.h +++ b/chrome/browser/chromeos/login/screens/mock_eula_screen.h
@@ -30,14 +30,14 @@ void Bind(EulaScreen* screen) override; void Unbind() override; - MOCK_METHOD(void, Show, ()); - MOCK_METHOD(void, Hide, ()); + MOCK_METHOD(void, Show, (), (override)); + MOCK_METHOD(void, Hide, (), (override)); MOCK_METHOD(void, MockBind, (EulaScreen * screen)); MOCK_METHOD(void, MockUnbind, ()); - MOCK_METHOD(void, ShowStatsUsageLearnMore, ()); - MOCK_METHOD(void, ShowAdditionalTosDialog, ()); - MOCK_METHOD(void, ShowSecuritySettingsDialog, ()); + MOCK_METHOD(void, ShowStatsUsageLearnMore, (), (override)); + MOCK_METHOD(void, ShowAdditionalTosDialog, (), (override)); + MOCK_METHOD(void, ShowSecuritySettingsDialog, (), (override)); private: EulaScreen* screen_ = nullptr;
diff --git a/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc b/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc index 3f6ceca..f438ea8 100644 --- a/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc +++ b/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc
@@ -63,6 +63,7 @@ #include "extensions/browser/process_manager.h" #include "extensions/test/extension_test_message_listener.h" #include "extensions/test/result_catcher.h" +#include "google_apis/gaia/gaia_auth_util.h" #include "net/cookies/canonical_cookie.h" #include "net/test/embedded_test_server/http_request.h" #include "net/test/embedded_test_server/http_response.h" @@ -302,29 +303,30 @@ void LoginAsExistingUser() { // PickAccountId does not work at this point as the primary user profile has // not yet been created. - const std::string email = kTestEmail; - EXPECT_EQ(GetOAuthStatusFromLocalState(email), + EXPECT_EQ(GetOAuthStatusFromLocalState(kTestEmail), user_manager::User::OAUTH2_TOKEN_STATUS_VALID); // Try login. Primary profile has changed. - ash::LoginScreenTestApi::SubmitPassword( - AccountId::FromUserEmailGaiaId(kTestEmail, kTestGaiaId), - kTestAccountPassword, true /*check_if_submittable */); + AccountId account_id = + AccountId::FromUserEmailGaiaId(kTestEmail, kTestGaiaId); + ash::LoginScreenTestApi::SubmitPassword(account_id, kTestAccountPassword, + true /*check_if_submittable */); test::WaitForPrimaryUserSessionStart(); Profile* profile = ProfileManager::GetPrimaryUserProfile(); - CoreAccountId account_id = PickAccountId(profile, kTestGaiaId, kTestEmail); - ASSERT_EQ(email, account_id.ToString()); // Wait for the session merge to finish. WaitForMergeSessionCompletion(OAuth2LoginManager::SESSION_RESTORE_DONE); + EXPECT_EQ(GetOAuthStatusFromLocalState(kTestEmail), + user_manager::User::OAUTH2_TOKEN_STATUS_VALID); - // Check for existence of refresh token. + // Check for existence of the primary account and its refresh token. signin::IdentityManager* identity_manager = IdentityManagerFactory::GetForProfile(profile); - EXPECT_TRUE(identity_manager->HasAccountWithRefreshToken(account_id)); - - EXPECT_EQ(GetOAuthStatusFromLocalState(account_id.ToString()), - user_manager::User::OAUTH2_TOKEN_STATUS_VALID); + CoreAccountInfo primary_account = identity_manager->GetPrimaryAccountInfo(); + EXPECT_TRUE(gaia::AreEmailsSame(kTestEmail, primary_account.email)); + EXPECT_EQ(kTestGaiaId, primary_account.gaia); + EXPECT_TRUE(identity_manager->HasAccountWithRefreshToken( + primary_account.account_id)); } bool TryToLogin(const AccountId& account_id, const std::string& password) { @@ -340,14 +342,14 @@ } user_manager::User::OAuthTokenStatus GetOAuthStatusFromLocalState( - const std::string& account_id) const { + const std::string& email) const { PrefService* local_state = g_browser_process->local_state(); const base::DictionaryValue* prefs_oauth_status = local_state->GetDictionary("OAuthTokenStatus"); int oauth_token_status = user_manager::User::OAUTH_TOKEN_STATUS_UNKNOWN; if (prefs_oauth_status && prefs_oauth_status->GetIntegerWithoutPathExpansion( - account_id, &oauth_token_status)) { + email, &oauth_token_status)) { user_manager::User::OAuthTokenStatus result = static_cast<user_manager::User::OAuthTokenStatus>(oauth_token_status); return result; @@ -517,7 +519,7 @@ IdentityManagerFactory::GetForProfile(GetProfile()); EXPECT_TRUE(identity_manager->HasAccountWithRefreshToken(account_id)); - EXPECT_EQ(GetOAuthStatusFromLocalState(account_id.ToString()), + EXPECT_EQ(GetOAuthStatusFromLocalState(kTestEmail), user_manager::User::OAUTH2_TOKEN_STATUS_VALID); CookieReader cookie_reader; cookie_reader.ReadCookies(GetProfile()); @@ -566,21 +568,20 @@ // PickAccountId does not work at this point as the primary user profile has // not yet been created. - const std::string account_id = kTestEmail; - EXPECT_EQ(GetOAuthStatusFromLocalState(account_id), + EXPECT_EQ(GetOAuthStatusFromLocalState(kTestEmail), user_manager::User::OAUTH2_TOKEN_STATUS_VALID); EXPECT_TRUE( TryToLogin(AccountId::FromUserEmailGaiaId(kTestEmail, kTestGaiaId), kTestAccountPassword)); - ASSERT_EQ(account_id, + ASSERT_EQ(kTestGaiaId, PickAccountId(GetProfile(), kTestGaiaId, kTestEmail).ToString()); // Wait for the session merge to finish. - WaitForMergeSessionCompletion(OAuth2LoginManager::SESSION_RESTORE_FAILED); + WaitForMergeSessionCompletion(OAuth2LoginManager::SESSION_RESTORE_DONE); - EXPECT_EQ(GetOAuthStatusFromLocalState(account_id), + EXPECT_EQ(GetOAuthStatusFromLocalState(kTestEmail), user_manager::User::OAUTH2_TOKEN_STATUS_INVALID); }
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_factory.cc b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_factory.cc index 1d906d0..90dbb31 100644 --- a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_factory.cc +++ b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_factory.cc
@@ -53,7 +53,6 @@ return new KeyPermissionsServiceImpl( ProfileHelper::IsRegularProfile(profile), profile->GetProfilePolicyConnector()->IsManaged(), profile->GetPrefs(), - profile->GetProfilePolicyConnector()->policy_service(), extensions::ExtensionSystem::Get(profile)->state_store(), PlatformKeysServiceFactory::GetForBrowserContext(profile), KeyPermissionsManagerImpl::GetUserPrivateTokenKeyPermissionsManager(
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.cc b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.cc index 24c7bddb..1822195 100644 --- a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.cc +++ b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.cc
@@ -22,7 +22,6 @@ #include "chrome/browser/chromeos/platform_keys/platform_keys.h" #include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" -#include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/common/pref_names.h" #include "components/policy/core/common/policy_map.h" #include "components/policy/core/common/policy_namespace.h" @@ -39,14 +38,12 @@ bool is_regular_user_profile, bool profile_is_managed, PrefService* profile_prefs, - policy::PolicyService* profile_policies, extensions::StateStore* extensions_state_store, PlatformKeysService* platform_keys_service, KeyPermissionsManager* profile_key_permissions_manager) : is_regular_user_profile_(is_regular_user_profile), profile_is_managed_(profile_is_managed), profile_prefs_(profile_prefs), - profile_policies_(profile_policies), extensions_state_store_(extensions_state_store), platform_keys_service_(platform_keys_service), profile_key_permissions_manager_(profile_key_permissions_manager) { @@ -54,7 +51,6 @@ DCHECK(extensions_state_store_); DCHECK(platform_keys_service_); DCHECK(profile_key_permissions_manager || !is_regular_user_profile); - DCHECK(!profile_is_managed_ || profile_policies_); } KeyPermissionsServiceImpl::~KeyPermissionsServiceImpl() = default;
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.h b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.h index 3616fc5..f862a06 100644 --- a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.h +++ b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.h
@@ -23,10 +23,6 @@ class StateStore; } -namespace policy { -class PolicyService; -} - namespace chromeos { namespace platform_keys { @@ -39,15 +35,12 @@ public: // |profile_prefs| and |extensions_state_store| must not be null and must // outlive this object. - // If |profile_is_managed| is false, |profile_policies| is ignored. Otherwise, - // |profile_policies| must not be null and must outlive this object. // |profile_is_managed| determines the default usage and permissions for // keys without explicitly assigned usage. KeyPermissionsServiceImpl( bool is_regular_user_profile, bool profile_is_managed, PrefService* profile_prefs, - policy::PolicyService* profile_policies, extensions::StateStore* extensions_state_store, PlatformKeysService* platform_keys_service, KeyPermissionsManager* profile_key_permissions_manager); @@ -102,7 +95,6 @@ const bool is_regular_user_profile_; const bool profile_is_managed_; PrefService* const profile_prefs_; - policy::PolicyService* const profile_policies_; extensions::StateStore* const extensions_state_store_; PlatformKeysService* const platform_keys_service_; KeyPermissionsManager* const profile_key_permissions_manager_;
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl_unittest.cc b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl_unittest.cc index 2f2f4a6..0ccad06 100644 --- a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl_unittest.cc +++ b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl_unittest.cc
@@ -14,7 +14,6 @@ #include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" #include "chrome/browser/extensions/test_extension_system.h" #include "chrome/test/base/testing_profile.h" -#include "components/policy/core/common/mock_policy_service.h" #include "components/prefs/pref_service.h" #include "content/public/test/browser_task_environment.h" #include "extensions/browser/state_store.h" @@ -105,11 +104,7 @@ ~KeyPermissionsServiceImplTest() override = default; void SetUp() override { - auto mock_policy_service = std::make_unique<policy::MockPolicyService>(); - policy_service_ = mock_policy_service.get(); - TestingProfile::Builder builder; - builder.SetPolicyService(std::move(mock_policy_service)); - profile_ = builder.Build(); + profile_ = std::make_unique<TestingProfile>(); extensions::TestExtensionSystem* extension_system = static_cast<extensions::TestExtensionSystem*>( @@ -125,7 +120,7 @@ key_permissions_service_ = std::make_unique<KeyPermissionsServiceImpl>( /*is_regular_profile=*/true, /*profile_is_managed=*/true, - profile_->GetPrefs(), policy_service_, extensions_state_store_, + profile_->GetPrefs(), extensions_state_store_, platform_keys_service_.get(), key_permissions_manager_.get()); } @@ -162,8 +157,6 @@ content::BrowserTaskEnvironment task_environment_; std::unique_ptr<TestingProfile> profile_; // Owned by |profile_|. - policy::MockPolicyService* policy_service_ = nullptr; - // Owned by |profile_|. extensions::StateStore* extensions_state_store_ = nullptr; std::unique_ptr<KeyPermissionsServiceImpl> key_permissions_service_;
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_service_nss.cc b/chrome/browser/chromeos/platform_keys/platform_keys_service_nss.cc index 9d010a4e..d94cbe2a 100644 --- a/chrome/browser/chromeos/platform_keys/platform_keys_service_nss.cc +++ b/chrome/browser/chromeos/platform_keys/platform_keys_service_nss.cc
@@ -80,7 +80,10 @@ // Keeps track of the originating task runner. class NSSOperationState { public: - explicit NSSOperationState(ServiceWeakPtr weak_ptr); + explicit NSSOperationState(ServiceWeakPtr weak_ptr) + : service_weak_ptr_(weak_ptr), + origin_task_runner_(base::ThreadTaskRunnerHandle::Get()) {} + virtual ~NSSOperationState() = default; // Called if an error occurred during the execution of the NSS operation @@ -164,7 +167,11 @@ public: GenerateRSAKeyState(ServiceWeakPtr weak_ptr, unsigned int modulus_length_bits, - GenerateKeyCallback callback); + GenerateKeyCallback callback) + : NSSOperationState(weak_ptr), + modulus_length_bits_(modulus_length_bits), + callback_(std::move(callback)) {} + ~GenerateRSAKeyState() override = default; void OnError(const base::Location& from, Status status) override { @@ -199,7 +206,11 @@ public: GenerateECKeyState(ServiceWeakPtr weak_ptr, const std::string& named_curve, - GenerateKeyCallback callback); + GenerateKeyCallback callback) + : NSSOperationState(weak_ptr), + named_curve_(named_curve), + callback_(std::move(callback)) {} + ~GenerateECKeyState() override = default; void OnError(const base::Location& from, Status status) override { @@ -238,7 +249,15 @@ bool raw_pkcs1, HashAlgorithm hash_algorithm, const KeyType key_type, - SignCallback callback); + SignCallback callback) + : NSSOperationState(weak_ptr), + data_(data), + public_key_spki_der_(public_key_spki_der), + raw_pkcs1_(raw_pkcs1), + hash_algorithm_(hash_algorithm), + key_type_(key_type), + callback_(std::move(callback)) {} + ~SignState() override = default; void OnError(const base::Location& from, Status status) override { @@ -301,10 +320,14 @@ class SelectCertificatesState : public NSSOperationState { public: - explicit SelectCertificatesState( + SelectCertificatesState( ServiceWeakPtr weak_ptr, - const scoped_refptr<net::SSLCertRequestInfo>& request, - SelectCertificatesCallback callback); + const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, + SelectCertificatesCallback callback) + : NSSOperationState(weak_ptr), + cert_request_info_(cert_request_info), + callback_(std::move(callback)) {} + ~SelectCertificatesState() override = default; void OnError(const base::Location& from, Status status) override { @@ -337,8 +360,10 @@ class GetCertificatesState : public NSSOperationState { public: - explicit GetCertificatesState(ServiceWeakPtr weak_ptr, - GetCertificatesCallback callback); + GetCertificatesState(ServiceWeakPtr weak_ptr, + GetCertificatesCallback callback) + : NSSOperationState(weak_ptr), callback_(std::move(callback)) {} + ~GetCertificatesState() override = default; void OnError(const base::Location& from, Status status) override { @@ -371,8 +396,9 @@ class GetAllKeysState : public NSSOperationState { public: - explicit GetAllKeysState(ServiceWeakPtr weak_ptr, - GetAllKeysCallback callback); + GetAllKeysState(ServiceWeakPtr weak_ptr, GetAllKeysCallback callback) + : NSSOperationState(weak_ptr), callback_(std::move(callback)) {} + ~GetAllKeysState() override = default; void OnError(const base::Location& from, Status status) override { @@ -404,7 +430,11 @@ public: ImportCertificateState(ServiceWeakPtr weak_ptr, const scoped_refptr<net::X509Certificate>& certificate, - ImportCertificateCallback callback); + ImportCertificateCallback callback) + : NSSOperationState(weak_ptr), + certificate_(certificate), + callback_(std::move(callback)) {} + ~ImportCertificateState() override = default; void OnError(const base::Location& from, Status status) override { @@ -433,7 +463,11 @@ public: RemoveCertificateState(ServiceWeakPtr weak_ptr, const scoped_refptr<net::X509Certificate>& certificate, - RemoveCertificateCallback callback); + RemoveCertificateCallback callback) + : NSSOperationState(weak_ptr), + certificate_(certificate), + callback_(std::move(callback)) {} + ~RemoveCertificateState() override = default; void OnError(const base::Location& from, Status status) override { @@ -462,7 +496,11 @@ public: RemoveKeyState(ServiceWeakPtr weak_ptr, const std::string& public_key_spki_der, - RemoveKeyCallback callback); + RemoveKeyCallback callback) + : NSSOperationState(weak_ptr), + public_key_spki_der_(public_key_spki_der), + callback_(std::move(callback)) {} + ~RemoveKeyState() override = default; void OnError(const base::Location& from, Status status) override { @@ -490,7 +528,9 @@ class GetTokensState : public NSSOperationState { public: - explicit GetTokensState(ServiceWeakPtr weak_ptr, GetTokensCallback callback); + GetTokensState(ServiceWeakPtr weak_ptr, GetTokensCallback callback) + : NSSOperationState(weak_ptr), callback_(std::move(callback)) {} + ~GetTokensState() override = default; void OnError(const base::Location& from, Status status) override { @@ -522,7 +562,11 @@ public: GetKeyLocationsState(ServiceWeakPtr weak_ptr, const std::string& public_key_spki_der, - GetKeyLocationsCallback callback); + GetKeyLocationsCallback callback) + : NSSOperationState(weak_ptr), + public_key_spki_der_(public_key_spki_der), + callback_(std::move(callback)) {} + ~GetKeyLocationsState() override = default; void OnError(const base::Location& from, Status status) override { @@ -558,7 +602,13 @@ const std::string& public_key_spki_der, CK_ATTRIBUTE_TYPE attribute_type, const std::string& attribute_value, - SetAttributeForKeyCallback callback); + SetAttributeForKeyCallback callback) + : NSSOperationState(weak_ptr), + public_key_spki_der_(public_key_spki_der), + attribute_type_(attribute_type), + attribute_value_(attribute_value), + callback_(std::move(callback)) {} + ~SetAttributeForKeyState() override = default; void OnError(const base::Location& from, Status status) override { @@ -591,7 +641,12 @@ GetAttributeForKeyState(ServiceWeakPtr weak_ptr, const std::string& public_key_spki_der, CK_ATTRIBUTE_TYPE attribute_type, - GetAttributeForKeyCallback callback); + GetAttributeForKeyCallback callback) + : NSSOperationState(weak_ptr), + public_key_spki_der_(public_key_spki_der), + attribute_type_(attribute_type), + callback_(std::move(callback)) {} + ~GetAttributeForKeyState() override = default; void OnError(const base::Location& from, Status status) override { @@ -626,7 +681,11 @@ public: IsKeyOnTokenState(ServiceWeakPtr weak_ptr, const std::string& public_key_spki_der, - IsKeyOnTokenCallback callback); + IsKeyOnTokenCallback callback) + : NSSOperationState(weak_ptr), + public_key_spki_der_(public_key_spki_der), + callback_(std::move(callback)) {} + ~IsKeyOnTokenState() override = default; void OnError(const base::Location& from, Status status) override { @@ -655,119 +714,6 @@ IsKeyOnTokenCallback callback_; }; -NSSOperationState::NSSOperationState(ServiceWeakPtr weak_ptr) - : service_weak_ptr_(weak_ptr), - origin_task_runner_(base::ThreadTaskRunnerHandle::Get()) {} - -GenerateRSAKeyState::GenerateRSAKeyState(ServiceWeakPtr weak_ptr, - unsigned int modulus_length_bits, - GenerateKeyCallback callback) - : NSSOperationState(weak_ptr), - modulus_length_bits_(modulus_length_bits), - callback_(std::move(callback)) {} - -GenerateECKeyState::GenerateECKeyState(ServiceWeakPtr weak_ptr, - const std::string& named_curve, - GenerateKeyCallback callback) - : NSSOperationState(weak_ptr), - named_curve_(named_curve), - callback_(std::move(callback)) {} - -SignState::SignState(ServiceWeakPtr weak_ptr, - const std::string& data, - const std::string& public_key_spki_der, - bool raw_pkcs1, - HashAlgorithm hash_algorithm, - const KeyType key_type, - SignCallback callback) - : NSSOperationState(weak_ptr), - data_(data), - public_key_spki_der_(public_key_spki_der), - raw_pkcs1_(raw_pkcs1), - hash_algorithm_(hash_algorithm), - key_type_(key_type), - callback_(std::move(callback)) {} - -SelectCertificatesState::SelectCertificatesState( - ServiceWeakPtr weak_ptr, - const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, - SelectCertificatesCallback callback) - : NSSOperationState(weak_ptr), - cert_request_info_(cert_request_info), - callback_(std::move(callback)) {} - -GetCertificatesState::GetCertificatesState(ServiceWeakPtr weak_ptr, - GetCertificatesCallback callback) - : NSSOperationState(weak_ptr), callback_(std::move(callback)) {} - -GetAllKeysState::GetAllKeysState(ServiceWeakPtr weak_ptr, - GetAllKeysCallback callback) - : NSSOperationState(weak_ptr), callback_(std::move(callback)) {} - -ImportCertificateState::ImportCertificateState( - ServiceWeakPtr weak_ptr, - const scoped_refptr<net::X509Certificate>& certificate, - ImportCertificateCallback callback) - : NSSOperationState(weak_ptr), - certificate_(certificate), - callback_(std::move(callback)) {} - -RemoveCertificateState::RemoveCertificateState( - ServiceWeakPtr weak_ptr, - const scoped_refptr<net::X509Certificate>& certificate, - RemoveCertificateCallback callback) - : NSSOperationState(weak_ptr), - certificate_(certificate), - callback_(std::move(callback)) {} - -RemoveKeyState::RemoveKeyState(ServiceWeakPtr weak_ptr, - const std::string& public_key_spki_der, - RemoveKeyCallback callback) - : NSSOperationState(weak_ptr), - public_key_spki_der_(public_key_spki_der), - callback_(std::move(callback)) {} - -GetTokensState::GetTokensState(ServiceWeakPtr weak_ptr, - GetTokensCallback callback) - : NSSOperationState(weak_ptr), callback_(std::move(callback)) {} - -GetKeyLocationsState::GetKeyLocationsState( - ServiceWeakPtr weak_ptr, - const std::string& public_key_spki_der, - GetKeyLocationsCallback callback) - : NSSOperationState(weak_ptr), - public_key_spki_der_(public_key_spki_der), - callback_(std::move(callback)) {} - -SetAttributeForKeyState::SetAttributeForKeyState( - ServiceWeakPtr weak_ptr, - const std::string& public_key_spki_der, - CK_ATTRIBUTE_TYPE attribute_type, - const std::string& attribute_value, - SetAttributeForKeyCallback callback) - : NSSOperationState(weak_ptr), - public_key_spki_der_(public_key_spki_der), - attribute_type_(attribute_type), - attribute_value_(attribute_value), - callback_(std::move(callback)) {} - -GetAttributeForKeyState::GetAttributeForKeyState( - ServiceWeakPtr weak_ptr, - const std::string& public_key_spki_der, - CK_ATTRIBUTE_TYPE attribute_type, - GetAttributeForKeyCallback callback) - : NSSOperationState(weak_ptr), - public_key_spki_der_(public_key_spki_der), - attribute_type_(attribute_type), - callback_(std::move(callback)) {} - -IsKeyOnTokenState::IsKeyOnTokenState(ServiceWeakPtr weak_ptr, - const std::string& public_key_spki_der, - IsKeyOnTokenCallback callback) - : NSSOperationState(weak_ptr), - public_key_spki_der_(public_key_spki_der), - callback_(std::move(callback)) {} - // Returns the private key corresponding to the der-encoded // |public_key_spki_der| if found in |slot|. If |slot| is nullptr, the // private key will be searched in all slots.
diff --git a/chrome/browser/chromeos/policy/android_management_client_unittest.cc b/chrome/browser/chromeos/policy/android_management_client_unittest.cc index 52766f5a..8896a5a 100644 --- a/chrome/browser/chromeos/policy/android_management_client_unittest.cc +++ b/chrome/browser/chromeos/policy/android_management_client_unittest.cc
@@ -51,9 +51,12 @@ shared_url_loader_factory_ = base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( &url_loader_factory_); + signin::IdentityManager* identity_manager = + identity_test_environment_.identity_manager(); + CoreAccountId account_id = identity_manager->PickAccountIdForAccount( + signin::GetTestGaiaIdForEmail(kAccountEmail), kAccountEmail); client_.reset(new AndroidManagementClient( - &service_, shared_url_loader_factory_, CoreAccountId(kAccountEmail), - identity_test_environment_.identity_manager())); + &service_, shared_url_loader_factory_, account_id, identity_manager)); service_.ScheduleInitialization(0); base::RunLoop().RunUntilIdle(); @@ -83,12 +86,9 @@ Run(AndroidManagementClient::Result::UNMANAGED)) .Times(1); - // On ChromeOS platform, account_id and email are same. AccountInfo account_info = identity_test_environment_.MakeAccountAvailable(kAccountEmail); - client_->StartCheckAndroidManagement(callback_observer_.Get()); - identity_test_environment_ .WaitForAccessTokenRequestIfNecessaryAndRespondWithToken( account_info.account_id, kOAuthToken, base::Time::Max());
diff --git a/chrome/browser/chromeos/policy/unaffiliated_arc_allowed_browsertest.cc b/chrome/browser/chromeos/policy/unaffiliated_arc_allowed_browsertest.cc index 20abbac7..7c34000 100644 --- a/chrome/browser/chromeos/policy/unaffiliated_arc_allowed_browsertest.cc +++ b/chrome/browser/chromeos/policy/unaffiliated_arc_allowed_browsertest.cc
@@ -32,7 +32,7 @@ namespace { constexpr char kAffiliatedUserEmail[] = "affiliated-user@example.com"; -constexpr char kAffiliatedUserGaiaId[] = "affiliated-user@example.com"; +constexpr char kAffiliatedUserGaiaId[] = "affiliated-user_example.com"; constexpr char kAffiliationID[] = "some-affiliation-id"; constexpr char kAnotherAffiliationID[] = "another-affiliation-id";
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index fc5717d..0b3b0372 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn
@@ -771,7 +771,6 @@ "//chrome/app/theme:chrome_unscaled_resources", "//chrome/app/theme:theme_resources", "//chrome/app/vector_icons", - "//chrome/browser:browser_process", "//chrome/browser:ntp_background_proto", "//chrome/browser:theme_properties", "//chrome/browser/devtools",
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.cc b/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.cc index dcc5946..da7ec8a 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.cc
@@ -30,13 +30,6 @@ incognito); } -std::unique_ptr<RuleIterator> CustomExtensionProvider::GetDiscardedRuleIterator( - ContentSettingsType content_type, - bool incognito) const { - return extensions_settings_->GetDiscardedRuleIterator(content_type, - incognito); -} - bool CustomExtensionProvider::SetWebsiteSetting( const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_pattern,
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.h b/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.h index 174f5404..0d0f698 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.h +++ b/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.h
@@ -29,10 +29,6 @@ ContentSettingsType content_type, bool incognito) const override; - std::unique_ptr<RuleIterator> GetDiscardedRuleIterator( - ContentSettingsType content_type, - bool incognito) const override; - bool SetWebsiteSetting( const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_pattern,
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_store.cc b/chrome/browser/extensions/api/content_settings/content_settings_store.cc index 03ee900..8efe962 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_store.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_store.cc
@@ -38,51 +38,6 @@ namespace extensions { -namespace { - -enum class FilterType { - WANT_DISCARDED_PATTERNS, - WANT_VALID_PATTERNS, -}; - -class FilterRuleIterator : public RuleIterator { - public: - FilterRuleIterator(std::unique_ptr<RuleIterator> iterator, - const FilterType filter_type) - : iterator_(std::move(iterator)), filter_type_(filter_type) {} - - ~FilterRuleIterator() override = default; - - bool HasNext() const override { - if (!iterator_) - return false; - if (current_rule_) - return true; - while (iterator_->HasNext()) { - current_rule_ = iterator_->Next(); - if (!((filter_type_ == FilterType::WANT_DISCARDED_PATTERNS) ^ - current_rule_->primary_pattern.HasHostWildcards())) { - return true; - } - } - return false; - } - - Rule Next() override { - DCHECK(current_rule_.has_value()); - Rule rule = std::move(*current_rule_); - current_rule_.reset(); - return rule; - } - - private: - std::unique_ptr<RuleIterator> iterator_; - const FilterType filter_type_; - mutable base::Optional<Rule> current_rule_; -}; - -} // namespace - struct ContentSettingsStore::ExtensionEntry { // Extension id. std::string id; @@ -108,33 +63,6 @@ std::unique_ptr<RuleIterator> ContentSettingsStore::GetRuleIterator( ContentSettingsType type, bool incognito) const { - if (base::FeatureList::IsEnabled( - content_settings::kDisallowWildcardsInPluginContentSettings) && - type == ContentSettingsType::PLUGINS) { - return std::make_unique<FilterRuleIterator>( - GetAllRulesIterator(type, incognito), FilterType::WANT_VALID_PATTERNS); - } else { - return GetAllRulesIterator(type, incognito); - } -} - -std::unique_ptr<RuleIterator> ContentSettingsStore::GetDiscardedRuleIterator( - ContentSettingsType type, - bool incognito) const { - if (base::FeatureList::IsEnabled( - content_settings::kDisallowWildcardsInPluginContentSettings) && - type == ContentSettingsType::PLUGINS) { - return std::make_unique<FilterRuleIterator>( - GetAllRulesIterator(type, incognito), - FilterType::WANT_DISCARDED_PATTERNS); - } else { - return std::make_unique<content_settings::EmptyRuleIterator>(); - } -} - -std::unique_ptr<RuleIterator> ContentSettingsStore::GetAllRulesIterator( - ContentSettingsType type, - bool incognito) const { std::vector<std::unique_ptr<RuleIterator>> iterators; // The individual |RuleIterators| shouldn't lock; pass |lock_| to the @@ -177,6 +105,12 @@ ContentSettingsType type, ContentSetting setting, ExtensionPrefsScope scope) { + if (base::FeatureList::IsEnabled( + content_settings::kDisallowWildcardsInPluginContentSettings) && + type == ContentSettingsType::PLUGINS && + primary_pattern.HasHostWildcards()) { + return; + } { base::AutoLock lock(lock_); OriginIdentifierValueMap* map = GetValueMap(ext_id, scope);
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_store.h b/chrome/browser/extensions/api/content_settings/content_settings_store.h index 57e1789..d55cf77c 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_store.h +++ b/chrome/browser/extensions/api/content_settings/content_settings_store.h
@@ -58,14 +58,6 @@ ContentSettingsType type, bool incognito) const; - std::unique_ptr<content_settings::RuleIterator> GetDiscardedRuleIterator( - ContentSettingsType type, - bool incognito) const; - - std::unique_ptr<content_settings::RuleIterator> GetAllRulesIterator( - ContentSettingsType type, - bool incognito) const; - // Sets the content |setting| for |pattern| of extension |ext_id|. The // |incognito| flag allow to set whether the provided setting is for // incognito mode only.
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc b/chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc index fea5d426..41d2b8e 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc
@@ -371,12 +371,6 @@ // Here we will have one rule because wildcard patterns are allowed for // ContentSettingsType::COOKIES. ASSERT_EQ(rules.size(), 1u); - - std::unique_ptr<content_settings::RuleIterator> discarded_rules_iterator = - store()->GetDiscardedRuleIterator(ContentSettingsType::PLUGINS, false); - ASSERT_TRUE(discarded_rules_iterator->HasNext()); - ASSERT_EQ(discarded_rules_iterator->Next().primary_pattern, primary_pattern); - ASSERT_FALSE(discarded_rules_iterator->HasNext()); } } // namespace extensions
diff --git a/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc b/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc index e107546..71f8752 100644 --- a/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc +++ b/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc
@@ -350,43 +350,18 @@ void AddDynamicRules(const ExtensionId& extension_id, const std::vector<TestRule>& rules) { - static constexpr char kScript[] = R"( - chrome.declarativeNetRequest.updateDynamicRules({addRules: $1}, - function () { - window.domAutomationController.send(chrome.runtime.lastError ? - chrome.runtime.lastError.message : 'success'); - }); - )"; - - // Serialize |rules|. - ListBuilder builder; - for (const auto& rule : rules) - builder.Append(rule.ToValue()); - - // A cast is necessary from ListValue to Value, else this fails to compile. - const std::string script = content::JsReplace( - kScript, static_cast<const base::Value&>(*builder.Build())); - ASSERT_EQ("success", ExecuteScriptInBackgroundPage(extension_id, script)); + UpdateRules(extension_id, {}, rules, RulesetScope::kDynamic); + } + void RemoveDynamicRules(const ExtensionId& extension_id, + const std::vector<int>& rule_ids) { + UpdateRules(extension_id, rule_ids, {}, RulesetScope::kDynamic); } - void RemoveDynamicRules(const ExtensionId& extension_id, - const std::vector<int> rule_ids) { - static constexpr char kScript[] = R"( - chrome.declarativeNetRequest.updateDynamicRules({removeRuleIds: $1}, - function () { - window.domAutomationController.send(chrome.runtime.lastError ? - chrome.runtime.lastError.message : 'success'); - }); - )"; - - // Serialize |rule_ids|. - std::unique_ptr<base::Value> rule_ids_value = - ListBuilder().Append(rule_ids.begin(), rule_ids.end()).Build(); - - // A cast is necessary from ListValue to Value, else this fails to compile. - const std::string script = content::JsReplace( - kScript, static_cast<const base::Value&>(*rule_ids_value)); - ASSERT_EQ("success", ExecuteScriptInBackgroundPage(extension_id, script)); + void UpdateSessionRules(const ExtensionId& extension_id, + const std::vector<int>& rule_ids_to_remove, + const std::vector<TestRule>& rules_to_add) { + UpdateRules(extension_id, rule_ids_to_remove, rules_to_add, + RulesetScope::kSession); } void UpdateEnabledRulesets( @@ -573,6 +548,49 @@ } private: + enum class RulesetScope { kDynamic, kSession }; + void UpdateRules(const ExtensionId& extension_id, + const std::vector<int>& rule_ids_to_remove, + const std::vector<TestRule>& rules_to_add, + RulesetScope scope) { + static constexpr char kScript[] = R"( + chrome.declarativeNetRequest.%s( + {addRules: $1, removeRuleIds: $2}, + function() { + window.domAutomationController.send(chrome.runtime.lastError ? + chrome.runtime.lastError.message : 'success'); + }); + )"; + + // Serialize |rules_to_add|. + ListBuilder rules_to_add_builder; + for (const auto& rule : rules_to_add) + rules_to_add_builder.Append(rule.ToValue()); + + // Serialize |rule_ids|. + std::unique_ptr<base::Value> rule_ids_to_remove_value = + ListBuilder() + .Append(rule_ids_to_remove.begin(), rule_ids_to_remove.end()) + .Build(); + + const char* function_name = nullptr; + switch (scope) { + case RulesetScope::kDynamic: + function_name = "updateDynamicRules"; + break; + case RulesetScope::kSession: + function_name = "updateSessionRules"; + break; + } + + // A cast is necessary from ListValue to Value, else this fails to compile. + const std::string script = content::JsReplace( + base::StringPrintf(kScript, function_name), + static_cast<const base::Value&>(*rules_to_add_builder.Build()), + static_cast<const base::Value&>(*rule_ids_to_remove_value)); + ASSERT_EQ("success", ExecuteScriptInBackgroundPage(extension_id, script)); + } + // Handler to monitor the requests which reach the EmbeddedTestServer. This // will be run on the EmbeddedTestServer's IO thread. void MonitorRequest(const net::test_server::HttpRequest& request) { @@ -1746,23 +1764,33 @@ set_config_flags(ConfigFlag::kConfig_HasBackgroundScript); - // Block all main frame requests to "index.html". + // Block all main frame requests to "static.com". TestRule rule = CreateGenericRule(); - rule.condition->url_filter = std::string("index.html"); + rule.condition->url_filter = std::string("static.com"); rule.condition->resource_types = std::vector<std::string>({"main_frame"}); - ASSERT_NO_FATAL_FAILURE(LoadExtensionWithRules({rule})); + ASSERT_NO_FATAL_FAILURE(LoadExtensionWithRules({rule}, "extension", {})); const ExtensionId extension_id = last_loaded_extension_id(); - // Add dynamic rule to block main-frame requests to "page.html". - rule.condition->url_filter = std::string("page.html"); + // Add dynamic rule to block main-frame requests to "dynamic.com". + rule.condition->url_filter = std::string("dynamic.com"); ASSERT_NO_FATAL_FAILURE(AddDynamicRules(extension_id, {rule})); + // Add session rule to block main-frame requests to "session.com". + rule.condition->url_filter = std::string("session.com"); + ASSERT_NO_FATAL_FAILURE(UpdateSessionRules(extension_id, {}, {rule})); + EXPECT_TRUE(IsNavigationBlocked(embedded_test_server()->GetURL( - "example.com", "/pages_with_script/index.html"))); + "static.com", "/pages_with_script/index.html"))); EXPECT_TRUE(IsNavigationBlocked(embedded_test_server()->GetURL( - "example.com", "/pages_with_script/page.html"))); + "dynamic.com", "/pages_with_script/index.html"))); + + // TODO(crbug.com/1043200): This should be true once we start evaluating + // session scoped rules. EXPECT_FALSE(IsNavigationBlocked(embedded_test_server()->GetURL( - "example.com", "/pages_with_script/page2.html"))); + "session.com", "/pages_with_script/index.html"))); + + EXPECT_FALSE(IsNavigationBlocked(embedded_test_server()->GetURL( + "unmatched.com", "/pages_with_script/index.html"))); } IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestBrowserTest_Packed, @@ -1771,14 +1799,35 @@ // directory won't be persisted across browser restarts. ASSERT_EQ(ExtensionLoadType::PACKED, GetParam()); + const Extension* extension = nullptr; + for (const auto& ext : extension_registry()->enabled_extensions()) { + if (ext->name() == "extension") { + extension = ext.get(); + break; + } + } + ASSERT_TRUE(extension); + + // The session-scoped ruleset should not be enabled after the browser + // restarts. However both the static and dynamic ruleset enabled in the last + // session should be enabled. + CompositeMatcher* composite_matcher = + ruleset_manager()->GetMatcherForExtension(extension->id()); + ASSERT_TRUE(composite_matcher); + EXPECT_THAT( + GetPublicRulesetIDs(*extension, *composite_matcher), + UnorderedElementsAre(kDefaultRulesetID, dnr_api::DYNAMIC_RULESET_ID)); + // Ensure that the DNR extension enabled in previous browser session still // correctly blocks network requests. EXPECT_TRUE(IsNavigationBlocked(embedded_test_server()->GetURL( - "example.com", "/pages_with_script/index.html"))); + "static.com", "/pages_with_script/index.html"))); EXPECT_TRUE(IsNavigationBlocked(embedded_test_server()->GetURL( - "example.com", "/pages_with_script/page.html"))); + "dynamic.com", "/pages_with_script/index.html"))); EXPECT_FALSE(IsNavigationBlocked(embedded_test_server()->GetURL( - "example.com", "/pages_with_script/page2.html"))); + "session.com", "/pages_with_script/index.html"))); + EXPECT_FALSE(IsNavigationBlocked(embedded_test_server()->GetURL( + "unmatched.com", "/pages_with_script/index.html"))); } // Tests than an extension can omit the "declarative_net_request" manifest key
diff --git a/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_unittest.cc b/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_unittest.cc index a31b1d34..d6c3a64 100644 --- a/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_unittest.cc +++ b/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_unittest.cc
@@ -194,9 +194,14 @@ tester.ExpectTotalCount(kManifestRulesCountHistogram, 0u); } - bool RunDynamicRuleUpdateFunction(const Extension& extension, - const std::vector<int>& rule_ids_to_remove, - const std::vector<TestRule>& rules_to_add) { + enum class RulesetScope { kDynamic, kSession }; + + // Runs the updateDynamicRules/updateSessionRules extension function based on + // |scope|. + bool RunUpdateRulesFunction(const Extension& extension, + const std::vector<int>& rule_ids_to_remove, + const std::vector<TestRule>& rules_to_add, + RulesetScope scope) { std::unique_ptr<base::Value> ids_to_remove_value = ListBuilder() .Append(rule_ids_to_remove.begin(), rule_ids_to_remove.end()) @@ -213,14 +218,50 @@ content::JsReplace(kParams, std::move(*rules_to_add_value), std::move(*ids_to_remove_value)); - auto update_function = - base::MakeRefCounted<DeclarativeNetRequestUpdateDynamicRulesFunction>(); + scoped_refptr<ExtensionFunction> update_function; + switch (scope) { + case RulesetScope::kDynamic: + update_function = base::MakeRefCounted< + DeclarativeNetRequestUpdateDynamicRulesFunction>(); + break; + case RulesetScope::kSession: + update_function = base::MakeRefCounted< + DeclarativeNetRequestUpdateSessionRulesFunction>(); + break; + } update_function->set_extension(&extension); update_function->set_has_callback(true); return api_test_utils::RunFunction(update_function.get(), json_args, browser_context()); } + // Runs getDynamicRules/getSessionRules extension function and populates + // |result|. + void RunGetRulesFunction(const Extension& extension, + RulesetScope scope, + base::ListValue* result) { + CHECK(result); + scoped_refptr<ExtensionFunction> function; + switch (scope) { + case RulesetScope::kDynamic: + function = base::MakeRefCounted< + DeclarativeNetRequestGetDynamicRulesFunction>(); + break; + case RulesetScope::kSession: + function = base::MakeRefCounted< + DeclarativeNetRequestGetSessionRulesFunction>(); + break; + } + function->set_extension(&extension); + function->set_has_callback(true); + + auto result_ptr = + base::ListValue::From(api_test_utils::RunFunctionAndReturnSingleResult( + function.get(), "[]" /* args */, browser_context())); + ASSERT_TRUE(result_ptr); + *result = std::move(*result_ptr); + } + void RunUpdateEnabledRulesetsFunction( const Extension& extension, const std::vector<std::string>& ruleset_ids_to_remove, @@ -908,8 +949,8 @@ // Add some dynamic rules. std::vector<TestRule> dynamic_rules({CreateGenericRule()}); - ASSERT_TRUE(RunDynamicRuleUpdateFunction( - *extension, {} /* rule_ids_to_remove */, dynamic_rules)); + ASSERT_TRUE(RunUpdateRulesFunction(*extension, {} /* rule_ids_to_remove */, + dynamic_rules, RulesetScope::kDynamic)); // The API function to update the dynamic ruleset should only complete once // the initial ruleset loading (in response to OnExtensionLoaded) is complete. @@ -965,6 +1006,41 @@ VerifyPublicRulesetIDs(*extension, {}); } +// Tests updateSessionRules and getSessionRules extension function calls. +TEST_P(SingleRulesetTest, SessionRules) { + // Load an extension with no static rulesets. + LoadAndExpectSuccess(); + + base::ListValue result; + RunGetRulesFunction(*extension(), RulesetScope::kSession, &result); + EXPECT_TRUE(result.empty()); + + TestRule rule_1 = CreateGenericRule(); + rule_1.id = 1; + TestRule rule_2 = CreateGenericRule(); + rule_2.id = 2; + ASSERT_TRUE(RunUpdateRulesFunction(*extension(), {}, {rule_1, rule_2}, + RulesetScope::kSession)); + RunGetRulesFunction(*extension(), RulesetScope::kSession, &result); + EXPECT_THAT(result.GetList(), + ::testing::UnorderedElementsAre( + ::testing::Eq(std::cref(*rule_1.ToValue())), + ::testing::Eq(std::cref(*rule_2.ToValue())))); + + // No dynamic rules should be returned. + RunGetRulesFunction(*extension(), RulesetScope::kDynamic, &result); + EXPECT_TRUE(result.empty()); + + ASSERT_TRUE(RunUpdateRulesFunction(*extension(), {*rule_2.id}, {}, + RulesetScope::kSession)); + RunGetRulesFunction(*extension(), RulesetScope::kSession, &result); + EXPECT_THAT(result.GetList(), ::testing::UnorderedElementsAre(::testing::Eq( + std::cref(*rule_1.ToValue())))); + + RunGetRulesFunction(*extension(), RulesetScope::kDynamic, &result); + EXPECT_TRUE(result.empty()); +} + // Test fixture for a single ruleset with the // |kDeclarativeNetRequestGlobalRules| feature enabled. class SingleRulesetGlobalRulesTest : public SingleRulesetTest { @@ -1556,8 +1632,8 @@ // Add dynamic rules and ensure that the setEnabledRulesets call doesn't have // any effect on the dynamic ruleset. Also ensure that the getEnabledRulesets // call excludes the dynamic ruleset ID. - ASSERT_TRUE( - RunDynamicRuleUpdateFunction(*extension(), {}, {CreateGenericRule()})); + ASSERT_TRUE(RunUpdateRulesFunction(*extension(), {}, {CreateGenericRule()}, + RulesetScope::kDynamic)); VerifyPublicRulesetIDs(*extension(), {kId2, kId3, dnr_api::DYNAMIC_RULESET_ID}); VerifyGetEnabledRulesetsFunction(*extension(), {kId2, kId3});
diff --git a/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc b/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc index cfbdae4..2f5978d 100644 --- a/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc +++ b/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc
@@ -27,8 +27,10 @@ constexpr char kHostname[] = "hostname"; constexpr char kTestExtensionID[] = "nbiliclbejdndfpchgkbmfoppjplbdok"; -constexpr char kUpdateManifestPath[] = - "/extensions/api_test/enterprise_device_attributes/update_manifest.xml"; +constexpr char kExtensionPath[] = + "extensions/api_test/enterprise_device_attributes/"; +constexpr char kExtensionPemPath[] = + "extensions/api_test/enterprise_device_attributes.pem"; base::Value BuildCustomArg(const std::string& expected_directory_device_id, const std::string& expected_serial_number, @@ -98,7 +100,7 @@ ->IsAffiliated()); const Extension* extension = - ForceInstallExtension(kTestExtensionID, kUpdateManifestPath); + ForceInstallExtension(kExtensionPath, kExtensionPemPath); const GURL test_url = extension->GetResourceURL("basic.html"); // Device attributes are available only for affiliated user.
diff --git a/chrome/browser/extensions/api/enterprise_networking_attributes/enterprise_networking_attributes_apitest.cc b/chrome/browser/extensions/api/enterprise_networking_attributes/enterprise_networking_attributes_apitest.cc index a3c7706..99ab581 100644 --- a/chrome/browser/extensions/api/enterprise_networking_attributes/enterprise_networking_attributes_apitest.cc +++ b/chrome/browser/extensions/api/enterprise_networking_attributes/enterprise_networking_attributes_apitest.cc
@@ -24,8 +24,10 @@ "Device is not connected to a network."; constexpr char kTestExtensionID[] = "pkhdjpcjgonhlomdjmnddhbfpgkdhgle"; -constexpr char kUpdateManifestPath[] = - "/extensions/api_test/enterprise_networking_attributes/update_manifest.xml"; +constexpr char kExtensionPath[] = + "extensions/api_test/enterprise_networking_attributes/"; +constexpr char kExtensionPemPath[] = + "extensions/api_test/enterprise_networking_attributes.pem"; constexpr char kMacAddress[] = "0123456789AB"; constexpr char kFormattedMacAddress[] = "01:23:45:67:89:AB"; @@ -157,7 +159,7 @@ ->IsAffiliated()); const Extension* extension = - ForceInstallExtension(kTestExtensionID, kUpdateManifestPath); + ForceInstallExtension(kExtensionPath, kExtensionPemPath); SetupDisconnectedNetwork(); const GURL test_url = extension->GetResourceURL("test.html");
diff --git a/chrome/browser/extensions/api/force_installed_affiliated_extension_apitest.cc b/chrome/browser/extensions/api/force_installed_affiliated_extension_apitest.cc index e1cfefc..3b57f43 100644 --- a/chrome/browser/extensions/api/force_installed_affiliated_extension_apitest.cc +++ b/chrome/browser/extensions/api/force_installed_affiliated_extension_apitest.cc
@@ -4,11 +4,16 @@ #include "chrome/browser/extensions/api/force_installed_affiliated_extension_apitest.h" +#include "base/files/file_path.h" #include "base/json/json_writer.h" +#include "base/optional.h" +#include "base/path_service.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/policy/affiliation_test_helper.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" -#include "chrome/browser/extensions/policy_test_utils.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "chrome/common/chrome_paths.h" +#include "chrome/test/base/mixin_based_in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "chromeos/dbus/session_manager/fake_session_manager_client.h" #include "components/prefs/pref_service.h" @@ -29,6 +34,10 @@ constexpr char kAffiliatedUserEmail[] = "user@example.com"; constexpr char kAffiliatedUserGaiaId[] = "1029384756"; +base::FilePath GetTestDataDir() { + return base::PathService::CheckedGet(chrome::DIR_TEST_DATA); +} + } // namespace namespace extensions { @@ -49,16 +58,33 @@ ForceInstalledAffiliatedExtensionApiTest:: ~ForceInstalledAffiliatedExtensionApiTest() = default; +void ForceInstalledAffiliatedExtensionApiTest::SetUp() { + mixin_host_.SetUp(); + ExtensionApiTest::SetUp(); +} + void ForceInstalledAffiliatedExtensionApiTest::SetUpCommandLine( base::CommandLine* command_line) { - ExtensionApiTest::SetUpCommandLine(command_line); + mixin_host_.SetUpCommandLine(command_line); policy::AffiliationTestHelper::AppendCommandLineSwitchesForLoginManager( command_line); + ExtensionApiTest::SetUpCommandLine(command_line); +} + +void ForceInstalledAffiliatedExtensionApiTest::SetUpDefaultCommandLine( + base::CommandLine* command_line) { + mixin_host_.SetUpDefaultCommandLine(command_line); + ExtensionApiTest::SetUpDefaultCommandLine(command_line); +} + +bool ForceInstalledAffiliatedExtensionApiTest::SetUpUserDataDirectory() { + return mixin_host_.SetUpUserDataDirectory() && + ExtensionApiTest::SetUpUserDataDirectory(); } void ForceInstalledAffiliatedExtensionApiTest:: SetUpInProcessBrowserTestFixture() { - ExtensionApiTest::SetUpInProcessBrowserTestFixture(); + mixin_host_.SetUpInProcessBrowserTestFixture(); // Initialize clients here so they are available during setup. They will be // shutdown in ChromeBrowserMain. @@ -93,9 +119,18 @@ // Set retry delay to prevent timeouts. policy::DeviceManagementService::SetRetryDelayForTesting(0); + + ExtensionApiTest::SetUpInProcessBrowserTestFixture(); +} + +void ForceInstalledAffiliatedExtensionApiTest::CreatedBrowserMainParts( + content::BrowserMainParts* browser_main_parts) { + mixin_host_.CreatedBrowserMainParts(browser_main_parts); + ExtensionApiTest::CreatedBrowserMainParts(browser_main_parts); } void ForceInstalledAffiliatedExtensionApiTest::SetUpOnMainThread() { + mixin_host_.SetUpOnMainThread(); // Log in user that was created with // policy::AffiliationTestHelper::PreLoginUser() in the PRE_ test. const base::ListValue* users = @@ -104,24 +139,36 @@ policy::AffiliationTestHelper::LoginUser(affiliated_account_id_); } - policy_test_utils::SetUpEmbeddedTestServer(embedded_test_server()); - ASSERT_TRUE(embedded_test_server()->Start()); - + force_install_mixin_.InitWithMockPolicyProvider(profile(), &policy_provider_); ExtensionApiTest::SetUpOnMainThread(); } +void ForceInstalledAffiliatedExtensionApiTest::TearDownOnMainThread() { + mixin_host_.TearDownOnMainThread(); + ExtensionApiTest::TearDownOnMainThread(); +} + +void ForceInstalledAffiliatedExtensionApiTest:: + TearDownInProcessBrowserTestFixture() { + mixin_host_.TearDownInProcessBrowserTestFixture(); + ExtensionApiTest::TearDownInProcessBrowserTestFixture(); +} + +void ForceInstalledAffiliatedExtensionApiTest::TearDown() { + mixin_host_.TearDown(); + ExtensionApiTest::TearDown(); +} + const extensions::Extension* ForceInstalledAffiliatedExtensionApiTest::ForceInstallExtension( - const extensions::ExtensionId& extension_id, - const std::string& update_manifest_path) { - policy_test_utils::SetExtensionInstallForcelistPolicy( - extension_id, embedded_test_server()->GetURL(update_manifest_path), - profile(), &policy_provider_); - const extensions::Extension* extension = - ExtensionRegistry::Get(profile())->enabled_extensions().GetByID( - extension_id); - DCHECK(extension); - return extension; + const std::string& extension_path, + const std::string& pem_path) { + extensions::ExtensionId extension_id; + EXPECT_TRUE(force_install_mixin_.ForceInstallFromSourceDir( + GetTestDataDir().AppendASCII(extension_path), + GetTestDataDir().AppendASCII(pem_path), + ExtensionForceInstallMixin::WaitMode::kLoad, &extension_id)); + return force_install_mixin_.GetInstalledExtension(extension_id); } void ForceInstalledAffiliatedExtensionApiTest::TestExtension(
diff --git a/chrome/browser/extensions/api/force_installed_affiliated_extension_apitest.h b/chrome/browser/extensions/api/force_installed_affiliated_extension_apitest.h index 7707876..3f3c6ed 100644 --- a/chrome/browser/extensions/api/force_installed_affiliated_extension_apitest.h +++ b/chrome/browser/extensions/api/force_installed_affiliated_extension_apitest.h
@@ -10,6 +10,8 @@ #include "base/values.h" #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" #include "chrome/browser/extensions/extension_apitest.h" +#include "chrome/browser/policy/extension_force_install_mixin.h" +#include "chrome/test/base/mixin_based_in_process_browser_test.h" #include "chromeos/tpm/stub_install_attributes.h" #include "components/account_id/account_id.h" #include "components/policy/core/common/mock_configuration_policy_provider.h" @@ -26,8 +28,12 @@ class Extension; -// TODO(https://crbug.com/1082195) Create force-installed extension and user -// affiliation test mixins to replace this class. +// TODO(https://crbug.com/1082195) Create user affiliation test mixin to use in +// this class. + +// TODO(https://crbug.com/1129486) This class is duplicating mixin functionality +// from MixinBasedInProcessBrowserTest. Move this into its own class and inherit +// from it instead. // Helper class to test force-installed extensions in a // affiliated/non-affiliated user profile. @@ -38,13 +44,21 @@ protected: // ExtensionApiTest + void SetUp() override; void SetUpCommandLine(base::CommandLine* command_line) override; + void SetUpDefaultCommandLine(base::CommandLine* command_line) override; + bool SetUpUserDataDirectory() override; void SetUpInProcessBrowserTestFixture() override; + void CreatedBrowserMainParts( + content::BrowserMainParts* browser_main_parts) override; void SetUpOnMainThread() override; + void TearDownOnMainThread() override; + void TearDownInProcessBrowserTestFixture() override; + void TearDown() override; const extensions::Extension* ForceInstallExtension( - const extensions::ExtensionId& extension_id, - const std::string& update_manifest_path); + const std::string& extension_path, + const std::string& pem_path); // Sets |custom_arg_value|, loads |page_url| and waits for an extension API // test pass/fail notification. @@ -60,6 +74,8 @@ policy::MockConfigurationPolicyProvider policy_provider_; chromeos::ScopedStubInstallAttributes test_install_attributes_; policy::DevicePolicyCrosTestHelper test_helper_; + InProcessBrowserTestMixinHost mixin_host_; + ExtensionForceInstallMixin force_install_mixin_{&mixin_host_}; }; } // namespace extensions
diff --git a/chrome/browser/extensions/api/tabs/tabs_event_router.cc b/chrome/browser/extensions/api/tabs/tabs_event_router.cc index 010798ec..f805d36 100644 --- a/chrome/browser/extensions/api/tabs/tabs_event_router.cc +++ b/chrome/browser/extensions/api/tabs/tabs_event_router.cc
@@ -203,9 +203,8 @@ break; } case TabStripModelChange::kRemoved: { - const bool will_be_deleted = change.GetRemove()->will_be_deleted; for (const auto& contents : change.GetRemove()->contents) { - if (will_be_deleted) { + if (contents.will_be_deleted) { DispatchTabClosingAt(tab_strip_model, contents.contents, contents.index); }
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 59c7011..001a336 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -45,6 +45,11 @@ "expiry_milestone": 88 }, { + "name": "account-management-flows-v2", + "owners": [ "anastasiian", "sinhak" ], + "expiry_milestone": 91 + }, + { "name": "add-web-content-drop-interaction", "owners": [ "edchin", "bling-flags@google.com" ], "expiry_milestone": 90 @@ -443,7 +448,7 @@ { "name": "camera-system-web-app", "owners": [ "chromeos-camera-eng@google.com" ], - "expiry_milestone": 89 + "expiry_milestone": 92 }, { "name": "cast-media-route-provider", @@ -3711,8 +3716,8 @@ }, { "name": "PasswordImport", - "owners": [ "vasilii" ], - "expiry_milestone": 88 + "owners": [ "jdoerrie", "vasilii" ], + "expiry_milestone": 92 }, { "name": "passwords-account-storage",
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 751efc4a..0b6ef87 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -3569,6 +3569,13 @@ #if defined(OS_CHROMEOS) +const char kAccountManagementFlowsV2Name[] = + "Enable redesign of account management flows"; +const char kAccountManagementFlowsV2Description[] = + "Enables redesign of account management flows and Account Manager page in " + "Settings. " + "See go/betterAM"; + const char kAcceleratedMjpegDecodeName[] = "Hardware-accelerated mjpeg decode for captured frame"; const char kAcceleratedMjpegDecodeDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 9385ffc..a29688a2 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -2069,6 +2069,9 @@ #if defined(OS_CHROMEOS) +extern const char kAccountManagementFlowsV2Name[]; +extern const char kAccountManagementFlowsV2Description[]; + extern const char kAcceleratedMjpegDecodeName[]; extern const char kAcceleratedMjpegDecodeDescription[];
diff --git a/chrome/browser/metrics/desktop_session_duration/audible_contents_tracker.cc b/chrome/browser/metrics/desktop_session_duration/audible_contents_tracker.cc index 7cdc4460..06ef4ecc 100644 --- a/chrome/browser/metrics/desktop_session_duration/audible_contents_tracker.cc +++ b/chrome/browser/metrics/desktop_session_duration/audible_contents_tracker.cc
@@ -37,9 +37,8 @@ const TabStripModelChange& change, const TabStripSelectionChange& selection) { if (change.type() == TabStripModelChange::kRemoved) { - auto* remove = change.GetRemove(); - if (remove->will_be_deleted) { - for (const auto& contents : remove->contents) + for (const auto& contents : change.GetRemove()->contents) { + if (contents.will_be_deleted) RemoveAudibleWebContents(contents.contents); } } else if (change.type() == TabStripModelChange::kReplaced) {
diff --git a/chrome/browser/picture_in_picture/picture_in_picture_window_controller_browsertest.cc b/chrome/browser/picture_in_picture/picture_in_picture_window_controller_browsertest.cc index ef6e5b6..5e556624 100644 --- a/chrome/browser/picture_in_picture/picture_in_picture_window_controller_browsertest.cc +++ b/chrome/browser/picture_in_picture/picture_in_picture_window_controller_browsertest.cc
@@ -2851,36 +2851,6 @@ ExpectLeavePictureInPicture(active_web_contents); } -IN_PROC_BROWSER_TEST_F(PictureInPictureWindowControllerBrowserTest, - UpdateMaxSize) { - LoadTabAndEnterPictureInPicture( - browser(), base::FilePath(kPictureInPictureWindowSizePage)); - - content::WebContents* active_web_contents = - browser()->tab_strip_model()->GetActiveWebContents(); - ASSERT_NE(nullptr, active_web_contents); - - OverlayWindowViews* overlay_window = static_cast<OverlayWindowViews*>( - window_controller()->GetWindowForTesting()); - ASSERT_TRUE(overlay_window); - - // Size should be half the work area. - gfx::Size window_size(100, 100); - window_size = overlay_window->UpdateMaxSize(gfx::Rect(100, 100), window_size); - EXPECT_EQ(gfx::Size(50, 50), window_size); - EXPECT_EQ(gfx::Size(50, 50), overlay_window->GetMaximumSize()); - - // If the max size increases then we should keep the existing window size. - window_size = overlay_window->UpdateMaxSize(gfx::Rect(200, 200), window_size); - EXPECT_EQ(gfx::Size(50, 50), window_size); - EXPECT_EQ(gfx::Size(100, 100), overlay_window->GetMaximumSize()); - - // If the max size decreases then we should shrink to fit. - window_size = overlay_window->UpdateMaxSize(gfx::Rect(50, 50), window_size); - EXPECT_EQ(gfx::Size(25, 25), window_size); - EXPECT_EQ(gfx::Size(25, 25), overlay_window->GetMaximumSize()); -} - // Tests that play/pause video playback is toggled if there are no focus // afforfances on the Picture-in-Picture window buttons when user hits space // keyboard key.
diff --git a/chrome/browser/policy/audio_sandbox_enabled_browsertest.cc b/chrome/browser/policy/audio_sandbox_enabled_browsertest.cc new file mode 100644 index 0000000..19481a6 --- /dev/null +++ b/chrome/browser/policy/audio_sandbox_enabled_browsertest.cc
@@ -0,0 +1,73 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/feature_list.h" +#include "base/optional.h" +#include "base/values.h" +#include "chrome/browser/media/audio_service_util.h" +#include "chrome/browser/policy/chrome_browser_policy_connector.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "components/policy/core/common/mock_configuration_policy_provider.h" +#include "components/policy/core/common/policy_map.h" +#include "components/policy/core/common/policy_types.h" +#include "components/policy/policy_constants.h" +#include "content/public/common/content_features.h" +#include "content/public/test/browser_test.h" +#include "sandbox/policy/features.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace policy { + +class AudioSandboxEnabledTest + : public InProcessBrowserTest, + public ::testing::WithParamInterface< + /*policy::key::kAllowAudioSandbox=*/base::Optional<bool>> { + public: + // InProcessBrowserTest implementation: + void SetUp() override { + EXPECT_CALL(policy_provider_, IsInitializationComplete(testing::_)) + .WillRepeatedly(testing::Return(true)); + policy::PolicyMap values; + if (GetParam().has_value()) { + values.Set(policy::key::kAudioSandboxEnabled, + policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_MACHINE, + policy::POLICY_SOURCE_CLOUD, base::Value(*GetParam()), + nullptr); + } + policy_provider_.UpdateChromePolicy(values); + policy::BrowserPolicyConnector::SetPolicyProviderForTesting( + &policy_provider_); + + InProcessBrowserTest::SetUp(); + } + + private: + policy::MockConfigurationPolicyProvider policy_provider_; +}; + +IN_PROC_BROWSER_TEST_P(AudioSandboxEnabledTest, IsRespected) { + base::Optional<bool> enable_sandbox_via_policy = GetParam(); + bool is_sandbox_enabled_by_default = + base::FeatureList::IsEnabled(features::kAudioServiceSandbox); + + ASSERT_EQ(enable_sandbox_via_policy.value_or(is_sandbox_enabled_by_default), + IsAudioServiceSandboxEnabled()); +} + +INSTANTIATE_TEST_SUITE_P( + Enabled, + AudioSandboxEnabledTest, + ::testing::Values(/*policy::key::kAudioSandboxEnabled=*/true)); + +INSTANTIATE_TEST_SUITE_P( + Disabled, + AudioSandboxEnabledTest, + ::testing::Values(/*policy::key::kAudioSandboxEnabled=*/false)); + +INSTANTIATE_TEST_SUITE_P( + NotSet, + AudioSandboxEnabledTest, + ::testing::Values(/*policy::key::kAudioSandboxEnabled=*/base::nullopt)); + +} // namespace policy
diff --git a/chrome/browser/policy/extension_force_install_mixin.cc b/chrome/browser/policy/extension_force_install_mixin.cc index b35ef1c..6f48414 100644 --- a/chrome/browser/policy/extension_force_install_mixin.cc +++ b/chrome/browser/policy/extension_force_install_mixin.cc
@@ -29,6 +29,11 @@ #include "chrome/browser/profiles/profile.h" #include "components/crx_file/crx_verifier.h" #include "components/crx_file/id_util.h" +#include "components/policy/core/common/mock_configuration_policy_provider.h" +#include "components/policy/core/common/policy_map.h" +#include "components/policy/core/common/policy_namespace.h" +#include "components/policy/core/common/policy_types.h" +#include "components/policy/policy_constants.h" #include "components/prefs/pref_change_registrar.h" #include "components/prefs/pref_service.h" #include "extensions/browser/extension_creator.h" @@ -325,8 +330,6 @@ return ParseExtensionManifestData(temp_dir.GetPath(), extension_version); } -#if defined(OS_CHROMEOS) - std::string MakeForceInstallPolicyItemValue( const extensions::ExtensionId& extension_id, const GURL& update_manifest_url) { @@ -336,6 +339,35 @@ update_manifest_url.spec().c_str()); } +void UpdatePolicyViaMockPolicyProvider( + const extensions::ExtensionId& extension_id, + const GURL& update_manifest_url, + policy::MockConfigurationPolicyProvider* mock_policy_provider) { + const std::string policy_item_value = + MakeForceInstallPolicyItemValue(extension_id, update_manifest_url); + policy::PolicyMap policy_map; + policy_map.CopyFrom( + mock_policy_provider->policies().Get(policy::PolicyNamespace( + policy::POLICY_DOMAIN_CHROME, /*component_id=*/std::string()))); + policy::PolicyMap::Entry* const existing_entry = + policy_map.GetMutable(policy::key::kExtensionInstallForcelist); + if (existing_entry) { + // Append to the existing policy. + existing_entry->value()->Append(policy_item_value); + } else { + // Set the new policy value. + base::Value policy_value(base::Value::Type::LIST); + policy_value.Append(policy_item_value); + policy_map.Set(policy::key::kExtensionInstallForcelist, + policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, + policy::POLICY_SOURCE_CLOUD, std::move(policy_value), + /*external_data_fetcher=*/nullptr); + } + mock_policy_provider->UpdateChromePolicy(policy_map); +} + +#if defined(OS_CHROMEOS) + void UpdatePolicyViaDeviceStateMixin( const extensions::ExtensionId& extension_id, const GURL& update_manifest_url, @@ -369,6 +401,17 @@ ExtensionForceInstallMixin::~ExtensionForceInstallMixin() = default; +void ExtensionForceInstallMixin::InitWithMockPolicyProvider( + Profile* profile, + policy::MockConfigurationPolicyProvider* mock_policy_provider) { + DCHECK(profile); + DCHECK(mock_policy_provider); + DCHECK(!profile_) << "Init already called"; + DCHECK(!mock_policy_provider_); + profile_ = profile; + mock_policy_provider_ = mock_policy_provider; +} + #if defined(OS_CHROMEOS) void ExtensionForceInstallMixin::InitWithDeviceStateMixin( @@ -605,6 +648,11 @@ const GURL& update_manifest_url) { DCHECK(profile_) << "Init not called"; + if (mock_policy_provider_) { + UpdatePolicyViaMockPolicyProvider(extension_id, update_manifest_url, + mock_policy_provider_); + return true; + } #if defined(OS_CHROMEOS) if (device_state_mixin_) { UpdatePolicyViaDeviceStateMixin(extension_id, update_manifest_url,
diff --git a/chrome/browser/policy/extension_force_install_mixin.h b/chrome/browser/policy/extension_force_install_mixin.h index 95cc59cb..668d50a 100644 --- a/chrome/browser/policy/extension_force_install_mixin.h +++ b/chrome/browser/policy/extension_force_install_mixin.h
@@ -25,6 +25,10 @@ class Extension; } // namespace extensions +namespace policy { +class MockConfigurationPolicyProvider; +} // namespace policy + #if defined(OS_CHROMEOS) namespace chromeos { @@ -92,6 +96,10 @@ // Use one of the Init*() methods to initialize the object before calling any // other method: + void InitWithMockPolicyProvider( + Profile* profile, + policy::MockConfigurationPolicyProvider* mock_policy_provider); + #if defined(OS_CHROMEOS) void InitWithDeviceStateMixin(Profile* profile, chromeos::DeviceStateMixin* device_state_mixin); @@ -177,6 +185,7 @@ base::ScopedTempDir temp_dir_; net::EmbeddedTestServer embedded_test_server_; Profile* profile_ = nullptr; + policy::MockConfigurationPolicyProvider* mock_policy_provider_ = nullptr; #if defined(OS_CHROMEOS) chromeos::DeviceStateMixin* device_state_mixin_ = nullptr; policy::DevicePolicyCrosTestHelper* device_policy_cros_test_helper_ = nullptr;
diff --git a/chrome/browser/policy/extension_policy_browsertest.cc b/chrome/browser/policy/extension_policy_browsertest.cc index 4c063c08..2099785 100644 --- a/chrome/browser/policy/extension_policy_browsertest.cc +++ b/chrome/browser/policy/extension_policy_browsertest.cc
@@ -56,6 +56,7 @@ #include "extensions/browser/test_extension_registry_observer.h" #include "extensions/browser/updater/extension_cache_fake.h" #include "extensions/common/constants.h" +#include "extensions/common/feature_switch.h" #include "extensions/common/features/feature_channel.h" #include "extensions/common/file_util.h" #include "extensions/common/manifest.h" @@ -1646,6 +1647,12 @@ // Verifies that extensions that are recommended-installed by policies are // installed, can be disabled but not uninstalled. + // External extensions are initially disabled for windows and MacOS. The users + // are prompted before enabling them. Explicitly override the flag with + // 'false' to disable prompting. + extensions::FeatureSwitch::ScopedOverride external_prompt_override( + extensions::FeatureSwitch::prompt_for_external_extensions(), false); + ExtensionRequestInterceptor interceptor; // Extensions that are force-installed come from an update URL, which defaults @@ -1680,19 +1687,12 @@ extensions::TestExtensionRegistryObserver observer(registry); UpdateProviderPolicy(policies); observer.WaitForExtensionWillBeInstalled(); - - // TODO(crbug.com/1006342): There is a race condition here where the extension - // may or may not be enabled by the time we get here. EXPECT_TRUE(registry->GetExtensionById( - kGoodCrxId, extensions::ExtensionRegistry::ENABLED | - extensions::ExtensionRegistry::DISABLED)); + kGoodCrxId, extensions::ExtensionRegistry::ENABLED)); // The user is not allowed to uninstall recommended-installed extensions. UninstallExtension(kGoodCrxId, false); - // Explicitly re-enables the extension. - service->EnableExtension(kGoodCrxId); - // But the user is allowed to disable them. EXPECT_TRUE(service->IsExtensionEnabled(kGoodCrxId)); DisableExtension(kGoodCrxId);
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 0f6c871..5b05bd1 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc
@@ -66,7 +66,6 @@ #include "chrome/browser/download/download_prefs.h" #include "chrome/browser/extensions/api/chrome_extensions_api_client.h" #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" -#include "chrome/browser/media/audio_service_util.h" #include "chrome/browser/media/webrtc/webrtc_event_log_manager.h" #include "chrome/browser/net/prediction_options.h" #include "chrome/browser/policy/chrome_browser_policy_connector.h" @@ -113,7 +112,6 @@ #include "components/omnibox/browser/omnibox_view.h" #include "components/policy/core/browser/browser_policy_connector.h" #include "components/policy/core/common/external_data_fetcher.h" -#include "components/policy/core/common/mock_configuration_policy_provider.h" #include "components/policy/core/common/policy_map.h" #include "components/policy/core/common/policy_pref_names.h" #include "components/policy/core/common/policy_service.h" @@ -1812,61 +1810,4 @@ EXPECT_TRUE(prefs->GetBoolean(prefs::kSharedClipboardEnabled)); } -#if defined(OS_WIN) || defined(OS_MAC) || \ - (defined(OS_LINUX) && !defined(OS_CHROMEOS)) - -class AudioSandboxEnabledTest - : public InProcessBrowserTest, - public ::testing::WithParamInterface< - /*policy::key::kAllowAudioSandbox=*/base::Optional<bool>> { - public: - // InProcessBrowserTest implementation: - void SetUp() override { - EXPECT_CALL(policy_provider_, IsInitializationComplete(testing::_)) - .WillRepeatedly(testing::Return(true)); - policy::PolicyMap values; - if (GetParam().has_value()) { - values.Set(policy::key::kAudioSandboxEnabled, - policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_MACHINE, - policy::POLICY_SOURCE_CLOUD, base::Value(*GetParam()), - nullptr); - } - policy_provider_.UpdateChromePolicy(values); - policy::BrowserPolicyConnector::SetPolicyProviderForTesting( - &policy_provider_); - - InProcessBrowserTest::SetUp(); - } - - private: - policy::MockConfigurationPolicyProvider policy_provider_; -}; - -IN_PROC_BROWSER_TEST_P(AudioSandboxEnabledTest, IsRespected) { - base::Optional<bool> enable_sandbox_via_policy = GetParam(); - bool is_sandbox_enabled_by_default = - base::FeatureList::IsEnabled(features::kAudioServiceSandbox); - - ASSERT_EQ(enable_sandbox_via_policy.value_or(is_sandbox_enabled_by_default), - IsAudioServiceSandboxEnabled()); -} - -INSTANTIATE_TEST_SUITE_P( - Enabled, - AudioSandboxEnabledTest, - ::testing::Values(/*policy::key::kAudioSandboxEnabled=*/true)); - -INSTANTIATE_TEST_SUITE_P( - Disabled, - AudioSandboxEnabledTest, - ::testing::Values(/*policy::key::kAudioSandboxEnabled=*/false)); - -INSTANTIATE_TEST_SUITE_P( - NotSet, - AudioSandboxEnabledTest, - ::testing::Values(/*policy::key::kAudioSandboxEnabled=*/base::nullopt)); - -#endif // defined(OS_WIN) || defined (OS_MAC) || (defined(OS_LINUX) && - // !defined(OS_CHROMEOS)) - } // namespace policy
diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java index 27dc28d..7a40229bb 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java
@@ -531,6 +531,12 @@ public static final String PREFETCH_NOTIFICATION_TIME = "prefetch_notification_shown_time"; public static final String PREFETCH_OFFLINE_COUNTER = "prefetch_notification_offline_counter"; + /** + * Whether users turn on the feature track prices on tabs. + */ + public static final String PRICE_TRACKING_TRACK_PRICES_ON_TABS = + "Chrome.PriceTracking.TrackPricesOnTabs"; + public static final String PRIVACY_METRICS_REPORTING = "metrics_reporting"; public static final String PRIVACY_METRICS_IN_SAMPLE = "in_metrics_sample"; public static final String PRIVACY_NETWORK_PREDICTIONS = "network_predictions"; @@ -831,6 +837,7 @@ IMAGE_DESCRIPTIONS_JUST_ONCE_COUNT, IMAGE_DESCRIPTIONS_DONT_ASK_AGAIN, PERSISTENT_OFFLINE_CONTENT_AVAILABILITY_STATUS, + PRICE_TRACKING_TRACK_PRICES_ON_TABS, PROMO_IS_DISMISSED.pattern(), PROMO_TIMES_SEEN.pattern(), SETTINGS_SAFETY_CHECK_LAST_RUN_TIMESTAMP,
diff --git a/chrome/browser/profiles/profile_metrics.cc b/chrome/browser/profiles/profile_metrics.cc index b5f34b3..5bdf752f 100644 --- a/chrome/browser/profiles/profile_metrics.cc +++ b/chrome/browser/profiles/profile_metrics.cc
@@ -19,6 +19,7 @@ #include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/signin/chrome_signin_helper.h" +#include "chrome/browser/ui/signin/profile_colors_util.h" #include "chrome/common/chrome_constants.h" #include "chrome/installer/util/google_update_settings.h" #include "components/profile_metrics/browser_profile_type.h" @@ -65,6 +66,37 @@ return metric; } +profile_metrics::ProfileColorsUniqueness GetProfileColorsUniqueness( + ProfileAttributesStorage* storage) { +#if defined(OS_ANDROID) + return profile_metrics::ProfileColorsUniqueness::kSingleProfile; +#else + std::vector<ProfileAttributesEntry*> entries = + storage->GetAllProfilesAttributes(); + DCHECK(!entries.empty()); + if (entries.size() == 1u) + return profile_metrics::ProfileColorsUniqueness::kSingleProfile; + + size_t default_colors_count = 0; + std::set<ProfileThemeColors> used_colors; + for (ProfileAttributesEntry* entry : entries) { + base::Optional<ProfileThemeColors> profile_colors = + entry->GetProfileThemeColorsIfSet(); + if (!profile_colors) { + default_colors_count++; + } else if (!base::Contains(used_colors, *profile_colors)) { + used_colors.insert(*profile_colors); + } else { + return profile_metrics::ProfileColorsUniqueness::kRepeated; + } + } + return default_colors_count > 1u + ? profile_metrics::ProfileColorsUniqueness:: + kUniqueExceptForRepeatedDefault + : profile_metrics::ProfileColorsUniqueness::kUnique; +#endif +} + } // namespace // This enum is used for histograms. Do not change existing values. Append new @@ -143,6 +175,7 @@ return true; } +// static void ProfileMetrics::CountProfileInformation(ProfileAttributesStorage* storage, profile_metrics::Counts* counts) { size_t number_of_profiles = storage->GetNumberOfProfiles(); @@ -172,6 +205,7 @@ } } } + counts->colors_uniqueness = GetProfileColorsUniqueness(storage); } profile_metrics::BrowserProfileType ProfileMetrics::GetBrowserProfileType(
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_get_more.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_get_more.html index e036858..c4c639b 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_get_more.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_get_more.html
@@ -2,6 +2,7 @@ Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> <link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> <dom-module id="assistant-get-more"> <template>
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_loading.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_loading.html index 573eeb1..431a0f9 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_loading.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_loading.html
@@ -7,6 +7,7 @@ <link rel="import" href="chrome://resources/polymer/v1_0/paper-progress/paper-progress.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> <dom-module id="assistant-loading"> <template>
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_optin.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_optin.html index 3ff9e09..c81448c 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_optin.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_optin.html
@@ -22,16 +22,15 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> <include src="../login/components/oobe_buttons.html"> -<include src="../login/components/oobe_dialog.html"> <include src="assistant_optin_flow.html"> <link rel="stylesheet" href="chrome://resources/css/text_defaults.css"> <link rel="stylesheet" href="chrome://resources/css/chrome_shared.css"> <link rel="stylesheet" href="../login/md_screen_container.css"> <link rel="stylesheet" href="../login/oobe_screen.css"> -<link rel="stylesheet" href="../login/components/oobe_dialog.css"> <link rel="stylesheet" href="../../../../../ui/login/oobe.css"> <link rel="stylesheet" href="setting_zippy.css"> <style include="cr-icons cr-shared-style oobe-common"></style>
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_optin.js b/chrome/browser/resources/chromeos/assistant_optin/assistant_optin.js index 20e0a2a..5795db4 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_optin.js +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_optin.js
@@ -5,7 +5,6 @@ // <include src="../login/components/oobe_types.js"> // <include src="../login/components/oobe_buttons.js"> // <include src="../login/components/oobe_dialog_host_behavior.js"> -// <include src="../login/components/oobe_dialog.js"> // <include src="assistant_optin_flow.js"> // <include src="browser_proxy.js">
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_optin_flow.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_optin_flow.html index e127fe1d..eb1d274 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_optin_flow.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_optin_flow.html
@@ -16,6 +16,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> <dom-module id="assistant-optin-flow"> <template>
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_related_info.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_related_info.html index d94a6c5..ea682de 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_related_info.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_related_info.html
@@ -2,6 +2,9 @@ Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> +<link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> + <dom-module id="assistant-related-info"> <template> <style include="oobe-dialog-host">
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_third_party.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_third_party.html index b9364dc42..ed00bdf86 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_third_party.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_third_party.html
@@ -3,6 +3,7 @@ found in the LICENSE file. --> <link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> <dom-module id="assistant-third-party"> <template>
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_value_prop.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_value_prop.html index ee6b2ba..1333957 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_value_prop.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_value_prop.html
@@ -6,6 +6,7 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> <dom-module id="assistant-value-prop"> <template>
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_voice_match.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_voice_match.html index faa02d8..59c724c 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_voice_match.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_voice_match.html
@@ -7,6 +7,7 @@ <link rel="import" href="chrome://resources/cr_elements/cr_lottie/cr_lottie.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> <dom-module id="assistant-voice-match"> <template>
diff --git a/chrome/browser/resources/chromeos/login/BUILD.gn b/chrome/browser/resources/chromeos/login/BUILD.gn index 6043ba9..d986f2d 100644 --- a/chrome/browser/resources/chromeos/login/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/BUILD.gn
@@ -67,6 +67,7 @@ "components:fake_oobe", "components:login_screen_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", "//ui/webui/resources/js/cr/ui:dialogs", ] @@ -77,6 +78,7 @@ ":oobe_select", "components:login_screen_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", "//ui/webui/resources/cr_elements/cr_input:cr_input", "//ui/webui/resources/js:load_time_data", @@ -85,6 +87,7 @@ js_library("multidevice_setup_first_run") { deps = [ + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", "//ui/webui/resources/cr_components/chromeos/multidevice_setup:mojo_api", "//ui/webui/resources/cr_components/chromeos/multidevice_setup:multidevice_setup", @@ -93,13 +96,17 @@ } js_library("active_directory_password_change") { - deps = [ "components/oobe_i18n_behavior:oobe_i18n_behavior" ] + deps = [ + "components/oobe_dialog:oobe_dialog", + "components/oobe_i18n_behavior:oobe_i18n_behavior" + ] } js_library("app_downloading") { deps = [ "components:login_screen_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -108,6 +115,7 @@ deps = [ "components:oobe_dialog_host_behavior", "components:oobe_help_dialog", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -116,6 +124,7 @@ deps = [ "components:login_screen_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -125,6 +134,7 @@ "components:login_screen_behavior", "components:multi_step_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -134,6 +144,7 @@ "components:login_screen_behavior", "components:multi_step_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -142,6 +153,7 @@ deps = [ "components:login_screen_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -149,6 +161,7 @@ js_library("fingerprint_setup") { deps = [ "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", "//ui/webui/resources/cr_elements/cr_fingerprint:cr_fingerprint_progress_arc", "//ui/webui/resources/cr_elements/cr_lottie:cr_lottie", @@ -172,6 +185,7 @@ "components:login_screen_behavior", "components:multi_step_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -180,6 +194,7 @@ deps = [ "components:login_screen_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -187,6 +202,7 @@ js_library("marketing_opt_in") { deps = [ "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -207,6 +223,7 @@ js_library("offline_gaia") { deps = [ "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -219,6 +236,7 @@ "components:login_screen_behavior", "components:multi_step_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -227,6 +245,7 @@ deps = [ "components:login_screen_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -235,7 +254,7 @@ deps = [ ":web_view_helper", "components:login_screen_behavior", - "components:oobe_dialog", + "components/oobe_dialog:oobe_dialog", "components:oobe_dialog_host_behavior", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] @@ -248,6 +267,7 @@ js_library("oobe_network") { deps = [ "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -255,6 +275,7 @@ js_library("oobe_reset") { deps = [ "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -263,6 +284,7 @@ deps = [ "components:login_screen_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -271,6 +293,7 @@ deps = [ "components:login_screen_behavior", "components:multi_step_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -279,6 +302,7 @@ deps = [ "components:login_screen_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -287,6 +311,7 @@ deps = [ "components:login_screen_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -295,6 +320,7 @@ deps = [ "components:login_screen_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -305,6 +331,7 @@ "components:multi_step_behavior", "components:oobe_dialog_host_behavior", "components:oobe_types", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -314,6 +341,7 @@ "components:login_screen_behavior", "components:multi_step_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -321,6 +349,7 @@ js_library("saml_confirm_password") { deps = [ "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -328,6 +357,7 @@ js_library("sync_consent") { deps = [ "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] } @@ -337,6 +367,7 @@ "components:login_screen_behavior", "components:multi_step_behavior", "components:oobe_dialog_host_behavior", + "components/oobe_dialog:oobe_dialog", "components/oobe_i18n_behavior:oobe_i18n_behavior", ] }
diff --git a/chrome/browser/resources/chromeos/login/app_downloading.html b/chrome/browser/resources/chromeos/login/app_downloading.html index 877dd0e..9fbf4191 100644 --- a/chrome/browser/resources/chromeos/login/app_downloading.html +++ b/chrome/browser/resources/chromeos/login/app_downloading.html
@@ -7,6 +7,7 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <dom-module id="app-downloading-element">
diff --git a/chrome/browser/resources/chromeos/login/arc_terms_of_service.html b/chrome/browser/resources/chromeos/login/arc_terms_of_service.html index a9907c8..27906b6 100644 --- a/chrome/browser/resources/chromeos/login/arc_terms_of_service.html +++ b/chrome/browser/resources/chromeos/login/arc_terms_of_service.html
@@ -9,6 +9,7 @@ <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> <link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <link rel="import" href="/components/throbber_notice.html">
diff --git a/chrome/browser/resources/chromeos/login/checking_downloading_update.html b/chrome/browser/resources/chromeos/login/checking_downloading_update.html index fe85913..f705055 100644 --- a/chrome/browser/resources/chromeos/login/checking_downloading_update.html +++ b/chrome/browser/resources/chromeos/login/checking_downloading_update.html
@@ -8,6 +8,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <!--
diff --git a/chrome/browser/resources/chromeos/login/components/BUILD.gn b/chrome/browser/resources/chromeos/login/components/BUILD.gn index e276f547..e9d3d4c 100644 --- a/chrome/browser/resources/chromeos/login/components/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/components/BUILD.gn
@@ -24,7 +24,6 @@ ":login_screen_behavior", ":multi_step_behavior", ":oobe_buttons", - ":oobe_dialog", ":oobe_dialog_host_behavior", ":oobe_help_dialog", ":oobe_types", @@ -62,14 +61,6 @@ deps = [ "oobe_i18n_behavior:oobe_i18n_behavior" ] } -js_library("oobe_dialog") { - deps = [ - ":fake_oobe", - "//ui/webui/resources/cr_elements/cr_lazy_render:cr_lazy_render", - ] - externs_list = [ "$externs_path/pending.js" ] -} - js_library("oobe_dialog_host_behavior") { }
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_dialog.css b/chrome/browser/resources/chromeos/login/components/oobe_dialog.css deleted file mode 100644 index bbc934a..0000000 --- a/chrome/browser/resources/chromeos/login/components/oobe_dialog.css +++ /dev/null
@@ -1,136 +0,0 @@ -/* Copyright 2016 The Chromium Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. */ - -:host { - --title-font-distance-to-baseline: 7px; - --subtitle-font-size: --oobe-default-font-size; - --subtitle-font-distance-to-baseline: 3px; - --subtitle-line-height: 18px; - @apply --oobe-default-font; -} - - -:host([two-columns-adaptable]) #topScrollContainer { - flex-direction: var(--oobe-dialog-adaptable-flex-direction); -} - -#topScrollContainer { - border: transparent; - overflow-y: auto; -} - -#header-container { - padding-bottom: 0; - padding-inline-end: var(--oobe-dialog-content-padding); - padding-inline-start: var(--oobe-dialog-content-padding); - padding-top: var(--oobe-dialog-content-padding); -} - -#oobe-title { - padding-top: 20px; -} - -/* - * TODO(https://crbug.com/703984): remove the fallback class when fixed. - */ -#oobe-title ::slotted(h1), -#oobe-title .fallback { - color: var(--oobe-header-text-color); - @apply --oobe-header-font; - margin: 0; -} - -#oobe-subtitle { - padding-top: 8px; -} - -/* - * TODO(https://crbug.com/703984): remove the fallback class when fixed. - */ -#oobe-subtitle ::slotted(*), -#oobe-subtitle .fallback { - color: var(--oobe-subheader-text-color); - line-height: var(--subtitle-line-height); - overflow-wrap: break-word; - margin: 0; -} - -#footerContainer ::slotted(*) { - line-height: var(--subtitle-line-height); -} - -:host(:not([has-buttons])) #footerContainer { - margin-bottom: 40px; -} - -#oobe-progress ::slotted(paper-progress) { - --paper-progress-active-color: var(--google-blue-500); - --paper-progress-container-color: var(--google-blue-100); - height: 3px; - margin-top: 32px; - width: 100%; -} - -#footerContainer { - padding-bottom: 0; - padding-inline-end: var(--oobe-dialog-content-padding); - padding-inline-start: var(--oobe-dialog-content-padding); - - /* TODO(https://crbug.com/1017173) Make it adaptive. */ - padding-top: var(--oobe-dialog-content-padding-top); -} - -#footerContainer[noFooterPadding] { - padding: 0; -} - -#footerContainer[footerShrinkable] { - flex-shrink: 1; -} - - - -#topScrollContainer.can-scroll:not(.is-scrolled):not(.scrolled-to-bottom) { - background: linear-gradient(0deg, - rgba(var(--google-grey-refresh-100-rgb), 1) 0, - rgba(var(--google-grey-refresh-100-rgb), 0) 8px); - -} -#topScrollContainer.can-scroll.is-scrolled:not(.scrolled-to-bottom) { - background: linear-gradient(0deg, - rgba(var(--google-grey-refresh-100-rgb), 1) 0, - rgba(var(--google-grey-refresh-100-rgb), 0) 8px), - linear-gradient(180deg, - rgba(var(--google-grey-refresh-100-rgb), 1) 0, - rgba(var(--google-grey-refresh-100-rgb), 0) 8px); -} -#topScrollContainer.is-scrolled.scrolled-to-bottom { - background: linear-gradient(180deg, - rgba(var(--google-grey-refresh-100-rgb), 1) 0, - rgba(var(--google-grey-refresh-100-rgb), 0) 8px); -} - -#oobe-bottom { - height: calc(var(--oobe-dialog-footer-height) - - 2 * var(--oobe-dialog-footer-padding)); - /* Width: real padding - button margin */ - padding: var(--oobe-dialog-footer-padding) - calc(var(--oobe-dialog-footer-padding) - 4px); - z-index: 1; -} - -:host #oobe-bottom[no-buttons-padding] { - padding: unset; -} - -#oobe-icon-div ::slotted(hd-iron-icon), -#oobe-icon-div ::slotted(iron-icon) { - --iron-icon-height: 32px; - --iron-icon-width: 32px; - --iron-icon-fill-color: var(--google-blue-600); -} - -.slot-container { - position: relative; -}
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_dialog.html b/chrome/browser/resources/chromeos/login/components/oobe_dialog.html deleted file mode 100644 index ae7cc50c..0000000 --- a/chrome/browser/resources/chromeos/login/components/oobe_dialog.html +++ /dev/null
@@ -1,120 +0,0 @@ -<!-- Copyright 2016 The Chromium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. --> - -<link rel="import" href="chrome://resources/html/polymer.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> -<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> -<link rel="import" href="chrome://resources/cr_elements/cr_scrollable_behavior.html"> -<link rel="import" href="chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.html"> - -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/oobe_i18n_behavior.html"> - -<!-- - Simple OOBE dialog which should be used for OOBE UI elements. - It has correct size and padding. It can display top left icon, and has - three parts: header (which should have <h1>title</h1>), footer (content part), - and optional buttons container at the bottom. - - When shown (i.e. when outside container calls .show()): - 1. If this dialog has tags in class "focus-on-show", the first one will be - focused. - 2. 'show-dialog' is fired. - - Please include oobe-dialog-host shared style if you use oobe-dialog. - - Example: - <style include="oobe-dialog-host"></style> - <oobe-dialog on-show-dialog="onTestDialogShown_" has-buttons> - <iron-icon ... slot="oobe-icon"> - <h1 slot="title">Title</h1> - <div slot="subtitle">Subtitle</div> - <div slot="footer"> - <div class="focus-on-show">...</div> - ... - </div> - <div slot="bottom-buttons"> - ... - </div> - </oobe-dialog> - - Add class |header| to all which you want to go inside the header. Similar - with clases |footer|, |bottom-buttons|. - - For single-DPI image |oobe-icon| class should be used. To select between two - images of different DPI, |oobe-icon-1x| and |oobe-icon-2x| should be used - instead. For example: - - <iron-icon icon="icon1" ... slot="oobe-icon" class="oobe-icon-1x"> - <iron-icon icon-"icon2" ... slot="oobe-icon" class="oobe-icon-2x"> - - |bottom-buttons| block is shown only if |has-buttons| attribute is set. - Please keep |bottom-buttons| block as simple as possible. Ideally just a div - with oobe buttons. No custom styles, etc. - - Attributes: - no-header - hides header - no-footer-padding - disables footer padding. - has-buttons - shows bottom buttons menu - footer-shrinkable - whether footer should be shrunk to fit the container. - Most likely should be set for oobe-illustration's. - title-key - ID of localized string to be used as default title element. - subtitle-key - ID of localized string to be used as default subtitle - element. - - two-columns-adaptable - if set layout might switch to two columns instead of - one when there is not enough vertical space for elements. Left column - would contain header-container, right columnn would contain - footerContainer. Bottom buttons are not affected. See oobe.css for - conditions. - - I.e. [no-header no-footer-padding] will make the footer occupy all the dialog - space. ---> -<dom-module id="oobe-dialog"> - <template> - <style include="oobe-dialog-host"></style> - <link rel="stylesheet" href="oobe_dialog.css"> - <style include="cr-shared-style"></style> - <cr-lazy-render id="lazy"> - <template> - <div id="topScrollContainer" class="layout vertical flex"> - <div id="header-container" hidden="[[noHeader]]"> - <div id="oobe-icon-div" class="slot-container"> - <slot name="oobe-icon"></slot> - </div> - <div id="oobe-title" class="slot-container layout vertical - end-justified"> - <slot name="title"> - <h1 class="fallback">[[i18nDynamic(locale, titleKey)]]</h1> - </slot> - </div> - <div id="oobe-subtitle" class="slot-container layout vertical"> - <slot name="subtitle"> - <div class="fallback">[[i18nDynamic(locale, subtitleKey)]]</div> - </slot> - </div> - <div id="oobe-progress" class="slot-container layout vertical"> - <slot name="progress"></slot> - </div> - </div> - <div id="footerContainer" noFooterPadding$="[[noFooterPadding]]" - footerShrinkable$="[[footerShrinkable]]" - class="slot-container flex-grow layout vertical"> - <slot name="footer"></slot> - </div> - </div> - <template is="dom-if" if="[[hasButtons]]"> - <div id="oobe-bottom" hideShadow$="[[hideShadow]]" - class="slot-container layout horizontal"> - <slot name="back-navigation"></slot> - <div class="flex"></div> - <slot name="bottom-buttons"></slot> - </div> - </template> - </template> - </cr-lazy-render> - </template> -</dom-module> -
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_dialog/BUILD.gn b/chrome/browser/resources/chromeos/login/components/oobe_dialog/BUILD.gn new file mode 100644 index 0000000..48fbb25 --- /dev/null +++ b/chrome/browser/resources/chromeos/login/components/oobe_dialog/BUILD.gn
@@ -0,0 +1,17 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/closure_compiler/compile_js.gni") + +js_type_check("closure_compile") { + deps = [ ":oobe_dialog" ] +} + +js_library("oobe_dialog") { + deps = [ + "//ui/webui/resources/cr_elements/cr_lazy_render:cr_lazy_render", + "../oobe_i18n_behavior:oobe_i18n_behavior", + ] + externs_list = [ "$externs_path/pending.js" ] +}
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_dialog/oobe_dialog.html b/chrome/browser/resources/chromeos/login/components/oobe_dialog/oobe_dialog.html new file mode 100644 index 0000000..1e75695e --- /dev/null +++ b/chrome/browser/resources/chromeos/login/components/oobe_dialog/oobe_dialog.html
@@ -0,0 +1,253 @@ +<!-- Copyright 2016 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> + +<link rel="import" href="chrome://resources/html/polymer.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> +<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> +<link rel="import" href="chrome://resources/cr_elements/cr_scrollable_behavior.html"> +<link rel="import" href="chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.html"> + +<link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/oobe_i18n_behavior.html"> + +<!-- + Simple OOBE dialog which should be used for OOBE UI elements. + It has correct size and padding. It can display top left icon, and has + three parts: header (which should have <h1>title</h1>), footer (content part), + and optional buttons container at the bottom. + + When shown (i.e. when outside container calls .show()): + 1. If this dialog has tags in class "focus-on-show", the first one will be + focused. + 2. 'show-dialog' is fired. + + Please include oobe-dialog-host shared style if you use oobe-dialog. + + Example: + <style include="oobe-dialog-host"></style> + <oobe-dialog on-show-dialog="onTestDialogShown_" has-buttons> + <iron-icon ... slot="oobe-icon"> + <h1 slot="title">Title</h1> + <div slot="subtitle">Subtitle</div> + <div slot="footer"> + <div class="focus-on-show">...</div> + ... + </div> + <div slot="bottom-buttons"> + ... + </div> + </oobe-dialog> + + Add class |header| to all which you want to go inside the header. Similar + with classes |footer|, |bottom-buttons|. + + For single-DPI image |oobe-icon| class should be used. To select between two + images of different DPI, |oobe-icon-1x| and |oobe-icon-2x| should be used + instead. For example: + + <iron-icon icon="icon1" ... slot="oobe-icon" class="oobe-icon-1x"> + <iron-icon icon-"icon2" ... slot="oobe-icon" class="oobe-icon-2x"> + + |bottom-buttons| block is shown only if |has-buttons| attribute is set. + Please keep |bottom-buttons| block as simple as possible. Ideally just a div + with oobe buttons. No custom styles, etc. + + Attributes: + no-header - hides header + no-footer-padding - disables footer padding. + has-buttons - shows bottom buttons menu + footer-shrinkable - whether footer should be shrunk to fit the container. + Most likely should be set for oobe-illustration's. + title-key - ID of localized string to be used as default title element. + subtitle-key - ID of localized string to be used as default subtitle + element. + + two-columns-adaptable - if set layout might switch to two columns instead of + one when there is not enough vertical space for elements. Left column + would contain header-container, right column would contain + footerContainer. Bottom buttons are not affected. See oobe.css for + conditions. + + I.e. [no-header no-footer-padding] will make the footer occupy all the dialog + space. +--> +<dom-module id="oobe-dialog"> + <template> + <!-- + TODO(https://crbug.com/1143666): Do not use oobe-dialog-host. + Use oobe-dialog-common instead. + --> + <style include="oobe-dialog-host cr-shared-style"> + :host { + --title-font-distance-to-baseline: 7px; + --subtitle-font-size: --oobe-default-font-size; + --subtitle-font-distance-to-baseline: 3px; + --subtitle-line-height: 18px; + @apply --oobe-default-font; + } + + :host([two-columns-adaptable]) #topScrollContainer { + flex-direction: var(--oobe-dialog-adaptable-flex-direction); + } + + #topScrollContainer { + border: transparent; + overflow-y: auto; + } + + #header-container { + padding-bottom: 0; + padding-inline-end: var(--oobe-dialog-content-padding); + padding-inline-start: var(--oobe-dialog-content-padding); + padding-top: var(--oobe-dialog-content-padding); + } + + #oobe-title { + padding-top: 20px; + } + + /* + * TODO(https://crbug.com/703984): remove the fallback class when fixed. + */ + #oobe-title ::slotted(h1), + #oobe-title .fallback { + color: var(--oobe-header-text-color); + @apply --oobe-header-font; + margin: 0; + } + + #oobe-subtitle { + padding-top: 8px; + } + + /* + * TODO(https://crbug.com/703984): remove the fallback class when fixed. + */ + #oobe-subtitle ::slotted(*), + #oobe-subtitle .fallback { + color: var(--oobe-subheader-text-color); + line-height: var(--subtitle-line-height); + overflow-wrap: break-word; + margin: 0; + } + + #footerContainer ::slotted(*) { + line-height: var(--subtitle-line-height); + } + + :host(:not([has-buttons])) #footerContainer { + margin-bottom: 40px; + } + + #oobe-progress ::slotted(paper-progress) { + --paper-progress-active-color: var(--google-blue-500); + --paper-progress-container-color: var(--google-blue-100); + height: 3px; + margin-top: 32px; + width: 100%; + } + + #footerContainer { + padding-bottom: 0; + padding-inline-end: var(--oobe-dialog-content-padding); + padding-inline-start: var(--oobe-dialog-content-padding); + + /* TODO(https://crbug.com/1017173) Make it adaptive. */ + padding-top: var(--oobe-dialog-content-padding-top); + } + + #footerContainer[noFooterPadding] { + padding: 0; + } + + #footerContainer[footerShrinkable] { + flex-shrink: 1; + } + + #topScrollContainer.can-scroll:not(.is-scrolled):not(.scrolled-to-bottom) { + background: linear-gradient(0deg, + rgba(var(--google-grey-refresh-100-rgb), 1) 0, + rgba(var(--google-grey-refresh-100-rgb), 0) 8px); + + } + #topScrollContainer.can-scroll.is-scrolled:not(.scrolled-to-bottom) { + background: linear-gradient(0deg, + rgba(var(--google-grey-refresh-100-rgb), 1) 0, + rgba(var(--google-grey-refresh-100-rgb), 0) 8px), + linear-gradient(180deg, + rgba(var(--google-grey-refresh-100-rgb), 1) 0, + rgba(var(--google-grey-refresh-100-rgb), 0) 8px); + } + #topScrollContainer.is-scrolled.scrolled-to-bottom { + background: linear-gradient(180deg, + rgba(var(--google-grey-refresh-100-rgb), 1) 0, + rgba(var(--google-grey-refresh-100-rgb), 0) 8px); + } + + #oobe-bottom { + height: calc(var(--oobe-dialog-footer-height) + - 2 * var(--oobe-dialog-footer-padding)); + /* Width: real padding - button margin */ + padding: var(--oobe-dialog-footer-padding) + calc(var(--oobe-dialog-footer-padding) - 4px); + z-index: 1; + } + + :host #oobe-bottom[no-buttons-padding] { + padding: unset; + } + + #oobe-icon-div ::slotted(hd-iron-icon), + #oobe-icon-div ::slotted(iron-icon) { + --iron-icon-height: 32px; + --iron-icon-width: 32px; + --iron-icon-fill-color: var(--google-blue-600); + } + + .slot-container { + position: relative; + } + </style> + <cr-lazy-render id="lazy"> + <template> + <div id="topScrollContainer" class="layout vertical flex"> + <div id="header-container" hidden="[[noHeader]]"> + <div id="oobe-icon-div" class="slot-container"> + <slot name="oobe-icon"></slot> + </div> + <div id="oobe-title" class="slot-container layout vertical + end-justified"> + <slot name="title"> + <h1 class="fallback">[[i18nDynamic(locale, titleKey)]]</h1> + </slot> + </div> + <div id="oobe-subtitle" class="slot-container layout vertical"> + <slot name="subtitle"> + <div class="fallback">[[i18nDynamic(locale, subtitleKey)]]</div> + </slot> + </div> + <div id="oobe-progress" class="slot-container layout vertical"> + <slot name="progress"></slot> + </div> + </div> + <div id="footerContainer" noFooterPadding$="[[noFooterPadding]]" + footerShrinkable$="[[footerShrinkable]]" + class="slot-container flex-grow layout vertical"> + <slot name="footer"></slot> + </div> + </div> + <template is="dom-if" if="[[hasButtons]]"> + <div id="oobe-bottom" hideShadow$="[[hideShadow]]" + class="slot-container layout horizontal"> + <slot name="back-navigation"></slot> + <div class="flex"></div> + <slot name="bottom-buttons"></slot> + </div> + </template> + </template> + </cr-lazy-render> + </template> + <script src="oobe_dialog.js"></script> +</dom-module> +
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_dialog.js b/chrome/browser/resources/chromeos/login/components/oobe_dialog/oobe_dialog.js similarity index 100% rename from chrome/browser/resources/chromeos/login/components/oobe_dialog.js rename to chrome/browser/resources/chromeos/login/components/oobe_dialog/oobe_dialog.js
diff --git a/chrome/browser/resources/chromeos/login/demo_preferences.html b/chrome/browser/resources/chromeos/login/demo_preferences.html index bf5bc3b..efeab95 100644 --- a/chrome/browser/resources/chromeos/login/demo_preferences.html +++ b/chrome/browser/resources/chromeos/login/demo_preferences.html
@@ -4,6 +4,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <dom-module id="demo-preferences-element">
diff --git a/chrome/browser/resources/chromeos/login/demo_setup.html b/chrome/browser/resources/chromeos/login/demo_setup.html index 5928749..b99a1aa 100644 --- a/chrome/browser/resources/chromeos/login/demo_setup.html +++ b/chrome/browser/resources/chromeos/login/demo_setup.html
@@ -1,5 +1,6 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <link rel="import" href="/components/progress_list_item.html">
diff --git a/chrome/browser/resources/chromeos/login/device_disabled.html b/chrome/browser/resources/chromeos/login/device_disabled.html index a96aeb2..96e0797 100644 --- a/chrome/browser/resources/chromeos/login/device_disabled.html +++ b/chrome/browser/resources/chromeos/login/device_disabled.html
@@ -6,6 +6,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <dom-module id="device-disabled-element">
diff --git a/chrome/browser/resources/chromeos/login/discover/modules/discover_module_pin_setup.html b/chrome/browser/resources/chromeos/login/discover/modules/discover_module_pin_setup.html index 6f2c290..3fde21b 100644 --- a/chrome/browser/resources/chromeos/login/discover/modules/discover_module_pin_setup.html +++ b/chrome/browser/resources/chromeos/login/discover/modules/discover_module_pin_setup.html
@@ -9,6 +9,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/throbber_notice.html"> <dom-module id="discover-pin-setup-card">
diff --git a/chrome/browser/resources/chromeos/login/encryption_migration.html b/chrome/browser/resources/chromeos/login/encryption_migration.html index 03e4ed6..e40ba7eaa 100644 --- a/chrome/browser/resources/chromeos/login/encryption_migration.html +++ b/chrome/browser/resources/chromeos/login/encryption_migration.html
@@ -8,6 +8,7 @@ <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> <link rel="import" href="chrome://oobe/custom_elements.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <link rel="import" href="/components/throbber_notice.html">
diff --git a/chrome/browser/resources/chromeos/login/enterprise_enrollment.html b/chrome/browser/resources/chromeos/login/enterprise_enrollment.html index 02d0fc4..95bfb2a 100644 --- a/chrome/browser/resources/chromeos/login/enterprise_enrollment.html +++ b/chrome/browser/resources/chromeos/login/enterprise_enrollment.html
@@ -9,6 +9,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <dom-module id="enterprise-enrollment-element">
diff --git a/chrome/browser/resources/chromeos/login/family_link_notice.html b/chrome/browser/resources/chromeos/login/family_link_notice.html index 9eae0be..2670ceb 100644 --- a/chrome/browser/resources/chromeos/login/family_link_notice.html +++ b/chrome/browser/resources/chromeos/login/family_link_notice.html
@@ -9,6 +9,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <dom-module id="family-link-notice-element">
diff --git a/chrome/browser/resources/chromeos/login/fingerprint_setup.html b/chrome/browser/resources/chromeos/login/fingerprint_setup.html index 981052a..c4ed9ad 100644 --- a/chrome/browser/resources/chromeos/login/fingerprint_setup.html +++ b/chrome/browser/resources/chromeos/login/fingerprint_setup.html
@@ -11,6 +11,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <dom-module id="fingerprint-setup-element">
diff --git a/chrome/browser/resources/chromeos/login/gaia_password_changed.html b/chrome/browser/resources/chromeos/login/gaia_password_changed.html index e9a9855..692162b 100644 --- a/chrome/browser/resources/chromeos/login/gaia_password_changed.html +++ b/chrome/browser/resources/chromeos/login/gaia_password_changed.html
@@ -8,6 +8,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <link rel="import" href="/components/throbber_notice.html">
diff --git a/chrome/browser/resources/chromeos/login/gesture_navigation.html b/chrome/browser/resources/chromeos/login/gesture_navigation.html index 76019e37..3ee4c05 100644 --- a/chrome/browser/resources/chromeos/login/gesture_navigation.html +++ b/chrome/browser/resources/chromeos/login/gesture_navigation.html
@@ -7,6 +7,7 @@ <link rel="import" href="chrome://resources/cr_elements/cr_lottie/cr_lottie.html"> <link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <dom-module id="gesture-navigation-element">
diff --git a/chrome/browser/resources/chromeos/login/marketing_opt_in.html b/chrome/browser/resources/chromeos/login/marketing_opt_in.html index 7dac9376..cd292cb 100644 --- a/chrome/browser/resources/chromeos/login/marketing_opt_in.html +++ b/chrome/browser/resources/chromeos/login/marketing_opt_in.html
@@ -8,6 +8,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <iron-iconset-svg name="marketing-opt-in-32" size="32">
diff --git a/chrome/browser/resources/chromeos/login/offline_ad_login.html b/chrome/browser/resources/chromeos/login/offline_ad_login.html index 7b5cb26..e696960e 100644 --- a/chrome/browser/resources/chromeos/login/offline_ad_login.html +++ b/chrome/browser/resources/chromeos/login/offline_ad_login.html
@@ -9,6 +9,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <!--
diff --git a/chrome/browser/resources/chromeos/login/offline_gaia.html b/chrome/browser/resources/chromeos/login/offline_gaia.html index 18440cdd..dd1b05b0 100644 --- a/chrome/browser/resources/chromeos/login/offline_gaia.html +++ b/chrome/browser/resources/chromeos/login/offline_gaia.html
@@ -9,6 +9,7 @@ <link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html"> <link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <!-- Offline UI for the New Gaia flow.
diff --git a/chrome/browser/resources/chromeos/login/oobe_adb_sideloading_screen.html b/chrome/browser/resources/chromeos/login/oobe_adb_sideloading_screen.html index e055241a..075316de 100644 --- a/chrome/browser/resources/chromeos/login/oobe_adb_sideloading_screen.html +++ b/chrome/browser/resources/chromeos/login/oobe_adb_sideloading_screen.html
@@ -6,6 +6,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <dom-module id="oobe-adb-sideloading-element"> <template>
diff --git a/chrome/browser/resources/chromeos/login/oobe_enable_kiosk.html b/chrome/browser/resources/chromeos/login/oobe_enable_kiosk.html index 20119cdd..a9c63f99 100644 --- a/chrome/browser/resources/chromeos/login/oobe_enable_kiosk.html +++ b/chrome/browser/resources/chromeos/login/oobe_enable_kiosk.html
@@ -8,6 +8,7 @@ <link rel="import" href="chrome://oobe/custom_elements.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> <dom-module id="kiosk-enable-element"> <template> @@ -30,7 +31,7 @@ </div> <div slot="footer" class="flex layout center-justified vertical"> <img src="chrome://theme/IDR_RESET_WARNING" class="oobe-illustration"> - </div> + </div> <div slot="bottom-buttons" class="flex layout horizontal end-justified"> <oobe-text-button id="enable" hidden="[[!eq_(state_, 'confirm')]]" inverse on-click="onEnableButton_" text-key="kioskEnableButton">
diff --git a/chrome/browser/resources/chromeos/login/oobe_eula.html b/chrome/browser/resources/chromeos/login/oobe_eula.html index 95898a8..1ed19f2 100644 --- a/chrome/browser/resources/chromeos/login/oobe_eula.html +++ b/chrome/browser/resources/chromeos/login/oobe_eula.html
@@ -12,6 +12,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> <dom-module id="oobe-eula-element"> <template>
diff --git a/chrome/browser/resources/chromeos/login/oobe_hid_detection.html b/chrome/browser/resources/chromeos/login/oobe_hid_detection.html index 07818e9..3696ceb 100644 --- a/chrome/browser/resources/chromeos/login/oobe_hid_detection.html +++ b/chrome/browser/resources/chromeos/login/oobe_hid_detection.html
@@ -5,6 +5,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> <iron-iconset-svg name="oobe-hid-detection" size="24"> <svg>
diff --git a/chrome/browser/resources/chromeos/login/oobe_network.html b/chrome/browser/resources/chromeos/login/oobe_network.html index 590da770..32f7d0d1 100644 --- a/chrome/browser/resources/chromeos/login/oobe_network.html +++ b/chrome/browser/resources/chromeos/login/oobe_network.html
@@ -5,6 +5,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> <dom-module id="oobe-network-element"> <template>
diff --git a/chrome/browser/resources/chromeos/login/oobe_reset.html b/chrome/browser/resources/chromeos/login/oobe_reset.html index d1b7cf2f..86d9257 100644 --- a/chrome/browser/resources/chromeos/login/oobe_reset.html +++ b/chrome/browser/resources/chromeos/login/oobe_reset.html
@@ -10,6 +10,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> <dom-module id="oobe-reset-element"> <template>
diff --git a/chrome/browser/resources/chromeos/login/oobe_supervision_transition.html b/chrome/browser/resources/chromeos/login/oobe_supervision_transition.html index d70f3428..6c5fa5e 100644 --- a/chrome/browser/resources/chromeos/login/oobe_supervision_transition.html +++ b/chrome/browser/resources/chromeos/login/oobe_supervision_transition.html
@@ -5,6 +5,7 @@ <link rel="import" href="/components/oobe_i18n_behavior.html"> <link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/oobe_dialog.html"> <dom-module id="supervision-transition-element"> <template>
diff --git a/chrome/browser/resources/chromeos/login/oobe_terms_of_service.html b/chrome/browser/resources/chromeos/login/oobe_terms_of_service.html index 4eba4e7..0fc2e93 100644 --- a/chrome/browser/resources/chromeos/login/oobe_terms_of_service.html +++ b/chrome/browser/resources/chromeos/login/oobe_terms_of_service.html
@@ -10,6 +10,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <link rel="import" href="/components/throbber_notice.html">
diff --git a/chrome/browser/resources/chromeos/login/oobe_update.html b/chrome/browser/resources/chromeos/login/oobe_update.html index 3549422..02a40fb 100644 --- a/chrome/browser/resources/chromeos/login/oobe_update.html +++ b/chrome/browser/resources/chromeos/login/oobe_update.html
@@ -11,6 +11,7 @@ <link rel="import" href="/components/oobe_carousel.html"> <link rel="import" href="/components/oobe_slide.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> <dom-module id="oobe-update-element"> <template>
diff --git a/chrome/browser/resources/chromeos/login/oobe_welcome.html b/chrome/browser/resources/chromeos/login/oobe_welcome.html index 502477e6..aed0eeb 100644 --- a/chrome/browser/resources/chromeos/login/oobe_welcome.html +++ b/chrome/browser/resources/chromeos/login/oobe_welcome.html
@@ -10,6 +10,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> <iron-iconset-svg name="oobe-welcome-32" size="32"> <svg>
diff --git a/chrome/browser/resources/chromeos/login/oobe_welcome.js b/chrome/browser/resources/chromeos/login/oobe_welcome.js index 9fb267f..ce6ebd2 100644 --- a/chrome/browser/resources/chromeos/login/oobe_welcome.js +++ b/chrome/browser/resources/chromeos/login/oobe_welcome.js
@@ -239,7 +239,8 @@ var screen = this.$[id]; assert(screen); screen.hidden = false; - screen.show(); + if (screen.show) + screen.show(); }, /**
diff --git a/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.html b/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.html index 9e9a615..3431e60 100644 --- a/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.html +++ b/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.html
@@ -8,6 +8,7 @@ <link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> <!-- OOBE Welcome screen
diff --git a/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.js b/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.js index 05ce0a28..9bd9902 100644 --- a/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.js +++ b/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.js
@@ -404,30 +404,20 @@ focusedElement.focus(); }, - /** - * This is called from oobe_welcome when this dialog is shown. - */ - show() { - this.focus(); - this.welcomeVideoController_.play(); - }, - /* - * Observer method for changes to the hidden property + * Observer method for changes to the hidden property. + * This replaces the show() function, in this class. */ updateHidden_(newValue, oldValue) { - /* - * hidden becomes True - */ - if (newValue && newValue != oldValue) { + let visible = !newValue; + if (visible) { + this.focus(); + this.welcomeVideoController_.play(); + } else { // Pause the welcome video to avoid using resources while // this page is not visible this.welcomeVideoController_.pause(); } - /* We are not calling show() when hidden becomes false - * as the pattern used in these classes is different, and show() is called - * by the parent anyway. - */ }, /**
diff --git a/chrome/browser/resources/chromeos/login/packaged_license_screen.html b/chrome/browser/resources/chromeos/login/packaged_license_screen.html index e3bc347..4ce90bd 100644 --- a/chrome/browser/resources/chromeos/login/packaged_license_screen.html +++ b/chrome/browser/resources/chromeos/login/packaged_license_screen.html
@@ -8,6 +8,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <dom-module id="packaged-license-element">
diff --git a/chrome/browser/resources/chromeos/login/parental_handoff.html b/chrome/browser/resources/chromeos/login/parental_handoff.html index f6f043c..7cf6e58 100644 --- a/chrome/browser/resources/chromeos/login/parental_handoff.html +++ b/chrome/browser/resources/chromeos/login/parental_handoff.html
@@ -4,7 +4,11 @@ <link rel="import" href="chrome://oobe/custom_elements.html"> <link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> -<link rel="import" href="chrome://resources/html/i18n_behavior.html"> + +<link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> +<link rel="import" href="/components/oobe_i18n_behavior.html"> <dom-module id="parental-handoff-element"> <template>
diff --git a/chrome/browser/resources/chromeos/login/recommend_apps.html b/chrome/browser/resources/chromeos/login/recommend_apps.html index 185c35b..1315b22 100644 --- a/chrome/browser/resources/chromeos/login/recommend_apps.html +++ b/chrome/browser/resources/chromeos/login/recommend_apps.html
@@ -6,6 +6,7 @@ <link rel="import" href="chrome://resources/cr_elements/cr_checkbox/cr_checkbox.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <link rel="import" href="/components/throbber_notice.html">
diff --git a/chrome/browser/resources/chromeos/login/saml_confirm_password.html b/chrome/browser/resources/chromeos/login/saml_confirm_password.html index 1cd3f50a..8d76e67 100644 --- a/chrome/browser/resources/chromeos/login/saml_confirm_password.html +++ b/chrome/browser/resources/chromeos/login/saml_confirm_password.html
@@ -11,6 +11,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <link rel="import" href="/components/throbber_notice.html">
diff --git a/chrome/browser/resources/chromeos/login/screen_error_message.html b/chrome/browser/resources/chromeos/login/screen_error_message.html index 95df061..7591f6d 100644 --- a/chrome/browser/resources/chromeos/login/screen_error_message.html +++ b/chrome/browser/resources/chromeos/login/screen_error_message.html
@@ -1,6 +1,8 @@ <link rel="import" href="chrome://oobe/custom_elements.html"> <link rel="import" href="chrome://resources/html/action_link.html"> +<link rel="import" href="/components/oobe_dialog.html"> + <div id="error-message" class="step hidden show-offline-error" hidden> <iron-iconset-svg name="error-message-24" size="24">
diff --git a/chrome/browser/resources/chromeos/login/screen_gaia_signin.html b/chrome/browser/resources/chromeos/login/screen_gaia_signin.html index 86bcac09..4bb4f6ad 100644 --- a/chrome/browser/resources/chromeos/login/screen_gaia_signin.html +++ b/chrome/browser/resources/chromeos/login/screen_gaia_signin.html
@@ -9,6 +9,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/throbber_notice.html"> <dom-module id="gaia-signin-element">
diff --git a/chrome/browser/resources/chromeos/login/screen_signin_fatal_error.html b/chrome/browser/resources/chromeos/login/screen_signin_fatal_error.html index 50acb80..96f630f 100644 --- a/chrome/browser/resources/chromeos/login/screen_signin_fatal_error.html +++ b/chrome/browser/resources/chromeos/login/screen_signin_fatal_error.html
@@ -4,6 +4,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <dom-module id="signin-fatal-error-element">
diff --git a/chrome/browser/resources/chromeos/login/screen_tpm_error.html b/chrome/browser/resources/chromeos/login/screen_tpm_error.html index 696d36d..98d7799 100644 --- a/chrome/browser/resources/chromeos/login/screen_tpm_error.html +++ b/chrome/browser/resources/chromeos/login/screen_tpm_error.html
@@ -2,6 +2,7 @@ Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <dom-module id="tpm-error-message-element">
diff --git a/chrome/browser/resources/chromeos/login/screen_wrong_hwid.html b/chrome/browser/resources/chromeos/login/screen_wrong_hwid.html index 7e6558f..f163746 100644 --- a/chrome/browser/resources/chromeos/login/screen_wrong_hwid.html +++ b/chrome/browser/resources/chromeos/login/screen_wrong_hwid.html
@@ -4,6 +4,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <dom-module id="wrong-hwid-element">
diff --git a/chrome/browser/resources/chromeos/login/security_token_pin.html b/chrome/browser/resources/chromeos/login/security_token_pin.html index 1ece1a5..d2a923e 100644 --- a/chrome/browser/resources/chromeos/login/security_token_pin.html +++ b/chrome/browser/resources/chromeos/login/security_token_pin.html
@@ -6,6 +6,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <dom-module id="security-token-pin">
diff --git a/chrome/browser/resources/chromeos/login/structure/components_common.html b/chrome/browser/resources/chromeos/login/structure/components_common.html index 6c3a9af..ad4ce4ed 100644 --- a/chrome/browser/resources/chromeos/login/structure/components_common.html +++ b/chrome/browser/resources/chromeos/login/structure/components_common.html
@@ -9,7 +9,6 @@ <include src="../components/oobe_icons.html"> <include src="../components/oobe_buttons.html"> -<include src="../components/oobe_dialog.html"> <include src="../components/oobe_help_dialog.html"> <include src="../components/html-echo.html"> <include src="../notification_card.html">
diff --git a/chrome/browser/resources/chromeos/login/structure/components_common.js b/chrome/browser/resources/chromeos/login/structure/components_common.js index 1560bf3..69d1900a 100644 --- a/chrome/browser/resources/chromeos/login/structure/components_common.js +++ b/chrome/browser/resources/chromeos/login/structure/components_common.js
@@ -9,7 +9,6 @@ // <include src="../components/login_screen_behavior.js"> // <include src="../components/multi_step_behavior.js"> // <include src="../components/oobe_buttons.js"> -// <include src="../components/oobe_dialog.js"> // <include src="../components/oobe_help_dialog.js"> // <include src="../components/html-echo.js"> // <include src="../notification_card.js">
diff --git a/chrome/browser/resources/chromeos/login/sync_consent.html b/chrome/browser/resources/chromeos/login/sync_consent.html index ec1b472..5866b461 100644 --- a/chrome/browser/resources/chromeos/login/sync_consent.html +++ b/chrome/browser/resources/chromeos/login/sync_consent.html
@@ -10,6 +10,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <link rel="import" href="/components/throbber_notice.html">
diff --git a/chrome/browser/resources/chromeos/login/update_required_card.html b/chrome/browser/resources/chromeos/login/update_required_card.html index 29b43edf..24efd8d4 100644 --- a/chrome/browser/resources/chromeos/login/update_required_card.html +++ b/chrome/browser/resources/chromeos/login/update_required_card.html
@@ -6,6 +6,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <!--
diff --git a/chrome/browser/resources/chromeos/login/user_creation.html b/chrome/browser/resources/chromeos/login/user_creation.html index d8abf78a..34e35068 100644 --- a/chrome/browser/resources/chromeos/login/user_creation.html +++ b/chrome/browser/resources/chromeos/login/user_creation.html
@@ -9,6 +9,7 @@ <link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/hd_iron_icon.html"> +<link rel="import" href="/components/oobe_dialog.html"> <link rel="import" href="/components/oobe_i18n_behavior.html"> <dom-module id="user-creation-element">
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_people_page/BUILD.gn index 1c73133..548c8ab 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_people_page/BUILD.gn
@@ -518,8 +518,6 @@ extra_deps = [ ":users_page_module" ] } -import("//tools/polymer/polymer.gni") - group("polymer3_elements") { public_deps = [ ":account_manager_module",
diff --git a/chrome/browser/resources/settings/chromeos/os_printing_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_printing_page/BUILD.gn index 01c0613..1c06498 100644 --- a/chrome/browser/resources/settings/chromeos/os_printing_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_printing_page/BUILD.gn
@@ -360,8 +360,6 @@ extra_deps = [ ":os_printing_page_module" ] } -import("//tools/polymer/polymer.gni") - group("polymer3_elements") { public_deps = [ ":cups_add_print_server_dialog_module",
diff --git a/chrome/browser/resources/settings/settings_page/BUILD.gn b/chrome/browser/resources/settings/settings_page/BUILD.gn index c58fd5c..b765a07 100644 --- a/chrome/browser/resources/settings/settings_page/BUILD.gn +++ b/chrome/browser/resources/settings/settings_page/BUILD.gn
@@ -105,8 +105,6 @@ extra_deps = [ ":settings_subpage_module" ] } -import("//tools/polymer/polymer.gni") - group("polymer3_elements") { public_deps = [ ":settings_animated_pages_module",
diff --git a/chrome/browser/resources/usb_internals/BUILD.gn b/chrome/browser/resources/usb_internals/BUILD.gn index ee5ceeb..9b641e1 100644 --- a/chrome/browser/resources/usb_internals/BUILD.gn +++ b/chrome/browser/resources/usb_internals/BUILD.gn
@@ -5,6 +5,49 @@ import("//third_party/closure_compiler/compile_js.gni") import("//tools/grit/grit_rule.gni") import("//tools/polymer/html_to_js.gni") +import("//ui/webui/resources/tools/generate_grd.gni") + +generated_grdp_file = "$target_gen_dir/generated_resources.grdp" +mojo_grdp_file = "$target_gen_dir/mojo_resources.grdp" +resources_grd_file = "$target_gen_dir/resources.grd" + +generate_grd("build_grd") { + grd_prefix = "usb_internals" + out_grd = resources_grd_file + deps = [ + ":build_generated_grdp", + ":build_mojo_grdp", + ] + input_files = [ + "descriptor_panel.js", + "devices_page.js", + "usb_internals.css", + "usb_internals.html", + ] + input_files_base_dir = rebase_path(".", "//") + + grdp_files = [ + generated_grdp_file, + mojo_grdp_file, + ] +} + +generate_grd("build_generated_grdp") { + grd_prefix = "usb_internals" + out_grd = generated_grdp_file + input_files = [ "app.js" ] + input_files_base_dir = rebase_path("$target_gen_dir", "$root_build_dir") +} + +generate_grd("build_mojo_grdp") { + grd_prefix = "usb_internals" + out_grd = mojo_grdp_file + input_files = [ "usb_internals.mojom-webui.js" ] + input_files_base_dir = + rebase_path( + "${root_gen_dir}/mojom-webui/chrome/browser/ui/webui/usb_internals", + "$root_build_dir") +} js_type_check("closure_compile") { uses_js_modules = true @@ -57,7 +100,8 @@ } grit("resources") { - source = "resources.grd" + enable_input_discovery_for_gn_analyze = false + source = resources_grd_file outputs = [ "grit/usb_internals_resources.h", "grit/usb_internals_resources_map.cc", @@ -66,6 +110,7 @@ ] output_dir = "$root_gen_dir/chrome" deps = [ + ":build_grd", ":web_components", "//chrome/browser/ui/webui/usb_internals:mojo_bindings_webui_js", ]
diff --git a/chrome/browser/resources/usb_internals/resources.grd b/chrome/browser/resources/usb_internals/resources.grd deleted file mode 100644 index 67185885..0000000 --- a/chrome/browser/resources/usb_internals/resources.grd +++ /dev/null
@@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<grit latest_public_release="0" - current_release="1" - output_all_resource_defines="false"> - <outputs> - <output filename="grit/usb_internals_resources.h" type="rc_header"> - <emit emit_type='prepend'></emit> - </output> - <output filename="grit/usb_internals_resources_map.cc" - type="resource_file_map_source" /> - <output filename="grit/usb_internals_resources_map.h" - type="resource_map_header" /> - <output filename="usb_internals_resources.pak" type="data_package" /> - </outputs> - <release seq="1"> - <includes> - <include name="IDR_USB_INTERNALS_CSS" - file="usb_internals.css" - type="BINDATA" /> - <include name="IDR_USB_INTERNALS_DESCRIPTOR_PANEL_JS" - file="descriptor_panel.js" - type="BINDATA" /> - <include name="IDR_USB_INTERNALS_DEVICES_PAGE_JS" - file="devices_page.js" - type="BINDATA" /> - <include name="IDR_USB_INTERNALS_HTML" - file="usb_internals.html" - type="BINDATA" /> - <include name="IDR_USB_INTERNALS_MOJOM_WEBUI_JS" - file="${root_gen_dir}\mojom-webui\chrome\browser\ui\webui\usb_internals\usb_internals.mojom-webui.js" - resource_path="usb_internals.mojom-webui.js" - use_base_dir="false" - type="BINDATA" /> - <include name="IDR_USB_INTERNALS_APP_JS" - file="${root_gen_dir}\chrome\browser\resources\usb_internals\app.js" - resource_path="app.js" - use_base_dir="false" - type="BINDATA" /> - </includes> - </release> -</grit>
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/BUILD.gn b/chrome/browser/safe_browsing/chrome_cleaner/BUILD.gn index 866a631..0e78667 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/BUILD.gn +++ b/chrome/browser/safe_browsing/chrome_cleaner/BUILD.gn
@@ -55,9 +55,8 @@ ] deps = [ - # TODO(crbug.com/925153): Break dependency cycles with //chrome/browser + # TODO(crbug.com/920223): Break dependency cycles with //chrome/browser ":public", - "//chrome/browser:browser_process", "//chrome/browser/extensions", "//chrome/browser/safe_browsing", "//chrome/browser/ui",
diff --git a/chrome/browser/subresource_filter/BUILD.gn b/chrome/browser/subresource_filter/BUILD.gn index 270ebc6..e0db900 100644 --- a/chrome/browser/subresource_filter/BUILD.gn +++ b/chrome/browser/subresource_filter/BUILD.gn
@@ -48,7 +48,7 @@ deps = [ ":jni_headers", "//base", - "//chrome/browser:browser_process", + "//chrome/browser", "//components/subresource_filter/content/browser", "//components/subresource_filter/core/common:test_support", ]
diff --git a/chrome/browser/subresource_redirect/origin_robots_rules.cc b/chrome/browser/subresource_redirect/origin_robots_rules.cc new file mode 100644 index 0000000..3710aa2 --- /dev/null +++ b/chrome/browser/subresource_redirect/origin_robots_rules.cc
@@ -0,0 +1,143 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/subresource_redirect/origin_robots_rules.h" + +#include "base/metrics/histogram_functions.h" +#include "base/metrics/histogram_macros.h" +#include "chrome/browser/subresource_redirect/subresource_redirect_util.h" +#include "components/variations/net/variations_http_headers.h" +#include "net/http/http_request_headers.h" +#include "net/http/http_response_headers.h" +#include "net/http/http_status_code.h" +#include "net/traffic_annotation/network_traffic_annotation.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" +#include "services/network/public/cpp/simple_url_loader.h" + +namespace subresource_redirect { + +OriginRobotsRules::FetcherInfo::FetcherInfo( + std::unique_ptr<network::SimpleURLLoader> url_loader, + OriginRobotsRules::NotifyResponseErrorCallback response_error_callback) + : url_loader(std::move(url_loader)), + response_error_callback(std::move(response_error_callback)) {} + +OriginRobotsRules::FetcherInfo::~FetcherInfo() = default; + +OriginRobotsRules::OriginRobotsRules( + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, + const url::SchemeHostPort& origin, + NotifyResponseErrorCallback response_error_callback) { + net::NetworkTrafficAnnotationTag traffic_annotation = + net::DefineNetworkTrafficAnnotation("litepages_robots_rules", + R"( + semantics { + sender: "LitePages" + description: + "Requests robots.txt rules from the LitePages robots.txt Service " + "to use in providing data saving optimizations for Chrome." + trigger: + "Requested for each unique origin for the images contained in the " + "page, and cached for certain period." + data: "A list of allowed and disallowed robots.txt path patterns" + destination: GOOGLE_OWNED_SERVICE + } + policy { + cookies_allowed: NO + setting: + "Users can control Lite mode on Android via 'Lite mode' setting." + chrome_policy { + DataCompressionProxyEnabled { + DataCompressionProxyEnabled: false + } + } + })"); + + auto resource_request = std::make_unique<network::ResourceRequest>(); + resource_request->url = GetRobotsServerURL(origin); + resource_request->method = "GET"; + resource_request->credentials_mode = network::mojom::CredentialsMode::kOmit; + + auto url_loader = variations::CreateSimpleURLLoaderWithVariationsHeader( + std::move(resource_request), variations::InIncognito::kNo, + variations::SignedIn::kNo, traffic_annotation); + + // url_loader should retry on network changes, but no retries on other + // failures such as 5xx errors. + url_loader->SetRetryOptions( + 1 /* max_retries */, network::SimpleURLLoader::RETRY_ON_NETWORK_CHANGE); + + url_loader->DownloadToStringOfUnboundedSizeUntilCrashAndDie( + url_loader_factory.get(), + base::BindOnce(&OriginRobotsRules::OnURLLoadComplete, + base::Unretained(this))); + + fetcher_info_ = std::make_unique<FetcherInfo>( + std::move(url_loader), std::move(response_error_callback)); +} + +OriginRobotsRules::~OriginRobotsRules() = default; + +void OriginRobotsRules::GetRobotsRules(RobotsRulesReceivedCallback callback) { + if (fetcher_info_) { + // Robots rules fetch is still in progress. + fetcher_info_->pending_callbacks.push_back(std::move(callback)); + return; + } + std::move(callback).Run(robots_rules_); +} + +void OriginRobotsRules::OnURLLoadComplete( + std::unique_ptr<std::string> response_body) { + const auto response_headers = + fetcher_info_->url_loader->ResponseInfo() + ? fetcher_info_->url_loader->ResponseInfo()->headers + : nullptr; + int response_code = + response_headers ? response_code = response_headers->response_code() : -1; + + int net_error = fetcher_info_->url_loader->NetError(); + + UMA_HISTOGRAM_BOOLEAN( + "SubresourceRedirect.RobotsRulesFetcher.CacheHit", + fetcher_info_->url_loader->ResponseInfo() + ? fetcher_info_->url_loader->ResponseInfo()->was_fetched_via_cache + : false); + base::UmaHistogramSparse( + "SubresourceRedirect.RobotsRulesFetcher.NetErrorCode", -net_error); + if (response_code != -1) { + UMA_HISTOGRAM_ENUMERATION( + "SubresourceRedirect.RobotsRulesFetcher.ResponseCode", + static_cast<net::HttpStatusCode>(response_code), + net::HTTP_VERSION_NOT_SUPPORTED); + } + + // Treat 4xx, 5xx as failures + if (response_code >= 400 && response_code <= 599) { + std::string retry_after_string; + base::TimeDelta retry_after; + if (response_headers && + response_headers->EnumerateHeader(nullptr, "Retry-After", + &retry_after_string) && + net::HttpUtil::ParseRetryAfterHeader(retry_after_string, + base::Time::Now(), &retry_after)) { + std::move(fetcher_info_->response_error_callback) + .Run(response_code, retry_after); + } else { + std::move(fetcher_info_->response_error_callback) + .Run(response_code, base::TimeDelta()); + } + } + + if (response_body && net_error == net::OK && + (response_code == net::HTTP_OK || + response_code == net::HTTP_NOT_MODIFIED)) { + robots_rules_ = *response_body; + } + for (auto& callback : fetcher_info_->pending_callbacks) + std::move(callback).Run(robots_rules_); + fetcher_info_.reset(); +} + +} // namespace subresource_redirect
diff --git a/chrome/browser/subresource_redirect/origin_robots_rules.h b/chrome/browser/subresource_redirect/origin_robots_rules.h new file mode 100644 index 0000000..b64d9d2 --- /dev/null +++ b/chrome/browser/subresource_redirect/origin_robots_rules.h
@@ -0,0 +1,79 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_SUBRESOURCE_REDIRECT_ORIGIN_ROBOTS_RULES_H_ +#define CHROME_BROWSER_SUBRESOURCE_REDIRECT_ORIGIN_ROBOTS_RULES_H_ + +#include <memory> +#include <string> +#include <vector> + +#include "base/callback.h" +#include "base/macros.h" +#include "base/memory/scoped_refptr.h" +#include "base/optional.h" +#include "url/scheme_host_port.h" + +namespace network { +class SharedURLLoaderFactory; +class SimpleURLLoader; +} // namespace network + +namespace subresource_redirect { + +// Holds the robots rules for one origin. Fetches the robots rules on creation. +class OriginRobotsRules { + public: + // The callback to send the received robots rules. base::nullopt will be sent + // when rule fetch fails. + using RobotsRulesReceivedCallback = + base::OnceCallback<void(base::Optional<std::string>)>; + + // The callback to notify 4xx, 5xx response codes. Sends the response code and + // retry-after response header. + using NotifyResponseErrorCallback = + base::OnceCallback<void(int, base::TimeDelta)>; + + OriginRobotsRules( + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, + const url::SchemeHostPort& origin, + NotifyResponseErrorCallback response_error_callback); + ~OriginRobotsRules(); + + // Get the robots rules for this origin. The callback is called immediately if + // rules have been fetched. When rules fetch is in progress, the callback will + // happen after it is complete. + void GetRobotsRules(RobotsRulesReceivedCallback callback); + + private: + // Holds the info pertaining to when robots rules are fetched. + struct FetcherInfo { + FetcherInfo(std::unique_ptr<network::SimpleURLLoader> url_loader, + NotifyResponseErrorCallback response_error_callback); + ~FetcherInfo(); + + // Holds the URLLoader when robots rules are fetched. + std::unique_ptr<network::SimpleURLLoader> url_loader; + + // Contains the requests that are pending for robots rules to be received. + std::vector<RobotsRulesReceivedCallback> pending_callbacks; + + // Callback to notify response errors. + NotifyResponseErrorCallback response_error_callback; + }; + + // URL loader completion callback. + void OnURLLoadComplete(std::unique_ptr<std::string> response_body); + + // The received robots rules. Set when rules fetch completes successfully. + base::Optional<std::string> robots_rules_; + + // Holds the robots rules fetcher state. Exists only when fetch is in + // progress. + std::unique_ptr<FetcherInfo> fetcher_info_; +}; + +} // namespace subresource_redirect + +#endif // CHROME_BROWSER_SUBRESOURCE_REDIRECT_ORIGIN_ROBOTS_RULES_H_
diff --git a/chrome/browser/subresource_redirect/origin_robots_rules_unittest.cc b/chrome/browser/subresource_redirect/origin_robots_rules_unittest.cc new file mode 100644 index 0000000..96fc29e7 --- /dev/null +++ b/chrome/browser/subresource_redirect/origin_robots_rules_unittest.cc
@@ -0,0 +1,265 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/subresource_redirect/origin_robots_rules.h" +#include "base/callback.h" +#include "base/macros.h" +#include "base/memory/scoped_refptr.h" +#include "base/optional.h" +#include "base/run_loop.h" +#include "base/strings/strcat.h" +#include "base/test/metrics/histogram_tester.h" +#include "base/test/scoped_feature_list.h" +#include "base/test/task_environment.h" +#include "base/time/time.h" +#include "net/base/escape.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" +#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" +#include "services/network/public/mojom/url_response_head.mojom.h" +#include "services/network/test/test_url_loader_factory.h" +#include "services/network/test/test_utils.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/features.h" + +namespace subresource_redirect { + +constexpr char kLitePagesURL[] = "https://litepages.googlezip.net/robots?u="; +constexpr char kFooOrigin[] = "https://foo.com/"; +constexpr char kTestResponse[] = "TEST RESPONSE"; + +class RobotsRulesFetcherState { + public: + OriginRobotsRules::RobotsRulesReceivedCallback + GetRobotsRulesReceivedCallback() { + return base::BindOnce(&RobotsRulesFetcherState::OnRobotsRulesReceived, + weak_ptr_factory_.GetWeakPtr()); + } + + OriginRobotsRules::NotifyResponseErrorCallback GetResponseErrorCallback() { + return base::BindOnce(&RobotsRulesFetcherState::OnResponseErrorReceived, + weak_ptr_factory_.GetWeakPtr()); + } + + private: + friend class SubresourceRedirectOriginRobotsRulesTest; + + void OnResponseErrorReceived(int response_code, base::TimeDelta retry_after) { + EXPECT_FALSE(response_error_received_.has_value()); + response_error_received_ = + std::pair<int, base::TimeDelta>(response_code, retry_after); + } + + void OnRobotsRulesReceived(base::Optional<std::string> rules) { + robots_rules_received_.push_back(rules); + } + + base::Optional<std::pair<int, base::TimeDelta>> response_error_received_; + std::vector<base::Optional<std::string>> robots_rules_received_; + base::WeakPtrFactory<RobotsRulesFetcherState> weak_ptr_factory_{this}; +}; + +class SubresourceRedirectOriginRobotsRulesTest : public testing::Test { + public: + SubresourceRedirectOriginRobotsRulesTest() + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI), + shared_url_loader_factory_( + base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( + &test_url_loader_factory_)) { + scoped_feature_list_.InitWithFeaturesAndParameters( + {{blink::features::kSubresourceRedirect, + {{"enable_login_robots_based_compression", "true"}, + {"enable_public_image_hints_based_compression", "false"}}}}, + {}); + } + + void CreateRobotsRulesFetcher(const std::string& origin) { + rules_fetcher_state_ = std::make_unique<RobotsRulesFetcherState>(); + origin_robots_rules_ = std::make_unique<OriginRobotsRules>( + shared_url_loader_factory_, url::SchemeHostPort(GURL(origin)), + rules_fetcher_state_->GetResponseErrorCallback()); + } + + void GetRobotsRules() { + origin_robots_rules_->GetRobotsRules( + rules_fetcher_state_->GetRobotsRulesReceivedCallback()); + } + + bool SimulateResponse(const std::string& lite_pages_url, + std::string robots_origin, + const std::string& content, + int net_error = net::OK, + net::HttpStatusCode http_status = net::HTTP_OK, + bool is_cache_hit = false, + const std::string& retry_after = "") { + GURL url(lite_pages_url + net::EscapeQueryParamValue(robots_origin, true)); + network::mojom::URLResponseHeadPtr head = + network::CreateURLResponseHead(http_status); + head->was_fetched_via_cache = is_cache_hit; + head->mime_type = "text/html"; + head->headers->SetHeader("Retry-After", retry_after); + network::URLLoaderCompletionStatus status; + status.error_code = net_error; + status.decoded_body_length = content.size(); + return test_url_loader_factory_.SimulateResponseForPendingRequest( + url, status, std::move(head), content); + } + + base::Optional<std::pair<int, base::TimeDelta>> GetResponseErrorReceived() { + return rules_fetcher_state_->response_error_received_; + } + + std::vector<base::Optional<std::string>> GetRobotsRulesReceived() { + return rules_fetcher_state_->robots_rules_received_; + } + + protected: + void RunUntilIdle() { + task_environment_.RunUntilIdle(); + base::RunLoop().RunUntilIdle(); + } + + base::test::ScopedFeatureList scoped_feature_list_; + base::test::TaskEnvironment task_environment_; + + base::HistogramTester histogram_tester_; + + std::unique_ptr<OriginRobotsRules> origin_robots_rules_; + std::unique_ptr<RobotsRulesFetcherState> rules_fetcher_state_; + + scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_; + network::TestURLLoaderFactory test_url_loader_factory_; +}; + +TEST_F(SubresourceRedirectOriginRobotsRulesTest, TestSuccessfulResponse) { + CreateRobotsRulesFetcher(kFooOrigin); + GetRobotsRules(); + // No robots rules received yet. + EXPECT_EQ(0ULL, GetRobotsRulesReceived().size()); + + EXPECT_TRUE(SimulateResponse(kLitePagesURL, kFooOrigin, kTestResponse)); + EXPECT_EQ(base::nullopt, GetResponseErrorReceived()); + histogram_tester_.ExpectUniqueSample( + "SubresourceRedirect.RobotsRulesFetcher.CacheHit", false, 1); + histogram_tester_.ExpectUniqueSample( + "SubresourceRedirect.RobotsRulesFetcher.NetErrorCode", 0, 1); + histogram_tester_.ExpectUniqueSample( + "SubresourceRedirect.RobotsRulesFetcher.ResponseCode", net::HTTP_OK, 1); + EXPECT_THAT(GetRobotsRulesReceived(), + testing::ElementsAre(base::Optional<std::string>(kTestResponse))); + + // Subsequent calls will return the response immediately. + GetRobotsRules(); + GetRobotsRules(); + EXPECT_THAT(GetRobotsRulesReceived(), + testing::ElementsAre(base::Optional<std::string>(kTestResponse), + base::Optional<std::string>(kTestResponse), + base::Optional<std::string>(kTestResponse))); + EXPECT_EQ(base::nullopt, GetResponseErrorReceived()); +} + +TEST_F(SubresourceRedirectOriginRobotsRulesTest, TestSuccessfulCachedResponse) { + CreateRobotsRulesFetcher(kFooOrigin); + GetRobotsRules(); + EXPECT_TRUE(SimulateResponse(kLitePagesURL, kFooOrigin, kTestResponse, + net::OK, net::HTTP_OK, true /*is_cache_hit*/)); + RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + "SubresourceRedirect.RobotsRulesFetcher.CacheHit", true, 1); + histogram_tester_.ExpectUniqueSample( + "SubresourceRedirect.RobotsRulesFetcher.NetErrorCode", 0, 1); + histogram_tester_.ExpectUniqueSample( + "SubresourceRedirect.RobotsRulesFetcher.ResponseCode", net::HTTP_OK, 1); + EXPECT_EQ(base::nullopt, GetResponseErrorReceived()); + EXPECT_THAT(GetRobotsRulesReceived(), + testing::ElementsAre(base::Optional<std::string>(kTestResponse))); + + GetRobotsRules(); + GetRobotsRules(); + EXPECT_THAT(GetRobotsRulesReceived(), + testing::ElementsAre(base::Optional<std::string>(kTestResponse), + base::Optional<std::string>(kTestResponse), + base::Optional<std::string>(kTestResponse))); + EXPECT_EQ(base::nullopt, GetResponseErrorReceived()); +} + +TEST_F(SubresourceRedirectOriginRobotsRulesTest, TestFailedResponse) { + CreateRobotsRulesFetcher(kFooOrigin); + GetRobotsRules(); + EXPECT_TRUE(SimulateResponse(kLitePagesURL, kFooOrigin, kTestResponse, + net::OK, net::HTTP_INTERNAL_SERVER_ERROR)); + RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + "SubresourceRedirect.RobotsRulesFetcher.CacheHit", false, 1); + histogram_tester_.ExpectTotalCount( + "SubresourceRedirect.RobotsRulesFetcher.NetErrorCode", 1); + histogram_tester_.ExpectUniqueSample( + "SubresourceRedirect.RobotsRulesFetcher.ResponseCode", + net::HTTP_INTERNAL_SERVER_ERROR, 1); + EXPECT_THAT( + *GetResponseErrorReceived(), + testing::Pair(net::HTTP_INTERNAL_SERVER_ERROR, base::TimeDelta())); + EXPECT_THAT(GetRobotsRulesReceived(), testing::ElementsAre(base::nullopt)); + + // Subsequent calls will return the response immediately. + GetRobotsRules(); + GetRobotsRules(); + EXPECT_THAT( + GetRobotsRulesReceived(), + testing::ElementsAre(base::nullopt, base::nullopt, base::nullopt)); +} + +TEST_F(SubresourceRedirectOriginRobotsRulesTest, + TestFailedResponseWithRetryAfter) { + CreateRobotsRulesFetcher(kFooOrigin); + GetRobotsRules(); + EXPECT_TRUE(SimulateResponse(kLitePagesURL, kFooOrigin, kTestResponse, + net::OK, net::HTTP_INTERNAL_SERVER_ERROR, + false /*is_cache_hit*/, "120")); + RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + "SubresourceRedirect.RobotsRulesFetcher.CacheHit", false, 1); + histogram_tester_.ExpectTotalCount( + "SubresourceRedirect.RobotsRulesFetcher.NetErrorCode", 1); + histogram_tester_.ExpectUniqueSample( + "SubresourceRedirect.RobotsRulesFetcher.ResponseCode", + net::HTTP_INTERNAL_SERVER_ERROR, 1); + EXPECT_THAT(*GetResponseErrorReceived(), + testing::Pair(net::HTTP_INTERNAL_SERVER_ERROR, + base::TimeDelta::FromSeconds(120))); + EXPECT_THAT(GetRobotsRulesReceived(), testing::ElementsAre(base::nullopt)); + + // Subsequent calls will return the response immediately. + GetRobotsRules(); + GetRobotsRules(); + EXPECT_THAT( + GetRobotsRulesReceived(), + testing::ElementsAre(base::nullopt, base::nullopt, base::nullopt)); +} + +TEST_F(SubresourceRedirectOriginRobotsRulesTest, TestNetErrorFailedResponse) { + CreateRobotsRulesFetcher(kFooOrigin); + GetRobotsRules(); + EXPECT_TRUE(SimulateResponse(kLitePagesURL, kFooOrigin, kTestResponse, + net::ERR_ADDRESS_UNREACHABLE)); + RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + "SubresourceRedirect.RobotsRulesFetcher.CacheHit", false, 1); + histogram_tester_.ExpectUniqueSample( + "SubresourceRedirect.RobotsRulesFetcher.NetErrorCode", + -net::ERR_ADDRESS_UNREACHABLE, 1); + histogram_tester_.ExpectTotalCount( + "SubresourceRedirect.RobotsRulesFetcher.ResponseCode", 0); + EXPECT_EQ(base::nullopt, GetResponseErrorReceived()); + EXPECT_THAT(GetRobotsRulesReceived(), testing::ElementsAre(base::nullopt)); + + // Subsequent calls will return the response immediately. + GetRobotsRules(); + GetRobotsRules(); + EXPECT_THAT( + GetRobotsRulesReceived(), + testing::ElementsAre(base::nullopt, base::nullopt, base::nullopt)); +} + +} // namespace subresource_redirect
diff --git a/chrome/browser/subresource_redirect/subresource_redirect_util.cc b/chrome/browser/subresource_redirect/subresource_redirect_util.cc index 750936e..ac53f12 100644 --- a/chrome/browser/subresource_redirect/subresource_redirect_util.cc +++ b/chrome/browser/subresource_redirect/subresource_redirect_util.cc
@@ -11,6 +11,7 @@ #include "chrome/browser/subresource_redirect/https_image_compression_infobar_decider.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" #include "content/public/browser/web_contents.h" +#include "net/base/escape.h" #include "third_party/blink/public/common/features.h" #if defined(OS_ANDROID) @@ -121,4 +122,27 @@ ->NotifyCompressedImageFetchFailed(retry_after); } +GURL GetRobotsServerURL(const url::SchemeHostPort& origin) { + DCHECK(ShouldEnableLoginRobotsCheckedCompression()); + DCHECK(origin.IsValid()); + + auto lite_page_robots_origin = base::GetFieldTrialParamValueByFeature( + blink::features::kSubresourceRedirect, "lite_page_robots_origin"); + GURL lite_page_robots_url(lite_page_robots_origin.empty() + ? "https://litepages.googlezip.net/" + : lite_page_robots_origin); + + std::string query_str = + "u=" + + net::EscapeQueryParamValue(origin.GetURL().spec(), true /* use_plus */); + + GURL::Replacements replacements; + replacements.SetPathStr("/robots"); + replacements.SetQueryStr(query_str); + + lite_page_robots_url = lite_page_robots_url.ReplaceComponents(replacements); + DCHECK(lite_page_robots_url.is_valid()); + return lite_page_robots_url; +} + } // namespace subresource_redirect
diff --git a/chrome/browser/subresource_redirect/subresource_redirect_util.h b/chrome/browser/subresource_redirect/subresource_redirect_util.h index 53610b02..4ba3167 100644 --- a/chrome/browser/subresource_redirect/subresource_redirect_util.h +++ b/chrome/browser/subresource_redirect/subresource_redirect_util.h
@@ -7,6 +7,8 @@ #include "base/macros.h" #include "base/time/time.h" +#include "url/gurl.h" +#include "url/scheme_host_port.h" namespace content { class NavigationHandle; @@ -42,6 +44,10 @@ void NotifyCompressedImageFetchFailed(content::WebContents* web_contents, base::TimeDelta retry_after); +// Returns the LitePages robots rules server endpoint URL to fetch for the given +// |origin|. +GURL GetRobotsServerURL(const url::SchemeHostPort& origin); + } // namespace subresource_redirect #endif // CHROME_BROWSER_SUBRESOURCE_REDIRECT_SUBRESOURCE_REDIRECT_UTIL_H_
diff --git a/chrome/browser/subresource_redirect/subresource_redirect_util_unit_test.cc b/chrome/browser/subresource_redirect/subresource_redirect_util_unit_test.cc new file mode 100644 index 0000000..8aed44a --- /dev/null +++ b/chrome/browser/subresource_redirect/subresource_redirect_util_unit_test.cc
@@ -0,0 +1,58 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/strings/string_util.h" +#include "base/strings/stringprintf.h" +#include "base/test/scoped_feature_list.h" +#include "chrome/browser/subresource_redirect/subresource_redirect_util.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/features.h" + +namespace subresource_redirect { + +namespace { + +// Naive function that escapes :, / characters in URL. Useful for simple tests. +std::string EscapeURLForQueryParam(std::string url) { + base::ReplaceChars(url, ":", base::StringPrintf("%%%0X", ':'), &url); + base::ReplaceChars(url, "/", base::StringPrintf("%%%0X", '/'), &url); + return url; +} + +} // namespace + +TEST(SubresourceRedirectUtilTest, GetRobotsServerURL) { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeaturesAndParameters( + {{blink::features::kSubresourceRedirect, + {{"enable_login_robots_based_compression", "true"}, + {"enable_public_image_hints_based_compression", "false"}}}}, + {}); + + for (auto* origin : + {"https://foo.com/", "https://www.foo.com/", "http://foo.com/"}) { + EXPECT_EQ(GURL("https://litepages.googlezip.net/robots?u=" + + EscapeURLForQueryParam(origin)), + GetRobotsServerURL(url::SchemeHostPort(GURL(origin)))); + } +} + +TEST(SubresourceRedirectUtilTest, GetRobotsServerURL_ModifiedLitePagesOrigin) { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeaturesAndParameters( + {{blink::features::kSubresourceRedirect, + {{"enable_login_robots_based_compression", "true"}, + {"enable_public_image_hints_based_compression", "false"}, + {"lite_page_robots_origin", "https://modified.litepages.com/"}}}}, + {}); + + for (auto* origin : + {"https://foo.com/", "https://www.foo.com/", "http://foo.com/"}) { + EXPECT_EQ(GURL("https://modified.litepages.com/robots?u=" + + EscapeURLForQueryParam(origin)), + GetRobotsServerURL(url::SchemeHostPort(GURL(origin)))); + } +} + +} // namespace subresource_redirect
diff --git a/chrome/browser/supervised_user/supervised_user_url_filter_browsertest.cc b/chrome/browser/supervised_user/supervised_user_url_filter_browsertest.cc index 45e2969..9d76a27d 100644 --- a/chrome/browser/supervised_user/supervised_user_url_filter_browsertest.cc +++ b/chrome/browser/supervised_user/supervised_user_url_filter_browsertest.cc
@@ -197,11 +197,8 @@ return; auto* remove = change.GetRemove(); - if (!remove->will_be_deleted) - return; - for (const auto& contents : remove->contents) { - if (contents_ == contents.contents) { + if (contents_ == contents.contents && contents.will_be_deleted) { if (run_loop_.running()) run_loop_.Quit(); contents_ = nullptr;
diff --git a/chrome/browser/sync/test/integration/single_client_user_consents_sync_test.cc b/chrome/browser/sync/test/integration/single_client_user_consents_sync_test.cc index 35c453d..69dfa3b 100644 --- a/chrome/browser/sync/test/integration/single_client_user_consents_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_user_consents_sync_test.cc
@@ -27,13 +27,7 @@ namespace { CoreAccountId GetAccountId() { -#if defined(OS_CHROMEOS) - // TODO(vitaliii): Unify the two, because it takes ages to debug and - // impossible to discover otherwise. - return CoreAccountId("user@gmail.com"); -#else return CoreAccountId("gaia_id_for_user_gmail.com"); -#endif } class UserConsentEqualityChecker : public SingleClientStatusChangeChecker {
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 5610aa4..ba361bd 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -353,7 +353,6 @@ "//chrome/app/theme:chrome_unscaled_resources", "//chrome/app/theme:theme_resources", "//chrome/app/vector_icons", - "//chrome/browser:browser_process", "//chrome/browser:buildflags", "//chrome/browser:dev_ui_browser_resources", "//chrome/browser:resource_prefetch_predictor_proto",
diff --git a/chrome/browser/ui/ash/chrome_launcher_prefs.cc b/chrome/browser/ui/ash/chrome_launcher_prefs.cc index c60e073..28a97c9 100644 --- a/chrome/browser/ui/ash/chrome_launcher_prefs.cc +++ b/chrome/browser/ui/ash/chrome_launcher_prefs.cc
@@ -48,28 +48,27 @@ // Chrome is pinned explicitly. const char* kDefaultPinnedApps[] = { - extension_misc::kFilesManagerAppId, extension_misc::kGmailAppId, - extension_misc::kGoogleDocAppId, extension_misc::kYoutubeAppId, - arc::kPlayStoreAppId}; + extension_misc::kGmailAppId, extension_misc::kGoogleDocAppId, + extension_misc::kYoutubeAppId, arc::kPlayStoreAppId}; const char* kDefaultPinnedApps7Apps[] = { - extension_misc::kFilesManagerAppId, extension_misc::kGmailAppId, - extension_misc::kGoogleDocAppId, extension_misc::kGooglePhotosAppId, + extension_misc::kGmailAppId, extension_misc::kGoogleDocAppId, + extension_misc::kGooglePhotosAppId, extension_misc::kFilesManagerAppId, extension_misc::kYoutubeAppId, arc::kPlayStoreAppId}; -const char* kDefaultPinnedApps10Apps[] = {extension_misc::kFilesManagerAppId, - extension_misc::kGmailAppId, +const char* kDefaultPinnedApps10Apps[] = {extension_misc::kGmailAppId, extension_misc::kCalendarAppId, extension_misc::kGoogleDocAppId, extension_misc::kGoogleSheetsAppId, extension_misc::kGoogleSlidesAppId, + extension_misc::kFilesManagerAppId, extension_misc::kCameraAppId, extension_misc::kGooglePhotosAppId, arc::kPlayStoreAppId}; const char* kTabletFormFactorDefaultPinnedApps[] = { - extension_misc::kFilesManagerAppId, arc::kGmailAppId, - extension_misc::kGoogleDocAppId, arc::kYoutubeAppId, arc::kPlayStoreAppId}; + arc::kGmailAppId, extension_misc::kGoogleDocAppId, arc::kYoutubeAppId, + arc::kPlayStoreAppId}; const char kDefaultPinnedAppsKey[] = "default"; const char kDefaultPinnedApps7AppsKey[] = "7apps";
diff --git a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc index f3cd8334..f1891e9 100644 --- a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc +++ b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc
@@ -198,8 +198,8 @@ UpdateBrowserItemState(); } else if (change.type() == TabStripModelChange::kRemoved) { auto* remove = change.GetRemove(); - if (remove->will_be_deleted) { - for (const auto& contents : remove->contents) + for (const auto& contents : remove->contents) { + if (contents.will_be_deleted) OnTabClosing(contents.contents); } } else if (change.type() == TabStripModelChange::kReplaced) {
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc index 632bf2c0..96c4408 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc
@@ -417,11 +417,6 @@ base::FilePath(), Manifest::UNPACKED, manifest, Extension::NO_FLAGS, extension_misc::kYoutubeAppId, &error); - // Fake File Manager app. - extension_files_app_ = Extension::Create( - base::FilePath(), Manifest::UNPACKED, manifest, Extension::NO_FLAGS, - extension_misc::kFilesManagerAppId, &error); - MaybeStartWebAppProvider(); } @@ -793,8 +788,6 @@ result += "Doc"; } else if (app == extension_youtube_app_->id()) { result += "Youtube"; - } else if (app == extension_files_app_->id()) { - result += "Files"; } else if (app == extension_platform_app_->id()) { result += "Platform_App"; } else if (app == arc_support_host_->id()) { @@ -969,7 +962,6 @@ scoped_refptr<Extension> extension_gmail_app_; scoped_refptr<Extension> extension_doc_app_; scoped_refptr<Extension> extension_youtube_app_; - scoped_refptr<Extension> extension_files_app_; scoped_refptr<Extension> extension_platform_app_; scoped_refptr<Extension> arc_support_host_; @@ -1072,7 +1064,6 @@ extension_service_->AddExtension(extension_gmail_app_.get()); extension_service_->AddExtension(extension_doc_app_.get()); extension_service_->AddExtension(extension_youtube_app_.get()); - extension_service_->AddExtension(extension_files_app_.get()); extension_service_->AddExtension(arc_support_host_.get()); std::string error; @@ -1090,6 +1081,7 @@ {extension_misc::kCalendarAppId, "Calendar"}, {extension_misc::kGoogleSheetsAppId, "Sheets"}, {extension_misc::kGoogleSlidesAppId, "Slides"}, + {extension_misc::kFilesManagerAppId, "Files"}, {extension_misc::kCameraAppId, "Camera"}, {extension_misc::kGooglePhotosAppId, "Photos"}, }; @@ -1351,8 +1343,6 @@ EXPECT_EQ("Chrome, Doc, Youtube, App1", GetPinnedAppStatus()); AddExtension(extension_gmail_app_.get()); EXPECT_EQ("Chrome, Gmail, Doc, Youtube, App1", GetPinnedAppStatus()); - AddExtension(extension_files_app_.get()); - EXPECT_EQ("Chrome, Files, Gmail, Doc, Youtube, App1", GetPinnedAppStatus()); } TEST_F(ChromeLauncherControllerSplitSettingsSyncTest, DefaultApps) { @@ -1393,29 +1383,28 @@ EXPECT_EQ("Chrome, Lacros", GetPinnedAppStatus()); } -TEST_F(ChromeLauncherControllerExtendedShelfTest, ExtendedShelfDefault) { +TEST_F(ChromeLauncherControllerExtendedShelfTest, ExtendedShefDefault) { base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitAndEnableFeatureWithParameters( kEnableExtendedShelfLayout, {std::pair<std::string, std::string>("app_count", "0")}); InitLauncherController(); - EXPECT_EQ("Chrome, Files, Gmail, Doc, Youtube, Play Store", - GetPinnedAppStatus()); + EXPECT_EQ("Chrome, Gmail, Doc, Youtube, Play Store", GetPinnedAppStatus()); } -TEST_F(ChromeLauncherControllerExtendedShelfTest, ExtendedShelf7Apps) { +TEST_F(ChromeLauncherControllerExtendedShelfTest, ExtendedShef7Apps) { base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitAndEnableFeatureWithParameters( kEnableExtendedShelfLayout, {std::pair<std::string, std::string>("app_count", "7")}); InitLauncherController(); - EXPECT_EQ("Chrome, Files, Gmail, Doc, Photos, Youtube, Play Store", + EXPECT_EQ("Chrome, Gmail, Doc, Photos, Files, Youtube, Play Store", GetPinnedAppStatus()); } -TEST_F(ChromeLauncherControllerExtendedShelfTest, ExtendedShelf10Apps) { +TEST_F(ChromeLauncherControllerExtendedShelfTest, ExtendedShef10Apps) { base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitAndEnableFeatureWithParameters( kEnableExtendedShelfLayout, @@ -1423,15 +1412,14 @@ InitLauncherController(); EXPECT_EQ( - "Chrome, Files, Gmail, Calendar, Doc, Sheets, Slides, Camera, Photos, " + "Chrome, Gmail, Calendar, Doc, Sheets, Slides, Files, Camera, Photos, " "Play Store", GetPinnedAppStatus()); } TEST_F(ChromeLauncherControllerExtendedShelfTest, UpgradeFromDefault) { InitLauncherController(); - EXPECT_EQ("Chrome, Files, Gmail, Doc, Youtube, Play Store", - GetPinnedAppStatus()); + EXPECT_EQ("Chrome, Gmail, Doc, Youtube, Play Store", GetPinnedAppStatus()); // Upgrade happens only in case default layout is active. base::test::ScopedFeatureList scoped_feature_list; @@ -1443,15 +1431,15 @@ AddExtension(extension1_.get()); EXPECT_EQ( - "Chrome, Files, Gmail, Calendar, Doc, Sheets, Slides, Camera, Photos, " + "Chrome, Gmail, Calendar, Doc, Sheets, Slides, Files, Camera, Photos, " "Play Store", GetPinnedAppStatus()); } -TEST_F(ChromeLauncherControllerExtendedShelfTest, NoDefaultAfterExperimental) { +TEST_F(ChromeLauncherControllerExtendedShelfTest, NoDefaultAfterExperemental) { const std::string expectations = - "Chrome, Files, Gmail, Calendar, Doc, Sheets, " - "Slides, Camera, Photos, Play Store"; + "Chrome, Gmail, Calendar, Doc, Sheets, " + "Slides, Files, Camera, Photos, Play Store"; { base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitAndEnableFeatureWithParameters( @@ -1478,7 +1466,7 @@ TEST_F(ChromeLauncherControllerExtendedShelfTest, NoUpgradeFromNonDefault) { InitLauncherController(); launcher_controller_->UnpinAppWithID(extension_misc::kYoutubeAppId); - EXPECT_EQ("Chrome, Files, Gmail, Doc, Play Store", GetPinnedAppStatus()); + EXPECT_EQ("Chrome, Gmail, Doc, Play Store", GetPinnedAppStatus()); // Upgrade does not happen due to default pin layout change. base::test::ScopedFeatureList scoped_feature_list; @@ -1489,7 +1477,7 @@ // Trigger layout update, app_id does not matter. AddExtension(extension1_.get()); - EXPECT_EQ("Chrome, Files, Gmail, Doc, Play Store", GetPinnedAppStatus()); + EXPECT_EQ("Chrome, Gmail, Doc, Play Store", GetPinnedAppStatus()); } TEST_F(ChromeLauncherControllerWithArcTest, ArcAppPinCrossPlatformWorkflow) {
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 2c9d816..ef1c039 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc
@@ -1182,9 +1182,8 @@ break; } case TabStripModelChange::kRemoved: { - const bool will_be_deleted = change.GetRemove()->will_be_deleted; for (const auto& contents : change.GetRemove()->contents) { - if (will_be_deleted) + if (contents.will_be_deleted) OnTabClosing(contents.contents); OnTabDetached(contents.contents, contents.contents == selection.old_contents);
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index b8bc2c5..b454c034 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc
@@ -200,8 +200,10 @@ return; auto* remove = change.GetRemove(); - if (remove->will_be_deleted) - closing_count_ += remove->contents.size(); + for (const auto& contents : remove->contents) { + if (contents.will_be_deleted) + closing_count_ += 1; + } } int closing_count() const { return closing_count_; }
diff --git a/chrome/browser/ui/tabs/tab_strip_model.cc b/chrome/browser/ui/tabs/tab_strip_model.cc index fa808e55..032eb7a 100644 --- a/chrome/browser/ui/tabs/tab_strip_model.cc +++ b/chrome/browser/ui/tabs/tab_strip_model.cc
@@ -247,14 +247,17 @@ NOTREACHED(); } -// Holds state for a WebContents that has been detached from the tab strip. +// Holds state for a WebContents that has been detached from the tab strip. Will +// also handle WebContents deletion if |will_delete| is true. struct TabStripModel::DetachedWebContents { DetachedWebContents(int index_before_any_removals, int index_at_time_of_removal, - std::unique_ptr<WebContents> contents) + std::unique_ptr<WebContents> contents, + bool will_delete) : contents(std::move(contents)), index_before_any_removals(index_before_any_removals), - index_at_time_of_removal(index_at_time_of_removal) {} + index_at_time_of_removal(index_at_time_of_removal), + will_delete(will_delete) {} DetachedWebContents(const DetachedWebContents&) = delete; DetachedWebContents& operator=(const DetachedWebContents&) = delete; ~DetachedWebContents() = default; @@ -271,17 +274,17 @@ // tabs are being simultaneously removed, the index reflects previously // removed tabs in this batch. const int index_at_time_of_removal; + + // Whether to delete the WebContents after sending notifications. + const bool will_delete; }; -// Holds all state necessary to send notifications for detached tabs. Will -// also handle WebContents deletion if |will_delete| is true. +// Holds all state necessary to send notifications for detached tabs. struct TabStripModel::DetachNotifications { DetachNotifications(WebContents* initially_active_web_contents, - const ui::ListSelectionModel& selection_model, - bool will_delete) + const ui::ListSelectionModel& selection_model) : initially_active_web_contents(initially_active_web_contents), - selection_model(selection_model), - will_delete(will_delete) {} + selection_model(selection_model) {} DetachNotifications(const DetachNotifications&) = delete; DetachNotifications& operator=(const DetachNotifications&) = delete; ~DetachNotifications() = default; @@ -301,9 +304,6 @@ // The selection model prior to any tabs being detached. const ui::ListSelectionModel selection_model; - - // Whether to delete the WebContents after sending notifications. - const bool will_delete; }; /////////////////////////////////////////////////////////////////////////////// @@ -428,12 +428,12 @@ GetWebContentsAtImpl(active_index()); DetachNotifications notifications(initially_active_web_contents, - selection_model_, /*will_delete=*/false); + selection_model_); std::unique_ptr<DetachedWebContents> dwc = std::make_unique<DetachedWebContents>( index, index, - DetachWebContentsImpl(index, /*create_historical_tab=*/false, - /*will_delete=*/false)); + DetachWebContentsImpl(index, /*create_historical_tab=*/false), + /*will_delete=*/false); notifications.detached_web_contents.push_back(std::move(dwc)); SendDetachWebContentsNotifications(¬ifications); return std::move(notifications.detached_web_contents[0]->contents); @@ -441,8 +441,7 @@ std::unique_ptr<content::WebContents> TabStripModel::DetachWebContentsImpl( int index, - bool create_historical_tab, - bool will_delete) { + bool create_historical_tab) { if (contents_data_.empty()) return nullptr; DCHECK(ContainsIndex(index)); @@ -502,10 +501,10 @@ }); TabStripModelChange::Remove remove; - remove.will_be_deleted = notifications->will_delete; for (auto& dwc : notifications->detached_web_contents) { - remove.contents.push_back( - {dwc->contents.get(), dwc->index_before_any_removals}); + remove.contents.push_back({dwc->contents.get(), + dwc->index_before_any_removals, + dwc->will_delete}); } TabStripModelChange change(std::move(remove)); @@ -530,7 +529,7 @@ } for (auto& dwc : notifications->detached_web_contents) { - if (notifications->will_delete) { + if (dwc->will_delete) { // This destroys the WebContents, which will also send // WebContentsDestroyed notifications. dwc->contents.reset(); @@ -1720,7 +1719,17 @@ for (auto& observer : observers_) observer.WillCloseAllTabs(this); } - const bool closed_all = CloseWebContentses(items, close_types); + + DetachNotifications notifications(GetWebContentsAtImpl(active_index()), + selection_model_); + const bool closed_all = + CloseWebContentses(items, close_types, ¬ifications); + + // When unload handler is triggered for all items, we should wait for the + // result. + if (!notifications.detached_web_contents.empty()) + SendDetachWebContentsNotifications(¬ifications); + if (!ref) return closed_all; if (closing_all) { @@ -1737,7 +1746,8 @@ bool TabStripModel::CloseWebContentses( base::span<content::WebContents* const> items, - uint32_t close_types) { + uint32_t close_types, + DetachNotifications* notifications) { if (items.empty()) return true; @@ -1761,9 +1771,6 @@ pair.first->FastShutdownIfPossible(pair.second, false); } - DetachNotifications notifications(GetWebContentsAtImpl(active_index()), - selection_model_, /*will_delete=*/true); - // We now return to our regularly scheduled shutdown procedure. bool closed_all = true; @@ -1798,16 +1805,11 @@ std::make_unique<DetachedWebContents>( original_indices[i], current_index, DetachWebContentsImpl(current_index, - close_types & CLOSE_CREATE_HISTORICAL_TAB, - /*will_delete=*/true)); - notifications.detached_web_contents.push_back(std::move(dwc)); + close_types & CLOSE_CREATE_HISTORICAL_TAB), + /*will_delete=*/true); + notifications->detached_web_contents.push_back(std::move(dwc)); } - // When unload handler is triggered for all items, we should wait for the - // result. - if (!notifications.detached_web_contents.empty()) - SendDetachWebContentsNotifications(¬ifications); - return closed_all; }
diff --git a/chrome/browser/ui/tabs/tab_strip_model.h b/chrome/browser/ui/tabs/tab_strip_model.h index 70e8a233..b740d3c 100644 --- a/chrome/browser/ui/tabs/tab_strip_model.h +++ b/chrome/browser/ui/tabs/tab_strip_model.h
@@ -592,8 +592,7 @@ // that TabDetachedAt() is called. std::unique_ptr<content::WebContents> DetachWebContentsImpl( int index, - bool create_historical_tab, - bool will_delete); + bool create_historical_tab); // We batch send notifications. This has two benefits: // 1) This allows us to send the minimal number of necessary notifications. @@ -667,7 +666,8 @@ // UI for the WebContents. See UnloadController for details on how unload // handlers are processed. bool CloseWebContentses(base::span<content::WebContents* const> items, - uint32_t close_types); + uint32_t close_types, + DetachNotifications* notifications); // Gets the WebContents at an index. Does no bounds checking. content::WebContents* GetWebContentsAtImpl(int index) const;
diff --git a/chrome/browser/ui/tabs/tab_strip_model_observer.h b/chrome/browser/ui/tabs/tab_strip_model_observer.h index 51a73bbd..796b26f 100644 --- a/chrome/browser/ui/tabs/tab_strip_model_observer.h +++ b/chrome/browser/ui/tabs/tab_strip_model_observer.h
@@ -43,6 +43,16 @@ virtual ~Delta() = default; }; + struct ContentsWithIndexAndWillBeDeleted { + content::WebContents* contents; + int index; + + // The specified WebContents are being closed (and eventually destroyed). + // TODO(https://crbug.com/1149549): Make will_be_deleted into enum to + // consider the case for ClosedTabCache feature separtely. + bool will_be_deleted; + }; + struct ContentsWithIndex { content::WebContents* contents; int index; @@ -89,8 +99,10 @@ Remove(Remove&& other); Remove& operator=(Remove&& other); - // Contains the list of web contents removed, along with their indexes at - // the time of removal. For example, if we removed elements: + // Contains the list of web contents removed with their indexes at + // the time of removal along with flag |will_be_deleted| that indicates if + // the web contents will be deleted or not after removing. For example, if + // we removed elements: // // Before removal: // A B C D E F G @@ -111,11 +123,7 @@ // them in the order the web contents appear in |contents|. Observers should // not do index-based queries based on their own internally-stored indices // until after processing all of |contents|. - std::vector<ContentsWithIndex> contents; - - // The specified WebContents are being closed (and eventually destroyed). - // |tab_strip_model| is the TabStripModel that contained the tab. - bool will_be_deleted; + std::vector<ContentsWithIndexAndWillBeDeleted> contents; }; // A WebContents was moved from |from_index| to |to_index|. This implicitly
diff --git a/chrome/browser/ui/tabs/tab_strip_model_stats_recorder.cc b/chrome/browser/ui/tabs/tab_strip_model_stats_recorder.cc index 64bf2f81..c7acd95 100644 --- a/chrome/browser/ui/tabs/tab_strip_model_stats_recorder.cc +++ b/chrome/browser/ui/tabs/tab_strip_model_stats_recorder.cc
@@ -144,10 +144,11 @@ TabStripModel* tab_strip_model, const TabStripModelChange& change, const TabStripSelectionChange& selection) { - if (change.type() == TabStripModelChange::kRemoved && - change.GetRemove()->will_be_deleted) { - for (const auto& contents : change.GetRemove()->contents) - OnTabClosing(contents.contents); + if (change.type() == TabStripModelChange::kRemoved) { + for (const auto& contents : change.GetRemove()->contents) { + if (contents.will_be_deleted) + OnTabClosing(contents.contents); + } } else if (change.type() == TabStripModelChange::kReplaced) { auto* replace = change.GetReplace(); OnTabReplaced(replace->old_contents, replace->new_contents);
diff --git a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc index ce6a2df..b3eaf7e7 100644 --- a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc
@@ -249,9 +249,8 @@ break; } case TabStripModelChange::kRemoved: { - const bool will_be_deleted = change.GetRemove()->will_be_deleted; for (const auto& contents : change.GetRemove()->contents) { - if (will_be_deleted) + if (contents.will_be_deleted) PushCloseState(contents.contents, contents.index); PushDetachState(contents.contents, contents.index, selection.old_contents == contents.contents);
diff --git a/chrome/browser/ui/user_education/active_tab_tracker.cc b/chrome/browser/ui/user_education/active_tab_tracker.cc index 502fb850..20911fbb 100644 --- a/chrome/browser/ui/user_education/active_tab_tracker.cc +++ b/chrome/browser/ui/user_education/active_tab_tracker.cc
@@ -49,15 +49,14 @@ // If the closing tab was the active tab, call the callback. // Ignore if the tab isn't being closed (this would happen if it were // dragged to a different tab strip). - if (remove->will_be_deleted) { for (const auto& contents : remove->contents) { - if (contents.index == prev_active_tab_index) { + if (contents.will_be_deleted && + contents.index == prev_active_tab_index) { active_tab_closed_callback_.Run( model, clock_->NowTicks() - active_tab_changed_times_[model]); } } } - } if (selection.active_tab_changed()) active_tab_changed_times_[model] = clock_->NowTicks();
diff --git a/chrome/browser/ui/views/borealis/borealis_installer_view.cc b/chrome/browser/ui/views/borealis/borealis_installer_view.cc index 2898ad30..3e274708 100644 --- a/chrome/browser/ui/views/borealis/borealis_installer_view.cc +++ b/chrome/browser/ui/views/borealis/borealis_installer_view.cc
@@ -296,6 +296,9 @@ IDS_BOREALIS_INSTALLER_NOT_ALLOWED_MESSAGE, app_name_, base::NumberToString16( static_cast<std::underlying_type_t<ResultEnum>>(*result_))); + case ResultEnum::kOffline: + return l10n_util::GetStringUTF16( + IDS_BOREALIS_INSTALLER_OFFLINE_MESSAGE); // DLC Failures. case ResultEnum::kDlcInternalError: return l10n_util::GetStringFUTF16(
diff --git a/chrome/browser/ui/views/overlay/overlay_window_views.cc b/chrome/browser/ui/views/overlay/overlay_window_views.cc index f07d400f5..6bbefe36 100644 --- a/chrome/browser/ui/views/overlay/overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/overlay_window_views.cc
@@ -196,7 +196,7 @@ }; // static -std::unique_ptr<content::OverlayWindow> OverlayWindowViews::Create( +std::unique_ptr<OverlayWindowViews> OverlayWindowViews::Create( content::PictureInPictureWindowController* controller) { // Can't use make_unique(), which doesn't have access to the private // constructor. It's important that the constructor be private, because it @@ -266,7 +266,7 @@ gfx::Rect OverlayWindowViews::CalculateAndUpdateWindowBounds() { gfx::Rect work_area = GetWorkAreaForWindow(); - UpdateMaxSize(work_area, window_bounds_.size()); + UpdateMaxSize(work_area); // Lower bound size of the window is a fixed value to allow for minimal sizes // on UI affordances, such as buttons. @@ -841,7 +841,7 @@ // Update the maximum size of the widget in case we have moved to another // window. - UpdateMaxSize(GetWorkAreaForWindow(), window_bounds_.size()); + UpdateMaxSize(GetWorkAreaForWindow()); #if defined(OS_CHROMEOS) // Update the positioning of some icons when the window is moved. @@ -1052,23 +1052,21 @@ .work_area(); } -gfx::Size OverlayWindowViews::UpdateMaxSize(const gfx::Rect& work_area, - const gfx::Size& window_size) { +void OverlayWindowViews::UpdateMaxSize(const gfx::Rect& work_area) { max_size_ = gfx::Size(work_area.width() / 2, work_area.height() / 2); if (!native_widget()) - return window_size; + return; // native_widget() is required for OnSizeConstraintsChanged. OnSizeConstraintsChanged(); - if (window_size.width() <= max_size_.width() && - window_size.height() <= max_size_.height()) { - return window_size; + if (window_bounds_.width() <= max_size_.width() && + window_bounds_.height() <= max_size_.height()) { + return; } SetSize(max_size_); - return gfx::Size(max_size_); } void OverlayWindowViews::TogglePlayPause() {
diff --git a/chrome/browser/ui/views/overlay/overlay_window_views.h b/chrome/browser/ui/views/overlay/overlay_window_views.h index 00757ca..f99818a 100644 --- a/chrome/browser/ui/views/overlay/overlay_window_views.h +++ b/chrome/browser/ui/views/overlay/overlay_window_views.h
@@ -29,7 +29,7 @@ class OverlayWindowViews : public content::OverlayWindow, public views::Widget { public: - static std::unique_ptr<content::OverlayWindow> Create( + static std::unique_ptr<OverlayWindowViews> Create( content::PictureInPictureWindowController* controller); ~OverlayWindowViews() override; @@ -94,12 +94,6 @@ ui::Layer* video_layer_for_testing() const; cc::Layer* GetLayerForTesting() override; - // Update the max size of the widget based on |work_area| and |window_size|. - // The return value is the new size of the window if it was resized and is - // only used for testing. - gfx::Size UpdateMaxSize(const gfx::Rect& work_area, - const gfx::Size& window_size); - private: explicit OverlayWindowViews( content::PictureInPictureWindowController* controller); @@ -119,6 +113,9 @@ // Finish initialization by performing the steps that require the root View. void OnRootViewReady(); + // Update the max size of the widget based on |work_area| and window size. + void UpdateMaxSize(const gfx::Rect& work_area); + // Update the bounds of the layers on the window. This may introduce // letterboxing. void UpdateLayerBoundsWithLetterboxing(gfx::Size window_size);
diff --git a/chrome/browser/ui/views/overlay/overlay_window_views_unittest.cc b/chrome/browser/ui/views/overlay/overlay_window_views_unittest.cc new file mode 100644 index 0000000..0daeb03 --- /dev/null +++ b/chrome/browser/ui/views/overlay/overlay_window_views_unittest.cc
@@ -0,0 +1,132 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <memory> +#include <utility> + +#include "chrome/browser/ui/views/overlay/overlay_window_views.h" +#include "chrome/test/base/testing_profile.h" +#include "chrome/test/views/chrome_views_test_base.h" +#include "content/public/browser/picture_in_picture_window_controller.h" +#include "content/public/test/test_web_contents_factory.h" +#include "ui/display/test/scoped_screen_override.h" +#include "ui/display/test/test_screen.h" + +class TestPictureInPictureWindowController + : public content::PictureInPictureWindowController { + public: + explicit TestPictureInPictureWindowController( + content::WebContents* web_contents) + : web_contents_(web_contents) {} + + // PictureInPictureWindowController: + void Show() override {} + void Close(bool) override {} + void CloseAndFocusInitiator() override {} + void OnWindowDestroyed() override {} + content::OverlayWindow* GetWindowForTesting() override { return nullptr; } + void UpdateLayerBounds() override {} + bool IsPlayerActive() override { return false; } + content::WebContents* GetWebContents() override { return web_contents_; } + void UpdatePlaybackState(bool, bool) override {} + bool TogglePlayPause() override { return false; } + void SkipAd() override {} + void NextTrack() override {} + void PreviousTrack() override {} + + private: + content::WebContents* const web_contents_; +}; + +// When running on ChromeOS, NativeWidgetAura requires the parent and/or +// context to be non-null. OverlayWindowViews provides neither, so we do it +// here. Normally this is done by the browser-specific ViewsDelegate. +class TestViewsDelegateWithContext : public views::TestViewsDelegate { + public: + // ViewsDelegate: + void OnBeforeWidgetInit( + views::Widget::InitParams* params, + views::internal::NativeWidgetDelegate* delegate) override { + views::TestViewsDelegate::OnBeforeWidgetInit(params, delegate); + if (!params->context) + params->context = context_; + } + + void set_context(gfx::NativeWindow context) { context_ = context; } + + private: + gfx::NativeWindow context_; +}; + +class OverlayWindowViewsTest : public ChromeViewsTestBase { + public: + // ChromeViewsTestBase: + void SetUp() override { + // set_views_delegate() must be called before SetUp(), and GetContext() is + // null before that, hence the unobvious initialization order. + auto views_delegate = std::make_unique<TestViewsDelegateWithContext>(); + auto* views_delegate_with_context = views_delegate.get(); + set_views_delegate(std::move(views_delegate)); + // Purposely skip ChromeViewsTestBase::SetUp() as that creates ash::Shell + // on ChromeOS, which we don't want. + ViewsTestBase::SetUp(); + views_delegate_with_context->set_context(GetContext()); + + test_views_delegate()->set_use_desktop_native_widgets(true); + + // The default work area must be big enough to fit the minimum + // OverlayWindowViews size. + SetDisplayWorkArea({0, 0, 1000, 1000}); + + overlay_window_ = OverlayWindowViews::Create(&pip_window_controller_); + } + + void TearDown() override { + overlay_window_.reset(); + ViewsTestBase::TearDown(); + } + + void SetDisplayWorkArea(const gfx::Rect& work_area) { + display::Display display = test_screen_.GetPrimaryDisplay(); + display.set_work_area(work_area); + test_screen_.display_list().UpdateDisplay(display); + } + + OverlayWindowViews& overlay_window() { return *overlay_window_; } + + private: + TestingProfile profile_; + content::TestWebContentsFactory web_contents_factory_; + TestPictureInPictureWindowController pip_window_controller_{ + web_contents_factory_.CreateWebContents(&profile_)}; + + display::test::TestScreen test_screen_; + display::test::ScopedScreenOverride scoped_screen_override_{&test_screen_}; + + std::unique_ptr<OverlayWindowViews> overlay_window_; +}; + +TEST_F(OverlayWindowViewsTest, UpdateMaximumSize) { + SetDisplayWorkArea({0, 0, 4000, 4000}); + + overlay_window().UpdateVideoSize({480, 320}); + + // The initial size is determined by the work area and the video natural size + // (aspect ratio). + EXPECT_EQ(gfx::Size(1200, 800), overlay_window().GetBounds().size()); + // The initial maximum size is a quarter of the work area. + EXPECT_EQ(gfx::Size(2000, 2000), overlay_window().GetMaximumSize()); + + // If the maximum size increases then we should keep the existing window size. + SetDisplayWorkArea({0, 0, 8000, 8000}); + overlay_window().OnNativeWidgetMove(); + EXPECT_EQ(gfx::Size(1200, 800), overlay_window().GetBounds().size()); + EXPECT_EQ(gfx::Size(4000, 4000), overlay_window().GetMaximumSize()); + + // If the maximum size decreases then we should shrink to fit. + SetDisplayWorkArea({0, 0, 1000, 1000}); + overlay_window().OnNativeWidgetMove(); + EXPECT_EQ(gfx::Size(500, 500), overlay_window().GetBounds().size()); + EXPECT_EQ(gfx::Size(500, 500), overlay_window().GetMaximumSize()); +}
diff --git a/chrome/browser/ui/views/sharesheet/sharesheet_bubble_view.cc b/chrome/browser/ui/views/sharesheet/sharesheet_bubble_view.cc index 8ca1d8f..04b7b00 100644 --- a/chrome/browser/ui/views/sharesheet/sharesheet_bubble_view.cc +++ b/chrome/browser/ui/views/sharesheet/sharesheet_bubble_view.cc
@@ -9,6 +9,7 @@ #include "base/i18n/rtl.h" #include "base/strings/string16.h" +#include "base/time/time.h" #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sharesheet/sharesheet_metrics.h" @@ -24,11 +25,15 @@ #include "ui/accessibility/ax_enums.mojom-forward.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/compositor/closure_animation_observer.h" +#include "ui/compositor/scoped_layer_animation_settings.h" +#include "ui/gfx/animation/tween.h" #include "ui/gfx/color_palette.h" #include "ui/gfx/font_list.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/image/image_skia.h" +#include "ui/gfx/transform_util.h" #include "ui/views/accessibility/view_accessibility.h" #include "ui/views/bubble/bubble_border.h" #include "ui/views/bubble/bubble_frame_view.h" @@ -72,6 +77,9 @@ constexpr int kSpacing = 24; constexpr int kTitleLineHeight = 24; +constexpr float kSharesheetOpacityTranslucent = 0.0f; +constexpr float kSharesheetOpacityOpaque = 1.0f; + constexpr char kTitleFont[] = "GoogleSans, Medium, 16px"; constexpr char kExpandViewTitleFont[] = "Roboto, Medium, 15px"; @@ -162,9 +170,9 @@ main_view_->RequestFocus(); main_view_->GetViewAccessibility().OverrideName( l10n_util::GetStringUTF16(IDS_SHARESHEET_TITLE_LABEL)); - views::Widget* widget = views::BubbleDialogDelegateView::CreateBubble(this); + views::BubbleDialogDelegateView::CreateBubble(this); GetWidget()->GetRootView()->Layout(); - widget->Show(); + ShowWidgetWithAnimateFadeIn(); if (expanded_view_ == nullptr || expanded_view_->children().size() > 1) { SetToDefaultBubbleSizing(); @@ -290,20 +298,18 @@ UpdateAnchorPosition(); } +// This function is called from a ShareAction or after an app launches. void SharesheetBubbleView::CloseBubble() { - views::Widget* widget = View::GetWidget(); - widget->CloseWithReason(views::Widget::ClosedReason::kAcceptButtonClicked); - // Reset all bubble values. - active_target_ = base::string16(); - intent_.reset(); - keyboard_highlighted_target_ = 0; - SetToDefaultBubbleSizing(); + CloseWidgetWithAnimateFadeOut( + views::Widget::ClosedReason::kAcceptButtonClicked); } void SharesheetBubbleView::OnKeyEvent(ui::KeyEvent* event) { + // Ignore key press if bubble is closing. // TODO(crbug.com/1141741) Update to OnKeyPressed. if (!IsKeyboardCodeArrow(event->key_code()) || - event->type() != ui::ET_KEY_RELEASED || default_view_ == nullptr) { + event->type() != ui::ET_KEY_RELEASED || default_view_ == nullptr || + is_bubble_closing_) { return; } @@ -368,21 +374,23 @@ return gfx::Size(width_, height_); } -void SharesheetBubbleView::OnWidgetDestroyed(views::Widget* widget) { - // If there is no active_target_ value, the user cancelled without making a - // selection and we will record this. - if (user_cancelled_) { +void SharesheetBubbleView::OnWidgetActivationChanged(views::Widget* widget, + bool active) { + // Catch widgets that are closing due to the user clicking out of the bubble. + // If |user_selection_made_| we should not close the bubble here as it will be + // closed in a different code path. + if (!active && !user_selection_made_) { + if (close_callback_) { + std::move(close_callback_).Run(sharesheet::SharesheetResult::kCancel); + } sharesheet::SharesheetMetrics::RecordSharesheetActionMetrics( sharesheet::SharesheetMetrics::UserAction::kCancelled); - } - delegate_->OnBubbleClosed(active_target_); - if (close_callback_) { - std::move(close_callback_).Run(sharesheet::SharesheetResult::kCancel); + CloseWidgetWithAnimateFadeOut(views::Widget::ClosedReason::kLostFocus); } } void SharesheetBubbleView::CreateBubble() { - set_close_on_deactivate(true); + set_close_on_deactivate(false); SetButtons(ui::DIALOG_BUTTON_NONE); SetLayoutManager(std::make_unique<views::BoxLayout>( @@ -418,6 +426,7 @@ } void SharesheetBubbleView::TargetButtonPressed(TargetInfo target) { + user_selection_made_ = true; auto type = target.type; if (type == sharesheet::TargetType::kAction) active_target_ = target.launch_name; @@ -426,7 +435,6 @@ delegate_->OnTargetSelected(target.launch_name, type, std::move(intent_), share_action_view_); intent_.reset(); - user_cancelled_ = false; if (close_callback_) std::move(close_callback_).Run(sharesheet::SharesheetResult::kSuccess); } @@ -454,3 +462,61 @@ width_ = kDefaultBubbleWidth; height_ = kDefaultBubbleHeight; } + +void SharesheetBubbleView::ShowWidgetWithAnimateFadeIn() { + constexpr float kSharesheetScaleUpFactor = 0.8f; + constexpr base::TimeDelta kSharesheetScaleUpTime = + base::TimeDelta::FromMilliseconds(150); + constexpr base::TimeDelta kSharesheetOpacityFadeInTime = + base::TimeDelta::FromMilliseconds(100); + + views::Widget* widget = View::GetWidget(); + ui::Layer* layer = widget->GetLayer(); + + layer->SetOpacity(kSharesheetOpacityTranslucent); + widget->ShowInactive(); + gfx::Transform transform = gfx::GetScaleTransform( + gfx::Rect(layer->size()).CenterPoint(), kSharesheetScaleUpFactor); + layer->SetTransform(transform); + auto scoped_settings = + std::make_unique<ui::ScopedLayerAnimationSettings>(layer->GetAnimator()); + + scoped_settings->SetTransitionDuration(kSharesheetScaleUpTime); + scoped_settings->SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); + layer->SetTransform(gfx::Transform()); + + scoped_settings->SetTransitionDuration(kSharesheetOpacityFadeInTime); + scoped_settings->SetTweenType(gfx::Tween::Type::LINEAR); + layer->SetOpacity(kSharesheetOpacityOpaque); + widget->Activate(); +} + +void SharesheetBubbleView::CloseWidgetWithAnimateFadeOut( + views::Widget::ClosedReason closed_reason) { + constexpr base::TimeDelta kSharesheetOpacityFadeOutTime = + base::TimeDelta::FromMilliseconds(80); + + is_bubble_closing_ = true; + ui::Layer* layer = View::GetWidget()->GetLayer(); + // If open animation is still running, abort it as we are now closing. + layer->GetAnimator()->AbortAllAnimations(); + auto scoped_settings = + std::make_unique<ui::ScopedLayerAnimationSettings>(layer->GetAnimator()); + scoped_settings->SetTweenType(gfx::Tween::Type::LINEAR); + scoped_settings->SetTransitionDuration(kSharesheetOpacityFadeOutTime); + layer->SetOpacity(kSharesheetOpacityTranslucent); + // We are closing the native widget during the close animation which results + // in destroying the layer and the animation and the observer not calling + // back. Thus it is safe to use base::Unretained here. + scoped_settings->AddObserver(new ui::ClosureAnimationObserver( + base::BindOnce(&SharesheetBubbleView::CloseWidgetWithReason, + base::Unretained(this), closed_reason))); +} + +void SharesheetBubbleView::CloseWidgetWithReason( + views::Widget::ClosedReason closed_reason) { + View::GetWidget()->CloseWithReason(closed_reason); + + // Bubble is deleted here. + delegate_->OnBubbleClosed(active_target_); +}
diff --git a/chrome/browser/ui/views/sharesheet/sharesheet_bubble_view.h b/chrome/browser/ui/views/sharesheet/sharesheet_bubble_view.h index 562698ee..fc8f91e1 100644 --- a/chrome/browser/ui/views/sharesheet/sharesheet_bubble_view.h +++ b/chrome/browser/ui/views/sharesheet/sharesheet_bubble_view.h
@@ -57,7 +57,7 @@ // views::BubbleDialogDelegateView: gfx::Size CalculatePreferredSize() const override; - void OnWidgetDestroyed(views::Widget* widget) override; + void OnWidgetActivationChanged(views::Widget* widget, bool active) override; void CreateBubble(); std::unique_ptr<views::View> MakeScrollableTargetView( @@ -69,6 +69,9 @@ void TargetButtonPressed(TargetInfo target); void UpdateAnchorPosition(); void SetToDefaultBubbleSizing(); + void ShowWidgetWithAnimateFadeIn(); + void CloseWidgetWithAnimateFadeOut(views::Widget::ClosedReason closed_reason); + void CloseWidgetWithReason(views::Widget::ClosedReason closed_reason); // Owns this class. sharesheet::SharesheetServiceDelegate* delegate_; @@ -78,8 +81,9 @@ int width_ = 0; int height_ = 0; - bool user_cancelled_ = true; bool show_expanded_view_ = false; + bool is_bubble_closing_ = false; + bool user_selection_made_ = false; size_t keyboard_highlighted_target_ = 0;
diff --git a/chrome/browser/ui/views/sharesheet/sharesheet_bubble_view_browsertest.cc b/chrome/browser/ui/views/sharesheet/sharesheet_bubble_view_browsertest.cc index ab56f248..8e3a513f 100644 --- a/chrome/browser/ui/views/sharesheet/sharesheet_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/sharesheet/sharesheet_bubble_view_browsertest.cc
@@ -4,26 +4,28 @@ #include "chrome/browser/ui/views/sharesheet/sharesheet_bubble_view.h" -#include <string> +#include <algorithm> +#include "ash/shell.h" #include "base/test/scoped_feature_list.h" #include "chrome/browser/nearby_sharing/common/nearby_share_features.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sharesheet/sharesheet_service.h" #include "chrome/browser/sharesheet/sharesheet_service_factory.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/test/test_browser_dialog.h" #include "chrome/browser/ui/views/frame/browser_view.h" +#include "chrome/test/base/in_process_browser_test.h" #include "components/services/app_service/public/cpp/intent_filter_util.h" #include "components/services/app_service/public/cpp/intent_test_util.h" #include "components/services/app_service/public/cpp/intent_util.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test.h" +#include "ui/aura/window.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h" class SharesheetBubbleViewBrowserTest : public ::testing::WithParamInterface<bool>, - public DialogBrowserTest { + public InProcessBrowserTest { public: SharesheetBubbleViewBrowserTest() { if (GetParam()) { @@ -33,21 +35,39 @@ } } - // DialogBrowserTest: - void ShowUi(const std::string& name) override { + void ShowUi() { + views::Widget::Widgets old_widgets; + for (aura::Window* root_window : ash::Shell::GetAllRootWindows()) + views::Widget::GetAllChildWidgets(root_window, &old_widgets); + sharesheet::SharesheetService* const sharesheet_service = sharesheet::SharesheetServiceFactory::GetForProfile( browser()->profile()); + GURL test_url = GURL("https://www.google.com/"); auto intent = apps_util::CreateIntentFromUrl(test_url); intent->action = apps_util::kIntentActionSend; sharesheet_service->ShowBubble( browser()->tab_strip_model()->GetActiveWebContents(), std::move(intent), base::DoNothing()); + + views::Widget::Widgets new_widgets; + for (aura::Window* root_window : ash::Shell::GetAllRootWindows()) + views::Widget::GetAllChildWidgets(root_window, &new_widgets); + + views::Widget::Widgets added_widgets; + std::set_difference(new_widgets.begin(), new_widgets.end(), + old_widgets.begin(), old_widgets.end(), + std::inserter(added_widgets, added_widgets.begin())); + ASSERT_EQ(added_widgets.size(), 1u); + sharesheet_widget_ = *added_widgets.begin(); } + bool VerifyUi() { return sharesheet_widget_->IsVisible(); } + private: base::test::ScopedFeatureList scoped_feature_list_; + views::Widget* sharesheet_widget_; }; INSTANTIATE_TEST_SUITE_P(All, @@ -55,5 +75,6 @@ ::testing::Bool()); IN_PROC_BROWSER_TEST_P(SharesheetBubbleViewBrowserTest, InvokeUi_Default) { - ShowAndVerifyUi(); + ShowUi(); + ASSERT_TRUE(VerifyUi()); }
diff --git a/chrome/browser/ui/web_applications/system_web_app_ui_utils.cc b/chrome/browser/ui/web_applications/system_web_app_ui_utils.cc index 67de663..c7d65b1 100644 --- a/chrome/browser/ui/web_applications/system_web_app_ui_utils.cc +++ b/chrome/browser/ui/web_applications/system_web_app_ui_utils.cc
@@ -36,6 +36,10 @@ #include "ui/base/window_open_disposition.h" #include "ui/display/types/display_constants.h" +#if defined(OS_CHROMEOS) +#include "chrome/browser/ui/ash/multi_user/multi_user_util.h" +#endif + namespace { // Returns the profile where we should launch System Web Apps into. It returns // the most appropriate profile for launching, if the provided |profile| is @@ -254,8 +258,16 @@ } } - // TODO(crbug.com/1114939): Need to make sure the browser is shown on the - // correct desktop, when used in multi-profile mode. +#if defined(OS_CHROMEOS) + // LaunchSystemWebApp may be called with a profile associated with an + // inactive (background) desktop (e.g. when multiple users are logged in). + // Here we move the newly created browser window (or the existing one on the + // inactive desktop) to the current active (visible) desktop, so the user + // always see the launched app. + multi_user_util::MoveWindowToCurrentDesktop( + browser->window()->GetNativeWindow()); +#endif + browser->window()->Show(); return browser; }
diff --git a/chrome/browser/ui/web_applications/test/system_web_app_ui_browsertest.cc b/chrome/browser/ui/web_applications/test/system_web_app_ui_browsertest.cc index a62e8ab..5f5d9fe 100644 --- a/chrome/browser/ui/web_applications/test/system_web_app_ui_browsertest.cc +++ b/chrome/browser/ui/web_applications/test/system_web_app_ui_browsertest.cc
@@ -8,6 +8,7 @@ #include <vector> #include "base/strings/utf_string_conversions.h" +#include "base/test/bind.h" #include "base/test/gtest_util.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" @@ -28,6 +29,16 @@ #include "content/public/test/browser_test.h" #include "content/public/test/test_navigation_observer.h" +#if defined(OS_CHROMEOS) +#include "chrome/browser/apps/app_service/app_service_proxy.h" +#include "chrome/browser/apps/app_service/app_service_proxy_factory.h" +#include "chrome/browser/chromeos/login/login_manager_test.h" +#include "chrome/browser/chromeos/login/test/login_manager_mixin.h" +#include "chrome/browser/chromeos/login/ui/user_adding_screen.h" +#include "chrome/browser/ui/ash/multi_user/multi_user_util.h" +#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_helper.h" +#endif + namespace web_app { class SystemWebAppLinkCaptureBrowserTest @@ -431,6 +442,133 @@ EXPECT_FALSE(app_browser->app_controller()->ShouldShowCustomTabBar()); } +#if defined(OS_CHROMEOS) +// Use LoginManagerTest here instead of SystemWebAppManagerBrowserTest, because +// it's less complicated to add SWA to LoginManagerTest than adding multi-logins +// to SWA browsertest. +class SystemWebAppManagerMultiDesktopLaunchBrowserTest + : public chromeos::LoginManagerTest { + public: + SystemWebAppManagerMultiDesktopLaunchBrowserTest() + : chromeos::LoginManagerTest() { + login_mixin_.AppendRegularUsers(2); + account_id1_ = login_mixin_.users()[0].account_id; + account_id2_ = login_mixin_.users()[1].account_id; + installation_ = + TestSystemWebAppInstallation::SetUpAppThatCapturesNavigation( + /* use_web_app_info*/ true); + } + + ~SystemWebAppManagerMultiDesktopLaunchBrowserTest() override = default; + + void WaitForSystemWebAppInstall(Profile* profile) { + base::RunLoop run_loop; + web_app::WebAppProvider::Get(profile) + ->system_web_app_manager() + .on_apps_synchronized() + .Post(FROM_HERE, base::BindLambdaForTesting([&]() { + // Wait one execution loop for on_apps_synchronized() to be + // called on all listeners. + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, run_loop.QuitClosure()); + })); + run_loop.Run(); + } + + Browser* LaunchAppOnProfile(Profile* profile) { + SystemWebAppManager& manager = + web_app::WebAppProvider::Get(profile)->system_web_app_manager(); + + base::Optional<AppId> app_id = + manager.GetAppIdForSystemApp(installation_->GetType()); + CHECK(app_id.has_value()); + + auto launch_params = apps::AppLaunchParams( + *app_id, apps::mojom::LaunchContainer::kLaunchContainerWindow, + WindowOpenDisposition::CURRENT_TAB, + apps::mojom::AppLaunchSource::kSourceAppLauncher); + + content::TestNavigationObserver navigation_observer( + installation_->GetAppUrl()); + + // Watch new WebContents to wait for launches that open an app for the first + // time. + navigation_observer.StartWatchingNewWebContents(); + + // Watch existing WebContents to wait for launches that re-use the + // WebContents e.g. launching an already opened SWA. + navigation_observer.WatchExistingWebContents(); + + content::WebContents* web_contents = + apps::AppServiceProxyFactory::GetForProfile(profile) + ->BrowserAppLauncher() + ->LaunchAppWithParams(std::move(launch_params)); + + navigation_observer.Wait(); + + return chrome::FindBrowserWithWebContents(web_contents); + } + + protected: + std::unique_ptr<TestSystemWebAppInstallation> installation_; + chromeos::LoginManagerMixin login_mixin_{&mixin_host_}; + AccountId account_id1_; + AccountId account_id2_; +}; + +IN_PROC_BROWSER_TEST_F(SystemWebAppManagerMultiDesktopLaunchBrowserTest, + LaunchToActiveDesktop) { + // Login two users. + LoginUser(account_id1_); + base::RunLoop().RunUntilIdle(); + chromeos::UserAddingScreen::Get()->Start(); + AddUser(account_id2_); + base::RunLoop().RunUntilIdle(); + + // Wait for System Apps to be installed on both user profiles. + auto* user_manager = user_manager::UserManager::Get(); + Profile* profile1 = chromeos::ProfileHelper::Get()->GetProfileByUser( + user_manager->FindUser(account_id1_)); + Profile* profile2 = chromeos::ProfileHelper::Get()->GetProfileByUser( + user_manager->FindUser(account_id2_)); + WaitForSystemWebAppInstall(profile1); + WaitForSystemWebAppInstall(profile2); + + // Set user 1 to be active. + user_manager->SwitchActiveUser(account_id1_); + EXPECT_TRUE(multi_user_util::IsProfileFromActiveUser(profile1)); + EXPECT_FALSE(multi_user_util::IsProfileFromActiveUser(profile2)); + + // Launch the app from user 2 profile. The window should be on user 1 + // (the active) desktop. + Browser* browser2 = LaunchAppOnProfile(profile2); + EXPECT_TRUE( + MultiUserWindowManagerHelper::GetInstance()->IsWindowOnDesktopOfUser( + browser2->window()->GetNativeWindow(), account_id1_)); + + // Launch the app from user 1 profile. The window should be on user 1 (the + // active) desktop. And there should be two different browser windows + // (for each profile). + Browser* browser1 = LaunchAppOnProfile(profile1); + EXPECT_TRUE( + MultiUserWindowManagerHelper::GetInstance()->IsWindowOnDesktopOfUser( + browser1->window()->GetNativeWindow(), account_id1_)); + + EXPECT_NE(browser1, browser2); + EXPECT_EQ(2U, chrome::GetTotalBrowserCount()); + + // Switch to user 2, then launch the app. SWAs reuse their window, so it + // should bring `browser2` to user 2 (the active) desktop. + user_manager->SwitchActiveUser(account_id2_); + Browser* browser2_relaunch = LaunchAppOnProfile(profile2); + + EXPECT_EQ(browser2, browser2_relaunch); + EXPECT_TRUE( + MultiUserWindowManagerHelper::GetInstance()->IsWindowOnDesktopOfUser( + browser2->window()->GetNativeWindow(), account_id2_)); +} +#endif // defined(OS_CHROMEOS) + // The following tests are disabled in DCHECK builds. LaunchSystemWebApp DCHECKs // if the wrong profile is used. EXPECT_DCHECK_DEATH (or its variants) aren't // reliable in browsertests, so we don't test this. This is okay because these
diff --git a/chrome/browser/ui/web_applications/web_app_metrics.cc b/chrome/browser/ui/web_applications/web_app_metrics.cc index afa1f221..f59721c 100644 --- a/chrome/browser/ui/web_applications/web_app_metrics.cc +++ b/chrome/browser/ui/web_applications/web_app_metrics.cc
@@ -185,16 +185,17 @@ UpdateForegroundWebContents(selection.new_contents); - if (change.type() == TabStripModelChange::kRemoved && - change.GetRemove()->will_be_deleted) { - for (const TabStripModelChange::ContentsWithIndex& contents : - change.GetRemove()->contents) { - auto* tab_helper = - WebAppTabHelperBase::FromWebContents(contents.contents); - if (tab_helper && !tab_helper->GetAppId().empty()) - app_last_interacted_time_.erase(tab_helper->GetAppId()); - // Foreground contents should not be going away. - DCHECK_NE(contents.contents, foreground_web_contents_); + if (change.type() == TabStripModelChange::kRemoved) { + for (const TabStripModelChange::ContentsWithIndexAndWillBeDeleted& + contents : change.GetRemove()->contents) { + if (contents.will_be_deleted) { + auto* tab_helper = + WebAppTabHelperBase::FromWebContents(contents.contents); + if (tab_helper && !tab_helper->GetAppId().empty()) + app_last_interacted_time_.erase(tab_helper->GetAppId()); + // Foreground contents should not be going away. + DCHECK_NE(contents.contents, foreground_web_contents_); + } } }
diff --git a/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.cc index 865def1b..fca845c 100644 --- a/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler.cc
@@ -9,7 +9,6 @@ #include "base/command_line.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" #include "chrome/browser/chromeos/login/oobe_screen.h" #include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h" @@ -21,8 +20,6 @@ #include "components/login/localized_values_builder.h" #include "components/prefs/pref_service.h" #include "components/strings/grit/components_strings.h" -#include "content/public/browser/notification_details.h" -#include "content/public/browser/notification_service.h" #include "ui/base/webui/web_ui_util.h" namespace chromeos { @@ -115,11 +112,6 @@ KioskAppManager::Get()->SetEnableAutoLaunch(false); if (delegate_) delegate_->OnExit(false); - - content::NotificationService::current()->Notify( - chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, - content::NotificationService::AllSources(), - content::NotificationService::NoDetails()); } void KioskAutolaunchScreenHandler::HandleOnConfirm() { @@ -127,11 +119,6 @@ KioskAppManager::Get()->SetEnableAutoLaunch(true); if (delegate_) delegate_->OnExit(true); - - content::NotificationService::current()->Notify( - chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_COMPLETED, - content::NotificationService::AllSources(), - content::NotificationService::NoDetails()); } void KioskAutolaunchScreenHandler::HandleOnVisible() { @@ -140,10 +127,6 @@ is_visible_ = true; UpdateKioskApp(); - content::NotificationService::current()->Notify( - chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, - content::NotificationService::AllSources(), - content::NotificationService::NoDetails()); } void KioskAutolaunchScreenHandler::OnKioskAppsSettingsChanged() {
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc index 80a7a372..121f655bd 100644 --- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc +++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
@@ -150,6 +150,8 @@ constexpr char kI18nBehaviorJS[] = "components/oobe_i18n_behavior.js"; constexpr char kHDIronIconHTML[] = "components/hd_iron_icon.html"; constexpr char kHDIronIconJS[] = "components/hd_iron_icon.js"; +constexpr char kOobeDialogHTML[] = "components/oobe_dialog.html"; +constexpr char kOobeDialogJS[] = "components/oobe_dialog.js"; constexpr char kOobeCarouselHTML[] = "components/oobe_carousel.html"; constexpr char kOobeCarouselJS[] = "components/oobe_carousel.js"; constexpr char kOobeSlideHTML[] = "components/oobe_slide.html"; @@ -634,6 +636,10 @@ IDR_OOBE_COMPONENTS_HD_IRON_ICON_HTML); source->AddResourcePath(kHDIronIconJS, IDR_OOBE_COMPONENTS_HD_IRON_ICON_JS); + source->AddResourcePath(kOobeDialogHTML, + IDR_OOBE_COMPONENTS_OOBE_DIALOG_HTML); + source->AddResourcePath(kOobeDialogJS, IDR_OOBE_COMPONENTS_OOBE_DIALOG_JS); + source->AddResourcePath(kOobeCarouselHTML, IDR_OOBE_COMPONENTS_OOBE_CAROUSEL_HTML); source->AddResourcePath(kOobeCarouselJS,
diff --git a/chrome/browser/ui/webui/settings/chromeos/constants/setting.mojom b/chrome/browser/ui/webui/settings/chromeos/constants/setting.mojom index e1c486f9..6314330 100644 --- a/chrome/browser/ui/webui/settings/chromeos/constants/setting.mojom +++ b/chrome/browser/ui/webui/settings/chromeos/constants/setting.mojom
@@ -5,7 +5,8 @@ module chromeos.settings.mojom; // Enumeration of each setting in the Chrome OS Settings app. Numerical values -// are used for metrics; do not change or reuse values. +// are used for metrics; do not change or reuse values. Add new values to the +// OsSetting enum in tools/metrics/histograms/enums.xml. enum Setting { // Network section. kConfigureEthernet = 0,
diff --git a/chrome/browser/ui/webui/settings/people_handler.cc b/chrome/browser/ui/webui/settings/people_handler.cc index e326ae8..ea6b036 100644 --- a/chrome/browser/ui/webui/settings/people_handler.cc +++ b/chrome/browser/ui/webui/settings/people_handler.cc
@@ -546,7 +546,7 @@ if (service->GetUserSettings()->IsEncryptEverythingAllowed()) { ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_ENCRYPT); } else { - // Don't allow "encrypt all" if the SyncService doesn't allow it. + // Don't allow "set new passphrase" if the SyncService doesn't allow it. // The UI is hidden, but the user may have enabled it e.g. by fiddling with // the web inspector. configuration.set_new_passphrase = false;
diff --git a/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc b/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc index 477d124..7141a95 100644 --- a/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc +++ b/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc
@@ -35,7 +35,7 @@ webui::SetupWebUIDataSource( source, base::make_span(kUsbInternalsResources, kUsbInternalsResourcesSize), "", - IDR_USB_INTERNALS_HTML); + IDR_USB_INTERNALS_USB_INTERNALS_HTML); content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source); }
diff --git a/chrome/browser/web_applications/BUILD.gn b/chrome/browser/web_applications/BUILD.gn index 14bb6b0..75c68a6 100644 --- a/chrome/browser/web_applications/BUILD.gn +++ b/chrome/browser/web_applications/BUILD.gn
@@ -73,7 +73,6 @@ deps = [ ":web_app_group", - "//chrome/browser:browser_process", "//chrome/browser/web_applications/components", "//chrome/browser/web_applications/preinstalled_web_apps", "//chrome/common",
diff --git a/chrome/browser/web_applications/components/BUILD.gn b/chrome/browser/web_applications/components/BUILD.gn index dd86bc3..d739a25 100644 --- a/chrome/browser/web_applications/components/BUILD.gn +++ b/chrome/browser/web_applications/components/BUILD.gn
@@ -131,7 +131,16 @@ deps = [ "//chrome/app/resources:platform_locale_settings", "//chrome/app/theme:chrome_unscaled_resources", - "//chrome/browser:browser_process", + + # web_applications:components uses header files from chrome/browser/banners/ + # via |allow_circular_includes_from| mechanism enabled for the whole + # chrome/browser/ directory. In turn, chrome/browser/banners/ uses header + # files from chrome/browser/engagement/. This two-way circular dependency + # isn't automatically verified by |gn check| tool and it breaks incremental + # distributed build occasionally. For now, we should explicitly depend on + # chrome/browser/engagement: gn parts (like mojo_bindings) to fix this. + # + # TODO(crbug.com/1039736): Refactor AppBannerManager to remove this dep. "//chrome/browser/web_applications:web_app_group", "//chrome/common", "//components/crx_file",
diff --git a/chrome/browser/web_applications/extensions/BUILD.gn b/chrome/browser/web_applications/extensions/BUILD.gn index 7bcd2e9..606b7b7 100644 --- a/chrome/browser/web_applications/extensions/BUILD.gn +++ b/chrome/browser/web_applications/extensions/BUILD.gn
@@ -38,7 +38,6 @@ deps = [ "//base", - "//chrome/browser:browser_process", "//chrome/browser/web_applications", "//chrome/browser/web_applications:web_app_group", "//chrome/browser/web_applications/components",
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 47cefb47..df27caeb 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-master-1605571148-8e0456d32b4535b8a26e31eb6f964ebd3417aaef.profdata +chrome-linux-master-1605612997-0b538d267d59602889f3873bf24b3a402bd4dd04.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index ef753a2..86ebc9ad 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-master-1605538580-853d8fcb404f37acc68f0179b58be2e881687944.profdata +chrome-win32-master-1605571148-cd63329ec540ae538404ceac5db1a609fe603f55.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 6309e5a..a5f42fe 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-master-1605560272-77c0d8d0117a28bac6ffdb0ad2fa6b677cbad6f9.profdata +chrome-win64-master-1605581968-699188875fbc74b98026cce85d5b16d698948c9f.profdata
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc index a3240b73..58d0d15 100644 --- a/chrome/common/chrome_features.cc +++ b/chrome/common/chrome_features.cc
@@ -525,7 +525,7 @@ #if !defined(OS_ANDROID) // Support sharing in Chrome OS intent handling. const base::Feature kIntentHandlingSharing{"IntentHandlingSharing", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; // Allow user to have preference for PWA in the intent picker. const base::Feature kIntentPickerPWAPersistence{ "IntentPickerPWAPersistence", base::FEATURE_DISABLED_BY_DEFAULT}; @@ -736,8 +736,7 @@ "SecurityKeyAttestationPrompt", base::FEATURE_ENABLED_BY_DEFAULT}; #if defined(OS_CHROMEOS) -const base::Feature kSharesheet{"Sharesheet", - base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kSharesheet{"Sharesheet", base::FEATURE_ENABLED_BY_DEFAULT}; #endif #if defined(OS_MAC)
diff --git a/chrome/common/extensions/api/autotest_private.idl b/chrome/common/extensions/api/autotest_private.idl index 6d88ccd5..e1c6ff7 100644 --- a/chrome/common/extensions/api/autotest_private.idl +++ b/chrome/common/extensions/api/autotest_private.idl
@@ -200,13 +200,17 @@ }; callback PrinterArrayCallback = void (Printer[] printers); - callback ArcStartTimeCallback = void (double startTime); + callback ArcStartTimeCallback = void (double startTicks); dictionary ArcState { // Whether the ARC is provisioned. boolean provisioned; // Whether ARC Terms of Service needs to be shown. boolean tosNeeded; + // ARC pre-start time (mini-ARC) or 0 if not pre-started. + double preStartTime; + // ARC start time or 0 if not started. + double startTime; }; callback ArcStateCallback = void (ArcState result); @@ -659,7 +663,7 @@ // Remove all notifications. static void removeAllNotifications(VoidCallback callback); - // Get ARC start time. + // Get ARC start time in ticks. static void getArcStartTime(ArcStartTimeCallback callback); // Get state of the ARC session.
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 60e663c..d087566 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -3001,13 +3001,14 @@ sources -= [ "../common/time_format_browsertest.cc" ] } - if (is_mac || is_win || (is_linux && !is_chromeos)) { + if (is_mac || is_win || is_linux) { sources += [ # Tests for non mobile and non CrOS (includes Linux, Win, Mac). "../browser/browser_switcher/browser_switcher_browsertest.cc", "../browser/browser_switcher/browser_switcher_service_browsertest.cc", "../browser/browser_switcher/ieem_sitelist_parser_browsertest.cc", "../browser/extensions/api/image_writer_private/image_writer_utility_client_browsertest.cc", + "../browser/policy/audio_sandbox_enabled_browsertest.cc", "../browser/profiles/profile_statistics_browsertest.cc", ] } @@ -3664,6 +3665,8 @@ "../browser/signin/e2e_tests/test_accounts_util_unittest.cc", "../browser/subresource_redirect/https_image_compression_bypass_decider_unittest.cc", "../browser/subresource_redirect/https_image_compression_infobar_decider_unittest.cc", + "../browser/subresource_redirect/origin_robots_rules_unittest.cc", + "../browser/subresource_redirect/subresource_redirect_util_unit_test.cc", # TODO(hashimoto): those tests should be componentized and moved to # //components:components_unittests, http://crbug.com/527882. @@ -6006,6 +6009,7 @@ "../browser/ui/views/media_router/web_contents_display_observer_view_unittest.cc", "../browser/ui/views/omnibox/omnibox_result_view_unittest.cc", "../browser/ui/views/omnibox/omnibox_view_views_unittest.cc", + "../browser/ui/views/overlay/overlay_window_views_unittest.cc", "../browser/ui/views/page_action/page_action_icon_view_unittest.cc", "../browser/ui/views/page_info/page_info_bubble_view_unittest.cc", "../browser/ui/views/page_info/safety_tip_page_info_bubble_view_unittest.cc",
diff --git a/chrome/test/data/extensions/api_test/autotest_private/test.js b/chrome/test/data/extensions/api_test/autotest_private/test.js index b75b817..3a6cc27 100644 --- a/chrome/test/data/extensions/api_test/autotest_private/test.js +++ b/chrome/test/data/extensions/api_test/autotest_private/test.js
@@ -184,6 +184,8 @@ chrome.test.assertTrue(state.allowed); chrome.test.assertTrue(state.enabled); chrome.test.assertFalse(state.managed); + // Revert to disable state as default in this test set. + chrome.autotestPrivate.setPlayStoreEnabled(false, function() {}); chrome.test.succeed(); }); }); @@ -315,11 +317,12 @@ // This test verifies that getArcState returns provisioned False in case ARC // is not provisioned by default. function arcNotProvisioned() { - chrome.autotestPrivate.getArcState(function(state) { - chrome.test.assertFalse(state.provisioned); - chrome.test.assertNoLastError(); - chrome.test.succeed(); - }); + chrome.autotestPrivate.getArcState( + chrome.test.callbackPass(function(state) { + chrome.test.assertFalse(state.provisioned); + chrome.test.assertEq(0, state.preStartTime); + chrome.test.assertEq(0, state.startTime); + })); }, // This test verifies that ARC Terms of Service are needed by default. function arcTosNeeded() { @@ -1002,11 +1005,14 @@ // This test verifies that getArcState returns provisioned True in case ARC // provisioning is done. function arcProvisioned() { - chrome.autotestPrivate.getArcState(function(state) { - chrome.test.assertTrue(state.provisioned); - chrome.test.assertNoLastError(); - chrome.test.succeed(); - }); + chrome.autotestPrivate.getArcState( + chrome.test.callbackPass(function(state) { + chrome.test.assertTrue(state.provisioned); + chrome.test.assertTrue(state.preStartTime > 0); + chrome.test.assertTrue(state.startTime > 0); + chrome.test.assertTrue(state.startTime >= state.preStartTime); + chrome.test.assertTrue((new Date()).getTime() >= state.startTime); + })); }, // This test verifies that ARC Terms of Service are not needed in case ARC is // provisioned and Terms of Service are accepted.
diff --git a/chrome/test/data/extensions/api_test/enterprise_device_attributes.crx b/chrome/test/data/extensions/api_test/enterprise_device_attributes.crx deleted file mode 100644 index 0956183..0000000 --- a/chrome/test/data/extensions/api_test/enterprise_device_attributes.crx +++ /dev/null Binary files differ
diff --git a/chrome/test/data/extensions/api_test/enterprise_device_attributes/update_manifest.xml b/chrome/test/data/extensions/api_test/enterprise_device_attributes/update_manifest.xml deleted file mode 100644 index 7968585..0000000 --- a/chrome/test/data/extensions/api_test/enterprise_device_attributes/update_manifest.xml +++ /dev/null
@@ -1,13 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- - This update manifest points to the enterprise_device_attributes.crx file. - "mock.http" is a placeholder that gets substituted with the test server - address in runtime. ---> -<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> - <app appid='nbiliclbejdndfpchgkbmfoppjplbdok'> - <updatecheck - codebase='http://mock.http/extensions/api_test/enterprise_device_attributes.crx' - version='0.1' /> - </app> -</gupdate>
diff --git a/chrome/test/data/extensions/api_test/enterprise_networking_attributes.crx b/chrome/test/data/extensions/api_test/enterprise_networking_attributes.crx deleted file mode 100644 index df8a85d..0000000 --- a/chrome/test/data/extensions/api_test/enterprise_networking_attributes.crx +++ /dev/null Binary files differ
diff --git a/chrome/test/data/extensions/api_test/enterprise_networking_attributes/update_manifest.xml b/chrome/test/data/extensions/api_test/enterprise_networking_attributes/update_manifest.xml deleted file mode 100644 index 0749767..0000000 --- a/chrome/test/data/extensions/api_test/enterprise_networking_attributes/update_manifest.xml +++ /dev/null
@@ -1,13 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- - This update manifest points to the enterprise_networking_attributes.crx file. - "mock.http" is a placeholder that gets substituted with the test server - address in runtime. ---> -<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> - <app appid='pkhdjpcjgonhlomdjmnddhbfpgkdhgle'> - <updatecheck - codebase='http://mock.http/extensions/api_test/enterprise_networking_attributes.crx' - version='1.0' /> - </app> -</gupdate>
diff --git a/chrome/test/data/webrtc/peerconnection_getstats.js b/chrome/test/data/webrtc/peerconnection_getstats.js index 6a3ac19..8930c9f 100644 --- a/chrome/test/data/webrtc/peerconnection_getstats.js +++ b/chrome/test/data/webrtc/peerconnection_getstats.js
@@ -303,15 +303,12 @@ * @private */ let kRTCCodecStats = new RTCStats(null, { + transportId: 'string', payloadType: 'number', mimeType: 'string', - // TODO(hbos): As soon as |codec| has been renamed |mimeType| in the webrtc - // repo, remove this line. https://bugs.webrtc.org/7061 - codec: 'string', clockRate: 'number', channels: 'number', sdpFmtpLine: 'string', - implementation: 'string', }); addRTCStatsToWhitelist(Presence.MANDATORY, 'codec', kRTCCodecStats);
diff --git a/chromeos/chromeos_strings.grd b/chromeos/chromeos_strings.grd index f47c6b8..f97c18ef 100644 --- a/chromeos/chromeos_strings.grd +++ b/chromeos/chromeos_strings.grd
@@ -159,21 +159,21 @@ </message> <!-- Managed guest session warnings --> - <message name="IDS_ASH_LOGIN_MANAGED_SESSION_MONITORING_FULL_WARNING" desc="Text shown in the public account user pod in case of risky configuration, informing the user that this session is managed and admin can monitor all activity."> - <ph name="ENROLLMENT_DOMAIN">$1<ex>example.com</ex></ph> manages this device and has access to all user activity, including webpages visited, passwords, and email. + <message name="IDS_ASH_LOGIN_MANAGED_SESSION_MONITORING_FULL_WARNING" desc="Text shown in the public account user pod in case of risky configuration, informing the user that this session is managed and admin can monitor all activity. MANAGER can be a domain or an email address."> + <ph name="MANAGER">$1<ex>example.com</ex></ph> manages this device and has access to all user activity, including webpages visited, passwords, and email. </message> - <message name="IDS_ASH_LOGIN_MANAGED_SESSION_MONITORING_SOFT_WARNING" desc="Text shown in the public account user pod in case of non-risky configuration, informing the user that this session is managed and admin can monitor all activity."> - <ph name="ENROLLMENT_DOMAIN">$1<ex>example.com</ex></ph> manages this device and may be able to monitor your activity. + <message name="IDS_ASH_LOGIN_MANAGED_SESSION_MONITORING_SOFT_WARNING" desc="Text shown in the public account user pod in case of non-risky configuration, informing the user that this session is managed and admin can monitor all activity. MANAGER can be a domain or an email address."> + <ph name="MANAGER">$1<ex>example.com</ex></ph> manages this device and may be able to monitor your activity. </message> <!-- Managed user session warning --> - <message name="IDS_ASH_LOGIN_MANAGED_SESSION_MONITORING_USER_WARNING" desc="Text shown in the user pod in case the user is managed."> - <ph name="ENROLLMENT_DOMAIN">$1<ex>example.com</ex></ph> manages this user and may remotely manage settings and monitor user activity. + <message name="IDS_ASH_LOGIN_MANAGED_SESSION_MONITORING_USER_WARNING" desc="Text shown in the user pod in case the user is managed. MANAGER can be a domain or an email address."> + <ph name="MANAGER">$1<ex>example.com</ex></ph> manages this user and may remotely manage settings and monitor user activity. </message> <!-- Pop-up enterprise management. --> - <message name="IDS_ASH_LOGIN_ENTERPRISE_MANAGED_POP_UP" desc="Text shown in the management pop-up when user clicks on status tray enterprise management."> - This <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> is managed by <ph name="ENROLLMENT_DOMAIN">$2<ex>example.com</ex></ph>. Administrators may remotely configure the device. + <message name="IDS_ASH_LOGIN_ENTERPRISE_MANAGED_POP_UP" desc="Text shown in the management pop-up when user clicks on status tray enterprise management. MANAGER can be a domain or an email address."> + This <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> is managed by <ph name="MANAGER">$2<ex>example.com</ex></ph>. Administrators may remotely configure the device. </message> <!-- Pop-up secondary login screen. -->
diff --git a/chromeos/constants/chromeos_features.cc b/chromeos/constants/chromeos_features.cc index f701e07..f093af4 100644 --- a/chromeos/constants/chromeos_features.cc +++ b/chromeos/constants/chromeos_features.cc
@@ -19,6 +19,11 @@ } // namespace +// Enables redesign of account management flows. +// https://crbug.com/1132472 +const base::Feature kAccountManagementFlowsV2{ + "AccountManagementFlowsV2", base::FEATURE_DISABLED_BY_DEFAULT}; + // Shows settings for adjusting scroll acceleration/sensitivity for // mouse/touchpad. const base::Feature kAllowScrollSettings{"AllowScrollSettings", @@ -655,6 +660,10 @@ //////////////////////////////////////////////////////////////////////////////// +bool IsAccountManagementFlowsV2Enabled() { + return base::FeatureList::IsEnabled(kAccountManagementFlowsV2); +} + bool IsAmbientModeEnabled() { return base::FeatureList::IsEnabled(kAmbientModeFeature); }
diff --git a/chromeos/constants/chromeos_features.h b/chromeos/constants/chromeos_features.h index a39a13388..1b0a79c 100644 --- a/chromeos/constants/chromeos_features.h +++ b/chromeos/constants/chromeos_features.h
@@ -17,6 +17,8 @@ // being rolled out via Finch, add a comment in the .cc file. COMPONENT_EXPORT(CHROMEOS_CONSTANTS) +extern const base::Feature kAccountManagementFlowsV2; +COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kAllowScrollSettings; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kAmbientModeFeature; @@ -299,6 +301,7 @@ // Keep alphabetized. +COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsAccountManagementFlowsV2Enabled(); COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsAmbientModeEnabled(); COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsAmbientModePhotoPreviewEnabled(); COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsAmbientModeDevUseProdEnabled();
diff --git a/chromeos/tpm/BUILD.gn b/chromeos/tpm/BUILD.gn index b83aea0..acfbb5a 100644 --- a/chromeos/tpm/BUILD.gn +++ b/chromeos/tpm/BUILD.gn
@@ -24,8 +24,6 @@ sources = [ "install_attributes.cc", "install_attributes.h", - "tpm_password_fetcher.cc", - "tpm_password_fetcher.h", "tpm_token_info_getter.cc", "tpm_token_info_getter.h", "tpm_token_loader.cc",
diff --git a/chromeos/tpm/tpm_password_fetcher.cc b/chromeos/tpm/tpm_password_fetcher.cc deleted file mode 100644 index 6ebe7d7..0000000 --- a/chromeos/tpm/tpm_password_fetcher.cc +++ /dev/null
@@ -1,72 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/tpm/tpm_password_fetcher.h" - -#include "base/bind.h" -#include "base/compiler_specific.h" -#include "base/location.h" -#include "base/logging.h" -#include "base/single_thread_task_runner.h" -#include "base/threading/thread_task_runner_handle.h" -#include "chromeos/dbus/cryptohome/cryptohome_client.h" - -namespace chromeos { - -namespace { - -// Interval between TPM password checks. -const int kTpmCheckIntervalMs = 500; - -} // namespace - -TpmPasswordFetcher::TpmPasswordFetcher(TpmPasswordFetcherDelegate* delegate) - : delegate_(delegate) { - DCHECK(delegate_); -} - -TpmPasswordFetcher::~TpmPasswordFetcher() = default; - -void TpmPasswordFetcher::Fetch() { - // Since this method is also called directly. - weak_factory_.InvalidateWeakPtrs(); - - CryptohomeClient::Get()->TpmIsReady(base::BindOnce( - &TpmPasswordFetcher::OnTpmIsReady, weak_factory_.GetWeakPtr())); -} - -void TpmPasswordFetcher::OnTpmIsReady(base::Optional<bool> tpm_is_ready) { - if (tpm_is_ready.value_or(false)) { - CryptohomeClient::Get()->TpmGetPassword(base::BindOnce( - &TpmPasswordFetcher::OnTpmGetPassword, weak_factory_.GetWeakPtr())); - } else { - // Password hasn't been acquired, reschedule fetch. - RescheduleFetch(); - } -} - -void TpmPasswordFetcher::OnTpmGetPassword( - base::Optional<std::string> password) { - if (password) { - if (password->empty()) { - // For a fresh OOBE flow TPM is uninitialized, - // ownership process is started at the EULA screen, - // password is cleared after EULA is accepted. - LOG(ERROR) << "TPM returned an empty password."; - } - delegate_->OnPasswordFetched(*password); - } else { - // Password hasn't been acquired, reschedule fetch. - RescheduleFetch(); - } -} - -void TpmPasswordFetcher::RescheduleFetch() { - base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( - FROM_HERE, - base::BindOnce(&TpmPasswordFetcher::Fetch, weak_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(kTpmCheckIntervalMs)); -} - -} // namespace chromeos
diff --git a/chromeos/tpm/tpm_password_fetcher.h b/chromeos/tpm/tpm_password_fetcher.h deleted file mode 100644 index d71c5cd..0000000 --- a/chromeos/tpm/tpm_password_fetcher.h +++ /dev/null
@@ -1,56 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMEOS_TPM_TPM_PASSWORD_FETCHER_H_ -#define CHROMEOS_TPM_TPM_PASSWORD_FETCHER_H_ - -#include <string> - -#include "base/component_export.h" -#include "base/macros.h" -#include "base/memory/weak_ptr.h" -#include "base/optional.h" - -namespace chromeos { - -// Interface which TpmPasswordFetcher uses to notify that password has been -// fetched. -class COMPONENT_EXPORT(CHROMEOS_TPM) TpmPasswordFetcherDelegate { - public: - virtual ~TpmPasswordFetcherDelegate() {} - virtual void OnPasswordFetched(const std::string& tpm_password) = 0; -}; - -// Class for fetching TPM password from the Cryptohome. -class COMPONENT_EXPORT(CHROMEOS_TPM) TpmPasswordFetcher { - public: - // Creates fetcher with the given delegate to be notified every time fetching - // is done. - explicit TpmPasswordFetcher(TpmPasswordFetcherDelegate* delegate); - ~TpmPasswordFetcher(); - - // Fetches TPM password and stores the result. Also notifies |delegate_| with - // OnPasswordFetched() call. - void Fetch(); - - private: - // Used to implement Fetch(). - void OnTpmIsReady(base::Optional<bool> tpm_is_ready); - - // Used to implement Fetch(). - void OnTpmGetPassword(base::Optional<std::string> password); - - // Posts a task to call Fetch() later. - void RescheduleFetch(); - - TpmPasswordFetcherDelegate* delegate_; - - base::WeakPtrFactory<TpmPasswordFetcher> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(TpmPasswordFetcher); -}; - -} // namespace chromeos - -#endif // CHROMEOS_TPM_TPM_PASSWORD_FETCHER_H_
diff --git a/components/account_manager_core/account_manager_util.cc b/components/account_manager_core/account_manager_util.cc index d2183684..b166106 100644 --- a/components/account_manager_core/account_manager_util.cc +++ b/components/account_manager_core/account_manager_util.cc
@@ -10,14 +10,13 @@ base::Optional<account_manager::Account> FromMojoAccount( const crosapi::mojom::AccountPtr& mojom_account) { - const base::Optional<account_manager::AccountType> account_type = - FromMojoAccountType(mojom_account->key->account_type); - if (!account_type.has_value()) + const base::Optional<account_manager::AccountKey> account_key = + FromMojoAccountKey(mojom_account->key); + if (!account_key.has_value()) return base::nullopt; account_manager::Account account; - account.key.id = mojom_account->key->id; - account.key.account_type = account_type.value(); + account.key = account_key.value(); account.raw_email = mojom_account->raw_email; return account; } @@ -25,16 +24,33 @@ crosapi::mojom::AccountPtr ToMojoAccount( const account_manager::Account& account) { crosapi::mojom::AccountPtr mojom_account = crosapi::mojom::Account::New(); - - mojom_account->key = crosapi::mojom::AccountKey::New(); - mojom_account->key->id = account.key.id; - mojom_account->key->account_type = - ToMojoAccountType(account.key.account_type); + mojom_account->key = ToMojoAccountKey(account.key); mojom_account->raw_email = account.raw_email; - return mojom_account; } +base::Optional<account_manager::AccountKey> FromMojoAccountKey( + const crosapi::mojom::AccountKeyPtr& mojom_account_key) { + const base::Optional<account_manager::AccountType> account_type = + FromMojoAccountType(mojom_account_key->account_type); + if (!account_type.has_value()) + return base::nullopt; + + account_manager::AccountKey account_key; + account_key.id = mojom_account_key->id; + account_key.account_type = account_type.value(); + return account_key; +} + +crosapi::mojom::AccountKeyPtr ToMojoAccountKey( + const account_manager::AccountKey& account_key) { + crosapi::mojom::AccountKeyPtr mojom_account_key = + crosapi::mojom::AccountKey::New(); + mojom_account_key->id = account_key.id; + mojom_account_key->account_type = ToMojoAccountType(account_key.account_type); + return mojom_account_key; +} + base::Optional<account_manager::AccountType> FromMojoAccountType( const crosapi::mojom::AccountType& account_type) { switch (account_type) {
diff --git a/components/account_manager_core/account_manager_util.h b/components/account_manager_core/account_manager_util.h index 4029974..69163f6 100644 --- a/components/account_manager_core/account_manager_util.h +++ b/components/account_manager_core/account_manager_util.h
@@ -20,6 +20,15 @@ crosapi::mojom::AccountPtr ToMojoAccount( const account_manager::Account& account); +// Returns `base::nullopt` if `mojom_account_key` cannot be parsed. +COMPONENT_EXPORT(ACCOUNT_MANAGER_CORE) +base::Optional<account_manager::AccountKey> FromMojoAccountKey( + const crosapi::mojom::AccountKeyPtr& mojom_account_key); + +COMPONENT_EXPORT(ACCOUNT_MANAGER_CORE) +crosapi::mojom::AccountKeyPtr ToMojoAccountKey( + const account_manager::AccountKey& account_key); + // Returns `base::nullopt` if `account_type` cannot be parsed. COMPONENT_EXPORT(ACCOUNT_MANAGER_CORE) base::Optional<account_manager::AccountType> FromMojoAccountType(
diff --git a/components/arc/BUILD.gn b/components/arc/BUILD.gn index 6f135fb..196397a3 100644 --- a/components/arc/BUILD.gn +++ b/components/arc/BUILD.gn
@@ -23,6 +23,7 @@ "crash_collector/arc_crash_collector_bridge.h", "disk_quota/arc_disk_quota_bridge.cc", "disk_quota/arc_disk_quota_bridge.h", + "enterprise/arc_apps_tracker.h", "enterprise/arc_data_snapshotd_bridge.cc", "enterprise/arc_data_snapshotd_bridge.h", "enterprise/arc_data_snapshotd_manager.cc", @@ -109,6 +110,7 @@ "//chromeos", "//chromeos/audio", "//chromeos/constants", + "//chromeos/cryptohome", "//chromeos/dbus", "//chromeos/dbus/cryptohome", "//chromeos/dbus/permission_broker",
diff --git a/components/arc/enterprise/arc_apps_tracker.h b/components/arc/enterprise/arc_apps_tracker.h new file mode 100644 index 0000000..8074ef6 --- /dev/null +++ b/components/arc/enterprise/arc_apps_tracker.h
@@ -0,0 +1,30 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_ARC_ENTERPRISE_ARC_APPS_TRACKER_H_ +#define COMPONENTS_ARC_ENTERPRISE_ARC_APPS_TRACKER_H_ + +namespace arc { +namespace data_snapshotd { + +// This class tracks installation of the list of ARC apps. +class ArcAppsTracker { + public: + virtual ~ArcAppsTracker() = default; + + // Starts tracking installation of the list of ARC apps. + // Invokes a repeating callback |update_callback| when the number of installed + // tracked apps changes. |update_callback| is invoked with the percent of + // installed tracked apps in a range of 0..100. + virtual void StartTracking( + base::RepeatingCallback<void(int)> update_callback) = 0; + + // Stops tracking installation of the list of ARC apps. + virtual void StopTracking() = 0; +}; + +} // namespace data_snapshotd +} // namespace arc + +#endif // COMPONENTS_ARC_ENTERPRISE_ARC_APPS_TRACKER_H_
diff --git a/components/arc/enterprise/arc_data_snapshotd_bridge.cc b/components/arc/enterprise/arc_data_snapshotd_bridge.cc index 41278639..e8c6ea64 100644 --- a/components/arc/enterprise/arc_data_snapshotd_bridge.cc +++ b/components/arc/enterprise/arc_data_snapshotd_bridge.cc
@@ -109,7 +109,22 @@ return; } VLOG(1) << "ClearSnapshot via D-Bus"; - // TODO(pbond): implement + NOTIMPLEMENTED(); + + std::move(callback).Run(true /* success */); +} + +void ArcDataSnapshotdBridge::TakeSnapshot( + const std::string& account_id, + base::OnceCallback<void(bool)> callback) { + if (!is_available_) { + LOG(ERROR) << "TakeSnapshot call when D-Bus service is not available."; + std::move(callback).Run(false /* success */); + return; + } + VLOG(1) << "TakeSnapshot via D-Bus"; + NOTIMPLEMENTED(); + std::move(callback).Run(true /* success */); }
diff --git a/components/arc/enterprise/arc_data_snapshotd_bridge.h b/components/arc/enterprise/arc_data_snapshotd_bridge.h index de8022b4..4f5e660a 100644 --- a/components/arc/enterprise/arc_data_snapshotd_bridge.h +++ b/components/arc/enterprise/arc_data_snapshotd_bridge.h
@@ -29,6 +29,8 @@ // Delegates the key pair generation to arc-data-snapshotd daemon. void GenerateKeyPair(base::OnceCallback<void(bool)> callback); void ClearSnapshot(bool last, base::OnceCallback<void(bool)> callback); + void TakeSnapshot(const std::string& account_id, + base::OnceCallback<void(bool)> callback); bool is_available_for_testing() { return is_available_; }
diff --git a/components/arc/enterprise/arc_data_snapshotd_manager.cc b/components/arc/enterprise/arc_data_snapshotd_manager.cc index 394cb5b8..8bf379df 100644 --- a/components/arc/enterprise/arc_data_snapshotd_manager.cc +++ b/components/arc/enterprise/arc_data_snapshotd_manager.cc
@@ -9,16 +9,21 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/command_line.h" +#include "base/i18n/time_formatting.h" #include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/system/sys_info.h" +#include "base/time/time.h" #include "base/values.h" #include "chromeos/constants/chromeos_switches.h" +#include "chromeos/cryptohome/cryptohome_parameters.h" #include "chromeos/dbus/upstart/upstart_client.h" #include "components/arc/arc_prefs.h" #include "components/arc/enterprise/arc_data_snapshotd_bridge.h" #include "components/prefs/pref_service.h" #include "components/session_manager/core/session_manager.h" +#include "components/user_manager/user.h" #include "components/user_manager/user_manager.h" #include "ui/ozone/public/ozone_switches.h" @@ -65,6 +70,13 @@ // This class is owned by ChromeBrowserMainPartsChromeos. static ArcDataSnapshotdManager* g_arc_data_snapshotd_manager = nullptr; +ArcDataSnapshotdManager::SnapshotInfo::SnapshotInfo(bool last) + : is_last_(last) { + os_version_ = base::SysInfo::OperatingSystemVersion(); + creation_date_ = + base::UTF16ToUTF8(base::TimeFormatShortDateAndTime(base::Time::Now())); +} + ArcDataSnapshotdManager::SnapshotInfo::SnapshotInfo(const base::Value* value, bool last) : is_last_(last) { @@ -127,8 +139,7 @@ } bool ArcDataSnapshotdManager::SnapshotInfo::IsOsVersionUpdated() const { - // TODO(pbond): implement; - return false; + return os_version_ != base::SysInfo::OperatingSystemVersion(); } ArcDataSnapshotdManager::SnapshotInfo::SnapshotInfo( @@ -219,6 +230,17 @@ Sync(); } +void ArcDataSnapshotdManager::Snapshot::OnSnapshotTaken() { + if (last_) { + LOG(WARNING) << "Last snapshot exists"; + last_.reset(); + } + last_ = std::make_unique<SnapshotInfo>(true /* last */); + // Clear snapshot started pref to highlight that the snapshot creation process + // is over. + started_ = false; +} + ArcDataSnapshotdManager::Snapshot::Snapshot( PrefService* local_state, bool blocked_ui_mode, @@ -240,11 +262,18 @@ ArcDataSnapshotdManager::ArcDataSnapshotdManager( PrefService* local_state, + std::unique_ptr<Delegate> delegate, + std::unique_ptr<ArcAppsTracker> apps_tracker, base::OnceClosure attempt_user_exit_callback) : snapshot_{local_state}, + delegate_(std::move(delegate)), + apps_tracker_(std::move(apps_tracker)), attempt_user_exit_callback_(std::move(attempt_user_exit_callback)) { DCHECK(!g_arc_data_snapshotd_manager); DCHECK(local_state); + DCHECK(delegate_); + DCHECK(apps_tracker_); + g_arc_data_snapshotd_manager = this; snapshot_.Parse(); @@ -316,10 +345,31 @@ } void ArcDataSnapshotdManager::OnSessionStateChanged() { - if (state_ != State::kMgsToLaunch) - return; - if (user_manager::UserManager::Get()->IsLoggedInAsPublicAccount()) - state_ = State::kMgsLaunched; + switch (state_) { + case State::kMgsLaunched: + if (user_manager::UserManager::Get() && + user_manager::UserManager::Get()->IsLoggedInAsPublicAccount()) { + return; + } + LOG(ERROR) << "MGS has failed."; + state_ = State::kNone; + apps_tracker_->StopTracking(); + OnSnapshotTaken(false /* success */); + break; + case State::kMgsToLaunch: + if (user_manager::UserManager::Get() && + user_manager::UserManager::Get()->IsLoggedInAsPublicAccount()) { + state_ = State::kMgsLaunched; + apps_tracker_->StartTracking(base::BindRepeating( + &ArcDataSnapshotdManager::Update, weak_ptr_factory_.GetWeakPtr())); + return; + } + break; + case ArcDataSnapshotdManager::State::kBlockedUi: + case ArcDataSnapshotdManager::State::kNone: + case ArcDataSnapshotdManager::State::kRestored: + break; + } } void ArcDataSnapshotdManager::StopDaemon(base::OnceClosure callback) { @@ -359,7 +409,10 @@ } void ArcDataSnapshotdManager::GenerateKeyPair() { - DCHECK(bridge_); + if (!bridge_) { + OnKeyPairGenerated(false /* success */); + return; + } bridge_->GenerateKeyPair( base::BindOnce(&ArcDataSnapshotdManager::OnKeyPairGenerated, weak_ptr_factory_.GetWeakPtr())); @@ -368,10 +421,23 @@ void ArcDataSnapshotdManager::ClearSnapshot( bool last, base::OnceCallback<void(bool)> callback) { - DCHECK(bridge_); + if (!bridge_) { + std::move(callback).Run(false /* success */); + return; + } bridge_->ClearSnapshot(last, std::move(callback)); } +void ArcDataSnapshotdManager::TakeSnapshot(const std::string& account_id) { + if (!bridge_) { + OnSnapshotTaken(false /* success */); + return; + } + bridge_->TakeSnapshot( + account_id, base::BindOnce(&ArcDataSnapshotdManager::OnSnapshotTaken, + weak_ptr_factory_.GetWeakPtr())); +} + void ArcDataSnapshotdManager::OnSnapshotsCleared(bool success) { switch (state_) { case State::kBlockedUi: @@ -443,5 +509,61 @@ std::move(callback).Run(); } +void ArcDataSnapshotdManager::Update(int percent) { + DCHECK_EQ(state_, State::kMgsLaunched); + + // TODO(pbond): wire up to arc-data-snapshotd. + if (percent == 100) { + // Stop tracking apps, 100% of required apps got installed. + // The snapshot can be taken right away. + // If the policy changes or an app gets uninstalled, the compliance with the + // required apps list will be fixed automatically on the next session + // startup. + apps_tracker_->StopTracking(); + delegate_->RequestStopArcInstance( + base::BindOnce(&ArcDataSnapshotdManager::OnArcInstanceStopped, + weak_ptr_factory_.GetWeakPtr())); + } +} + +void ArcDataSnapshotdManager::OnArcInstanceStopped(bool success) { + if (!success) { + LOG(ERROR) << "Failed to stop ARC instance."; + OnSnapshotTaken(false /* success */); + return; + } + std::string account_id = ""; + // Take snapshots only for MGSs. + if (user_manager::UserManager::Get() && + user_manager::UserManager::Get()->IsLoggedInAsPublicAccount() && + state_ == State::kMgsLaunched && + user_manager::UserManager::Get()->GetActiveUser()) { + cryptohome::Identification id( + user_manager::UserManager::Get()->GetActiveUser()->GetAccountId()); + account_id = id.id(); + } + if (account_id.empty()) { + LOG(ERROR) << "Cryptohome account ID is empty."; + OnSnapshotTaken(false /* success */); + return; + } + EnsureDaemonStarted(base::BindOnce(&ArcDataSnapshotdManager::TakeSnapshot, + weak_ptr_factory_.GetWeakPtr(), + std::move(account_id))); +} + +void ArcDataSnapshotdManager::OnSnapshotTaken(bool success) { + if (success) + snapshot_.OnSnapshotTaken(); + else + LOG(ERROR) << "Failed to take ARC data directory snapshot."; + + snapshot_.set_blocked_ui_mode(false); + snapshot_.Sync(); + + DCHECK(!attempt_user_exit_callback_.is_null()); + EnsureDaemonStopped(std::move(attempt_user_exit_callback_)); +} + } // namespace data_snapshotd } // namespace arc
diff --git a/components/arc/enterprise/arc_data_snapshotd_manager.h b/components/arc/enterprise/arc_data_snapshotd_manager.h index aba4e15a..1229a2a1 100644 --- a/components/arc/enterprise/arc_data_snapshotd_manager.h +++ b/components/arc/enterprise/arc_data_snapshotd_manager.h
@@ -10,6 +10,7 @@ #include "base/callback.h" #include "base/memory/weak_ptr.h" +#include "components/arc/enterprise/arc_apps_tracker.h" #include "components/session_manager/core/session_manager_observer.h" class PrefService; @@ -43,11 +44,26 @@ kRestored, }; + // This class is a delegate to perform actions in Chrome. + class Delegate { + public: + virtual ~Delegate() = default; + + // Requests to stop ARC instance and async invokes |stopped_callback| when + // ARC is not running with a success result or failure result if ARC is + // failed to stop. + // |stopped_callback| should never be null. + virtual void RequestStopArcInstance( + base::OnceCallback<void(bool)> stopped_callback) = 0; + }; + // This class operates with a snapshot related info either last or // backed-up (previous): stores and keeps in sync with an appropriate // preference in local state. class SnapshotInfo { public: + // Creates new snapshot with current parameters. + explicit SnapshotInfo(bool last); SnapshotInfo(const base::Value* value, bool last); SnapshotInfo(const SnapshotInfo&) = delete; SnapshotInfo& operator=(const SnapshotInfo&) = delete; @@ -127,6 +143,9 @@ // date. void StartNewSnapshot(); + // Updates the last snapshot creation date and OS version. + void OnSnapshotTaken(); + void set_blocked_ui_mode(bool blocked_ui_mode) { blocked_ui_mode_ = blocked_ui_mode; } @@ -148,12 +167,14 @@ // Values should be kept in sync with values stored in arc.snapshot // preference. bool blocked_ui_mode_ = false; - bool started_; + bool started_ = false; std::unique_ptr<SnapshotInfo> last_; std::unique_ptr<SnapshotInfo> previous_; }; ArcDataSnapshotdManager(PrefService* local_state, + std::unique_ptr<Delegate> delegate, + std::unique_ptr<ArcAppsTracker> apps_tracker, base::OnceClosure attempt_user_exit_callback); ArcDataSnapshotdManager(const ArcDataSnapshotdManager&) = delete; ArcDataSnapshotdManager& operator=(const ArcDataSnapshotdManager&) = delete; @@ -209,6 +230,7 @@ // Delegates operations to |bridge_| void GenerateKeyPair(); void ClearSnapshot(bool last, base::OnceCallback<void(bool)> callback); + void TakeSnapshot(const std::string& account_id); // Called once the outdated snapshots were removed or ensured that there are // no outdated snapshots. @@ -219,13 +241,25 @@ // |success|, runs |callback| afterwards. void OnDaemonStarted(base::OnceClosure callback, bool success); // Called once arc-data-snapshotd stopping process is finished with result - // |success", runs |callback| afterwards. + // |success|, runs |callback| afterwards. void OnDaemonStopped(base::OnceClosure callback, bool success); + // Callback to be passed to ArcAppsTracker::StartTracking to get notified + // about a percentage of installed apps. + void Update(int percent); + + // Called once ARC instance is stopped. + void OnArcInstanceStopped(bool success); + + // Called once a snapshot is taken. + void OnSnapshotTaken(bool success); + static bool is_snapshot_enabled_for_testing_; State state_ = State::kNone; Snapshot snapshot_; + std::unique_ptr<Delegate> delegate_; + std::unique_ptr<ArcAppsTracker> apps_tracker_; std::unique_ptr<ArcDataSnapshotdBridge> bridge_; base::OnceClosure attempt_user_exit_callback_;
diff --git a/components/arc/enterprise/arc_data_snapshotd_manager_unittest.cc b/components/arc/enterprise/arc_data_snapshotd_manager_unittest.cc index e0889133..085c0db 100644 --- a/components/arc/enterprise/arc_data_snapshotd_manager_unittest.cc +++ b/components/arc/enterprise/arc_data_snapshotd_manager_unittest.cc
@@ -9,6 +9,7 @@ #include "base/callback_helpers.h" #include "base/command_line.h" #include "base/memory/ptr_util.h" +#include "base/system/sys_info.h" #include "base/test/bind.h" #include "base/test/task_environment.h" #include "chromeos/constants/chromeos_switches.h" @@ -19,6 +20,8 @@ #include "components/arc/enterprise/arc_data_snapshotd_bridge.h" #include "components/prefs/testing_pref_service.h" #include "components/session_manager/core/session_manager.h" +#include "components/user_manager/fake_user_manager.h" +#include "components/user_manager/scoped_user_manager.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/ozone/public/ozone_switches.h" @@ -34,6 +37,8 @@ namespace { +constexpr char kPublicAccountEmail[] = "public-account@localhost"; + class TestUpstartClient : public chromeos::FakeUpstartClient { public: // FakeUpstartClient overrides: @@ -48,6 +53,57 @@ (override)); }; +class FakeDelegate : public ArcDataSnapshotdManager::Delegate { + public: + FakeDelegate() = default; + FakeDelegate(const FakeDelegate&) = delete; + FakeDelegate& operator=(const FakeDelegate&) = delete; + ~FakeDelegate() override = default; + + // ArcDataSnapshotdManager::Delegate overrides: + void RequestStopArcInstance( + base::OnceCallback<void(bool)> stopped_callback) override { + EXPECT_FALSE(stopped_callback.is_null()); + stopped_callback_num_++; + std::move(stopped_callback).Run(true /* success */); + } + + bool stopped_callback_num() const { return stopped_callback_num_; } + + private: + int stopped_callback_num_ = 0; +}; + +class FakeAppsTracker : public ArcAppsTracker { + public: + FakeAppsTracker() = default; + FakeAppsTracker(const FakeAppsTracker&) = delete; + FakeAppsTracker& operator=(const FakeAppsTracker&) = delete; + ~FakeAppsTracker() override = default; + + // ArcAppsTracker overrides: + void StartTracking( + base::RepeatingCallback<void(int)> update_callback) override { + EXPECT_FALSE(update_callback.is_null()); + start_tracking_num_++; + update_callback_ = std::move(update_callback); + } + void StopTracking() override { + stop_tracking_num_++; + update_callback_.Reset(); + } + base::RepeatingCallback<void(int)>& update_callback() { + return update_callback_; + } + int start_tracking_num() const { return start_tracking_num_; } + int stop_tracking_num() const { return stop_tracking_num_; } + + private: + int start_tracking_num_ = 0; + int stop_tracking_num_ = 0; + base::RepeatingCallback<void(int)> update_callback_; +}; + // Basic tests for ArcDataSnapshotdManager class instance. class ArcDataSnapshotdManagerBasicTest : public testing::Test { protected: @@ -56,15 +112,24 @@ chromeos::DBusThreadManager::Initialize(); EXPECT_TRUE(chromeos::DBusThreadManager::Get()->IsUsingFakes()); - upstart_client_ = std::make_unique<TestUpstartClient>(); - } + fake_user_manager_ = new user_manager::FakeUserManager(); + scoped_user_manager_ = std::make_unique<user_manager::ScopedUserManager>( + base::WrapUnique(fake_user_manager_)); - void SetUp() override { - SetDBusClientAvailability(true /* is_available */); + upstart_client_ = std::make_unique<TestUpstartClient>(); arc::prefs::RegisterLocalStatePrefs(local_state_.registry()); } + void SetUp() override { SetDBusClientAvailability(true /* is_available */); } + + void TearDown() override { + manager_.reset(); + apps_tracker_ = nullptr; + delegate_ = nullptr; + ClearLocalState(); + } + ~ArcDataSnapshotdManagerBasicTest() override { chromeos::DBusThreadManager::Shutdown(); } @@ -97,37 +162,12 @@ client->set_available(is_available); } - TestUpstartClient* upstart_client() { return upstart_client_.get(); } - PrefService* local_state() { return &local_state_; } - - protected: - base::test::TaskEnvironment task_environment_{ - base::test::TaskEnvironment::TimeSource::MOCK_TIME}; - TestingPrefServiceSimple local_state_; - - private: - std::unique_ptr<TestUpstartClient> upstart_client_; - session_manager::SessionManager session_manager_; -}; - -// Tests flows in ArcDataSnapshotdManager: -// * clear snapshot flow. -// * generate key pair flow. -class ArcDataSnapshotdManagerFlowTest - : public ArcDataSnapshotdManagerBasicTest, - public ::testing::WithParamInterface<bool> { - public: - void SetUp() override { - SetDBusClientAvailability(is_dbus_client_available()); - arc::prefs::RegisterLocalStatePrefs(local_state_.registry()); - } - - bool is_dbus_client_available() { return GetParam(); } - - void CheckHeadlessMode() { - auto* command_line = base::CommandLine::ForCurrentProcess(); - EXPECT_EQ(command_line->GetSwitchValueASCII(switches::kOzonePlatform), - "headless"); + ArcDataSnapshotdManager* CreateManager( + base::OnceClosure attempt_exit_callback = base::DoNothing()) { + manager_ = std::make_unique<ArcDataSnapshotdManager>( + local_state(), MakeDelegate(), MakeAppsTracker(), + std::move(attempt_exit_callback)); + return manager_.get(); } // Check number of snapshots in local_state. @@ -148,15 +188,94 @@ EXPECT_EQ(expected_snapshot_started, snapshot.started()); } + void ExpectStartTrackingApps() { + EXPECT_EQ(1, apps_tracker()->start_tracking_num()); + EXPECT_FALSE(apps_tracker()->update_callback().is_null()); + } + + void ExpectStopTrackingApps() { + EXPECT_EQ(1, apps_tracker()->stop_tracking_num()); + EXPECT_TRUE(apps_tracker()->update_callback().is_null()); + } + + TestUpstartClient* upstart_client() { return upstart_client_.get(); } + PrefService* local_state() { return &local_state_; } + user_manager::FakeUserManager* user_manager() { return fake_user_manager_; } + FakeAppsTracker* apps_tracker() { return apps_tracker_; } + FakeDelegate* delegate() { return delegate_; } + + protected: + std::unique_ptr<ArcDataSnapshotdManager::Delegate> MakeDelegate() { + auto delegate = std::make_unique<FakeDelegate>(); + delegate_ = delegate.get(); + return std::move(delegate); + } + + std::unique_ptr<ArcAppsTracker> MakeAppsTracker() { + auto apps_tracker = std::make_unique<FakeAppsTracker>(); + apps_tracker_ = apps_tracker.get(); + return std::move(apps_tracker); + } + + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; + TestingPrefServiceSimple local_state_; + + private: + void ClearLocalState() { + auto snapshot = ArcDataSnapshotdManager::Snapshot::CreateForTesting( + local_state(), false /* blocked_ui_mode */, false /* started */, + nullptr /* last */, nullptr /* previous */); + snapshot->Sync(); + } + + std::unique_ptr<TestUpstartClient> upstart_client_; + session_manager::SessionManager session_manager_; + std::unique_ptr<ArcDataSnapshotdManager> manager_; + // Owned by |manager_|. + FakeDelegate* delegate_ = nullptr; + // Owned by |manager_|. + FakeAppsTracker* apps_tracker_ = nullptr; + user_manager::FakeUserManager* fake_user_manager_; + std::unique_ptr<user_manager::ScopedUserManager> scoped_user_manager_; +}; + +class ArcDataSnapshotdManagerStateTest + : public ArcDataSnapshotdManagerBasicTest, + public ::testing::WithParamInterface<ArcDataSnapshotdManager::State> { + public: + ArcDataSnapshotdManager::State expected_state() { return GetParam(); } +}; + +// Tests flows in ArcDataSnapshotdManager: +// * clear snapshot flow. +// * generate key pair flow. +// * blocked UI flow. +class ArcDataSnapshotdManagerFlowTest + : public ArcDataSnapshotdManagerBasicTest, + public ::testing::WithParamInterface<bool> { + public: + void SetUp() override { + SetDBusClientAvailability(is_dbus_client_available()); + } + + bool is_dbus_client_available() { return GetParam(); } + + void CheckHeadlessMode() { + auto* command_line = base::CommandLine::ForCurrentProcess(); + EXPECT_EQ(command_line->GetSwitchValueASCII(switches::kOzonePlatform), + "headless"); + } + // Set up local_state with info for previous and last snapshots and blocked ui // mode. void SetupLocalState(bool blocked_ui_mode) { auto last = ArcDataSnapshotdManager::SnapshotInfo::CreateForTesting( - "" /* os_version */, "" /* creation_date */, false /* verified */, - false /* updated */, true /* last */); + base::SysInfo::OperatingSystemVersion(), "" /* creation_date */, + false /* verified */, false /* updated */, true /* last */); auto previous = ArcDataSnapshotdManager::SnapshotInfo::CreateForTesting( - "" /* os_version */, "" /* creation_date */, false /* verified */, - false /* updated */, false /* last */); + base::SysInfo::OperatingSystemVersion(), "" /* creation_date */, + false /* verified */, false /* updated */, false /* last */); auto snapshot = ArcDataSnapshotdManager::Snapshot::CreateForTesting( local_state(), blocked_ui_mode, false /* started */, std::move(last), std::move(previous)); @@ -182,17 +301,17 @@ TEST_F(ArcDataSnapshotdManagerBasicTest, Basic) { // Daemon stopped in ctor, since no need to be running. ExpectStopDaemon(false /* success */); - ArcDataSnapshotdManager manager(local_state(), base::DoNothing()); - EXPECT_EQ(manager.state(), ArcDataSnapshotdManager::State::kNone); - EXPECT_FALSE(manager.bridge()); + auto* manager = CreateManager(); + EXPECT_EQ(manager->state(), ArcDataSnapshotdManager::State::kNone); + EXPECT_FALSE(manager->bridge()); ExpectStartDaemon(true /*success */); - manager.EnsureDaemonStarted(base::DoNothing()); - EXPECT_TRUE(manager.bridge()); + manager->EnsureDaemonStarted(base::DoNothing()); + EXPECT_TRUE(manager->bridge()); ExpectStopDaemon(true /*success */); - manager.EnsureDaemonStopped(base::DoNothing()); - EXPECT_FALSE(manager.bridge()); + manager->EnsureDaemonStopped(base::DoNothing()); + EXPECT_FALSE(manager->bridge()); } // Test a double start scenario: start arc-data-snapshotd twice. @@ -200,18 +319,18 @@ TEST_F(ArcDataSnapshotdManagerBasicTest, DoubleStart) { // Daemon stopped in ctor, since no need to be running. ExpectStopDaemon(false /* success */); - ArcDataSnapshotdManager manager(local_state(), base::DoNothing()); - EXPECT_EQ(manager.state(), ArcDataSnapshotdManager::State::kNone); - EXPECT_FALSE(manager.bridge()); + auto* manager = CreateManager(); + EXPECT_EQ(manager->state(), ArcDataSnapshotdManager::State::kNone); + EXPECT_FALSE(manager->bridge()); ExpectStartDaemon(true /*success */); - manager.EnsureDaemonStarted(base::DoNothing()); - EXPECT_TRUE(manager.bridge()); + manager->EnsureDaemonStarted(base::DoNothing()); + EXPECT_TRUE(manager->bridge()); // The attempt to start the already running daemon. // upstart client is not aware of this. - manager.EnsureDaemonStarted(base::DoNothing()); - EXPECT_TRUE(manager.bridge()); + manager->EnsureDaemonStarted(base::DoNothing()); + EXPECT_TRUE(manager->bridge()); // Stop daemon from dtor. ExpectStopDaemon(true /*success */); @@ -225,44 +344,133 @@ // Daemon stopped in ctor, since no need to be running. ExpectStopDaemon(false /* success */); - ArcDataSnapshotdManager manager(local_state(), base::DoNothing()); - - EXPECT_EQ(manager.state(), ArcDataSnapshotdManager::State::kNone); - EXPECT_FALSE(manager.bridge()); + auto* manager = CreateManager(); + EXPECT_EQ(manager->state(), ArcDataSnapshotdManager::State::kNone); + EXPECT_FALSE(manager->bridge()); ExpectStartDaemon(false /* success */); - manager.EnsureDaemonStarted(base::DoNothing()); - EXPECT_TRUE(manager.bridge()); + manager->EnsureDaemonStarted(base::DoNothing()); + EXPECT_TRUE(manager->bridge()); ExpectStopDaemon(false /* success */); - manager.EnsureDaemonStopped(base::DoNothing()); - EXPECT_FALSE(manager.bridge()); + manager->EnsureDaemonStopped(base::DoNothing()); + EXPECT_FALSE(manager->bridge()); } -#if defined(MEMORY_SANITIZER) -// https://crbug.com/1144452 -#define MAYBE_RestoredAfterCrash DISABLED_RestoredAfterCrash -#else -#define MAYBE_RestoredAfterCrash RestoredAfterCrash -#endif -TEST_F(ArcDataSnapshotdManagerBasicTest, MAYBE_RestoredAfterCrash) { +TEST_F(ArcDataSnapshotdManagerBasicTest, RestoredAfterCrash) { SetUpRestoredSessionCommandLine(); // The attempt to stop the daemon, started before crash. ExpectStopDaemon(true /*success */); - ArcDataSnapshotdManager manager(local_state(), base::DoNothing()); - EXPECT_EQ(manager.state(), ArcDataSnapshotdManager::State::kRestored); - EXPECT_FALSE(manager.IsAutoLoginConfigured()); - EXPECT_TRUE(manager.IsAutoLoginAllowed()); + auto* manager = CreateManager(); + EXPECT_EQ(manager->state(), ArcDataSnapshotdManager::State::kRestored); + EXPECT_FALSE(manager->IsAutoLoginConfigured()); + EXPECT_TRUE(manager->IsAutoLoginAllowed()); - EXPECT_FALSE(manager.bridge()); + EXPECT_FALSE(manager->bridge()); ExpectStartDaemon(true /*success */); - manager.EnsureDaemonStarted(base::DoNothing()); + manager->EnsureDaemonStarted(base::DoNothing()); // Stop daemon from dtor. ExpectStopDaemon(true /*success */); } +// Test success TakeSnapshot flow: when public session account logs in and MGS +// is expected to be launched, a new snapshot is expected to be taken. +TEST_F(ArcDataSnapshotdManagerBasicTest, TakeSnapshotSuccess) { + // Daemon stopped in ctor, since no need to be running. + ExpectStopDaemon(false /* success */); + base::RunLoop run_loop; + auto* manager = CreateManager( + base::BindLambdaForTesting([&run_loop]() { run_loop.Quit(); })); + CheckSnapshots(0 /* expected_snapshots_number */, + false /* expected_blocked_ui_mode */); + + // Logging into public session account. + manager->set_state_for_testing(ArcDataSnapshotdManager::State::kMgsToLaunch); + auto account_id = AccountId::FromUserEmail(kPublicAccountEmail); + user_manager()->AddPublicAccountUser(account_id); + user_manager()->UserLoggedIn(account_id, account_id.GetUserEmail(), false, + false); + manager->OnSessionStateChanged(); + + ExpectStartTrackingApps(); + EXPECT_EQ(manager->state(), ArcDataSnapshotdManager::State::kMgsLaunched); + // Installed 10% of tracking apps. + apps_tracker()->update_callback().Run(10 /* percent */); + EXPECT_EQ(manager->state(), ArcDataSnapshotdManager::State::kMgsLaunched); + // Expect to stop ARC. + ExpectStartDaemon(true /*success */); + // Expect daemon to stop once the snapshot is taken. + ExpectStopDaemon(true /* success */); + // Finished ARC tracking. + apps_tracker()->update_callback().Run(100); + // Attempt user exit callback must be called. + run_loop.Run(); + + ExpectStopTrackingApps(); + EXPECT_EQ(1, delegate()->stopped_callback_num()); + + CheckSnapshots(1 /* expected_snapshots_number */, + false /* expected_blocked_ui_mode */); +} + +// Test that ARC data removal triggers chrome restart. +// Test failure TakeSnapshot flow: when MGS has failed during TakeSnapshot flow. +TEST_F(ArcDataSnapshotdManagerBasicTest, TakeSnapshotMgsFailure) { + // Daemon stopped in ctor, since no need to be running. + ExpectStopDaemon(false /* success */); + base::RunLoop run_loop; + auto* manager = CreateManager( + base::BindLambdaForTesting([&run_loop]() { run_loop.Quit(); })); + CheckSnapshots(0 /* expected_snapshots_number */, + false /* expected_blocked_ui_mode */); + + // Logging into public session account. + manager->set_state_for_testing(ArcDataSnapshotdManager::State::kMgsToLaunch); + auto account_id = AccountId::FromUserEmail(kPublicAccountEmail); + user_manager()->AddPublicAccountUser(account_id); + user_manager()->UserLoggedIn(account_id, account_id.GetUserEmail(), false, + false); + EXPECT_TRUE(user_manager()->IsLoggedInAsPublicAccount()); + manager->OnSessionStateChanged(); + ExpectStartTrackingApps(); + EXPECT_EQ(manager->state(), ArcDataSnapshotdManager::State::kMgsLaunched); + + user_manager()->RemoveUserFromList(account_id); + EXPECT_FALSE(user_manager()->IsLoggedInAsPublicAccount()); + manager->OnSessionStateChanged(); + EXPECT_EQ(manager->state(), ArcDataSnapshotdManager::State::kNone); + + // Attempt user exit callback must be called. + run_loop.Run(); + ExpectStopTrackingApps(); + // No ARC stop callback is called, because of invalid state. + EXPECT_EQ(0, delegate()->stopped_callback_num()); + CheckSnapshots(0 /* expected_snapshots_number */, + false /* expected_blocked_ui_mode */); +} + +// Test no one state should lead to any changes except when MGS is launched. +TEST_P(ArcDataSnapshotdManagerStateTest, OnSessionStateChangedWrongState) { + // Daemon stopped in ctor, since no need to be running. + ExpectStopDaemon(false /* success */); + auto* manager = CreateManager(); + manager->set_state_for_testing(expected_state()); + EXPECT_EQ(manager->state(), expected_state()); + EXPECT_FALSE(manager->bridge()); + manager->OnSessionStateChanged(); + EXPECT_EQ(manager->state(), expected_state()); +} + +INSTANTIATE_TEST_SUITE_P( + ArcDataSnapshotdManagerStateTest, + ArcDataSnapshotdManagerStateTest, + ::testing::Values(ArcDataSnapshotdManager::State::kNone, + ArcDataSnapshotdManager::State::kBlockedUi, + ArcDataSnapshotdManager::State::kMgsToLaunch, + ArcDataSnapshotdManager::State::kRestored)); + // Test clear snapshots flow. TEST_P(ArcDataSnapshotdManagerFlowTest, ClearSnapshotsBasic) { // Set up two snapshots (previous and last) in local_state. @@ -276,17 +484,17 @@ ExpectStartDaemon(true /*success */); // Stop once finished clearing. ExpectStopDaemon(true /*success */); - ArcDataSnapshotdManager manager(local_state(), base::DoNothing()); + auto* manager = CreateManager(); RunUntilIdle(); // No snapshots in local_state either. - EXPECT_EQ(manager.state(), ArcDataSnapshotdManager::State::kNone); - EXPECT_FALSE(manager.IsAutoLoginConfigured()); - EXPECT_TRUE(manager.IsAutoLoginAllowed()); + EXPECT_EQ(manager->state(), ArcDataSnapshotdManager::State::kNone); + EXPECT_FALSE(manager->IsAutoLoginConfigured()); + EXPECT_TRUE(manager->IsAutoLoginAllowed()); CheckSnapshots(0 /* expected_snapshots_number */, false /* expected_blocked_ui_mode */); - EXPECT_FALSE(manager.bridge()); + EXPECT_FALSE(manager->bridge()); } // Test blocked UI mode flow. @@ -304,33 +512,32 @@ // Stop once finished clearing. ExpectStopDaemon(true /*success */); bool is_attempt_user_exit_called = false; - ArcDataSnapshotdManager manager( - local_state(), + auto* manager = CreateManager( base::BindLambdaForTesting([&is_attempt_user_exit_called]() { is_attempt_user_exit_called = true; })); CheckHeadlessMode(); - EXPECT_EQ(manager.state(), ArcDataSnapshotdManager::State::kBlockedUi); - EXPECT_TRUE(manager.IsAutoLoginConfigured()); - EXPECT_FALSE(manager.IsAutoLoginAllowed()); + EXPECT_EQ(manager->state(), ArcDataSnapshotdManager::State::kBlockedUi); + EXPECT_TRUE(manager->IsAutoLoginConfigured()); + EXPECT_FALSE(manager->IsAutoLoginAllowed()); RunUntilIdle(); if (is_dbus_client_available()) { EXPECT_FALSE(is_attempt_user_exit_called); - EXPECT_EQ(manager.state(), ArcDataSnapshotdManager::State::kMgsToLaunch); - EXPECT_TRUE(manager.IsAutoLoginConfigured()); - EXPECT_TRUE(manager.IsAutoLoginAllowed()); + EXPECT_EQ(manager->state(), ArcDataSnapshotdManager::State::kMgsToLaunch); + EXPECT_TRUE(manager->IsAutoLoginConfigured()); + EXPECT_TRUE(manager->IsAutoLoginAllowed()); - EXPECT_TRUE(manager.bridge()); + EXPECT_TRUE(manager->bridge()); // Starts a last snapshot creation. last became previous. CheckSnapshots(1 /* expected_snapshots_number */, true /*expected_blocked_ui */, true /* expected_snapshot_started */); } else { EXPECT_TRUE(is_attempt_user_exit_called); - EXPECT_EQ(manager.state(), ArcDataSnapshotdManager::State::kBlockedUi); - EXPECT_FALSE(manager.bridge()); + EXPECT_EQ(manager->state(), ArcDataSnapshotdManager::State::kBlockedUi); + EXPECT_FALSE(manager->bridge()); // Snapshots are valid. No need to clear. CheckSnapshots(2 /* expected_snapshots_number */, false /* expected_blocked_ui */);
diff --git a/components/autofill_assistant/browser/BUILD.gn b/components/autofill_assistant/browser/BUILD.gn index 1b02b1f..19e1efd 100644 --- a/components/autofill_assistant/browser/BUILD.gn +++ b/components/autofill_assistant/browser/BUILD.gn
@@ -10,6 +10,9 @@ proto_library("proto") { sources = [ + "action_strategy.proto", + "action_value.proto", + "dom_action.proto", "generic_ui.proto", "model.proto", "service.proto", @@ -419,6 +422,9 @@ proto_java_library("proto_java") { proto_path = "//components/autofill_assistant/browser/" sources = [ + "$proto_path/action_strategy.proto", + "$proto_path/action_value.proto", + "$proto_path/dom_action.proto", "$proto_path/generic_ui.proto", "$proto_path/model.proto", "$proto_path/service.proto",
diff --git a/components/autofill_assistant/browser/action_strategy.proto b/components/autofill_assistant/browser/action_strategy.proto new file mode 100644 index 0000000..26eb8681 --- /dev/null +++ b/components/autofill_assistant/browser/action_strategy.proto
@@ -0,0 +1,59 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option java_package = "org.chromium.chrome.browser.autofill_assistant.proto"; +option java_multiple_files = true; + +package autofill_assistant; + +enum KeyboardValueFillStrategy { + UNSPECIFIED_KEYBAORD_STRATEGY = 0; + + // Send a `node.value = "<value>"` JS command. + SET_VALUE = 1; + + // Send a `node.value = ""` JS command to clear the field, then click the + // field to focus it and send single key strokes. + SIMULATE_KEY_PRESSES = 2; + + // Send a `node.select()` JS command to select the current field value, then + // send single key strokes overwriting the current value. + SIMULATE_KEY_PRESSES_SELECT_VALUE = 3; + + // Send a `node.value = ""` JS command to clear the field, then send a + // `node.focus()` JS command to focus the field and send single key strokes. + SIMULATE_KEY_PRESSES_FOCUS = 4; +} + +// Note: On multiple matches, the first one will be selected. +enum DropdownSelectStrategy { + UNSPECIFIED_SELECT_STRATEGY = 0; + + // Match by the option's value, case insensitive. + VALUE_MATCH = 1; + + // Match by the option's label, case insensitive. + LABEL_MATCH = 2; + + // Match by the option's label by `label.startsWith`, case insensitive. + LABEL_STARTS_WITH = 3; +} + +// This type disambiguates the term "clicking" on a node in the DOM by defining +// what strategy should be used to execute the "click". +enum ClickType { + NOT_SET = 0; + + // Send a tap event to the node. + TAP = 1; + + // Use JavaScript's `node.click()` to click the element. + JAVASCRIPT = 2; + + // Send a click event to the node. + CLICK = 3; +}
diff --git a/components/autofill_assistant/browser/action_value.proto b/components/autofill_assistant/browser/action_value.proto new file mode 100644 index 0000000..f5a42093 --- /dev/null +++ b/components/autofill_assistant/browser/action_value.proto
@@ -0,0 +1,33 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option java_package = "org.chromium.chrome.browser.autofill_assistant.proto"; +option java_multiple_files = true; + +package autofill_assistant; + +message AutofillValue { + message Profile { optional string identifier = 1; } + + // The profile to be used. This has to be requested with a + // |CollectUserDataAction| first. + optional Profile profile = 1; + + // A string containing any number of "${key}" placeholders, where the key is + // an integer corresponding to entries from field_types.h or + // |AutofillFormatProto::AutofillAssistantCustomField|. + // Note that the set of actually available fields are outside of our + // control and are retrieved automatically from the provided profile. + optional string value_expression = 2; +} + +message TextValue { + oneof value { + string text = 1; + AutofillValue autofill_value = 2; + } +}
diff --git a/components/autofill_assistant/browser/dom_action.proto b/components/autofill_assistant/browser/dom_action.proto new file mode 100644 index 0000000..5b0f1813 --- /dev/null +++ b/components/autofill_assistant/browser/dom_action.proto
@@ -0,0 +1,78 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option java_package = "org.chromium.chrome.browser.autofill_assistant.proto"; +option java_multiple_files = true; + +package autofill_assistant; + +import "action_value.proto"; + +message ClientIdProto { + optional string identifier = 1; +} + +message ScrollIntoViewProto { + optional ClientIdProto client_id = 1; +} + +message WaitForDocumentToBecomeInteractiveProto { + optional ClientIdProto client_id = 1; + optional int32 timeout_in_ms = 2; +} + +message WaitForDocumentToBecomeCompleteProto { + optional ClientIdProto client_id = 1; + optional int32 timeout_in_ms = 2; +} + +message WaitForElementToBecomeStable { + optional ClientIdProto client_id = 1; + optional int32 stable_check_max_rounds = 2 [default = 50]; + optional int32 stable_check_interval_ms = 3 [default = 200]; +} + +message CheckElementIsOnTop { + optional ClientIdProto client_id = 1; +} + +message SendClickEventProto { + optional ClientIdProto client_id = 1; +} + +message SendTapEventProto { + optional ClientIdProto client_id = 1; +} + +message JsClickProto { + optional ClientIdProto client_id = 1; +} + +message SendKeystrokeEventsProto { + optional ClientIdProto client_id = 1; + optional TextValue value = 2; + optional int32 delay_in_ms = 3; +} + +message SetFieldValueProto { + optional ClientIdProto client_id = 1; + optional TextValue value = 2; +} + +message SetElementAttributeProto { + optional ClientIdProto client_id = 1; + repeated string attribute = 2; + optional TextValue value = 3; +} + +message SelectFieldValueProto { + optional ClientIdProto client_id = 1; +} + +message FocusFieldProto { + optional ClientIdProto client_id = 1; +}
diff --git a/components/autofill_assistant/browser/service.proto b/components/autofill_assistant/browser/service.proto index 2399e19..1c69dec 100644 --- a/components/autofill_assistant/browser/service.proto +++ b/components/autofill_assistant/browser/service.proto
@@ -10,6 +10,8 @@ package autofill_assistant; +import "action_strategy.proto"; +import "action_value.proto"; import "generic_ui.proto"; import "model.proto"; import "view_layout.proto"; @@ -576,69 +578,6 @@ optional bool resize_visual_viewport = 8; } -enum KeyboardValueFillStrategy { - UNSPECIFIED_KEYBAORD_STRATEGY = 0; - - // Send a `node.value = "<value>"` JS command. - SET_VALUE = 1; - - // Send a `node.value = ""` JS command to clear the field, then click the - // field to focus it and send single key strokes. - SIMULATE_KEY_PRESSES = 2; - - // Send a `node.select()` JS command to select the current field value, then - // send single key strokes overwriting the current value. - SIMULATE_KEY_PRESSES_SELECT_VALUE = 3; - - // Send a `node.value = ""` JS command to clear the field, then send a - // `node.focus()` JS command to focus the field and send single key strokes. - SIMULATE_KEY_PRESSES_FOCUS = 4; -} - -// Note: On multiple matches, the first one will be selected. -enum DropdownSelectStrategy { - UNSPECIFIED_SELECT_STRATEGY = 0; - - // Match by the option's value, case insensitive. - VALUE_MATCH = 1; - - // Match by the option's label, case insensitive. - LABEL_MATCH = 2; - - // Match by the option's label by `label.startsWith`, case insensitive. - LABEL_STARTS_WITH = 3; -} - -// This type disambiguates the term "clicking" on a node in the DOM by defining -// what strategy should be used to execute the "click". -enum ClickType { - NOT_SET = 0; - - // Send a tap event to the node. - TAP = 1; - - // Use JavaScript's `node.click()` to click the element. - JAVASCRIPT = 2; - - // Send a click event to the node. - CLICK = 3; -} - -message AutofillValue { - message Profile { optional string identifier = 1; } - - // The profile to be used. This has to be requested with a - // |CollectUserDataAction| first. - optional Profile profile = 1; - - // A string containing any number of "${key}" placeholders, where the key is - // an integer corresponding to entries from field_types.h or - // |AutofillFormatProto::AutofillAssistantCustomField|. - // Note that the set of actually available fields are outside of our - // control and are retrieved automatically from the provided profile. - optional string value_expression = 2; -} - // An action could be performed. message ActionProto { // Wait these many milliseconds before executing the action, if set.
diff --git a/components/find_in_page/DIR_METADATA b/components/find_in_page/DIR_METADATA new file mode 100644 index 0000000..98c264d --- /dev/null +++ b/components/find_in_page/DIR_METADATA
@@ -0,0 +1,3 @@ +monorail { + component: "UI>Browser>FindInPage" +} \ No newline at end of file
diff --git a/components/find_in_page/OWNERS b/components/find_in_page/OWNERS index 2d9c6684..a8d65b2 100644 --- a/components/find_in_page/OWNERS +++ b/components/find_in_page/OWNERS
@@ -1,3 +1 @@ file://chrome/browser/ui/OWNERS - -# COMPONENT: UI>Browser>FindInPage
diff --git a/components/find_in_page/android/DIR_METADATA b/components/find_in_page/android/DIR_METADATA new file mode 100644 index 0000000..98c264d --- /dev/null +++ b/components/find_in_page/android/DIR_METADATA
@@ -0,0 +1,3 @@ +monorail { + component: "UI>Browser>FindInPage" +} \ No newline at end of file
diff --git a/components/find_in_page/android/OWNERS b/components/find_in_page/android/OWNERS index 3e2e014..697c69ed 100644 --- a/components/find_in_page/android/OWNERS +++ b/components/find_in_page/android/OWNERS
@@ -1,3 +1 @@ file://chrome/android/OWNERS - -# COMPONENT: UI>Browser>FindInPage
diff --git a/components/management_strings.grdp b/components/management_strings.grdp index 8500595..c89f287 100644 --- a/components/management_strings.grdp +++ b/components/management_strings.grdp
@@ -21,11 +21,11 @@ <!-- Subtitles of the Chrome OS version of the management page --> <if expr="chromeos"> - <message name="IDS_MANAGEMENT_SUBTITLE_MANAGED" desc="Title of chrome://management page, shows when device is managed by unknown organization"> + <message name="IDS_MANAGEMENT_SUBTITLE_MANAGED" desc="Title of chrome://management page, shows when device is managed by an unknown manager"> Your <ph name="DEVICE_NAME">$1<ex>Chromebook</ex></ph> is managed </message> - <message name="IDS_MANAGEMENT_SUBTITLE_MANAGED_BY" desc="Title of chrome://management page, shows when device managed by known organization"> - Your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> is managed by <ph name="ENROLLMENT_DOMAIN">$2<ex>example.com</ex></ph> + <message name="IDS_MANAGEMENT_SUBTITLE_MANAGED_BY" desc="Title of chrome://management page, shows when device managed by a known manager. MANAGER can be a domain or an email address."> + Your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> is managed by <ph name="MANAGER">$2<ex>example.com</ex></ph> </message> <message name="IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE" desc="Message indicating that the device is not managed"> Your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> is not managed @@ -37,8 +37,8 @@ <message name="IDS_MANAGEMENT_SUBTITLE" desc="Title of chrome://management page, which shows the administrator's capabilities in a managed environment"> Your browser is managed </message> - <message name="IDS_MANAGEMENT_SUBTITLE_MANAGED_BY" desc="Title of chrome://management page, which shows the administrator's capabilities in a managed environment"> - Your browser is managed by <ph name="ENROLLMENT_DOMAIN">$1<ex>example.com</ex></ph> + <message name="IDS_MANAGEMENT_SUBTITLE_MANAGED_BY" desc="Title of chrome://management page, which shows the administrator's capabilities in a managed environment. MANAGER can be a domain or an email address."> + Your browser is managed by <ph name="MANAGER">$1<ex>example.com</ex></ph> </message> <message name="IDS_MANAGEMENT_NOT_MANAGED_SUBTITLE" desc="Title of chrome://management page for a browser that is not managed"> Your browser is not managed @@ -60,14 +60,14 @@ <message name="IDS_MANAGEMENT_DEVICE_NOT_MANAGED" desc="Message indicating that the device and account are not managed"> This device and account are not managed by a company or other organization. </message> - <message name="IDS_MANAGEMENT_DEVICE_MANAGED_BY_ACCOUNT_MANAGED_BY" desc="Message indicating that the device is enterprise enrolled to be managed by an administrator, from a specific domain. And account is managed by an administrator, from another specific domain."> - Your device is managed by <ph name="ENROLLMENT_DOMAIN">$1<ex>example.com</ex></ph> and your account is managed by <ph name="ACCOUNT_DOMAIN">$2<ex>example.com</ex></ph>. + <message name="IDS_MANAGEMENT_DEVICE_MANAGED_BY_ACCOUNT_MANAGED_BY" desc="Message indicating that the device is enterprise enrolled to be managed by one administrator and the account is managed by another administrator. DEVICE_MANAGER and ACCOUNT_MANAGER can each be a domain or an email address."> + Your device is managed by <ph name="DEVICE_MANAGER">$1<ex>example.com</ex></ph> and your account is managed by <ph name="ACCOUNT_MANAGER">$2<ex>example.com</ex></ph>. </message> - <message name="IDS_MANAGEMENT_DEVICE_AND_ACCOUNT_MANAGED_BY" desc="Message indicating that the device and account are enterprise enrolled to be managed by an administrator, from a specific domain"> - Your device and account are managed by <ph name="ENROLLMENT_DOMAIN">$1<ex>example.com</ex></ph>. + <message name="IDS_MANAGEMENT_DEVICE_AND_ACCOUNT_MANAGED_BY" desc="Message indicating that the device and account are enterprise enrolled to be managed by an administrator. MANAGER can be a domain or an email address."> + Your device and account are managed by <ph name="MANAGER">$1<ex>example.com</ex></ph>. </message> - <message name="IDS_MANAGEMENT_ACCOUNT_MANAGED_BY" desc="Message indicating that the account is enterprise enrolled to be managed by an administrator"> - Your account is managed by <ph name="ENROLLMENT_DOMAIN">$1<ex>example.com</ex></ph>. + <message name="IDS_MANAGEMENT_ACCOUNT_MANAGED_BY" desc="Message indicating that the account is enterprise enrolled to be managed by an administrator. MANAGER can be a domain or an email address."> + Your account is managed by <ph name="MANAGER">$1<ex>example.com</ex></ph>. </message> </if>
diff --git a/components/management_strings_grdp/IDS_MANAGEMENT_ACCOUNT_MANAGED_BY.png.sha1 b/components/management_strings_grdp/IDS_MANAGEMENT_ACCOUNT_MANAGED_BY.png.sha1 new file mode 100644 index 0000000..d27c6b1 --- /dev/null +++ b/components/management_strings_grdp/IDS_MANAGEMENT_ACCOUNT_MANAGED_BY.png.sha1
@@ -0,0 +1 @@ +0fb6297e7a4a29e5e963a160edd1bbfde0daf39f \ No newline at end of file
diff --git a/components/management_strings_grdp/IDS_MANAGEMENT_DEVICE_AND_ACCOUNT_MANAGED_BY.png.sha1 b/components/management_strings_grdp/IDS_MANAGEMENT_DEVICE_AND_ACCOUNT_MANAGED_BY.png.sha1 new file mode 100644 index 0000000..29e4166 --- /dev/null +++ b/components/management_strings_grdp/IDS_MANAGEMENT_DEVICE_AND_ACCOUNT_MANAGED_BY.png.sha1
@@ -0,0 +1 @@ +d574efbf54253d72f90419bf335451db29e9292e \ No newline at end of file
diff --git a/components/management_strings_grdp/IDS_MANAGEMENT_DEVICE_MANAGED_BY_ACCOUNT_MANAGED_BY.png.sha1 b/components/management_strings_grdp/IDS_MANAGEMENT_DEVICE_MANAGED_BY_ACCOUNT_MANAGED_BY.png.sha1 new file mode 100644 index 0000000..f490fb0 --- /dev/null +++ b/components/management_strings_grdp/IDS_MANAGEMENT_DEVICE_MANAGED_BY_ACCOUNT_MANAGED_BY.png.sha1
@@ -0,0 +1 @@ +47563a96b73f29c5fcb8a0961154f50e858595ec \ No newline at end of file
diff --git a/components/management_strings_grdp/IDS_MANAGEMENT_SUBTITLE_MANAGED_BY.png.sha1 b/components/management_strings_grdp/IDS_MANAGEMENT_SUBTITLE_MANAGED_BY.png.sha1 new file mode 100644 index 0000000..29e4166 --- /dev/null +++ b/components/management_strings_grdp/IDS_MANAGEMENT_SUBTITLE_MANAGED_BY.png.sha1
@@ -0,0 +1 @@ +d574efbf54253d72f90419bf335451db29e9292e \ No newline at end of file
diff --git a/components/paint_preview/player/player_compositor_delegate.cc b/components/paint_preview/player/player_compositor_delegate.cc index 7767c59..5d65357 100644 --- a/components/paint_preview/player/player_compositor_delegate.cc +++ b/components/paint_preview/player/player_compositor_delegate.cc
@@ -387,6 +387,12 @@ return; } + // It is possible the client was disconnected while loading the proto. + if (!paint_preview_compositor_client_) { + OnCompositorReady(CompositorStatus::COMPOSITOR_CLIENT_DISCONNECT, nullptr); + return; + } + paint_preview_compositor_client_->BeginSeparatedFrameComposite( std::move(begin_composite_request), base::BindOnce(&PlayerCompositorDelegate::OnCompositorReadyStatusAdapter,
diff --git a/components/payments/content/android/java/src/org/chromium/components/payments/BrowserPaymentRequest.java b/components/payments/content/android/java/src/org/chromium/components/payments/BrowserPaymentRequest.java index 0a73b2e..67ef971 100644 --- a/components/payments/content/android/java/src/org/chromium/components/payments/BrowserPaymentRequest.java +++ b/components/payments/content/android/java/src/org/chromium/components/payments/BrowserPaymentRequest.java
@@ -147,8 +147,12 @@ /** * Skips the app selector UI whether it is currently opened or not, and if applicable, invokes a * payment app. + * @return The error if it fails; null otherwise. */ - default void triggerPaymentAppUiSkipIfApplicable() {} + @Nullable + default String triggerPaymentAppUiSkipIfApplicable() { + return null; + } /** * Called when a new payment app is created. @@ -209,8 +213,12 @@ /** * Continues the unfinished part of show() that was blocked for the payment details that was * pending to be updated. + * @return The error if it fails; null otherwise. */ - default void continueShow() {} + @Nullable + default String continueShow() { + return null; + } /** * If needed, do extra parsing and validation for details.
diff --git a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentRequestService.java b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentRequestService.java index 745ed3dd..56208d0 100644 --- a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentRequestService.java +++ b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentRequestService.java
@@ -670,14 +670,28 @@ String error = mBrowserPaymentRequest.showAppSelector(mIsShowWaitingForUpdatedDetails, mSpec.getRawTotal(), mSpec.getPaymentOptions()); if (error != null) { - mJourneyLogger.setNotShown(NotShownReason.OTHER); - disconnectFromClientWithDebugMessage(error, PaymentErrorReason.USER_CANCEL); - if (sObserverForTest != null) sObserverForTest.onPaymentRequestServiceShowFailed(); + onShowFailed(error); return; } } - mBrowserPaymentRequest.triggerPaymentAppUiSkipIfApplicable(); + String error = mBrowserPaymentRequest.triggerPaymentAppUiSkipIfApplicable(); + if (error != null) { + onShowFailed(error); + return; + } + } + + private void onShowFailed(String error) { + onShowFailed(NotShownReason.OTHER, error, PaymentErrorReason.USER_CANCEL); + } + + // notShowReason is defined in NotShownReason. + // paymentErrorReason is defined in PaymentErrorReason. + private void onShowFailed(int notShowReason, String error, int paymentErrorReason) { + mJourneyLogger.setNotShown(notShowReason); + disconnectFromClientWithDebugMessage(error, paymentErrorReason); + if (sObserverForTest != null) sObserverForTest.onPaymentRequestServiceShowFailed(); } /** @@ -691,14 +705,15 @@ // All factories have responded, but none of them have apps. It's possible to add credit // cards, but the merchant does not support them either. The payment request must be // rejected. - mJourneyLogger.setNotShown(mCanMakePayment - ? NotShownReason.NO_MATCHING_PAYMENT_METHOD - : NotShownReason.NO_SUPPORTED_PAYMENT_METHOD); + int notShowReason = mCanMakePayment ? NotShownReason.NO_MATCHING_PAYMENT_METHOD + : NotShownReason.NO_SUPPORTED_PAYMENT_METHOD; + String debugMessage; + int paymentErrorReason; if (mDelegate.isOffTheRecord()) { // If the user is in the OffTheRecord mode, hide the absence of their payment // methods from the merchant site. - disconnectFromClientWithDebugMessage( - ErrorStrings.USER_CANCELLED, PaymentErrorReason.USER_CANCEL); + debugMessage = ErrorStrings.USER_CANCELLED; + paymentErrorReason = PaymentErrorReason.USER_CANCEL; } else { if (sNativeObserverForTest != null) { sNativeObserverForTest.onNotSupportedError(); @@ -708,16 +723,14 @@ && mSpec.getMethodData().get(MethodStrings.GOOGLE_PLAY_BILLING) != null) { mRejectShowErrorMessage = ErrorStrings.APP_STORE_METHOD_ONLY_SUPPORTED_IN_TWA; } - disconnectFromClientWithDebugMessage( + debugMessage = ErrorMessageUtil.getNotSupportedErrorMessage(mSpec.getMethodData().keySet()) - + (TextUtils.isEmpty(mRejectShowErrorMessage) - ? "" - : " " + mRejectShowErrorMessage), - PaymentErrorReason.NOT_SUPPORTED); + + (TextUtils.isEmpty(mRejectShowErrorMessage) + ? "" + : " " + mRejectShowErrorMessage); + paymentErrorReason = PaymentErrorReason.NOT_SUPPORTED; } - if (sObserverForTest != null) { - sObserverForTest.onPaymentRequestServiceShowFailed(); - } + onShowFailed(notShowReason, debugMessage, paymentErrorReason); return true; } return disconnectForStrictShow(mIsUserGestureShow); @@ -736,15 +749,11 @@ return false; } - if (sObserverForTest != null) { - sObserverForTest.onPaymentRequestServiceShowFailed(); - } mRejectShowErrorMessage = ErrorStrings.STRICT_BASIC_CARD_SHOW_REJECT; - disconnectFromClientWithDebugMessage( + String debugMessage = ErrorMessageUtil.getNotSupportedErrorMessage(mSpec.getMethodData().keySet()) + " " - + mRejectShowErrorMessage, - PaymentErrorReason.NOT_SUPPORTED); - + + mRejectShowErrorMessage; + onShowFailed(NotShownReason.OTHER, debugMessage, PaymentErrorReason.NOT_SUPPORTED); return true; } @@ -923,12 +932,8 @@ // The renderer can create multiple instances of PaymentRequest and call show() on each // one. Only the first one will be shown. This also prevents multiple tabs and windows // from showing PaymentRequest UI at the same time. - mJourneyLogger.setNotShown(NotShownReason.CONCURRENT_REQUESTS); - disconnectFromClientWithDebugMessage( - ErrorStrings.ANOTHER_UI_SHOWING, PaymentErrorReason.ALREADY_SHOWING); - if (sObserverForTest != null) { - sObserverForTest.onPaymentRequestServiceShowFailed(); - } + onShowFailed(NotShownReason.CONCURRENT_REQUESTS, ErrorStrings.ANOTHER_UI_SHOWING, + PaymentErrorReason.ALREADY_SHOWING); return; } sShowingPaymentRequest = this; @@ -945,14 +950,16 @@ String error = mBrowserPaymentRequest.showAppSelector(mIsShowWaitingForUpdatedDetails, mSpec.getRawTotal(), mSpec.getPaymentOptions()); if (error != null) { - mJourneyLogger.setNotShown(NotShownReason.OTHER); - disconnectFromClientWithDebugMessage(error, PaymentErrorReason.USER_CANCEL); - if (sObserverForTest != null) sObserverForTest.onPaymentRequestServiceShowFailed(); + onShowFailed(error); return; } } - mBrowserPaymentRequest.triggerPaymentAppUiSkipIfApplicable(); + String error = mBrowserPaymentRequest.triggerPaymentAppUiSkipIfApplicable(); + if (error != null) { + onShowFailed(error); + return; + } } // Implements PaymentDetailsConverter.MethodChecker: @@ -963,7 +970,7 @@ && invokedPaymentApp.isValidForPaymentMethodData(methodName, null); } - private void continueShow(PaymentDetails details) { + private String continueShow(PaymentDetails details) { assert mIsShowWaitingForUpdatedDetails; // mSpec.updateWith() can be used only when mSpec has not been destroyed. assert !mSpec.isDestroyed(); @@ -971,22 +978,17 @@ if (!PaymentValidator.validatePaymentDetails(details) || !mBrowserPaymentRequest.parseAndValidateDetailsFurtherIfNeeded(details)) { mJourneyLogger.setAborted(AbortReason.INVALID_DATA_FROM_RENDERER); - disconnectFromClientWithDebugMessage( - ErrorStrings.INVALID_PAYMENT_DETAILS, PaymentErrorReason.USER_CANCEL); - return; + return ErrorStrings.INVALID_PAYMENT_DETAILS; } - if (!TextUtils.isEmpty(details.error)) { - mJourneyLogger.setNotShown(NotShownReason.OTHER); - disconnectFromClientWithDebugMessage( - ErrorStrings.INVALID_STATE, PaymentErrorReason.USER_CANCEL); - return; - } + if (!TextUtils.isEmpty(details.error)) return ErrorStrings.INVALID_STATE; mSpec.updateWith(details); mIsShowWaitingForUpdatedDetails = false; - mBrowserPaymentRequest.continueShow(); + String error = mBrowserPaymentRequest.continueShow(); + if (error != null) return error; + return null; } /** @@ -998,7 +1000,11 @@ if (mIsShowWaitingForUpdatedDetails) { // Under this condition, updateWith() is called in response to the resolution of // show()'s PaymentDetailsUpdate promise. - continueShow(details); + String error = continueShow(details); + if (error != null) { + onShowFailed(error); + return; + } return; } @@ -1208,6 +1214,12 @@ mOnClosedListener.run(); + mJourneyLogger.destroy(); + + if (mSpec != null) { + mSpec.destroy(); + } + if (sNativeObserverForTest != null) { sNativeObserverForTest.onClosed(); }
diff --git a/components/performance_manager/public/voting/voting.h b/components/performance_manager/public/voting/voting.h index 2129c01..e2b82b70 100644 --- a/components/performance_manager/public/voting/voting.h +++ b/components/performance_manager/public/voting/voting.h
@@ -453,6 +453,40 @@ accepted_votes_by_voter_id_; }; +// A wrapper for a VotingChannel that takes care of handling the VoteReceipts. +// This is a temporary class that exists while existing users of VotingChannel +// are being migrated. Its functionality will be folded into VotingChannel +// in the future. +template <class VoteImpl> +class VotingChannelWrapper { + public: + using ContextType = typename VoteImpl::ContextType; + + VotingChannelWrapper(); + ~VotingChannelWrapper(); + + // Sets the underlying VotingChannel. Can only be invoked once, and it must be + // done before any calls to the functions to submit/change/invalidate votes. + void SetVotingChannel(VotingChannel<VoteImpl> voting_channel); + + // Submits a vote through the underlying voting channel. Can only be called + // after SetVotingChannel() was invoked. + void SubmitVote(const ContextType* context, const VoteImpl& vote); + + // Modifies an existing vote. Can only be called after SetVotingChannel() was + // invoked. + void ChangeVote(const ContextType* context, const VoteImpl& new_vote); + + // Invalidates an existing vote. Can only be called after SetVotingChannel() + // was invoked. + void InvalidateVote(const ContextType* context); + + private: + VotingChannel<VoteImpl> voting_channel_; + + std::map<const ContextType*, VoteReceipt<VoteImpl>> vote_receipts_; +}; + ///////////////////////////////////////////////////////////////////// // Vote @@ -933,6 +967,50 @@ } } +///////////////////////////////////////////////////////////////////// +// VotingChannelWrapper + +template <class VoteImpl> +VotingChannelWrapper<VoteImpl>::VotingChannelWrapper() = default; + +template <class VoteImpl> +VotingChannelWrapper<VoteImpl>::~VotingChannelWrapper() = default; + +template <class VoteImpl> +void VotingChannelWrapper<VoteImpl>::SetVotingChannel( + VotingChannel<VoteImpl> voting_channel) { + DCHECK(voting_channel.IsValid()); + DCHECK(!voting_channel_.IsValid()); + voting_channel_ = std::move(voting_channel); +} + +template <class VoteImpl> +void VotingChannelWrapper<VoteImpl>::SubmitVote(const ContextType* context, + const VoteImpl& vote) { + DCHECK(voting_channel_.IsValid()); + + VoteReceipt<VoteImpl> vote_receipt = + voting_channel_.SubmitVote(context, vote); + bool inserted = + vote_receipts_.emplace(context, std::move(vote_receipt)).second; + DCHECK(inserted); +} + +template <class VoteImpl> +void VotingChannelWrapper<VoteImpl>::ChangeVote(const ContextType* context, + const VoteImpl& new_vote) { + auto it = vote_receipts_.find(context); + DCHECK(it != vote_receipts_.end()); + it->second.ChangeVote(new_vote.value(), new_vote.reason()); +} + +template <class VoteImpl> +void VotingChannelWrapper<VoteImpl>::InvalidateVote( + const ContextType* context) { + size_t removed = vote_receipts_.erase(context); + DCHECK_EQ(removed, 1u); +} + } // namespace voting } // namespace performance_manager
diff --git a/components/performance_manager/test_support/voting.h b/components/performance_manager/test_support/voting.h index c232396..fa66f9d 100644 --- a/components/performance_manager/test_support/voting.h +++ b/components/performance_manager/test_support/voting.h
@@ -102,6 +102,9 @@ const ContextType* context) override; bool HasVote(voting::VoterId<VoteImpl> voter_id, + const typename VoteImpl::ContextType* context); + + bool HasVote(voting::VoterId<VoteImpl> voter_id, const typename VoteImpl::ContextType* context, typename VoteImpl::VoteType vote_value, const char* reason = nullptr); @@ -258,6 +261,16 @@ template <class VoteImpl> bool DummyVoteObserver<VoteImpl>::HasVote( voting::VoterId<VoteImpl> voter_id, + const typename VoteImpl::ContextType* context) { + if (!base::Contains(votes_by_voter_id_, voter_id)) + return false; + + return base::Contains(votes_by_voter_id_[voter_id], context); +} + +template <class VoteImpl> +bool DummyVoteObserver<VoteImpl>::HasVote( + voting::VoterId<VoteImpl> voter_id, const typename VoteImpl::ContextType* context, typename VoteImpl::VoteType vote_value, const char* reason) {
diff --git a/components/performance_manager/voting_unittest.cc b/components/performance_manager/voting_unittest.cc index fa6ec50..bbfd3786 100644 --- a/components/performance_manager/voting_unittest.cc +++ b/components/performance_manager/voting_unittest.cc
@@ -4,6 +4,7 @@ #include "components/performance_manager/public/voting/voting.h" +#include "base/test/gtest_util.h" #include "components/performance_manager/test_support/voting.h" #include "testing/gtest/include/gtest/gtest.h" @@ -21,6 +22,7 @@ using TestVotingChannelFactory = voting::VotingChannelFactory<TestVote>; using TestVoteConsumer = voting::VoteConsumer<TestVote>; using TestAcceptedVote = voting::AcceptedVote<TestVote>; +using TestVotingChannelWrapper = voting::VotingChannelWrapper<TestVote>; using DummyVoter = voting::test::DummyVoter<TestVote>; using DummyVoteConsumer = voting::test::DummyVoteConsumer<TestVote>; @@ -198,4 +200,80 @@ EXPECT_FALSE(observer.HasVote(voter_id, kDummyContext1, 5, kReason)); } +TEST(VotingTest, VotingChannelWrapper) { + DummyVoteObserver observer; + + TestVotingChannel voting_channel = + observer.vote_consumer_default_impl_.BuildVotingChannel(); + voting::VoterId<TestVote> voter_id = voting_channel.voter_id(); + + TestVotingChannelWrapper voting_channel_wrapper; + voting_channel_wrapper.SetVotingChannel(std::move(voting_channel)); + + EXPECT_FALSE(observer.HasVote(voter_id, kDummyContext1)); + + voting_channel_wrapper.SubmitVote(kDummyContext1, TestVote(5, kReason)); + EXPECT_TRUE(observer.HasVote(voter_id, kDummyContext1, 5, kReason)); + + voting_channel_wrapper.ChangeVote(kDummyContext1, TestVote(10, kReason)); + EXPECT_TRUE(observer.HasVote(voter_id, kDummyContext1, 10, kReason)); + + voting_channel_wrapper.InvalidateVote(kDummyContext1); + EXPECT_FALSE(observer.HasVote(voter_id, kDummyContext1)); +} + +// Tests that submitting 2 votes for the same context using a +// VotingChannelWrapper results in a DCHECK. +TEST(VotingTest, VotingChannelWrapper_SubmitDuplicateVote) { + DummyVoteObserver observer; + + TestVotingChannel voting_channel = + observer.vote_consumer_default_impl_.BuildVotingChannel(); + voting::VoterId<TestVote> voter_id = voting_channel.voter_id(); + + TestVotingChannelWrapper voting_channel_wrapper; + voting_channel_wrapper.SetVotingChannel(std::move(voting_channel)); + + EXPECT_FALSE(observer.HasVote(voter_id, kDummyContext1)); + + voting_channel_wrapper.SubmitVote(kDummyContext1, TestVote(5, kReason)); + EXPECT_TRUE(observer.HasVote(voter_id, kDummyContext1, 5, kReason)); + + EXPECT_DCHECK_DEATH( + voting_channel_wrapper.SubmitVote(kDummyContext1, TestVote(10, kReason))); +} + +// Tests that calling ChangeVote() for a context before a vote was submitted for +// that context results in a DCHECK. +TEST(VotingTest, VotingChannelWrapper_ChangeNonExisting) { + DummyVoteObserver observer; + + TestVotingChannel voting_channel = + observer.vote_consumer_default_impl_.BuildVotingChannel(); + voting::VoterId<TestVote> voter_id = voting_channel.voter_id(); + + TestVotingChannelWrapper voting_channel_wrapper; + voting_channel_wrapper.SetVotingChannel(std::move(voting_channel)); + + EXPECT_FALSE(observer.HasVote(voter_id, kDummyContext1)); + EXPECT_DCHECK_DEATH( + voting_channel_wrapper.ChangeVote(kDummyContext1, TestVote(5, kReason))); +} + +// Tests that calling InvalidateVote() for a context before a vote was submitted +// for that context results in a DCHECK. +TEST(VotingTest, VotingChannelWrapper_InvalidateNonExisting) { + DummyVoteObserver observer; + + TestVotingChannel voting_channel = + observer.vote_consumer_default_impl_.BuildVotingChannel(); + voting::VoterId<TestVote> voter_id = voting_channel.voter_id(); + + TestVotingChannelWrapper voting_channel_wrapper; + voting_channel_wrapper.SetVotingChannel(std::move(voting_channel)); + + EXPECT_FALSE(observer.HasVote(voter_id, kDummyContext1)); + EXPECT_DCHECK_DEATH(voting_channel_wrapper.InvalidateVote(kDummyContext1)); +} + } // namespace performance_manager
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index c625eac..6d75e25 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -1795,7 +1795,7 @@ 'id': 11, 'caption': '''Disable saving browser history''', 'tags': [], - 'desc': '''Setting the policy to Enabled means browsing history is not saved, tab syncing is off and, and users can't change this setting. + 'desc': '''Setting the policy to Enabled means browsing history is not saved, tab syncing is off and users can't change this setting. Setting the policy to Disabled or leaving it unset saves browsing history.''', },
diff --git a/components/profile_metrics/counts.cc b/components/profile_metrics/counts.cc index fc659667..b940e52 100644 --- a/components/profile_metrics/counts.cc +++ b/components/profile_metrics/counts.cc
@@ -26,6 +26,8 @@ counts.gaia_icon); UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfProfilesWithAuthErrors", counts.auth_errors); + UMA_HISTOGRAM_ENUMERATION("Profile.ColorsUniqueness", + counts.colors_uniqueness); } }
diff --git a/components/profile_metrics/counts.h b/components/profile_metrics/counts.h index 3fe5c56..37b996d5 100644 --- a/components/profile_metrics/counts.h +++ b/components/profile_metrics/counts.h
@@ -9,25 +9,27 @@ namespace profile_metrics { -struct Counts { - base::HistogramBase::Sample total; - base::HistogramBase::Sample signedin; - base::HistogramBase::Sample supervised; - base::HistogramBase::Sample active; - base::HistogramBase::Sample named; - base::HistogramBase::Sample unused; - base::HistogramBase::Sample gaia_icon; - base::HistogramBase::Sample auth_errors; +// These values are persisted to logs. Entries should not be renumbered and +// numeric values should never be reused. +enum class ProfileColorsUniqueness { + kSingleProfile = 0, + kUnique = 1, + kUniqueExceptForRepeatedDefault = 2, + kRepeated = 3, + kMaxValue = kRepeated, +}; - Counts() - : total(0), - signedin(0), - supervised(0), - active(0), - named(0), - unused(0), - gaia_icon(0), - auth_errors(0) {} +struct Counts { + base::HistogramBase::Sample total = 0; + base::HistogramBase::Sample signedin = 0; + base::HistogramBase::Sample supervised = 0; + base::HistogramBase::Sample active = 0; + base::HistogramBase::Sample named = 0; + base::HistogramBase::Sample unused = 0; + base::HistogramBase::Sample gaia_icon = 0; + base::HistogramBase::Sample auth_errors = 0; + ProfileColorsUniqueness colors_uniqueness = + ProfileColorsUniqueness::kRepeated; }; // Logs metrics related to |counts|.
diff --git a/components/signin/core/browser/chrome_connected_header_helper.cc b/components/signin/core/browser/chrome_connected_header_helper.cc index b208cf9f..d8acfa4 100644 --- a/components/signin/core/browser/chrome_connected_header_helper.cc +++ b/components/signin/core/browser/chrome_connected_header_helper.cc
@@ -156,18 +156,16 @@ bool ChromeConnectedHeaderHelper::IsUrlEligibleForRequestHeader( const GURL& url) { - // Only send the header on platforms where Mirror account consistency is - // enabled. - if (account_consistency_ != AccountConsistencyMethod::kMirror) - return false; + // Only set the header for Drive and Gaia always, and other Google properties + // if account consistency is enabled. Vasquette, which is integrated with most + // Google properties, needs the header to redirect certain user actions to + // Chrome native UI. Drive and Gaia need the header to tell if the current + // user is connected. // Consider the account ID sensitive and limit it to secure domains. if (!url.SchemeIsCryptographic()) return false; - // Vasquette, which is integrated with most Google properties, needs the - // header to redirect certain user actions to Chrome native UI. Drive and - // Gaia need the header to tell if the current user is connected. GURL origin(url.GetOrigin()); bool is_google_url = google_util::IsGoogleDomainUrl( @@ -175,7 +173,10 @@ google_util::DISALLOW_NON_STANDARD_PORTS) || google_util::IsYoutubeDomainUrl(url, google_util::ALLOW_SUBDOMAIN, google_util::DISALLOW_NON_STANDARD_PORTS); - return is_google_url || gaia::IsGaiaSignonRealm(origin); + bool is_mirror_enabled = + account_consistency_ == AccountConsistencyMethod::kMirror; + return (is_mirror_enabled && is_google_url) || IsDriveOrigin(origin) || + gaia::IsGaiaSignonRealm(origin); } std::string ChromeConnectedHeaderHelper::BuildRequestHeader(
diff --git a/components/signin/core/browser/signin_header_helper_unittest.cc b/components/signin/core/browser/signin_header_helper_unittest.cc index 6b6941a..d1c341de 100644 --- a/components/signin/core/browser/signin_header_helper_unittest.cc +++ b/components/signin/core/browser/signin_header_helper_unittest.cc
@@ -128,11 +128,14 @@ void CheckDiceHeaderRequest(const GURL& url, const std::string& account_id, const base::Optional<bool>& is_child_account, - const std::string& expected_request) { + const std::string& expected_mirror_request, + const std::string& expected_dice_request) { net::HttpRequestHeaders headers = CreateRequest(url, account_id, is_child_account); + CheckAccountConsistencyHeaderRequest(headers, kChromeConnectedHeader, + expected_mirror_request); CheckAccountConsistencyHeaderRequest(headers, kDiceRequestHeader, - expected_request); + expected_dice_request); } #endif @@ -150,37 +153,6 @@ scoped_refptr<content_settings::CookieSettings> cookie_settings_; }; -// Tests that no header is attached when account consistency is disabled. -TEST_F(SigninHeaderHelperTest, TestNoHeadersWhenAccountConsistencyDisabled) { - CheckMirrorHeaderRequest(GURL("https://accounts.google.com"), "", - /*is_child_account=*/base::nullopt, - /*expected_request=*/""); - CheckMirrorHeaderRequest(GURL("https://youtube.com"), "", - /*is_child_account=*/base::nullopt, - /*expected_request=*/""); - CheckMirrorHeaderRequest(GURL("https://youtube.com"), "", - /*is_child_account=*/base::nullopt, - /*expected_request=*/""); - - CheckMirrorCookieRequest(GURL("https://accounts.google.com"), "", - /*expected_request=*/""); - CheckMirrorCookieRequest(GURL("https://google.com"), "", - /*expected_request=*/""); - CheckMirrorCookieRequest(GURL("https://youtube.com"), "", - /*expected_request=*/""); -#if BUILDFLAG(ENABLE_DICE_SUPPORT) - CheckDiceHeaderRequest(GURL("https://accounts.google.com"), "", - /*is_child_account=*/base::nullopt, - /*expected_request=*/""); - CheckDiceHeaderRequest(GURL("https://google.com"), "", - /*is_child_account=*/base::nullopt, - /*expected_request=*/""); - CheckDiceHeaderRequest(GURL("https://youtube.com"), "", - /*is_child_account=*/base::nullopt, - /*expected_request=*/""); -#endif -} - #if defined(OS_CHROMEOS) // Tests that Mirror request is returned on Chrome OS for Public Sessions (no // account id). @@ -195,18 +167,6 @@ "consistency_enabled_by_default=false"); } #else // !defined(OS_CHROMEOS) -// Tests that no Mirror request is returned when the user is not signed in (no -// account id), for non Chrome OS platforms. -TEST_F(SigninHeaderHelperTest, TestNoMirrorRequestNoAccountId) { - account_consistency_ = AccountConsistencyMethod::kMirror; - CheckMirrorHeaderRequest(GURL("https://docs.google.com"), "", - /*is_child_account=*/base::nullopt, - /*expected_header=*/""); - CheckMirrorCookieRequest(GURL("https://docs.google.com"), "", - /*expected_header=*/""); -} -#endif - #if defined(OS_ANDROID) || defined(OS_IOS) // Tests that eligible_for_consistency request is returned on mobile (Android, // iOS) when reaching to Gaia origin and there's no primary account. Only @@ -232,17 +192,9 @@ feature_list.InitAndEnableFeature(kMobileIdentityConsistency); account_consistency_ = AccountConsistencyMethod::kMirror; - CheckMirrorHeaderRequest(GURL("https://google.com"), "", - /*is_child_account=*/base::nullopt, - /*expected_request=*/""); - CheckMirrorCookieRequest(GURL("https://google.com"), "", - /*expected_request=*/""); - - CheckMirrorHeaderRequest(GURL("https://youtube.com"), "", - /*is_child_account=*/base::nullopt, - /*expected_request=*/""); - CheckMirrorCookieRequest(GURL("https://youtube.com"), "", - /*expected_request=*/""); + CheckMirrorHeaderRequest(GURL("https://docs.google.com"), "", + /*is_child_account=*/base::nullopt, ""); + CheckMirrorCookieRequest(GURL("https://docs.google.com"), "", ""); } // Tests that the full Mirror request is returned when the @@ -254,22 +206,30 @@ account_consistency_ = AccountConsistencyMethod::kMirror; force_account_consistency_ = true; CheckMirrorHeaderRequest( - GURL("https://google.com"), "", /*is_child_account=*/base::nullopt, + GURL("https://docs.google.com"), "", /*is_child_account=*/base::nullopt, "source=TestSource,mode=0,enable_account_consistency=true," "consistency_enabled_by_default=false"); } #endif // defined(OS_ANDROID) || defined(OS_IOS) +// Tests that no Mirror request is returned when the user is not signed in (no +// account id), for non Chrome OS platforms. +TEST_F(SigninHeaderHelperTest, TestNoMirrorRequestNoAccountId) { + account_consistency_ = AccountConsistencyMethod::kMirror; + CheckMirrorHeaderRequest(GURL("https://docs.google.com"), "", + /*is_child_account=*/base::nullopt, ""); + CheckMirrorCookieRequest(GURL("https://docs.google.com"), "", ""); +} +#endif + // Tests that no Mirror request is returned when the cookies aren't allowed to // be set. TEST_F(SigninHeaderHelperTest, TestNoMirrorRequestCookieSettingBlocked) { account_consistency_ = AccountConsistencyMethod::kMirror; cookie_settings_->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK); - CheckMirrorHeaderRequest(GURL("https://google.com"), "0123456789", - /*is_child_account=*/base::nullopt, - /*expected_header=*/""); - CheckMirrorCookieRequest(GURL("https://google.com"), "0123456789", - /*expected_header=*/""); + CheckMirrorHeaderRequest(GURL("https://docs.google.com"), "0123456789", + /*is_child_account=*/base::nullopt, ""); + CheckMirrorCookieRequest(GURL("https://docs.google.com"), "0123456789", ""); } // Tests that no Mirror request is returned when the target is a non-Google URL. @@ -359,62 +319,68 @@ "supervised=false,consistency_enabled_by_default=false"); } -// Tests that the Mirror request is returned with the GAIA Id on Drive origin -TEST_F(SigninHeaderHelperTest, TestMirrorRequestDrive) { - // Enable Account Consistency will override the disable. - account_consistency_ = AccountConsistencyMethod::kMirror; - CheckMirrorHeaderRequest( - GURL("https://docs.google.com/document"), "0123456789", - /*is_child_account=*/base::nullopt, - "source=TestSource,id=0123456789,mode=0,enable_account_consistency=true," - "consistency_enabled_by_default=false"); - CheckMirrorCookieRequest( - GURL("https://drive.google.com/drive"), "0123456789", - "id=0123456789:mode=0:enable_account_consistency=true:" - "consistency_enabled_by_default=false"); -} - // Mirror is always enabled on Android and iOS, so these tests are only relevant // on Desktop. #if BUILDFLAG(ENABLE_DICE_SUPPORT) +// Tests that the Mirror request is returned when the target is a Gaia URL, even +// if account consistency is disabled. +TEST_F(SigninHeaderHelperTest, TestMirrorRequestGaiaURL) { + CheckMirrorHeaderRequest( + GURL("https://accounts.google.com"), "0123456789", + /*is_child_account=*/base::nullopt, + "source=TestSource,mode=0,enable_account_consistency=false," + "consistency_enabled_by_default=false"); + CheckMirrorCookieRequest( + GURL("https://accounts.google.com"), "0123456789", + "id=0123456789:mode=0:enable_account_consistency=false:" + "consistency_enabled_by_default=false"); +} + // Tests Dice requests. TEST_F(SigninHeaderHelperTest, TestDiceRequest) { account_consistency_ = AccountConsistencyMethod::kDice; - // No Dice header on non-Gaia URLs. - CheckDiceHeaderRequest(GURL("https://google.com"), "0123456789", - /*is_child_account=*/base::nullopt, - /*expected_request=*/""); + // ChromeConnected but no Dice for Docs URLs. + CheckDiceHeaderRequest( + GURL("https://docs.google.com"), "0123456789", + /*is_child_account=*/base::nullopt, + "source=TestSource,id=0123456789,mode=0,enable_account_consistency=false," + "consistency_enabled_by_default=false", + ""); + // ChromeConnected and Dice for Gaia URLs. // Sync disabled. std::string client_id = GaiaUrls::GetInstance()->oauth2_chrome_client_id(); ASSERT_FALSE(client_id.empty()); CheckDiceHeaderRequest( GURL("https://accounts.google.com"), "0123456789", /*is_child_account=*/base::nullopt, + "source=TestSource,mode=0,enable_account_consistency=false," + "consistency_enabled_by_default=false", base::StringPrintf( "version=%s,client_id=%s,device_id=DeviceID,signin_mode=all_accounts," "signout_mode=show_confirmation", kDiceProtocolVersion, client_id.c_str())); - - // Sync enabled: check that the Dice header has the Sync account ID. + // Sync enabled: check that the Dice header has the Sync account ID and that + // the mirror header is not modified. sync_enabled_ = true; CheckDiceHeaderRequest( GURL("https://accounts.google.com"), "0123456789", /*is_child_account=*/base::nullopt, + "source=TestSource,mode=0,enable_account_consistency=false," + "consistency_enabled_by_default=false", base::StringPrintf("version=%s,client_id=%s,device_id=DeviceID," "sync_account_id=0123456789,signin_mode=all_accounts," "signout_mode=show_confirmation", kDiceProtocolVersion, client_id.c_str())); sync_enabled_ = false; - // No Dice for other URLs. + // No ChromeConnected and no Dice for other URLs. CheckDiceHeaderRequest(GURL("https://www.google.com"), "0123456789", - /*is_child_account=*/base::nullopt, - /*expected_request=*/""); + /*is_child_account=*/base::nullopt, "", ""); } -// Send the Dice header even when cookies are blocked. +// When cookies are blocked, only the Dice header is sent. TEST_F(SigninHeaderHelperTest, DiceCookiesBlocked) { account_consistency_ = AccountConsistencyMethod::kDice; cookie_settings_->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK); @@ -423,7 +389,7 @@ ASSERT_FALSE(client_id.empty()); CheckDiceHeaderRequest( GURL("https://accounts.google.com"), "0123456789", - /*is_child_account=*/base::nullopt, + /*is_child_account=*/base::nullopt, "", base::StringPrintf( "version=%s,client_id=%s,device_id=DeviceID,signin_mode=all_accounts," "signout_mode=show_confirmation", @@ -432,15 +398,13 @@ // Tests that no Dice request is returned when Dice is not enabled. TEST_F(SigninHeaderHelperTest, TestNoDiceRequestWhenDisabled) { - account_consistency_ = AccountConsistencyMethod::kDisabled; - CheckDiceHeaderRequest(GURL("https://accounts.google.com"), "0123456789", - /*is_child_account=*/base::nullopt, - /*expected_request=*/""); - account_consistency_ = AccountConsistencyMethod::kMirror; - CheckDiceHeaderRequest(GURL("https://accounts.google.com"), "0123456789", - /*is_child_account=*/base::nullopt, - /*expected_request=*/""); + CheckDiceHeaderRequest( + GURL("https://accounts.google.com"), "0123456789", + /*is_child_account=*/base::nullopt, + "source=TestSource,mode=0,enable_account_consistency=true," + "consistency_enabled_by_default=false", + ""); } TEST_F(SigninHeaderHelperTest, TestDiceEmptyDeviceID) { @@ -453,6 +417,8 @@ CheckDiceHeaderRequest( GURL("https://accounts.google.com"), "0123456789", /*is_child_account=*/base::nullopt, + "source=TestSource,mode=0,enable_account_consistency=false," + "consistency_enabled_by_default=false", base::StringPrintf("version=%s,client_id=%s,signin_mode=all_accounts," "signout_mode=show_confirmation", kDiceProtocolVersion, client_id.c_str())); @@ -467,12 +433,40 @@ CheckDiceHeaderRequest( GURL("https://accounts.google.com"), "0123456789", /*is_child_account=*/base::nullopt, + "source=TestSource,mode=0,enable_account_consistency=false," + "consistency_enabled_by_default=false", base::StringPrintf( "version=%s,client_id=%s,device_id=DeviceID,signin_mode=all_accounts," "signout_mode=show_confirmation", kDiceProtocolVersion, client_id.c_str())); } +// Tests that the Mirror request is returned with the GAIA Id on Drive origin, +// even if account consistency is disabled. +TEST_F(SigninHeaderHelperTest, TestMirrorRequestDrive) { + CheckMirrorHeaderRequest( + GURL("https://docs.google.com/document"), "0123456789", + /*is_child_account=*/base::nullopt, + "source=TestSource,id=0123456789,mode=0,enable_account_consistency=false," + "consistency_enabled_by_default=false"); + CheckMirrorCookieRequest( + GURL("https://drive.google.com/drive"), "0123456789", + "id=0123456789:mode=0:enable_account_consistency=false:" + "consistency_enabled_by_default=false"); + + // Enable Account Consistency will override the disable. + account_consistency_ = AccountConsistencyMethod::kMirror; + CheckMirrorHeaderRequest( + GURL("https://docs.google.com/document"), "0123456789", + /*is_child_account=*/base::nullopt, + "source=TestSource,id=0123456789,mode=0,enable_account_consistency=true," + "consistency_enabled_by_default=false"); + CheckMirrorCookieRequest( + GURL("https://drive.google.com/drive"), "0123456789", + "id=0123456789:mode=0:enable_account_consistency=true:" + "consistency_enabled_by_default=false"); +} + TEST_F(SigninHeaderHelperTest, TestDiceInvalidResponseParams) { DiceResponseParams params = BuildDiceSigninResponseParams("blah"); EXPECT_EQ(DiceAction::NONE, params.user_intention);
diff --git a/components/signin/internal/identity_manager/account_tracker_service.cc b/components/signin/internal/identity_manager/account_tracker_service.cc index a31e0bea..3083c0e 100644 --- a/components/signin/internal/identity_manager/account_tracker_service.cc +++ b/components/signin/internal/identity_manager/account_tracker_service.cc
@@ -186,15 +186,6 @@ return AccountInfo(); } -// static -bool AccountTrackerService::IsMigrationSupported() { -#if defined(OS_CHROMEOS) - return base::FeatureList::IsEnabled(switches::kAccountIdMigration); -#else - return true; -#endif -} - AccountTrackerService::AccountIdMigrationState AccountTrackerService::GetMigrationState() const { return GetMigrationState(pref_service_); @@ -366,10 +357,7 @@ } } -bool AccountTrackerService::IsMigrationDone() const { - if (!IsMigrationSupported()) - return false; - +bool AccountTrackerService::AreAllAccountsMigrated() const { for (const auto& pair : accounts_) { if (pair.first.ToString() != pair.second.gaia) return false; @@ -380,9 +368,21 @@ AccountTrackerService::AccountIdMigrationState AccountTrackerService::ComputeNewMigrationState() const { - // If migration is not supported, skip migration. - if (!IsMigrationSupported()) + if (accounts_.empty()) { + // If there are no accounts in the account tracker service, then we expect + // that this is profile that was never signed in to Chrome. Consider the + // migration done as there are no accounts to migrate.. + return MIGRATION_DONE; + } + +#if defined(OS_CHROMEOS) + // Migration on ChromeOS is not started by default due to the following risks: + // * a lot more data than on desktop is keyed by the account id + // * bugs in the migration flow can lead to user not being able to sign in + // to their device which makes the device unusable. + if (!base::FeatureList::IsEnabled(switches::kAccountIdMigration)) return MIGRATION_NOT_STARTED; +#endif bool migration_required = false; for (const auto& pair : accounts_) { @@ -399,7 +399,7 @@ } void AccountTrackerService::SetMigrationState(AccountIdMigrationState state) { - DCHECK(state != MIGRATION_DONE || IsMigrationDone()); + DCHECK(state != MIGRATION_DONE || AreAllAccountsMigrated()); pref_service_->SetInteger(prefs::kAccountIdMigrationState, state); } @@ -554,24 +554,16 @@ RemoveAccountImageFromDisk(account_id); } - if (IsMigrationSupported()) { - if (GetMigrationState() != MIGRATION_DONE) { - const AccountIdMigrationState new_state = ComputeNewMigrationState(); - SetMigrationState(new_state); + if (GetMigrationState() != MIGRATION_DONE) { + const AccountIdMigrationState new_state = ComputeNewMigrationState(); + SetMigrationState(new_state); - if (new_state == MIGRATION_IN_PROGRESS) { - MigrateToGaiaId(); - } + if (new_state == MIGRATION_IN_PROGRESS) { + MigrateToGaiaId(); } - } else { - // ChromeOS running on Linux and Linux share the preferences, so the - // migration may have been performed on Linux. Reset the migration - // state to ensure that the same code path is used whether ChromeOS - // is running on Linux on a dev build or on real ChromeOS device. - SetMigrationState(MIGRATION_NOT_STARTED); } - DCHECK(GetMigrationState() != MIGRATION_DONE || IsMigrationDone()); + DCHECK(GetMigrationState() != MIGRATION_DONE || AreAllAccountsMigrated()); UMA_HISTOGRAM_ENUMERATION("Signin.AccountTracker.GaiaIdMigrationState", GetMigrationState(), NUM_MIGRATION_STATES);
diff --git a/components/signin/internal/identity_manager/account_tracker_service.h b/components/signin/internal/identity_manager/account_tracker_service.h index e6f2910..fb5846c 100644 --- a/components/signin/internal/identity_manager/account_tracker_service.h +++ b/components/signin/internal/identity_manager/account_tracker_service.h
@@ -121,10 +121,6 @@ void RemoveAccount(const CoreAccountId& account_id); - // Is migration of the account id from normalized email to gaia id supported - // on the current platform? - static bool IsMigrationSupported(); - AccountIdMigrationState GetMigrationState() const; void SetMigrationDone(); @@ -213,7 +209,7 @@ // Returns whether the accounts are all keyed by gaia id. This should // be the case when the migration state is set to MIGRATION_DONE. - bool IsMigrationDone() const; + bool AreAllAccountsMigrated() const; // Computes the new migration state. The state is saved to preference // before performing the migration in order to support resuming the
diff --git a/components/signin/internal/identity_manager/account_tracker_service_unittest.cc b/components/signin/internal/identity_manager/account_tracker_service_unittest.cc index 9de5ed5..d12619a2 100644 --- a/components/signin/internal/identity_manager/account_tracker_service_unittest.cc +++ b/components/signin/internal/identity_manager/account_tracker_service_unittest.cc
@@ -11,6 +11,7 @@ #include "base/files/scoped_temp_dir.h" #include "base/strings/stringprintf.h" #include "base/test/metrics/histogram_tester.h" +#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "build/build_config.h" #include "components/image_fetcher/core/fake_image_decoder.h" @@ -23,6 +24,7 @@ #include "components/signin/internal/identity_manager/fake_profile_oauth2_token_service.h" #include "components/signin/public/base/avatar_icon_util.h" #include "components/signin/public/base/signin_pref_names.h" +#include "components/signin/public/base/signin_switches.h" #include "components/signin/public/base/test_signin_client.h" #include "components/signin/public/identity_manager/account_info.h" #include "google_apis/gaia/gaia_oauth_client.h" @@ -698,6 +700,11 @@ } TEST_F(AccountTrackerServiceTest, Persistence) { +#if defined(OS_CHROMEOS) + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature(switches::kAccountIdMigration); +#endif + // Define a user data directory for the account image storage. base::ScopedTempDir scoped_user_data_dir; ASSERT_TRUE(scoped_user_data_dir.CreateUniqueTempDir()); @@ -854,6 +861,11 @@ } TEST_F(AccountTrackerServiceTest, UpgradeToFullAccountInfo) { +#if defined(OS_CHROMEOS) + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature(switches::kAccountIdMigration); +#endif + // Start by simulating an incomplete account info and let it be saved to // prefs. ResetAccountTracker(); @@ -981,8 +993,10 @@ } TEST_F(AccountTrackerServiceTest, MigrateAccountIdToGaiaId) { - if (!AccountTrackerService::IsMigrationSupported()) - return; +#if defined(OS_CHROMEOS) + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature(switches::kAccountIdMigration); +#endif const std::string email_alpha = AccountKeyToEmail(kAccountKeyAlpha); const std::string gaia_alpha = AccountKeyToGaiaId(kAccountKeyAlpha); @@ -1028,8 +1042,10 @@ } TEST_F(AccountTrackerServiceTest, CanNotMigrateAccountIdToGaiaId) { - if (!AccountTrackerService::IsMigrationSupported()) - return; +#if defined(OS_CHROMEOS) + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature(switches::kAccountIdMigration); +#endif const std::string email_alpha = AccountKeyToEmail(kAccountKeyAlpha); const std::string gaia_alpha = AccountKeyToGaiaId(kAccountKeyAlpha); @@ -1074,8 +1090,10 @@ } TEST_F(AccountTrackerServiceTest, GaiaIdMigrationCrashInTheMiddle) { - if (!AccountTrackerService::IsMigrationSupported()) - return; +#if defined(OS_CHROMEOS) + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature(switches::kAccountIdMigration); +#endif const std::string email_alpha = AccountKeyToEmail(kAccountKeyAlpha); const std::string gaia_alpha = AccountKeyToGaiaId(kAccountKeyAlpha);
diff --git a/components/signin/internal/identity_manager/primary_account_manager.cc b/components/signin/internal/identity_manager/primary_account_manager.cc index 8f5528f..ef0bad6d 100644 --- a/components/signin/internal/identity_manager/primary_account_manager.cc +++ b/components/signin/internal/identity_manager/primary_account_manager.cc
@@ -391,7 +391,6 @@ observer.GoogleSignedOut(account_info); } -#if !defined(OS_CHROMEOS) void PrimaryAccountManager::OnRefreshTokensLoaded() { token_service_->RemoveObserver(this); @@ -415,4 +414,3 @@ } } } -#endif // !defined(OS_CHROMEOS)
diff --git a/components/signin/internal/identity_manager/primary_account_manager.h b/components/signin/internal/identity_manager/primary_account_manager.h index 43ece97..8bb524c 100644 --- a/components/signin/internal/identity_manager/primary_account_manager.h +++ b/components/signin/internal/identity_manager/primary_account_manager.h
@@ -193,10 +193,8 @@ bool assert_signout_allowed, SigninClient::SignoutDecision signout_decision); -#if !defined(OS_CHROMEOS) // ProfileOAuth2TokenServiceObserver: void OnRefreshTokensLoaded() override; -#endif const CoreAccountInfo& primary_account_info() const { return primary_account_info_;
diff --git a/components/signin/internal/identity_manager/primary_account_manager_unittest.cc b/components/signin/internal/identity_manager/primary_account_manager_unittest.cc index a5d92f8..c2af6ef 100644 --- a/components/signin/internal/identity_manager/primary_account_manager_unittest.cc +++ b/components/signin/internal/identity_manager/primary_account_manager_unittest.cc
@@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/run_loop.h" +#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "build/build_config.h" #include "components/image_fetcher/core/fake_image_decoder.h" @@ -24,6 +25,7 @@ #include "components/signin/internal/identity_manager/profile_oauth2_token_service.h" #include "components/signin/public/base/account_consistency_method.h" #include "components/signin/public/base/signin_pref_names.h" +#include "components/signin/public/base/signin_switches.h" #include "components/signin/public/base/test_signin_client.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "testing/gtest/include/gtest/gtest.h" @@ -359,64 +361,72 @@ #endif TEST_F(PrimaryAccountManagerTest, GaiaIdMigration) { - if (account_tracker()->GetMigrationState() != - AccountTrackerService::MIGRATION_NOT_STARTED) { - std::string email = "user@gmail.com"; - std::string gaia_id = "account_gaia_id"; +#if defined(OS_CHROMEOS) + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature(switches::kAccountIdMigration); +#endif - PrefService* client_prefs = signin_client()->GetPrefs(); - client_prefs->SetInteger(prefs::kAccountIdMigrationState, - AccountTrackerService::MIGRATION_NOT_STARTED); - ListPrefUpdate update(client_prefs, prefs::kAccountInfo); - update->Clear(); - auto dict = std::make_unique<base::DictionaryValue>(); - dict->SetString("account_id", email); - dict->SetString("email", email); - dict->SetString("gaia", gaia_id); - update->Append(std::move(dict)); + ASSERT_EQ(AccountTrackerService::MIGRATION_DONE, + account_tracker()->GetMigrationState()); + std::string email = "user@gmail.com"; + std::string gaia_id = "account_gaia_id"; - account_tracker()->Shutdown(); - account_tracker()->Initialize(prefs(), base::FilePath()); + PrefService* client_prefs = signin_client()->GetPrefs(); + client_prefs->SetInteger(prefs::kAccountIdMigrationState, + AccountTrackerService::MIGRATION_NOT_STARTED); + ListPrefUpdate update(client_prefs, prefs::kAccountInfo); + update->Clear(); + auto dict = std::make_unique<base::DictionaryValue>(); + dict->SetString("account_id", email); + dict->SetString("email", email); + dict->SetString("gaia", gaia_id); + update->Append(std::move(dict)); - client_prefs->SetString(prefs::kGoogleServicesAccountId, email); + account_tracker()->Shutdown(); + account_tracker()->Initialize(prefs(), base::FilePath()); - CreatePrimaryAccountManager(); + client_prefs->SetString(prefs::kGoogleServicesAccountId, email); - EXPECT_EQ(CoreAccountId(gaia_id), manager_->GetAuthenticatedAccountId()); - EXPECT_EQ(gaia_id, user_prefs_.GetString(prefs::kGoogleServicesAccountId)); - } + CreatePrimaryAccountManager(); + + EXPECT_EQ(CoreAccountId(gaia_id), manager_->GetAuthenticatedAccountId()); + EXPECT_EQ(gaia_id, user_prefs_.GetString(prefs::kGoogleServicesAccountId)); } TEST_F(PrimaryAccountManagerTest, GaiaIdMigrationCrashInTheMiddle) { - if (account_tracker()->GetMigrationState() != - AccountTrackerService::MIGRATION_NOT_STARTED) { - std::string email = "user@gmail.com"; - std::string gaia_id = "account_gaia_id"; +#if defined(OS_CHROMEOS) + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature(switches::kAccountIdMigration); +#endif - PrefService* client_prefs = signin_client()->GetPrefs(); - client_prefs->SetInteger(prefs::kAccountIdMigrationState, - AccountTrackerService::MIGRATION_NOT_STARTED); - ListPrefUpdate update(client_prefs, prefs::kAccountInfo); - update->Clear(); - auto dict = std::make_unique<base::DictionaryValue>(); - dict->SetString("account_id", email); - dict->SetString("email", email); - dict->SetString("gaia", gaia_id); - update->Append(std::move(dict)); + ASSERT_EQ(AccountTrackerService::MIGRATION_DONE, + account_tracker()->GetMigrationState()); + std::string email = "user@gmail.com"; + std::string gaia_id = "account_gaia_id"; - account_tracker()->Shutdown(); - account_tracker()->Initialize(prefs(), base::FilePath()); + PrefService* client_prefs = signin_client()->GetPrefs(); + client_prefs->SetInteger(prefs::kAccountIdMigrationState, + AccountTrackerService::MIGRATION_NOT_STARTED); + ListPrefUpdate update(client_prefs, prefs::kAccountInfo); + update->Clear(); + auto dict = std::make_unique<base::DictionaryValue>(); + dict->SetString("account_id", email); + dict->SetString("email", email); + dict->SetString("gaia", gaia_id); + update->Append(std::move(dict)); - client_prefs->SetString(prefs::kGoogleServicesAccountId, gaia_id); + account_tracker()->Shutdown(); + account_tracker()->Initialize(prefs(), base::FilePath()); - CreatePrimaryAccountManager(); - EXPECT_EQ(CoreAccountId(gaia_id), manager_->GetAuthenticatedAccountId()); - EXPECT_EQ(gaia_id, user_prefs_.GetString(prefs::kGoogleServicesAccountId)); + client_prefs->SetString(prefs::kGoogleServicesAccountId, gaia_id); - base::RunLoop().RunUntilIdle(); - EXPECT_EQ(AccountTrackerService::MIGRATION_DONE, - account_tracker()->GetMigrationState()); - } + CreatePrimaryAccountManager(); + EXPECT_EQ(CoreAccountId(gaia_id), manager_->GetAuthenticatedAccountId()); + EXPECT_EQ(gaia_id, user_prefs_.GetString(prefs::kGoogleServicesAccountId)); + + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(AccountTrackerService::MIGRATION_DONE, + account_tracker()->GetMigrationState()); } TEST_F(PrimaryAccountManagerTest, RestoreFromPrefsConsented) {
diff --git a/components/signin/public/identity_manager/identity_manager_unittest.cc b/components/signin/public/identity_manager/identity_manager_unittest.cc index 34bb307..5651763 100644 --- a/components/signin/public/identity_manager/identity_manager_unittest.cc +++ b/components/signin/public/identity_manager/identity_manager_unittest.cc
@@ -2206,15 +2206,8 @@ } TEST_F(IdentityManagerTest, AccountIdMigration_DoneOnInitialization) { - // Migration gets marked as DONE while initializing the AccountTrackerService - // on platforms supporting account ID migration only. - if (account_tracker()->IsMigrationSupported()) { - EXPECT_EQ(identity_manager()->GetAccountIdMigrationState(), - IdentityManager::AccountIdMigrationState::MIGRATION_DONE); - } else { - EXPECT_EQ(identity_manager()->GetAccountIdMigrationState(), - IdentityManager::AccountIdMigrationState::MIGRATION_NOT_STARTED); - } + EXPECT_EQ(IdentityManager::AccountIdMigrationState::MIGRATION_DONE, + identity_manager()->GetAccountIdMigrationState()); } // Checks that IdentityManager::Observer gets OnAccountUpdated when account info
diff --git a/components/suggestions/OWNERS b/components/suggestions/OWNERS index 28c1796..e3a7435 100644 --- a/components/suggestions/OWNERS +++ b/components/suggestions/OWNERS
@@ -1,4 +1,5 @@ -mathp@chromium.org +mahmadi@chromium.org +tiborg@chromium.org treib@chromium.org # TEAM: ntp-dev@chromium.org
diff --git a/components/sync/driver/profile_sync_service_unittest.cc b/components/sync/driver/profile_sync_service_unittest.cc index d8aa0325e..81da21a 100644 --- a/components/sync/driver/profile_sync_service_unittest.cc +++ b/components/sync/driver/profile_sync_service_unittest.cc
@@ -358,7 +358,7 @@ // Verify that the server URLs are sane. TEST_F(ProfileSyncServiceTest, InitialState) { - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); InitializeForNthSync(); const std::string& url = service()->GetSyncServiceUrlForDebugging().spec(); EXPECT_TRUE(url == internal::kSyncServerUrl || @@ -367,7 +367,7 @@ TEST_F(ProfileSyncServiceTest, SuccessfulInitialization) { SignIn(); - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); EXPECT_CALL(*component_factory(), CreateSyncEngine(_, _, _, _)) .WillOnce(ReturnNewFakeSyncEngine()); EXPECT_CALL(*component_factory(), CreateDataTypeManager(_, _, _, _, _, _)) @@ -427,8 +427,8 @@ } TEST_F(ProfileSyncServiceTest, ModelTypesForTransportMode) { - CreateService(ProfileSyncService::AUTO_START); SignIn(); + CreateService(ProfileSyncService::MANUAL_START); InitializeForNthSync(); // Disable sync-the-feature. @@ -450,7 +450,7 @@ // Verify that the SetSetupInProgress function call updates state // and notifies observers. TEST_F(ProfileSyncServiceTest, SetupInProgress) { - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); InitializeForFirstSync(); TestSyncServiceObserver observer; @@ -473,7 +473,7 @@ policy::PolicyServiceImpl::Providers()); SignIn(); - CreateService(ProfileSyncService::AUTO_START, policy_service.get()); + CreateService(ProfileSyncService::MANUAL_START, policy_service.get()); EXPECT_CALL(*component_factory(), CreateSyncEngine(_, _, _, _)) .WillOnce(ReturnNewFakeSyncEngine()); EXPECT_CALL(*component_factory(), CreateDataTypeManager(_, _, _, _, _, _)) @@ -500,7 +500,7 @@ prefs()->SetManagedPref(prefs::kSyncManaged, std::make_unique<base::Value>(true)); SignIn(); - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); InitializeForNthSync(); EXPECT_EQ(SyncService::DisableReasonSet( SyncService::DISABLE_REASON_ENTERPRISE_POLICY), @@ -514,7 +514,7 @@ TEST_F(ProfileSyncServiceTest, DisabledByPolicyBeforeInitThenPolicyRemoved) { prefs()->SetManagedPref(prefs::kSyncManaged, std::make_unique<base::Value>(true)); - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); InitializeForNthSync(); EXPECT_EQ(SyncService::DisableReasonSet( SyncService::DISABLE_REASON_ENTERPRISE_POLICY, @@ -546,7 +546,7 @@ // been initialized. TEST_F(ProfileSyncServiceTest, DisabledByPolicyAfterInit) { SignIn(); - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); InitializeForNthSync(); ASSERT_EQ(SyncService::DisableReasonSet(), service()->GetDisableReasons()); @@ -566,11 +566,11 @@ // Exercises the ProfileSyncService's code paths related to getting shut down // before the backend initialize call returns. TEST_F(ProfileSyncServiceTest, AbortedByShutdown) { - CreateService(ProfileSyncService::AUTO_START); + SignIn(); + CreateService(ProfileSyncService::MANUAL_START); ON_CALL(*component_factory(), CreateSyncEngine(_, _, _, _)) .WillByDefault(ReturnNewFakeSyncEngineNoReturn()); - SignIn(); InitializeForNthSync(); ASSERT_EQ(SyncService::TransportState::INITIALIZING, service()->GetTransportState()); @@ -580,11 +580,11 @@ // Test SetSyncRequested(false) before we've initialized the backend. TEST_F(ProfileSyncServiceTest, EarlyRequestStop) { - CreateService(ProfileSyncService::AUTO_START); + SignIn(); + CreateService(ProfileSyncService::MANUAL_START); // Set up a fake sync engine that will not immediately finish initialization. EXPECT_CALL(*component_factory(), CreateSyncEngine(_, _, _, _)) .WillOnce(ReturnNewFakeSyncEngineNoReturn()); - SignIn(); InitializeForNthSync(); ASSERT_EQ(SyncService::TransportState::INITIALIZING, @@ -614,8 +614,8 @@ // Test SetSyncRequested(false) after we've initialized the backend. TEST_F(ProfileSyncServiceTest, DisableAndEnableSyncTemporarily) { - CreateService(ProfileSyncService::AUTO_START); SignIn(); + CreateService(ProfileSyncService::MANUAL_START); InitializeForNthSync(); SyncPrefs sync_prefs(prefs()); @@ -653,8 +653,8 @@ #if !defined(OS_CHROMEOS) TEST_F(ProfileSyncServiceTest, SignOutDisablesSyncTransportAndSyncFeature) { // Sign-in and enable sync. - CreateService(ProfileSyncService::AUTO_START); SignIn(); + CreateService(ProfileSyncService::MANUAL_START); InitializeForNthSync(); ASSERT_EQ(SyncService::DisableReasonSet(), service()->GetDisableReasons()); ASSERT_EQ(SyncService::TransportState::ACTIVE, @@ -679,8 +679,8 @@ TEST_F(ProfileSyncServiceTest, SignOutClearsSyncTransportDataAndSyncTheFeaturePrefs) { // Sign-in and enable sync. - CreateService(ProfileSyncService::AUTO_START); SignIn(); + CreateService(ProfileSyncService::MANUAL_START); InitializeForNthSync(); ASSERT_TRUE(service()->GetUserSettings()->IsFirstSetupComplete()); ASSERT_TRUE(service()->GetUserSettings()->IsSyncRequested()); @@ -704,8 +704,8 @@ TEST_F(ProfileSyncServiceTest, IdentityProvider_GetActiveAccountId) { // Sign-in and enable sync. - CreateService(ProfileSyncService::AUTO_START); SignIn(); + CreateService(ProfileSyncService::MANUAL_START); InitializeForNthSync(); EXPECT_EQ(identity_manager()->GetPrimaryAccountId(), identity_provider()->GetActiveAccountId()); @@ -731,9 +731,8 @@ #endif // !defined(OS_CHROMEOS) TEST_F(ProfileSyncServiceTest, GetSyncTokenStatus) { - CreateService(ProfileSyncService::AUTO_START); - SignIn(); + CreateService(ProfileSyncService::MANUAL_START); InitializeForNthSync(); // Initial status. @@ -781,8 +780,8 @@ TEST_F(ProfileSyncServiceTest, RevokeAccessTokenFromTokenService) { CoreAccountId init_account_id; - CreateService(ProfileSyncService::AUTO_START); SignIn(); + CreateService(ProfileSyncService::MANUAL_START); EXPECT_CALL(*component_factory(), CreateSyncEngine(_, _, _, _)) .WillOnce( Return(ByMove(std::make_unique<FakeSyncEngineCollectCredentials>( @@ -824,8 +823,8 @@ CoreAccountId init_account_id; - CreateService(ProfileSyncService::AUTO_START); SignIn(); + CreateService(ProfileSyncService::MANUAL_START); EXPECT_CALL(*component_factory(), CreateSyncEngine(_, _, _, _)) .WillOnce( Return(ByMove(std::make_unique<FakeSyncEngineCollectCredentials>( @@ -888,8 +887,8 @@ base::BindRepeating([](bool* called) { *called = true; }, base::Unretained(&invalidate_credentials_called)); - CreateService(ProfileSyncService::AUTO_START); SignIn(); + CreateService(ProfileSyncService::MANUAL_START); EXPECT_CALL(*component_factory(), CreateSyncEngine(_, _, _, _)) .WillOnce( Return(ByMove(std::make_unique<FakeSyncEngineCollectCredentials>( @@ -946,8 +945,8 @@ TEST_F(ProfileSyncServiceTest, SignOutRevokeAccessToken) { CoreAccountId init_account_id; - CreateService(ProfileSyncService::AUTO_START); SignIn(); + CreateService(ProfileSyncService::MANUAL_START); EXPECT_CALL(*component_factory(), CreateSyncEngine(_, _, _, _)) .WillOnce( Return(ByMove(std::make_unique<FakeSyncEngineCollectCredentials>( @@ -987,7 +986,7 @@ TEST_F(ProfileSyncServiceTest, StopAndClearWillClearDataAndSwitchToTransportMode) { SignIn(); - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); InitializeForNthSync(); ASSERT_EQ(SyncService::TransportState::ACTIVE, service()->GetTransportState()); @@ -1014,7 +1013,7 @@ // and account is signed out. TEST_F(ProfileSyncServiceTest, ClearDemographicsOnInitializeWhenSignedOut) { // Don't sign-in before creating the service. - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); // Local transport data should be cleared and the client notified. EXPECT_CALL(*sync_client(), OnLocalSyncTransportDataCleared()); @@ -1025,7 +1024,7 @@ TEST_F(ProfileSyncServiceTest, StopSyncAndClearTwiceDoesNotCrash) { SignIn(); - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); InitializeForNthSync(); ASSERT_EQ(SyncService::TransportState::ACTIVE, service()->GetTransportState()); @@ -1053,8 +1052,8 @@ CoreAccountId init_account_id; - CreateService(ProfileSyncService::AUTO_START); SignIn(); + CreateService(ProfileSyncService::MANUAL_START); EXPECT_CALL(*component_factory(), CreateSyncEngine(_, _, _, _)) .WillOnce( Return(ByMove(std::make_unique<FakeSyncEngineCollectCredentials>( @@ -1114,8 +1113,8 @@ CoreAccountId init_account_id; - CreateService(ProfileSyncService::AUTO_START); SignIn(); + CreateService(ProfileSyncService::MANUAL_START); EXPECT_CALL(*component_factory(), CreateSyncEngine(_, _, _, _)) .WillOnce( Return(ByMove(std::make_unique<FakeSyncEngineCollectCredentials>( @@ -1193,7 +1192,7 @@ // on a datatype type requesting startup, but only happens once. TEST_F(ProfileSyncServiceTest, PassphrasePromptDueToVersion) { SignIn(); - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); InitializeForNthSync(); SyncPrefs sync_prefs(prefs()); @@ -1222,7 +1221,7 @@ // RESET_LOCAL_SYNC_DATA it restarts sync. TEST_F(ProfileSyncServiceTest, ResetSyncData) { SignIn(); - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); // Backend should get initialized two times: once during initialization and // once when handling actionable error. EXPECT_CALL(*component_factory(), CreateDataTypeManager(_, _, _, _, _, _)) @@ -1245,7 +1244,7 @@ // DISABLE_SYNC_ON_CLIENT it disables sync and signs out. TEST_F(ProfileSyncServiceTest, DisableSyncOnClient) { SignIn(); - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); InitializeForNthSync(); ASSERT_EQ(SyncService::TransportState::ACTIVE, @@ -1320,7 +1319,7 @@ SignIn(); // First sync. - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); EXPECT_CALL(*component_factory(), CreateDataTypeManager(_, _, _, _, _, _)) .WillOnce(ReturnNewFakeDataTypeManager( GetRecordingConfigureCalledCallback(&configure_reason))); @@ -1340,7 +1339,7 @@ ShutdownAndDeleteService(); // Nth sync. - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); EXPECT_CALL(*component_factory(), CreateDataTypeManager(_, _, _, _, _, _)) .WillOnce(ReturnNewFakeDataTypeManager( GetRecordingConfigureCalledCallback(&configure_reason))); @@ -1372,9 +1371,9 @@ // ProfileSyncService usages after shutdown are addressed. TEST_F(ProfileSyncServiceTestWithStopSyncInPausedState, ShouldProvideDisableReasonsAfterShutdown) { - CreateService(ProfileSyncService::AUTO_START); - InitializeForFirstSync(); SignIn(); + CreateService(ProfileSyncService::MANUAL_START); + InitializeForFirstSync(); service()->Shutdown(); EXPECT_FALSE(service()->GetDisableReasons().Empty()); } @@ -1383,7 +1382,7 @@ SyncPrefs sync_prefs(prefs()); SignIn(); - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); InitializeForNthSync(); ASSERT_EQ(SyncService::TransportState::ACTIVE, service()->GetTransportState()); @@ -1449,7 +1448,7 @@ SyncPrefs sync_prefs(prefs()); SignIn(); - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); PopulatePrefsForNthSync(); ASSERT_EQ(kTestCacheGuid, sync_prefs.GetCacheGuid()); @@ -1467,8 +1466,8 @@ TEST_F(ProfileSyncServiceTestWithSyncInvalidationsServiceCreated, ShouldSendDataTypesToSyncInvalidationsService) { - CreateService(ProfileSyncService::AUTO_START); SignIn(); + CreateService(ProfileSyncService::MANUAL_START); EXPECT_CALL(*sync_invalidations_service(), SetInterestedDataTypes(_, _)); InitializeForFirstSync(); } @@ -1479,9 +1478,9 @@ TEST_F(ProfileSyncServiceTestWithSyncInvalidationsServiceCreated, ShouldEnableAndDisableInvalidationsForSessions) { - CreateService(ProfileSyncService::AUTO_START, nullptr, - {{SESSIONS, false}, {TYPED_URLS, false}}); SignIn(); + CreateService(ProfileSyncService::MANUAL_START, nullptr, + {{SESSIONS, false}, {TYPED_URLS, false}}); InitializeForNthSync(); EXPECT_CALL(*sync_invalidations_service(), @@ -1494,16 +1493,16 @@ TEST_F(ProfileSyncServiceTestWithSyncInvalidationsServiceCreated, ShouldActivateSyncInvalidationsServiceWhenSyncIsInitialized) { - CreateService(ProfileSyncService::AUTO_START); - EXPECT_CALL(*sync_invalidations_service(), SetActive(true)).Times(0); SignIn(); + CreateService(ProfileSyncService::MANUAL_START); + EXPECT_CALL(*sync_invalidations_service(), SetActive(true)).Times(0); EXPECT_CALL(*sync_invalidations_service(), SetActive(true)); InitializeForFirstSync(); } TEST_F(ProfileSyncServiceTestWithSyncInvalidationsServiceCreated, ShouldActivateSyncInvalidationsServiceOnSignIn) { - CreateService(ProfileSyncService::AUTO_START); + CreateService(ProfileSyncService::MANUAL_START); EXPECT_CALL(*sync_invalidations_service(), SetActive(false)); InitializeForFirstSync(); EXPECT_CALL(*sync_invalidations_service(), SetActive(true)); @@ -1514,8 +1513,8 @@ #if !defined(OS_CHROMEOS) TEST_F(ProfileSyncServiceTestWithSyncInvalidationsServiceCreated, ShouldDectivateSyncInvalidationsServiceOnSignOut) { - CreateService(ProfileSyncService::AUTO_START); SignIn(); + CreateService(ProfileSyncService::MANUAL_START); EXPECT_CALL(*sync_invalidations_service(), SetActive(true)); InitializeForFirstSync();
diff --git a/components/web_cache/browser/web_cache_manager.cc b/components/web_cache/browser/web_cache_manager.cc index 4c5dcdb..ba45776 100644 --- a/components/web_cache/browser/web_cache_manager.cc +++ b/components/web_cache/browser/web_cache_manager.cc
@@ -157,7 +157,7 @@ void WebCacheManager::OnRenderProcessHostCreated( content::RenderProcessHost* process_host) { Add(process_host->GetID()); - rph_observers_.Add(process_host); + rph_observations_.AddObservation(process_host); } void WebCacheManager::RenderProcessExited( @@ -168,7 +168,7 @@ void WebCacheManager::RenderProcessHostDestroyed( content::RenderProcessHost* process_host) { - rph_observers_.Remove(process_host); + rph_observations_.RemoveObservation(process_host); Remove(process_host->GetID()); }
diff --git a/components/web_cache/browser/web_cache_manager.h b/components/web_cache/browser/web_cache_manager.h index 46f548fa..e5e174f 100644 --- a/components/web_cache/browser/web_cache_manager.h +++ b/components/web_cache/browser/web_cache_manager.h
@@ -19,7 +19,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/no_destructor.h" -#include "base/scoped_observer.h" +#include "base/scoped_multi_source_observation.h" #include "base/time/time.h" #include "components/web_cache/public/mojom/web_cache.mojom.h" #include "content/public/browser/render_process_host.h" @@ -247,8 +247,9 @@ // mojo::Remote<mojom::WebCache>. WebCacheServicesMap web_cache_services_; - ScopedObserver<content::RenderProcessHost, content::RenderProcessHostObserver> - rph_observers_{this}; + base::ScopedMultiSourceObservation<content::RenderProcessHost, + content::RenderProcessHostObserver> + rph_observations_{this}; base::WeakPtrFactory<WebCacheManager> weak_factory_{this};
diff --git a/content/browser/bad_message.h b/content/browser/bad_message.h index ce284fb..436e17a 100644 --- a/content/browser/bad_message.h +++ b/content/browser/bad_message.h
@@ -261,6 +261,8 @@ RWH_CLOSE_PORTAL = 233, MSDH_INVALID_STREAM_TYPE = 234, RFH_CREATE_CHILD_FRAME_TOKENS_NOT_FOUND = 235, + ASGH_ASSOCIATED_INTERFACE_REQUEST = 236, + ASGH_RECEIVED_CONTROL_MESSAGE = 237, // Please add new elements here. The naming convention is abbreviated class // name (e.g. RenderFrameHost becomes RFH) plus a unique description of the
diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc index a673d5c2..e064ff5 100644 --- a/content/browser/download/download_browsertest.cc +++ b/content/browser/download/download_browsertest.cc
@@ -3485,10 +3485,10 @@ ASSERT_GE(2u, requests.size()); net::test_server::HttpRequest last_request = requests.back()->http_request; - EXPECT_TRUE(last_request.headers.find(net::HttpRequestHeaders::kReferer) != - last_request.headers.end()); - EXPECT_EQ(document_url.spec(), - last_request.headers.at(net::HttpRequestHeaders::kReferer)); + ASSERT_TRUE( + base::Contains(last_request.headers, net::HttpRequestHeaders::kReferer)); + EXPECT_EQ(last_request.headers.at(net::HttpRequestHeaders::kReferer), + document_url.GetOrigin().spec()); } // Test that the referrer header is dropped for HTTP downloads from HTTPS.
diff --git a/content/browser/isolated_origin_browsertest.cc b/content/browser/isolated_origin_browsertest.cc index 2540b27b..2f1ce9e 100644 --- a/content/browser/isolated_origin_browsertest.cc +++ b/content/browser/isolated_origin_browsertest.cc
@@ -1500,7 +1500,7 @@ bool WillProcessDidCommitNavigation( RenderFrameHost* render_frame_host, NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr*, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) override { was_called_ = true;
diff --git a/content/browser/navigation_browsertest.cc b/content/browser/navigation_browsertest.cc index 682490f..c010e00 100644 --- a/content/browser/navigation_browsertest.cc +++ b/content/browser/navigation_browsertest.cc
@@ -24,6 +24,7 @@ #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/content_navigation_policy.h" #include "content/common/frame_messages.h" +#include "content/common/navigation_client.mojom.h" #include "content/common/navigation_params.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_message_filter.h" @@ -100,7 +101,7 @@ return intercepted_navigations_; } - const std::vector<::FrameHostMsg_DidCommitProvisionalLoad_Params>& + const std::vector<mojom::DidCommitProvisionalLoadParamsPtr>& intercepted_messages() const { return intercepted_messages_; } @@ -115,11 +116,11 @@ bool WillProcessDidCommitNavigation( RenderFrameHost* render_frame_host, NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) override { intercepted_navigations_.push_back(navigation_request); - intercepted_messages_.push_back(*params); + intercepted_messages_.push_back(std::move(*params)); intercepted_receivers_.push_back( *interface_params ? std::move((*interface_params)->interface_provider_receiver) @@ -133,8 +134,7 @@ // Note: Do not dereference the intercepted_navigations_, they are used as // indices in the RenderFrameHostImpl and not for themselves. std::vector<NavigationRequest*> intercepted_navigations_; - std::vector<::FrameHostMsg_DidCommitProvisionalLoad_Params> - intercepted_messages_; + std::vector<mojom::DidCommitProvisionalLoadParamsPtr> intercepted_messages_; std::vector< mojo::PendingReceiver<::service_manager::mojom::InterfaceProvider>> intercepted_receivers_;
diff --git a/content/browser/renderer_host/agent_scheduling_group_host.cc b/content/browser/renderer_host/agent_scheduling_group_host.cc index 8fe6b45..492dfe5c 100644 --- a/content/browser/renderer_host/agent_scheduling_group_host.cc +++ b/content/browser/renderer_host/agent_scheduling_group_host.cc
@@ -9,18 +9,21 @@ #include "base/no_destructor.h" #include "base/stl_util.h" #include "base/supports_user_data.h" +#include "content/browser/bad_message.h" #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/common/agent_scheduling_group.mojom.h" #include "content/common/renderer.mojom.h" #include "content/common/state_transitions.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/content_features.h" +#include "ipc/ipc_channel_mojo.h" #include "ipc/ipc_message.h" namespace content { namespace { +using ::IPC::ChannelMojo; using ::IPC::ChannelProxy; using ::IPC::Listener; using ::mojo::AssociatedReceiver; @@ -52,47 +55,6 @@ } // namespace -// MaybeAssociatedRemote: -AgentSchedulingGroupHost::MaybeAssociatedRemote::MaybeAssociatedRemote( - bool should_associate) { - if (should_associate) { - remote_ = AssociatedRemote<mojom::AgentSchedulingGroup>(); - } else { - remote_ = Remote<mojom::AgentSchedulingGroup>(); - } -} - -AgentSchedulingGroupHost::MaybeAssociatedRemote::~MaybeAssociatedRemote() = - default; - -PendingReceiver<mojom::AgentSchedulingGroup> -AgentSchedulingGroupHost::MaybeAssociatedRemote::BindNewPipeAndPassReceiver() { - return absl::get<Remote<mojom::AgentSchedulingGroup>>(remote_) - .BindNewPipeAndPassReceiver(); -} - -PendingAssociatedReceiver<mojom::AgentSchedulingGroup> -AgentSchedulingGroupHost::MaybeAssociatedRemote:: - BindNewEndpointAndPassReceiver() { - return absl::get<AssociatedRemote<mojom::AgentSchedulingGroup>>(remote_) - .BindNewEndpointAndPassReceiver(); -} - -void AgentSchedulingGroupHost::MaybeAssociatedRemote::reset() { - absl::visit([](auto& remote) { remote.reset(); }, remote_); -} - -bool AgentSchedulingGroupHost::MaybeAssociatedRemote::is_bound() { - return absl::visit([](auto& remote) { return remote.is_bound(); }, remote_); -} - -mojom::AgentSchedulingGroup* -AgentSchedulingGroupHost::MaybeAssociatedRemote::get() { - return absl::visit([](auto& r) { return r.get(); }, remote_); -} - -// AgentSchedulingGroupHost: - // static AgentSchedulingGroupHost* AgentSchedulingGroupHost::Get( const SiteInstance& instance, @@ -111,26 +73,21 @@ } AgentSchedulingGroupHost::AgentSchedulingGroupHost(RenderProcessHost& process) - : AgentSchedulingGroupHost( - process, - !base::FeatureList::IsEnabled( - features::kMbiDetachAgentSchedulingGroupFromChannel)) {} - -AgentSchedulingGroupHost::AgentSchedulingGroupHost(RenderProcessHost& process, - bool should_associate) : process_(process), - should_associate_(should_associate), - receiver_(this), - mojo_remote_(should_associate) { + association_mode_(base::FeatureList::IsEnabled( + features::kMbiDetachAgentSchedulingGroupFromChannel) + ? IPCAssociationMode::kUnassociated + : IPCAssociationMode::kAssociatedWithProcess), + receiver_(this) { process_.AddObserver(this); // The RenderProcessHost's channel and other mojo interfaces are bound by the - // time this class is constructed, so we eagerly initialize this class's mojos + // time this class is constructed, so we eagerly initialize this class's IPC // so they have the same bind lifetime as those of the RenderProcessHost. // Furthermore, when the RenderProcessHost's channel and mojo interfaces get // reset and reinitialized, we'll be notified so that we can reset and // reinitialize ours as well. - SetUpMojo(); + SetUpIPC(); } // DO NOT USE |process_| HERE! At this point it (or at least parts of it) is no @@ -148,17 +105,17 @@ // We mirror the RenderProcessHost flow here by resetting our mojos, and // reinitializing them once the process's IPC::ChannelProxy and renderer // interface are reinitialized. - ResetMojo(); + ResetIPC(); // RenderProcessHostImpl will attempt to call this method later if it has not - // already been called. We call it now since `SetUpMojo()` relies on it being - // called, thus setting up the IPC ChannelProxy and mojom::Renderer interface. + // already been called. We call it now since `SetUpIPC()` relies on it being + // called, thus setting up the IPC channel and mojom::Renderer interface. process_.EnableSendQueue(); // We call this so that we can immediately queue IPC and mojo messages on the // new channel/interfaces that are bound for the next renderer process, should // one eventually be spun up. - SetUpMojo(); + SetUpIPC(); } void AgentSchedulingGroupHost::RenderProcessHostDestroyed( @@ -176,6 +133,37 @@ SetState(LifecycleState::kRenderProcessHostDestroyed); } +bool AgentSchedulingGroupHost::OnMessageReceived(const IPC::Message& message) { + if (message.routing_id() == MSG_ROUTING_CONTROL) { + bad_message::ReceivedBadMessage(&process_, + bad_message::ASGH_RECEIVED_CONTROL_MESSAGE); + return false; + } + + auto* listener = GetListener(message.routing_id()); + if (!listener) + return false; + + return listener->OnMessageReceived(message); +} + +void AgentSchedulingGroupHost::OnBadMessageReceived( + const IPC::Message& message) { + // If a bad message is received, it should be treated the same as a bad + // message on the renderer-wide channel (i.e., kill the renderer). + return process_.OnBadMessageReceived(message); +} + +void AgentSchedulingGroupHost::OnAssociatedInterfaceRequest( + const std::string& interface_name, + mojo::ScopedInterfaceEndpointHandle handle) { + // There shouldn't be any interfaces requested this way - process-wide + // interfaces should be requested via the process-wide channel, and + // ASG-related interfaces should go through `RouteProvider`. + bad_message::ReceivedBadMessage( + &process_, bad_message::ASGH_ASSOCIATED_INTERFACE_REQUEST); +} + RenderProcessHost* AgentSchedulingGroupHost::GetProcess() { // TODO(crbug.com/1111231): Make the condition below hold. // Currently the DCHECK doesn't hold, since RenderViewHostImpl outlives @@ -202,12 +190,30 @@ ChannelProxy* AgentSchedulingGroupHost::GetChannel() { DCHECK_EQ(state_, LifecycleState::kBound); - return process_.GetChannel(); + + if (association_mode_ == IPCAssociationMode::kAssociatedWithProcess) + return process_.GetChannel(); + + DCHECK(channel_); + return channel_.get(); } bool AgentSchedulingGroupHost::Send(IPC::Message* message) { DCHECK_EQ(state_, LifecycleState::kBound); - return process_.Send(message); + + std::unique_ptr<IPC::Message> msg(message); + + if (association_mode_ == IPCAssociationMode::kAssociatedWithProcess) + return process_.Send(msg.release()); + + // This DCHECK is too idealistic for now - messages that are handled by + // filters are sent as control messages since they are intercepted before + // routing. It is put here as documentation for now, since this code would not + // be reached until we activate `kUnassociated`. + DCHECK_NE(message->routing_id(), MSG_ROUTING_CONTROL); + + DCHECK(channel_); + return channel_->Send(msg.release()); } void AgentSchedulingGroupHost::AddRoute(int32_t routing_id, @@ -246,10 +252,11 @@ int32_t routing_id, mojom::AgentSchedulingGroup::DestroyViewCallback callback) { DCHECK_EQ(state_, LifecycleState::kBound); - if (mojo_remote_.is_bound()) + if (mojo_remote_.is_bound()) { mojo_remote_.get()->DestroyView(routing_id, std::move(callback)); - else + } else { std::move(callback).Run(); + } } void AgentSchedulingGroupHost::CreateFrameProxy( @@ -288,36 +295,85 @@ listener->OnAssociatedInterfaceRequest(name, receiver.PassHandle()); } -void AgentSchedulingGroupHost::ResetMojo() { +void AgentSchedulingGroupHost::ResetIPC() { DCHECK_EQ(state_, LifecycleState::kRenderProcessExited); receiver_.reset(); mojo_remote_.reset(); remote_route_provider_.reset(); route_provider_receiver_.reset(); associated_interface_provider_receivers_.Clear(); + channel_ = nullptr; } -void AgentSchedulingGroupHost::SetUpMojo() { +void AgentSchedulingGroupHost::SetUpIPC() { DCHECK_CURRENTLY_ON(BrowserThread::UI); - // The RenderProcessHostImpl's renderer interface must be initialized at this - // at this point. We don't DCHECK |process_.IsInitializedAndNotDead()| here - // because we may end up here after the render process has died but before - // RenderProcessHostImpl::Init() is called. Therefore, the process can - // accept IPCs that will be queued for the next render process if one is spun - // up. - DCHECK(process_.GetRendererInterface()); - DCHECK(state_ == LifecycleState::kNewborn || state_ == LifecycleState::kRenderProcessExited); - if (should_associate_) { + // The RenderProcessHostImpl's renderer interface must be initialized at this + // point. We don't DCHECK |process_.IsInitializedAndNotDead()| here because + // we may end up here after the renderer process has died but before + // RenderProcessHostImpl::Init() is called. Therefore, the process can accept + // IPCs that will be queued for the next renderer process if one is spun up. + DCHECK(process_.GetRendererInterface()); + + DCHECK(!channel_); + DCHECK(!mojo_remote_.is_bound()); + DCHECK(!receiver_.is_bound()); + DCHECK(!remote_route_provider_.is_bound()); + DCHECK(!route_provider_receiver_.is_bound()); + + // After this function returns, all of `this`'s associated mojo interfaces + // need to be bound, and associated "properly" - in `kUnassociated` mode that + // means they are associated with the ASG's channel, and in + // `kAssociatedWithProcess` mode with the process-global channel. This + // initialization is done in a number of steps: + // 1. If we're in `kUnassociated` mode, create an IPC Channel (i.e., + // initialize `channel_`). After this, regardless of which mode we're in, + // the ASGH would have a channel. + // 2. Initialize `mojo_remote_`. In `kAssociatedWithProcess` mode, this can be + // done via the `mojom::Renderer` interface, but in `kUnassociated` mode + // this *has* to be done via the just-created channel (so the interface is + // associated with the correct pipe). + // 3. All the ASGH's other associated interfaces can now be initialized via + // `mojo_remote_`, and will be transitively associated with the appropriate + // IPC channel/pipe. + if (association_mode_ == IPCAssociationMode::kAssociatedWithProcess) { process_.GetRendererInterface()->CreateAssociatedAgentSchedulingGroup( mojo_remote_.BindNewEndpointAndPassReceiver()); } else { + auto io_task_runner = GetIOThreadTaskRunner({}); + + // Empty interface endpoint to pass pipes more easily. + PendingRemote<IPC::mojom::ChannelBootstrap> bootstrap; + process_.GetRendererInterface()->CreateAgentSchedulingGroup( - mojo_remote_.BindNewPipeAndPassReceiver()); + bootstrap.InitWithNewPipeAndPassReceiver()); + + auto channel_factory = ChannelMojo::CreateServerFactory( + bootstrap.PassPipe(), /*ipc_task_runner=*/io_task_runner, + /*proxy_task_runner=*/base::ThreadTaskRunnerHandle::Get()); + + // TODO(crbug.com/1111231): Android WebViews (that support synchronous + // compositing) send sync messages from the browser to the renderer, and + // therefore need a `SyncChannel`. However, we don't plan to support + // WebViews at this stage, so a plain `ChannelProxy` is fine for now. + channel_ = ChannelProxy::Create( + std::move(channel_factory), /*listener=*/this, + /*ipc_task_runner=*/io_task_runner, + /*listener_task_runner=*/base::ThreadTaskRunnerHandle::Get()); + + // TODO(crbug.com/1111231): Add necessary filters. + // Most of the filters currently installed on the process-wide channel are: + // 1. "Process-bound", that is, they do not handle messages sent using ASG, + // 2. Pepper/NaCl-related, that are going away, and are not supported, or + // 3. Related to Android WebViews, which are not currently supported. + + channel_->GetRemoteAssociatedInterface(&mojo_remote_); } + DCHECK(mojo_remote_.is_bound()); + mojo_remote_.get()->BindAssociatedInterfaces( receiver_.BindNewEndpointAndPassRemote(), route_provider_receiver_.BindNewEndpointAndPassRemote(),
diff --git a/content/browser/renderer_host/agent_scheduling_group_host.h b/content/browser/renderer_host/agent_scheduling_group_host.h index 8efdc7a..db4e4d71 100644 --- a/content/browser/renderer_host/agent_scheduling_group_host.h +++ b/content/browser/renderer_host/agent_scheduling_group_host.h
@@ -14,17 +14,16 @@ #include "content/common/renderer.mojom-forward.h" #include "content/common/state_transitions.h" #include "content/public/browser/render_process_host_observer.h" +#include "ipc/ipc_listener.h" #include "mojo/public/cpp/bindings/associated_receiver.h" #include "mojo/public/cpp/bindings/associated_receiver_set.h" #include "mojo/public/cpp/bindings/associated_remote.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" -#include "third_party/abseil-cpp/absl/types/variant.h" #include "third_party/blink/public/mojom/associated_interfaces/associated_interfaces.mojom.h" namespace IPC { class ChannelProxy; -class Listener; class Message; } // namespace IPC @@ -43,6 +42,7 @@ // RenderProcessHost. class CONTENT_EXPORT AgentSchedulingGroupHost : public RenderProcessHostObserver, + public IPC::Listener, public mojom::AgentSchedulingGroupHost, public mojom::RouteProvider, public blink::mojom::AssociatedInterfaceProvider { @@ -54,7 +54,6 @@ static AgentSchedulingGroupHost* Get(const SiteInstance& instance, RenderProcessHost& process); - // Utility ctor, forwarding to the main ctor below. // Should not be called explicitly. Use `Get()` instead. explicit AgentSchedulingGroupHost(RenderProcessHost& process); ~AgentSchedulingGroupHost() override; @@ -106,41 +105,12 @@ friend StateTransitions<LifecycleState>; friend std::ostream& operator<<(std::ostream& os, LifecycleState state); - // `MaybeAssociatedRemote` is a temporary helper class that allows us to - // switch between using an associated and non-associated remote. This behavior - // is controlled by the `kMbiDetachAgentSchedulingGroupFromChannel` feature - // flag. Associated remotes are associated with the IPC channel (transitively, - // via the `Renderer` interface), thus preserving cross-agent scheduling group - // message order. Non-associated interfaces are independent from each other - // and do not preserve message order between agent scheduling groups. - // TODO(crbug.com/1111231): Remove this once we can remove the flag. - class MaybeAssociatedRemote { - public: - explicit MaybeAssociatedRemote(bool should_associate); - ~MaybeAssociatedRemote(); - - mojo::PendingReceiver<mojom::AgentSchedulingGroup> - BindNewPipeAndPassReceiver() WARN_UNUSED_RESULT; - mojo::PendingAssociatedReceiver<mojom::AgentSchedulingGroup> - BindNewEndpointAndPassReceiver() WARN_UNUSED_RESULT; - - void reset(); - bool is_bound(); - mojom::AgentSchedulingGroup* get(); - - private: - absl::variant<mojo::Remote<mojom::AgentSchedulingGroup>, - mojo::AssociatedRemote<mojom::AgentSchedulingGroup>> - remote_; - }; - - // Main constructor. - // |should_associate| determines whether the `AgentSchedulingGroupHost` and - // `AgentSchedulingGroup` mojos should be associated with the `Renderer` or - // not. If they are, message order will be preserved across the entire - // process. If not, ordering will only be preserved inside an - // `AgentSchedulingGroup`. - AgentSchedulingGroupHost(RenderProcessHost& process, bool should_associate); + // IPC::Listener + bool OnMessageReceived(const IPC::Message& message) override; + void OnBadMessageReceived(const IPC::Message& message) override; + void OnAssociatedInterfaceRequest( + const std::string& interface_name, + mojo::ScopedInterfaceEndpointHandle handle) override; // mojom::RouteProvider void GetRoute( @@ -159,8 +129,8 @@ const ChildProcessTerminationInfo& info) override; void RenderProcessHostDestroyed(RenderProcessHost* host) override; - void ResetMojo(); - void SetUpMojo(); + void ResetIPC(); + void SetUpIPC(); void SetState(LifecycleState state); @@ -169,19 +139,34 @@ // The RenderProcessHost this AgentSchedulingGroup is assigned to. RenderProcessHost& process_; - const bool should_associate_; + enum class IPCAssociationMode { + // In this mode, the AgentSchedulingGroup will use the process-wide legacy + // IPC channel for communication with the renderer process and to associate + // its interfaces with. + kAssociatedWithProcess = 0, + + // In this mode, each AgentSchedulingGroup will have its own legacy IPC + // channel for communication with the renderer process and to associate its + // interfaces with. + kUnassociated = 1, + }; + const IPCAssociationMode association_mode_; + + // This AgentSchedulingGroup's legacy IPC channel. Will only be used in + // `kUnassociated` mode. + std::unique_ptr<IPC::ChannelProxy> channel_; // Map of registered IPC listeners. base::IDMap<IPC::Listener*> listener_map_; + // Remote stub of `mojom::AgentSchedulingGroup`, used for sending calls to the + // (renderer-side) `AgentSchedulingGroup`. + mojo::AssociatedRemote<mojom::AgentSchedulingGroup> mojo_remote_; + // Implementation of `mojom::AgentSchedulingGroupHost`, used for responding to // calls from the (renderer-side) `AgentSchedulingGroup`. mojo::AssociatedReceiver<mojom::AgentSchedulingGroupHost> receiver_; - // Remote stub of `mojom::AgentSchedulingGroup`, used for sending calls to the - // (renderer-side) `AgentSchedulingGroup`. - MaybeAssociatedRemote mojo_remote_; - // The `mojom::RouteProvider` mojo pair to setup // `blink::AssociatedInterfaceProvider` routes between this and the // renderer-side `AgentSchedulingGroup`.
diff --git a/content/browser/renderer_host/ancestor_throttle.cc b/content/browser/renderer_host/ancestor_throttle.cc index 13778c6..c0de55b 100644 --- a/content/browser/renderer_host/ancestor_throttle.cc +++ b/content/browser/renderer_host/ancestor_throttle.cc
@@ -24,7 +24,6 @@ #include "content/public/browser/storage_partition.h" #include "net/http/http_response_headers.h" #include "services/network/public/cpp/content_security_policy/csp_context.h" -#include "services/network/public/cpp/features.h" #include "third_party/blink/public/mojom/devtools/console_message.mojom.h" namespace content { @@ -147,9 +146,6 @@ AncestorThrottle::~AncestorThrottle() {} NavigationThrottle::ThrottleCheckResult AncestorThrottle::WillStartRequest() { - if (!base::FeatureList::IsEnabled(network::features::kOutOfBlinkCSPEE)) - return NavigationThrottle::PROCEED; - NavigationRequest* request = NavigationRequest::From(navigation_handle()); if (request->IsInMainFrame()) return NavigationThrottle::PROCEED; @@ -437,9 +433,6 @@ // - https://w3c.github.io/webappsec-cspee/#allow-csp-from-header AncestorThrottle::CheckResult AncestorThrottle::EvaluateCSPEmbeddedEnforcement() { - if (!base::FeatureList::IsEnabled(network::features::kOutOfBlinkCSPEE)) - return CheckResult::PROCEED; - NavigationRequest* request = NavigationRequest::From(navigation_handle()); if (request->IsInMainFrame()) { // We enforce CSPEE only for frames, not for portals.
diff --git a/content/browser/renderer_host/ancestor_throttle_unittest.cc b/content/browser/renderer_host/ancestor_throttle_unittest.cc index 63398cf3..8baf9ab 100644 --- a/content/browser/renderer_host/ancestor_throttle_unittest.cc +++ b/content/browser/renderer_host/ancestor_throttle_unittest.cc
@@ -7,7 +7,6 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/memory/ref_counted.h" -#include "base/test/scoped_feature_list.h" #include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/navigation_throttle.h" @@ -17,7 +16,6 @@ #include "content/test/test_navigation_url_loader.h" #include "net/http/http_response_headers.h" #include "services/network/public/cpp/content_security_policy/content_security_policy.h" -#include "services/network/public/cpp/features.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -146,9 +144,6 @@ } TEST_F(AncestorThrottleTest, AllowsBlanketEnforcementOfRequiredCSP) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature(network::features::kOutOfBlinkCSPEE); - struct TestCase { const char* name; const char* request_origin; @@ -268,9 +263,6 @@ TEST_F(AncestorThrottleNavigationTest, WillStartRequestAddsSecRequiredCSPHeader) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature(network::features::kOutOfBlinkCSPEE); - // Create a frame tree with different 'csp' attributes according to the // following graph: // @@ -365,9 +357,6 @@ } TEST_F(AncestorThrottleNavigationTest, EvaluateCSPEmbeddedEnforcement) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature(network::features::kOutOfBlinkCSPEE); - // We need one initial navigation to set up everything. NavigateAndCommit(GURL("https://www.example.org"));
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc index 218d8a44..71ede49 100644 --- a/content/browser/renderer_host/navigation_controller_impl.cc +++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -233,7 +233,7 @@ } base::Optional<url::Origin> GetCommittedOriginForFrameEntry( - const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { + const mojom::DidCommitProvisionalLoadParams& params) { // Error pages commit in an opaque origin, yet have the real URL that resulted // in an error as the |params.url|. Since successful reload of an error page // should commit in the correct origin, setting the opaque origin on the @@ -999,7 +999,7 @@ bool NavigationControllerImpl::RendererDidNavigate( RenderFrameHostImpl* rfh, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, LoadCommittedDetails* details, bool is_same_document_navigation, bool previous_document_was_activated, @@ -1242,7 +1242,7 @@ NavigationType NavigationControllerImpl::ClassifyNavigation( RenderFrameHostImpl* rfh, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { + const mojom::DidCommitProvisionalLoadParams& params) { TraceReturnReason<tracing_category::kNavigation> trace_return( "ClassifyNavigation"); @@ -1390,7 +1390,7 @@ void NavigationControllerImpl::RendererDidNavigateToNewPage( RenderFrameHostImpl* rfh, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, bool is_same_document, bool replace_entry, bool previous_document_was_activated, @@ -1409,8 +1409,9 @@ rfh->frame_tree_node()->unique_name(), params.item_sequence_number, params.document_sequence_number, rfh->GetSiteInstance(), nullptr, params.url, (params.url_is_unreachable) ? nullptr : ¶ms.origin, - params.referrer, initiator_origin, params.redirects, params.page_state, - params.method, params.post_id, nullptr /* blob_url_loader_factory */, + Referrer(*params.referrer), initiator_origin, params.redirects, + params.page_state, params.method, params.post_id, + nullptr /* blob_url_loader_factory */, nullptr /* web_bundle_navigation_info */); new_entry = GetLastCommittedEntry()->CloneAndReplace( @@ -1475,7 +1476,8 @@ // For non-in-page commits with no matching pending entry, create a new entry. if (!new_entry) { new_entry = std::make_unique<NavigationEntryImpl>( - rfh->GetSiteInstance(), params.url, params.referrer, initiator_origin, + rfh->GetSiteInstance(), params.url, Referrer(*params.referrer), + initiator_origin, base::string16(), // title params.transition, request->IsRendererInitiated(), nullptr); // blob_url_loader_factory @@ -1513,7 +1515,7 @@ new_entry->SetURL(params.url); if (update_virtual_url) UpdateVirtualURLToURL(new_entry.get(), params.url); - new_entry->SetReferrer(params.referrer); + new_entry->SetReferrer(Referrer(*params.referrer)); new_entry->SetTransitionType(params.transition); new_entry->set_site_instance( static_cast<SiteInstanceImpl*>(rfh->GetSiteInstance())); @@ -1574,7 +1576,7 @@ void NavigationControllerImpl::RendererDidNavigateToExistingPage( RenderFrameHostImpl* rfh, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, bool is_same_document, bool was_restored, NavigationRequest* request, @@ -1706,7 +1708,7 @@ entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR : PAGE_TYPE_NORMAL); entry->SetURL(params.url); - entry->SetReferrer(params.referrer); + entry->SetReferrer(Referrer(*params.referrer)); if (entry->update_virtual_url_with_url()) UpdateVirtualURLToURL(entry, params.url); @@ -1723,9 +1725,10 @@ entry->AddOrUpdateFrameEntry( rfh->frame_tree_node(), params.item_sequence_number, params.document_sequence_number, rfh->GetSiteInstance(), nullptr, - params.url, GetCommittedOriginForFrameEntry(params), params.referrer, - initiator_origin, params.redirects, params.page_state, params.method, - params.post_id, nullptr /* blob_url_loader_factory */, + params.url, GetCommittedOriginForFrameEntry(params), + Referrer(*params.referrer), initiator_origin, params.redirects, + params.page_state, params.method, params.post_id, + nullptr /* blob_url_loader_factory */, request->web_bundle_navigation_info() ? request->web_bundle_navigation_info()->Clone() : nullptr); @@ -1752,7 +1755,7 @@ void NavigationControllerImpl::RendererDidNavigateToSamePage( RenderFrameHostImpl* rfh, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, bool is_same_document, NavigationRequest* request) { // This classification says that we have a pending entry that's the same as @@ -1802,9 +1805,10 @@ existing_entry->AddOrUpdateFrameEntry( rfh->frame_tree_node(), params.item_sequence_number, params.document_sequence_number, rfh->GetSiteInstance(), nullptr, - params.url, GetCommittedOriginForFrameEntry(params), params.referrer, - initiator_origin, params.redirects, params.page_state, params.method, - params.post_id, nullptr /* blob_url_loader_factory */, + params.url, GetCommittedOriginForFrameEntry(params), + Referrer(*params.referrer), initiator_origin, params.redirects, + params.page_state, params.method, params.post_id, + nullptr /* blob_url_loader_factory */, request->web_bundle_navigation_info() ? request->web_bundle_navigation_info()->Clone() : nullptr); @@ -1814,7 +1818,7 @@ void NavigationControllerImpl::RendererDidNavigateNewSubframe( RenderFrameHostImpl* rfh, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, bool is_same_document, bool replace_entry, bool previous_document_was_activated, @@ -1843,8 +1847,9 @@ rfh->frame_tree_node()->unique_name(), params.item_sequence_number, params.document_sequence_number, rfh->GetSiteInstance(), nullptr, params.url, (params.url_is_unreachable) ? nullptr : ¶ms.origin, - params.referrer, initiator_origin, params.redirects, params.page_state, - params.method, params.post_id, nullptr /* blob_url_loader_factory */, + Referrer(*params.referrer), initiator_origin, params.redirects, + params.page_state, params.method, params.post_id, + nullptr /* blob_url_loader_factory */, request->web_bundle_navigation_info() ? request->web_bundle_navigation_info()->Clone() : nullptr); @@ -1868,7 +1873,7 @@ bool NavigationControllerImpl::RendererDidNavigateAutoSubframe( RenderFrameHostImpl* rfh, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, NavigationRequest* request) { DCHECK(ui::PageTransitionCoreTypeIs(params.transition, ui::PAGE_TRANSITION_AUTO_SUBFRAME)); @@ -1923,9 +1928,10 @@ last_committed->AddOrUpdateFrameEntry( rfh->frame_tree_node(), params.item_sequence_number, params.document_sequence_number, rfh->GetSiteInstance(), nullptr, - params.url, GetCommittedOriginForFrameEntry(params), params.referrer, - initiator_origin, params.redirects, params.page_state, params.method, - params.post_id, nullptr /* blob_url_loader_factory */, + params.url, GetCommittedOriginForFrameEntry(params), + Referrer(*params.referrer), initiator_origin, params.redirects, + params.page_state, params.method, params.post_id, + nullptr /* blob_url_loader_factory */, request->web_bundle_navigation_info() ? request->web_bundle_navigation_info()->Clone() : nullptr);
diff --git a/content/browser/renderer_host/navigation_controller_impl.h b/content/browser/renderer_host/navigation_controller_impl.h index cbd41908..296375f5 100644 --- a/content/browser/renderer_host/navigation_controller_impl.h +++ b/content/browser/renderer_host/navigation_controller_impl.h
@@ -25,13 +25,12 @@ #include "content/browser/renderer_host/navigation_controller_delegate.h" #include "content/browser/renderer_host/navigation_entry_impl.h" #include "content/browser/ssl/ssl_manager.h" +#include "content/common/navigation_client.mojom-forward.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_type.h" #include "content/public/browser/reload_type.h" #include "mojo/public/cpp/bindings/pending_associated_remote.h" -struct FrameHostMsg_DidCommitProvisionalLoad_Params; - namespace content { class FrameTreeNode; class NavigationRequest; @@ -236,13 +235,12 @@ // interaction. This is used for a new renderer-initiated navigation to decide // if the page that initiated the navigation should be skipped on // back/forward button. - bool RendererDidNavigate( - RenderFrameHostImpl* rfh, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, - LoadCommittedDetails* details, - bool is_same_document_navigation, - bool previous_document_was_activated, - NavigationRequest* navigation_request); + bool RendererDidNavigate(RenderFrameHostImpl* rfh, + const mojom::DidCommitProvisionalLoadParams& params, + LoadCommittedDetails* details, + bool is_same_document_navigation, + bool previous_document_was_activated, + NavigationRequest* navigation_request); // Notifies us that we just became active. This is used by the WebContentsImpl // so that we know to load URLs that were pending as "lazy" loads. @@ -478,7 +476,7 @@ // Classifies the given renderer navigation (see the NavigationType enum). NavigationType ClassifyNavigation( RenderFrameHostImpl* rfh, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params); + const mojom::DidCommitProvisionalLoadParams& params); // Handlers for the different types of navigation types. They will actually // handle the navigations corresponding to the different NavClasses above. @@ -496,33 +494,33 @@ // (e.g., for history.replaceState). void RendererDidNavigateToNewPage( RenderFrameHostImpl* rfh, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, bool is_same_document, bool replace_entry, bool previous_document_was_activated, NavigationRequest* request); void RendererDidNavigateToExistingPage( RenderFrameHostImpl* rfh, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, bool is_same_document, bool was_restored, NavigationRequest* request, bool keep_pending_entry); void RendererDidNavigateToSamePage( RenderFrameHostImpl* rfh, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, bool is_same_document, NavigationRequest* request); void RendererDidNavigateNewSubframe( RenderFrameHostImpl* rfh, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, bool is_same_document, bool replace_entry, bool previous_document_was_activated, NavigationRequest* request); bool RendererDidNavigateAutoSubframe( RenderFrameHostImpl* rfh, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, NavigationRequest* request); // Allows the derived class to issue notifications that a load has been
diff --git a/content/browser/renderer_host/navigation_controller_impl_browsertest.cc b/content/browser/renderer_host/navigation_controller_impl_browsertest.cc index 67adb74..d00e45ae 100644 --- a/content/browser/renderer_host/navigation_controller_impl_browsertest.cc +++ b/content/browser/renderer_host/navigation_controller_impl_browsertest.cc
@@ -7207,10 +7207,10 @@ bool WillProcessDidCommitNavigation( RenderFrameHost* render_frame_host, NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) override { - if (!render_frame_host->GetParent() && params->url == url_) { + if (!render_frame_host->GetParent() && (**params).url == url_) { did_trigger_history_navigation_ = true; web_contents()->GetController().GoBack(); } @@ -7443,9 +7443,7 @@ // Verify the Origin and Referer headers. EXPECT_THAT(headers, ::testing::HasSubstr("Origin: null")); - EXPECT_THAT(headers, - ::testing::ContainsRegex( - "Referer: http://a.com:.*/form_that_posts_cross_site.html")); + EXPECT_THAT(headers, ::testing::ContainsRegex("Referer: http://a.com:.*/")); } // Test that verifies that Content-Type http header is correctly sent @@ -8710,11 +8708,11 @@ // Try to fake an error page navigation by doing a DidCommitProvisionalLoad // call. The browser doesn't know about the navigation at all previously. GURL bad_url(embedded_test_server()->GetURL("/title2.html")); - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params = - std::make_unique<FrameHostMsg_DidCommitProvisionalLoad_Params>(); + auto params = mojom::DidCommitProvisionalLoadParams::New(); params->nav_entry_id = 0; params->did_create_new_entry = true; params->url = bad_url; + params->referrer = blink::mojom::Referrer::New(); params->transition = ui::PAGE_TRANSITION_LINK; params->gesture = NavigationGestureUser; params->page_state = blink::PageState::CreateFromURL(bad_url); @@ -10659,7 +10657,7 @@ bool WillProcessDidCommitNavigation( RenderFrameHost* render_frame_host, NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) override { std::move(callback_).Run(); @@ -11611,8 +11609,8 @@ NavigationRequest* navigation_1 = main_frame->child_at(0)->navigation_request(); ASSERT_TRUE(navigation_1); - EXPECT_EQ(main_url, navigation_1->GetReferrer().url); - EXPECT_EQ(network::mojom::ReferrerPolicy::kNoReferrerWhenDowngrade, + EXPECT_EQ(main_url.GetOrigin(), navigation_1->GetReferrer().url); + EXPECT_EQ(network::mojom::ReferrerPolicy::kStrictOriginWhenCrossOrigin, navigation_1->GetReferrer().policy); EXPECT_TRUE(navigation_1->IsRendererInitiated()); EXPECT_TRUE(navigation_1->IsPost()); @@ -11629,8 +11627,8 @@ EXPECT_EQ(url::Origin::Create(main_url), frame_entry_1->initiator_origin().value()); content::Referrer referrer_1 = frame_entry_1->referrer(); - EXPECT_EQ(main_url, frame_entry_1->referrer().url); - EXPECT_EQ(network::mojom::ReferrerPolicy::kNoReferrerWhenDowngrade, + EXPECT_EQ(main_url.GetOrigin(), frame_entry_1->referrer().url); + EXPECT_EQ(network::mojom::ReferrerPolicy::kStrictOriginWhenCrossOrigin, frame_entry_1->referrer().policy); int item_sequence_number_1 = frame_entry_1->item_sequence_number(); int document_sequence_number_1 = frame_entry_1->document_sequence_number(); @@ -11644,8 +11642,8 @@ NavigationRequest* navigation_2 = main_frame->child_at(0)->navigation_request(); ASSERT_TRUE(navigation_2); - EXPECT_EQ(main_url, navigation_2->GetReferrer().url); - EXPECT_EQ(network::mojom::ReferrerPolicy::kNoReferrerWhenDowngrade, + EXPECT_EQ(main_url.GetOrigin(), navigation_2->GetReferrer().url); + EXPECT_EQ(network::mojom::ReferrerPolicy::kStrictOriginWhenCrossOrigin, navigation_2->GetReferrer().policy); EXPECT_FALSE(navigation_2->IsRendererInitiated()); EXPECT_TRUE(navigation_2->IsPost()); @@ -11662,8 +11660,8 @@ EXPECT_EQ(url::Origin::Create(main_url), frame_entry_2->initiator_origin().value()); content::Referrer referrer_2 = frame_entry_1->referrer(); - EXPECT_EQ(main_url, frame_entry_2->referrer().url); - EXPECT_EQ(network::mojom::ReferrerPolicy::kNoReferrerWhenDowngrade, + EXPECT_EQ(main_url.GetOrigin(), frame_entry_2->referrer().url); + EXPECT_EQ(network::mojom::ReferrerPolicy::kStrictOriginWhenCrossOrigin, frame_entry_2->referrer().policy); // TODO(http://crbug.com/1068965): Remove this when test passes.
diff --git a/content/browser/renderer_host/navigation_controller_impl_unittest.cc b/content/browser/renderer_host/navigation_controller_impl_unittest.cc index f0769f2..ebf56c7 100644 --- a/content/browser/renderer_host/navigation_controller_impl_unittest.cc +++ b/content/browser/renderer_host/navigation_controller_impl_unittest.cc
@@ -2272,20 +2272,21 @@ // First navigation (using location.replace). const GURL url2("http://foo#a"); - FrameHostMsg_DidCommitProvisionalLoad_Params params; - params.nav_entry_id = 0; - params.did_create_new_entry = false; - params.should_replace_current_entry = true; - params.url = url2; - params.transition = ui::PAGE_TRANSITION_LINK; - params.should_update_history = false; - params.gesture = NavigationGestureUser; - params.method = "GET"; - params.page_state = blink::PageState::CreateFromURL(url2); + auto params = mojom::DidCommitProvisionalLoadParams::New(); + params->nav_entry_id = 0; + params->did_create_new_entry = false; + params->should_replace_current_entry = true; + params->url = url2; + params->referrer = blink::mojom::Referrer::New(); + params->transition = ui::PAGE_TRANSITION_LINK; + params->should_update_history = false; + params->gesture = NavigationGestureUser; + params->method = "GET"; + params->page_state = blink::PageState::CreateFromURL(url2); // This should NOT generate a new entry, nor prune the list. LoadCommittedDetailsObserver observer(contents()); - main_test_rfh()->SendNavigateWithParams(¶ms, true); + main_test_rfh()->SendNavigateWithParams(std::move(params), true); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; EXPECT_TRUE(observer.is_same_document()); @@ -2295,15 +2296,16 @@ TEST_F(NavigationControllerTest, PushStateWithoutPreviousEntry) { ASSERT_FALSE(controller_impl().GetLastCommittedEntry()); - FrameHostMsg_DidCommitProvisionalLoad_Params params; GURL url("http://foo"); - params.nav_entry_id = 0; - params.did_create_new_entry = true; - params.url = url; - params.page_state = blink::PageState::CreateFromURL(url); + auto params = mojom::DidCommitProvisionalLoadParams::New(); + params->nav_entry_id = 0; + params->did_create_new_entry = true; + params->url = url; + params->referrer = blink::mojom::Referrer::New(); + params->page_state = blink::PageState::CreateFromURL(url); main_test_rfh()->SendRendererInitiatedNavigationRequest(url, false); main_test_rfh()->PrepareForCommit(); - contents()->GetMainFrame()->SendNavigateWithParams(¶ms, true); + contents()->GetMainFrame()->SendNavigateWithParams(std::move(params), true); // We pass if we don't crash. } @@ -2995,20 +2997,21 @@ EXPECT_EQ(0, rph->bad_msg_count()); // Doing a replaceState to a cross-origin URL is thus allowed. - FrameHostMsg_DidCommitProvisionalLoad_Params params; - params.nav_entry_id = 1; - params.did_create_new_entry = false; - params.url = different_origin_url; - params.origin = file_origin; - params.transition = ui::PAGE_TRANSITION_LINK; - params.gesture = NavigationGestureUser; - params.page_state = blink::PageState::CreateFromURL(different_origin_url); - params.method = "GET"; - params.post_id = -1; + auto params = mojom::DidCommitProvisionalLoadParams::New(); + params->nav_entry_id = 1; + params->did_create_new_entry = false; + params->url = different_origin_url; + params->referrer = blink::mojom::Referrer::New(); + params->origin = file_origin; + params->transition = ui::PAGE_TRANSITION_LINK; + params->gesture = NavigationGestureUser; + params->page_state = blink::PageState::CreateFromURL(different_origin_url); + params->method = "GET"; + params->post_id = -1; main_test_rfh()->SendRendererInitiatedNavigationRequest(different_origin_url, false); main_test_rfh()->PrepareForCommit(); - contents()->GetMainFrame()->SendNavigateWithParams(¶ms, true); + contents()->GetMainFrame()->SendNavigateWithParams(std::move(params), true); // At this point, we should still consider the current origin to be file://, // so that a file URL would still be a same-document navigation. See @@ -4044,13 +4047,14 @@ controller().GetLastCommittedEntry()->GetFavicon() = favicon; // history.pushState() is called. - FrameHostMsg_DidCommitProvisionalLoad_Params params; + auto params = mojom::DidCommitProvisionalLoadParams::New(); GURL kUrl2("http://foo#foo"); - params.nav_entry_id = 0; - params.did_create_new_entry = true; - params.url = kUrl2; - params.page_state = blink::PageState::CreateFromURL(kUrl2); - main_test_rfh()->SendNavigateWithParams(¶ms, true); + params->nav_entry_id = 0; + params->did_create_new_entry = true; + params->url = kUrl2; + params->referrer = blink::mojom::Referrer::New(); + params->page_state = blink::PageState::CreateFromURL(kUrl2); + main_test_rfh()->SendNavigateWithParams(std::move(params), true); // The title should immediately be visible on the new NavigationEntry. base::string16 new_title =
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc index 2e67728..2727609 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc
@@ -895,7 +895,7 @@ std::unique_ptr<NavigationRequest> NavigationRequest::CreateForCommit( FrameTreeNode* frame_tree_node, RenderFrameHostImpl* render_frame_host, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, std::unique_ptr<CrossOriginEmbedderPolicyReporter> coep_reporter, bool is_same_document, std::unique_ptr<WebBundleNavigationInfo> web_bundle_navigation_info) { @@ -907,8 +907,8 @@ // TODO(nasko): Investigate better value to pass for // |initiator_origin|. params.origin, - blink::mojom::Referrer::New(params.referrer.url, - params.referrer.policy), + blink::mojom::Referrer::New(params.referrer->url, + params.referrer->policy), params.transition, is_same_document ? mojom::NavigationType::SAME_DOCUMENT : mojom::NavigationType::DIFFERENT_DOCUMENT, @@ -3203,6 +3203,8 @@ } void NavigationRequest::CommitNavigation() { + frame_tree_node_->render_manager() + ->ValidateSpeculativeRenderFrameHostForBug1146573(); UpdateCommitNavigationParamsHistory(); DCHECK(NeedsUrlLoader() == !!response_head_ || (was_redirected_ && common_params_->url.IsAboutBlank())); @@ -4173,7 +4175,7 @@ } void NavigationRequest::DidCommitNavigation( - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, bool navigation_entry_committed, bool did_replace_entry, const GURL& previous_url, @@ -4613,11 +4615,11 @@ return response_head_.get() ? response_head_->headers.get() : nullptr; } -std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> +mojom::DidCommitProvisionalLoadParamsPtr NavigationRequest::MakeDidCommitProvisionalLoadParamsForBFCache() { - // Use the DidCommitProvisionalLoad_Params last used to commit the frame - // being restored as a starting point. - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params = + // Use the DidCommitProvisionalLoadParams last used to commit the frame being + // restored as a starting point. + mojom::DidCommitProvisionalLoadParamsPtr params = render_frame_host_->TakeLastCommitParams(); // Params must have been set when the RFH being restored from the cache last
diff --git a/content/browser/renderer_host/navigation_request.h b/content/browser/renderer_host/navigation_request.h index dea8361..e6cdfbaa 100644 --- a/content/browser/renderer_host/navigation_request.h +++ b/content/browser/renderer_host/navigation_request.h
@@ -29,6 +29,7 @@ #include "content/browser/site_instance_impl.h" #include "content/browser/web_package/web_bundle_handle.h" #include "content/common/content_export.h" +#include "content/common/navigation_client.mojom-forward.h" #include "content/common/navigation_params.h" #include "content/common/navigation_params.mojom.h" #include "content/public/browser/allow_service_worker_result.h" @@ -68,8 +69,6 @@ struct URLLoaderCompletionStatus; } // namespace network -struct FrameHostMsg_DidCommitProvisionalLoad_Params; - namespace content { class AppCacheNavigationHandle; @@ -207,7 +206,7 @@ static std::unique_ptr<NavigationRequest> CreateForCommit( FrameTreeNode* frame_tree_node, RenderFrameHostImpl* render_frame_host, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, std::unique_ptr<CrossOriginEmbedderPolicyReporter> coep_reporter, bool is_same_document, std::unique_ptr<WebBundleNavigationInfo> web_bundle_navigation_info); @@ -517,12 +516,11 @@ // NavigationEntry is current. // |did_replace_entry| is true if the committed entry has replaced the // existing one. A non-user initiated redirect causes such replacement. - void DidCommitNavigation( - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, - bool navigation_entry_committed, - bool did_replace_entry, - const GURL& previous_url, - NavigationType navigation_type); + void DidCommitNavigation(const mojom::DidCommitProvisionalLoadParams& params, + bool navigation_entry_committed, + bool did_replace_entry, + const GURL& previous_url, + NavigationType navigation_type); NavigationType navigation_type() const { DCHECK(state_ == DID_COMMIT || state_ == DID_COMMIT_ERROR_PAGE); @@ -840,7 +838,7 @@ // Builds the parameters used to commit a navigation to a page that was // restored from the back-forward cache. - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> + mojom::DidCommitProvisionalLoadParamsPtr MakeDidCommitProvisionalLoadParamsForBFCache(); // This enum describes the result of the credentialed subresource check for
diff --git a/content/browser/renderer_host/navigator.cc b/content/browser/renderer_host/navigator.cc index f763805..bddf1891 100644 --- a/content/browser/renderer_host/navigator.cc +++ b/content/browser/renderer_host/navigator.cc
@@ -225,7 +225,7 @@ void Navigator::DidNavigate( RenderFrameHostImpl* render_frame_host, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, std::unique_ptr<NavigationRequest> navigation_request, bool was_within_same_document) { DCHECK(navigation_request); @@ -918,7 +918,7 @@ void Navigator::RecordNavigationMetrics( const LoadCommittedDetails& details, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, SiteInstance* site_instance) { DCHECK(site_instance->HasProcess());
diff --git a/content/browser/renderer_host/navigator.h b/content/browser/renderer_host/navigator.h index 4db476c8..60b8c49 100644 --- a/content/browser/renderer_host/navigator.h +++ b/content/browser/renderer_host/navigator.h
@@ -23,7 +23,6 @@ #include "ui/base/window_open_disposition.h" class GURL; -struct FrameHostMsg_DidCommitProvisionalLoad_Params; namespace base { class TimeTicks; @@ -96,7 +95,7 @@ // Navigator should use the NavigationRequest provided by this method and not // attempt to access the RenderFrameHost's NavigationsRequests. void DidNavigate(RenderFrameHostImpl* render_frame_host, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, std::unique_ptr<NavigationRequest> navigation_request, bool was_within_same_document); @@ -210,7 +209,7 @@ void RecordNavigationMetrics( const LoadCommittedDetails& details, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, SiteInstance* site_instance); // Called when a renderer initiated navigation has started. Returns the
diff --git a/content/browser/renderer_host/navigator_delegate.h b/content/browser/renderer_host/navigator_delegate.h index 38afefb..3fe2aa3 100644 --- a/content/browser/renderer_host/navigator_delegate.h +++ b/content/browser/renderer_host/navigator_delegate.h
@@ -14,7 +14,6 @@ #include "content/public/browser/reload_type.h" class GURL; -struct FrameHostMsg_DidCommitProvisionalLoad_Params; namespace blink { struct UserAgentOverride; @@ -68,11 +67,11 @@ virtual void DidNavigateMainFramePostCommit( RenderFrameHostImpl* render_frame_host, const LoadCommittedDetails& details, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params) = 0; + const mojom::DidCommitProvisionalLoadParams& params) = 0; virtual void DidNavigateAnyFramePostCommit( RenderFrameHostImpl* render_frame_host, const LoadCommittedDetails& details, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params) = 0; + const mojom::DidCommitProvisionalLoadParams& params) = 0; virtual bool CanOverscrollContent() const = 0;
diff --git a/content/browser/renderer_host/navigator_unittest.cc b/content/browser/renderer_host/navigator_unittest.cc index 8efe3f0..036a9ca 100644 --- a/content/browser/renderer_host/navigator_unittest.cc +++ b/content/browser/renderer_host/navigator_unittest.cc
@@ -1184,8 +1184,8 @@ // A renderer process might try and claim that a cross site navigation was // within the same document by setting was_within_same_document = true in -// FrameHostMsg_DidCommitProvisionalLoad_Params. Such case should be detected on -// the browser side and the renderer process should be killed. +// DidCommitProvisionalLoadParams. Such case should be detected on the browser +// side and the renderer process should be killed. TEST_F(NavigatorTest, CrossSiteClaimWithinPage) { const GURL kUrl1("http://www.chromium.org/"); const GURL kUrl2("http://www.google.com/");
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index 869737a..f1eb17e 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -140,6 +140,7 @@ #include "content/common/frame.mojom.h" #include "content/common/frame_messages.h" #include "content/common/inter_process_time_ticks_converter.h" +#include "content/common/navigation_client.mojom.h" #include "content/common/navigation_params.h" #include "content/common/navigation_params_mojom_traits.h" #include "content/common/navigation_params_utils.h" @@ -331,7 +332,7 @@ // Returns true if |validated_params| represents a WebView loadDataWithBaseUrl // navigation. bool IsLoadDataWithBaseURL( - const FrameHostMsg_DidCommitProvisionalLoad_Params& validated_params) { + const mojom::DidCommitProvisionalLoadParams& validated_params) { return NavigationRequest::IsLoadDataWithBaseURL(validated_params.url, validated_params.base_url); } @@ -779,7 +780,7 @@ // https://crbug.com/888079. void VerifyThatBrowserAndRendererCalculatedOriginsToCommitMatch( NavigationRequest* navigation_request, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { + const mojom::DidCommitProvisionalLoadParams& params) { DCHECK(navigation_request); // Ignore for now cases where the NavigationRequest is in an unexpectedly @@ -1355,7 +1356,7 @@ service_worker_container_hosts_)); } -std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> +mojom::DidCommitProvisionalLoadParamsPtr RenderFrameHostImpl::TakeLastCommitParams() { return std::move(last_commit_params_); } @@ -2638,7 +2639,7 @@ } void RenderFrameHostImpl::DidNavigate( - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, NavigationRequest* navigation_request, bool did_create_new_document) { // Keep track of the last committed URL and origin in the RenderFrameHost @@ -3004,9 +3005,10 @@ } void RenderFrameHostImpl::DidCommitProvisionalLoad( - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params, + mojom::DidCommitProvisionalLoadParamsPtr params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params) { - if (MaybeInterceptCommitCallback(nullptr, params.get(), &interface_params)) { + if (MaybeInterceptCommitCallback(nullptr, ¶ms, &interface_params)) { + DCHECK(params); DidCommitNavigation(std::move(navigation_request_), std::move(params), std::move(interface_params)); } @@ -3014,7 +3016,7 @@ void RenderFrameHostImpl::DidCommitBackForwardCacheNavigation( NavigationRequest* committing_navigation_request, - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params) { + mojom::DidCommitProvisionalLoadParamsPtr params) { auto request = navigation_requests_.find(committing_navigation_request); CHECK(request != navigation_requests_.end()); @@ -3041,14 +3043,15 @@ void RenderFrameHostImpl::DidCommitPerNavigationMojoInterfaceNavigation( NavigationRequest* committing_navigation_request, - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params, + mojom::DidCommitProvisionalLoadParamsPtr params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params) { DCHECK(committing_navigation_request); committing_navigation_request->IgnoreCommitInterfaceDisconnection(); - if (!MaybeInterceptCommitCallback(committing_navigation_request, params.get(), + if (!MaybeInterceptCommitCallback(committing_navigation_request, ¶ms, &interface_params)) { return; } + DCHECK(params); auto request = navigation_requests_.find(committing_navigation_request); @@ -3063,7 +3066,7 @@ } void RenderFrameHostImpl::DidCommitSameDocumentNavigation( - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params) { + mojom::DidCommitProvisionalLoadParamsPtr params) { ScopedActiveURL scoped_active_url(params->url, frame_tree()->root()->current_origin()); ScopedCommitStateResetter commit_state_resetter(this); @@ -8183,7 +8186,7 @@ std::unique_ptr<NavigationRequest> RenderFrameHostImpl::CreateNavigationRequestForCommit( - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, bool is_same_document) { std::unique_ptr<CrossOriginEmbedderPolicyReporter> coep_reporter; // We don't switch the COEP reporter on same-document navigations, so create @@ -8402,8 +8405,9 @@ bool RenderFrameHostImpl::ValidateDidCommitParams( NavigationRequest* navigation_request, - FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParams* params, bool is_same_document_navigation) { + DCHECK(params); RenderProcessHost* process = GetProcess(); // Error pages may sometimes commit a URL in the wrong process, which requires @@ -8506,7 +8510,7 @@ // the URL. To prevent this attack, we block the renderer from inserting // banned URLs into the navigation controller in the first place. process->FilterURL(false, ¶ms->url); - process->FilterURL(true, ¶ms->referrer.url); + process->FilterURL(true, ¶ms->referrer->url); for (auto& redirect : params->redirects) { process->FilterURL(false, &redirect); } @@ -8551,7 +8555,7 @@ bool RenderFrameHostImpl::DidCommitNavigationInternal( std::unique_ptr<NavigationRequest> navigation_request, - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params, + mojom::DidCommitProvisionalLoadParamsPtr params, bool is_same_document_navigation) { // Sanity-check the page transition for frame type. DCHECK_EQ(ui::PageTransitionIsMainFrame(params->transition), !GetParent()); @@ -8718,18 +8722,6 @@ RecordDocumentCreatedUkmEvent(params->origin, document_ukm_source_id, ukm_recorder); } - - // If we still have a PeakGpuMemoryTracker, then the loading it was observing - // never completed. Cancel it's callback so that we don't report partial - // loads to UMA. - if (loading_mem_tracker_) - loading_mem_tracker_->Cancel(); - // Main Frames will create the tracker, which will be triggered after we - // receive DidStopLoading. - // TODO(arthursonzogni): Updating this flag for same-document or bfcache - // navigation isn't right. This should be moved to DidCommitNewDocument(). - loading_mem_tracker_ = navigation_request->TakePeakGpuMemoryTracker(); - frame_tree_node()->navigator().DidNavigate(this, *params, std::move(navigation_request), is_same_document_navigation); @@ -8758,7 +8750,7 @@ // TODO(arthursonzogni): Investigate what must be done when // navigation_request->IsWaitingToCommit() is false here. void RenderFrameHostImpl::DidCommitNewDocument( - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, NavigationRequest* navigation_request) { // BackForwardCache navigations restore existing document, but never create // new ones. @@ -8783,12 +8775,12 @@ DCHECK(params.embedding_token.has_value()); SetEmbeddingToken(params.embedding_token.value()); - // TODO(arthursonzogni): Stop relying on DidCommitProvisionalLoad_Params. Use + // TODO(arthursonzogni): Stop relying on DidCommitProvisionalLoadParams. Use // the NavigationRequest instead. The browser process doesn't need to rely on // the renderer process. last_http_status_code_ = params.http_status_code; - // TODO(arthursonzogni): Stop relying on DidCommitProvisionalLoad_Params. Use + // TODO(arthursonzogni): Stop relying on DidCommitProvisionalLoadParams. Use // the NavigationRequest instead. The browser process doesn't need to rely on // the renderer process. last_http_method_ = params.method; @@ -8864,6 +8856,17 @@ // Reset the salt so that media device IDs are reset for the new document // if necessary. media_device_id_salt_base_ = BrowserContext::CreateRandomMediaDeviceIDSalt(); + + // If we still have a PeakGpuMemoryTracker, then the loading it was observing + // never completed. Cancel it's callback so that we don't report partial + // loads to UMA. + if (loading_mem_tracker_) + loading_mem_tracker_->Cancel(); + // Main Frames will create the tracker, which will be triggered after we + // receive DidStopLoading. + // TODO(arthursonzogni): Updating this flag for same-document or bfcache + // navigation isn't right. This should be moved to DidCommitNewDocument(). + loading_mem_tracker_ = navigation_request->TakePeakGpuMemoryTracker(); } void RenderFrameHostImpl::OnSameDocumentCommitProcessed( @@ -8914,7 +8917,7 @@ std::unique_ptr<base::trace_event::TracedValue> RenderFrameHostImpl::CommitAsTracedValue( - FrameHostMsg_DidCommitProvisionalLoad_Params* params) const { + const mojom::DidCommitProvisionalLoadParams& params) const { auto value = std::make_unique<base::trace_event::TracedValue>(); // TODO(nasko): Move the process lock into RenderProcessHost. @@ -8924,42 +8927,42 @@ ->GetProcessLock(agent_scheduling_group_.GetProcess()->GetID()) .ToString()); - value->SetInteger("nav_entry_id", params->nav_entry_id); - value->SetInteger("item_sequence_number", params->item_sequence_number); + value->SetInteger("nav_entry_id", params.nav_entry_id); + value->SetInteger("item_sequence_number", params.item_sequence_number); value->SetInteger("document_sequence_number", - params->document_sequence_number); - value->SetString("url", params->url.spec()); - if (!params->base_url.is_empty()) { - value->SetString("base_url", params->base_url.possibly_invalid_spec()); + params.document_sequence_number); + value->SetString("url", params.url.spec()); + if (!params.base_url.is_empty()) { + value->SetString("base_url", params.base_url.possibly_invalid_spec()); } - value->SetInteger("transition", params->transition); + value->SetInteger("transition", params.transition); value->BeginDictionary("referrer"); - value->SetString("url", params->referrer.url.spec()); - value->SetInteger("policy", static_cast<int>(params->referrer.policy)); + value->SetString("url", params.referrer->url.spec()); + value->SetInteger("policy", static_cast<int>(params.referrer->policy)); value->EndDictionary(); - value->SetBoolean("should_update_history", params->should_update_history); - value->SetString("contents_mime_type", params->contents_mime_type); + value->SetBoolean("should_update_history", params.should_update_history); + value->SetString("contents_mime_type", params.contents_mime_type); - value->SetBoolean("intended_as_new_entry", params->intended_as_new_entry); - value->SetBoolean("did_create_new_entry", params->did_create_new_entry); + value->SetBoolean("intended_as_new_entry", params.intended_as_new_entry); + value->SetBoolean("did_create_new_entry", params.did_create_new_entry); value->SetBoolean("should_replace_current_entry", - params->should_replace_current_entry); - value->SetString("method", params->method); - value->SetInteger("post_id", params->post_id); - value->SetInteger("http_status_code", params->http_status_code); - value->SetBoolean("url_is_unreachable", params->url_is_unreachable); - value->SetString("original_request_url", params->original_request_url.spec()); + params.should_replace_current_entry); + value->SetString("method", params.method); + value->SetInteger("post_id", params.post_id); + value->SetInteger("http_status_code", params.http_status_code); + value->SetBoolean("url_is_unreachable", params.url_is_unreachable); + value->SetString("original_request_url", params.original_request_url.spec()); value->SetBoolean("is_overriding_user_agent", - params->is_overriding_user_agent); + params.is_overriding_user_agent); value->SetBoolean("history_list_was_cleared", - params->history_list_was_cleared); - value->SetString("origin", params->origin.GetDebugString()); + params.history_list_was_cleared); + value->SetString("origin", params.origin.GetDebugString()); value->SetBoolean("has_potentially_trustworthy_unique_origin", - params->has_potentially_trustworthy_unique_origin); - value->SetInteger("request_id", params->request_id); - value->SetString("navigation_token", params->navigation_token.ToString()); - if (params->embedding_token) - value->SetString("embedding_token", params->embedding_token->ToString()); + params.has_potentially_trustworthy_unique_origin); + value->SetInteger("request_id", params.request_id); + value->SetString("navigation_token", params.navigation_token.ToString()); + if (params.embedding_token) + value->SetString("embedding_token", params.embedding_token->ToString()); return value; } @@ -9067,7 +9070,7 @@ // notification containing parameters identifying the navigation. void RenderFrameHostImpl::DidCommitNavigation( std::unique_ptr<NavigationRequest> request, - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params, + mojom::DidCommitProvisionalLoadParamsPtr params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params) { // BackForwardCacheImpl::CanStoreRenderFrameHost prevents placing the pages // with in-flight navigation requests in the back-forward cache and it's not @@ -9095,7 +9098,7 @@ TRACE_EVENT2("navigation", "RenderFrameHostImpl::DidCommitProvisionalLoad", "rfh", base::trace_event::ToTracedValue(this), "params", - CommitAsTracedValue(params.get())); + CommitAsTracedValue(*params)); // If we're waiting for a cross-site beforeunload completion callback from // this renderer and we receive a Navigate message from the main frame, then @@ -9267,7 +9270,7 @@ bool RenderFrameHostImpl::MaybeInterceptCommitCallback( NavigationRequest* navigation_request, - FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) { if (commit_callback_interceptor_) { return commit_callback_interceptor_->WillProcessDidCommitNavigation(
diff --git a/content/browser/renderer_host/render_frame_host_impl.h b/content/browser/renderer_host/render_frame_host_impl.h index 7b11784e..69edba4b 100644 --- a/content/browser/renderer_host/render_frame_host_impl.h +++ b/content/browser/renderer_host/render_frame_host_impl.h
@@ -56,6 +56,7 @@ #include "content/common/frame_delete_intention.h" #include "content/common/frame_replication_state.h" #include "content/common/input/input_injector.mojom-forward.h" +#include "content/common/navigation_client.mojom-forward.h" #include "content/common/navigation_params.mojom.h" #include "content/common/render_accessibility.mojom.h" #include "content/public/browser/browser_thread.h" @@ -543,7 +544,7 @@ // midst of a DidCommitProvisionalLoad call. If |did_create_new_document| is // true the navigation was not same-document and was not served from the // back-forward cache. - void DidNavigate(const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + void DidNavigate(const mojom::DidCommitProvisionalLoadParams& params, NavigationRequest* navigation_request, bool did_create_new_document); @@ -1142,12 +1143,10 @@ // occurs immediately before a restored document is committed. void WillLeaveBackForwardCache(); - // Take ownership over the DidCommitProvisionalLoad_Params that - // were last used to commit this navigation. - // This is used by the BackForwardCache to re-commit when navigating to a - // restored page. - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> - TakeLastCommitParams(); + // Take ownership over the DidCommitProvisionalLoadParams that were last used + // to commit this navigation. This is used by the BackForwardCache to + // re-commit when navigating to a restored page. + mojom::DidCommitProvisionalLoadParamsPtr TakeLastCommitParams(); // Start a timer that will evict this RenderFrameHost from the // BackForwardCache after time to live. @@ -1252,7 +1251,7 @@ virtual bool WillProcessDidCommitNavigation( NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) = 0; }; @@ -1509,7 +1508,7 @@ // the back-forward cache. void DidCommitBackForwardCacheNavigation( NavigationRequest* committing_navigation_request, - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params); + mojom::DidCommitProvisionalLoadParamsPtr params); // Whether there's any "unload" event handlers registered on this // RenderFrameHost or subframes that share the same SiteInstance as this @@ -1822,7 +1821,7 @@ // committing a same-document navigation. // // The optional |should_commit_unreachable_url| will be set to |true| if the - // caller should verify that FrameHostMsg_DidCommitProvisionalLoad_Params' + // caller should verify that DidCommitProvisionalLoadParams' // url_is_unreachable is |true|. bool ShouldBypassSecurityChecksForErrorPage( NavigationRequest* navigation_request, @@ -2046,7 +2045,7 @@ void IssueKeepAliveHandle( mojo::PendingReceiver<blink::mojom::KeepAliveHandle> receiver) override; void DidCommitProvisionalLoad( - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params, + mojom::DidCommitProvisionalLoadParamsPtr params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params) override; void CreateChildFrame( @@ -2069,12 +2068,11 @@ // replace DidCommitProvisionalLoad in the long run. void DidCommitPerNavigationMojoInterfaceNavigation( NavigationRequest* committing_navigation_request, - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params, + mojom::DidCommitProvisionalLoadParamsPtr params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params); void DidCommitSameDocumentNavigation( - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params) - override; + mojom::DidCommitProvisionalLoadParamsPtr params) override; void BeginNavigation( mojom::CommonNavigationParamsPtr common_params, mojom::BeginNavigationParamsPtr begin_params, @@ -2283,7 +2281,7 @@ // Creates a NavigationRequest to use for commit. This should only be used // when no appropriate NavigationRequest has been found. std::unique_ptr<NavigationRequest> CreateNavigationRequestForCommit( - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + const mojom::DidCommitProvisionalLoadParams& params, bool is_same_document); // Helper to process the beforeunload completion callback. |proceed| indicates @@ -2387,10 +2385,9 @@ // Utility function used to validate potentially harmful parameters sent by // the renderer during the commit notification. // A return value of true means that the commit should proceed. - bool ValidateDidCommitParams( - NavigationRequest* navigation_request, - FrameHostMsg_DidCommitProvisionalLoad_Params* params, - bool is_same_document_navigation); + bool ValidateDidCommitParams(NavigationRequest* navigation_request, + mojom::DidCommitProvisionalLoadParams* params, + bool is_same_document_navigation); // Updates the site url if the navigation was successful and the page is not // an interstitial. @@ -2400,7 +2397,7 @@ // DidCommitPerNavigationMojoInterfaceNavigation. void DidCommitNavigation( std::unique_ptr<NavigationRequest> committing_navigation_request, - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params, + mojom::DidCommitProvisionalLoadParamsPtr params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params); // Called when we receive the confirmation that a navigation committed in the @@ -2410,14 +2407,13 @@ // state should be restored to its pre-commit value. bool DidCommitNavigationInternal( std::unique_ptr<NavigationRequest> navigation_request, - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params, + mojom::DidCommitProvisionalLoadParamsPtr params, bool is_same_document_navigation); // Called when we received the confirmation a new document committed in the // renderer. It was created from the |navigation|. - void DidCommitNewDocument( - const FrameHostMsg_DidCommitProvisionalLoad_Params& params, - NavigationRequest* navigation); + void DidCommitNewDocument(const mojom::DidCommitProvisionalLoadParams& params, + NavigationRequest* navigation); // Called by the renderer process when it is done processing a same-document // commit request. @@ -2435,7 +2431,7 @@ // Creates a TracedValue object containing the details of a committed // navigation, so it can be logged with the tracing system. std::unique_ptr<base::trace_event::TracedValue> CommitAsTracedValue( - FrameHostMsg_DidCommitProvisionalLoad_Params* params) const; + const mojom::DidCommitProvisionalLoadParams& params) const; // Creates URLLoaderFactory objects for |isolated_world_origins|. // @@ -2482,7 +2478,7 @@ // Returns true if we should proceed to the Commit callback, false otherwise. bool MaybeInterceptCommitCallback( NavigationRequest* navigation_request, - FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params); // If this RenderFrameHost is a local root (i.e., either the main frame or a @@ -3091,8 +3087,7 @@ // This used to re-commit when restoring from the BackForwardCache, with the // same params as the original navigation. // Note: If BackForwardCache is not enabled, this field is not set. - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> - last_commit_params_; + mojom::DidCommitProvisionalLoadParamsPtr last_commit_params_; blink::mojom::FrameVisibility visibility_ = blink::mojom::FrameVisibility::kRenderedInViewport;
diff --git a/content/browser/renderer_host/render_frame_host_impl_browsertest.cc b/content/browser/renderer_host/render_frame_host_impl_browsertest.cc index e7f708ac..ce53df3e 100644 --- a/content/browser/renderer_host/render_frame_host_impl_browsertest.cc +++ b/content/browser/renderer_host/render_frame_host_impl_browsertest.cc
@@ -1673,10 +1673,10 @@ bool WillProcessDidCommitNavigation( RenderFrameHost* render_frame_host, NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) override { - url_of_last_commit_ = params->url; + url_of_last_commit_ = (**params).url; if (*interface_params) { original_receiver_of_last_commit_ = std::move((*interface_params)->browser_interface_broker_receiver);
diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc index 91ce535..4cb4a1b 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc
@@ -654,6 +654,7 @@ // in the long run. For now, and to avoid complex edge cases, we simply reuse // it to preserve the understood logic in CommitPending. speculative_render_frame_host_ = std::move(entry->render_frame_host); + ValidateSpeculativeRenderFrameHostForBug1146573(); bfcache_entry_to_restore_ = std::move(entry); } @@ -696,6 +697,36 @@ } } +void RenderFrameHostManager::ValidateSpeculativeRenderFrameHostForBug1146573() { + // TODO(https://crbug.com/1146573): Remove this when the bug is closed. + if (ShouldCreateNewHostForSameSiteSubframe()) + return; + // This can happen during destruction after the RFH has been cleared. + if (!render_frame_host_) + return; + if (render_frame_host_->must_be_replaced()) + return; + if (!speculative_render_frame_host_) + return; + if (speculative_render_frame_host_->GetSiteInstance() == + render_frame_host_->GetSiteInstance()) { + // This should never be true. + SCOPED_CRASH_KEY_BOOL(ValidateSpeculative, HostsEqual, + speculative_render_frame_host_ == render_frame_host_); + DCHECK_NE(speculative_render_frame_host_, render_frame_host_); + SCOPED_CRASH_KEY_BOOL(ValidateSpeculative, Live, + render_frame_host_->IsRenderFrameLive()); + SCOPED_CRASH_KEY_STRING256( + ValidateSpeculative, OldSiteInstance, + render_frame_host_->GetSiteInstance()->GetSiteURL().spec()); + SCOPED_CRASH_KEY_STRING256( + ValidateSpeculative, NewSiteInstance, + speculative_render_frame_host_->GetSiteInstance()->GetSiteURL().spec()); + DCHECK(false); + base::debug::DumpWithoutCrashing(); + } +} + RenderFrameHostImpl* RenderFrameHostManager::GetFrameHostForNavigation( NavigationRequest* request, std::string* reason) { @@ -2363,6 +2394,7 @@ speculative_render_frame_host_ = CreateSpeculativeRenderFrame( new_instance, recovering_without_early_commit); + ValidateSpeculativeRenderFrameHostForBug1146573(); // If RenderViewHost was created along with the speculative RenderFrameHost, // ensure that RenderViewCreated is fired for it. It is important to do this @@ -3128,6 +3160,7 @@ std::unique_ptr<RenderFrameHostImpl> old_render_frame_host = std::move(render_frame_host_); render_frame_host_ = std::move(render_frame_host); + ValidateSpeculativeRenderFrameHostForBug1146573(); if (render_frame_host_ && render_frame_host_->lifecycle_state() != RenderFrameHostImpl::LifecycleState::kActive) {
diff --git a/content/browser/renderer_host/render_frame_host_manager.h b/content/browser/renderer_host/render_frame_host_manager.h index 1f757d8..ce91374f 100644 --- a/content/browser/renderer_host/render_frame_host_manager.h +++ b/content/browser/renderer_host/render_frame_host_manager.h
@@ -322,6 +322,10 @@ // new RenderFrameHost (and potentially a new process) if needed. void DidCreateNavigationRequest(NavigationRequest* request); + // Validate the speculative RFH and DumpWithoutCrashing if it's invalid. + // TODO(https://crbug.com/1146573): Remove this when the bug is closed. + void ValidateSpeculativeRenderFrameHostForBug1146573(); + // Called (possibly several times) during a navigation to select or create an // appropriate RenderFrameHost for the provided URL. The returned pointer will // be for the current or the speculative RenderFrameHost and the instance is
diff --git a/content/browser/renderer_host/render_frame_host_manager_browsertest.cc b/content/browser/renderer_host/render_frame_host_manager_browsertest.cc index 435bf75..1580c00 100644 --- a/content/browser/renderer_host/render_frame_host_manager_browsertest.cc +++ b/content/browser/renderer_host/render_frame_host_manager_browsertest.cc
@@ -472,7 +472,7 @@ // Check that the referrer is set correctly. std::string expected_referrer = - embedded_test_server()->GetURL("/click-noreferrer-links.html").spec(); + embedded_test_server()->GetURL("/").GetOrigin().spec(); success = false; EXPECT_TRUE(ExecuteScriptAndExtractBool( new_shell,
diff --git a/content/browser/renderer_host/render_widget_host_view_browsertest.cc b/content/browser/renderer_host/render_widget_host_view_browsertest.cc index 8e32e3c..c467b997 100644 --- a/content/browser/renderer_host/render_widget_host_view_browsertest.cc +++ b/content/browser/renderer_host/render_widget_host_view_browsertest.cc
@@ -163,7 +163,7 @@ bool WillProcessDidCommitNavigation( RenderFrameHost* render_frame_host, NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) override { frame_observer_->WaitForAnyFrameSubmission();
diff --git a/content/browser/security_exploit_browsertest.cc b/content/browser/security_exploit_browsertest.cc index 09c7695..326a375d 100644 --- a/content/browser/security_exploit_browsertest.cc +++ b/content/browser/security_exploit_browsertest.cc
@@ -498,7 +498,7 @@ bool WillProcessDidCommitNavigation( RenderFrameHost* render_frame_host, NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr*, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) override { interface_params->Swap(¶ms_override_); @@ -631,11 +631,11 @@ // Simulate a back navigation from the now renamed nested iframe, which would // put a PageState on the cross-site iframe's FrameNavigationEntry. Forge a // data URL within the PageState that differs from child1_url. - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params = - std::make_unique<FrameHostMsg_DidCommitProvisionalLoad_Params>(); + auto params = mojom::DidCommitProvisionalLoadParams::New(); params->nav_entry_id = nav_entry_id; params->did_create_new_entry = false; params->url = GURL("about:blank"); + params->referrer = blink::mojom::Referrer::New(); params->transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; params->should_update_history = false; params->gesture = NavigationGestureAuto; @@ -1118,10 +1118,10 @@ bool WillProcessDidCommitNavigation( RenderFrameHost* render_frame_host, NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) override { - params->url = replacement_url_; + (**params).url = replacement_url_; return true; }
diff --git a/content/browser/service_worker/service_worker_test_utils.cc b/content/browser/service_worker/service_worker_test_utils.cc index 8c369ec8..58d3220 100644 --- a/content/browser/service_worker/service_worker_test_utils.cc +++ b/content/browser/service_worker/service_worker_test_utils.cc
@@ -39,6 +39,7 @@ #include "net/base/test_completion_callback.h" #include "net/http/http_response_info.h" #include "third_party/blink/public/common/loader/throttling_url_loader.h" +#include "third_party/blink/public/mojom/loader/referrer.mojom.h" #include "third_party/blink/public/mojom/loader/transferrable_url_loader.mojom.h" namespace content { @@ -102,6 +103,15 @@ DISALLOW_COPY_AND_ASSIGN(MockPendingSharedURLLoaderFactory); }; +// The minimal DidCommitProvisionalLoadParams passing mojom validation. +mojom::DidCommitProvisionalLoadParamsPtr +MinimalDidCommitNavigationLoadParams() { + auto params = mojom::DidCommitProvisionalLoadParams::New(); + params->referrer = blink::mojom::Referrer::New(); + params->navigation_token = base::UnguessableToken::Create(); + return params; +} + class FakeNavigationClient : public mojom::NavigationClient { public: using ReceivedProviderInfoCallback = base::OnceCallback<void( @@ -133,7 +143,7 @@ blink::mojom::PolicyContainerPtr policy_container, CommitNavigationCallback callback) override { std::move(on_received_callback_).Run(std::move(container_info)); - std::move(callback).Run(nullptr, nullptr); + std::move(callback).Run(MinimalDidCommitNavigationLoadParams(), nullptr); } void CommitFailedNavigation( mojom::CommonNavigationParamsPtr common_params, @@ -144,7 +154,7 @@ const base::Optional<std::string>& error_page_content, std::unique_ptr<blink::PendingURLLoaderFactoryBundle> subresource_loaders, CommitFailedNavigationCallback callback) override { - std::move(callback).Run(nullptr, nullptr); + std::move(callback).Run(MinimalDidCommitNavigationLoadParams(), nullptr); } ReceivedProviderInfoCallback on_received_callback_; @@ -289,8 +299,7 @@ nullptr, std::move(info), mojo::NullRemote(), base::UnguessableToken::Create(), CreateStubPolicyContainer(), base::BindOnce( - [](std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> - validated_params, + [](mojom::DidCommitProvisionalLoadParamsPtr validated_params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params) {})); loop.Run();
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc index 797ef5a..cfdcb32 100644 --- a/content/browser/site_per_process_browsertest.cc +++ b/content/browser/site_per_process_browsertest.cc
@@ -4167,11 +4167,7 @@ csp_values[i].c_str()))); NavigateFrameToURL(child, urls[i]); - if (!base::FeatureList::IsEnabled(network::features::kOutOfBlinkCSPEE)) { - EXPECT_EQ(csp_values[i], child->frame_owner_properties().required_csp); - } else { - EXPECT_EQ(csp_values[i], child->csp_attribute()->header->header_value); - } + EXPECT_EQ(csp_values[i], child->csp_attribute()->header->header_value); // TODO(amalika): add checks that the CSP replication takes effect const url::Origin child_origin = @@ -12036,14 +12032,14 @@ bool WillProcessDidCommitNavigation( RenderFrameHost* render_frame_host, NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) override { // The DidCommitProvisionalLoad message is dispatched once this method // returns, so to defer committing the the navigation to |deferred_url_|, // run a nested message loop until the subsequent other commit message is // dispatched. - if (params->url == deferred_url_) { + if ((**params).url == deferred_url_) { std::move(deferred_url_triggered_action_).Run(render_frame_host); base::RunLoop nested_run_loop(base::RunLoop::Type::kNestableTasksAllowed); @@ -13174,7 +13170,7 @@ bool WillProcessDidCommitNavigation( RenderFrameHost* render_frame_host, NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) override { RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( @@ -15188,11 +15184,11 @@ // Create commit params with the same URL as the start one, so URL checks // pass, but use a different origin than the origin lock of the process. - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params = - std::make_unique<FrameHostMsg_DidCommitProvisionalLoad_Params>(); + auto params = mojom::DidCommitProvisionalLoadParams::New(); params->nav_entry_id = 0; params->did_create_new_entry = false; params->url = start_url; + params->referrer = blink::mojom::Referrer::New(); params->transition = ui::PAGE_TRANSITION_LINK; params->should_update_history = false; params->gesture = NavigationGestureAuto;
diff --git a/content/browser/web_contents/web_contents_android.cc b/content/browser/web_contents/web_contents_android.cc index 1a4fb45..8b3a9f6d 100644 --- a/content/browser/web_contents/web_contents_android.cc +++ b/content/browser/web_contents/web_contents_android.cc
@@ -291,6 +291,19 @@ return rfh->GetJavaRenderFrameHost(); } +ScopedJavaLocalRef<jobjectArray> WebContentsAndroid::GetAllRenderFrameHosts( + JNIEnv* env, + const JavaParamRef<jobject>& obj) const { + std::vector<RenderFrameHost*> frames = web_contents_->GetAllFrames(); + ScopedJavaLocalRef<jobjectArray> jframes = + Java_WebContentsImpl_createRenderFrameHostArray(env, frames.size()); + for (size_t i = 0; i < frames.size(); i++) { + Java_WebContentsImpl_addRenderFrameHostToArray( + env, jframes, i, frames[i]->GetJavaRenderFrameHost()); + } + return jframes; +} + ScopedJavaLocalRef<jstring> WebContentsAndroid::GetTitle( JNIEnv* env, const JavaParamRef<jobject>& obj) const {
diff --git a/content/browser/web_contents/web_contents_android.h b/content/browser/web_contents/web_contents_android.h index 63fd930..fc05cd6 100644 --- a/content/browser/web_contents/web_contents_android.h +++ b/content/browser/web_contents/web_contents_android.h
@@ -63,6 +63,9 @@ JNIEnv* env, jint render_process_id, jint render_frame_id) const; + base::android::ScopedJavaLocalRef<jobjectArray> GetAllRenderFrameHosts( + JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj) const; base::android::ScopedJavaLocalRef<jstring> GetTitle( JNIEnv* env, const base::android::JavaParamRef<jobject>& obj) const;
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index cef3171a..7cb1d89 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -5315,7 +5315,7 @@ void WebContentsImpl::DidNavigateMainFramePostCommit( RenderFrameHostImpl* render_frame_host, const LoadCommittedDetails& details, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { + const mojom::DidCommitProvisionalLoadParams& params) { OPTIONAL_TRACE_EVENT1( "content,navigation", "WebContentsImpl::DidNavigateMainFramePostCommit", "render_frame_host", base::trace_event::ToTracedValue(render_frame_host)); @@ -5353,7 +5353,7 @@ void WebContentsImpl::DidNavigateAnyFramePostCommit( RenderFrameHostImpl* render_frame_host, const LoadCommittedDetails& details, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { + const mojom::DidCommitProvisionalLoadParams& params) { OPTIONAL_TRACE_EVENT1( "content,navigation", "WebContentsImpl::DidNavigateAnyFramePostCommit", "render_frame_host", base::trace_event::ToTracedValue(render_frame_host));
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index c341979..20e6dbd 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -837,11 +837,11 @@ void DidNavigateMainFramePostCommit( RenderFrameHostImpl* render_frame_host, const LoadCommittedDetails& details, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override; + const mojom::DidCommitProvisionalLoadParams& params) override; void DidNavigateAnyFramePostCommit( RenderFrameHostImpl* render_frame_host, const LoadCommittedDetails& details, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override; + const mojom::DidCommitProvisionalLoadParams&) override; bool CanOverscrollContent() const override; void NotifyChangedNavigationState(InvalidateTypes changed_flags) override; bool ShouldTransferNavigation(bool is_main_frame_navigation) override;
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc index d09f1ea..835e5159 100644 --- a/content/browser/web_contents/web_contents_impl_unittest.cc +++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -263,11 +263,20 @@ cont.LoadURL(GURL(url::kAboutBlankURL), Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - FrameHostMsg_DidCommitProvisionalLoad_Params params; - InitNavigateParams(¶ms, 0, true, GURL(url::kAboutBlankURL), - ui::PAGE_TRANSITION_TYPED); + auto params = mojom::DidCommitProvisionalLoadParams::New(); + params->nav_entry_id = 0; + params->url = GURL(url::kAboutBlankURL); + params->origin = url::Origin::Create(params->url); + params->referrer = blink::mojom::Referrer::New(); + params->transition = ui::PAGE_TRANSITION_TYPED; + params->redirects = std::vector<GURL>(); + params->should_update_history = false; + params->did_create_new_entry = true; + params->gesture = NavigationGestureUser; + params->method = "GET"; + params->page_state = blink::PageState::CreateFromURL(params->url); - main_test_rfh()->SendNavigateWithParams(¶ms, + main_test_rfh()->SendNavigateWithParams(std::move(params), false /* was_within_same_document */); contents()->UpdateTitle(main_test_rfh(),
diff --git a/content/browser/webauth/webauth_browsertest.cc b/content/browser/webauth/webauth_browsertest.cc index 954835b..c83ecb12d4 100644 --- a/content/browser/webauth/webauth_browsertest.cc +++ b/content/browser/webauth/webauth_browsertest.cc
@@ -289,7 +289,7 @@ bool WillProcessDidCommitNavigation( RenderFrameHost* render_frame_host, NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) override { if (closure_)
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn index b4fd171f..bcb2264 100644 --- a/content/common/BUILD.gn +++ b/content/common/BUILD.gn
@@ -80,7 +80,6 @@ "font_list_fontconfig.cc", "frame_delete_intention.h", "frame_messages.h", - "frame_messages_forward.h", "frame_replication_state.cc", "frame_replication_state.h", "gin_java_bridge_messages.h", @@ -478,18 +477,6 @@ { types = [ { - mojom = "content.mojom.DidCommitProvisionalLoadParams" - cpp = "::std::unique_ptr<::FrameHostMsg_DidCommitProvisionalLoad_Params>" - move_only = true - nullable_is_same_type = true - }, - ] - traits_headers = [ "//content/common/frame_messages_forward.h" ] - traits_private_headers = [ "//content/common/frame_messages.h" ] - }, - { - types = [ - { mojom = "content.mojom.ContentSecurityPolicy" cpp = "::content::ContentSecurityPolicy" }, @@ -502,6 +489,10 @@ cpp = "::content::NavigationDownloadPolicy" }, { + mojom = "content.mojom.NavigationGesture" + cpp = "::content::NavigationGesture" + }, + { mojom = "content.mojom.NetworkConnectionType" cpp = "::net::NetworkChangeNotifier::ConnectionType" },
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h index 34e40d5f..7436511f 100644 --- a/content/common/frame_messages.h +++ b/content/common/frame_messages.h
@@ -210,127 +210,6 @@ IPC_STRUCT_TRAITS_MEMBER(orientation_angle) IPC_STRUCT_TRAITS_END() -// Parameters structure for mojom::FrameHost::DidCommitProvisionalLoad. -// TODO(https://crbug.com/729021, https://crbug.com/1145888): -// Convert this to a Mojo struct. -IPC_STRUCT_BEGIN(FrameHostMsg_DidCommitProvisionalLoad_Params) - // The unique ID of the NavigationEntry for browser-initiated navigations. - // This value was given to the render process in the HistoryNavigationParams - // and is being returned by the renderer without it having any idea what it - // means. If the navigation was renderer-initiated, this value is 0. - IPC_STRUCT_MEMBER(int, nav_entry_id, 0) - - // The item sequence number identifies each stop in the session history. It - // is unique within the renderer process and makes a best effort to be unique - // across browser sessions (using a renderer process timestamp). - IPC_STRUCT_MEMBER(int64_t, item_sequence_number, -1) - - // The document sequence number is used to identify cross-document navigations - // in session history. It increments for each new document and is unique in - // the same way as |item_sequence_number|. In-page navigations get a new item - // sequence number but the same document sequence number. - IPC_STRUCT_MEMBER(int64_t, document_sequence_number, -1) - - // URL of the page being loaded. - IPC_STRUCT_MEMBER(GURL, url) - - // The base URL for the page's document when the frame was committed. Empty if - // similar to 'url' above. Note that any base element in the page has not been - // parsed yet and is therefore not reflected. - // This is of interest when a MHTML file is loaded, as the base URL has been - // set to original URL of the site the MHTML represents. - IPC_STRUCT_MEMBER(GURL, base_url) - - // URL of the referrer of this load. WebKit generates this based on the - // source of the event that caused the load. - IPC_STRUCT_MEMBER(content::Referrer, referrer) - - // The type of transition. - IPC_STRUCT_MEMBER(ui::PageTransition, transition, ui::PAGE_TRANSITION_LINK) - - // Lists the redirects that occurred on the way to the current page. This - // vector has the same format as reported by the WebDataSource in the glue, - // with the current page being the last one in the list (so even when - // there's no redirect, there will be one entry in the list. - IPC_STRUCT_MEMBER(std::vector<GURL>, redirects) - - // Set to false if we want to update the session history but not update - // the browser history. E.g., on unreachable urls. - IPC_STRUCT_MEMBER(bool, should_update_history, false) - - // Contents MIME type of main frame. - IPC_STRUCT_MEMBER(std::string, contents_mime_type) - - // This is the value from the browser (copied from the navigation request) - // indicating whether it intended to make a new entry. TODO(avi): Remove this - // when the pending entry situation is made sane and the browser keeps them - // around long enough to match them via nav_entry_id. - IPC_STRUCT_MEMBER(bool, intended_as_new_entry) - - // Whether this commit created a new entry. - IPC_STRUCT_MEMBER(bool, did_create_new_entry) - - // Whether this commit should replace the current entry. - IPC_STRUCT_MEMBER(bool, should_replace_current_entry) - - // The gesture that initiated this navigation. - IPC_STRUCT_MEMBER(content::NavigationGesture, gesture) - - // The HTTP method used by the navigation. - IPC_STRUCT_MEMBER(std::string, method) - - // The POST body identifier. -1 if it doesn't exist. - IPC_STRUCT_MEMBER(int64_t, post_id) - - // The status code of the HTTP request. - IPC_STRUCT_MEMBER(int, http_status_code) - - // This flag is used to warn if the renderer is displaying an error page, - // so that we can set the appropriate page type. - IPC_STRUCT_MEMBER(bool, url_is_unreachable) - - // Serialized history item state to store in the navigation entry. - IPC_STRUCT_MEMBER(blink::PageState, page_state) - - // Original request's URL. - IPC_STRUCT_MEMBER(GURL, original_request_url) - - // User agent override used to navigate. - IPC_STRUCT_MEMBER(bool, is_overriding_user_agent) - - // Notifies the browser that for this navigation, the session history was - // successfully cleared. - IPC_STRUCT_MEMBER(bool, history_list_was_cleared) - - // Origin of the frame. This will be replicated to any associated - // RenderFrameProxies. - IPC_STRUCT_MEMBER(url::Origin, origin) - - // The insecure request policy the document for the load is enforcing. - IPC_STRUCT_MEMBER(blink::mojom::InsecureRequestPolicy, - insecure_request_policy) - - // The upgrade insecure navigations set the document for the load is - // enforcing. - IPC_STRUCT_MEMBER(std::vector<uint32_t>, insecure_navigations_set) - - // True if the document for the load is a unique origin that should be - // considered potentially trustworthy. - IPC_STRUCT_MEMBER(bool, has_potentially_trustworthy_unique_origin) - - // Request ID generated by the renderer. - IPC_STRUCT_MEMBER(int, request_id) - - // A token that has been passed by the browser process when it asked the - // renderer process to commit the navigation. - IPC_STRUCT_MEMBER(base::UnguessableToken, navigation_token) - - // An embedding token used to signify the relationship between a document and - // its parent. This is populated for cross-document navigations including - // sub-documents and the main document. - IPC_STRUCT_MEMBER(base::Optional<base::UnguessableToken>, embedding_token) -IPC_STRUCT_END() - IPC_STRUCT_TRAITS_BEGIN(blink::ParsedFeaturePolicyDeclaration) IPC_STRUCT_TRAITS_MEMBER(feature) IPC_STRUCT_TRAITS_MEMBER(allowed_origins)
diff --git a/content/common/frame_messages.mojom b/content/common/frame_messages.mojom index fff7765..0dcf5dc8 100644 --- a/content/common/frame_messages.mojom +++ b/content/common/frame_messages.mojom
@@ -7,9 +7,6 @@ import "services/service_manager/public/mojom/interface_provider.mojom"; import "third_party/blink/public/mojom/browser_interface_broker.mojom"; -[Native] -struct DidCommitProvisionalLoadParams; - struct DidCommitProvisionalLoadInterfaceParams { pending_receiver<service_manager.mojom.InterfaceProvider> interface_provider_receiver;
diff --git a/content/common/frame_messages_forward.h b/content/common/frame_messages_forward.h deleted file mode 100644 index 3e83e19..0000000 --- a/content/common/frame_messages_forward.h +++ /dev/null
@@ -1,25 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_COMMON_FRAME_MESSAGES_FORWARD_H_ -#define CONTENT_COMMON_FRAME_MESSAGES_FORWARD_H_ - -// Forward-declaration for FrameHostMsg_DidCommitProvisionalLoad_Params, which -// is typemapped to a Mojo [Native] type used by content::mojom::FrameHost. This -// means that the generated header for mojom::FrameHost requires (at least) a -// forward declaration of the legacy IPC struct type. -// -// Including content/common/frame_messages.h in the generated header for -// mojom::FrameHost is, however, not possible because legacy IPC struct type -// definition headers must be included exactly once in each translation unit -// using them, so any .cc files directly/indirectly including frame_messages.h -// could no longer include the generated header for mojom::FrameHost. Hence the -// generated header for mojom::FrameHost does not include frame_messages.h, but -// instead includes the forward-declaration below. -// -// TODO(https://crbug.com/729021): Eventually convert this legacy IPC struct to -// a proper Mojo type. -struct FrameHostMsg_DidCommitProvisionalLoad_Params; - -#endif // CONTENT_COMMON_FRAME_MESSAGES_FORWARD_H_
diff --git a/content/common/navigation_client.mojom b/content/common/navigation_client.mojom index 0b935bf1..e8286dce 100644 --- a/content/common/navigation_client.mojom +++ b/content/common/navigation_client.mojom
@@ -4,20 +4,156 @@ module content.mojom; -import "services/network/public/mojom/host_resolver.mojom"; -import "services/network/public/mojom/url_response_head.mojom"; -import "services/network/public/mojom/url_loader.mojom"; -import "services/network/public/mojom/url_loader_factory.mojom"; import "content/common/frame_messages.mojom"; import "content/common/navigation_params.mojom"; import "mojo/public/mojom/base/unguessable_token.mojom"; -import "url/mojom/url.mojom"; +import "services/network/public/mojom/host_resolver.mojom"; +import "services/network/public/mojom/url_loader.mojom"; +import "services/network/public/mojom/url_loader_factory.mojom"; +import "services/network/public/mojom/url_response_head.mojom"; +import "third_party/blink/public/mojom/commit_result/commit_result.mojom"; import "third_party/blink/public/mojom/frame/policy_container.mojom"; +import "third_party/blink/public/mojom/loader/referrer.mojom"; import "third_party/blink/public/mojom/loader/transferrable_url_loader.mojom"; import "third_party/blink/public/mojom/loader/url_loader_factory_bundle.mojom"; +import "third_party/blink/public/mojom/security_context/insecure_request_policy.mojom"; import "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_container.mojom"; -import "third_party/blink/public/mojom/commit_result/commit_result.mojom"; +import "url/mojom/origin.mojom"; +import "url/mojom/url.mojom"; + +[Native] +enum NavigationGesture; + +[Native] +enum PageTransition; + +[Native] +struct PageState; + +// Parameters structure used in the IPC: +// - FrameHost.DidCommitProvisionalLoad +// - FrameHost.DidCommitSameDocumentNavigation +// - NavigationClient.CommitNavigationCallback +// - NavigationClient.CommitFailedNavigationCallback +struct DidCommitProvisionalLoadParams { + // The unique ID of the NavigationEntry for browser-initiated navigations. + // This value was given to the render process in the HistoryNavigationParams + // and is being returned by the renderer without it having any idea what it + // means. If the navigation was renderer-initiated, this value is 0. + int32 nav_entry_id = 0; + + // The item sequence number identifies each stop in the session history. It + // is unique within the renderer process and makes a best effort to be unique + // across browser sessions (using a renderer process timestamp). + int64 item_sequence_number = -1; + + // The document sequence number is used to identify cross-document navigations + // in session history. It increments for each new document and is unique in + // the same way as |item_sequence_number|. In-page navigations get a new item + // sequence number but the same document sequence number. + int64 document_sequence_number = -1; + + // URL of the page being loaded. + url.mojom.Url url; + + // The base URL for the page's document when the frame was committed. Empty if + // similar to 'url' above. Note that any base element in the page has not been + // parsed yet and is therefore not reflected. + // This is of interest when a MHTML file is loaded, as the base URL has been + // set to original URL of the site the MHTML represents. + url.mojom.Url base_url; + + // URL of the referrer of this load. WebKit generates this based on the + // source of the event that caused the load. + blink.mojom.Referrer referrer; + + // The type of transition. + // [Native] enums are by default initialized to 0 (i.e. PAGE_TRANSITION_LINK) + PageTransition transition; + + // Lists the redirects that occurred on the way to the current page. This + // vector has the same format as reported by the WebDataSource in the glue, + // with the current page being the last one in the list (so even when + // there's no redirect, there will be one entry in the list. + array<url.mojom.Url> redirects; + + // Set to false if we want to update the session history but not update + // the browser history. E.g., on unreachable urls. + bool should_update_history = false; + + // Contents MIME type of main frame. + string contents_mime_type; + + // This is the value from the browser (copied from the navigation request) + // indicating whether it intended to make a new entry. TODO(avi): Remove this + // when the pending entry situation is made sane and the browser keeps them + // around long enough to match them via nav_entry_id. + bool intended_as_new_entry; + + // Whether this commit created a new entry. + bool did_create_new_entry; + + // Whether this commit should replace the current entry. + bool should_replace_current_entry; + + // The gesture that initiated this navigation. + NavigationGesture gesture; + + // The HTTP method used by the navigation. + string method; + + // The POST body identifier. -1 if it doesn't exist. + int64 post_id; + + // The status code of the HTTP request. + int32 http_status_code; + + // This flag is used to warn if the renderer is displaying an error page, + // so that we can set the appropriate page type. + bool url_is_unreachable; + + // Serialized history item state to store in the navigation entry. + PageState page_state; + + // Original request's URL. + url.mojom.Url original_request_url; + + // User agent override used to navigate. + bool is_overriding_user_agent; + + // Notifies the browser that for this navigation, the session history was + // successfully cleared. + bool history_list_was_cleared; + + // Origin of the frame. This will be replicated to any associated + // RenderFrameProxies. + url.mojom.Origin origin; + + // The insecure request policy the document for the load is enforcing. + blink.mojom.InsecureRequestPolicy insecure_request_policy; + + // The upgrade insecure navigations set the document for the load is + // enforcing. + array<uint32> insecure_navigations_set; + + // True if the document for the load is a unique origin that should be + // considered potentially trustworthy. + bool has_potentially_trustworthy_unique_origin; + + // Request ID generated by the renderer. + int32 request_id; + + // A token that has been passed by the browser process when it asked the + // renderer process to commit the navigation. + mojo_base.mojom.UnguessableToken navigation_token; + + // An embedding token used to signify the relationship between a document and + // its parent. This is populated for cross-document navigations including + // sub-documents and the main document. + mojo_base.mojom.UnguessableToken? embedding_token; +}; + interface NavigationClient { // Tells the renderer that a navigation is ready to commit.
diff --git a/content/common/navigation_params.mojom b/content/common/navigation_params.mojom index 072da3b..949fa74b 100644 --- a/content/common/navigation_params.mojom +++ b/content/common/navigation_params.mojom
@@ -340,7 +340,7 @@ // For browser-initiated navigations, this is the unique id of the // NavigationEntry being navigated to. (For renderer-initiated navigations it // is 0.) If the load succeeds, then this nav_entry_id will be reflected in - // the resulting FrameHostMsg_DidCommitProvisionalLoad_Params. + // the resulting DidCommitProvisionalLoadParams. int32 nav_entry_id = 0; // If this is a history navigation, this contains a map of frame unique names
diff --git a/content/common/renderer.mojom b/content/common/renderer.mojom index ecb1d23..70ab352 100644 --- a/content/common/renderer.mojom +++ b/content/common/renderer.mojom
@@ -6,6 +6,7 @@ import "content/common/agent_scheduling_group.mojom"; import "content/common/native_types.mojom"; +import "ipc/ipc.mojom"; import "mojo/public/mojom/base/generic_pending_receiver.mojom"; import "mojo/public/mojom/base/time.mojom"; import "services/network/public/mojom/network_types.mojom"; @@ -58,22 +59,24 @@ // This should be used for implementing browser-to-renderer control messages // which need to retain FIFO with respect to legacy IPC messages. interface Renderer { - // Tells the renderer to create a new AgentSchedulingGroup, that will - // listen to messages sent by the host via the pending - // |agent_scheduling_group|. This will create "independent" agent scheduling - // groups that are not associated with the IPC channel, which will not - // guarantee any order across agent scheduling groups. + // Tells the renderer to create a new AgentSchedulingGroup, and initialize its + // legacy IPC Channel using the pipe provided by `bootstrap`. The channel will + // later be used to bind the mojom::AgentSchedulingGroup receiver, that + // listens to messages sent by the host. + // This will create an "independent" agent scheduling group that is not + // associated with the process-wide or other groups' IPC channels, meaning + // there is no guaranteed ordering between them. CreateAgentSchedulingGroup( - pending_receiver<AgentSchedulingGroup> agent_scheduling_group - ); + pending_receiver<IPC.mojom.ChannelBootstrap> bootstrap); // Tells the renderer to create a new AgentSchedulingGroup, that will // listen to messages sent by the host via the pending - // |agent_scheduling_group|. This will create a channel-associated interface - // that will preserve message ordering across agent scheduling groups. + // |agent_scheduling_group|. + // This will create an agent scheduling group that is associated with the + // process-wide IPC channel, preserving message ordering across different + // agent scheduling groups. CreateAssociatedAgentSchedulingGroup( - pending_associated_receiver<AgentSchedulingGroup> agent_scheduling_group - ); + pending_associated_receiver<AgentSchedulingGroup> agent_scheduling_group); // Tells the renderer that the network type has changed so that // navigator.onLine and navigator.connection can be updated.
diff --git a/content/public/android/java/src/org/chromium/content/browser/remoteobjects/RemoteObjectInjector.java b/content/public/android/java/src/org/chromium/content/browser/remoteobjects/RemoteObjectInjector.java index 42016f5..0750ca5 100644 --- a/content/public/android/java/src/org/chromium/content/browser/remoteobjects/RemoteObjectInjector.java +++ b/content/public/android/java/src/org/chromium/content/browser/remoteobjects/RemoteObjectInjector.java
@@ -6,6 +6,7 @@ import org.chromium.blink.mojom.RemoteObjectGateway; import org.chromium.blink.mojom.RemoteObjectGatewayFactory; +import org.chromium.content.browser.webcontents.WebContentsImpl; import org.chromium.content_public.browser.RenderFrameHost; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContentsObserver; @@ -16,6 +17,7 @@ import java.lang.annotation.Annotation; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; @@ -85,7 +87,7 @@ public void addInterface( Object object, String name, Class<? extends Annotation> requiredAnnotation) { - WebContents webContents = mWebContents.get(); + WebContentsImpl webContents = (WebContentsImpl) mWebContents.get(); if (webContents == null) return; Pair<Object, Class<? extends Annotation>> value = mInjectedObjects.get(name); @@ -100,32 +102,35 @@ mInjectedObjects.put(name, new Pair<>(object, requiredAnnotation)); - // TODO(crbug.com/1105935): the objects need to be injected into all frames, not just the - // main one. - addInterfaceForFrame(webContents.getMainFrame(), name, object, requiredAnnotation); + List<RenderFrameHost> frames = webContents.getAllRenderFrameHosts(); + for (RenderFrameHost frame : frames) { + addInterfaceForFrame(frame, name, object, requiredAnnotation); + } } public void removeInterface(String name) { - WebContents webContents = mWebContents.get(); + WebContentsImpl webContents = (WebContentsImpl) mWebContents.get(); if (webContents == null) return; Pair<Object, Class<? extends Annotation>> value = mInjectedObjects.remove(name); if (value == null) return; - // TODO(crbug.com/1105935): the objects need to be removed from all frames, not just the - // main one. - removeInterfaceForFrame(webContents.getMainFrame(), name, value.first); + List<RenderFrameHost> frames = webContents.getAllRenderFrameHosts(); + for (RenderFrameHost frame : frames) { + removeInterfaceForFrame(frame, name, value.first); + } } public void setAllowInspection(boolean allow) { - WebContents webContents = mWebContents.get(); + WebContentsImpl webContents = (WebContentsImpl) mWebContents.get(); if (webContents == null) return; mAllowInspection = allow; - // TODO(crbug.com/1105935): the objects host needs to update the allow status from all - // frames, not just the main one. - setAllowInspectionForFrame(webContents.getMainFrame()); + List<RenderFrameHost> frames = webContents.getAllRenderFrameHosts(); + for (RenderFrameHost frame : frames) { + setAllowInspectionForFrame(frame); + } } private void addInterfaceForFrame(RenderFrameHost frameHost, String name, Object object,
diff --git a/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java b/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java index 762c3afb..990f553 100644 --- a/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java +++ b/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java
@@ -391,6 +391,24 @@ mNativeWebContentsAndroid, renderProcessId, renderFrameId); } + public List<RenderFrameHost> getAllRenderFrameHosts() { + checkNotDestroyed(); + RenderFrameHost[] frames = WebContentsImplJni.get().getAllRenderFrameHosts( + mNativeWebContentsAndroid, WebContentsImpl.this); + return Collections.unmodifiableList(Arrays.asList(frames)); + } + + @CalledByNative + private static RenderFrameHost[] createRenderFrameHostArray(int size) { + return new RenderFrameHost[size]; + } + + @CalledByNative + private static void addRenderFrameHostToArray( + RenderFrameHost[] frames, int index, RenderFrameHost frame) { + frames[index] = frame; + } + @Override public @Nullable RenderWidgetHostViewImpl getRenderWidgetHostView() { if (mNativeWebContentsAndroid == 0) return null; @@ -1061,6 +1079,8 @@ RenderFrameHost getFocusedFrame(long nativeWebContentsAndroid, WebContentsImpl caller); RenderFrameHost getRenderFrameHostFromId( long nativeWebContentsAndroid, int renderProcessId, int renderFrameId); + RenderFrameHost[] getAllRenderFrameHosts( + long nativeWebContentsAndroid, WebContentsImpl caller); RenderWidgetHostViewImpl getRenderWidgetHostView( long nativeWebContentsAndroid, WebContentsImpl caller); WebContentsImpl[] getInnerWebContents(
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java index d1e4612..3854e0b 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java
@@ -75,6 +75,7 @@ mActivityTestRule.injectObjectAndReload(mTestController, "testController"); } + // TODO(crbug.com/1116744): Fix flakiness when using MojoTestParams. @Test @SmallTest @Feature({"AndroidWebView", "Android-JavaBridge"}) @@ -118,6 +119,7 @@ // Verify that parent page and child frame each has own JS wrapper object. // Failing to do so exposes parent's context to the child. + // TODO(crbug.com/1116744): Fix flakiness when using MojoTestParams. @Test @SmallTest @Feature({"AndroidWebView", "Android-JavaBridge"})
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index 5624a61..62956cc 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc
@@ -549,12 +549,12 @@ bool WillProcessDidCommitNavigation( RenderFrameHost* render_frame_host, NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) override { - if (params->url == target_url_) { - params->url = new_url_; - params->origin = new_origin_; + if ((**params).url == target_url_) { + (**params).url = new_url_; + (**params).origin = new_origin_; } return true; }
diff --git a/content/renderer/agent_scheduling_group.cc b/content/renderer/agent_scheduling_group.cc index a253662..73f3252 100644 --- a/content/renderer/agent_scheduling_group.cc +++ b/content/renderer/agent_scheduling_group.cc
@@ -6,16 +6,22 @@ #include "base/feature_list.h" #include "base/util/type_safety/pass_key.h" +#include "content/common/agent_scheduling_group.mojom.h" #include "content/public/common/content_features.h" #include "content/renderer/compositor/compositor_dependencies.h" #include "content/renderer/render_frame_proxy.h" #include "content/renderer/render_thread_impl.h" #include "content/renderer/render_view_impl.h" +#include "ipc/ipc_channel_mojo.h" +#include "ipc/ipc_listener.h" +#include "ipc/ipc_sync_channel.h" #include "third_party/blink/public/platform/scheduler/web_thread_scheduler.h" namespace content { +using ::IPC::ChannelMojo; using ::IPC::Listener; +using ::IPC::SyncChannel; using ::mojo::AssociatedReceiver; using ::mojo::AssociatedRemote; using ::mojo::PendingAssociatedReceiver; @@ -35,53 +41,49 @@ } // namespace -// MaybeAssociatedReceiver: -AgentSchedulingGroup::MaybeAssociatedReceiver::MaybeAssociatedReceiver( - AgentSchedulingGroup& impl, - PendingReceiver<mojom::AgentSchedulingGroup> receiver, - scoped_refptr<base::SingleThreadTaskRunner> task_runner) - : receiver_(absl::in_place_type<Receiver<mojom::AgentSchedulingGroup>>, - &impl, - std::move(receiver), - task_runner) {} - -AgentSchedulingGroup::MaybeAssociatedReceiver::MaybeAssociatedReceiver( - AgentSchedulingGroup& impl, - PendingAssociatedReceiver<mojom::AgentSchedulingGroup> receiver, - scoped_refptr<base::SingleThreadTaskRunner> task_runner) - : receiver_( - absl::in_place_type<AssociatedReceiver<mojom::AgentSchedulingGroup>>, - &impl, - std::move(receiver), - task_runner) {} - -AgentSchedulingGroup::MaybeAssociatedReceiver::~MaybeAssociatedReceiver() = - default; - // AgentSchedulingGroup: AgentSchedulingGroup::AgentSchedulingGroup( RenderThread& render_thread, - PendingReceiver<mojom::AgentSchedulingGroup> receiver) - : agent_group_scheduler_( + mojo::PendingReceiver<IPC::mojom::ChannelBootstrap> bootstrap) + : association_mode_(IPCAssociationMode::kUnassociated), + agent_group_scheduler_( blink::scheduler::WebThreadScheduler::MainThreadScheduler() ->CreateAgentGroupScheduler()), render_thread_(render_thread), - receiver_(*this, - std::move(receiver), - agent_group_scheduler_->DefaultTaskRunner()) { + // `receiver_` will be bound by `OnAssociatedInterfaceRequest()`. + receiver_(this) { DCHECK(agent_group_scheduler_); DCHECK(base::FeatureList::IsEnabled( features::kMbiDetachAgentSchedulingGroupFromChannel)); + + channel_ = SyncChannel::Create( + /*listener=*/this, /*ipc_task_runner=*/render_thread_.GetIOTaskRunner(), + /*listener_task_runner=*/agent_group_scheduler_->DefaultTaskRunner(), + render_thread_.GetShutdownEvent()); + + // TODO(crbug.com/1111231): Add necessary filters. + // Currently, the renderer process has these filters: + // 1. `UnfreezableMessageFilter` - in the process of being removed, + // 2. `PnaclTranslationResourceHost` - NaCl is going away, and + // 3. `AutomationMessageFilter` - needs to be handled somehow. + + channel_->Init( + ChannelMojo::CreateClientFactory( + bootstrap.PassPipe(), + /*ipc_task_runner=*/render_thread_.GetIOTaskRunner(), + /*proxy_task_runner=*/agent_group_scheduler_->DefaultTaskRunner()), + /*create_pipe_now=*/true); } AgentSchedulingGroup::AgentSchedulingGroup( RenderThread& render_thread, PendingAssociatedReceiver<mojom::AgentSchedulingGroup> receiver) - : agent_group_scheduler_( + : association_mode_(IPCAssociationMode::kAssociatedWithProcess), + agent_group_scheduler_( blink::scheduler::WebThreadScheduler::MainThreadScheduler() ->CreateAgentGroupScheduler()), render_thread_(render_thread), - receiver_(*this, + receiver_(this, std::move(receiver), agent_group_scheduler_->DefaultTaskRunner()) { DCHECK(agent_group_scheduler_); @@ -91,12 +93,49 @@ AgentSchedulingGroup::~AgentSchedulingGroup() = default; -// IPC messages to be forwarded to the `RenderThread`, for now. In the future -// they will be handled directly by the `AgentSchedulingGroup`. +bool AgentSchedulingGroup::OnMessageReceived(const IPC::Message& message) { + DCHECK_NE(message.routing_id(), MSG_ROUTING_CONTROL); + + auto* listener = GetListener(message.routing_id()); + if (!listener) + return false; + + return listener->OnMessageReceived(message); +} + +void AgentSchedulingGroup::OnBadMessageReceived(const IPC::Message& message) { + // Not strictly required, since we don't currently do anything with bad + // messages in the renderer, but if we ever do then this will "just work". + return ToImpl(render_thread_).OnBadMessageReceived(message); +} + +void AgentSchedulingGroup::OnAssociatedInterfaceRequest( + const std::string& interface_name, + mojo::ScopedInterfaceEndpointHandle handle) { + // The ASG's channel should only be used to bootstrap the ASG mojo interface. + DCHECK_EQ(interface_name, mojom::AgentSchedulingGroup::Name_); + DCHECK(!receiver_.is_bound()); + + PendingAssociatedReceiver<mojom::AgentSchedulingGroup> pending_receiver( + std::move(handle)); + receiver_.Bind(std::move(pending_receiver), + agent_group_scheduler_->DefaultTaskRunner()); +} + bool AgentSchedulingGroup::Send(IPC::Message* message) { - // TODO(crbug.com/1111231): For some reason, changing this to use - // render_thread_ causes trybots to time out (not specific tests). - return RenderThread::Get()->Send(message); + std::unique_ptr<IPC::Message> msg(message); + + if (association_mode_ == IPCAssociationMode::kAssociatedWithProcess) + return render_thread_.Send(msg.release()); + + // This DCHECK is too idealistic for now - messages that are handled by + // filters are sent control messages since they are intercepted before + // routing. It is put here as documentation for now, since this code would not + // be reached until we activate `kUnassociated`. + DCHECK_NE(message->routing_id(), MSG_ROUTING_CONTROL); + + DCHECK(channel_); + return channel_->Send(msg.release()); } void AgentSchedulingGroup::AddRoute(int32_t routing_id, Listener* listener) {
diff --git a/content/renderer/agent_scheduling_group.h b/content/renderer/agent_scheduling_group.h index 90ed0f5..0ac011db 100644 --- a/content/renderer/agent_scheduling_group.h +++ b/content/renderer/agent_scheduling_group.h
@@ -9,18 +9,19 @@ #include "content/common/agent_scheduling_group.mojom.h" #include "content/common/associated_interfaces.mojom.h" #include "content/common/content_export.h" +#include "ipc/ipc.mojom.h" +#include "ipc/ipc_listener.h" #include "mojo/public/cpp/bindings/associated_receiver.h" #include "mojo/public/cpp/bindings/associated_receiver_set.h" #include "mojo/public/cpp/bindings/associated_remote.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" -#include "third_party/abseil-cpp/absl/types/variant.h" #include "third_party/blink/public/mojom/associated_interfaces/associated_interfaces.mojom.h" #include "third_party/blink/public/platform/scheduler/web_agent_group_scheduler.h" namespace IPC { -class Listener; class Message; +class SyncChannel; } // namespace IPC namespace content { @@ -33,22 +34,21 @@ // to obtain ordering guarantees between different Mojo (associated) interfaces // and legacy IPC messages. class CONTENT_EXPORT AgentSchedulingGroup - : public mojom::AgentSchedulingGroup, + : public IPC::Listener, + public mojom::AgentSchedulingGroup, public mojom::RouteProvider, public blink::mojom::AssociatedInterfaceProvider { public: AgentSchedulingGroup( RenderThread& render_thread, - mojo::PendingReceiver<mojom::AgentSchedulingGroup> receiver); + mojo::PendingReceiver<IPC::mojom::ChannelBootstrap> bootstrap); AgentSchedulingGroup( RenderThread& render_thread, mojo::PendingAssociatedReceiver<mojom::AgentSchedulingGroup> receiver); ~AgentSchedulingGroup() override; AgentSchedulingGroup(const AgentSchedulingGroup&) = delete; - AgentSchedulingGroup(const AgentSchedulingGroup&&) = delete; AgentSchedulingGroup& operator=(const AgentSchedulingGroup&) = delete; - AgentSchedulingGroup& operator=(const AgentSchedulingGroup&&) = delete; bool Send(IPC::Message* message); void AddRoute(int32_t routing_id, IPC::Listener* listener); @@ -62,32 +62,12 @@ } private: - // `MaybeAssociatedReceiver` is a temporary helper class that allows us to - // switch between using an associated and non-associated receiver. This - // behavior is controlled by the `kMbiDetachAgentSchedulingGroupFromChannel` - // feature flag. Associated receivers are associated with the IPC channel - // (transitively, via the `Renderer` interface), thus preserving cross-agent - // scheduling group message order. Non-associated receivers are independent - // from each other and do not preserve message order between agent scheduling - // groups. - // TODO(crbug.com/1111231): Remove these once we can remove the flag. - class MaybeAssociatedReceiver { - public: - MaybeAssociatedReceiver( - AgentSchedulingGroup& impl, - mojo::PendingReceiver<mojom::AgentSchedulingGroup> receiver, - scoped_refptr<base::SingleThreadTaskRunner> task_runner); - MaybeAssociatedReceiver( - AgentSchedulingGroup& impl, - mojo::PendingAssociatedReceiver<mojom::AgentSchedulingGroup> receiver, - scoped_refptr<base::SingleThreadTaskRunner> task_runner); - ~MaybeAssociatedReceiver(); - - private: - absl::variant<mojo::Receiver<mojom::AgentSchedulingGroup>, - mojo::AssociatedReceiver<mojom::AgentSchedulingGroup>> - receiver_; - }; + // IPC::Listener: + bool OnMessageReceived(const IPC::Message& message) override; + void OnBadMessageReceived(const IPC::Message& message) override; + void OnAssociatedInterfaceRequest( + const std::string& interface_name, + mojo::ScopedInterfaceEndpointHandle handle) override; // mojom::AgentSchedulingGroup: void CreateView(mojom::CreateViewParamsPtr params) override; @@ -122,6 +102,23 @@ IPC::Listener* GetListener(int32_t routing_id); + enum class IPCAssociationMode { + // In this mode, the AgentSchedulingGroup will use the process-wide legacy + // IPC channel for communication with the renderer process and to associate + // its interfaces with. + kAssociatedWithProcess = 0, + + // In this mode, each AgentSchedulingGroup will have its own legacy IPC + // channel for communication with the renderer process and to associate its + // interfaces with. + kUnassociated = 1, + }; + const IPCAssociationMode association_mode_; + + // This AgentSchedulingGroup's legacy IPC channel. Will only be used in + // `kUnassociated` mode. + std::unique_ptr<IPC::SyncChannel> channel_; + // Map of registered IPC listeners. base::IDMap<IPC::Listener*> listener_map_; @@ -133,7 +130,7 @@ // Implementation of `mojom::AgentSchedulingGroup`, used for responding to // calls from the (browser-side) `AgentSchedulingGroupHost`. - MaybeAssociatedReceiver receiver_; + mojo::AssociatedReceiver<mojom::AgentSchedulingGroup> receiver_; // Remote stub of mojom::AgentSchedulingGroupHost, used for sending calls to // the (browser-side) AgentSchedulingGroupHost.
diff --git a/content/renderer/navigation_state.cc b/content/renderer/navigation_state.cc index d16d0fd..de19362 100644 --- a/content/renderer/navigation_state.cc +++ b/content/renderer/navigation_state.cc
@@ -56,7 +56,7 @@ } void NavigationState::RunCommitNavigationCallback( - std::unique_ptr<::FrameHostMsg_DidCommitProvisionalLoad_Params> params, + mojom::DidCommitProvisionalLoadParamsPtr params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params) { if (commit_callback_) { std::move(commit_callback_)
diff --git a/content/renderer/navigation_state.h b/content/renderer/navigation_state.h index bcbc454b..18527a3 100644 --- a/content/renderer/navigation_state.h +++ b/content/renderer/navigation_state.h
@@ -14,8 +14,6 @@ #include "content/common/navigation_params.mojom.h" #include "content/renderer/navigation_client.h" -struct FrameHostMsg_DidCommitProvisionalLoad_Params; - namespace blink { class WebDocumentLoader; @@ -69,7 +67,7 @@ } void RunCommitNavigationCallback( - std::unique_ptr<::FrameHostMsg_DidCommitProvisionalLoad_Params> params, + mojom::DidCommitProvisionalLoadParamsPtr params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params); private:
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index de20605..3792922 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -57,6 +57,7 @@ #include "content/common/frame_messages.h" #include "content/common/frame_replication_state.h" #include "content/common/input_messages.h" +#include "content/common/navigation_client.mojom.h" #include "content/common/navigation_gesture.h" #include "content/common/navigation_params.h" #include "content/common/navigation_params_mojom_traits.h" @@ -4968,7 +4969,7 @@ : RenderFrameImpl::FromWebFrame(frame_->LocalRoot()); } -std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> +mojom::DidCommitProvisionalLoadParamsPtr RenderFrameImpl::MakeDidCommitProvisionalLoadParams( blink::WebHistoryCommitType commit_type, ui::PageTransition transition, @@ -4981,8 +4982,7 @@ frame_->GetDocumentLoader()); NavigationState* navigation_state = internal_data->navigation_state(); - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params = - std::make_unique<FrameHostMsg_DidCommitProvisionalLoad_Params>(); + auto params = mojom::DidCommitProvisionalLoadParams::New(); params->http_status_code = response.HttpStatusCode(); params->url_is_unreachable = document_loader->HasUnreachableURL(); params->method = "GET"; @@ -5058,12 +5058,12 @@ // If the page contained a client redirect (meta refresh, document.loc...), // set the referrer appropriately. if (document_loader->IsClientRedirect()) { - params->referrer = - Referrer(params->redirects[0], document_loader->GetReferrerPolicy()); + params->referrer = blink::mojom::Referrer::New( + params->redirects[0], document_loader->GetReferrerPolicy()); } else { - params->referrer = - Referrer(blink::WebStringToGURL(document_loader->Referrer()), - document_loader->GetReferrerPolicy()); + params->referrer = blink::mojom::Referrer::New( + blink::WebStringToGURL(document_loader->Referrer()), + document_loader->GetReferrerPolicy()); } if (!frame_->Parent()) {
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index 22851071..b02f52d 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h
@@ -1062,9 +1062,8 @@ void ShowDeferredContextMenu(const UntrustworthyContextMenuParams& params); - // Build DidCommitProvisionalLoad_Params based on the frame internal state. - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> - MakeDidCommitProvisionalLoadParams( + // Build DidCommitProvisionalLoadParams based on the frame internal state. + mojom::DidCommitProvisionalLoadParamsPtr MakeDidCommitProvisionalLoadParams( blink::WebHistoryCommitType commit_type, ui::PageTransition transition, const base::Optional<base::UnguessableToken>& embedding_token);
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 5a43139..b0dc8414 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -1642,9 +1642,9 @@ } void RenderThreadImpl::CreateAgentSchedulingGroup( - mojo::PendingReceiver<mojom::AgentSchedulingGroup> agent_scheduling_group) { - agent_scheduling_groups_.emplace(std::make_unique<AgentSchedulingGroup>( - *this, std::move(agent_scheduling_group))); + mojo::PendingReceiver<IPC::mojom::ChannelBootstrap> bootstrap) { + agent_scheduling_groups_.emplace( + std::make_unique<AgentSchedulingGroup>(*this, std::move(bootstrap))); } void RenderThreadImpl::CreateAssociatedAgentSchedulingGroup(
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index 989f770..a195f88f 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h
@@ -439,8 +439,7 @@ // mojom::Renderer: void CreateAgentSchedulingGroup( - mojo::PendingReceiver<mojom::AgentSchedulingGroup> agent_scheduling_group) - override; + mojo::PendingReceiver<IPC::mojom::ChannelBootstrap> bootstrap) override; void CreateAssociatedAgentSchedulingGroup( mojo::PendingAssociatedReceiver<mojom::AgentSchedulingGroup> agent_scheduling_group) override;
diff --git a/content/test/did_commit_navigation_interceptor.cc b/content/test/did_commit_navigation_interceptor.cc index f97d72a..f2ba2ce2 100644 --- a/content/test/did_commit_navigation_interceptor.cc +++ b/content/test/did_commit_navigation_interceptor.cc
@@ -29,7 +29,7 @@ bool WillProcessDidCommitNavigation( NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) override { return interceptor_->WillProcessDidCommitNavigation( @@ -87,9 +87,9 @@ bool CommitMessageDelayer::WillProcessDidCommitNavigation( RenderFrameHost* render_frame_host, NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) { - if (params->url == deferred_url_) { + if ((**params).url == deferred_url_) { std::move(deferred_action_).Run(render_frame_host); if (run_loop_) run_loop_->Quit();
diff --git a/content/test/did_commit_navigation_interceptor.h b/content/test/did_commit_navigation_interceptor.h index 3a18c0f..7ed18bc 100644 --- a/content/test/did_commit_navigation_interceptor.h +++ b/content/test/did_commit_navigation_interceptor.h
@@ -32,13 +32,14 @@ ~DidCommitNavigationInterceptor() override; // Called just before DidCommitNavigation with |navigation_request|, |params| - // and |interface_provider_request| would be processed by - // |render_frame_host|. + // and |interface_provider_request| would be processed by |render_frame_host|. // Return false to cancel the processing of this call by |render_frame_host|. + // |params| and |interface_params| can be modified. When returning false, they + // can also be consumed, they won't be used anymore by the caller. virtual bool WillProcessDidCommitNavigation( RenderFrameHost* render_frame_host, NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) = 0; private: @@ -75,7 +76,7 @@ bool WillProcessDidCommitNavigation( RenderFrameHost* render_frame_host, NavigationRequest* navigation_request, - ::FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr* params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr* interface_params) override;
diff --git a/content/test/navigation_simulator_impl.cc b/content/test/navigation_simulator_impl.cc index e82d145..c6a3810 100644 --- a/content/test/navigation_simulator_impl.cc +++ b/content/test/navigation_simulator_impl.cc
@@ -1292,15 +1292,14 @@ history_list_was_cleared_ = history_cleared; } -std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> +mojom::DidCommitProvisionalLoadParamsPtr NavigationSimulatorImpl::BuildDidCommitProvisionalLoadParams( bool same_document, bool failed_navigation) { - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params = - std::make_unique<FrameHostMsg_DidCommitProvisionalLoad_Params>(); + auto params = mojom::DidCommitProvisionalLoadParams::New(); params->url = navigation_url_; params->original_request_url = original_url_; - params->referrer = Referrer(*referrer_); + params->referrer = mojo::Clone(referrer_); params->contents_mime_type = contents_mime_type_; params->transition = transition_; params->gesture =
diff --git a/content/test/navigation_simulator_impl.h b/content/test/navigation_simulator_impl.h index 32ec18c..a73a1fc3 100644 --- a/content/test/navigation_simulator_impl.h +++ b/content/test/navigation_simulator_impl.h
@@ -26,8 +26,6 @@ #include "third_party/blink/public/mojom/loader/referrer.mojom-forward.h" #include "url/gurl.h" -struct FrameHostMsg_DidCommitProvisionalLoad_Params; - namespace content { class FrameTreeNode; @@ -235,9 +233,9 @@ // Build DidCommitProvisionalLoadParams to commit the ongoing navigation, // based on internal NavigationSimulator state and given parameters. - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> - BuildDidCommitProvisionalLoadParams(bool same_document, - bool failed_navigation); + mojom::DidCommitProvisionalLoadParamsPtr BuildDidCommitProvisionalLoadParams( + bool same_document, + bool failed_navigation); // Simulate the UnloadACK in the old RenderFrameHost if it was unloaded at the // commit time.
diff --git a/content/test/test_render_frame.cc b/content/test/test_render_frame.cc index 113e345..7ae063666 100644 --- a/content/test/test_render_frame.cc +++ b/content/test/test_render_frame.cc
@@ -41,8 +41,7 @@ MockFrameHost() {} ~MockFrameHost() override = default; - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> - TakeLastCommitParams() { + mojom::DidCommitProvisionalLoadParamsPtr TakeLastCommitParams() { return std::move(last_commit_params_); } @@ -83,7 +82,7 @@ } void DidCommitProvisionalLoad( - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params, + mojom::DidCommitProvisionalLoadParamsPtr params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params) override { last_commit_params_ = std::move(params); @@ -169,8 +168,7 @@ } void DidCommitSameDocumentNavigation( - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params) - override { + mojom::DidCommitProvisionalLoadParamsPtr params) override { last_commit_params_ = std::move(params); } @@ -226,8 +224,7 @@ #endif private: - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> - last_commit_params_; + mojom::DidCommitProvisionalLoadParamsPtr last_commit_params_; mojo::PendingReceiver<service_manager::mojom::InterfaceProvider> last_interface_provider_receiver_; mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker> @@ -371,7 +368,7 @@ RenderFrameImpl::BeginNavigation(std::move(info)); } -std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> +mojom::DidCommitProvisionalLoadParamsPtr TestRenderFrame::TakeLastCommitParams() { return mock_frame_host_->TakeLastCommitParams(); }
diff --git a/content/test/test_render_frame.h b/content/test/test_render_frame.h index e23fc30..5c4214d 100644 --- a/content/test/test_render_frame.h +++ b/content/test/test_render_frame.h
@@ -62,8 +62,7 @@ const base::UnguessableToken& frame_token); void BeginNavigation(std::unique_ptr<blink::WebNavigationInfo> info) override; - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> - TakeLastCommitParams(); + mojom::DidCommitProvisionalLoadParamsPtr TakeLastCommitParams(); // Sets a callback to be run the next time DidAddMessageToConsole // is called (e.g. window.console.log() is called).
diff --git a/content/test/test_render_frame_host.cc b/content/test/test_render_frame_host.cc index 7df7322d..e80c1e5 100644 --- a/content/test/test_render_frame_host.cc +++ b/content/test/test_render_frame_host.cc
@@ -269,11 +269,11 @@ if (!was_within_same_document) params->embedding_token = base::UnguessableToken::Create(); - SendNavigateWithParams(params.get(), was_within_same_document); + SendNavigateWithParams(std::move(params), was_within_same_document); } void TestRenderFrameHost::SendNavigateWithParams( - FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr params, bool was_within_same_document) { SendNavigateWithParamsAndInterfaceParams( std::move(params), @@ -282,19 +282,15 @@ } void TestRenderFrameHost::SendNavigateWithParamsAndInterfaceParams( - FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params, bool was_within_same_document) { - if (was_within_same_document) { - DidCommitSameDocumentNavigation( - std::make_unique<FrameHostMsg_DidCommitProvisionalLoad_Params>( - *params)); - } else { - DidCommitProvisionalLoad( - std::make_unique<FrameHostMsg_DidCommitProvisionalLoad_Params>(*params), - std::move(interface_params)); - } last_commit_was_error_page_ = params->url_is_unreachable; + if (was_within_same_document) { + DidCommitSameDocumentNavigation(std::move(params)); + } else { + DidCommitProvisionalLoad(std::move(params), std::move(interface_params)); + } } void TestRenderFrameHost::SendRendererInitiatedNavigationRequest( @@ -428,7 +424,7 @@ void TestRenderFrameHost::SimulateCommitProcessed( NavigationRequest* navigation_request, - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params, + mojom::DidCommitProvisionalLoadParamsPtr params, mojo::PendingReceiver<service_manager::mojom::InterfaceProvider> interface_provider_receiver, mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker> @@ -436,7 +432,6 @@ bool same_document) { CHECK(params); - bool did_commit = false; if (!same_document) { // Note: Although the code does not prohibit the running of multiple // callbacks, no more than 1 callback will ever run, because navigation_id @@ -449,7 +444,7 @@ mojom::DidCommitProvisionalLoadInterfaceParams::New( std::move(interface_provider_receiver), std::move(browser_interface_broker_receiver))); - did_commit = true; + return; } } { @@ -460,19 +455,17 @@ mojom::DidCommitProvisionalLoadInterfaceParams::New( std::move(interface_provider_receiver), std::move(browser_interface_broker_receiver))); - did_commit = true; + return; } } } - if (!did_commit) { - SendNavigateWithParamsAndInterfaceParams( - params.get(), - mojom::DidCommitProvisionalLoadInterfaceParams::New( - std::move(interface_provider_receiver), - std::move(browser_interface_broker_receiver)), - same_document); - } + SendNavigateWithParamsAndInterfaceParams( + std::move(params), + mojom::DidCommitProvisionalLoadInterfaceParams::New( + std::move(interface_provider_receiver), + std::move(browser_interface_broker_receiver)), + same_document); } WebBluetoothServiceImpl* @@ -527,16 +520,16 @@ BuildCommitFailedNavigationCallback(navigation_request); } -std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> +mojom::DidCommitProvisionalLoadParamsPtr TestRenderFrameHost::BuildDidCommitParams(int nav_entry_id, bool did_create_new_entry, const GURL& url, ui::PageTransition transition, int response_code) { - auto params = - std::make_unique<FrameHostMsg_DidCommitProvisionalLoad_Params>(); + auto params = mojom::DidCommitProvisionalLoadParams::New(); params->nav_entry_id = nav_entry_id; params->url = url; + params->referrer = blink::mojom::Referrer::New(); params->transition = transition; params->should_update_history = true; params->did_create_new_entry = did_create_new_entry;
diff --git a/content/test/test_render_frame_host.h b/content/test/test_render_frame_host.h index 055537d..17f6916 100644 --- a/content/test/test_render_frame_host.h +++ b/content/test/test_render_frame_host.h
@@ -97,11 +97,10 @@ void SendNavigate(int nav_entry_id, bool did_create_new_entry, const GURL& url); - void SendNavigateWithParams( - FrameHostMsg_DidCommitProvisionalLoad_Params* params, - bool was_within_same_document); + void SendNavigateWithParams(mojom::DidCommitProvisionalLoadParamsPtr params, + bool was_within_same_document); void SendNavigateWithParamsAndInterfaceParams( - FrameHostMsg_DidCommitProvisionalLoad_Params* params, + mojom::DidCommitProvisionalLoadParamsPtr params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params, bool was_within_same_document); @@ -128,8 +127,7 @@ blink::mojom::InsecureRequestPolicy policy); // If set, navigations will appear to have cleared the history list in the - // RenderFrame - // (FrameHostMsg_DidCommitProvisionalLoad_Params::history_list_was_cleared). + // RenderFrame (DidCommitProvisionalLoadParams::history_list_was_cleared). // False by default. void set_simulate_history_list_was_cleared(bool cleared) { simulate_history_list_was_cleared_ = cleared; @@ -157,7 +155,7 @@ // set to default null values. void SimulateCommitProcessed( NavigationRequest* navigation_request, - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params, + mojom::DidCommitProvisionalLoadParamsPtr params, mojo::PendingReceiver<service_manager::mojom::InterfaceProvider> interface_provider_receiver, mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker> @@ -254,12 +252,12 @@ // Computes the page ID for a pending navigation in this RenderFrameHost; int32_t ComputeNextPageID(); - std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> - BuildDidCommitParams(int nav_entry_id, - bool did_create_new_entry, - const GURL& url, - ui::PageTransition transition, - int response_code); + mojom::DidCommitProvisionalLoadParamsPtr BuildDidCommitParams( + int nav_entry_id, + bool did_create_new_entry, + const GURL& url, + ui::PageTransition transition, + int response_code); mojom::DidCommitProvisionalLoadInterfaceParamsPtr BuildDidCommitInterfaceParams(bool is_same_document);
diff --git a/content/test/test_render_view_host.cc b/content/test/test_render_view_host.cc index 11d75a5..1ca0dce 100644 --- a/content/test/test_render_view_host.cc +++ b/content/test/test_render_view_host.cc
@@ -46,24 +46,6 @@ namespace content { -void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params, - int nav_entry_id, - bool did_create_new_entry, - const GURL& url, - ui::PageTransition transition) { - params->nav_entry_id = nav_entry_id; - params->url = url; - params->origin = url::Origin::Create(url); - params->referrer = Referrer(); - params->transition = transition; - params->redirects = std::vector<GURL>(); - params->should_update_history = false; - params->did_create_new_entry = did_create_new_entry; - params->gesture = NavigationGestureUser; - params->method = "GET"; - params->page_state = blink::PageState::CreateFromURL(url); -} - TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) : RenderWidgetHostViewBase(rwh), is_showing_(false), is_occluded_(false) { #if defined(OS_ANDROID)
diff --git a/content/test/test_render_view_host.h b/content/test/test_render_view_host.h index 2e9b35aa..11c5ec41 100644 --- a/content/test/test_render_view_host.h +++ b/content/test/test_render_view_host.h
@@ -36,8 +36,6 @@ // // To use, derive your test base class from RenderViewHostImplTestHarness. -struct FrameHostMsg_DidCommitProvisionalLoad_Params; - namespace gfx { class Rect; } @@ -48,14 +46,6 @@ class TestRenderFrameHost; class TestWebContents; -// Utility function to initialize FrameHostMsg_DidCommitProvisionalLoad_Params -// with given parameters. -void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params, - int nav_entry_id, - bool did_create_new_entry, - const GURL& url, - ui::PageTransition transition_type); - // TestRenderWidgetHostView ---------------------------------------------------- // Subclass the RenderViewHost's view so that we can call Show(), etc.,
diff --git a/content/test/test_web_contents.cc b/content/test/test_web_contents.cc index e489035a..385b85d 100644 --- a/content/test/test_web_contents.cc +++ b/content/test/test_web_contents.cc
@@ -24,6 +24,7 @@ #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" +#include "content/public/common/referrer_type_converters.h" #include "content/public/common/url_utils.h" #include "content/public/test/mock_render_process_host.h" #include "content/public/test/navigation_simulator.h" @@ -154,41 +155,40 @@ if (!rfh->is_loading()) rfh->SimulateNavigationStart(url); - FrameHostMsg_DidCommitProvisionalLoad_Params params; - - params.nav_entry_id = nav_entry_id; - params.item_sequence_number = item_sequence_number; - params.document_sequence_number = document_sequence_number; - params.url = url; - params.base_url = GURL(); - params.referrer = referrer; - params.transition = transition; - params.redirects = std::vector<GURL>(); - params.should_update_history = true; - params.contents_mime_type = std::string("text/html"); - params.intended_as_new_entry = did_create_new_entry; - params.did_create_new_entry = did_create_new_entry; - params.should_replace_current_entry = false; - params.gesture = NavigationGestureUser; - params.method = "GET"; - params.post_id = 0; - params.http_status_code = 200; - params.url_is_unreachable = false; + auto params = mojom::DidCommitProvisionalLoadParams::New(); + params->nav_entry_id = nav_entry_id; + params->item_sequence_number = item_sequence_number; + params->document_sequence_number = document_sequence_number; + params->url = url; + params->base_url = GURL(); + params->referrer = blink::mojom::Referrer::From(referrer); + params->transition = transition; + params->redirects = std::vector<GURL>(); + params->should_update_history = true; + params->contents_mime_type = std::string("text/html"); + params->intended_as_new_entry = did_create_new_entry; + params->did_create_new_entry = did_create_new_entry; + params->should_replace_current_entry = false; + params->gesture = NavigationGestureUser; + params->method = "GET"; + params->post_id = 0; + params->http_status_code = 200; + params->url_is_unreachable = false; if (item_sequence_number != -1 && document_sequence_number != -1) { - params.page_state = blink::PageState::CreateForTestingWithSequenceNumbers( + params->page_state = blink::PageState::CreateForTestingWithSequenceNumbers( url, item_sequence_number, document_sequence_number); } else { - params.page_state = blink::PageState::CreateFromURL(url); + params->page_state = blink::PageState::CreateFromURL(url); } - params.original_request_url = GURL(); - params.is_overriding_user_agent = false; - params.history_list_was_cleared = false; - params.origin = url::Origin::Create(url); - params.insecure_request_policy = + params->original_request_url = GURL(); + params->is_overriding_user_agent = false; + params->history_list_was_cleared = false; + params->origin = url::Origin::Create(url); + params->insecure_request_policy = blink::mojom::InsecureRequestPolicy::kLeaveInsecureRequestsAlone; - params.has_potentially_trustworthy_unique_origin = false; + params->has_potentially_trustworthy_unique_origin = false; - rfh->SendNavigateWithParams(¶ms, was_within_same_document); + rfh->SendNavigateWithParams(std::move(params), was_within_same_document); } const std::string& TestWebContents::GetSaveFrameHeaders() {
diff --git a/extensions/browser/api/declarative_net_request/declarative_net_request_api.cc b/extensions/browser/api/declarative_net_request/declarative_net_request_api.cc index 4adcfff..c86a9aa 100644 --- a/extensions/browser/api/declarative_net_request/declarative_net_request_api.cc +++ b/extensions/browser/api/declarative_net_request/declarative_net_request_api.cc
@@ -5,7 +5,9 @@ #include "extensions/browser/api/declarative_net_request/declarative_net_request_api.h" #include <memory> +#include <set> #include <utility> +#include <vector> #include "base/bind.h" #include "base/feature_list.h" @@ -161,6 +163,55 @@ dnr_api::GetDynamicRules::Results::Create(read_json_result.rules))); } +DeclarativeNetRequestUpdateSessionRulesFunction:: + DeclarativeNetRequestUpdateSessionRulesFunction() = default; +DeclarativeNetRequestUpdateSessionRulesFunction:: + ~DeclarativeNetRequestUpdateSessionRulesFunction() = default; + +ExtensionFunction::ResponseAction +DeclarativeNetRequestUpdateSessionRulesFunction::Run() { + using Params = dnr_api::UpdateSessionRules::Params; + + base::string16 error; + std::unique_ptr<Params> params(Params::Create(*args_, &error)); + EXTENSION_FUNCTION_VALIDATE(params); + EXTENSION_FUNCTION_VALIDATE(error.empty()); + + std::vector<int> rule_ids_to_remove; + if (params->options.remove_rule_ids) + rule_ids_to_remove = std::move(*params->options.remove_rule_ids); + + std::vector<api::declarative_net_request::Rule> rules_to_add; + if (params->options.add_rules) + rules_to_add = std::move(*params->options.add_rules); + + // Early return if there is nothing to do. + if (rule_ids_to_remove.empty() && rules_to_add.empty()) + return RespondNow(NoArguments()); + + auto* rules_monitor_service = + declarative_net_request::RulesMonitorService::Get(browser_context()); + DCHECK(rules_monitor_service); + rules_monitor_service->UpdateSessionRules( + extension_id(), std::move(rule_ids_to_remove), std::move(rules_to_add)); + return RespondNow(NoArguments()); +} + +DeclarativeNetRequestGetSessionRulesFunction:: + DeclarativeNetRequestGetSessionRulesFunction() = default; +DeclarativeNetRequestGetSessionRulesFunction:: + ~DeclarativeNetRequestGetSessionRulesFunction() = default; + +ExtensionFunction::ResponseAction +DeclarativeNetRequestGetSessionRulesFunction::Run() { + auto* rules_monitor_service = + declarative_net_request::RulesMonitorService::Get(browser_context()); + DCHECK(rules_monitor_service); + + return RespondNow(OneArgument( + rules_monitor_service->GetSessionRulesValue(extension_id()).Clone())); +} + DeclarativeNetRequestUpdateEnabledRulesetsFunction:: DeclarativeNetRequestUpdateEnabledRulesetsFunction() = default; DeclarativeNetRequestUpdateEnabledRulesetsFunction::
diff --git a/extensions/browser/api/declarative_net_request/declarative_net_request_api.h b/extensions/browser/api/declarative_net_request/declarative_net_request_api.h index 82a1d3a..1d5a691 100644 --- a/extensions/browser/api/declarative_net_request/declarative_net_request_api.h +++ b/extensions/browser/api/declarative_net_request/declarative_net_request_api.h
@@ -50,6 +50,33 @@ declarative_net_request::ReadJSONRulesResult read_json_result); }; +class DeclarativeNetRequestUpdateSessionRulesFunction + : public ExtensionFunction { + public: + DeclarativeNetRequestUpdateSessionRulesFunction(); + DECLARE_EXTENSION_FUNCTION("declarativeNetRequest.updateSessionRules", + DECLARATIVENETREQUEST_UPDATESESSIONRULES) + + protected: + ~DeclarativeNetRequestUpdateSessionRulesFunction() override; + + // ExtensionFunction override: + ExtensionFunction::ResponseAction Run() override; +}; + +class DeclarativeNetRequestGetSessionRulesFunction : public ExtensionFunction { + public: + DeclarativeNetRequestGetSessionRulesFunction(); + DECLARE_EXTENSION_FUNCTION("declarativeNetRequest.getSessionRules", + DECLARATIVENETREQUEST_GETSESSIONRULES) + + protected: + ~DeclarativeNetRequestGetSessionRulesFunction() override; + + // ExtensionFunction override: + ExtensionFunction::ResponseAction Run() override; +}; + class DeclarativeNetRequestUpdateEnabledRulesetsFunction : public ExtensionFunction { public:
diff --git a/extensions/browser/api/declarative_net_request/rules_monitor_service.cc b/extensions/browser/api/declarative_net_request/rules_monitor_service.cc index 68e37b6..a4f781c 100644 --- a/extensions/browser/api/declarative_net_request/rules_monitor_service.cc +++ b/extensions/browser/api/declarative_net_request/rules_monitor_service.cc
@@ -16,6 +16,7 @@ #include "base/location.h" #include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" +#include "base/no_destructor.h" #include "base/stl_util.h" #include "base/task/post_task.h" #include "base/threading/thread_restrictions.h" @@ -42,6 +43,7 @@ #include "extensions/common/api/declarative_net_request/dnr_manifest_data.h" #include "extensions/common/api/declarative_net_request/utils.h" #include "extensions/common/extension_id.h" +#include "tools/json_schema_compiler/util.h" namespace extensions { namespace declarative_net_request { @@ -167,6 +169,48 @@ std::move(callback))); } +const base::ListValue& RulesMonitorService::GetSessionRulesValue( + const ExtensionId& extension_id) const { + static const base::NoDestructor<base::ListValue> empty_rules; + auto it = session_rules_.find(extension_id); + return it == session_rules_.end() ? *empty_rules : it->second; +} + +std::vector<api::declarative_net_request::Rule> +RulesMonitorService::GetSessionRules(const ExtensionId& extension_id) const { + std::vector<api::declarative_net_request::Rule> result; + base::string16 error; + bool populate_result = json_schema_compiler::util::PopulateArrayFromList( + GetSessionRulesValue(extension_id), &result, &error); + DCHECK(populate_result); + DCHECK(error.empty()); + return result; +} + +void RulesMonitorService::UpdateSessionRules( + const ExtensionId& extension_id, + std::vector<int> rule_ids_to_remove, + std::vector<api::declarative_net_request::Rule> rules_to_add) { + std::vector<api::declarative_net_request::Rule> new_rules = + GetSessionRules(extension_id); + + std::set<int> ids_to_remove(rule_ids_to_remove.begin(), + rule_ids_to_remove.end()); + base::EraseIf(new_rules, [&ids_to_remove](const dnr_api::Rule& rule) { + return base::Contains(ids_to_remove, rule.id); + }); + + new_rules.insert(new_rules.end(), + std::make_move_iterator(rules_to_add.begin()), + std::make_move_iterator(rules_to_add.end())); + + // TODO(crbug.com/1043200): Index and evaluate session scoped rules. + std::unique_ptr<base::ListValue> new_rules_value = base::ListValue::From( + json_schema_compiler::util::CreateValueFromArray(new_rules)); + DCHECK(new_rules_value); + session_rules_[extension_id] = std::move(*new_rules_value); +} + RulesMonitorService::RulesMonitorService( content::BrowserContext* browser_context) : file_sequence_bridge_(std::make_unique<FileSequenceBridge>()),
diff --git a/extensions/browser/api/declarative_net_request/rules_monitor_service.h b/extensions/browser/api/declarative_net_request/rules_monitor_service.h index 6eeb6e9..267f2f7 100644 --- a/extensions/browser/api/declarative_net_request/rules_monitor_service.h +++ b/extensions/browser/api/declarative_net_request/rules_monitor_service.h
@@ -96,6 +96,21 @@ std::set<RulesetID> ids_to_enable, UpdateEnabledRulesetsUICallback callback); + // Returns the list of session scoped rules for |extension_id| as a + // base::ListValue. + const base::ListValue& GetSessionRulesValue( + const ExtensionId& extension_id) const; + + // Returns a copy of the session scoped rules for the given |extension_id|. + std::vector<api::declarative_net_request::Rule> GetSessionRules( + const ExtensionId& extension_id) const; + + // Updates the session scoped rules for the given |extension_id|. + void UpdateSessionRules( + const ExtensionId& extension_id, + std::vector<int> rule_ids_to_remove, + std::vector<api::declarative_net_request::Rule> rules_to_add); + RulesetManager* ruleset_manager() { return &ruleset_manager_; } const ActionTracker& action_tracker() const { return action_tracker_; } @@ -225,6 +240,9 @@ std::map<ExtensionId, std::unique_ptr<base::OneShotEvent>> tasks_pending_on_load_; + // Session scoped rules value corresponding to extensions. + std::map<ExtensionId, base::ListValue> session_rules_; + // Must be the last member variable. See WeakPtrFactory documentation for // details. base::WeakPtrFactory<RulesMonitorService> weak_factory_{this};
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h index 2859bf8..abe1caa 100644 --- a/extensions/browser/extension_function_histogram_value.h +++ b/extensions/browser/extension_function_histogram_value.h
@@ -1593,6 +1593,8 @@ ACCESSIBILITY_PRIVATE_UPDATESELECTTOSPEAKPANEL = 1530, TAB_GROUPS_MOVE = 1531, SCRIPTING_EXECUTESCRIPT = 1532, + DECLARATIVENETREQUEST_UPDATESESSIONRULES = 1533, + DECLARATIVENETREQUEST_GETSESSIONRULES = 1534, // Last entry: Add new entries above, then run: // python tools/metrics/histograms/update_extension_histograms.py ENUM_BOUNDARY
diff --git a/extensions/common/api/_api_features.json b/extensions/common/api/_api_features.json index 7e4a99e..6f6bf7e 100644 --- a/extensions/common/api/_api_features.json +++ b/extensions/common/api/_api_features.json
@@ -145,6 +145,13 @@ // feature is enabled by default. "channel": "trunk" }, + // TODO(crbug.com/1043200): Enable on Stable once implementation is complete. + "declarativeNetRequest.getSessionRules": { + "channel": "trunk" + }, + "declarativeNetRequest.updateSessionRules": { + "channel": "trunk" + }, "declarativeNetRequest.onRuleMatchedDebug": { "dependencies": ["permission:declarativeNetRequest", "permission:declarativeNetRequestFeedback"], "location": "unpacked"
diff --git a/extensions/common/api/declarative_net_request.idl b/extensions/common/api/declarative_net_request.idl index a04774b..e673fb10 100644 --- a/extensions/common/api/declarative_net_request.idl +++ b/extensions/common/api/declarative_net_request.idl
@@ -380,13 +380,11 @@ RequestDetails request; }; - [nodoc] - dictionary DNRInfo { + [nodoc] dictionary DNRInfo { Ruleset[] rule_resources; }; - [nodoc] - dictionary ManifestKeys { + [nodoc] dictionary ManifestKeys { DNRInfo declarative_net_request; }; @@ -471,6 +469,33 @@ // raised in case of transient internal errors. static void getDynamicRules(GetRulesCallback callback); + // Modifies the current set of session scoped rules for the extension. + // The rules with IDs listed in <code>options.removeRuleIds</code> are first + // removed, and then the rules given in <code>options.addRules</code> are + // added. Notes: + // <ul> + // <li>This update happens as a single atomic operation: either all + // specified rules are added and removed, or an error is returned.</li> + // <li>These rules are not persisted across sessions and are backed in + // memory.</li> + // <li>$(ref:MAX_NUMBER_OF_DYNAMIC_OR_SESSION_RULES) is the maximum number + // of combined dynamic or session rules an extension can add.</li> + // </ul> + // |callback|: Called once the update is complete or has failed. In case of + // an error, $(ref:runtime.lastError) will be set and no change will be made + // to the rule set. This can happen for multiple reasons, such as invalid + // rule format, duplicate rule ID, rule count limit exceeded, and others. + // TODO(crbug.com/1043200): Add documentation once implementation is + // complete. + [nodoc] static void updateSessionRules(UpdateRuleOptions options, + optional EmptyCallback callback); + + // Returns the current set of session scoped rules for the extension. + // |callback|: Called with the set of session scoped rules. + // TODO(crbug.com/1043200): Add documentation once implementation is + // complete. + [nodoc] static void getSessionRules(GetRulesCallback callback); + // Updates the set of enabled static rulesets for the extension. The // rulesets with IDs listed in <code>options.disableRulesetIds</code> are // first removed, and then the rulesets listed in @@ -523,7 +548,8 @@ // Returns the number of static rules an extension can enable before the // global static rule limit is reached. // TODO(crbug.com/983299): Add documentation once implementation is complete. - [nodoc] static void getAvailableStaticRuleCount(GetAvailableStaticRuleCountCallback callback); + [nodoc] static void getAvailableStaticRuleCount( + GetAvailableStaticRuleCountCallback callback); }; interface Properties { @@ -536,12 +562,21 @@ // static rulesets that will not count towards the global total. Up to this // number of rules can be enabled regardless of the number of rules that // count towards the global total. - // TODO(crbug.com/983299): Add documentation once implementation is complete. + // TODO(crbug.com/983299): Add documentation once implementation is + // complete. [nodoc, value=30000] static long GUARANTEED_MINIMUM_STATIC_RULES(); // The maximum number of dynamic rules that an extension can add. + // TODO(crbug.com/1043200): Deprecate this once implementation of session + // scoped rules is complete. [value=5000] static long MAX_NUMBER_OF_DYNAMIC_RULES(); + // The maximum number of combined dynamic or session scoped rules an + // extension can add. + // TODO(crbug.com/1043200): Add documentation once implementation is + // complete. + [nodoc, value=5000] static long MAX_NUMBER_OF_DYNAMIC_OR_SESSION_RULES(); + // Time interval within which <code>MAX_GETMATCHEDRULES_CALLS_PER_INTERVAL // getMatchedRules</code> calls can be made, specified in minutes. // Additional calls will fail immediately and set $(ref:runtime.lastError).
diff --git a/gpu/command_buffer/service/service_utils.cc b/gpu/command_buffer/service/service_utils.cc index 81f87d33..a199a32 100644 --- a/gpu/command_buffer/service/service_utils.cc +++ b/gpu/command_buffer/service/service_utils.cc
@@ -151,15 +151,7 @@ gpu_preferences.use_passthrough_cmd_decoder = gpu::gles2::UsePassthroughCommandDecoder(command_line); gpu_preferences.ignore_gpu_blocklist = - command_line->HasSwitch(switches::kIgnoreGpuBlacklist) || command_line->HasSwitch(switches::kIgnoreGpuBlocklist); - - if (command_line->HasSwitch(switches::kIgnoreGpuBlacklist)) { - LOG(ERROR) << "--" << switches::kIgnoreGpuBlacklist - << " is deprecated and will be removed in 2020Q4, use --" - << switches::kIgnoreGpuBlocklist << " instead."; - } - gpu_preferences.enable_webgpu = command_line->HasSwitch(switches::kEnableUnsafeWebGPU); gpu_preferences.enable_dawn_backend_validation =
diff --git a/gpu/config/gpu_switches.cc b/gpu/config/gpu_switches.cc index b40d21f..82ede09b 100644 --- a/gpu/config/gpu_switches.cc +++ b/gpu/config/gpu_switches.cc
@@ -32,10 +32,6 @@ // Ignores GPU blocklist. const char kIgnoreGpuBlocklist[] = "ignore-gpu-blocklist"; -// Ignores GPU blocklist. -// TODO(crbug.com/1101491): remove in 2020Q4 in favor of --ignore-gpu-blocklist. -const char kIgnoreGpuBlacklist[] = "ignore-gpu-blacklist"; - // Allows explicitly specifying the shader disk cache size for embedded devices. // Default value is 6MB. On Android, 2MB is default and 128KB for low-end // devices.
diff --git a/gpu/config/gpu_switches.h b/gpu/config/gpu_switches.h index bbdedb9..7135afdb 100644 --- a/gpu/config/gpu_switches.h +++ b/gpu/config/gpu_switches.h
@@ -16,7 +16,6 @@ GPU_EXPORT extern const char kGpuDriverBugListTestGroup[]; GPU_EXPORT extern const char kGpuPreferences[]; GPU_EXPORT extern const char kIgnoreGpuBlocklist[]; -GPU_EXPORT extern const char kIgnoreGpuBlacklist[]; GPU_EXPORT extern const char kShaderDiskCacheSizeKB[]; GPU_EXPORT extern const char kDisableGpuProcessForDX12InfoCollection[]; GPU_EXPORT extern const char kEnableUnsafeWebGPU[];
diff --git a/gpu/ipc/client/gpu_channel_host.cc b/gpu/ipc/client/gpu_channel_host.cc index e8b8b85..d4c969c 100644 --- a/gpu/ipc/client/gpu_channel_host.cc +++ b/gpu/ipc/client/gpu_channel_host.cc
@@ -90,30 +90,20 @@ FROM_HERE, base::BindOnce(&Listener::SendMessage, base::Unretained(listener_.get()), std::move(message), &pending_sync)); + base::TimeTicks start_time = base::TimeTicks::Now(); // http://crbug.com/125264 base::ScopedAllowBaseSyncPrimitivesOutsideBlockingScope allow_wait; - // TODO(magchen): crbug.com/949839. Remove this histogram and do only one - // done_event->Wait() after the GPU watchdog V2 is fully launched. - base::TimeTicks start_time = base::TimeTicks::Now(); + pending_sync.done_event->Wait(); - // The wait for event is split into two phases so we can still record the - // case in which the GPU hangs but not killed. Also all data should be - // recorded in the range of max_wait_sec seconds for easier comparison. - bool signaled = - pending_sync.done_event->TimedWait(kGpuChannelHostMaxWaitTime); - + // Histogram to measure how long the browser UI thread spends blocked. + // Recorded only for users with high-resolution clocks. base::TimeDelta wait_duration = base::TimeTicks::Now() - start_time; - - // Histogram of wait-for-sync time, used for monitoring the GPU watchdog. - UMA_HISTOGRAM_CUSTOM_TIMES("GPU.GPUChannelHostWaitTime2", wait_duration, - base::TimeDelta::FromSeconds(1), - kGpuChannelHostMaxWaitTime, 50); - - // Continue waiting for the event if not signaled - if (!signaled) - pending_sync.done_event->Wait(); + UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES("GPU.GPUChannelHostWaitTime3", + wait_duration, + base::TimeDelta::FromMicroseconds(5), + base::TimeDelta::FromSeconds(1), 50); return pending_sync.send_result; }
diff --git a/gpu/ipc/common/gpu_watchdog_timeout.h b/gpu/ipc/common/gpu_watchdog_timeout.h index 7b3877fb..cb033cd 100644 --- a/gpu/ipc/common/gpu_watchdog_timeout.h +++ b/gpu/ipc/common/gpu_watchdog_timeout.h
@@ -47,13 +47,6 @@ constexpr int kRestartFactorFinch = 4; #endif -// Do not change this number. It's for histogram "GPU.GPUChannelHostWaitTime". -// This is the max wait time when waiting for sync in the GPU channel Host. It -// needs to be bigger than (kGpuWatchdogTimeout * kRestartFactor) for all -// platforms. -constexpr base::TimeDelta kGpuChannelHostMaxWaitTime = - base::TimeDelta::FromSeconds(120); - } // namespace gpu #endif // GPU_IPC_COMMON_GPU_WATCHDOG_TIMEOUT_H_
diff --git a/gpu/ipc/service/gpu_init.cc b/gpu/ipc/service/gpu_init.cc index 1471ceae..813b4017 100644 --- a/gpu/ipc/service/gpu_init.cc +++ b/gpu/ipc/service/gpu_init.cc
@@ -408,7 +408,7 @@ gles2::UsePassthroughCommandDecoder(command_line) && gles2::PassthroughCommandDecoderSupported(); - // We need to collect GL strings (VENDOR, RENDERER) for blacklisting purposes. + // We need to collect GL strings (VENDOR, RENDERER) for blocklisting purposes. if (!gl_disabled) { if (!gl_use_swiftshader_) { if (!CollectGraphicsInfo(&gpu_info_))
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm index b2e584cd0..c91bd5cf 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm
@@ -603,9 +603,8 @@ GURL blockURL(node->url()); auto faviconLoadedBlock = ^(FaviconAttributes* attributes) { BookmarkHomeViewController* strongSelf = weakSelf; - if (!strongSelf) { + if (!strongSelf) return; - } // Due to search filtering, we also need to validate the indexPath // requested versus what is in the table now. if (![strongSelf hasItemAtIndexPath:indexPath] || @@ -790,8 +789,9 @@ UINavigationItemLargeTitleDisplayModeNever; } + __weak BookmarkHomeViewController* weakSelf = self; auto completion = ^{ - [self.navigationController setViewControllers:stack animated:YES]; + [weakSelf.navigationController setViewControllers:stack animated:YES]; }; [self.searchController dismissViewControllerAnimated:YES @@ -982,22 +982,27 @@ DCHECK(self.spinnerView); __weak BookmarkHomeViewController* weakSelf = self; [self.spinnerView stopWaitingWithCompletion:^{ - BookmarkHomeViewController* strongSelf = weakSelf; // Early return if the controller has been deallocated. + BookmarkHomeViewController* strongSelf = weakSelf; if (!strongSelf) return; [UIView animateWithDuration:0.2f animations:^{ - strongSelf.spinnerView.alpha = 0.0; + weakSelf.spinnerView.alpha = 0.0; } completion:^(BOOL finished) { + BookmarkHomeViewController* strongSelf = weakSelf; + if (!strongSelf) + return; + // By the time completion block is called, the backgroundView could be // another view, like the empty view background. Only clear the // background if it is still the spinner. - if (self.sharedState.tableView.backgroundView == self.spinnerView) { - self.sharedState.tableView.backgroundView = nil; + if (strongSelf.sharedState.tableView.backgroundView == + strongSelf.spinnerView) { + strongSelf.sharedState.tableView.backgroundView = nil; } - self.spinnerView = nil; + strongSelf.spinnerView = nil; }]; [strongSelf loadBookmarkViews]; [strongSelf.sharedState.tableView reloadData]; @@ -1126,8 +1131,9 @@ // Before passing the URL to the block, make sure the block has a copy of // the URL and not just a reference. const GURL localUrl(url); + __weak BookmarkHomeViewController* weakSelf = self; dispatch_async(dispatch_get_main_queue(), ^{ - [self loadURL:localUrl]; + [weakSelf loadURL:localUrl]; }); } } @@ -1391,23 +1397,31 @@ AddSameConstraints(self.scrimView, self.view.superview); self.tableView.accessibilityElementsHidden = YES; self.tableView.scrollEnabled = NO; + __weak BookmarkHomeViewController* weakSelf = self; [UIView animateWithDuration:kTableViewNavigationScrimFadeDuration animations:^{ - self.scrimView.alpha = 1.0f; - [self.view layoutIfNeeded]; + BookmarkHomeViewController* strongSelf = weakSelf; + if (!strongSelf) + return; + strongSelf.scrimView.alpha = 1.0f; + [strongSelf.view layoutIfNeeded]; }]; } // Hide scrim and restore toolbar. - (void)hideScrim { + __weak BookmarkHomeViewController* weakSelf = self; [UIView animateWithDuration:kTableViewNavigationScrimFadeDuration animations:^{ - self.scrimView.alpha = 0.0f; + weakSelf.scrimView.alpha = 0.0f; } completion:^(BOOL finished) { - [self.scrimView removeFromSuperview]; - self.tableView.accessibilityElementsHidden = NO; - self.tableView.scrollEnabled = YES; + BookmarkHomeViewController* strongSelf = weakSelf; + if (!strongSelf) + return; + [strongSelf.scrimView removeFromSuperview]; + strongSelf.tableView.accessibilityElementsHidden = NO; + strongSelf.tableView.scrollEnabled = YES; }]; [self setupContextBar]; } @@ -1450,19 +1464,24 @@ // Hide the loading spinner if it is showing. - (void)hideLoadingSpinnerBackground { if (self.spinnerView) { + __weak BookmarkHomeViewController* weakSelf = self; [self.spinnerView stopWaitingWithCompletion:^{ [UIView animateWithDuration:0.2 animations:^{ - self.spinnerView.alpha = 0.0; + weakSelf.spinnerView.alpha = 0.0; } completion:^(BOOL finished) { + BookmarkHomeViewController* strongSelf = weakSelf; + if (!strongSelf) + return; // By the time completion block is called, the backgroundView could // be another view, like the empty view background. Only clear the // background if it is still the spinner. - if (self.sharedState.tableView.backgroundView == self.spinnerView) { - self.sharedState.tableView.backgroundView = nil; + if (strongSelf.sharedState.tableView.backgroundView == + strongSelf.spinnerView) { + strongSelf.sharedState.tableView.backgroundView = nil; } - self.spinnerView = nil; + strongSelf.spinnerView = nil; }]; }]; } @@ -1747,21 +1766,30 @@ coordinator.alertController.view.accessibilityIdentifier = kBookmarkHomeContextMenuIdentifier; - [coordinator - addItemWithTitle:l10n_util::GetNSString( - IDS_IOS_BOOKMARK_CONTEXT_MENU_OPEN) - action:^{ - std::vector<const BookmarkNode*> nodes = [weakSelf editNodes]; - [weakSelf openAllNodes:nodes inIncognito:NO newTab:NO]; - } - style:UIAlertActionStyleDefault]; + [coordinator addItemWithTitle:l10n_util::GetNSString( + IDS_IOS_BOOKMARK_CONTEXT_MENU_OPEN) + action:^{ + BookmarkHomeViewController* strongSelf = weakSelf; + if (!strongSelf) + return; + std::vector<const BookmarkNode*> nodes = + [strongSelf editNodes]; + [strongSelf openAllNodes:nodes + inIncognito:NO + newTab:NO]; + } + style:UIAlertActionStyleDefault]; [coordinator addItemWithTitle:l10n_util::GetNSString( IDS_IOS_BOOKMARK_CONTEXT_MENU_OPEN_INCOGNITO) action:^{ - std::vector<const BookmarkNode*> nodes = [weakSelf editNodes]; - [weakSelf openAllNodes:nodes inIncognito:YES newTab:NO]; + BookmarkHomeViewController* strongSelf = weakSelf; + if (!strongSelf) + return; + std::vector<const BookmarkNode*> nodes = + [strongSelf editNodes]; + [strongSelf openAllNodes:nodes inIncognito:YES newTab:NO]; } style:UIAlertActionStyleDefault]; @@ -1794,14 +1822,15 @@ coordinator.alertController.actions[0].enabled = NO; } - [coordinator - addItemWithTitle:l10n_util::GetNSString( - IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWTAB) - action:^{ - std::vector<const BookmarkNode*> nodes = {node}; - [weakSelf openAllNodes:nodes inIncognito:NO newTab:YES]; - } - style:UIAlertActionStyleDefault]; + [coordinator addItemWithTitle:l10n_util::GetNSString( + IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWTAB) + action:^{ + std::vector<const BookmarkNode*> nodes = {node}; + [weakSelf openAllNodes:nodes + inIncognito:NO + newTab:YES]; + } + style:UIAlertActionStyleDefault]; if (IsMultipleScenesSupported()) { NSString* title = @@ -1830,9 +1859,15 @@ [coordinator addItemWithTitle:l10n_util::GetNSString(IDS_IOS_CONTENT_CONTEXT_COPY) action:^{ + // Use strongSelf even though the object is only used once + // because we do not want to change the global pasteboard + // if the view has been deallocated. + BookmarkHomeViewController* strongSelf = weakSelf; + if (!strongSelf) + return; UIPasteboard* pasteboard = [UIPasteboard generalPasteboard]; pasteboard.string = base::SysUTF8ToNSString(urlString); - [weakSelf setTableViewEditing:NO]; + [strongSelf setTableViewEditing:NO]; } style:UIAlertActionStyleDefault]; } @@ -1853,8 +1888,7 @@ [coordinator addItemWithTitle:l10n_util::GetNSString( IDS_IOS_BOOKMARK_CONTEXT_MENU_MOVE) action:^{ - std::set<const BookmarkNode*> nodes; - nodes.insert(node); + std::set<const BookmarkNode*> nodes{node}; [weakSelf moveNodes:nodes]; } style:UIAlertActionStyleDefault]; @@ -2034,10 +2068,14 @@ // needed when scrolling away and then back into the editingCell, // without the delay the cell will resign first responder before its // created. + __weak BookmarkHomeViewController* weakSelf = self; dispatch_async(dispatch_get_main_queue(), ^{ - self.sharedState.editingFolderCell = tableCell; + BookmarkHomeViewController* strongSelf = weakSelf; + if (!strongSelf) + return; + strongSelf.sharedState.editingFolderCell = tableCell; [tableCell startEdit]; - tableCell.textDelegate = self; + tableCell.textDelegate = strongSelf; }); } @@ -2224,13 +2262,18 @@ [self isEditBookmarksEnabled] && [self isNodeEditableByUser:node]; UIContextMenuActionProvider actionProvider; + __weak BookmarkHomeViewController* weakSelf = self; if (node->is_url()) { actionProvider = ^(NSArray<UIMenuElement*>* suggestedActions) { + BookmarkHomeViewController* strongSelf = weakSelf; + if (!strongSelf) + return [UIMenu menuWithTitle:@"" children:@[]]; + // Record that this context menu was shown to the user. RecordMenuShown(MenuScenario::kBookmarkEntry); ActionFactory* actionFactory = - [[ActionFactory alloc] initWithBrowser:self.browser + [[ActionFactory alloc] initWithBrowser:strongSelf.browser scenario:MenuScenario::kBookmarkEntry]; NSMutableArray<UIMenuElement*>* menuElements = @@ -2238,13 +2281,13 @@ [menuElements addObject:[actionFactory actionToOpenInNewTabWithBlock:^{ std::vector<const BookmarkNode*> nodes = {node}; - [self openAllNodes:nodes inIncognito:NO newTab:YES]; + [weakSelf openAllNodes:nodes inIncognito:NO newTab:YES]; }]]; [menuElements addObject:[actionFactory actionToOpenInNewIncognitoTabWithBlock:^{ std::vector<const BookmarkNode*> nodes = {node}; - [self openAllNodes:nodes inIncognito:YES newTab:YES]; + [weakSelf openAllNodes:nodes inIncognito:YES newTab:YES]; }]]; if (IsMultipleScenesSupported()) { @@ -2259,31 +2302,36 @@ [menuElements addObject:[actionFactory actionToCopyURL:node->url()]]; UIAction* editAction = [actionFactory actionToEditWithBlock:^{ - if ([self isNodeDeleted:node]) { + BookmarkHomeViewController* strongSelf = weakSelf; + if (!strongSelf) + return; + if ([strongSelf isNodeDeleted:node]) { // If the node has been deleted via sync or another window while the // context menu was open, ignore the action. return; } - [self editNode:node]; + [strongSelf editNode:node]; }]; [menuElements addObject:editAction]; [menuElements addObject:[actionFactory actionToShareWithBlock:^{ - [self shareURL:node->url() - title:bookmark_utils_ios::TitleForBookmarkNode(node) - indexPath:indexPath]; + [weakSelf shareURL:node->url() + title:bookmark_utils_ios::TitleForBookmarkNode(node) + indexPath:indexPath]; }]]; UIAction* deleteAction = [actionFactory actionToDeleteWithBlock:^{ - if ([self isNodeDeleted:node]) { + BookmarkHomeViewController* strongSelf = weakSelf; + if (!strongSelf) + return; + if ([strongSelf isNodeDeleted:node]) { // If the node has been deleted via sync or another window while the // context menu was open, ignore the action. return; } - std::set<const BookmarkNode*> nodes; - nodes.insert(node); - [self handleSelectNodesForDeletion:nodes]; + std::set<const BookmarkNode*> nodes{node}; + [strongSelf handleSelectNodesForDeletion:nodes]; base::RecordAction( base::UserMetricsAction("MobileBookmarkManagerEntryDeleted")); }]; @@ -2299,32 +2347,42 @@ }; } else if (node->is_folder()) { actionProvider = ^(NSArray<UIMenuElement*>* suggestedActions) { + BookmarkHomeViewController* strongSelf = weakSelf; + if (!strongSelf) + return [UIMenu menuWithTitle:@"" children:@[]]; + + // Record that this context menu was shown to the user. RecordMenuShown(MenuScenario::kBookmarkFolder); ActionFactory* actionFactory = - [[ActionFactory alloc] initWithBrowser:self.browser + [[ActionFactory alloc] initWithBrowser:strongSelf.browser scenario:MenuScenario::kBookmarkFolder]; NSMutableArray<UIMenuElement*>* menuElements = [[NSMutableArray alloc] init]; UIAction* editAction = [actionFactory actionToEditWithBlock:^{ - if ([self isNodeDeleted:node]) { + BookmarkHomeViewController* strongSelf = weakSelf; + if (!strongSelf) + return; + if ([strongSelf isNodeDeleted:node]) { // If the node has been deleted via sync or another window while the // context menu was open, ignore the action. return; } - [self editNode:node]; + [strongSelf editNode:node]; }]; UIAction* moveAction = [actionFactory actionToMoveFolderWithBlock:^{ - if ([self isNodeDeleted:node]) { + BookmarkHomeViewController* strongSelf = weakSelf; + if (!strongSelf) + return; + if ([strongSelf isNodeDeleted:node]) { // If the node has been deleted via sync or another window while the // context menu was open, ignore the action. return; } - std::set<const BookmarkNode*> nodes; - nodes.insert(node); - [self moveNodes:nodes]; + std::set<const BookmarkNode*> nodes{node}; + [strongSelf moveNodes:nodes]; }]; if (!canEditNode) {
diff --git a/ios/chrome/browser/ui/browser_view/BUILD.gn b/ios/chrome/browser/ui/browser_view/BUILD.gn index 3a02513..49b2b67 100644 --- a/ios/chrome/browser/ui/browser_view/BUILD.gn +++ b/ios/chrome/browser/ui/browser_view/BUILD.gn
@@ -84,6 +84,7 @@ "//ios/chrome/browser/ui/bookmarks", "//ios/chrome/browser/ui/browser_container", "//ios/chrome/browser/ui/browser_container:ui", + "//ios/chrome/browser/ui/browser_view/hider", "//ios/chrome/browser/ui/bubble", "//ios/chrome/browser/ui/colors", "//ios/chrome/browser/ui/commands",
diff --git a/ios/chrome/browser/ui/browser_view/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view/browser_view_controller.mm index 70f1094..37295ae 100644 --- a/ios/chrome/browser/ui/browser_view/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view/browser_view_controller.mm
@@ -72,6 +72,7 @@ #import "ios/chrome/browser/ui/browser_container/browser_container_view_controller.h" #import "ios/chrome/browser/ui/browser_view/browser_view_controller_dependency_factory.h" #import "ios/chrome/browser/ui/browser_view/browser_view_controller_helper.h" +#import "ios/chrome/browser/ui/browser_view/hider/browser_view_hider_coordinator.h" #import "ios/chrome/browser/ui/browser_view/key_commands_provider.h" #import "ios/chrome/browser/ui/bubble/bubble_presenter.h" #import "ios/chrome/browser/ui/bubble/bubble_presenter_delegate.h" @@ -610,6 +611,11 @@ // The coordinator that shows the Send Tab To Self UI. @property(nonatomic, strong) SendTabToSelfCoordinator* sendTabToSelfCoordinator; +// Coordinator for the view that hides the web content when using the +// ViewRevealingVerticalPanHandler. +@property(nonatomic, strong) + BrowserViewHiderCoordinator* browserViewHiderCoordinator; + // BVC initialization // ------------------ // If the BVC is initialized with a valid browser state & tab model immediately, @@ -1337,6 +1343,8 @@ self.legacyTabStripCoordinator = nil; self.tabStripView = nil; } + [self.browserViewHiderCoordinator stop]; + self.browserViewHiderCoordinator = nil; [self.commandDispatcher stopDispatchingToTarget:self.bubblePresenter]; self.bubblePresenter = nil; @@ -1464,6 +1472,16 @@ [tapRecognizer setDelegate:self]; [tapRecognizer setCancelsTouchesInView:NO]; [self.contentArea addGestureRecognizer:tapRecognizer]; + + // When using the thumb strip, the web content needs to be hidden when the + // thumb strip is opened. + if (IsThumbStripEnabled()) { + self.browserViewHiderCoordinator = [[BrowserViewHiderCoordinator alloc] + initWithBaseViewController:self + browser:self.browser]; + self.browserViewHiderCoordinator.locationBarModel = self.locationBarModel; + [self.browserViewHiderCoordinator start]; + } } - (void)viewSafeAreaInsetsDidChange { @@ -1570,9 +1588,14 @@ self.typingShield = nil; if (_voiceSearchController) _voiceSearchController->SetDispatcher(nil); + [self.primaryToolbarCoordinator stop]; self.primaryToolbarCoordinator = nil; + [self.secondaryToolbarContainerCoordinator stop]; self.secondaryToolbarContainerCoordinator = nil; + [self.secondaryToolbarCoordinator stop]; self.secondaryToolbarCoordinator = nil; + [self.browserViewHiderCoordinator stop]; + self.browserViewHiderCoordinator = nil; self.toolbarInterface = nil; [_toolbarUIUpdater stopUpdating]; _toolbarUIUpdater = nil; @@ -2323,6 +2346,7 @@ kSecondaryToolbarGuide, kVoiceSearchButtonGuide, kDiscoverFeedHeaderMenuGuide, + kPrimaryToolbarLocationViewGuide, ]; AddNamedGuidesToView(guideNames, self.view); @@ -2828,6 +2852,8 @@ - (void)setUpThumbStrip { [self.thumbStripPanHandler addAnimatee:self.primaryToolbarCoordinator.animatee]; + [self.thumbStripPanHandler + addAnimatee:self.browserViewHiderCoordinator.animatee]; [self.thumbStripPanHandler addAnimatee:self]; self.primaryToolbarCoordinator.panGestureHandler = self.thumbStripPanHandler; @@ -2835,6 +2861,8 @@ self.legacyTabStripCoordinator.panGestureHandler = self.thumbStripPanHandler; } + self.browserViewHiderCoordinator.panGestureHandler = + self.thumbStripPanHandler; } #pragma mark - ** Protocol Implementations and Helpers **
diff --git a/ios/chrome/browser/ui/browser_view/hider/BUILD.gn b/ios/chrome/browser/ui/browser_view/hider/BUILD.gn new file mode 100644 index 0000000..369cc37 --- /dev/null +++ b/ios/chrome/browser/ui/browser_view/hider/BUILD.gn
@@ -0,0 +1,25 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +source_set("hider") { + configs += [ "//build/config/compiler:enable_arc" ] + sources = [ + "browser_view_hider_coordinator.h", + "browser_view_hider_coordinator.mm", + "browser_view_hider_view_controller.h", + "browser_view_hider_view_controller.mm", + ] + deps = [ + "//ios/chrome/browser/main:public", + "//ios/chrome/browser/overlays", + "//ios/chrome/browser/ui/coordinators:chrome_coordinators", + "//ios/chrome/browser/ui/gestures", + "//ios/chrome/browser/ui/location_bar", + "//ios/chrome/browser/ui/toolbar", + "//ios/chrome/browser/ui/toolbar/public:constants", + "//ios/chrome/browser/ui/util", + "//ios/chrome/common/ui/colors", + "//ios/chrome/common/ui/util", + ] +}
diff --git a/ios/chrome/browser/ui/browser_view/hider/browser_view_hider_coordinator.h b/ios/chrome/browser/ui/browser_view/hider/browser_view_hider_coordinator.h new file mode 100644 index 0000000..1c8a279 --- /dev/null +++ b/ios/chrome/browser/ui/browser_view/hider/browser_view_hider_coordinator.h
@@ -0,0 +1,30 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_UI_BROWSER_VIEW_HIDER_BROWSER_VIEW_HIDER_COORDINATOR_H_ +#define IOS_CHROME_BROWSER_UI_BROWSER_VIEW_HIDER_BROWSER_VIEW_HIDER_COORDINATOR_H_ + +#import "ios/chrome/browser/ui/coordinators/chrome_coordinator.h" + +class LocationBarModel; +@protocol ViewRevealingAnimatee; +@class ViewRevealingVerticalPanHandler; + +// Coordinator for a view that hides the browser view controller's view. +@interface BrowserViewHiderCoordinator : ChromeCoordinator + +// A reference to the view controller that implements the view revealing +// vertical pan handler delegate methods. +@property(nonatomic, weak, readonly) id<ViewRevealingAnimatee> animatee; + +// The pan gesture handler for the hider view controller. +@property(nonatomic, weak) ViewRevealingVerticalPanHandler* panGestureHandler; + +// The locationBarModel that informs this view about the current navigation +// entry. +@property(nonatomic, assign) LocationBarModel* locationBarModel; + +@end + +#endif // IOS_CHROME_BROWSER_UI_BROWSER_VIEW_HIDER_BROWSER_VIEW_HIDER_COORDINATOR_H_
diff --git a/ios/chrome/browser/ui/browser_view/hider/browser_view_hider_coordinator.mm b/ios/chrome/browser/ui/browser_view/hider/browser_view_hider_coordinator.mm new file mode 100644 index 0000000..4efaf73b --- /dev/null +++ b/ios/chrome/browser/ui/browser_view/hider/browser_view_hider_coordinator.mm
@@ -0,0 +1,69 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/ui/browser_view/hider/browser_view_hider_coordinator.h" + +#import "ios/chrome/browser/main/browser.h" +#import "ios/chrome/browser/overlays/public/overlay_presenter.h" +#import "ios/chrome/browser/ui/browser_view/hider/browser_view_hider_view_controller.h" +#import "ios/chrome/browser/ui/location_bar/location_bar_steady_view_mediator.h" +#import "ios/chrome/browser/ui/toolbar/toolbar_coordinator_delegate.h" +#import "ios/chrome/browser/ui/util/layout_guide_names.h" +#import "ios/chrome/browser/ui/util/named_guide.h" +#import "ios/chrome/common/ui/util/constraints_ui_util.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@interface BrowserViewHiderCoordinator () + +@property(nonatomic, strong) BrowserViewHiderViewController* viewController; + +@property(nonatomic, strong) LocationBarSteadyViewMediator* mediator; + +@end + +@implementation BrowserViewHiderCoordinator + +- (void)start { + self.viewController = [[BrowserViewHiderViewController alloc] init]; + + [self.baseViewController addChildViewController:self.viewController]; + [self.baseViewController.view addSubview:self.viewController.view]; + self.viewController.view.translatesAutoresizingMaskIntoConstraints = NO; + AddSameConstraintsToSides( + self.baseViewController.view, self.viewController.view, + LayoutSides::kBottom | LayoutSides::kLeading | LayoutSides::kTrailing); + + NamedGuide* primaryToolbarGuide = + [NamedGuide guideWithName:kPrimaryToolbarGuide + view:self.baseViewController.view]; + [self.viewController.view.topAnchor + constraintEqualToAnchor:primaryToolbarGuide.topAnchor] + .active = YES; + [self.viewController didMoveToParentViewController:self.baseViewController]; + + self.mediator = [[LocationBarSteadyViewMediator alloc] + initWithLocationBarModel:self.locationBarModel]; + self.mediator.webStateList = self.browser->GetWebStateList(); + self.mediator.webContentAreaOverlayPresenter = OverlayPresenter::FromBrowser( + self.browser, OverlayModality::kWebContentArea); + self.mediator.consumer = self.viewController; +} + +- (id<ViewRevealingAnimatee>)animatee { + return self.viewController; +} + +- (ViewRevealingVerticalPanHandler*)panGestureHandler { + return self.viewController.panGestureHandler; +} + +- (void)setPanGestureHandler: + (ViewRevealingVerticalPanHandler*)panGestureHandler { + self.viewController.panGestureHandler = panGestureHandler; +} + +@end
diff --git a/ios/chrome/browser/ui/browser_view/hider/browser_view_hider_view_controller.h b/ios/chrome/browser/ui/browser_view/hider/browser_view_hider_view_controller.h new file mode 100644 index 0000000..7dc34669 --- /dev/null +++ b/ios/chrome/browser/ui/browser_view/hider/browser_view_hider_view_controller.h
@@ -0,0 +1,24 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_UI_BROWSER_VIEW_HIDER_BROWSER_VIEW_HIDER_VIEW_CONTROLLER_H_ +#define IOS_CHROME_BROWSER_UI_BROWSER_VIEW_HIDER_BROWSER_VIEW_HIDER_VIEW_CONTROLLER_H_ + +#import <UIKit/UIKit.h> + +#import "ios/chrome/browser/ui/gestures/view_revealing_animatee.h" +#import "ios/chrome/browser/ui/location_bar/location_bar_steady_view_consumer.h" + +@class ViewRevealingVerticalPanHandler; + +// View controller for a view that hides the browser view controller's view. +@interface BrowserViewHiderViewController + : UIViewController <LocationBarSteadyViewConsumer, ViewRevealingAnimatee> + +// Pan gesture handler for the hider view. +@property(nonatomic, weak) ViewRevealingVerticalPanHandler* panGestureHandler; + +@end + +#endif // IOS_CHROME_BROWSER_UI_BROWSER_VIEW_HIDER_BROWSER_VIEW_HIDER_VIEW_CONTROLLER_H_
diff --git a/ios/chrome/browser/ui/browser_view/hider/browser_view_hider_view_controller.mm b/ios/chrome/browser/ui/browser_view/hider/browser_view_hider_view_controller.mm new file mode 100644 index 0000000..97c58d5 --- /dev/null +++ b/ios/chrome/browser/ui/browser_view/hider/browser_view_hider_view_controller.mm
@@ -0,0 +1,113 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/ui/browser_view/hider/browser_view_hider_view_controller.h" + +#import "ios/chrome/browser/ui/gestures/view_revealing_vertical_pan_handler.h" +#import "ios/chrome/browser/ui/location_bar/location_bar_steady_view.h" +#import "ios/chrome/browser/ui/toolbar/public/toolbar_constants.h" +#import "ios/chrome/browser/ui/util/layout_guide_names.h" +#import "ios/chrome/browser/ui/util/named_guide.h" +#import "ios/chrome/common/ui/colors/semantic_color_names.h" +#import "ios/chrome/common/ui/util/constraints_ui_util.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@interface BrowserViewHiderViewController () + +// Gesture recognizer for swipes on this view. +@property(nonatomic, strong) UIPanGestureRecognizer* panGestureRecognizer; + +@property(nonatomic, strong) LocationBarSteadyView* steadyView; + +@end + +@implementation BrowserViewHiderViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = [UIColor colorNamed:kBackgroundDarkColor]; + self.view.layer.cornerRadius = kTopCornerRadius; + self.view.hidden = YES; + + self.steadyView = [[LocationBarSteadyView alloc] init]; + self.steadyView.translatesAutoresizingMaskIntoConstraints = NO; + [self.view addSubview:self.steadyView]; + self.steadyView.colorScheme = + [LocationBarSteadyViewColorScheme incognitoScheme]; + self.steadyView.locationButton.enabled = NO; +} + +- (void)didMoveToParentViewController:(UIViewController*)parent { + [super didMoveToParentViewController:parent]; + + NamedGuide* guide = [NamedGuide guideWithName:kPrimaryToolbarLocationViewGuide + view:self.view]; + AddSameConstraints(guide, self.steadyView); +} + +- (void)setPanGestureHandler: + (ViewRevealingVerticalPanHandler*)panGestureHandler { + _panGestureHandler = panGestureHandler; + [self.view removeGestureRecognizer:self.panGestureRecognizer]; + + UIPanGestureRecognizer* panGestureRecognizer = [[UIPanGestureRecognizer alloc] + initWithTarget:panGestureHandler + action:@selector(handlePanGesture:)]; + panGestureRecognizer.maximumNumberOfTouches = 1; + [self.view addGestureRecognizer:panGestureRecognizer]; + + self.panGestureRecognizer = panGestureRecognizer; +} + +#pragma mark - LocationBarSteadyViewConsumer + +- (void)updateLocationText:(NSString*)string clipTail:(BOOL)clipTail { + [self.steadyView setLocationLabelText:string]; + self.steadyView.locationLabel.lineBreakMode = + clipTail ? NSLineBreakByTruncatingTail : NSLineBreakByTruncatingHead; +} + +- (void)updateLocationIcon:(UIImage*)icon + securityStatusText:(NSString*)statusText { + [self.steadyView setLocationImage:icon]; + self.steadyView.securityLevelAccessibilityString = statusText; +} + +- (void)updateLocationShareable:(BOOL)shareable { + // No-op. The share button should never be visible on the hider view. +} + +- (void)updateAfterNavigatingToNTP { + [self.steadyView setLocationLabelText:@""]; +} + +#pragma mark - viewRevealingAnimatee + +- (void)willAnimateViewReveal:(ViewRevealState)currentViewRevealState { + self.view.alpha = currentViewRevealState == ViewRevealState::Revealed ? 1 : 0; + self.view.hidden = NO; +} + +- (void)animateViewReveal:(ViewRevealState)nextViewRevealState { + switch (nextViewRevealState) { + case ViewRevealState::Hidden: + self.view.alpha = 0; + break; + case ViewRevealState::Peeked: + self.view.alpha = 0; + break; + case ViewRevealState::Revealed: + self.view.alpha = 1; + break; + } +} + +- (void)didAnimateViewReveal:(ViewRevealState)viewRevealState { + self.view.hidden = viewRevealState != ViewRevealState::Revealed; +} + +@end
diff --git a/ios/chrome/browser/ui/link_to_text/BUILD.gn b/ios/chrome/browser/ui/link_to_text/BUILD.gn index 97f5487..ef619ad 100644 --- a/ios/chrome/browser/ui/link_to_text/BUILD.gn +++ b/ios/chrome/browser/ui/link_to_text/BUILD.gn
@@ -49,12 +49,15 @@ deps = [ "//base", "//base/test:test_support", + "//components/shared_highlighting/core/common", "//ios/chrome/app/strings:ios_strings_grit", + "//ios/chrome/browser/ui:feature_flags", "//ios/chrome/test/earl_grey:eg_test_support+eg2", "//ios/testing/earl_grey:eg_test_support+eg2", "//ios/third_party/earl_grey2:test_lib", "//ios/web/common:features", "//ios/web/public/navigation:navigation", + "//ios/web/public/test:element_selector", "//ios/web/public/test/http_server", "//net", "//net:test_support",
diff --git a/ios/chrome/browser/ui/link_to_text/link_to_text_egtest.mm b/ios/chrome/browser/ui/link_to_text/link_to_text_egtest.mm index f4b2acd..b030d0f7 100644 --- a/ios/chrome/browser/ui/link_to_text/link_to_text_egtest.mm +++ b/ios/chrome/browser/ui/link_to_text/link_to_text_egtest.mm
@@ -2,8 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#import <vector> + +#import "base/ios/ios_util.h" +#import "base/strings/string_util.h" #import "base/strings/sys_string_conversions.h" #import "base/test/ios/wait_util.h" +#import "components/shared_highlighting/core/common/text_fragment.h" +#import "components/shared_highlighting/core/common/text_fragments_utils.h" +#import "ios/chrome/browser/ui/ui_feature_flags.h" +#import "ios/chrome/test/earl_grey/chrome_actions.h" #import "ios/chrome/test/earl_grey/chrome_actions_app_interface.h" #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" #import "ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.h" @@ -12,6 +20,8 @@ #import "ios/chrome/test/earl_grey/chrome_test_case.h" #import "ios/testing/earl_grey/earl_grey_test.h" #import "ios/web/common/features.h" +#import "ios/web/public/test/element_selector.h" +#import "net/base/mac/url_conversions.h" #import "net/test/embedded_test_server/default_handlers.h" #import "net/test/embedded_test_server/http_request.h" #import "net/test/embedded_test_server/http_response.h" @@ -21,11 +31,15 @@ #error "This file requires ARC support." #endif +using shared_highlighting::TextFragment; + namespace { const char kFirstFragmentText[] = "Hello foo!"; const char kSecondFragmentText[] = "bar"; const char kTestPageTextSample[] = "Lorem ipsum"; +const char kSimpleTextElementId[] = "toBeSelected"; +const char kToBeSelectedText[] = "VeryUniqueWord"; const char kTestURL[] = "/testPage"; const char kURLWithTwoFragments[] = "/testPage/#:~:text=Hello%20foo!&text=bar"; @@ -37,6 +51,7 @@ "minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip " "ex ea " "commodo consequat. bar</p>" + "<p id=\"toBeSelected\">VeryUniqueWord</p>" "</body></html>"; const char kTestLongPageURL[] = "/longTestPage"; @@ -106,6 +121,7 @@ - (AppLaunchConfiguration)appConfigurationForTestCase { AppLaunchConfiguration config; config.features_enabled.push_back(web::features::kScrollToTextIOS); + config.features_enabled.push_back(kSharedHighlightingIOS); return config; } @@ -123,14 +139,10 @@ GREYAssertTrue(self.testServer->Start(), @"Test server failed to start."); } -- (void)loadURLPath:(const char*)path { - [ChromeEarlGrey loadURL:self.testServer->GetURL(path)]; -} - // Tests that navigating to a URL with text fragments will highlight all // fragments. - (void)testHighlightAllFragments { - [self loadURLPath:kURLWithTwoFragments]; + [ChromeEarlGrey loadURL:self.testServer->GetURL(kURLWithTwoFragments)]; [ChromeEarlGrey waitForWebStateContainingText:kTestPageTextSample]; NSArray<NSString*>* markedText = GetMarkedText(); @@ -145,7 +157,7 @@ // Tests that a fragment will be scrolled to if it's lower on the page. - (void)testScrollToHighlight { - [self loadURLPath:kLongPageURLWithOneFragment]; + [ChromeEarlGrey loadURL:self.testServer->GetURL(kLongPageURLWithOneFragment)]; [ChromeEarlGrey waitForWebStateContainingText:kTestPageTextSample]; __block NSString* firstVisibleMark; @@ -169,4 +181,74 @@ @"Visible marked text is not valid."); } +// Tests that a link can be generated for a simple text selection. +- (void)testGenerateLinkForSimpleText { + if (!base::ios::IsRunningOnIOS13OrLater()) { + // Skip test on iOS 12 as the Activity View on that version is not + // accessible by Earl Grey. + EARL_GREY_TEST_SKIPPED(@"Test skipped on iOS 12."); + } + + // TODO(crbug.com/1149603): Re-enable this test on iPad once presenting + // popovers work. + if ([ChromeEarlGrey isIPadIdiom]) { + EARL_GREY_TEST_DISABLED(@"Test is disabled on iPad."); + } + + if (@available(iOS 13, *)) { + GURL pageURL = self.testServer->GetURL(kTestURL); + [ChromeEarlGrey loadURL:pageURL]; + [ChromeEarlGrey waitForWebStateContainingText:kTestPageTextSample]; + + [ChromeTestCase removeAnyOpenMenusAndInfoBars]; + + [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()] + performAction:chrome_test_util::LongPressElementForContextMenu( + [ElementSelector + selectorWithElementID:kSimpleTextElementId], + true)]; + + // Edit menu should be there. + id<GREYMatcher> linkToTextButton = + chrome_test_util::SystemSelectionCalloutLinkToTextButton(); + [ChromeEarlGrey + waitForSufficientlyVisibleElementWithMatcher:linkToTextButton]; + + [[EarlGrey selectElementWithMatcher:linkToTextButton] + performAction:grey_tap()]; + + // Make sure the Edit menu is gone. + [[EarlGrey + selectElementWithMatcher:chrome_test_util::SystemSelectionCallout()] + assertWithMatcher:grey_notVisible()]; + + // Wait for the Activity View to show up (look for the Copy action). + id<GREYMatcher> copyActivityButton = chrome_test_util::CopyActivityButton(); + [ChromeEarlGrey + waitForSufficientlyVisibleElementWithMatcher:copyActivityButton]; + + // Tap on the Copy action. + [[EarlGrey selectElementWithMatcher:copyActivityButton] + performAction:grey_tap()]; + + // Assert the values stored in the pasteboard. Lower-casing the expected + // GURL as that is what the JS library is doing. + std::vector<TextFragment> fragments{ + TextFragment(base::ToLowerASCII(kToBeSelectedText))}; + GURL expectedGURL = + shared_highlighting::AppendFragmentDirectives(pageURL, fragments); + + // Wait for the value to be in the pasteboard. + GREYCondition* getPasteboardValue = [GREYCondition + conditionWithName:@"Could not get an expected URL from the pasteboard." + block:^{ + return expectedGURL == [ChromeEarlGrey pasteboardURL]; + }]; + + GREYAssert([getPasteboardValue + waitWithTimeout:base::test::ios::kWaitForActionTimeout], + @"Could not get expected URL from pasteboard."); + } +} + @end
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_strip/tab_strip_view_controller.h b/ios/chrome/browser/ui/tab_switcher/tab_strip/tab_strip_view_controller.h index 04b56e0..5681f42 100644 --- a/ios/chrome/browser/ui/tab_switcher/tab_strip/tab_strip_view_controller.h +++ b/ios/chrome/browser/ui/tab_switcher/tab_strip/tab_strip_view_controller.h
@@ -20,6 +20,8 @@ @property(nonatomic, weak) id<TabFaviconDataSource> faviconDataSource; +@property(nonatomic, readonly, retain) UIButton* buttonNewTab; + - (instancetype)init NS_DESIGNATED_INITIALIZER; - (instancetype)initWithNibName:(NSString*)nibNameOrNil
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_strip/tab_strip_view_controller.mm b/ios/chrome/browser/ui/tab_switcher/tab_strip/tab_strip_view_controller.mm index 6a9989e..712bf090 100644 --- a/ios/chrome/browser/ui/tab_switcher/tab_strip/tab_strip_view_controller.mm +++ b/ios/chrome/browser/ui/tab_switcher/tab_strip/tab_strip_view_controller.mm
@@ -9,16 +9,25 @@ #import "ios/chrome/browser/ui/tab_switcher/tab_strip/tab_strip_mediator.h" #import "ios/chrome/browser/ui/tab_switcher/tab_strip/tab_strip_view_layout.h" #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_item.h" +#import "ios/chrome/common/ui/colors/semantic_color_names.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif namespace { + static NSString* const kReuseIdentifier = @"TabView"; NSIndexPath* CreateIndexPath(NSInteger index) { return [NSIndexPath indexPathForItem:index inSection:0]; } + +// The size of the new tab button. +const CGFloat kNewTabButtonWidth = 44; +// Default image insets for the new tab button. +const CGFloat kNewTabButtonLeadingImageInset = -10.0; +const CGFloat kNewTabButtonBottomImageInset = -2.0; + } // namespace @interface TabStripViewController () @@ -48,6 +57,25 @@ self.collectionView.alwaysBounceHorizontal = YES; [self.collectionView registerClass:[TabStripCell class] forCellWithReuseIdentifier:kReuseIdentifier]; + + _buttonNewTab = [[UIButton alloc] init]; + _buttonNewTab.translatesAutoresizingMaskIntoConstraints = NO; + _buttonNewTab.imageView.contentMode = UIViewContentModeCenter; + UIImage* buttonNewTabImage = [[UIImage imageNamed:@"tabstrip_new_tab"] + imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + [_buttonNewTab setImage:buttonNewTabImage forState:UIControlStateNormal]; + [_buttonNewTab.imageView setTintColor:[UIColor colorNamed:kGrey500Color]]; + UIEdgeInsets imageInsets = UIEdgeInsetsMake(0, kNewTabButtonLeadingImageInset, + kNewTabButtonBottomImageInset, 0); + _buttonNewTab.imageEdgeInsets = imageInsets; + [self.view addSubview:_buttonNewTab]; + [NSLayoutConstraint activateConstraints:@[ + [_buttonNewTab.trailingAnchor + constraintEqualToAnchor:self.view.trailingAnchor], + [_buttonNewTab.topAnchor constraintEqualToAnchor:self.view.topAnchor], + [_buttonNewTab.heightAnchor constraintEqualToAnchor:self.view.heightAnchor], + [_buttonNewTab.widthAnchor constraintEqualToConstant:kNewTabButtonWidth], + ]]; } - (NSInteger)numberOfSectionsInCollectionView:
diff --git a/ios/chrome/browser/ui/toolbar/primary_toolbar_view.mm b/ios/chrome/browser/ui/toolbar/primary_toolbar_view.mm index 8b33c3e..28e3b95a 100644 --- a/ios/chrome/browser/ui/toolbar/primary_toolbar_view.mm +++ b/ios/chrome/browser/ui/toolbar/primary_toolbar_view.mm
@@ -180,12 +180,16 @@ [super willMoveToWindow:newWindow]; [NamedGuide guideWithName:kPrimaryToolbarGuide view:self].constrainedView = nil; + [NamedGuide guideWithName:kPrimaryToolbarLocationViewGuide view:self] + .constrainedView = nil; } - (void)didMoveToWindow { [super didMoveToWindow]; [NamedGuide guideWithName:kPrimaryToolbarGuide view:self].constrainedView = self; + [NamedGuide guideWithName:kPrimaryToolbarLocationViewGuide view:self] + .constrainedView = self.locationBarContainer; } #pragma mark - Setup
diff --git a/ios/chrome/browser/ui/util/layout_guide_names.h b/ios/chrome/browser/ui/util/layout_guide_names.h index 50e2e44..d980eb7 100644 --- a/ios/chrome/browser/ui/util/layout_guide_names.h +++ b/ios/chrome/browser/ui/util/layout_guide_names.h
@@ -55,5 +55,8 @@ // A guide that is constrained to match the frame of the Discover feed header's // top-level menu button. extern GuideName* const kDiscoverFeedHeaderMenuGuide; +// A guide that is constrained to match the frame of the location view in the +// primary toolbar (i.e. the Address Bar). +extern GuideName* const kPrimaryToolbarLocationViewGuide; #endif // IOS_CHROME_BROWSER_UI_UTIL_LAYOUT_GUIDE_NAMES_H_
diff --git a/ios/chrome/browser/ui/util/layout_guide_names.mm b/ios/chrome/browser/ui/util/layout_guide_names.mm index 876ecaa..00c3beb 100644 --- a/ios/chrome/browser/ui/util/layout_guide_names.mm +++ b/ios/chrome/browser/ui/util/layout_guide_names.mm
@@ -26,3 +26,5 @@ @"kTranslateInfobarOptionsGuide"; GuideName* const kVoiceSearchButtonGuide = @"kVoiceSearchButtonGuide"; GuideName* const kDiscoverFeedHeaderMenuGuide = @"kDiscoverFeedHeaderMenuGuide"; +GuideName* const kPrimaryToolbarLocationViewGuide = + @"kPrimaryToolbarLocationViewGuide";
diff --git a/ios/chrome/test/earl_grey/chrome_earl_grey.h b/ios/chrome/test/earl_grey/chrome_earl_grey.h index 9eac0260..befcedb 100644 --- a/ios/chrome/test/earl_grey/chrome_earl_grey.h +++ b/ios/chrome/test/earl_grey/chrome_earl_grey.h
@@ -585,6 +585,10 @@ // Verifies that |text| was copied to the pasteboard. - (void)verifyStringCopied:(NSString*)text; +// Retrieves the GURL stored in the Pasteboard. Returns an empty GURL if no +// URL is currently in the pasteboard. +- (GURL)pasteboardURL; + #pragma mark - Context Menus Utilities (EG2) // Taps on the Copy Link context menu action and verifies that the |text| has
diff --git a/ios/chrome/test/earl_grey/chrome_earl_grey.mm b/ios/chrome/test/earl_grey/chrome_earl_grey.mm index 242ad23..ae6b58f 100644 --- a/ios/chrome/test/earl_grey/chrome_earl_grey.mm +++ b/ios/chrome/test/earl_grey/chrome_earl_grey.mm
@@ -1046,6 +1046,12 @@ @"Waiting for '%@' to be copied to pasteboard.", text); } +- (GURL)pasteboardURL { + NSString* absoluteString = [ChromeEarlGreyAppInterface pasteboardURLSpec]; + return absoluteString ? GURL(base::SysNSStringToUTF8(absoluteString)) + : GURL::EmptyGURL(); +} + #pragma mark - Context Menus Utilities (EG2) - (void)verifyCopyLinkActionWithText:(NSString*)text
diff --git a/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.h b/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.h index 3efce26..2f9b183 100644 --- a/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.h +++ b/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.h
@@ -515,6 +515,10 @@ // perspective. + (NSString*)pasteboardString; +// Retrieves the currently stored URL on the pasteboard from the tested app's +// perspective. ++ (NSString*)pasteboardURLSpec; + @end #endif // IOS_CHROME_TEST_EARL_GREY_CHROME_EARL_GREY_APP_INTERFACE_H_
diff --git a/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.mm b/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.mm index daa15f2..18c6230 100644 --- a/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.mm +++ b/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.mm
@@ -932,4 +932,8 @@ return [UIPasteboard generalPasteboard].string; } ++ (NSString*)pasteboardURLSpec { + return [UIPasteboard generalPasteboard].URL.absoluteString; +} + @end
diff --git a/ios/chrome/test/earl_grey/chrome_matchers.h b/ios/chrome/test/earl_grey/chrome_matchers.h index 2dc20d6..52cc28f 100644 --- a/ios/chrome/test/earl_grey/chrome_matchers.h +++ b/ios/chrome/test/earl_grey/chrome_matchers.h
@@ -338,9 +338,17 @@ // Returns matcher for the system selection callout. id<GREYMatcher> SystemSelectionCallout(); +// Returns a matcher for the Link to text button in the edit menu. +id<GREYMatcher> SystemSelectionCalloutLinkToTextButton(); + // Returns matcher for the copy button on the system selection callout. id<GREYMatcher> SystemSelectionCalloutCopyButton(); +// Matcher for a Copy button, such as the one in the Activity View. This matcher +// is very broad and will look for any button with a matching string. +// Only the iOS 13 Activity View is reachable by EarlGrey. +id<GREYMatcher> CopyActivityButton() API_AVAILABLE(ios(13)); + // Matcher for the Copy Link option in the updated context menus when long // pressing on a link. |use_new_string| determines which string to use. id<GREYMatcher> CopyLinkButton(BOOL use_new_string);
diff --git a/ios/chrome/test/earl_grey/chrome_matchers.mm b/ios/chrome/test/earl_grey/chrome_matchers.mm index d8901a18..a2ed0a8 100644 --- a/ios/chrome/test/earl_grey/chrome_matchers.mm +++ b/ios/chrome/test/earl_grey/chrome_matchers.mm
@@ -429,10 +429,18 @@ return [ChromeMatchersAppInterface systemSelectionCallout]; } +id<GREYMatcher> SystemSelectionCalloutLinkToTextButton() { + return [ChromeMatchersAppInterface systemSelectionCalloutLinkToTextButton]; +} + id<GREYMatcher> SystemSelectionCalloutCopyButton() { return [ChromeMatchersAppInterface systemSelectionCalloutCopyButton]; } +id<GREYMatcher> CopyActivityButton() API_AVAILABLE(ios(13)) { + return [ChromeMatchersAppInterface copyActivityButton]; +} + id<GREYMatcher> CopyLinkButton(BOOL use_new_string) { return [ChromeMatchersAppInterface copyLinkButtonWithUseNewString:use_new_string];
diff --git a/ios/chrome/test/earl_grey/chrome_matchers_app_interface.h b/ios/chrome/test/earl_grey/chrome_matchers_app_interface.h index 0fa47488..62ff5d37 100644 --- a/ios/chrome/test/earl_grey/chrome_matchers_app_interface.h +++ b/ios/chrome/test/earl_grey/chrome_matchers_app_interface.h
@@ -338,9 +338,16 @@ // Returns matcher for the system selection callout. + (id<GREYMatcher>)systemSelectionCallout; +// Returns a matcher for the Link to text button in the edit menu. ++ (id<GREYMatcher>)systemSelectionCalloutLinkToTextButton; + // Returns matcher for the copy button on the system selection callout. + (id<GREYMatcher>)systemSelectionCalloutCopyButton; +// Matcher for a Copy button, such as the one in the Activity View. This matcher +// is very broad and will look for any button with a matching string. ++ (id<GREYMatcher>)copyActivityButton API_AVAILABLE(ios(13)); + // Matcher for the Copy Link option in the updated context menus when long // pressing on a link. |useNewString| determines which string to use. + (id<GREYMatcher>)copyLinkButtonWithUseNewString:(BOOL)useNewString;
diff --git a/ios/chrome/test/earl_grey/chrome_matchers_app_interface.mm b/ios/chrome/test/earl_grey/chrome_matchers_app_interface.mm index c4434072..24ede46 100644 --- a/ios/chrome/test/earl_grey/chrome_matchers_app_interface.mm +++ b/ios/chrome/test/earl_grey/chrome_matchers_app_interface.mm
@@ -700,6 +700,21 @@ [self systemSelectionCallout], nil); } ++ (id<GREYMatcher>)systemSelectionCalloutLinkToTextButton { + return grey_allOf(grey_accessibilityLabel( + l10n_util::GetNSString(IDS_IOS_SHARE_LINK_TO_TEXT)), + [self systemSelectionCallout], nil); +} + ++ (id<GREYMatcher>)copyActivityButton API_AVAILABLE(ios(13)) { + id<GREYMatcher> copyStaticText = [ChromeMatchersAppInterface + staticTextWithAccessibilityLabel:l10n_util::GetNSString( + IDS_IOS_SHARE_MENU_COPY)]; + return grey_allOf( + copyStaticText, + grey_ancestor(grey_kindOfClassName(@"UIActivityActionGroupCell")), nil); +} + + (id<GREYMatcher>)copyLinkButtonWithUseNewString:(BOOL)useNewString { int stringId = useNewString ? IDS_IOS_COPY_LINK_ACTION_TITLE : IDS_IOS_CONTENT_CONTEXT_COPY;
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1 index f0c0d726..3bd5099 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -1158047afef60a518415a6f3fcb2c4ed33f44f56 \ No newline at end of file +277fbdfb6054efb319b87f894a2de1ca00a12c7f \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1 index 6906daa..71fbc7c6 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -d6c76390de6ee64198fb94805b04ecfa57936307 \ No newline at end of file +4a2d3e8ae2eaea6442c96caf702b6d54e9291183 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.arm64.zip.sha1 index 3f36d51..2a8af0a 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -caad13a3e31e7be41532f338e7acf8e79f563024 \ No newline at end of file +3df204948f30945444b82f3d91bcd53bf320680e \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1 index 9ecd94d..37e64127 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -8fdb33fd0c33854da7306fcdc3170ec0760eaf8e \ No newline at end of file +e2cd261baaea0ab09073d1df758cfd073924fcec \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1 index 6d44f9e8..f72bb99 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -7614942a3c3dbee7e2f7d5b2984944d5e6c23988 \ No newline at end of file +5916773e988ac837b6a9c2f2f196a8c609fa8c31 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1 index 41618c6..0a97b7e 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -39a2fb61c6a40720ce9256748fb6a2d82397ead1 \ No newline at end of file +a61bc31d7477ab99e66eebd294001f776cdacf67 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1 index e75cc5b..f68df8d 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -e6943071459c46f55e072046821e09b20ba84457 \ No newline at end of file +f6bba9f3105865caa9a58b3f60beaee095b0a288 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1 index 34e69e8..e342cae 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -04baae7a3af07d6ed1f60bce920a5823bdae318b \ No newline at end of file +14e715972560ed84beca38e4a8c502fc1a6025bd \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1 index 39c9931b..0164480 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -f25ae3973b66ad12a73a876bebb3d84b41425518 \ No newline at end of file +8b0095bf9ca037142a286612bf55c9ed0772b70f \ No newline at end of file
diff --git a/media/audio/cras/audio_manager_cras.cc b/media/audio/cras/audio_manager_cras.cc index a78ad96..4d38ac8 100644 --- a/media/audio/cras/audio_manager_cras.cc +++ b/media/audio/cras/audio_manager_cras.cc
@@ -92,6 +92,9 @@ AudioParameters::HardwareCapabilities(limits::kMinAudioBufferSize, limits::kMaxAudioBufferSize)); + if (CrasHasKeyboardMic()) + params.set_effects(AudioParameters::KEYBOARD_MIC); + // Allow experimentation with system echo cancellation with all devices, // but enable it by default on devices that actually support it. params.set_effects(params.effects() |
diff --git a/media/audio/cras/cras_util.cc b/media/audio/cras/cras_util.cc index d7be14b..e40376e6 100644 --- a/media/audio/cras/cras_util.cc +++ b/media/audio/cras/cras_util.cc
@@ -18,6 +18,7 @@ const char kInternalInputVirtualDevice[] = "Built-in mic"; const char kInternalOutputVirtualDevice[] = "Built-in speaker"; const char kHeadphoneLineOutVirtualDevice[] = "Headphone/Line Out"; +const char kKeyBoardMic[] = "KEYBOARD_MIC"; // Returns if that an input or output audio device is for simple usage like // playback or recording for user. In contrast, audio device such as loopback, @@ -143,6 +144,29 @@ return devices; } +bool CrasHasKeyboardMic() { + cras_client* client = CrasConnect(); + if (!client) + return false; + + struct cras_iodev_info devs[CRAS_MAX_IODEVS]; + struct cras_ionode_info nodes[CRAS_MAX_IONODES]; + size_t num_devs = CRAS_MAX_IODEVS, num_nodes = CRAS_MAX_IONODES; + + int rc = + cras_client_get_input_devices(client, devs, nodes, &num_devs, &num_nodes); + if (rc < 0) { + LOG(ERROR) << "Failed to get devices: " << std::strerror(rc); + return false; + } + + for (size_t i = 0; i < num_nodes; i++) { + if (std::string(nodes[i].type) == kKeyBoardMic) + return true; + } + return false; +} + int CrasGetAecSupported() { cras_client* client = CrasConnect(); if (!client)
diff --git a/media/audio/cras/cras_util.h b/media/audio/cras/cras_util.h index db3b84a..9481d757 100644 --- a/media/audio/cras/cras_util.h +++ b/media/audio/cras/cras_util.h
@@ -31,6 +31,9 @@ // Enumerates all devices of |type|. std::vector<CrasDevice> CrasGetAudioDevices(DeviceType type); +// Returns if there is a keyboard mic in CRAS. +bool CrasHasKeyboardMic(); + // Returns if system AEC is supported in CRAS. int CrasGetAecSupported();
diff --git a/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc b/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc index c43bf9f..621eba78 100644 --- a/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc +++ b/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc
@@ -127,6 +127,13 @@ jea_factory_ = std::move(jea_factory); base::WaitableEvent started(base::WaitableEvent::ResetPolicy::MANUAL, base::WaitableEvent::InitialState::NOT_SIGNALED); + // It's important we generate tokens before creating the socket, because once + // it is available, everyone connecting to socket would start fetching + // tokens. + if (!token_manager_.GenerateServerToken()) { + LOG(ERROR) << "Failed to generate authentication token for server"; + return false; + } blocking_io_task_runner_->PostTask( FROM_HERE, base::BindOnce(&CameraHalDispatcherImpl::CreateSocket,
diff --git a/media/capture/video/chromeos/token_manager.cc b/media/capture/video/chromeos/token_manager.cc index faf66ed..47ae6a1 100644 --- a/media/capture/video/chromeos/token_manager.cc +++ b/media/capture/video/chromeos/token_manager.cc
@@ -4,11 +4,72 @@ #include "media/capture/video/chromeos/token_manager.h" +#include <grp.h> +#include <sys/types.h> +#include <unistd.h> +#include <string> + +#include <base/files/file_path.h> +#include <base/files/file_util.h> +#include <base/strings/string_number_conversions.h> +#include <base/strings/string_util.h> + +namespace { + +gid_t GetArcCameraGid() { + auto* group = getgrnam("arc-camera"); + return group != nullptr ? group->gr_gid : 0; +} + +bool EnsureTokenDirectoryExists(const base::FilePath& token_path) { + static const gid_t gid = GetArcCameraGid(); + if (gid == 0) { + LOG(ERROR) << "Failed to query the GID of arc-camera"; + return false; + } + + base::FilePath dir_name = token_path.DirName(); + if (!base::CreateDirectory(dir_name) || + !base::SetPosixFilePermissions(dir_name, 0770)) { + LOG(ERROR) << "Failed to create token directory at " + << token_path.AsUTF8Unsafe(); + return false; + } + + if (chown(dir_name.AsUTF8Unsafe().c_str(), -1, gid) != 0) { + LOG(ERROR) << "Failed to chown token directory to arc-camera"; + return false; + } + return true; +} + +} // namespace + namespace media { TokenManager::TokenManager() = default; TokenManager::~TokenManager() = default; +bool TokenManager::GenerateServerToken() { + static constexpr char kServerTokenPath[] = "/run/camera_tokens/server/token"; + base::FilePath token_path(kServerTokenPath); + + if (!EnsureTokenDirectoryExists(token_path)) { + LOG(ERROR) << "Failed to ensure server token directory exists"; + return false; + } + base::File token_file( + token_path, base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); + if (!token_file.IsValid()) { + LOG(ERROR) << "Failed to create server token file"; + return false; + } + server_token_ = base::UnguessableToken::Create(); + std::string token_string = server_token_.ToString(); + token_file.WriteAtCurrentPos(token_string.c_str(), token_string.length()); + return true; +} + base::UnguessableToken TokenManager::GetTokenForTrustedClient( cros::mojom::CameraClientType type) { // pluginvm's token should be generated by vm_permission_service.
diff --git a/media/capture/video/chromeos/token_manager.h b/media/capture/video/chromeos/token_manager.h index 242d6621..40d77b8 100644 --- a/media/capture/video/chromeos/token_manager.h +++ b/media/capture/video/chromeos/token_manager.h
@@ -16,6 +16,8 @@ TokenManager(); ~TokenManager(); + bool GenerateServerToken(); + base::UnguessableToken GetTokenForTrustedClient( cros::mojom::CameraClientType type); @@ -23,6 +25,7 @@ const base::UnguessableToken& token); private: + base::UnguessableToken server_token_; base::flat_map<cros::mojom::CameraClientType, base::UnguessableToken> client_token_map_; };
diff --git a/media/gpu/chromeos/vd_video_decode_accelerator.cc b/media/gpu/chromeos/vd_video_decode_accelerator.cc index fb085cba..feaf6a45 100644 --- a/media/gpu/chromeos/vd_video_decode_accelerator.cc +++ b/media/gpu/chromeos/vd_video_decode_accelerator.cc
@@ -291,6 +291,12 @@ notify_layout_changed_cb_ = std::move(notify_layout_changed_cb); import_frame_cb_ = std::move(import_frame_cb); + // Stop tracking currently-allocated pictures, otherwise the count will be + // corrupted as we import new frames with the same IDs as the old ones. + // The client should still have its own reference to the frame data, which + // will keep it valid for as long as it needs it. + picture_at_client_.clear(); + // After calling ProvidePictureBuffersWithVisibleRect(), the client might // still send buffers with old coded size. We temporarily store at // |pending_coded_size_|. @@ -375,6 +381,14 @@ base::BindOnce(&VdVideoDecodeAccelerator::OnFrameReleasedThunk, weak_this_, client_task_runner_, std::move(origin_frame))); + // This should not happen - picture_at_client_ should either be initially + // empty, or be cleared as RequestFrames() is called. However for extra safety + // let's make sure the slot for the picture buffer ID is free, otherwise we + // might lose track of the reference count and keep frames out of the pool + // forever. + DCHECK(picture_at_client_.find(picture_buffer_id) == + picture_at_client_.end()); + DCHECK(import_frame_cb_); import_frame_cb_.Run(std::move(wrapped_frame)); }
diff --git a/net/dns/BUILD.gn b/net/dns/BUILD.gn index bc54c81..5a36c9d 100644 --- a/net/dns/BUILD.gn +++ b/net/dns/BUILD.gn
@@ -47,6 +47,8 @@ "dns_reloader.cc", "dns_reloader.h", "dns_response.cc", + "dns_response_result_extractor.cc", + "dns_response_result_extractor.h", "dns_server_iterator.cc", "dns_server_iterator.h", "dns_session.cc", @@ -391,6 +393,7 @@ "dns_config_service_unittest.cc", "dns_hosts_unittest.cc", "dns_query_unittest.cc", + "dns_response_result_extractor_unittest.cc", "dns_response_unittest.cc", "dns_socket_allocator_unittest.cc", "dns_transaction_unittest.cc",
diff --git a/net/dns/dns_response.cc b/net/dns/dns_response.cc index 7d33499..90c41dec 100644 --- a/net/dns/dns_response.cc +++ b/net/dns/dns_response.cc
@@ -19,6 +19,7 @@ #include "net/base/ip_address.h" #include "net/base/net_errors.h" #include "net/dns/dns_query.h" +#include "net/dns/dns_response_result_extractor.h" #include "net/dns/dns_util.h" #include "net/dns/public/dns_protocol.h" #include "net/dns/record_rdata.h" @@ -520,28 +521,28 @@ for (unsigned i = 0; i < ancount; ++i) { if (!parser.ReadRecord(&record)) - return DNS_MALFORMED_RESPONSE; + return Result::kMalformedRecord; base::TimeDelta record_ttl = base::TimeDelta::FromSeconds(record.ttl); if (record.type == dns_protocol::kTypeCNAME) { // Following the CNAME chain, only if no addresses seen. if (!ip_addresses.empty()) - return DNS_CNAME_AFTER_ADDRESS; + return Result::kCnameAfterResult; if (!base::EqualsCaseInsensitiveASCII(record.name, expected_name)) - return DNS_NAME_MISMATCH; + return Result::kNameMismatch; if (record.rdata.size() != parser.ReadName(record.rdata.begin(), &expected_name)) - return DNS_MALFORMED_CNAME; + return Result::kMalformedCname; ttl = std::min(ttl.value_or(base::TimeDelta::Max()), record_ttl); } else if (record.type == expected_type) { if (record.rdata.size() != expected_size) - return DNS_SIZE_MISMATCH; + return Result::kMalformedResult; if (!base::EqualsCaseInsensitiveASCII(record.name, expected_name)) - return DNS_NAME_MISMATCH; + return Result::kNameMismatch; ttl = std::min(ttl.value_or(base::TimeDelta::Max()), record_ttl); ip_addresses.push_back( @@ -574,7 +575,7 @@ *out_addr_list = AddressList::CreateFromIPAddressList(ip_addresses, expected_name); *out_ttl = ttl; - return DNS_PARSE_OK; + return Result::kOk; } bool DnsResponse::WriteHeader(base::BigEndianWriter* writer,
diff --git a/net/dns/dns_response.h b/net/dns/dns_response.h index 6bc51c9..2901e010 100644 --- a/net/dns/dns_response.h +++ b/net/dns/dns_response.h
@@ -17,6 +17,7 @@ #include "base/strings/string_piece.h" #include "base/time/time.h" #include "net/base/net_export.h" +#include "net/dns/dns_response_result_extractor.h" #include "net/dns/public/dns_protocol.h" namespace base { @@ -112,20 +113,7 @@ class NET_EXPORT_PRIVATE DnsResponse { public: // Possible results from ParseToAddressList. - enum Result { - DNS_PARSE_OK = 0, - DNS_MALFORMED_RESPONSE, // DnsRecordParser failed before the end of - // packet. - DNS_MALFORMED_CNAME, // Could not parse CNAME out of RRDATA. - DNS_NAME_MISMATCH, // Got an address but no ordered chain of CNAMEs - // leads there. - DNS_SIZE_MISMATCH, // Got an address but size does not match. - DNS_CNAME_AFTER_ADDRESS, // Found CNAME after an address record. - DNS_ADDRESS_TTL_MISMATCH, // OBSOLETE. No longer used. - DNS_NO_ADDRESSES, // OBSOLETE. No longer used. - // Only add new values here. - DNS_PARSE_RESULT_MAX, // Bounding value for histograms. - }; + using Result = DnsResponseResultExtractor::ExtractionError; // Constructs a response buffer large enough to store one byte more than // largest possible response, to detect malformed responses. @@ -207,8 +195,8 @@ // This operation is idempotent. DnsRecordParser Parser() const; - // Extracts an AddressList from this response. Returns SUCCESS if succeeded. - // Otherwise returns a detailed error number. + // Extracts an AddressList from this response. + // TODO(crbug.com/1147247): Remove in favor of DnsResponseResultExtractor. Result ParseToAddressList(AddressList* out_addr_list, base::Optional<base::TimeDelta>* out_ttl) const;
diff --git a/net/dns/dns_response_result_extractor.cc b/net/dns/dns_response_result_extractor.cc new file mode 100644 index 0000000..6728d0d36 --- /dev/null +++ b/net/dns/dns_response_result_extractor.cc
@@ -0,0 +1,447 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/dns/dns_response_result_extractor.h" + +#include <limits.h> +#include <stdint.h> + +#include <memory> +#include <unordered_set> +#include <vector> + +#include "base/check.h" +#include "base/metrics/histogram_macros.h" +#include "base/notreached.h" +#include "base/numerics/checked_math.h" +#include "base/optional.h" +#include "base/rand_util.h" +#include "base/time/time.h" +#include "net/base/host_port_pair.h" +#include "net/base/net_errors.h" +#include "net/dns/dns_response.h" +#include "net/dns/dns_util.h" +#include "net/dns/host_cache.h" +#include "net/dns/https_record_rdata.h" +#include "net/dns/public/dns_protocol.h" +#include "net/dns/public/dns_query_type.h" +#include "net/dns/record_parsed.h" +#include "net/dns/record_rdata.h" + +namespace net { + +namespace { + +using ExtractionError = DnsResponseResultExtractor::ExtractionError; + +void SaveMetricsForAdditionalHttpsRecord(const RecordParsed& record, + bool is_unsolicited) { + const HttpsRecordRdata* rdata = record.rdata<HttpsRecordRdata>(); + + // These values are persisted to logs. Entries should not be renumbered and + // numeric values should never be reused. + enum class UnsolicitedHttpsRecordStatus { + kMalformed = 0, + kAlias = 1, + kService = 2, + kMaxValue = kService + } status; + + if (!rdata || rdata->IsMalformed()) { + status = UnsolicitedHttpsRecordStatus::kMalformed; + } else if (rdata->IsAlias()) { + status = UnsolicitedHttpsRecordStatus::kAlias; + } else { + status = UnsolicitedHttpsRecordStatus::kService; + } + + if (is_unsolicited) { + UMA_HISTOGRAM_ENUMERATION("Net.DNS.DnsTask.AdditionalHttps.Unsolicited", + status); + } else { + UMA_HISTOGRAM_ENUMERATION("Net.DNS.DnsTask.AdditionalHttps.Requested", + status); + } +} + +// Sort service targets per RFC2782. In summary, sort first by `priority`, +// lowest first. For targets with the same priority, secondary sort randomly +// using `weight` with higher weighted objects more likely to go first. +std::vector<HostPortPair> SortServiceTargets( + const std::vector<const SrvRecordRdata*>& rdatas) { + std::map<uint16_t, std::unordered_set<const SrvRecordRdata*>> + ordered_by_priority; + for (const SrvRecordRdata* rdata : rdatas) + ordered_by_priority[rdata->priority()].insert(rdata); + + std::vector<HostPortPair> sorted_targets; + for (auto& priority : ordered_by_priority) { + // With (num results) <= UINT16_MAX (and in practice, much less) and + // (weight per result) <= UINT16_MAX, then it should be the case that + // (total weight) <= UINT32_MAX, but use CheckedNumeric for extra safety. + auto total_weight = base::MakeCheckedNum<uint32_t>(0); + for (const SrvRecordRdata* rdata : priority.second) + total_weight += rdata->weight(); + + // Add 1 to total weight because, to deal with 0-weight targets, we want + // our random selection to be inclusive [0, total]. + total_weight++; + + // Order by weighted random. Make such random selections, removing from + // |priority.second| until |priority.second| only contains 1 rdata. + while (priority.second.size() >= 2) { + uint32_t random_selection = + base::RandGenerator(total_weight.ValueOrDie()); + const SrvRecordRdata* selected_rdata = nullptr; + for (const SrvRecordRdata* rdata : priority.second) { + // >= to always select the first target on |random_selection| == 0, + // even if its weight is 0. + if (rdata->weight() >= random_selection) { + selected_rdata = rdata; + break; + } + random_selection -= rdata->weight(); + } + + DCHECK(selected_rdata); + sorted_targets.emplace_back(selected_rdata->target(), + selected_rdata->port()); + total_weight -= selected_rdata->weight(); + size_t removed = priority.second.erase(selected_rdata); + DCHECK_EQ(1u, removed); + } + + DCHECK_EQ(1u, priority.second.size()); + DCHECK_EQ((total_weight - 1).ValueOrDie(), + (*priority.second.begin())->weight()); + const SrvRecordRdata* rdata = *priority.second.begin(); + sorted_targets.emplace_back(rdata->target(), rdata->port()); + } + + return sorted_targets; +} + +ExtractionError ExtractResponseRecords( + const DnsResponse& response, + uint16_t result_qtype, + std::vector<std::unique_ptr<const RecordParsed>>* out_records, + base::Optional<base::TimeDelta>* out_response_ttl) { + DCHECK(out_records); + DCHECK(out_response_ttl); + + out_records->clear(); + out_response_ttl->reset(); + + DnsRecordParser parser = response.Parser(); + + // Expected to be validated by DnsTransaction. + DCHECK_EQ(result_qtype, response.qtype()); + + for (unsigned i = 0; i < response.answer_count(); ++i) { + std::unique_ptr<const RecordParsed> record = + RecordParsed::CreateFrom(&parser, base::Time::Now()); + + if (!record) + return ExtractionError::kMalformedRecord; + if (!base::EqualsCaseInsensitiveASCII(record->name(), + response.GetDottedName())) { + return ExtractionError::kNameMismatch; + } + + // Ignore any records that are not class Internet and type + // |filter_dns_type|. + if (record->klass() == dns_protocol::kClassIN && + record->type() == result_qtype) { + base::TimeDelta ttl = base::TimeDelta::FromSeconds(record->ttl()); + *out_response_ttl = + std::min(out_response_ttl->value_or(base::TimeDelta::Max()), ttl); + + out_records->push_back(std::move(record)); + } + } + + // For NXDOMAIN or NODATA (NOERROR with 0 answers), attempt to find a TTL + // via an SOA record. + if (response.rcode() == dns_protocol::kRcodeNXDOMAIN || + (response.answer_count() == 0 && + response.rcode() == dns_protocol::kRcodeNOERROR)) { + bool soa_found = false; + for (unsigned i = 0; i < response.authority_count(); ++i) { + DnsResourceRecord record; + if (parser.ReadRecord(&record) && record.type == dns_protocol::kTypeSOA) { + soa_found = true; + base::TimeDelta ttl = base::TimeDelta::FromSeconds(record.ttl); + *out_response_ttl = + std::min(out_response_ttl->value_or(base::TimeDelta::Max()), ttl); + } + } + + // Per RFC2308, section 5, never cache negative results unless an SOA + // record is found. + if (!soa_found) + out_response_ttl->reset(); + } + + for (unsigned i = 0; i < response.additional_answer_count(); ++i) { + std::unique_ptr<const RecordParsed> record = + RecordParsed::CreateFrom(&parser, base::Time::Now()); + if (record && record->klass() == dns_protocol::kClassIN && + record->type() == dns_protocol::kTypeHttps) { + bool is_unsolicited = result_qtype != dns_protocol::kTypeHttps; + SaveMetricsForAdditionalHttpsRecord(*record, is_unsolicited); + } + } + + return ExtractionError::kOk; +} + +ExtractionError ExtractAddressResults(const DnsResponse& response, + uint16_t address_qtype, + HostCache::Entry* out_results) { + // TODO(crbug.com/1147247): Move address result handling from DnsResponse. + NOTIMPLEMENTED(); + return ExtractionError::kUnexpected; +} + +ExtractionError ExtractTxtResults(const DnsResponse& response, + HostCache::Entry* out_results) { + DCHECK(out_results); + + std::vector<std::unique_ptr<const RecordParsed>> records; + base::Optional<base::TimeDelta> response_ttl; + ExtractionError extraction_error = ExtractResponseRecords( + response, dns_protocol::kTypeTXT, &records, &response_ttl); + + if (extraction_error != ExtractionError::kOk) { + *out_results = HostCache::Entry(ERR_DNS_MALFORMED_RESPONSE, + HostCache::Entry::SOURCE_DNS); + return extraction_error; + } + + std::vector<std::string> text_records; + for (const auto& record : records) { + const TxtRecordRdata* rdata = record->rdata<net::TxtRecordRdata>(); + text_records.insert(text_records.end(), rdata->texts().begin(), + rdata->texts().end()); + } + + *out_results = HostCache::Entry( + text_records.empty() ? ERR_NAME_NOT_RESOLVED : OK, + std::move(text_records), HostCache::Entry::SOURCE_DNS, response_ttl); + return ExtractionError::kOk; +} + +ExtractionError ExtractPointerResults(const DnsResponse& response, + HostCache::Entry* out_results) { + DCHECK(out_results); + + std::vector<std::unique_ptr<const RecordParsed>> records; + base::Optional<base::TimeDelta> response_ttl; + ExtractionError extraction_error = ExtractResponseRecords( + response, dns_protocol::kTypePTR, &records, &response_ttl); + + if (extraction_error != ExtractionError::kOk) { + *out_results = HostCache::Entry(ERR_DNS_MALFORMED_RESPONSE, + HostCache::Entry::SOURCE_DNS); + return extraction_error; + } + + std::vector<HostPortPair> pointers; + for (const auto& record : records) { + const PtrRecordRdata* rdata = record->rdata<net::PtrRecordRdata>(); + std::string pointer = rdata->ptrdomain(); + + // Skip pointers to the root domain. + if (!pointer.empty()) + pointers.emplace_back(std::move(pointer), 0); + } + + *out_results = HostCache::Entry(pointers.empty() ? ERR_NAME_NOT_RESOLVED : OK, + std::move(pointers), + HostCache::Entry::SOURCE_DNS, response_ttl); + return ExtractionError::kOk; +} + +ExtractionError ExtractServiceResults(const DnsResponse& response, + HostCache::Entry* out_results) { + DCHECK(out_results); + + std::vector<std::unique_ptr<const RecordParsed>> records; + base::Optional<base::TimeDelta> response_ttl; + ExtractionError extraction_error = ExtractResponseRecords( + response, dns_protocol::kTypeSRV, &records, &response_ttl); + + if (extraction_error != ExtractionError::kOk) { + *out_results = HostCache::Entry(ERR_DNS_MALFORMED_RESPONSE, + HostCache::Entry::SOURCE_DNS); + return extraction_error; + } + + std::vector<const SrvRecordRdata*> fitered_rdatas; + for (const auto& record : records) { + const SrvRecordRdata* rdata = record->rdata<net::SrvRecordRdata>(); + + // Skip pointers to the root domain. + if (!rdata->target().empty()) + fitered_rdatas.push_back(rdata); + } + + std::vector<HostPortPair> ordered_service_targets = + SortServiceTargets(fitered_rdatas); + + *out_results = HostCache::Entry( + ordered_service_targets.empty() ? ERR_NAME_NOT_RESOLVED : OK, + std::move(ordered_service_targets), HostCache::Entry::SOURCE_DNS, + response_ttl); + return ExtractionError::kOk; +} + +ExtractionError ExtractIntegrityResults(const DnsResponse& response, + HostCache::Entry* out_results) { + DCHECK(out_results); + + base::Optional<base::TimeDelta> response_ttl; + std::vector<std::unique_ptr<const RecordParsed>> records; + ExtractionError extraction_error = + ExtractResponseRecords(response, dns_protocol::kExperimentalTypeIntegrity, + &records, &response_ttl); + + // If the response couldn't be parsed, assume no INTEGRITY records, and + // pretend success. This is a temporary hack to keep errors with INTEGRITY + // (which is only used for experiments) from affecting non-experimental + // results, e.g. due to a parse error being treated as fatal for the whole + // HostResolver request. + // + // TODO(crbug.com/1138620): Cleanup handling of fatal vs non-fatal errors and + // the organization responsibility for handling them so that this extractor + // can more sensibly return honest results rather than lying to try to be + // helpful to HostResolverManager. + if (extraction_error != ExtractionError::kOk) { + *out_results = + DnsResponseResultExtractor::CreateEmptyResult(DnsQueryType::INTEGRITY); + return ExtractionError::kOk; + } + + // Condense results into a list of booleans. We do not cache the results, + // but this enables us to write some unit tests. + std::vector<bool> condensed_results; + for (const auto& record : records) { + const IntegrityRecordRdata& rdata = *record->rdata<IntegrityRecordRdata>(); + condensed_results.push_back(rdata.IsIntact()); + } + + // As another temporary hack for the experimental nature of INTEGRITY, always + // claim no results, even on success. This will let it merge with address + // results since an address request should be considered successful overall + // only with A/AAAA results, not INTEGRITY results. + // + // TODO(crbug.com/1138620): Remove and handle the merging more intelligently + // in HostResolverManager. + *out_results = + HostCache::Entry(ERR_NAME_NOT_RESOLVED, std::move(condensed_results), + HostCache::Entry::SOURCE_DNS, response_ttl); + DCHECK_EQ(extraction_error, ExtractionError::kOk); + return extraction_error; +} + +ExtractionError ExtractHttpsResults(const DnsResponse& response, + HostCache::Entry* out_results) { + DCHECK(out_results); + + base::Optional<base::TimeDelta> response_ttl; + std::vector<std::unique_ptr<const RecordParsed>> records; + ExtractionError extraction_error = ExtractResponseRecords( + response, dns_protocol::kTypeHttps, &records, &response_ttl); + + // If the response couldn't be parsed, assume no HTTPS records, and pretend + // success. This is a temporary hack to keep errors with HTTPS (which is + // currently only used for experiments) from affecting non-experimental + // results, e.g. due to a parse error being treated as fatal for the whole + // HostResolver request. + // + // TODO(crbug.com/1138620): Cleanup handling of fatal vs non-fatal errors and + // the organization responsibility for handling them so that this extractor + // can more sensibly return honest results rather than lying to try to be + // helpful to HostResolverManager. + if (extraction_error != ExtractionError::kOk) { + *out_results = + DnsResponseResultExtractor::CreateEmptyResult(DnsQueryType::HTTPS); + return ExtractionError::kOk; + } + + // Condense results into a list of booleans. We do not cache the results, + // but this enables us to write some unit tests. + std::vector<bool> condensed_results; + for (const auto& record : records) { + const HttpsRecordRdata& rdata = *record->rdata<HttpsRecordRdata>(); + condensed_results.push_back(!rdata.IsMalformed()); + } + + // As another temporary hack for experimental usage of HTTPS, always claim no + // results, even on success. This will let it merge with address results + // since an address request should be considered successful overall only with + // A/AAAA results, not HTTPS results. + // + // TODO(crbug.com/1138620): Remove and handle the merging more intelligently + // in HostResolverManager. + *out_results = + HostCache::Entry(ERR_NAME_NOT_RESOLVED, std::move(condensed_results), + HostCache::Entry::SOURCE_DNS, response_ttl); + DCHECK_EQ(extraction_error, ExtractionError::kOk); + return extraction_error; +} + +} // namespace + +DnsResponseResultExtractor::DnsResponseResultExtractor( + const DnsResponse* response) + : response_(response) { + DCHECK(response_); +} + +DnsResponseResultExtractor::~DnsResponseResultExtractor() = default; + +DnsResponseResultExtractor::ExtractionError +DnsResponseResultExtractor::ExtractDnsResults( + DnsQueryType query_type, + HostCache::Entry* out_results) const { + DCHECK(out_results); + + switch (query_type) { + case DnsQueryType::UNSPECIFIED: + // Should create multiple transactions with specified types. + NOTREACHED(); + return ExtractionError::kUnexpected; + case DnsQueryType::A: + case DnsQueryType::AAAA: + return ExtractAddressResults(*response_, DnsQueryTypeToQtype(query_type), + out_results); + case DnsQueryType::TXT: + return ExtractTxtResults(*response_, out_results); + case DnsQueryType::PTR: + return ExtractPointerResults(*response_, out_results); + case DnsQueryType::SRV: + return ExtractServiceResults(*response_, out_results); + case DnsQueryType::INTEGRITY: + return ExtractIntegrityResults(*response_, out_results); + case DnsQueryType::HTTPS: + return ExtractHttpsResults(*response_, out_results); + } +} + +// static +HostCache::Entry DnsResponseResultExtractor::CreateEmptyResult( + DnsQueryType query_type) { + if (query_type != DnsQueryType::INTEGRITY && + query_type != DnsQueryType::HTTPS) { + // Currently only used for INTEGRITY/HTTPS. + NOTIMPLEMENTED(); + return HostCache::Entry(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + } + + return HostCache::Entry(ERR_NAME_NOT_RESOLVED, std::vector<bool>(), + HostCache::Entry::SOURCE_DNS); +} + +} // namespace net
diff --git a/net/dns/dns_response_result_extractor.h b/net/dns/dns_response_result_extractor.h new file mode 100644 index 0000000..520e7f9 --- /dev/null +++ b/net/dns/dns_response_result_extractor.h
@@ -0,0 +1,70 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_DNS_DNS_RESPONSE_RESULT_EXTRACTOR_H_ +#define NET_DNS_DNS_RESPONSE_RESULT_EXTRACTOR_H_ + +#include <stdint.h> + +#include "net/base/net_export.h" +#include "net/dns/host_cache.h" +#include "net/dns/public/dns_query_type.h" + +namespace net { + +class DnsResponse; + +// Higher-level parser to take a DnsResponse and extract results. +class NET_EXPORT_PRIVATE DnsResponseResultExtractor { + public: + enum class ExtractionError { + kOk = 0, + // Record failed to parse. + kMalformedRecord, + // Malformed CNAME + kMalformedCname, + // Found CNAME or result record with an unexpected name. + kNameMismatch, + // Malformed result record + kMalformedResult, + // CNAME record after a result record + kCnameAfterResult, + // Not expected. Used for DCHECKs. + kUnexpected, + }; + + explicit DnsResponseResultExtractor(const DnsResponse* response); + ~DnsResponseResultExtractor(); + + DnsResponseResultExtractor(const DnsResponseResultExtractor&) = delete; + DnsResponseResultExtractor& operator=(const DnsResponseResultExtractor&) = + delete; + + // Extract results from the response. `query_type` must match the qtype from + // the DNS query, and it must have already been validated (expected to be done + // by DnsTransaction) that the response matches the query. + // + // May have the side effect of recording metrics about DnsResponses as they + // are parsed, so while not an absolute requirement, any given DnsResponse + // should only be used and extracted from at most once. + // + // Note that for INTEGRITY or HTTPS, this will ignore errors and pretend it + // successfully parsed a no-result response. + // TODO(crbug.com/1138620): Cleanup this "helpfulness" and let + // HostResolverManager handle whether or not errors should be fatal due to + // experimentation. + ExtractionError ExtractDnsResults(DnsQueryType query_type, + HostCache::Entry* out_results) const; + + // Creates the results of a NODATA response (successfully parsed but without + // any results) appropriate for `query_type`. + static HostCache::Entry CreateEmptyResult(DnsQueryType query_type); + + private: + const DnsResponse* const response_; +}; + +} // namespace net + +#endif // NET_DNS_DNS_RESPONSE_RESULT_EXTRACTOR_H_
diff --git a/net/dns/dns_response_result_extractor_unittest.cc b/net/dns/dns_response_result_extractor_unittest.cc new file mode 100644 index 0000000..84ce031 --- /dev/null +++ b/net/dns/dns_response_result_extractor_unittest.cc
@@ -0,0 +1,480 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/dns/dns_response_result_extractor.h" + +#include <string> +#include <utility> +#include <vector> + +#include "base/optional.h" +#include "net/base/host_port_pair.h" +#include "net/base/net_errors.h" +#include "net/dns/dns_query.h" +#include "net/dns/dns_response.h" +#include "net/dns/dns_test_util.h" +#include "net/dns/host_cache.h" +#include "net/dns/public/dns_protocol.h" +#include "net/dns/public/dns_query_type.h" +#include "net/test/gtest_util.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace net { +namespace { + +TEST(DnsResponseResultExtractorTest, ExtractsTxtResponses) { + // Simulate two separate DNS records, each with multiple strings. + std::vector<std::string> foo_records = {"foo1", "foo2", "foo3"}; + std::vector<std::string> bar_records = {"bar1", "bar2"}; + std::vector<std::vector<std::string>> text_records = {foo_records, + bar_records}; + + DnsResponse response = + BuildTestDnsTextResponse("name.test", std::move(text_records)); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::TXT, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsOk()); + + // Order between separate DNS records is undefined, but each record should + // stay in order as that order may be meaningful. + ASSERT_THAT(results.text_records(), + testing::Optional(testing::UnorderedElementsAre( + "foo1", "foo2", "foo3", "bar1", "bar2"))); + std::vector<std::string> results_vector = results.text_records().value(); + EXPECT_NE(results_vector.end(), + std::search(results_vector.begin(), results_vector.end(), + foo_records.begin(), foo_records.end())); + EXPECT_NE(results_vector.end(), + std::search(results_vector.begin(), results_vector.end(), + bar_records.begin(), bar_records.end())); +} + +TEST(DnsResponseResultExtractorTest, ExtractsNxdomainTxtResponses) { + DnsResponse response = BuildTestDnsResponse( + "name.test", dns_protocol::kTypeTXT, {} /* answers */, + {BuildTestDnsRecord("name.test", dns_protocol::kTypeSOA, + "fake rdata")} /* authority */, + {} /* additional */, dns_protocol::kRcodeNOERROR); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::TXT, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsError(ERR_NAME_NOT_RESOLVED)); + EXPECT_THAT(results.text_records(), testing::Optional(testing::IsEmpty())); +} + +TEST(DnsResponseResultExtractorTest, ExtractsNodataTxtResponses) { + DnsResponse response = + BuildTestDnsTextResponse("name.test", {} /* text_records */); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::TXT, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsError(ERR_NAME_NOT_RESOLVED)); + EXPECT_THAT(results.text_records(), testing::Optional(testing::IsEmpty())); +} + +TEST(DnsResponseResultExtractorTest, RejectsMalformedTxtRecord) { + DnsResponse response = BuildTestDnsResponse( + "name.test", dns_protocol::kTypeTXT, + {BuildTestDnsRecord("name.test", dns_protocol::kTypeTXT, + "malformed rdata")} /* answers */); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::TXT, &results), + DnsResponseResultExtractor::ExtractionError::kMalformedRecord); + + EXPECT_THAT(results.error(), test::IsError(ERR_DNS_MALFORMED_RESPONSE)); +} + +TEST(DnsResponseResultExtractorTest, RejectsWrongNameTxtRecord) { + DnsResponse response = + BuildTestDnsTextResponse("name.test", {{"foo"}}, "different.test"); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::TXT, &results), + DnsResponseResultExtractor::ExtractionError::kNameMismatch); + + EXPECT_THAT(results.error(), test::IsError(ERR_DNS_MALFORMED_RESPONSE)); +} + +TEST(DnsResponseResultExtractorTest, IgnoresWrongTypeTxtResponses) { + DnsResponse response = BuildTestDnsResponse( + "name.test", dns_protocol::kTypeTXT, + {BuildTestAddressRecord("name.test", IPAddress(1, 2, 3, 4))}); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::TXT, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsError(ERR_NAME_NOT_RESOLVED)); + EXPECT_THAT(results.text_records(), testing::Optional(testing::IsEmpty())); +} + +TEST(DnsResponseResultExtractorTest, ExtractsPtrResponses) { + DnsResponse response = + BuildTestDnsPointerResponse("name.test", {"foo.com", "bar.com"}); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::PTR, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsOk()); + + // Order between separate records is undefined. + EXPECT_THAT(results.hostnames(), + testing::Optional(testing::UnorderedElementsAre( + HostPortPair("foo.com", 0), HostPortPair("bar.com", 0)))); +} + +TEST(DnsResponseResultExtractorTest, ExtractsNxdomainPtrResponses) { + DnsResponse response = BuildTestDnsResponse( + "name.test", dns_protocol::kTypePTR, {} /* answers */, + {BuildTestDnsRecord("name.test", dns_protocol::kTypeSOA, + "fake rdata")} /* authority */, + {} /* additional */, dns_protocol::kRcodeNOERROR); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::PTR, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsError(ERR_NAME_NOT_RESOLVED)); + EXPECT_THAT(results.hostnames(), testing::Optional(testing::IsEmpty())); +} + +TEST(DnsResponseResultExtractorTest, ExtractsNodataPtrResponses) { + DnsResponse response = + BuildTestDnsPointerResponse("name.test", {} /* pointer_names */); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::PTR, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsError(ERR_NAME_NOT_RESOLVED)); + EXPECT_THAT(results.hostnames(), testing::Optional(testing::IsEmpty())); +} + +TEST(DnsResponseResultExtractorTest, RejectsMalformedPtrRecord) { + DnsResponse response = BuildTestDnsResponse( + "name.test", dns_protocol::kTypePTR, + {BuildTestDnsRecord("name.test", dns_protocol::kTypePTR, + "malformed rdata")} /* answers */); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::PTR, &results), + DnsResponseResultExtractor::ExtractionError::kMalformedRecord); + + EXPECT_THAT(results.error(), test::IsError(ERR_DNS_MALFORMED_RESPONSE)); +} + +TEST(DnsResponseResultExtractorTest, RejectsWrongNamePtrRecord) { + DnsResponse response = BuildTestDnsPointerResponse( + "name.test", {"foo.com", "bar.com"}, "different.test"); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::PTR, &results), + DnsResponseResultExtractor::ExtractionError::kNameMismatch); + + EXPECT_THAT(results.error(), test::IsError(ERR_DNS_MALFORMED_RESPONSE)); +} + +TEST(DnsResponseResultExtractorTest, IgnoresWrongTypePtrResponses) { + DnsResponse response = BuildTestDnsResponse( + "name.test", dns_protocol::kTypePTR, + {BuildTestAddressRecord("name.test", IPAddress(1, 2, 3, 4))}); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::PTR, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsError(ERR_NAME_NOT_RESOLVED)); + EXPECT_THAT(results.hostnames(), testing::Optional(testing::IsEmpty())); +} + +TEST(DnsResponseResultExtractorTest, ExtractsSrvResponses) { + const TestServiceRecord kRecord1 = {2, 3, 1223, "foo.com"}; + const TestServiceRecord kRecord2 = {5, 10, 80, "bar.com"}; + const TestServiceRecord kRecord3 = {5, 1, 5, "google.com"}; + const TestServiceRecord kRecord4 = {2, 100, 12345, "chromium.org"}; + + DnsResponse response = BuildTestDnsServiceResponse( + "name.test", {kRecord1, kRecord2, kRecord3, kRecord4}); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::SRV, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsOk()); + + // Expect ordered by priority, and random within a priority. + base::Optional<std::vector<HostPortPair>> result_hosts = results.hostnames(); + ASSERT_THAT( + result_hosts, + testing::Optional(testing::UnorderedElementsAre( + HostPortPair("foo.com", 1223), HostPortPair("bar.com", 80), + HostPortPair("google.com", 5), HostPortPair("chromium.org", 12345)))); + auto priority2 = std::vector<HostPortPair>(result_hosts.value().begin(), + result_hosts.value().begin() + 2); + EXPECT_THAT(priority2, testing::UnorderedElementsAre( + HostPortPair("foo.com", 1223), + HostPortPair("chromium.org", 12345))); + auto priority5 = std::vector<HostPortPair>(result_hosts.value().begin() + 2, + result_hosts.value().end()); + EXPECT_THAT(priority5, + testing::UnorderedElementsAre(HostPortPair("bar.com", 80), + HostPortPair("google.com", 5))); +} + +// 0-weight services are allowed. Ensure that we can handle such records, +// especially the case where all entries have weight 0. +TEST(DnsResponseResultExtractorTest, ExtractsZeroWeightSrvResponses) { + const TestServiceRecord kRecord1 = {5, 0, 80, "bar.com"}; + const TestServiceRecord kRecord2 = {5, 0, 5, "google.com"}; + + DnsResponse response = + BuildTestDnsServiceResponse("name.test", {kRecord1, kRecord2}); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::SRV, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsOk()); + + // Expect ordered by priority, and random within a priority. + EXPECT_THAT(results.hostnames(), + testing::Optional(testing::UnorderedElementsAre( + HostPortPair("bar.com", 80), HostPortPair("google.com", 5)))); +} + +TEST(DnsResponseResultExtractorTest, ExtractsNxdomainSrvResponses) { + DnsResponse response = BuildTestDnsResponse( + "name.test", dns_protocol::kTypeSRV, {} /* answers */, + {BuildTestDnsRecord("name.test", dns_protocol::kTypeSOA, + "fake rdata")} /* authority */, + {} /* additional */, dns_protocol::kRcodeNOERROR); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::SRV, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsError(ERR_NAME_NOT_RESOLVED)); + EXPECT_THAT(results.hostnames(), testing::Optional(testing::IsEmpty())); +} + +TEST(DnsResponseResultExtractorTest, ExtractsNodataSrvResponses) { + DnsResponse response = + BuildTestDnsServiceResponse("name.test", {} /* service_records */); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::SRV, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsError(ERR_NAME_NOT_RESOLVED)); + EXPECT_THAT(results.hostnames(), testing::Optional(testing::IsEmpty())); +} + +TEST(DnsResponseResultExtractorTest, RejectsMalformedSrvRecord) { + DnsResponse response = BuildTestDnsResponse( + "name.test", dns_protocol::kTypeSRV, + {BuildTestDnsRecord("name.test", dns_protocol::kTypeSRV, + "malformed rdata")} /* answers */); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::SRV, &results), + DnsResponseResultExtractor::ExtractionError::kMalformedRecord); + + EXPECT_THAT(results.error(), test::IsError(ERR_DNS_MALFORMED_RESPONSE)); +} + +TEST(DnsResponseResultExtractorTest, RejectsWrongNameSrvRecord) { + const TestServiceRecord kRecord = {2, 3, 1223, "foo.com"}; + DnsResponse response = + BuildTestDnsServiceResponse("name.test", {kRecord}, "different.test"); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::SRV, &results), + DnsResponseResultExtractor::ExtractionError::kNameMismatch); + + EXPECT_THAT(results.error(), test::IsError(ERR_DNS_MALFORMED_RESPONSE)); +} + +TEST(DnsResponseResultExtractorTest, IgnoresWrongTypeSrvResponses) { + DnsResponse response = BuildTestDnsResponse( + "name.test", dns_protocol::kTypeSRV, + {BuildTestAddressRecord("name.test", IPAddress(1, 2, 3, 4))}); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::SRV, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsError(ERR_NAME_NOT_RESOLVED)); + EXPECT_THAT(results.hostnames(), testing::Optional(testing::IsEmpty())); +} + +TEST(DnsResponseResultExtractorTest, ExtractsHttpsResponses) { + DnsResponse response = BuildTestDnsResponse( + "https.test", dns_protocol::kTypeHttps, + {BuildTestHttpsAliasRecord("https.test", "alias.test")}); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::HTTPS, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + // Experimental type, so does not affect overall result. + EXPECT_THAT(results.error(), test::IsError(ERR_NAME_NOT_RESOLVED)); + + EXPECT_THAT(results.experimental_results(), + testing::Optional(testing::ElementsAre(true))); +} + +TEST(DnsResponseResultExtractorTest, ExtractsNxdomainHttpsResponses) { + DnsResponse response = BuildTestDnsResponse( + "https.test", dns_protocol::kTypeHttps, {} /* answers */, + {BuildTestDnsRecord("name.test", dns_protocol::kTypeSOA, + "fake rdata")} /* authority */, + {} /* additional */, dns_protocol::kRcodeNOERROR); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::HTTPS, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsError(ERR_NAME_NOT_RESOLVED)); + EXPECT_THAT(results.experimental_results(), + testing::Optional(testing::IsEmpty())); +} + +TEST(DnsResponseResultExtractorTest, ExtractsNodataHttpsResponses) { + DnsResponse response = BuildTestDnsResponse( + "https.test", dns_protocol::kTypeHttps, {} /* answers */); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::HTTPS, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsError(ERR_NAME_NOT_RESOLVED)); + EXPECT_THAT(results.experimental_results(), + testing::Optional(testing::IsEmpty())); +} + +TEST(DnsResponseResultExtractorTest, RecognizesMalformedHttpsRecord) { + DnsResponse response = BuildTestDnsResponse( + "https.test", dns_protocol::kTypeHttps, + {BuildTestDnsRecord("https.test", dns_protocol::kTypeHttps, + "malformed rdata")} /* answers */); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::HTTPS, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsError(ERR_NAME_NOT_RESOLVED)); + EXPECT_THAT(results.experimental_results(), + testing::Optional(testing::ElementsAre(false))); +} + +TEST(DnsResponseResultExtractorTest, IgnoresWrongNameHttpsRecord) { + DnsResponse response = BuildTestDnsResponse( + "https.test", dns_protocol::kTypeHttps, + {BuildTestHttpsAliasRecord("different.test", "alias.test")}); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::HTTPS, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsError(ERR_NAME_NOT_RESOLVED)); + + HostCache::Entry default_results = + DnsResponseResultExtractor::CreateEmptyResult(DnsQueryType::HTTPS); + EXPECT_EQ(results.error(), default_results.error()); + EXPECT_EQ(results.experimental_results(), + default_results.experimental_results()); +} + +TEST(DnsResponseResultExtractorTest, IgnoresWrongTypeHttpsResponses) { + DnsResponse response = BuildTestDnsResponse( + "https.test", dns_protocol::kTypeHttps, + {BuildTestAddressRecord("https.test", IPAddress(1, 2, 3, 4))}); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::HTTPS, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsError(ERR_NAME_NOT_RESOLVED)); + EXPECT_THAT(results.experimental_results(), + testing::Optional(testing::IsEmpty())); +} + +TEST(DnsResponseResultExtractorTest, IgnoresAdditionalHttpsRecords) { + DnsResponse response = BuildTestDnsResponse( + "https.test", dns_protocol::kTypeHttps, + {BuildTestHttpsAliasRecord("https.test", "alias.test")} /* answers */, + {} /* authority */, + {BuildTestHttpsServiceRecord("https.test", 3u, "service1.test", {}), + BuildTestHttpsServiceRecord("https.test", 2u, "service2.test", + {})} /* additional */); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::HTTPS, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + // Experimental type, so does not affect overall result. + EXPECT_THAT(results.error(), test::IsError(ERR_NAME_NOT_RESOLVED)); + + EXPECT_THAT(results.experimental_results(), + testing::Optional(testing::ElementsAre(true))); +} + +TEST(DnsResponseResultExtractorTest, IgnoresUnsolicitedHttpsRecords) { + DnsResponse response = BuildTestDnsResponse( + "name.test", dns_protocol::kTypeTXT, + {BuildTestDnsRecord("name.test", dns_protocol::kTypeTXT, + "\003foo")} /* answers */, + {} /* authority */, + {BuildTestHttpsServiceRecord("https.test", 3u, "service1.test", {}), + BuildTestHttpsServiceRecord("https.test", 2u, "service2.test", + {})} /* additional */); + DnsResponseResultExtractor extractor(&response); + + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + EXPECT_EQ(extractor.ExtractDnsResults(DnsQueryType::TXT, &results), + DnsResponseResultExtractor::ExtractionError::kOk); + + EXPECT_THAT(results.error(), test::IsOk()); + EXPECT_THAT(results.text_records(), + testing::Optional(testing::ElementsAre("foo"))); +} + +} // namespace +} // namespace net
diff --git a/net/dns/dns_response_unittest.cc b/net/dns/dns_response_unittest.cc index 794358a..fd79165 100644 --- a/net/dns/dns_response_unittest.cc +++ b/net/dns/dns_response_unittest.cc
@@ -683,7 +683,7 @@ DnsResponse response(t.response_data, t.response_size, t.answers_offset); AddressList addr_list; base::Optional<base::TimeDelta> ttl; - EXPECT_EQ(DnsResponse::DNS_PARSE_OK, + EXPECT_EQ(DnsResponse::Result::kOk, response.ParseToAddressList(&addr_list, &ttl)); std::vector<const char*> expected_addresses( t.expected_addresses, @@ -781,23 +781,23 @@ const struct TestCase { const uint8_t* data; size_t size; - DnsResponse::Result expected_result; + DnsResponseResultExtractor::ExtractionError expected_result; } cases[] = { {kResponseTruncatedRecord, base::size(kResponseTruncatedRecord), - DnsResponse::DNS_MALFORMED_RESPONSE}, + DnsResponse::Result::kMalformedRecord}, {kResponseTruncatedCNAME, base::size(kResponseTruncatedCNAME), - DnsResponse::DNS_MALFORMED_CNAME}, + DnsResponse::Result::kMalformedCname}, {kResponseNameMismatch, base::size(kResponseNameMismatch), - DnsResponse::DNS_NAME_MISMATCH}, + DnsResponse::Result::kNameMismatch}, {kResponseNameMismatchInChain, base::size(kResponseNameMismatchInChain), - DnsResponse::DNS_NAME_MISMATCH}, + DnsResponse::Result::kNameMismatch}, {kResponseSizeMismatch, base::size(kResponseSizeMismatch), - DnsResponse::DNS_SIZE_MISMATCH}, + DnsResponse::Result::kMalformedResult}, {kResponseCNAMEAfterAddress, base::size(kResponseCNAMEAfterAddress), - DnsResponse::DNS_CNAME_AFTER_ADDRESS}, + DnsResponse::Result::kCnameAfterResult}, // Not actually a failure, just an empty result. {kResponseNoAddresses, base::size(kResponseNoAddresses), - DnsResponse::DNS_PARSE_OK}, + DnsResponse::Result::kOk}, }; const size_t kQuerySize = 12 + 7;
diff --git a/net/dns/dns_test_util.cc b/net/dns/dns_test_util.cc index 80416dae..9287927 100644 --- a/net/dns/dns_test_util.cc +++ b/net/dns/dns_test_util.cc
@@ -176,7 +176,8 @@ uint16_t type, const std::vector<DnsResourceRecord>& answers, const std::vector<DnsResourceRecord>& authority, - const std::vector<DnsResourceRecord>& additional) { + const std::vector<DnsResourceRecord>& additional, + uint8_t rcode) { DCHECK(!name.empty()); std::string dns_name; @@ -185,8 +186,7 @@ base::Optional<DnsQuery> query(base::in_place, 0, std::move(dns_name), type); return DnsResponse(0, true /* is_authoritative */, answers, authority /* authority_records */, - additional /* additional_records */, query, - dns_protocol::kRcodeNOERROR /* rcode */, + additional /* additional_records */, query, rcode, false /* validate_answers_match_query */); }
diff --git a/net/dns/dns_test_util.h b/net/dns/dns_test_util.h index 942fa845..c66232c3 100644 --- a/net/dns/dns_test_util.h +++ b/net/dns/dns_test_util.h
@@ -228,7 +228,8 @@ uint16_t type, const std::vector<DnsResourceRecord>& answers, const std::vector<DnsResourceRecord>& authority = {}, - const std::vector<DnsResourceRecord>& additional = {}); + const std::vector<DnsResourceRecord>& additional = {}, + uint8_t rcode = dns_protocol::kRcodeNOERROR); DnsResponse BuildTestDnsAddressResponse(std::string name, const IPAddress& ip,
diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc index 3a7dfbb..a008c2b 100644 --- a/net/dns/dns_transaction.cc +++ b/net/dns/dns_transaction.cc
@@ -48,6 +48,7 @@ #include "net/dns/dns_config.h" #include "net/dns/dns_query.h" #include "net/dns/dns_response.h" +#include "net/dns/dns_response_result_extractor.h" #include "net/dns/dns_server_iterator.h" #include "net/dns/dns_session.h" #include "net/dns/dns_socket_allocator.h" @@ -979,7 +980,7 @@ base::Optional<base::TimeDelta> ttl; if (response && attempt->GetResponse()->ParseToAddressList(&addresses, &ttl) == - DnsResponse::DNS_PARSE_OK && + DnsResponseResultExtractor::ExtractionError::kOk && !addresses.empty()) { // The DoH probe queries don't go through the standard DnsAttempt path, // so the ServerStats have not been updated yet.
diff --git a/net/dns/host_cache.h b/net/dns/host_cache.h index 51badc85..ae24c4ab 100644 --- a/net/dns/host_cache.h +++ b/net/dns/host_cache.h
@@ -241,6 +241,12 @@ // method performs a stable sort to ensure IPv6 addresses precede IPv4 // addresses. IP versions being equal, addresses from |*this| will precede // those from |source|. + // + // Only non-failure entries (`error_` is OK or ERR_NAME_NOT_RESOLVED) can be + // merged. Because an ERR_NAME_NOT_RESOLVED represents success without any + // results, merging an OK entry with an ERR_NAME_NOT_RESOLVED entry + // represents merging a non-empty entry with an empty entry, resulting in + // non-empty and therefore OK. void MergeAddressesFrom(const HostCache::Entry& source); base::Value GetAsValue(bool include_staleness) const;
diff --git a/net/dns/host_resolver_manager.cc b/net/dns/host_resolver_manager.cc index 3f8016b..5692766 100644 --- a/net/dns/host_resolver_manager.cc +++ b/net/dns/host_resolver_manager.cc
@@ -43,8 +43,6 @@ #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/no_destructor.h" -#include "base/numerics/checked_math.h" -#include "base/rand_util.h" #include "base/sequence_checker.h" #include "base/single_thread_task_runner.h" #include "base/strings/string_number_conversions.h" @@ -76,12 +74,12 @@ #include "net/dns/dns_client.h" #include "net/dns/dns_reloader.h" #include "net/dns/dns_response.h" +#include "net/dns/dns_response_result_extractor.h" #include "net/dns/dns_transaction.h" #include "net/dns/dns_util.h" #include "net/dns/host_resolver_mdns_listener_impl.h" #include "net/dns/host_resolver_mdns_task.h" #include "net/dns/host_resolver_proc.h" -#include "net/dns/https_record_rdata.h" #include "net/dns/httpssvc_metrics.h" #include "net/dns/mdns_client.h" #include "net/dns/public/dns_protocol.h" @@ -461,36 +459,6 @@ net_log.AddEntry(type, phase, [&] { return results.NetLogParams(); }); } -void SaveMetricsForAdditionalHttpsRecord(const RecordParsed& record, - bool is_unsolicited) { - const HttpsRecordRdata* rdata = record.rdata<HttpsRecordRdata>(); - - // These values are persisted to logs. Entries should not be renumbered and - // numeric values should never be reused. - enum class UnsolicitedHttpsRecordStatus { - kMalformed = 0, - kAlias = 1, - kService = 2, - kMaxValue = kService - } status; - - if (!rdata || rdata->IsMalformed()) { - status = UnsolicitedHttpsRecordStatus::kMalformed; - } else if (rdata->IsAlias()) { - status = UnsolicitedHttpsRecordStatus::kAlias; - } else { - status = UnsolicitedHttpsRecordStatus::kService; - } - - if (is_unsolicited) { - UMA_HISTOGRAM_ENUMERATION("Net.DNS.DnsTask.AdditionalHttps.Unsolicited", - status); - } else { - UMA_HISTOGRAM_ENUMERATION("Net.DNS.DnsTask.AdditionalHttps.Requested", - status); - } -} - } // namespace //----------------------------------------------------------------------------- @@ -1288,50 +1256,37 @@ } } - if (net_error != OK && !(net_error == ERR_NAME_NOT_RESOLVED && response && - response->IsValid())) { - if (dns_query_type == DnsQueryType::INTEGRITY || - dns_query_type == DnsQueryType::HTTPS) { - // Do not allow an experimental query to fail the whole DnsTask. - response = nullptr; + HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); + // Parse NOERROR results or NXDOMAIN (signified from DnsTransaction by + // ERR_NAME_NOT_RESOLVED) results with a valid response to parse. + if (net_error == OK || (net_error == ERR_NAME_NOT_RESOLVED && response && + response->IsValid())) { + DnsResponseResultExtractor::ExtractionError extraction_error; + if (dns_query_type == DnsQueryType::A || + dns_query_type == DnsQueryType::AAAA) { + extraction_error = ParseAddressDnsResponse(response, &results); } else { - OnFailure(net_error, DnsResponse::DNS_PARSE_OK, base::nullopt); + DnsResponseResultExtractor extractor(response); + extraction_error = + extractor.ExtractDnsResults(dns_query_type, &results); + } + DCHECK_NE(extraction_error, + DnsResponseResultExtractor::ExtractionError::kUnexpected); + + if (results.error() != OK && results.error() != ERR_NAME_NOT_RESOLVED) { + OnFailure(results.error(), extraction_error, results.GetOptionalTtl()); return; } - } - - DnsResponse::Result parse_result = DnsResponse::DNS_PARSE_RESULT_MAX; - HostCache::Entry results(ERR_FAILED, HostCache::Entry::SOURCE_UNKNOWN); - switch (dns_query_type) { - case DnsQueryType::UNSPECIFIED: - // Should create multiple transactions with specified types. - NOTREACHED(); - break; - case DnsQueryType::A: - case DnsQueryType::AAAA: - parse_result = ParseAddressDnsResponse(response, &results); - break; - case DnsQueryType::TXT: - parse_result = ParseTxtDnsResponse(response, &results); - break; - case DnsQueryType::PTR: - parse_result = ParsePointerDnsResponse(response, &results); - break; - case DnsQueryType::SRV: - parse_result = ParseServiceDnsResponse(response, &results); - break; - case DnsQueryType::INTEGRITY: - // Parse the INTEGRITY records, condensing them into a vector<bool>. - parse_result = ParseIntegrityDnsResponse(response, &results); - break; - case DnsQueryType::HTTPS: - parse_result = ParseHttpsDnsResponse(response, &results); - break; - } - DCHECK_LT(parse_result, DnsResponse::DNS_PARSE_RESULT_MAX); - - if (results.error() != OK && results.error() != ERR_NAME_NOT_RESOLVED) { - OnFailure(results.error(), parse_result, results.GetOptionalTtl()); + } else if (dns_query_type == DnsQueryType::INTEGRITY || + dns_query_type == DnsQueryType::HTTPS) { + // Do not allow an experimental query to fail the whole DnsTask. Instead + // pretend an empty result that can be cleanly merged with address + // results. + results = DnsResponseResultExtractor::CreateEmptyResult(dns_query_type); + } else { + // Fail completely on network failure. + OnFailure(net_error, DnsResponseResultExtractor::ExtractionError::kOk, + base::nullopt); return; } @@ -1436,15 +1391,16 @@ OnSuccess(results); } - DnsResponse::Result ParseAddressDnsResponse(const DnsResponse* response, - HostCache::Entry* out_results) { + DnsResponseResultExtractor::ExtractionError ParseAddressDnsResponse( + const DnsResponse* response, + HostCache::Entry* out_results) { DCHECK(response); AddressList addresses; base::Optional<base::TimeDelta> ttl; - DnsResponse::Result parse_result = + DnsResponseResultExtractor::ExtractionError parse_result = response->ParseToAddressList(&addresses, &ttl); - if (parse_result != DnsResponse::DNS_PARSE_OK) { + if (parse_result != DnsResponseResultExtractor::ExtractionError::kOk) { *out_results = GetMalformedResponseResult(); } else if (addresses.empty()) { *out_results = HostCache::Entry(ERR_NAME_NOT_RESOLVED, AddressList(), @@ -1457,303 +1413,6 @@ return parse_result; } - DnsResponse::Result ParseTxtDnsResponse(const DnsResponse* response, - HostCache::Entry* out_results) { - DCHECK(response); - std::vector<std::unique_ptr<const RecordParsed>> records; - base::Optional<base::TimeDelta> response_ttl; - DnsResponse::Result parse_result = ParseAndFilterResponseRecords( - response, dns_protocol::kTypeTXT, &records, &response_ttl); - - if (parse_result != DnsResponse::DNS_PARSE_OK) { - *out_results = GetMalformedResponseResult(); - return parse_result; - } - - std::vector<std::string> text_records; - for (const auto& record : records) { - const TxtRecordRdata* rdata = record->rdata<net::TxtRecordRdata>(); - text_records.insert(text_records.end(), rdata->texts().begin(), - rdata->texts().end()); - } - - *out_results = HostCache::Entry( - text_records.empty() ? ERR_NAME_NOT_RESOLVED : OK, - std::move(text_records), HostCache::Entry::SOURCE_DNS, response_ttl); - return DnsResponse::DNS_PARSE_OK; - } - - DnsResponse::Result ParsePointerDnsResponse(const DnsResponse* response, - HostCache::Entry* out_results) { - DCHECK(response); - std::vector<std::unique_ptr<const RecordParsed>> records; - base::Optional<base::TimeDelta> response_ttl; - DnsResponse::Result parse_result = ParseAndFilterResponseRecords( - response, dns_protocol::kTypePTR, &records, &response_ttl); - - if (parse_result != DnsResponse::DNS_PARSE_OK) { - *out_results = GetMalformedResponseResult(); - return parse_result; - } - - std::vector<HostPortPair> pointers; - for (const auto& record : records) { - const PtrRecordRdata* rdata = record->rdata<net::PtrRecordRdata>(); - std::string pointer = rdata->ptrdomain(); - - // Skip pointers to the root domain. - if (!pointer.empty()) - pointers.emplace_back(std::move(pointer), 0); - } - - *out_results = HostCache::Entry( - pointers.empty() ? ERR_NAME_NOT_RESOLVED : OK, std::move(pointers), - HostCache::Entry::SOURCE_DNS, response_ttl); - return DnsResponse::DNS_PARSE_OK; - } - - DnsResponse::Result ParseServiceDnsResponse(const DnsResponse* response, - HostCache::Entry* out_results) { - DCHECK(response); - std::vector<std::unique_ptr<const RecordParsed>> records; - base::Optional<base::TimeDelta> response_ttl; - DnsResponse::Result parse_result = ParseAndFilterResponseRecords( - response, dns_protocol::kTypeSRV, &records, &response_ttl); - - if (parse_result != DnsResponse::DNS_PARSE_OK) { - *out_results = GetMalformedResponseResult(); - return parse_result; - } - - std::vector<const SrvRecordRdata*> fitered_rdatas; - for (const auto& record : records) { - const SrvRecordRdata* rdata = record->rdata<net::SrvRecordRdata>(); - - // Skip pointers to the root domain. - if (!rdata->target().empty()) - fitered_rdatas.push_back(rdata); - } - - std::vector<HostPortPair> ordered_service_targets = - SortServiceTargets(fitered_rdatas); - - *out_results = HostCache::Entry( - ordered_service_targets.empty() ? ERR_NAME_NOT_RESOLVED : OK, - std::move(ordered_service_targets), HostCache::Entry::SOURCE_DNS, - response_ttl); - return DnsResponse::DNS_PARSE_OK; - } - - DnsResponse::Result ParseIntegrityDnsResponse(const DnsResponse* response, - HostCache::Entry* out_results) { - base::Optional<base::TimeDelta> response_ttl; - const HostCache::Entry default_entry( - ERR_NAME_NOT_RESOLVED, std::vector<bool>(), - HostCache::Entry::SOURCE_DNS, response_ttl); - - if (response == nullptr) { - *out_results = default_entry; - return DnsResponse::Result::DNS_PARSE_OK; - } - - std::vector<std::unique_ptr<const RecordParsed>> records; - DnsResponse::Result parse_result = ParseAndFilterResponseRecords( - response, dns_protocol::kExperimentalTypeIntegrity, &records, - &response_ttl); - - if (parse_result != DnsResponse::DNS_PARSE_OK) { - *out_results = default_entry; - return DnsResponse::Result::DNS_PARSE_OK; - } - - // Condense results into a list of booleans. We do not cache the results, - // but this enables us to write some unit tests. - std::vector<bool> condensed_results; - for (const auto& record : records) { - const IntegrityRecordRdata& rdata = - *record->rdata<IntegrityRecordRdata>(); - condensed_results.push_back(rdata.IsIntact()); - } - - *out_results = - HostCache::Entry(ERR_NAME_NOT_RESOLVED, std::move(condensed_results), - HostCache::Entry::SOURCE_DNS, response_ttl); - DCHECK_EQ(parse_result, DnsResponse::DNS_PARSE_OK); - return parse_result; - } - - DnsResponse::Result ParseHttpsDnsResponse(const DnsResponse* response, - HostCache::Entry* out_results) { - base::Optional<base::TimeDelta> response_ttl; - HostCache::Entry default_entry(ERR_NAME_NOT_RESOLVED, std::vector<bool>(), - HostCache::Entry::SOURCE_DNS, response_ttl); - - // As HTTPS is currently only used for experimental queries, request - // failures are not treated as critical, and flow may reach here without a - // response. - // - // TODO(crbug.com/1138620): As HTTPS becomes less experimental, reevaluate - // request failures and consider making having a response required to call - // this method. - if (response == nullptr) { - *out_results = std::move(default_entry); - return DnsResponse::Result::DNS_PARSE_OK; - } - - std::vector<std::unique_ptr<const RecordParsed>> records; - DnsResponse::Result parse_result = ParseAndFilterResponseRecords( - response, dns_protocol::kTypeHttps, &records, &response_ttl); - - // If the response couldn't be parsed, assume no HTTPS records. - if (parse_result != DnsResponse::DNS_PARSE_OK) { - *out_results = std::move(default_entry); - return DnsResponse::Result::DNS_PARSE_OK; - } - - // Condense results into a list of booleans. We do not cache the results, - // but this enables us to write some unit tests. - std::vector<bool> condensed_results; - for (const auto& record : records) { - const HttpsRecordRdata& rdata = *record->rdata<HttpsRecordRdata>(); - condensed_results.push_back(!rdata.IsMalformed()); - } - - *out_results = - HostCache::Entry(ERR_NAME_NOT_RESOLVED, std::move(condensed_results), - HostCache::Entry::SOURCE_DNS, response_ttl); - DCHECK_EQ(parse_result, DnsResponse::DNS_PARSE_OK); - return parse_result; - } - - // Sort service targets per RFC2782. In summary, sort first by |priority|, - // lowest first. For targets with the same priority, secondary sort randomly - // using |weight| with higher weighted objects more likely to go first. - std::vector<HostPortPair> SortServiceTargets( - const std::vector<const SrvRecordRdata*>& rdatas) { - std::map<uint16_t, std::unordered_set<const SrvRecordRdata*>> - ordered_by_priority; - for (const SrvRecordRdata* rdata : rdatas) - ordered_by_priority[rdata->priority()].insert(rdata); - - std::vector<HostPortPair> sorted_targets; - for (auto& priority : ordered_by_priority) { - // With (num results) <= UINT16_MAX (and in practice, much less) and - // (weight per result) <= UINT16_MAX, then it should be the case that - // (total weight) <= UINT32_MAX, but use CheckedNumeric for extra safety. - auto total_weight = base::MakeCheckedNum<uint32_t>(0); - for (const SrvRecordRdata* rdata : priority.second) - total_weight += rdata->weight(); - - // Add 1 to total weight because, to deal with 0-weight targets, we want - // our random selection to be inclusive [0, total]. - total_weight++; - - // Order by weighted random. Make such random selections, removing from - // |priority.second| until |priority.second| only contains 1 rdata. - while (priority.second.size() >= 2) { - uint32_t random_selection = - base::RandGenerator(total_weight.ValueOrDie()); - const SrvRecordRdata* selected_rdata = nullptr; - for (const SrvRecordRdata* rdata : priority.second) { - // >= to always select the first target on |random_selection| == 0, - // even if its weight is 0. - if (rdata->weight() >= random_selection) { - selected_rdata = rdata; - break; - } - random_selection -= rdata->weight(); - } - - DCHECK(selected_rdata); - sorted_targets.emplace_back(selected_rdata->target(), - selected_rdata->port()); - total_weight -= selected_rdata->weight(); - size_t removed = priority.second.erase(selected_rdata); - DCHECK_EQ(1u, removed); - } - - DCHECK_EQ(1u, priority.second.size()); - DCHECK_EQ((total_weight - 1).ValueOrDie(), - (*priority.second.begin())->weight()); - const SrvRecordRdata* rdata = *priority.second.begin(); - sorted_targets.emplace_back(rdata->target(), rdata->port()); - } - - return sorted_targets; - } - - DnsResponse::Result ParseAndFilterResponseRecords( - const DnsResponse* response, - uint16_t filter_dns_type, - std::vector<std::unique_ptr<const RecordParsed>>* out_records, - base::Optional<base::TimeDelta>* out_response_ttl) { - out_records->clear(); - out_response_ttl->reset(); - - DnsRecordParser parser = response->Parser(); - - // Expected to be validated by DnsTransaction. - DCHECK_EQ(filter_dns_type, response->qtype()); - - for (unsigned i = 0; i < response->answer_count(); ++i) { - std::unique_ptr<const RecordParsed> record = - RecordParsed::CreateFrom(&parser, base::Time::Now()); - - if (!record) - return DnsResponse::DNS_MALFORMED_RESPONSE; - if (!base::EqualsCaseInsensitiveASCII(record->name(), - response->GetDottedName())) { - return DnsResponse::DNS_NAME_MISMATCH; - } - - // Ignore any records that are not class Internet and type - // |filter_dns_type|. - if (record->klass() == dns_protocol::kClassIN && - record->type() == filter_dns_type) { - base::TimeDelta ttl = base::TimeDelta::FromSeconds(record->ttl()); - *out_response_ttl = - std::min(out_response_ttl->value_or(base::TimeDelta::Max()), ttl); - - out_records->push_back(std::move(record)); - } - } - - // For NXDOMAIN or NODATA (NOERROR with 0 answers), attempt to find a TTL - // via an SOA record. - if (response->rcode() == dns_protocol::kRcodeNXDOMAIN || - (response->answer_count() == 0 && - response->rcode() == dns_protocol::kRcodeNOERROR)) { - bool soa_found = false; - for (unsigned i = 0; i < response->authority_count(); ++i) { - DnsResourceRecord record; - if (parser.ReadRecord(&record) && - record.type == dns_protocol::kTypeSOA) { - soa_found = true; - base::TimeDelta ttl = base::TimeDelta::FromSeconds(record.ttl); - *out_response_ttl = - std::min(out_response_ttl->value_or(base::TimeDelta::Max()), ttl); - } - } - - // Per RFC2308, section 5, never cache negative results unless an SOA - // record is found. - if (!soa_found) - out_response_ttl->reset(); - } - - for (unsigned i = 0; i < response->additional_answer_count(); ++i) { - std::unique_ptr<const RecordParsed> record = - RecordParsed::CreateFrom(&parser, base::Time::Now()); - if (record && record->klass() == dns_protocol::kClassIN && - record->type() == dns_protocol::kTypeHttps) { - bool is_unsolicited = filter_dns_type != dns_protocol::kTypeHttps; - SaveMetricsForAdditionalHttpsRecord(*record, is_unsolicited); - } - } - - return DnsResponse::DNS_PARSE_OK; - } - void OnSortComplete(base::TimeTicks sort_start_time, HostCache::Entry results, bool secure, @@ -1762,7 +1421,8 @@ results.set_addresses(addr_list); if (!success) { - OnFailure(ERR_DNS_SORT_ERROR, DnsResponse::DNS_PARSE_OK, + OnFailure(ERR_DNS_SORT_ERROR, + DnsResponseResultExtractor::ExtractionError::kOk, results.GetOptionalTtl()); return; } @@ -1772,7 +1432,8 @@ results.text_records().value_or(std::vector<std::string>()).empty() && results.hostnames().value_or(std::vector<HostPortPair>()).empty()) { LOG(WARNING) << "Address list empty after RFC3484 sort"; - OnFailure(ERR_NAME_NOT_RESOLVED, DnsResponse::DNS_PARSE_OK, + OnFailure(ERR_NAME_NOT_RESOLVED, + DnsResponseResultExtractor::ExtractionError::kOk, results.GetOptionalTtl()); return; } @@ -1781,7 +1442,7 @@ } void OnFailure(int net_error, - DnsResponse::Result parse_result, + DnsResponseResultExtractor::ExtractionError extraction_error, base::Optional<base::TimeDelta> ttl) { if (httpssvc_metrics_) httpssvc_metrics_->SaveAddressQueryFailure(); @@ -1790,7 +1451,8 @@ HostCache::Entry results(net_error, HostCache::Entry::SOURCE_UNKNOWN, ttl); net_log_.EndEvent(NetLogEventType::HOST_RESOLVER_IMPL_DNS_TASK, [&] { - return NetLogDnsTaskFailedParams(results, parse_result); + return NetLogDnsTaskFailedParams(results, + static_cast<int>(extraction_error)); }); delegate_->OnDnsTaskComplete(task_start_time_, results, secure_);
diff --git a/remoting/protocol/connection_unittest.cc b/remoting/protocol/connection_unittest.cc index d81147eb..6862586 100644 --- a/remoting/protocol/connection_unittest.cc +++ b/remoting/protocol/connection_unittest.cc
@@ -543,10 +543,9 @@ } } -// TODO(crbug.com/1143311): Test is flaky. // Verifies that the VideoStream doesn't loose any video frames while the // connection is being established. -TEST_P(ConnectionTest, DISABLED_VideoWithSlowSignaling) { +TEST_P(ConnectionTest, VideoWithSlowSignaling) { // Add signaling delay to slow down connection handshake. host_session_->set_signaling_delay(base::TimeDelta::FromMilliseconds(100)); client_session_->set_signaling_delay(base::TimeDelta::FromMilliseconds(100));
diff --git a/services/network/public/cpp/content_security_policy/content_security_policy.cc b/services/network/public/cpp/content_security_policy/content_security_policy.cc index d69c1fc..3b3a9a6 100644 --- a/services/network/public/cpp/content_security_policy/content_security_policy.cc +++ b/services/network/public/cpp/content_security_policy/content_security_policy.cc
@@ -18,7 +18,6 @@ #include "services/network/public/cpp/content_security_policy/csp_context.h" #include "services/network/public/cpp/content_security_policy/csp_source.h" #include "services/network/public/cpp/content_security_policy/csp_source_list.h" -#include "services/network/public/cpp/features.h" #include "services/network/public/cpp/is_potentially_trustworthy.h" #include "services/network/public/cpp/web_sandbox_flags.h" #include "url/gurl.h" @@ -1015,9 +1014,6 @@ mojom::AllowCSPFromHeaderValuePtr ParseAllowCSPFromHeader( const net::HttpResponseHeaders& headers) { - if (!base::FeatureList::IsEnabled(features::kOutOfBlinkCSPEE)) - return nullptr; - std::string allow_csp_from; if (!headers.GetNormalizedHeader("Allow-CSP-From", &allow_csp_from)) return nullptr;
diff --git a/services/network/public/cpp/features.cc b/services/network/public/cpp/features.cc index 40a5377c..a3c2072 100644 --- a/services/network/public/cpp/features.cc +++ b/services/network/public/cpp/features.cc
@@ -211,10 +211,6 @@ const base::FeatureParam<bool> kPlatformProvidedTrustTokenIssuance{ &kTrustTokens, "PlatformProvidedTrustTokenIssuance", false}; -// Enables the Content Security Policy Embedded Enforcement check out of blink -const base::Feature kOutOfBlinkCSPEE{"OutOfBlinkCSPEE", - base::FEATURE_ENABLED_BY_DEFAULT}; - const base::Feature kWebSocketReassembleShortMessages{ "WebSocketReassembleShortMessages", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/services/network/public/cpp/features.h b/services/network/public/cpp/features.h index a836a51..9ccf9eb 100644 --- a/services/network/public/cpp/features.h +++ b/services/network/public/cpp/features.h
@@ -79,9 +79,6 @@ extern const base::FeatureParam<bool> kPlatformProvidedTrustTokenIssuance; COMPONENT_EXPORT(NETWORK_CPP) -extern const base::Feature kOutOfBlinkCSPEE; - -COMPONENT_EXPORT(NETWORK_CPP) extern const base::Feature kWebSocketReassembleShortMessages; COMPONENT_EXPORT(NETWORK_CPP)
diff --git a/services/resource_coordinator/public/cpp/memory_instrumentation/tracing_observer_proto.cc b/services/resource_coordinator/public/cpp/memory_instrumentation/tracing_observer_proto.cc index daf8af8..9b4c2de 100644 --- a/services/resource_coordinator/public/cpp/memory_instrumentation/tracing_observer_proto.cc +++ b/services/resource_coordinator/public/cpp/memory_instrumentation/tracing_observer_proto.cc
@@ -120,6 +120,7 @@ smaps_packet->set_timestamp_clock_id(tracing::kTraceClockId); perfetto::protos::pbzero::SmapsPacket* smaps = smaps_packet->set_smaps_packet(); + smaps->set_pid(static_cast<uint32_t>(pid)); MemoryMapsAsProtoInto(memory_maps, smaps, false);
diff --git a/services/resource_coordinator/public/cpp/memory_instrumentation/tracing_observer_proto_unittest.cc b/services/resource_coordinator/public/cpp/memory_instrumentation/tracing_observer_proto_unittest.cc index 33078471..d04f7210 100644 --- a/services/resource_coordinator/public/cpp/memory_instrumentation/tracing_observer_proto_unittest.cc +++ b/services/resource_coordinator/public/cpp/memory_instrumentation/tracing_observer_proto_unittest.cc
@@ -366,8 +366,10 @@ const ::perfetto::protos::SmapsPacket& smaps_packet = smaps_trace_packet->smaps_packet(); - EXPECT_EQ(kRegionsCount, smaps_packet.entries_size()); + EXPECT_TRUE(smaps_packet.has_pid()); + EXPECT_EQ(static_cast<uint32_t>(kTestPid), smaps_packet.pid()); + EXPECT_EQ(kRegionsCount, smaps_packet.entries_size()); for (int i = 0; i < kRegionsCount; i++) { const ::perfetto::protos::SmapsEntry& entry = smaps_packet.entries(i);
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc index 6d621f7..3876392 100644 --- a/third_party/blink/common/features.cc +++ b/third_party/blink/common/features.cc
@@ -739,7 +739,7 @@ // Reduce the amount of information in the default 'referer' header for // cross-origin requests. const base::Feature kReducedReferrerGranularity{ - "ReducedReferrerGranularity", base::FEATURE_DISABLED_BY_DEFAULT}; + "ReducedReferrerGranularity", base::FEATURE_ENABLED_BY_DEFAULT}; // Enables the constant streaming in the ContentCapture task. const base::Feature kContentCaptureConstantStreaming = {
diff --git a/third_party/blink/common/loader/referrer_utils_unittest.cc b/third_party/blink/common/loader/referrer_utils_unittest.cc index 6d00d76b..7d19e686 100644 --- a/third_party/blink/common/loader/referrer_utils_unittest.cc +++ b/third_party/blink/common/loader/referrer_utils_unittest.cc
@@ -12,7 +12,7 @@ TEST(DefaultNetReferrerPolicyTest, Unconfigured) { EXPECT_EQ(blink::ReferrerUtils::GetDefaultNetReferrerPolicy(), - net::ReferrerPolicy::CLEAR_ON_TRANSITION_FROM_SECURE_TO_INSECURE); + net::ReferrerPolicy::REDUCE_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN); } TEST(DefaultNetReferrerPolicyTest, FeatureOnly) {
diff --git a/third_party/blink/public/devtools_protocol/browser_protocol.pdl b/third_party/blink/public/devtools_protocol/browser_protocol.pdl index 50f384d..3a94562 100644 --- a/third_party/blink/public/devtools_protocol/browser_protocol.pdl +++ b/third_party/blink/public/devtools_protocol/browser_protocol.pdl
@@ -2522,6 +2522,12 @@ attribute-modified node-removed + # CSP Violation type. + experimental type CSPViolationType extends string + enum + trustedtype-sink-violation + trustedtype-policy-violation + # Object event listener. type EventListener extends object properties @@ -2589,6 +2595,12 @@ # Resource URL substring. string url + # Sets breakpoint on particular CSP violations. + experimental command setBreakOnCSPViolation + parameters + # CSP Violations to stop upon. + array of CSPViolationType violationTypes + # Sets breakpoint on particular operation with DOM. command setDOMBreakpoint parameters @@ -5701,6 +5713,13 @@ # Identifier of the node to highlight. DOM.NodeId nodeId + type FlexNodeHighlightConfig extends object + properties + # A descriptor for the highlight appearance of flex containers. + FlexContainerHighlightConfig flexContainerHighlightConfig + # Identifier of the node to highlight. + DOM.NodeId nodeId + # Configuration for dual screen hinge type HingeConfig extends object properties @@ -5866,6 +5885,11 @@ # An array of node identifiers and descriptors for the highlight appearance. array of GridNodeHighlightConfig gridNodeHighlightConfigs + command setShowFlexOverlays + parameters + # An array of node identifiers and descriptors for the highlight appearance. + array of FlexNodeHighlightConfig flexNodeHighlightConfigs + # Requests that backend shows paint rectangles command setShowPaintRects parameters @@ -6781,6 +6805,12 @@ # Frame object. Frame frame + # Fired when opening document to write to. + experimental event documentOpened + parameters + # Frame object. + Frame frame + experimental event frameResized # Fired when a renderer-initiated navigation is requested.
diff --git a/third_party/blink/renderer/bindings/core/v8/script_streamer.cc b/third_party/blink/renderer/bindings/core/v8/script_streamer.cc index 0fb1c19..77b29e09 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_streamer.cc +++ b/third_party/blink/renderer/bindings/core/v8/script_streamer.cc
@@ -486,10 +486,8 @@ std::move(stream_ptr), encoding_); std::unique_ptr<v8::ScriptCompiler::ScriptStreamingTask> - script_streaming_task( - base::WrapUnique(v8::ScriptCompiler::StartStreamingScript( - V8PerIsolateData::MainThreadIsolate(), source_.get(), - compile_options_))); + script_streaming_task(base::WrapUnique(v8::ScriptCompiler::StartStreaming( + V8PerIsolateData::MainThreadIsolate(), source_.get()))); if (!script_streaming_task) { // V8 cannot stream the script. stream_ = nullptr; @@ -529,12 +527,10 @@ ScriptResource* script_resource, mojo::ScopedDataPipeConsumerHandle data_pipe, ResponseBodyLoaderClient* response_body_loader_client, - v8::ScriptCompiler::CompileOptions compile_options, scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner) : script_resource_(script_resource), response_body_loader_client_(response_body_loader_client), data_pipe_(std::move(data_pipe)), - compile_options_(compile_options), script_url_string_(script_resource->Url().Copy().GetString()), script_resource_identifier_(script_resource->InspectorId()), // Unfortunately there's no dummy encoding value in the enum; let's use
diff --git a/third_party/blink/renderer/bindings/core/v8/script_streamer.h b/third_party/blink/renderer/bindings/core/v8/script_streamer.h index bf04278..13e25e7 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_streamer.h +++ b/third_party/blink/renderer/bindings/core/v8/script_streamer.h
@@ -69,7 +69,6 @@ ScriptResource* resource, mojo::ScopedDataPipeConsumerHandle data_pipe, ResponseBodyLoaderClient* response_body_loader_client, - v8::ScriptCompiler::CompileOptions compile_options, scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner); ~ScriptStreamer(); void Trace(Visitor*) const; @@ -201,9 +200,6 @@ // The reason that streaming is disabled NotStreamingReason suppressed_reason_ = NotStreamingReason::kInvalid; - // What kind of cached data V8 produces during streaming. - v8::ScriptCompiler::CompileOptions compile_options_; - // Keep the script URL string for event tracing. const String script_url_string_;
diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn index c5254a4..09f9eb2 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn
@@ -1266,7 +1266,6 @@ "frame/csp/content_security_policy_test.cc", "frame/csp/csp_directive_list_test.cc", "frame/csp/csp_source_test.cc", - "frame/csp/media_list_directive_test.cc", "frame/csp/require_trusted_types_for_directive_test.cc", "frame/csp/source_list_directive_test.cc", "frame/csp/string_list_directive_test.cc",
diff --git a/third_party/blink/renderer/core/css/cssom/paint_worklet_input.h b/third_party/blink/renderer/core/css/cssom/paint_worklet_input.h index 6dde812..c4ead2a8 100644 --- a/third_party/blink/renderer/core/css/cssom/paint_worklet_input.h +++ b/third_party/blink/renderer/core/css/cssom/paint_worklet_input.h
@@ -46,14 +46,7 @@ // List of properties associated with this PaintWorkletInput. // Kept and initialized here, but used in CC, so using C++ std library types. - // TODO(xidachen): make this structure account for native property. - // Instead of pair<string, CompositorElementId>, define - // struct PropertyKey { - // std::string custom_property_name; - // enum native_property_type; - // CompositorElementId element_id; - // } - // PropId uniquely identifies a property value, potentially being animated by + // PropertyKey uniquely identifies a property, potentially being animated by // the compositor, used by this PaintWorklet as an input at paint time. The // worklet provides a list of the properties that it uses as inputs. cc::PaintWorkletInput::PropertyKeys property_keys_;
diff --git a/third_party/blink/renderer/core/css/resolver/element_style_resources.cc b/third_party/blink/renderer/core/css/resolver/element_style_resources.cc index 7c3b4695..adfe980 100644 --- a/third_party/blink/renderer/core/css/resolver/element_style_resources.cc +++ b/third_party/blink/renderer/core/css/resolver/element_style_resources.cc
@@ -55,7 +55,7 @@ ElementStyleResources::ElementStyleResources(Element& element, float device_scale_factor, PseudoElement* pseudo_element) - : element_(&element), + : element_(element), device_scale_factor_(device_scale_factor), pseudo_element_(pseudo_element) {} @@ -100,17 +100,16 @@ pending_image_properties_.insert(property); return MakeGarbageCollected<StylePendingImage>(value); } - value.RestoreCachedResourceIfNeeded(element_->GetDocument()); + value.RestoreCachedResourceIfNeeded(element_.GetDocument()); return value.CachedImage(); } SVGResource* ElementStyleResources::GetSVGResourceFromValue( - TreeScope& tree_scope, const cssvalue::CSSURIValue& value, AllowExternal allow_external) const { - if (value.IsLocal(element_->GetDocument())) { + if (value.IsLocal(element_.GetDocument())) { SVGTreeScopeResources& tree_scope_resources = - tree_scope.EnsureSVGTreeScopedResources(); + element_.OriginatingTreeScope().EnsureSVGTreeScopedResources(); AtomicString decoded_fragment(DecodeURLEscapeSequences( value.FragmentIdentifier(), DecodeURLMode::kUTF8OrIsomorphic)); return tree_scope_resources.ResourceForId(decoded_fragment); @@ -131,7 +130,7 @@ if (!reference_operation) continue; if (SVGResource* resource = reference_operation->Resource()) - resource->Load(element_->GetDocument()); + resource->Load(element_.GetDocument()); } } @@ -151,7 +150,7 @@ FetchParameters::ImageRequestBehavior image_request_behavior, CrossOriginAttributeValue cross_origin) { if (CSSImageValue* image_value = pending_image->CssImageValue()) { - return image_value->CacheImage(element_->GetDocument(), + return image_value->CacheImage(element_.GetDocument(), image_request_behavior, cross_origin); } @@ -163,12 +162,12 @@ if (CSSImageGeneratorValue* image_generator_value = pending_image->CssImageGeneratorValue()) { - image_generator_value->LoadSubimages(element_->GetDocument()); + image_generator_value->LoadSubimages(element_.GetDocument()); return MakeGarbageCollected<StyleGeneratedImage>(*image_generator_value); } if (CSSImageSetValue* image_set_value = pending_image->CssImageSetValue()) { - return image_set_value->CacheImage(element_->GetDocument(), + return image_set_value->CacheImage(element_.GetDocument(), device_scale_factor_, image_request_behavior, cross_origin); } @@ -206,7 +205,7 @@ FetchParameters::ImageRequestBehavior image_request_behavior = FetchParameters::kNone; if (!BackgroundLayerMayBeSprite(*background_layer)) { - if (element_->GetDocument() + if (element_.GetDocument() .GetFrame() ->GetLazyLoadImageSetting() == LocalFrame::LazyLoadImageSetting::kEnabledAutomatic) { @@ -218,7 +217,7 @@ image_request_behavior); if (new_image && new_image->IsLazyloadPossiblyDeferred()) { LazyImageHelper::StartMonitoring(pseudo_element_ ? pseudo_element_ - : element_); + : &element_); } background_layer->SetImage(new_image); }
diff --git a/third_party/blink/renderer/core/css/resolver/element_style_resources.h b/third_party/blink/renderer/core/css/resolver/element_style_resources.h index 2925ff4..21dfb1f 100644 --- a/third_party/blink/renderer/core/css/resolver/element_style_resources.h +++ b/third_party/blink/renderer/core/css/resolver/element_style_resources.h
@@ -44,7 +44,6 @@ class SVGResource; class StyleImage; class StylePendingImage; -class TreeScope; namespace cssvalue { @@ -70,7 +69,6 @@ enum AllowExternal { kDontAllowExternalResource, kAllowExternalResource }; SVGResource* GetSVGResourceFromValue( - TreeScope&, const cssvalue::CSSURIValue&, AllowExternal = kDontAllowExternalResource) const; @@ -89,7 +87,7 @@ FetchParameters::ImageRequestBehavior, CrossOriginAttributeValue = kCrossOriginAttributeNotSet); - Element* element_; + Element& element_; HashSet<CSSPropertyID> pending_image_properties_; float device_scale_factor_; PseudoElement* pseudo_element_;
diff --git a/third_party/blink/renderer/core/css/resolver/filter_operation_resolver.cc b/third_party/blink/renderer/core/css/resolver/filter_operation_resolver.cc index d7612ea..ddef60b0 100644 --- a/third_party/blink/renderer/core/css/resolver/filter_operation_resolver.cc +++ b/third_party/blink/renderer/core/css/resolver/filter_operation_resolver.cc
@@ -174,8 +174,7 @@ SVGResource* resource = state.GetElementStyleResources().GetSVGResourceFromValue( - state.GetTreeScope(), *url_value, - ElementStyleResources::kAllowExternalResource); + *url_value, ElementStyleResources::kAllowExternalResource); operations.Operations().push_back( MakeGarbageCollected<ReferenceFilterOperation>( url_value->ValueForSerialization(), resource));
diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc index b3749f0..6f671c4 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
@@ -129,8 +129,7 @@ if (!url_value) return nullptr; SVGResource* resource = - state.GetElementStyleResources().GetSVGResourceFromValue( - state.GetElement().OriginatingTreeScope(), *url_value); + state.GetElementStyleResources().GetSVGResourceFromValue(*url_value); return StyleSVGResource::Create(resource, url_value->ValueForSerialization()); } @@ -152,8 +151,7 @@ if (const auto* url_value = DynamicTo<cssvalue::CSSURIValue>(value)) { SVGResource* resource = - state.GetElementStyleResources().GetSVGResourceFromValue( - state.GetElement().OriginatingTreeScope(), *url_value); + state.GetElementStyleResources().GetSVGResourceFromValue(*url_value); // TODO(fs): Doesn't work with external SVG references (crbug.com/109212.) return ReferenceClipPathOperation::Create( url_value->ValueForSerialization(), resource);
diff --git a/third_party/blink/renderer/core/css/resolver/style_cascade.cc b/third_party/blink/renderer/core/css/resolver/style_cascade.cc index 13ce88a0..8a61bad 100644 --- a/third_party/blink/renderer/core/css/resolver/style_cascade.cc +++ b/third_party/blink/renderer/core/css/resolver/style_cascade.cc
@@ -1008,7 +1008,7 @@ CSSVariableData* StyleCascade::GetEnvironmentVariable( const AtomicString& name) const { // If we are in a User Agent Shadow DOM then we should not record metrics. - ContainerNode& scope_root = state_.GetTreeScope().RootNode(); + ContainerNode& scope_root = state_.GetElement().GetTreeScope().RootNode(); auto* shadow_root = DynamicTo<ShadowRoot>(&scope_root); bool is_ua_scope = shadow_root && shadow_root->IsUserAgent();
diff --git a/third_party/blink/renderer/core/css/resolver/style_resolver_state.cc b/third_party/blink/renderer/core/css/resolver/style_resolver_state.cc index 6a45207..6be1002 100644 --- a/third_party/blink/renderer/core/css/resolver/style_resolver_state.cc +++ b/third_party/blink/renderer/core/css/resolver/style_resolver_state.cc
@@ -101,10 +101,6 @@ animation_update_.Clear(); } -TreeScope& StyleResolverState::GetTreeScope() const { - return GetElement().GetTreeScope(); -} - void StyleResolverState::SetStyle(scoped_refptr<ComputedStyle> style) { // FIXME: Improve RAII of StyleResolverState to remove this function. style_ = std::move(style);
diff --git a/third_party/blink/renderer/core/css/resolver/style_resolver_state.h b/third_party/blink/renderer/core/css/resolver/style_resolver_state.h index 3b1172e4..ae902e32 100644 --- a/third_party/blink/renderer/core/css/resolver/style_resolver_state.h +++ b/third_party/blink/renderer/core/css/resolver/style_resolver_state.h
@@ -77,7 +77,6 @@ Document& GetDocument() const { return *document_; } // These are all just pass-through methods to ElementResolveContext. Element& GetElement() const { return element_context_.GetElement(); } - TreeScope& GetTreeScope() const; const ContainerNode* ParentNode() const { return element_context_.ParentNode(); }
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index b3252b9..c018993 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc
@@ -8210,12 +8210,6 @@ return policy_.Get(); } -const AtomicString& Document::RequiredCSP() { - if (!Loader()) - return g_null_atom; - return GetFrame()->Loader().RequiredCSP(); -} - StylePropertyMapReadOnly* Document::ComputedStyleMap(Element* element) { ElementComputedStyleMap::AddResult add_result = element_computed_style_map_.insert(element, nullptr);
diff --git a/third_party/blink/renderer/core/dom/document.h b/third_party/blink/renderer/core/dom/document.h index b649720..9d505e5 100644 --- a/third_party/blink/renderer/core/dom/document.h +++ b/third_party/blink/renderer/core/dom/document.h
@@ -1493,8 +1493,6 @@ bool CurrentFrameHadRAF() const; bool NextFrameHasPendingRAF() const; - const AtomicString& RequiredCSP(); - StylePropertyMapReadOnly* ComputedStyleMap(Element*); void AddComputedStyleMapItem(Element*, StylePropertyMapReadOnly*); StylePropertyMapReadOnly* RemoveComputedStyleMapItem(Element*);
diff --git a/third_party/blink/renderer/core/events/pointer_event.cc b/third_party/blink/renderer/core/events/pointer_event.cc index 6386b0d..103fb50e 100644 --- a/third_party/blink/renderer/core/events/pointer_event.cc +++ b/third_party/blink/renderer/core/events/pointer_event.cc
@@ -100,11 +100,22 @@ return false; } +bool PointerEvent::ShouldHaveIntegerCoordinates() const { + if (RuntimeEnabledFeatures::ClickPointerEventIntegerCoordinatesEnabled() && + (type() == event_type_names::kClick || + type() == event_type_names::kContextmenu)) { + return true; + } + return false; +} + bool PointerEvent::IsPointerEvent() const { return true; } double PointerEvent::offsetX() const { + if (ShouldHaveIntegerCoordinates()) + return MouseEvent::offsetX(); if (!HasPosition()) return 0; if (!has_cached_relative_position_) @@ -113,6 +124,8 @@ } double PointerEvent::offsetY() const { + if (ShouldHaveIntegerCoordinates()) + return MouseEvent::offsetY(); if (!HasPosition()) return 0; if (!has_cached_relative_position_)
diff --git a/third_party/blink/renderer/core/events/pointer_event.h b/third_party/blink/renderer/core/events/pointer_event.h index d03d997..96e7860 100644 --- a/third_party/blink/renderer/core/events/pointer_event.h +++ b/third_party/blink/renderer/core/events/pointer_event.h
@@ -7,6 +7,7 @@ #include "third_party/blink/public/common/input/pointer_id.h" #include "third_party/blink/renderer/core/events/mouse_event.h" +#include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/wtf/casting.h" namespace blink { @@ -56,12 +57,36 @@ bool IsMouseEvent() const override; bool IsPointerEvent() const override; - double screenX() const override { return screen_location_.X(); } - double screenY() const override { return screen_location_.Y(); } - double clientX() const override { return client_location_.X(); } - double clientY() const override { return client_location_.Y(); } - double pageX() const override { return page_location_.X(); } - double pageY() const override { return page_location_.Y(); } + double screenX() const override { + if (ShouldHaveIntegerCoordinates()) + return MouseEvent::screenX(); + return screen_location_.X(); + } + double screenY() const override { + if (ShouldHaveIntegerCoordinates()) + return MouseEvent::screenY(); + return screen_location_.Y(); + } + double clientX() const override { + if (ShouldHaveIntegerCoordinates()) + return MouseEvent::clientX(); + return client_location_.X(); + } + double clientY() const override { + if (ShouldHaveIntegerCoordinates()) + return MouseEvent::clientY(); + return client_location_.Y(); + } + double pageX() const override { + if (ShouldHaveIntegerCoordinates()) + return MouseEvent::pageX(); + return page_location_.X(); + } + double pageY() const override { + if (ShouldHaveIntegerCoordinates()) + return MouseEvent::pageY(); + return page_location_.Y(); + } double offsetX() const override; double offsetY() const override; @@ -82,6 +107,8 @@ void Trace(Visitor*) const override; private: + bool ShouldHaveIntegerCoordinates() const; + PointerId pointer_id_; double width_; double height_;
diff --git a/third_party/blink/renderer/core/frame/csp/content_security_policy.cc b/third_party/blink/renderer/core/frame/csp/content_security_policy.cc index 0f5d656..fc12fda 100644 --- a/third_party/blink/renderer/core/frame/csp/content_security_policy.cc +++ b/third_party/blink/renderer/core/frame/csp/content_security_policy.cc
@@ -29,7 +29,6 @@ #include <utility> #include "base/debug/dump_without_crashing.h" -#include "services/network/public/cpp/features.h" #include "services/network/public/cpp/web_sandbox_flags.h" #include "services/network/public/mojom/web_sandbox_flags.mojom-blink.h" #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h" @@ -352,33 +351,6 @@ ApplyPolicySideEffectsToDelegate(); } -bool ContentSecurityPolicy::ShouldEnforceEmbeddersPolicy( - const ResourceResponse& response, - const SecurityOrigin* parent_origin) { - if (response.CurrentRequestUrl().IsEmpty() || - response.CurrentRequestUrl().ProtocolIsAbout() || - response.CurrentRequestUrl().ProtocolIsData() || - response.CurrentRequestUrl().ProtocolIs("blob") || - response.CurrentRequestUrl().ProtocolIs("filesystem")) { - return true; - } - - if (parent_origin->CanAccess( - SecurityOrigin::Create(response.CurrentRequestUrl()).get())) - return true; - - String header = response.HttpHeaderField(http_names::kAllowCSPFrom); - header = header.StripWhiteSpace(); - if (header == "*") - return true; - if (scoped_refptr<const SecurityOrigin> child_origin = - SecurityOrigin::CreateFromString(header)) { - return parent_origin->CanAccess(child_origin.get()); - } - - return false; -} - void ContentSecurityPolicy::AddPolicyFromHeaderValue( const String& header, ContentSecurityPolicyType type, @@ -1691,23 +1663,6 @@ return DirectiveType::kUndefined; } -bool ContentSecurityPolicy::Subsumes(const ContentSecurityPolicy& other) const { - DCHECK(!base::FeatureList::IsEnabled(network::features::kOutOfBlinkCSPEE)); - if (!policies_.size() || !other.policies_.size()) - return !policies_.size(); - // Required-CSP must specify only one policy. - if (policies_.size() != 1) - return false; - - CSPDirectiveListVector other_vector; - for (const auto& policy : other.policies_) { - if (!policy->IsReportOnly()) - other_vector.push_back(policy); - } - - return policies_[0]->Subsumes(other_vector); -} - bool ContentSecurityPolicy::ShouldBypassContentSecurityPolicy( const KURL& url, SchemeRegistry::PolicyAreas area) const { @@ -1729,45 +1684,6 @@ return should_bypass_csp; } -// static -bool ContentSecurityPolicy::IsValidCSPAttr(const String& attr, - const String& context_required_csp) { - DCHECK(!base::FeatureList::IsEnabled(network::features::kOutOfBlinkCSPEE)); - - // we don't allow any newline characters in the CSP attributes - if (attr.Contains('\n') || attr.Contains('\r')) - return false; - - auto* attr_policy = MakeGarbageCollected<ContentSecurityPolicy>(); - attr_policy->AddPolicyFromHeaderValue(attr, - ContentSecurityPolicyType::kEnforce, - ContentSecurityPolicySource::kHTTP); - if (!attr_policy->console_messages_.IsEmpty() || - attr_policy->policies_.size() != 1) { - return false; - } - - // Don't allow any report endpoints in "csp" attributes. - for (auto& directiveList : attr_policy->policies_) { - if (directiveList->ReportEndpoints().size() != 0) - return false; - } - - if (context_required_csp.IsEmpty() || context_required_csp.IsNull()) { - return true; - } - - auto* context_policy = MakeGarbageCollected<ContentSecurityPolicy>(); - context_policy->AddPolicyFromHeaderValue(context_required_csp, - ContentSecurityPolicyType::kEnforce, - ContentSecurityPolicySource::kHTTP); - - DCHECK(context_policy->console_messages_.IsEmpty() && - context_policy->policies_.size() == 1); - - return context_policy->Subsumes(*attr_policy); -} - WTF::Vector<network::mojom::blink::ContentSecurityPolicyPtr> ContentSecurityPolicy::ExposeForNavigationalChecks() const { WTF::Vector<network::mojom::blink::ContentSecurityPolicyPtr> list;
diff --git a/third_party/blink/renderer/core/frame/csp/content_security_policy.h b/third_party/blink/renderer/core/frame/csp/content_security_policy.h index 504b55c5..964f3dba 100644 --- a/third_party/blink/renderer/core/frame/csp/content_security_policy.h +++ b/third_party/blink/renderer/core/frame/csp/content_security_policy.h
@@ -464,26 +464,11 @@ static bool IsNonceableElement(const Element*); - // This method checks whether the request should be allowed for an - // experimental EmbeddingCSP feature - // Please, see https://w3c.github.io/webappsec-csp/embedded/#origin-allowed. - static bool ShouldEnforceEmbeddersPolicy(const ResourceResponse&, - const SecurityOrigin*); - static const char* GetDirectiveName(const DirectiveType&); static DirectiveType GetDirectiveType(const String& name); - // This method checks if if this policy subsumes a given policy. - // Note the correct result is guaranteed if this policy contains only one - // CSPDirectiveList. More information here: - // https://w3c.github.io/webappsec-csp/embedded/#subsume-policy - bool Subsumes(const ContentSecurityPolicy&) const; - bool HasHeaderDeliveredPolicy() const { return header_delivered_; } - static bool IsValidCSPAttr(const String& attr, - const String& context_required_csp); - // Returns the 'wasm-eval' source is supported. bool SupportsWasmEval() const { return supports_wasm_eval_; } void SetSupportsWasmEval(bool value) { supports_wasm_eval_ = value; }
diff --git a/third_party/blink/renderer/core/frame/csp/content_security_policy_test.cc b/third_party/blink/renderer/core/frame/csp/content_security_policy_test.cc index 7d9255b9..123d793 100644 --- a/third_party/blink/renderer/core/frame/csp/content_security_policy_test.cc +++ b/third_party/blink/renderer/core/frame/csp/content_security_policy_test.cc
@@ -585,57 +585,6 @@ } } -TEST_F(ContentSecurityPolicyTest, ShouldEnforceEmbeddersPolicy) { - struct TestCase { - const char* resource_url; - const bool inherits; - } cases[] = { - // Same-origin - {"https://example.test/index.html", true}, - // Cross-origin - {"http://example.test/index.html", false}, - {"http://example.test:8443/index.html", false}, - {"https://example.test:8443/index.html", false}, - {"http://not.example.test/index.html", false}, - {"https://not.example.test/index.html", false}, - {"https://not.example.test:8443/index.html", false}, - - // Inherit - {"about:blank", true}, - {"data:text/html,yay", true}, - {"blob:https://example.test/bbe708f3-defd-4852-93b6-cf94e032f08d", true}, - {"filesystem:http://example.test/temporary/index.html", true}, - }; - - for (const auto& test : cases) { - ResourceResponse response(KURL(test.resource_url)); - EXPECT_EQ(ContentSecurityPolicy::ShouldEnforceEmbeddersPolicy( - response, secure_origin.get()), - test.inherits); - - response.SetHttpHeaderField(http_names::kAllowCSPFrom, AtomicString("*")); - EXPECT_TRUE(ContentSecurityPolicy::ShouldEnforceEmbeddersPolicy( - response, secure_origin.get())); - - response.SetHttpHeaderField(http_names::kAllowCSPFrom, - AtomicString("* not a valid header")); - EXPECT_EQ(ContentSecurityPolicy::ShouldEnforceEmbeddersPolicy( - response, secure_origin.get()), - test.inherits); - - response.SetHttpHeaderField(http_names::kAllowCSPFrom, - AtomicString("http://example.test")); - EXPECT_EQ(ContentSecurityPolicy::ShouldEnforceEmbeddersPolicy( - response, secure_origin.get()), - test.inherits); - - response.SetHttpHeaderField(http_names::kAllowCSPFrom, - AtomicString("https://example.test")); - EXPECT_TRUE(ContentSecurityPolicy::ShouldEnforceEmbeddersPolicy( - response, secure_origin.get())); - } -} - TEST_F(ContentSecurityPolicyTest, DirectiveType) { struct TestCase { ContentSecurityPolicy::DirectiveType type; @@ -688,42 +637,6 @@ } } -// TODO(antoniosartori): Remove this test and the function -// ContentSecurityPolicy::Subsumes when we remove the feature flag. -TEST_F(ContentSecurityPolicyTest, Subsumes) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndDisableFeature(network::features::kOutOfBlinkCSPEE); - - auto* other = MakeGarbageCollected<ContentSecurityPolicy>(); - EXPECT_TRUE(csp->Subsumes(*other)); - EXPECT_TRUE(other->Subsumes(*csp)); - - csp->DidReceiveHeader("default-src http://example.com;", - ContentSecurityPolicyType::kEnforce, - ContentSecurityPolicySource::kHTTP); - // If this CSP is not empty, the other must not be empty either. - EXPECT_FALSE(csp->Subsumes(*other)); - EXPECT_TRUE(other->Subsumes(*csp)); - - // Report-only policies do not impact subsumption. - other->DidReceiveHeader("default-src http://example.com;", - ContentSecurityPolicyType::kReport, - ContentSecurityPolicySource::kHTTP); - EXPECT_FALSE(csp->Subsumes(*other)); - - // CSPDirectiveLists have to subsume. - other->DidReceiveHeader("default-src http://example.com https://another.com;", - ContentSecurityPolicyType::kEnforce, - ContentSecurityPolicySource::kHTTP); - EXPECT_FALSE(csp->Subsumes(*other)); - - // `other` is stricter than `this`. - other->DidReceiveHeader("default-src https://example.com;", - ContentSecurityPolicyType::kEnforce, - ContentSecurityPolicySource::kHTTP); - EXPECT_TRUE(csp->Subsumes(*other)); -} - TEST_F(ContentSecurityPolicyTest, RequestsAllowedWhenBypassingCSP) { const KURL base; execution_context = CreateExecutionContext(); @@ -913,149 +826,6 @@ SchemeRegistry::RemoveURLSchemeAsNotAllowingJavascriptURLs("https"); } -// TODO(antoniosartori): Remove this test and the function -// ContentSecurityPolicy::IsValidCSPAttr when we remove the feature flag. -TEST_F(ContentSecurityPolicyTest, IsValidCSPAttrTest) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndDisableFeature(network::features::kOutOfBlinkCSPEE); - - // Empty string is invalid - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr("", "")); - - // Policy with single directive - EXPECT_TRUE( - ContentSecurityPolicy::IsValidCSPAttr("base-uri http://example.com", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "invalid-policy-name http://example.com", "")); - - // Policy with multiple directives - EXPECT_TRUE(ContentSecurityPolicy::IsValidCSPAttr( - "base-uri http://example.com 'self'; child-src http://example.com; " - "default-src http://example.com", - "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "default-src http://example.com; " - "invalid-policy-name http://example.com", - "")); - - // 'self', 'none' - EXPECT_TRUE(ContentSecurityPolicy::IsValidCSPAttr("script-src 'self'", "")); - EXPECT_TRUE(ContentSecurityPolicy::IsValidCSPAttr("default-src 'none'", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr("script-src 'slef'", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr("default-src 'non'", "")); - - // invalid ascii character - EXPECT_FALSE( - ContentSecurityPolicy::IsValidCSPAttr("script-src https: \x08", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src 127.0.0.1%2F%DFisnotSorB%2F", "")); - - // paths on script-src - EXPECT_TRUE( - ContentSecurityPolicy::IsValidCSPAttr("script-src 127.0.0.1:*/", "")); - EXPECT_TRUE( - ContentSecurityPolicy::IsValidCSPAttr("script-src 127.0.0.1:*/path", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src 127.0.0.1:*/path?query=string", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src 127.0.0.1:*/path#anchor", "")); - EXPECT_TRUE( - ContentSecurityPolicy::IsValidCSPAttr("script-src 127.0.0.1:8000/", "")); - EXPECT_TRUE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src 127.0.0.1:8000/path", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src 127.0.0.1:8000/path?query=string", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src 127.0.0.1:8000/path#anchor", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src 127.0.0.1:8000/thisisa;pathwithasemicolon", "")); - - // script-src invalid hosts - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr("script-src http:/", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr("script-src http://", "")); - EXPECT_FALSE( - ContentSecurityPolicy::IsValidCSPAttr("script-src http:/127.0.0.1", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src http:///127.0.0.1", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src http://127.0.0.1:/", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src https://127.?.0.1:*", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src https://127.0.0.1:", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src https://127.0.0.1:\t* ", "")); - - // script-src host wildcards - EXPECT_TRUE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src http://*.0.1:8000", "")); - EXPECT_TRUE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src http://*.0.1:8000/", "")); - EXPECT_TRUE( - ContentSecurityPolicy::IsValidCSPAttr("script-src http://*.0.1:*", "")); - EXPECT_TRUE( - ContentSecurityPolicy::IsValidCSPAttr("script-src http://*.0.1:*/", "")); - - // missing semicolon - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "default-src 'self' script-src example.com", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src 'self' object-src 'self' style-src *", "")); - - // 'none' with other sources - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src http://127.0.0.1:8000 'none'", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src 'none' 'none' 'none'", "")); - - // comma separated - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src 'none', object-src 'none'", "")); - - // reporting not allowed - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src 'none'; report-uri http://example.com/reporting", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "report-uri relative-path/reporting;" - "base-uri http://example.com 'self'", - "")); - - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "script-src 'none'; report-to http://example.com/reporting", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "report-to relative-path/reporting;" - "base-uri http://example.com 'self'", - "")); - - // CRLF should not be allowed - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "base-uri\nhttp://example.com", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "base-uri http://example.com\nhttp://example2.com", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "base\n-uri http://example.com", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "\nbase-uri http://example.com", "")); - - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "base-uri\r\nhttp://example.com", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "base-uri http://example.com\r\nhttp://example2.com", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "base\r\n-uri http://example.com", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "\r\nbase-uri http://example.com", "")); - - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "base-uri\rhttp://example.com", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "base-uri http://example.com\rhttp://example2.com", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "base\r-uri http://example.com", "")); - EXPECT_FALSE(ContentSecurityPolicy::IsValidCSPAttr( - "\rbase-uri http://example.com", "")); -} - TEST_F(ContentSecurityPolicyTest, TrustedTypesNoDirective) { csp->BindToDelegate(execution_context->GetContentSecurityPolicyDelegate()); csp->DidReceiveHeader("", ContentSecurityPolicyType::kEnforce,
diff --git a/third_party/blink/renderer/core/frame/csp/csp_directive_list.cc b/third_party/blink/renderer/core/frame/csp/csp_directive_list.cc index 9127b2e..82e99c21 100644 --- a/third_party/blink/renderer/core/frame/csp/csp_directive_list.cc +++ b/third_party/blink/renderer/core/frame/csp/csp_directive_list.cc
@@ -1425,76 +1425,6 @@ original_type); } -SourceListDirectiveVector CSPDirectiveList::GetSourceVector( - const ContentSecurityPolicy::DirectiveType type, - const CSPDirectiveListVector& policies) { - SourceListDirectiveVector source_list_directives; - for (const auto& policy : policies) { - if (SourceListDirective* directive = policy->OperativeDirective(type)) { - if (directive->IsNone()) - return SourceListDirectiveVector(1, directive); - source_list_directives.push_back(directive); - } - } - - return source_list_directives; -} - -bool CSPDirectiveList::Subsumes(const CSPDirectiveListVector& other) { - // A list of directives that we consider for subsumption. - // See more about source lists here: - // https://w3c.github.io/webappsec-csp/#framework-directive-source-list - static ContentSecurityPolicy::DirectiveType directives[] = { - ContentSecurityPolicy::DirectiveType::kChildSrc, - ContentSecurityPolicy::DirectiveType::kConnectSrc, - ContentSecurityPolicy::DirectiveType::kFontSrc, - ContentSecurityPolicy::DirectiveType::kFrameSrc, - ContentSecurityPolicy::DirectiveType::kImgSrc, - ContentSecurityPolicy::DirectiveType::kManifestSrc, - ContentSecurityPolicy::DirectiveType::kMediaSrc, - ContentSecurityPolicy::DirectiveType::kObjectSrc, - ContentSecurityPolicy::DirectiveType::kScriptSrc, - ContentSecurityPolicy::DirectiveType::kScriptSrcAttr, - ContentSecurityPolicy::DirectiveType::kScriptSrcElem, - ContentSecurityPolicy::DirectiveType::kStyleSrc, - ContentSecurityPolicy::DirectiveType::kStyleSrcAttr, - ContentSecurityPolicy::DirectiveType::kStyleSrcElem, - ContentSecurityPolicy::DirectiveType::kWorkerSrc, - ContentSecurityPolicy::DirectiveType::kBaseURI, - ContentSecurityPolicy::DirectiveType::kFrameAncestors, - ContentSecurityPolicy::DirectiveType::kFormAction, - ContentSecurityPolicy::DirectiveType::kNavigateTo}; - - for (const auto& directive : directives) { - // There should only be one SourceListDirective for each directive in - // Embedding-CSP. - SourceListDirectiveVector required_list = - GetSourceVector(directive, CSPDirectiveListVector(1, this)); - if (!required_list.size()) - continue; - SourceListDirective* required = required_list[0]; - // Aggregate all serialized source lists of the returned CSP into a vector - // based on a directive type, defaulting accordingly (for example, to - // `default-src`). - SourceListDirectiveVector returned = GetSourceVector(directive, other); - // TODO(amalika): Add checks for plugin-types, sandbox, disown-opener, - // navigation-to, worker-src. - if (!required->Subsumes(returned)) - return false; - } - - if (!HasPluginTypes()) - return true; - - HeapVector<Member<MediaListDirective>> plugin_types_other; - for (const auto& policy : other) { - if (policy->HasPluginTypes()) - plugin_types_other.push_back(policy->plugin_types_); - } - - return plugin_types_->Subsumes(plugin_types_other); -} - network::mojom::blink::ContentSecurityPolicyPtr CSPDirectiveList::ExposeForNavigationalChecks() const { using CSPDirectiveName = network::mojom::blink::CSPDirectiveName;
diff --git a/third_party/blink/renderer/core/frame/csp/csp_directive_list.h b/third_party/blink/renderer/core/frame/csp/csp_directive_list.h index 0199a12..59335c60 100644 --- a/third_party/blink/renderer/core/frame/csp/csp_directive_list.h +++ b/third_party/blink/renderer/core/frame/csp/csp_directive_list.h
@@ -134,10 +134,6 @@ bool AllowHash(const CSPHashValue& hash_value, const ContentSecurityPolicy::InlineType inline_type) const; - // The algorithm is described here: - // https://w3c.github.io/webappsec-csp/embedded/#subsume-policy - bool Subsumes(const CSPDirectiveListVector&); - // Export a subset of the Policy. The primary goal of this method is to make // the embedders aware of the directives that affect navigation, as the // embedder is responsible for navigational enforcement. @@ -178,7 +174,6 @@ private: FRIEND_TEST_ALL_PREFIXES(CSPDirectiveListTest, IsMatchingNoncePresent); - FRIEND_TEST_ALL_PREFIXES(CSPDirectiveListTest, GetSourceVector); FRIEND_TEST_ALL_PREFIXES(CSPDirectiveListTest, OperativeDirectiveGivenType); bool ParseDirective(const UChar* begin, @@ -294,12 +289,6 @@ ContentSecurityPolicy::DirectiveType original_type = ContentSecurityPolicy::DirectiveType::kUndefined) const; - // This function aggregates from a vector of policies all operative - // SourceListDirectives of a given type into a vector. - static SourceListDirectiveVector GetSourceVector( - const ContentSecurityPolicy::DirectiveType, - const CSPDirectiveListVector& policies); - Member<ContentSecurityPolicy> policy_; String header_;
diff --git a/third_party/blink/renderer/core/frame/csp/csp_directive_list_test.cc b/third_party/blink/renderer/core/frame/csp/csp_directive_list_test.cc index c0876d4..48467f19 100644 --- a/third_party/blink/renderer/core/frame/csp/csp_directive_list_test.cc +++ b/third_party/blink/renderer/core/frame/csp/csp_directive_list_test.cc
@@ -540,276 +540,6 @@ } } -TEST_F(CSPDirectiveListTest, SubsumesBasedOnCSPSourcesOnly) { - CSPDirectiveList* a = CreateList( - "script-src http://*.one.com; img-src https://sub.one.com " - "http://two.com/imgs/", - ContentSecurityPolicyType::kEnforce); - - struct TestCase { - const Vector<const char*> policies; - bool expected; - bool expected_first_policy_opposite; - } cases[] = { - // `listB`, which is not as restrictive as `A`, is not subsumed. - {{""}, false, true}, - {{"script-src http://example.com"}, false, false}, - {{"img-src http://example.com"}, false, false}, - {{"script-src http://*.one.com"}, false, true}, - {{"img-src https://sub.one.com http://two.com/imgs/"}, false, true}, - {{"default-src http://example.com"}, false, false}, - {{"default-src https://sub.one.com http://two.com/imgs/"}, false, false}, - {{"default-src http://sub.one.com"}, false, false}, - {{"script-src http://*.one.com; img-src http://two.com/"}, false, false}, - {{"script-src http://*.one.com", "img-src http://sub.one.com"}, - false, - true}, - {{"script-src http://*.one.com", "script-src https://two.com"}, - false, - true}, - {{"script-src http://*.random.com", "script-src https://random.com"}, - false, - false}, - {{"script-src http://sub.one.com", "script-src https://random.com"}, - false, - false}, - {{"script-src http://*.random.com; default-src http://sub.one.com " - "http://two.com/imgs/", - "default-src https://sub.random.com"}, - false, - false}, - // `listB`, which is as restrictive as `A`, is subsumed. - {{"default-src https://sub.one.com"}, true, false}, - {{"default-src http://random.com", - "default-src https://non-random.com:*"}, - true, - false}, - {{"script-src http://*.one.com; img-src https://sub.one.com"}, - true, - false}, - {{"script-src http://*.one.com; img-src https://sub.one.com " - "http://two.com/imgs/"}, - true, - true}, - {{"script-src http://*.one.com", - "img-src https://sub.one.com http://two.com/imgs/"}, - true, - true}, - {{"script-src http://*.random.com; default-src https://sub.one.com " - "http://two.com/imgs/", - "default-src https://else.com"}, - true, - false}, - {{"script-src http://*.random.com; default-src https://sub.one.com " - "http://two.com/imgs/", - "default-src https://sub.one.com"}, - true, - false}, - }; - - CSPDirectiveList* empty_a = - CreateList("", ContentSecurityPolicyType::kEnforce); - - for (const auto& test : cases) { - HeapVector<Member<CSPDirectiveList>> list_b; - for (auto* const policy : test.policies) { - list_b.push_back(CreateList(policy, ContentSecurityPolicyType::kEnforce)); - } - - EXPECT_EQ(test.expected, a->Subsumes(list_b)); - // Empty CSPDirective subsumes any list. - EXPECT_TRUE(empty_a->Subsumes(list_b)); - // Check if first policy of `listB` subsumes `A`. - EXPECT_EQ(test.expected_first_policy_opposite, - list_b[0]->Subsumes(HeapVector<Member<CSPDirectiveList>>(1, a))); - } -} - -TEST_F(CSPDirectiveListTest, SubsumesIfNoneIsPresent) { - struct TestCase { - const char* policy_a; - const Vector<const char*> policies_b; - bool expected; - } cases[] = { - // `policyA` subsumes any vector of policies. - {"", {""}, true}, - {"", {"script-src http://example.com"}, true}, - {"", {"script-src 'none'"}, true}, - {"", {"script-src http://*.one.com", "script-src https://two.com"}, true}, - // `policyA` is 'none', but no policy in `policiesB` is. - {"script-src ", {""}, false}, - {"script-src 'none'", {""}, false}, - {"script-src ", {"script-src http://example.com"}, false}, - {"script-src 'none'", {"script-src http://example.com"}, false}, - {"script-src ", {"img-src 'none'"}, false}, - {"script-src 'none'", {"img-src 'none'"}, false}, - {"script-src ", - {"script-src http://*.one.com", "img-src https://two.com"}, - false}, - {"script-src 'none'", - {"script-src http://*.one.com", "img-src https://two.com"}, - false}, - {"script-src 'none'", - {"script-src http://*.one.com", "script-src https://two.com"}, - true}, - {"script-src 'none'", - {"script-src http://*.one.com", "script-src 'self'"}, - true}, - // `policyA` is not 'none', but at least effective result of `policiesB` - // is. - {"script-src http://example.com 'none'", {"script-src 'none'"}, true}, - {"script-src http://example.com", {"script-src 'none'"}, true}, - {"script-src http://example.com 'none'", - {"script-src http://*.one.com", "script-src http://one.com", - "script-src 'none'"}, - true}, - {"script-src http://example.com", - {"script-src http://*.one.com", "script-src http://one.com", - "script-src 'none'"}, - true}, - {"script-src http://one.com 'none'", - {"script-src http://*.one.com", "script-src http://one.com", - "script-src https://one.com"}, - true}, - // `policyA` is `none` and at least effective result of `policiesB` is - // too. - {"script-src ", {"script-src ", "script-src "}, true}, - {"script-src 'none'", {"script-src", "script-src 'none'"}, true}, - {"script-src ", {"script-src 'none'", "script-src 'none'"}, true}, - {"script-src ", - {"script-src 'none' http://example.com", - "script-src 'none' http://example.com"}, - false}, - {"script-src 'none'", {"script-src 'none'", "script-src 'none'"}, true}, - {"script-src 'none'", - {"script-src 'none'", "script-src 'none'", "script-src 'none'"}, - true}, - {"script-src 'none'", - {"script-src http://*.one.com", "script-src http://one.com", - "script-src 'none'"}, - true}, - {"script-src 'none'", - {"script-src http://*.one.com", "script-src http://two.com", - "script-src http://three.com"}, - true}, - // Policies contain special keywords. - {"script-src ", {"script-src ", "script-src 'unsafe-eval'"}, true}, - {"script-src 'none'", - {"script-src 'unsafe-inline'", "script-src 'none'"}, - true}, - {"script-src ", - {"script-src 'none' 'unsafe-inline'", - "script-src 'none' 'unsafe-inline'"}, - false}, - {"script-src ", - {"script-src 'none' 'unsafe-inline'", - "script-src 'unsafe-inline' 'strict-dynamic'"}, - false}, - {"script-src 'unsafe-eval'", - {"script-src 'unsafe-eval'", "script 'unsafe-inline'"}, - true}, - {"script-src 'unsafe-inline'", - {"script-src ", "script http://example.com"}, - true}, - }; - - for (const auto& test : cases) { - CSPDirectiveList* a = - CreateList(test.policy_a, ContentSecurityPolicyType::kEnforce); - - HeapVector<Member<CSPDirectiveList>> list_b; - for (auto* const policy_b : test.policies_b) { - list_b.push_back( - CreateList(policy_b, ContentSecurityPolicyType::kEnforce)); - } - - EXPECT_EQ(test.expected, a->Subsumes(list_b)); - } -} - -TEST_F(CSPDirectiveListTest, SubsumesPluginTypes) { - struct TestCase { - const char* policy_a; - const Vector<const char*> policies_b; - bool expected; - } cases[] = { - // `policyA` subsumes `policiesB`. - {"script-src 'unsafe-inline'", - {"script-src ", "script-src http://example.com", - "plugin-types text/plain"}, - true}, - {"script-src http://example.com", - {"script-src http://example.com; plugin-types "}, - true}, - {"script-src http://example.com", - {"script-src http://example.com; plugin-types text/plain"}, - true}, - {"script-src http://example.com; plugin-types text/plain", - {"script-src http://example.com; plugin-types text/plain"}, - true}, - {"script-src http://example.com; plugin-types text/plain", - {"script-src http://example.com; plugin-types "}, - true}, - {"script-src http://example.com; plugin-types text/plain", - {"script-src http://example.com; plugin-types ", "plugin-types "}, - true}, - {"plugin-types application/pdf text/plain", - {"plugin-types application/pdf text/plain", - "plugin-types application/x-blink-test-plugin"}, - true}, - {"plugin-types application/pdf text/plain", - {"plugin-types application/pdf text/plain", - "plugin-types application/pdf text/plain " - "application/x-blink-test-plugin"}, - true}, - {"plugin-types application/x-shockwave-flash application/pdf text/plain", - {"plugin-types application/x-shockwave-flash application/pdf text/plain", - "plugin-types application/x-shockwave-flash"}, - true}, - {"plugin-types application/x-shockwave-flash", - {"plugin-types application/x-shockwave-flash application/pdf text/plain", - "plugin-types application/x-shockwave-flash"}, - true}, - // `policyA` does not subsume `policiesB`. - {"script-src http://example.com; plugin-types text/plain", - {"script-src http://example.com"}, - false}, - {"plugin-types random-value", - {"script-src 'unsafe-inline'", "plugin-types text/plain"}, - false}, - {"plugin-types random-value", - {"script-src http://example.com", "script-src http://example.com"}, - false}, - {"plugin-types random-value", - {"plugin-types text/plain", "plugin-types text/plain"}, - false}, - {"script-src http://example.com; plugin-types text/plain", - {"plugin-types ", "plugin-types "}, - false}, - {"plugin-types application/pdf text/plain", - {"plugin-types application/x-blink-test-plugin", - "plugin-types application/x-blink-test-plugin"}, - false}, - {"plugin-types application/pdf text/plain", - {"plugin-types application/pdf application/x-blink-test-plugin", - "plugin-types application/x-blink-test-plugin"}, - false}, - }; - - for (const auto& test : cases) { - CSPDirectiveList* a = - CreateList(test.policy_a, ContentSecurityPolicyType::kEnforce); - - HeapVector<Member<CSPDirectiveList>> list_b; - for (auto* const policy_b : test.policies_b) { - list_b.push_back( - CreateList(policy_b, ContentSecurityPolicyType::kEnforce)); - } - - EXPECT_EQ(test.expected, a->Subsumes(list_b)); - } -} - TEST_F(CSPDirectiveListTest, OperativeDirectiveGivenType) { struct TestCase { ContentSecurityPolicy::DirectiveType directive; @@ -917,160 +647,6 @@ } } -TEST_F(CSPDirectiveListTest, GetSourceVector) { - const Vector<const char*> policies = { - // Policy 1 - "default-src https://default-src.com", - // Policy 2 - "child-src http://child-src.com", - // Policy 3 - "child-src http://child-src.com; default-src https://default-src.com", - // Policy 4 - "base-uri http://base-uri.com", - // Policy 5 - "frame-src http://frame-src.com"}; - - // Check expectations on the initial set-up. - HeapVector<Member<CSPDirectiveList>> policy_vector; - for (auto* const policy : policies) { - policy_vector.push_back( - CreateList(policy, ContentSecurityPolicyType::kEnforce)); - } - HeapVector<Member<SourceListDirective>> result = - CSPDirectiveList::GetSourceVector( - ContentSecurityPolicy::DirectiveType::kDefaultSrc, policy_vector); - EXPECT_EQ(result.size(), 2u); - result = CSPDirectiveList::GetSourceVector( - ContentSecurityPolicy::DirectiveType::kChildSrc, policy_vector); - EXPECT_EQ(result.size(), 3u); - result = CSPDirectiveList::GetSourceVector( - ContentSecurityPolicy::DirectiveType::kBaseURI, policy_vector); - EXPECT_EQ(result.size(), 1u); - result = CSPDirectiveList::GetSourceVector( - ContentSecurityPolicy::DirectiveType::kFrameSrc, policy_vector); - EXPECT_EQ(result.size(), 4u); - - enum DefaultBehaviour { kDefault, kNoDefault, kChildAndDefault }; - - struct TestCase { - ContentSecurityPolicy::DirectiveType directive; - const DefaultBehaviour type; - size_t expected_total; - int expected_current; - int expected_default_src; - int expected_child_src; - } cases[] = { - // Directives with default directive. - {ContentSecurityPolicy::DirectiveType::kChildSrc, kDefault, 4u, 3, 1, 3}, - {ContentSecurityPolicy::DirectiveType::kConnectSrc, kDefault, 3u, 1, 2, - 0}, - {ContentSecurityPolicy::DirectiveType::kFontSrc, kDefault, 3u, 1, 2, 0}, - {ContentSecurityPolicy::DirectiveType::kImgSrc, kDefault, 3u, 1, 2, 0}, - {ContentSecurityPolicy::DirectiveType::kManifestSrc, kDefault, 3u, 1, 2, - 0}, - {ContentSecurityPolicy::DirectiveType::kMediaSrc, kDefault, 3u, 1, 2, 0}, - {ContentSecurityPolicy::DirectiveType::kObjectSrc, kDefault, 3u, 1, 2, 0}, - {ContentSecurityPolicy::DirectiveType::kScriptSrc, kDefault, 3u, 1, 2, 0}, - {ContentSecurityPolicy::DirectiveType::kStyleSrc, kDefault, 3u, 1, 2, 0}, - // Directives with no default directive. - {ContentSecurityPolicy::DirectiveType::kBaseURI, kNoDefault, 2u, 2, 0, 0}, - {ContentSecurityPolicy::DirectiveType::kFrameAncestors, kNoDefault, 1u, 1, - 0, 0}, - {ContentSecurityPolicy::DirectiveType::kFormAction, kNoDefault, 1u, 1, 0, - 0}, - // Directive with multiple default directives. - {ContentSecurityPolicy::DirectiveType::kFrameSrc, kChildAndDefault, 5u, 2, - 1, 2}, - }; - - for (const auto& test : cases) { - // Initial set-up. - HeapVector<Member<CSPDirectiveList>> policy_vector; - for (auto* const policy : policies) { - policy_vector.push_back( - CreateList(policy, ContentSecurityPolicyType::kEnforce)); - } - // Append current test's policy. - std::stringstream current_directive; - const char* name = ContentSecurityPolicy::GetDirectiveName(test.directive); - current_directive << name << " http://" << name << ".com;"; - policy_vector.push_back(CreateList(current_directive.str().c_str(), - ContentSecurityPolicyType::kEnforce)); - - HeapVector<Member<SourceListDirective>> result = - CSPDirectiveList::GetSourceVector(test.directive, policy_vector); - - EXPECT_EQ(result.size(), test.expected_total); - - int actual_current = 0, actual_default = 0, actual_child = 0; - for (const auto& src_list : result) { - HeapVector<Member<CSPSource>> sources = src_list->list_; - for (const auto& source : sources) { - if (source->host_.StartsWith(name)) - actual_current += 1; - else if (source->host_ == "default-src.com") - actual_default += 1; - - if (source->host_ == "child-src.com") - actual_child += 1; - } - } - - EXPECT_EQ(actual_default, test.expected_default_src); - EXPECT_EQ(actual_current, test.expected_current); - EXPECT_EQ(actual_child, test.expected_child_src); - - // If another default-src is added that should only impact Fetch Directives - policy_vector.push_back(CreateList("default-src https://default-src.com;", - ContentSecurityPolicyType::kEnforce)); - size_t udpated_total = - test.type != kNoDefault ? test.expected_total + 1 : test.expected_total; - EXPECT_EQ( - CSPDirectiveList::GetSourceVector(test.directive, policy_vector).size(), - udpated_total); - size_t expected_child_src = - test.directive == ContentSecurityPolicy::DirectiveType::kChildSrc ? 5u - : 4u; - EXPECT_EQ( - CSPDirectiveList::GetSourceVector( - ContentSecurityPolicy::DirectiveType::kChildSrc, policy_vector) - .size(), - expected_child_src); - - // If another child-src is added that should only impact frame-src and - // child-src - policy_vector.push_back(CreateList("child-src http://child-src.com;", - ContentSecurityPolicyType::kEnforce)); - udpated_total = test.type == kChildAndDefault || - test.directive == - ContentSecurityPolicy::DirectiveType::kChildSrc - ? udpated_total + 1 - : udpated_total; - EXPECT_EQ( - CSPDirectiveList::GetSourceVector(test.directive, policy_vector).size(), - udpated_total); - expected_child_src = expected_child_src + 1u; - EXPECT_EQ( - CSPDirectiveList::GetSourceVector( - ContentSecurityPolicy::DirectiveType::kChildSrc, policy_vector) - .size(), - expected_child_src); - - // If we add sandbox, nothing should change since it is currenly not - // considered. - policy_vector.push_back(CreateList("sandbox http://sandbox.com;", - ContentSecurityPolicyType::kEnforce)); - EXPECT_EQ( - CSPDirectiveList::GetSourceVector(test.directive, policy_vector).size(), - udpated_total); - EXPECT_EQ( - CSPDirectiveList::GetSourceVector( - ContentSecurityPolicy::DirectiveType::kChildSrc, policy_vector) - .size(), - expected_child_src); - } -} - TEST_F(CSPDirectiveListTest, ReportEndpointsProperlyParsed) { struct TestCase { const char* policy;
diff --git a/third_party/blink/renderer/core/frame/csp/csp_source.cc b/third_party/blink/renderer/core/frame/csp/csp_source.cc index 1e93f6b2..915e6a7 100644 --- a/third_party/blink/renderer/core/frame/csp/csp_source.cc +++ b/third_party/blink/renderer/core/frame/csp/csp_source.cc
@@ -197,117 +197,10 @@ return PortMatchingResult::kNotMatching; } -bool CSPSource::Subsumes(CSPSource* other) const { - if (SchemeMatches(other->scheme_) == SchemeMatchingResult::kNotMatching) - return false; - - if (other->IsSchemeOnly() || IsSchemeOnly()) - return IsSchemeOnly(); - - if ((host_wildcard_ == kNoWildcard && - other->host_wildcard_ == kHasWildcard) || - (port_wildcard_ == kNoWildcard && - other->port_wildcard_ == kHasWildcard)) { - return false; - } - - bool host_subsumes = other->host_wildcard_ == kHasWildcard - ? HostMatches("." + other->host_) - : HostMatches(other->host_); - bool port_subsumes = (port_wildcard_ == kHasWildcard) || - PortMatches(other->port_, other->scheme_) != - PortMatchingResult::kNotMatching; - bool path_subsumes = PathMatches(other->path_); - return host_subsumes && port_subsumes && path_subsumes; -} - -bool CSPSource::IsSimilar(CSPSource* other) const { - bool schemes_match = - SchemeMatches(other->scheme_) != SchemeMatchingResult::kNotMatching || - other->SchemeMatches(scheme_) != SchemeMatchingResult::kNotMatching; - if (!schemes_match || IsSchemeOnly() || other->IsSchemeOnly()) - return schemes_match; - bool hosts_match = - HostMatches((other->host_wildcard_ ? "*." : "") + other->host_) || - other->HostMatches((host_wildcard_ ? "*." : "") + host_); - bool ports_match = - (other->port_wildcard_ == kHasWildcard) || - PortMatches(other->port_, other->scheme_) != - PortMatchingResult::kNotMatching || - other->PortMatches(port_, scheme_) != PortMatchingResult::kNotMatching; - bool paths_match = PathMatches(other->path_) || other->PathMatches(path_); - if (hosts_match && ports_match && paths_match) - return true; - - return false; -} - -CSPSource* CSPSource::Intersect(CSPSource* other) const { - if (!IsSimilar(other)) - return nullptr; - - String scheme = - other->SchemeMatches(scheme_) != SchemeMatchingResult::kNotMatching - ? scheme_ - : other->scheme_; - if (IsSchemeOnly() || other->IsSchemeOnly()) { - const CSPSource* stricter = IsSchemeOnly() ? other : this; - return MakeGarbageCollected<CSPSource>( - policy_, scheme, stricter->host_, stricter->port_, stricter->path_, - stricter->host_wildcard_, stricter->port_wildcard_); - } - - // Pick the host without wildcard, or if both have a wildcard, pick the - // longer one. - String host = (host_wildcard_ == kNoWildcard || - (other->host_wildcard_ == kHasWildcard && - host_.length() > other->host_.length())) - ? host_ - : other->host_; - // Since sources are similar and paths match, pick the longer one. - String path = path_.length() > other->path_.length() ? path_ : other->path_; - // Choose this port if the other port is empty, has wildcard or is a port for - // a less secure scheme such as "http" whereas scheme of this is "https", in - // which case the lengths would differ. - int port = (other->port_wildcard_ == kHasWildcard || - other->port_ == kPortUnspecified || - scheme_.length() > other->scheme_.length()) - ? port_ - : other->port_; - WildcardDisposition host_wildcard = - (host_wildcard_ == kHasWildcard) ? other->host_wildcard_ : host_wildcard_; - WildcardDisposition port_wildcard = - (port_wildcard_ == kHasWildcard) ? other->port_wildcard_ : port_wildcard_; - return MakeGarbageCollected<CSPSource>(policy_, scheme, host, port, path, - host_wildcard, port_wildcard); -} - bool CSPSource::IsSchemeOnly() const { return host_.IsEmpty() && (host_wildcard_ == kNoWildcard); } -bool CSPSource::FirstSubsumesSecond( - const HeapVector<Member<CSPSource>>& list_a, - const HeapVector<Member<CSPSource>>& list_b) { - // Empty vector of CSPSources has an effect of 'none'. - if (!list_a.size() || !list_b.size()) - return !list_b.size(); - - // Walk through all the items in |listB|, ensuring that each is subsumed by at - // least one item in |listA|. If any item in |listB| is not subsumed, return - // false. - for (const auto& source_b : list_b) { - bool found_match = false; - for (const auto& source_a : list_a) { - if ((found_match = source_a->Subsumes(source_b))) - break; - } - if (!found_match) - return false; - } - return true; -} - network::mojom::blink::CSPSourcePtr CSPSource::ExposeForNavigationalChecks() const { return network::mojom::blink::CSPSource::New(
diff --git a/third_party/blink/renderer/core/frame/csp/csp_source.h b/third_party/blink/renderer/core/frame/csp/csp_source.h index 6c582cb..856d4cd 100644 --- a/third_party/blink/renderer/core/frame/csp/csp_source.h +++ b/third_party/blink/renderer/core/frame/csp/csp_source.h
@@ -56,40 +56,18 @@ bool MatchesAsSelf(const KURL&); - // Returns true if this CSPSource subsumes the other, as defined by the - // algorithm at https://w3c.github.io/webappsec-csp/embedded/#subsume-policy - bool Subsumes(CSPSource*) const; - // Retrieve the most restrictive information from the two CSPSources if - // isSimilar is true for the two. Otherwise, return nullptr. - CSPSource* Intersect(CSPSource*) const; - // Returns true if the first list subsumes the second, as defined by the - // algorithm at - // https://w3c.github.io/webappsec-csp/embedded/#subsume-source-list - static bool FirstSubsumesSecond(const HeapVector<Member<CSPSource>>&, - const HeapVector<Member<CSPSource>>&); - network::mojom::blink::CSPSourcePtr ExposeForNavigationalChecks() const; void Trace(Visitor*) const; private: - FRIEND_TEST_ALL_PREFIXES(CSPSourceTest, IsSimilar); - FRIEND_TEST_ALL_PREFIXES(CSPSourceTest, Intersect); - FRIEND_TEST_ALL_PREFIXES(CSPSourceTest, IntersectSchemesOnly); - FRIEND_TEST_ALL_PREFIXES(SourceListDirectiveTest, GetIntersectCSPSources); - FRIEND_TEST_ALL_PREFIXES(SourceListDirectiveTest, - GetIntersectCSPSourcesSchemes); - FRIEND_TEST_ALL_PREFIXES(CSPDirectiveListTest, GetSourceVector); FRIEND_TEST_ALL_PREFIXES(CSPDirectiveListTest, OperativeDirectiveGivenType); - FRIEND_TEST_ALL_PREFIXES(SourceListDirectiveTest, SubsumesWithSelf); - FRIEND_TEST_ALL_PREFIXES(SourceListDirectiveTest, GetSources); SchemeMatchingResult SchemeMatches(const String&) const; bool HostMatches(const String&) const; bool PathMatches(const String&) const; // Protocol is necessary to determine default port if it is zero. PortMatchingResult PortMatches(int port, const String& protocol) const; - bool IsSimilar(CSPSource* other) const; // Helper inline functions for Port and Scheme MatchingResult enums bool inline RequiresUpgrade(const PortMatchingResult result) const {
diff --git a/third_party/blink/renderer/core/frame/csp/csp_source_test.cc b/third_party/blink/renderer/core/frame/csp/csp_source_test.cc index c0129a5..4238482 100644 --- a/third_party/blink/renderer/core/frame/csp/csp_source_test.cc +++ b/third_party/blink/renderer/core/frame/csp/csp_source_test.cc
@@ -318,751 +318,6 @@ } } -TEST_F(CSPSourceTest, DoesNotSubsume) { - struct Source { - const char* scheme; - const char* host; - const char* path; - const int port; - }; - struct TestCase { - const Source a; - const Source b; - } cases[] = { - {{"http", "example.com", "/", CSPSource::kPortUnspecified}, - {"http", "another.com", "/", CSPSource::kPortUnspecified}}, - {{"wss", "example.com", "/", CSPSource::kPortUnspecified}, - {"http", "example.com", "/", CSPSource::kPortUnspecified}}, - {{"wss", "example.com", "/", CSPSource::kPortUnspecified}, - {"about", "example.com", "/", CSPSource::kPortUnspecified}}, - {{"http", "example.com", "/", CSPSource::kPortUnspecified}, - {"about", "example.com", "/", CSPSource::kPortUnspecified}}, - {{"http", "example.com", "/1.html", CSPSource::kPortUnspecified}, - {"http", "example.com", "/2.html", CSPSource::kPortUnspecified}}, - {{"http", "example.com", "/", 443}, {"about", "example.com", "/", 800}}, - }; - for (const auto& test : cases) { - CSPSource* returned = MakeGarbageCollected<CSPSource>( - csp.Get(), test.a.scheme, test.a.host, test.a.port, test.a.path, - CSPSource::kNoWildcard, CSPSource::kNoWildcard); - - CSPSource* required = MakeGarbageCollected<CSPSource>( - csp.Get(), test.b.scheme, test.b.host, test.b.port, test.b.path, - CSPSource::kNoWildcard, CSPSource::kNoWildcard); - - EXPECT_FALSE(required->Subsumes(returned)); - // Verify the same test with a and b swapped. - EXPECT_FALSE(required->Subsumes(returned)); - } -} - -TEST_F(CSPSourceTest, Subsumes) { - struct Source { - const char* scheme; - const char* path; - const int port; - }; - struct TestCase { - const Source a; - const Source b; - bool expected; - bool expected_when_swapped; - } cases[] = { - // Equal signals - {{"http", "/", CSPSource::kPortUnspecified}, - {"http", "/", CSPSource::kPortUnspecified}, - true, - true}, - {{"https", "/", CSPSource::kPortUnspecified}, - {"https", "/", CSPSource::kPortUnspecified}, - true, - true}, - {{"https", "/page1.html", CSPSource::kPortUnspecified}, - {"https", "/page1.html", CSPSource::kPortUnspecified}, - true, - true}, - {{"http", "/", 70}, {"http", "/", 70}, true, true}, - {{"https", "/", 70}, {"https", "/", 70}, true, true}, - {{"https", "/page1.html", CSPSource::kPortUnspecified}, - {"https", "/page1.html", CSPSource::kPortUnspecified}, - true, - true}, - {{"http", "/page1.html", 70}, {"http", "/page1.html", 70}, true, true}, - {{"https", "/page1.html", 70}, {"https", "/page1.html", 70}, true, true}, - {{"http", "/", CSPSource::kPortUnspecified}, - {"http", "", CSPSource::kPortUnspecified}, - true, - true}, - {{"http", "/", 80}, {"http", "", 80}, true, true}, - {{"http", "/", 80}, {"https", "", 443}, false, true}, - // One stronger signal in the first CSPSource - {{"https", "/", CSPSource::kPortUnspecified}, - {"http", "/", CSPSource::kPortUnspecified}, - true, - false}, - {{"http", "/page1.html", CSPSource::kPortUnspecified}, - {"http", "/", CSPSource::kPortUnspecified}, - true, - false}, - {{"http", "/", 80}, - {"http", "/", CSPSource::kPortUnspecified}, - true, - true}, - {{"http", "/", 700}, - {"http", "/", CSPSource::kPortUnspecified}, - false, - false}, - // Two stronger signals in the first CSPSource - {{"https", "/page1.html", CSPSource::kPortUnspecified}, - {"http", "/", CSPSource::kPortUnspecified}, - true, - false}, - {{"https", "/", 80}, - {"http", "/", CSPSource::kPortUnspecified}, - false, - false}, - {{"http", "/page1.html", 80}, - {"http", "/", CSPSource::kPortUnspecified}, - true, - false}, - // Three stronger signals in the first CSPSource - {{"https", "/page1.html", 70}, - {"http", "/", CSPSource::kPortUnspecified}, - false, - false}, - // Mixed signals - {{"https", "/", CSPSource::kPortUnspecified}, - {"http", "/page1.html", CSPSource::kPortUnspecified}, - false, - false}, - {{"https", "/", CSPSource::kPortUnspecified}, - {"http", "/", 70}, - false, - false}, - {{"http", "/page1.html", CSPSource::kPortUnspecified}, - {"http", "/", 70}, - false, - false}, - }; - - for (const auto& test : cases) { - CSPSource* returned = MakeGarbageCollected<CSPSource>( - csp.Get(), test.a.scheme, "example.com", test.a.port, test.a.path, - CSPSource::kNoWildcard, CSPSource::kNoWildcard); - - CSPSource* required = MakeGarbageCollected<CSPSource>( - csp.Get(), test.b.scheme, "example.com", test.b.port, test.b.path, - CSPSource::kNoWildcard, CSPSource::kNoWildcard); - - EXPECT_EQ(required->Subsumes(returned), test.expected); - // Verify the same test with a and b swapped. - EXPECT_EQ(returned->Subsumes(required), test.expected_when_swapped); - } - - // When returned CSP has a wildcard but the required csp doesn't, then it is - // not subsumed. - for (const auto& test : cases) { - CSPSource* returned = MakeGarbageCollected<CSPSource>( - csp.Get(), test.a.scheme, "example.com", test.a.port, test.a.path, - CSPSource::kHasWildcard, CSPSource::kNoWildcard); - CSPSource* required = MakeGarbageCollected<CSPSource>( - csp.Get(), test.b.scheme, "example.com", test.b.port, test.b.path, - CSPSource::kNoWildcard, CSPSource::kNoWildcard); - - EXPECT_FALSE(required->Subsumes(returned)); - - // If required csp also allows a wildcard in host, then the answer should be - // as expected. - CSPSource* required2 = MakeGarbageCollected<CSPSource>( - csp.Get(), test.b.scheme, "example.com", test.b.port, test.b.path, - CSPSource::kHasWildcard, CSPSource::kNoWildcard); - EXPECT_EQ(required2->Subsumes(returned), test.expected); - } -} - -TEST_F(CSPSourceTest, WildcardsSubsumes) { - struct Wildcards { - CSPSource::WildcardDisposition host_dispotion; - CSPSource::WildcardDisposition port_dispotion; - }; - struct TestCase { - const Wildcards a; - const Wildcards b; - bool expected; - } cases[] = { - // One out of four possible wildcards. - {{CSPSource::kHasWildcard, CSPSource::kNoWildcard}, - {CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - false}, - {{CSPSource::kNoWildcard, CSPSource::kHasWildcard}, - {CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - false}, - {{CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {CSPSource::kNoWildcard, CSPSource::kHasWildcard}, - true}, - {{CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {CSPSource::kHasWildcard, CSPSource::kNoWildcard}, - false}, - // Two out of four possible wildcards. - {{CSPSource::kHasWildcard, CSPSource::kHasWildcard}, - {CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - false}, - {{CSPSource::kHasWildcard, CSPSource::kNoWildcard}, - {CSPSource::kHasWildcard, CSPSource::kNoWildcard}, - true}, - {{CSPSource::kHasWildcard, CSPSource::kNoWildcard}, - {CSPSource::kNoWildcard, CSPSource::kHasWildcard}, - false}, - {{CSPSource::kNoWildcard, CSPSource::kHasWildcard}, - {CSPSource::kHasWildcard, CSPSource::kNoWildcard}, - false}, - {{CSPSource::kNoWildcard, CSPSource::kHasWildcard}, - {CSPSource::kNoWildcard, CSPSource::kHasWildcard}, - true}, - {{CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {CSPSource::kHasWildcard, CSPSource::kHasWildcard}, - false}, - // Three out of four possible wildcards. - {{CSPSource::kHasWildcard, CSPSource::kHasWildcard}, - {CSPSource::kHasWildcard, CSPSource::kNoWildcard}, - false}, - {{CSPSource::kHasWildcard, CSPSource::kHasWildcard}, - {CSPSource::kNoWildcard, CSPSource::kHasWildcard}, - false}, - {{CSPSource::kHasWildcard, CSPSource::kNoWildcard}, - {CSPSource::kHasWildcard, CSPSource::kHasWildcard}, - true}, - {{CSPSource::kNoWildcard, CSPSource::kHasWildcard}, - {CSPSource::kHasWildcard, CSPSource::kHasWildcard}, - false}, - // Four out of four possible wildcards. - {{CSPSource::kHasWildcard, CSPSource::kHasWildcard}, - {CSPSource::kHasWildcard, CSPSource::kHasWildcard}, - true}, - }; - - // There are different cases for wildcards but now also the second CSPSource - // has a more specific path. - for (const auto& test : cases) { - CSPSource* returned = MakeGarbageCollected<CSPSource>( - csp.Get(), "http", "example.com", CSPSource::kPortUnspecified, "/", - test.a.host_dispotion, test.a.port_dispotion); - CSPSource* required = MakeGarbageCollected<CSPSource>( - csp.Get(), "http", "example.com", CSPSource::kPortUnspecified, "/", - test.b.host_dispotion, test.b.port_dispotion); - EXPECT_EQ(required->Subsumes(returned), test.expected); - - // Wildcards should not matter when required csp is stricter than returned - // csp. - CSPSource* required2 = MakeGarbageCollected<CSPSource>( - csp.Get(), "https", "example.com", CSPSource::kPortUnspecified, "/", - test.b.host_dispotion, test.b.port_dispotion); - EXPECT_FALSE(required2->Subsumes(returned)); - } -} - -TEST_F(CSPSourceTest, SchemesOnlySubsumes) { - struct TestCase { - String a_scheme; - String b_scheme; - bool expected; - } cases[] = { - // HTTP - {"http", "http", true}, - {"http", "https", false}, - {"https", "http", true}, - {"https", "https", true}, - // WSS - {"ws", "ws", true}, - {"ws", "wss", false}, - {"wss", "ws", true}, - {"wss", "wss", true}, - // Unequal - {"ws", "http", false}, - {"http", "ws", false}, - {"http", "about", false}, - }; - - for (const auto& test : cases) { - CSPSource* returned = MakeGarbageCollected<CSPSource>( - csp.Get(), test.a_scheme, "example.com", CSPSource::kPortUnspecified, - "/", CSPSource::kNoWildcard, CSPSource::kNoWildcard); - CSPSource* required = MakeGarbageCollected<CSPSource>( - csp.Get(), test.b_scheme, "example.com", CSPSource::kPortUnspecified, - "/", CSPSource::kNoWildcard, CSPSource::kNoWildcard); - EXPECT_EQ(required->Subsumes(returned), test.expected); - } -} - -TEST_F(CSPSourceTest, IsSimilar) { - struct Source { - const char* scheme; - const char* host; - const char* path; - const int port; - }; - struct TestCase { - const Source a; - const Source b; - bool is_similar; - } cases[] = { - // Similar - {{"http", "example.com", "/", CSPSource::kPortUnspecified}, - {"http", "example.com", "/", CSPSource::kPortUnspecified}, - true}, - // Schemes - {{"https", "example.com", "/", CSPSource::kPortUnspecified}, - {"https", "example.com", "/", CSPSource::kPortUnspecified}, - true}, - {{"https", "example.com", "/", CSPSource::kPortUnspecified}, - {"http", "example.com", "/", CSPSource::kPortUnspecified}, - true}, - {{"ws", "example.com", "/", CSPSource::kPortUnspecified}, - {"wss", "example.com", "/", CSPSource::kPortUnspecified}, - true}, - // Ports - {{"http", "example.com", "/", 90}, - {"http", "example.com", "/", 90}, - true}, - {{"wss", "example.com", "/", CSPSource::kPortUnspecified}, - {"wss", "example.com", "/", CSPSource::kPortUnspecified}, - true}, // use default port - {{"http", "example.com", "/", 80}, - {"http", "example.com", "/", CSPSource::kPortUnspecified}, - true}, - {{"http", "example.com", "/", 80}, - {"https", "example.com", "/", 443}, - true}, - {{"http", "example.com", "/", 80}, - {"https", "example.com", "/", 444}, - false}, - // Paths - {{"http", "example.com", "/", CSPSource::kPortUnspecified}, - {"http", "example.com", "/1.html", CSPSource::kPortUnspecified}, - true}, - {{"http", "example.com", "/", CSPSource::kPortUnspecified}, - {"http", "example.com", "", CSPSource::kPortUnspecified}, - true}, - {{"http", "example.com", "/", CSPSource::kPortUnspecified}, - {"http", "example.com", "/a/b/", CSPSource::kPortUnspecified}, - true}, - {{"http", "example.com", "/a/", CSPSource::kPortUnspecified}, - {"http", "example.com", "/a/", CSPSource::kPortUnspecified}, - true}, - {{"http", "example.com", "/a/", CSPSource::kPortUnspecified}, - {"http", "example.com", "/a/b/", CSPSource::kPortUnspecified}, - true}, - {{"http", "example.com", "/a/", CSPSource::kPortUnspecified}, - {"http", "example.com", "/a/b/1.html", CSPSource::kPortUnspecified}, - true}, - {{"http", "example.com", "/1.html", CSPSource::kPortUnspecified}, - {"http", "example.com", "/1.html", CSPSource::kPortUnspecified}, - true}, - // Mixed - {{"http", "example.com", "/1.html", 90}, - {"http", "example.com", "/", 90}, - true}, - {{"https", "example.com", "/", CSPSource::kPortUnspecified}, - {"http", "example.com", "/", CSPSource::kPortUnspecified}, - true}, - {{"http", "example.com", "/a/", 90}, - {"https", "example.com", "", 90}, - true}, - {{"wss", "example.com", "/a/", 90}, - {"ws", "example.com", "/a/b/", 90}, - true}, - {{"https", "example.com", "/a/", 90}, - {"https", "example.com", "/a/b/", 90}, - true}, - // Not Similar - {{"http", "example.com", "/a/", CSPSource::kPortUnspecified}, - {"https", "example.com", "", 90}, - false}, - {{"https", "example.com", "/", CSPSource::kPortUnspecified}, - {"https", "example.com", "/", 90}, - false}, - {{"http", "example.com", "/", CSPSource::kPortUnspecified}, - {"http", "another.com", "/", CSPSource::kPortUnspecified}, - false}, - {{"wss", "example.com", "/", CSPSource::kPortUnspecified}, - {"http", "example.com", "/", CSPSource::kPortUnspecified}, - false}, - {{"wss", "example.com", "/", CSPSource::kPortUnspecified}, - {"about", "example.com", "/", CSPSource::kPortUnspecified}, - false}, - {{"http", "example.com", "/", CSPSource::kPortUnspecified}, - {"about", "example.com", "/", CSPSource::kPortUnspecified}, - false}, - {{"http", "example.com", "/1.html", CSPSource::kPortUnspecified}, - {"http", "example.com", "/2.html", CSPSource::kPortUnspecified}, - false}, - {{"http", "example.com", "/a/1.html", CSPSource::kPortUnspecified}, - {"http", "example.com", "/a/b/", CSPSource::kPortUnspecified}, - false}, - {{"http", "example.com", "/", 443}, - {"about", "example.com", "/", 800}, - false}, - }; - - for (const auto& test : cases) { - CSPSource* returned = MakeGarbageCollected<CSPSource>( - csp.Get(), test.a.scheme, test.a.host, test.a.port, test.a.path, - CSPSource::kNoWildcard, CSPSource::kNoWildcard); - - CSPSource* required = MakeGarbageCollected<CSPSource>( - csp.Get(), test.b.scheme, test.b.host, test.b.port, test.b.path, - CSPSource::kNoWildcard, CSPSource::kNoWildcard); - - EXPECT_EQ(returned->IsSimilar(required), test.is_similar); - // Verify the same test with a and b swapped. - EXPECT_EQ(required->IsSimilar(returned), test.is_similar); - } -} - -TEST_F(CSPSourceTest, FirstSubsumesSecond) { - struct Source { - const char* scheme; - const char* host; - const int port; - const char* path; - }; - struct TestCase { - const Source source_b; - String scheme_a; - bool expected; - } cases[] = { - // Subsumed. - {{"http", "example.com", CSPSource::kPortUnspecified, "/"}, "http", true}, - {{"http", "example.com", CSPSource::kPortUnspecified, "/page.html"}, - "http", - true}, - {{"http", "second-example.com", 80, "/"}, "http", true}, - {{"https", "second-example.com", CSPSource::kPortUnspecified, "/"}, - "http", - true}, - {{"http", "second-example.com", CSPSource::kPortUnspecified, - "/page.html"}, - "http", - true}, - {{"https", "second-example.com", 80, "/page.html"}, "http", true}, - {{"https", "second-example.com", CSPSource::kPortUnspecified, "/"}, - "https", - true}, - {{"https", "second-example.com", CSPSource::kPortUnspecified, - "/page.html"}, - "https", - true}, - {{"http", "example.com", 900, "/"}, "http", true}, - // NOT subsumed. - {{"http", "second-example.com", CSPSource::kPortUnspecified, "/"}, - "wss", - false}, - {{"http", "non-example.com", 900, "/"}, "http", false}, - {{"http", "second-example.com", CSPSource::kPortUnspecified, "/"}, - "https", - false}, - }; - - CSPSource* no_wildcards = MakeGarbageCollected<CSPSource>( - csp.Get(), "http", "example.com", CSPSource::kPortUnspecified, "/", - CSPSource::kNoWildcard, CSPSource::kNoWildcard); - CSPSource* host_wildcard = MakeGarbageCollected<CSPSource>( - csp.Get(), "http", "third-example.com", CSPSource::kPortUnspecified, "/", - CSPSource::kHasWildcard, CSPSource::kNoWildcard); - CSPSource* port_wildcard = MakeGarbageCollected<CSPSource>( - csp.Get(), "http", "third-example.com", CSPSource::kPortUnspecified, "/", - CSPSource::kNoWildcard, CSPSource::kHasWildcard); - CSPSource* both_wildcards = MakeGarbageCollected<CSPSource>( - csp.Get(), "http", "third-example.com", CSPSource::kPortUnspecified, "/", - CSPSource::kHasWildcard, CSPSource::kHasWildcard); - CSPSource* http_only = MakeGarbageCollected<CSPSource>( - csp.Get(), "http", "", CSPSource::kPortUnspecified, "", - CSPSource::kNoWildcard, CSPSource::kNoWildcard); - CSPSource* https_only = MakeGarbageCollected<CSPSource>( - csp.Get(), "https", "", CSPSource::kPortUnspecified, "", - CSPSource::kNoWildcard, CSPSource::kNoWildcard); - - for (const auto& test : cases) { - // Setup default vectors. - HeapVector<Member<CSPSource>> list_a; - HeapVector<Member<CSPSource>> list_b; - list_b.push_back(no_wildcards); - // Empty `listA` implies `none` is allowed. - EXPECT_FALSE(CSPSource::FirstSubsumesSecond(list_a, list_b)); - - list_a.push_back(no_wildcards); - // Add CSPSources based on the current test. - list_b.push_back(MakeGarbageCollected<CSPSource>( - csp.Get(), test.source_b.scheme, test.source_b.host, - CSPSource::kPortUnspecified, test.source_b.path, CSPSource::kNoWildcard, - CSPSource::kNoWildcard)); - list_a.push_back(MakeGarbageCollected<CSPSource>( - csp.Get(), test.scheme_a, "second-example.com", - CSPSource::kPortUnspecified, "/", CSPSource::kNoWildcard, - CSPSource::kNoWildcard)); - // listB contains: ["http://example.com/", test.listB] - // listA contains: ["http://example.com/", - // test.schemeA + "://second-example.com/"] - EXPECT_EQ(test.expected, CSPSource::FirstSubsumesSecond(list_a, list_b)); - - // If we add another source to `listB` with a host wildcard, - // then the result should definitely be false. - list_b.push_back(host_wildcard); - EXPECT_FALSE(CSPSource::FirstSubsumesSecond(list_a, list_b)); - - // If we add another source to `listA` with a port wildcard, - // it does not make `listB` to be subsumed under `listA`. - list_b.push_back(port_wildcard); - EXPECT_FALSE(CSPSource::FirstSubsumesSecond(list_a, list_b)); - - // If however we add another source to `listA` with both wildcards, and the - // source with the port wildcard, the answer should be as expected before. - list_a.push_back(both_wildcards); - list_a.push_back(port_wildcard); - EXPECT_EQ(test.expected, CSPSource::FirstSubsumesSecond(list_a, list_b)); - - // If we add a scheme-source expression of 'https' to `listB`, then it - // should not be subsumed. - list_b.push_back(https_only); - EXPECT_FALSE(CSPSource::FirstSubsumesSecond(list_a, list_b)); - - // If we add a scheme-source expression of 'http' to `listA`, then it should - // subsume all current epxression in `listB`. - list_a.push_back(http_only); - EXPECT_TRUE(CSPSource::FirstSubsumesSecond(list_a, list_b)); - } -} - -TEST_F(CSPSourceTest, Intersect) { - struct TestCase { - const Source a; - const Source b; - const Source normalized; - } cases[] = { - {{"http", "example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}}, - {{"ws", "example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"wss", "example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"wss", "example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}}, - // Wildcards - {{"http", "example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kHasWildcard, CSPSource::kNoWildcard}, - {"http", "sub.example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "sub.example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}}, - {{"http", "example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kHasWildcard, CSPSource::kHasWildcard}, - {"http", "sub.example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "sub.example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}}, - {{"http", "example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kHasWildcard, CSPSource::kNoWildcard}, - {"http", "sub.example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kHasWildcard}, - {"http", "sub.example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}}, - // Ports - {{"http", "example.com", "/", 80, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"http", "example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "example.com", "/", 80, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}}, - {{"http", "example.com", "/", 80, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"https", "example.com", "/", 443, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"https", "example.com", "/", 443, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}}, - {{"https", "example.com", "/", 443, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"http", "example.com", "/", 80, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"https", "example.com", "/", 443, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}}, - // Paths - {{"http", "example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "example.com", "/1.html", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "example.com", "/1.html", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}}, - {{"http", "example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "example.com", "", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}}, - {{"http", "example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "example.com", "/a/b/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "example.com", "/a/b/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}}, - {{"http", "example.com", "/a/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "example.com", "/a/b/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "example.com", "/a/b/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}}, - {{"http", "example.com", "/a/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "example.com", "/a/b/1.html", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "example.com", "/a/b/1.html", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}}, - // Mixed - {{"http", "example.com", "/1.html", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "example.com", "/", 80, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"http", "example.com", "/1.html", 80, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}}, - }; - - for (const auto& test : cases) { - CSPSource* a = MakeGarbageCollected<CSPSource>( - csp.Get(), test.a.scheme, test.a.host, test.a.port, test.a.path, - test.a.host_wildcard, test.a.port_wildcard); - CSPSource* b = MakeGarbageCollected<CSPSource>( - csp.Get(), test.b.scheme, test.b.host, test.b.port, test.b.path, - test.b.host_wildcard, test.b.port_wildcard); - - CSPSource* normalized = a->Intersect(b); - Source intersect_ab = { - normalized->scheme_, normalized->host_, - normalized->path_, normalized->port_, - normalized->host_wildcard_, normalized->port_wildcard_}; - EXPECT_TRUE(EqualSources(intersect_ab, test.normalized)) - << - - "intersect_ab=" << normalized->scheme_ << normalized->host_ - << normalized->path_ << normalized->port_ << normalized->host_wildcard_ - << normalized->port_wildcard_ - << ", test.normalized=" << test.normalized.scheme - << test.normalized.host << test.normalized.path << test.normalized.port - << test.normalized.host_wildcard << test.normalized.port_wildcard; - - // Verify the same test with A and B swapped. The result should be - // identical. - normalized = b->Intersect(a); - Source intersect_ba = { - normalized->scheme_, normalized->host_, - normalized->path_, normalized->port_, - normalized->host_wildcard_, normalized->port_wildcard_}; - EXPECT_TRUE(EqualSources(intersect_ba, test.normalized)) - << - - "intersect_ba=" << normalized->scheme_ << normalized->host_ - << normalized->path_ << normalized->port_ << normalized->host_wildcard_ - << normalized->port_wildcard_ - << ", test.normalized=" << test.normalized.scheme - << test.normalized.host << test.normalized.path << test.normalized.port - << test.normalized.host_wildcard << test.normalized.port_wildcard; - } -} - -TEST_F(CSPSourceTest, IntersectSchemesOnly) { - struct TestCase { - const Source a; - const Source b; - const Source normalized; - } cases[] = { - // Both sources are schemes only. - {{"http", "", "", CSPSource::kPortUnspecified, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"http", "", "", CSPSource::kPortUnspecified, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"http", "", "", CSPSource::kPortUnspecified, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}}, - {{"http", "", "", CSPSource::kPortUnspecified, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"https", "", "", CSPSource::kPortUnspecified, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"https", "", "", CSPSource::kPortUnspecified, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}}, - {{"ws", "", "", CSPSource::kPortUnspecified, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"wss", "", "", CSPSource::kPortUnspecified, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"wss", "", "", CSPSource::kPortUnspecified, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}}, - // One source is a scheme only and the other one has no wildcards. - {{"http", "", "", CSPSource::kPortUnspecified, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"http", "example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}, - {"http", "example.com", "/", CSPSource::kPortUnspecified, - CSPSource::kNoWildcard, CSPSource::kNoWildcard}}, - {{"http", "", "", CSPSource::kPortUnspecified, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"https", "example.com", "/", 80, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"https", "example.com", "/", 80, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}}, - {{"https", "", "", CSPSource::kPortUnspecified, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"http", "example.com", "/page.html", 80, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"https", "example.com", "/page.html", 80, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}}, - // One source is a scheme only and the other has one or two wildcards. - {{"https", "", "", CSPSource::kPortUnspecified, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"http", "example.com", "/page.html", 80, CSPSource::kHasWildcard, - CSPSource::kNoWildcard}, - {"https", "example.com", "/page.html", 80, CSPSource::kHasWildcard, - CSPSource::kNoWildcard}}, - {{"https", "", "", CSPSource::kPortUnspecified, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"http", "example.com", "/page.html", 80, CSPSource::kNoWildcard, - CSPSource::kHasWildcard}, - {"https", "example.com", "/page.html", 80, CSPSource::kNoWildcard, - CSPSource::kHasWildcard}}, - {{"https", "", "", CSPSource::kPortUnspecified, CSPSource::kNoWildcard, - CSPSource::kNoWildcard}, - {"http", "example.com", "/page.html", 80, CSPSource::kHasWildcard, - CSPSource::kHasWildcard}, - {"https", "example.com", "/page.html", 80, CSPSource::kHasWildcard, - CSPSource::kHasWildcard}}, - }; - - for (const auto& test : cases) { - CSPSource* a = MakeGarbageCollected<CSPSource>( - csp.Get(), test.a.scheme, test.a.host, test.a.port, test.a.path, - test.a.host_wildcard, test.a.port_wildcard); - - CSPSource* b = MakeGarbageCollected<CSPSource>( - csp.Get(), test.b.scheme, test.b.host, test.b.port, test.b.path, - test.b.host_wildcard, test.b.port_wildcard); - - CSPSource* normalized = a->Intersect(b); - Source intersect_ab = { - normalized->scheme_, normalized->host_, - normalized->path_, normalized->port_, - normalized->host_wildcard_, normalized->port_wildcard_}; - EXPECT_TRUE(EqualSources(intersect_ab, test.normalized)); - - // Verify the same test with A and B swapped. The result should be - // identical. - normalized = b->Intersect(a); - Source intersect_ba = { - normalized->scheme_, normalized->host_, - normalized->path_, normalized->port_, - normalized->host_wildcard_, normalized->port_wildcard_}; - EXPECT_TRUE(EqualSources(intersect_ba, test.normalized)); - } -} - TEST_F(CSPSourceTest, MatchingAsSelf) { // Testing Step 4 of // https://w3c.github.io/webappsec-csp/#match-url-to-source-expression
diff --git a/third_party/blink/renderer/core/frame/csp/media_list_directive.cc b/third_party/blink/renderer/core/frame/csp/media_list_directive.cc index 9b79187..1322793 100644 --- a/third_party/blink/renderer/core/frame/csp/media_list_directive.cc +++ b/third_party/blink/renderer/core/frame/csp/media_list_directive.cc
@@ -88,38 +88,4 @@ } } -bool MediaListDirective::Subsumes( - const HeapVector<Member<MediaListDirective>>& other) const { - if (!other.size()) - return false; - - // Find the effective set of plugins allowed by `other`. - HashSet<String> normalized_b = other[0]->plugin_types_; - for (wtf_size_t i = 1; i < other.size(); i++) - normalized_b = other[i]->GetIntersect(normalized_b); - - // Empty list of plugins is equivalent to no plugins being allowed. - if (!plugin_types_.size()) - return !normalized_b.size(); - - // Check that each element of `normalizedB` is allowed by `m_pluginTypes`. - for (auto it = normalized_b.begin(); it != normalized_b.end(); ++it) { - if (!Allows(*it)) - return false; - } - - return true; -} - -HashSet<String> MediaListDirective::GetIntersect( - const HashSet<String>& other) const { - HashSet<String> normalized; - for (const auto& type : plugin_types_) { - if (other.Contains(type)) - normalized.insert(type); - } - - return normalized; -} - } // namespace blink
diff --git a/third_party/blink/renderer/core/frame/csp/media_list_directive.h b/third_party/blink/renderer/core/frame/csp/media_list_directive.h index df84c3e1..e722ece8 100644 --- a/third_party/blink/renderer/core/frame/csp/media_list_directive.h +++ b/third_party/blink/renderer/core/frame/csp/media_list_directive.h
@@ -22,20 +22,12 @@ ContentSecurityPolicy*); bool Allows(const String& type) const; - // The algorothm is described more extensively here: - // https://w3c.github.io/webappsec-csp/embedded/#subsume-policy. - bool Subsumes(const HeapVector<Member<MediaListDirective>>& other) const; - private: FRIEND_TEST_ALL_PREFIXES(MediaListDirectiveTest, GetIntersect); FRIEND_TEST_ALL_PREFIXES(MediaListDirectiveTest, Subsumes); void Parse(const UChar* begin, const UChar* end); - // The algorothm is described more extensively here: - // https://w3c.github.io/webappsec-csp/embedded/#subsume-policy. - HashSet<String> GetIntersect(const HashSet<String>& other) const; - HashSet<String> plugin_types_; DISALLOW_COPY_AND_ASSIGN(MediaListDirective);
diff --git a/third_party/blink/renderer/core/frame/csp/media_list_directive_test.cc b/third_party/blink/renderer/core/frame/csp/media_list_directive_test.cc deleted file mode 100644 index 3436ce31..0000000 --- a/third_party/blink/renderer/core/frame/csp/media_list_directive_test.cc +++ /dev/null
@@ -1,153 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "third_party/blink/renderer/core/frame/csp/media_list_directive.h" - -#include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" -#include "third_party/blink/renderer/platform/wtf/vector.h" - -namespace blink { - -class MediaListDirectiveTest : public testing::Test { - public: - MediaListDirectiveTest() - : csp(MakeGarbageCollected<ContentSecurityPolicy>()) {} - - protected: - Persistent<ContentSecurityPolicy> csp; -}; - -TEST_F(MediaListDirectiveTest, GetIntersect) { - MediaListDirective a( - "plugin-types", - "application/x-shockwave-flash application/pdf text/plain", csp.Get()); - MediaListDirective empty_a("plugin-types", "", csp.Get()); - - struct TestCase { - const char* policy_b; - const Vector<const char*> expected; - } cases[] = { - {"", Vector<const char*>()}, - {"text/", Vector<const char*>()}, - {"text/*", Vector<const char*>()}, - {"*/plain", Vector<const char*>()}, - {"text/plain */plain", {"text/plain"}}, - {"text/plain application/*", {"text/plain"}}, - {"text/plain", {"text/plain"}}, - {"application/pdf", {"application/pdf"}}, - {"application/x-shockwave-flash", {"application/x-shockwave-flash"}}, - {"application/x-shockwave-flash text/plain", - {"application/x-shockwave-flash", "text/plain"}}, - {"application/pdf text/plain", {"text/plain", "application/pdf"}}, - {"application/x-shockwave-flash application/pdf text/plain", - {"application/x-shockwave-flash", "application/pdf", "text/plain"}}, - }; - - for (const auto& test : cases) { - MediaListDirective b("plugin-types", test.policy_b, csp.Get()); - - HashSet<String> result = a.GetIntersect(b.plugin_types_); - EXPECT_EQ(result.size(), test.expected.size()); - - for (auto* const type : test.expected) - EXPECT_TRUE(result.Contains(type)); - - // If we change the order of `A` and `B`, intersection should not change. - result = b.GetIntersect(a.plugin_types_); - EXPECT_EQ(result.size(), test.expected.size()); - - for (auto* const type : test.expected) - EXPECT_TRUE(result.Contains(type)); - - // When `A` is empty, there should not be any intersection. - result = empty_a.GetIntersect(b.plugin_types_); - EXPECT_FALSE(result.size()); - } -} - -TEST_F(MediaListDirectiveTest, Subsumes) { - MediaListDirective a( - "plugin-types", - "application/x-shockwave-flash application/pdf text/plain text/*", - csp.Get()); - - struct TestCase { - const Vector<const char*> policies_b; - bool subsumed; - bool subsumed_by_empty_a; - } cases[] = { - // `A` subsumes `policiesB`. - {{""}, true, true}, - {{"text/"}, true, true}, - {{"text/*"}, true, false}, - {{"application/*"}, false, false}, - {{"application/"}, true, true}, - {{"*/plain"}, false, false}, - {{"application"}, true, true}, - {{"text/plain"}, true, false}, - {{"application/pdf"}, true, false}, - {{"application/x-shockwave-flash"}, true, false}, - {{"application/x-shockwave-flash text/plain"}, true, false}, - {{"application/pdf text/plain"}, true, false}, - {{"application/x-shockwave-flash text/plain application/pdf"}, - true, - false}, - {{"application/x-shockwave-flash text "}, true, false}, - {{"text/* application/x-shockwave-flash"}, true, false}, - {{"application/ application/x-shockwave-flash"}, true, false}, - {{"*/plain application/x-shockwave-flash"}, false, false}, - {{"text/ application/x-shockwave-flash"}, true, false}, - {{"application application/x-shockwave-flash"}, true, false}, - {{"application/x-shockwave-flash text/plain " - "application/x-blink-test-plugin", - "application/x-shockwave-flash text/plain"}, - true, - false}, - {{"application/x-shockwave-flash text/plain " - "application/x-blink-test-plugin", - "text/plain"}, - true, - false}, - {{"application/x-blink-test-plugin", "text/plain"}, true, true}, - {{"application/x-shockwave-flash", - "text/plain application/x-shockwave-flash"}, - true, - false}, - {{"application/x-shockwave-flash text/plain", - "application/x-blink-test-plugin", "text/plain"}, - true, - true}, - // `A` does not subsumes `policiesB`. - {Vector<const char*>(), false, false}, - {{"application/x-blink-test-plugin"}, false, false}, - {{"application/x-shockwave-flash text/plain " - "application/x-blink-test-plugin"}, - false, - false}, - {{"application/x-shockwave-flash text application/x-blink-test-plugin"}, - false, - false}, - {{"application/x-invalid-type text application/"}, false, false}, - {{"application/x-blink-test-plugin text application/", - "application/x-blink-test-plugin"}, - false, - false}, - }; - - MediaListDirective empty_a("plugin-types", "", csp.Get()); - - for (const auto& test : cases) { - HeapVector<Member<MediaListDirective>> policies_b; - for (auto* const policy : test.policies_b) { - policies_b.push_back(MakeGarbageCollected<MediaListDirective>( - "plugin-types", policy, csp.Get())); - } - - EXPECT_EQ(a.Subsumes(policies_b), test.subsumed); - EXPECT_EQ(empty_a.Subsumes(policies_b), test.subsumed_by_empty_a); - } -} - -} // namespace blink
diff --git a/third_party/blink/renderer/core/frame/csp/source_list_directive.cc b/third_party/blink/renderer/core/frame/csp/source_list_directive.cc index 2ae6af8..4d5a2671 100644 --- a/third_party/blink/renderer/core/frame/csp/source_list_directive.cc +++ b/third_party/blink/renderer/core/frame/csp/source_list_directive.cc
@@ -633,16 +633,6 @@ hash_algorithms_used_ |= algorithm; } -void SourceListDirective::AddSourceToMap( - HeapHashMap<String, Member<CSPSource>>& hash_map, - CSPSource* source) { - hash_map.insert(source->GetScheme(), source); - if (source->GetScheme() == "http") - hash_map.insert("https", source); - else if (source->GetScheme() == "ws") - hash_map.insert("wss", source); -} - bool SourceListDirective::HasSourceMatchInList( const KURL& url, ResourceRequest::RedirectStatus redirect_status) const { @@ -667,100 +657,6 @@ (!ContentSecurityPolicy::IsScriptDirective(type) || !allow_dynamic_); } -HeapVector<Member<CSPSource>> SourceListDirective::GetSources( - Member<CSPSource> self) const { - HeapVector<Member<CSPSource>> sources = list_; - if (allow_star_) { - sources.push_back(MakeGarbageCollected<CSPSource>( - policy_, "ftp", String(), CSPSource::kPortUnspecified, String(), - CSPSource::kNoWildcard, CSPSource::kNoWildcard)); - sources.push_back(MakeGarbageCollected<CSPSource>( - policy_, "ws", String(), CSPSource::kPortUnspecified, String(), - CSPSource::kNoWildcard, CSPSource::kNoWildcard)); - sources.push_back(MakeGarbageCollected<CSPSource>( - policy_, "http", String(), CSPSource::kPortUnspecified, String(), - CSPSource::kNoWildcard, CSPSource::kNoWildcard)); - if (self) { - sources.push_back(MakeGarbageCollected<CSPSource>( - policy_, self->GetScheme(), String(), CSPSource::kPortUnspecified, - String(), CSPSource::kNoWildcard, CSPSource::kNoWildcard)); - } - } else if (allow_self_ && self) { - sources.push_back(self); - } - - return sources; -} - -bool SourceListDirective::Subsumes( - const HeapVector<Member<SourceListDirective>>& other) const { - if (!other.size() || other[0]->IsNone()) - return other.size(); - - bool allow_inline_other = other[0]->allow_inline_; - bool allow_eval_other = other[0]->allow_eval_; - bool allow_wasm_eval_other = other[0]->allow_wasm_eval_; - bool allow_dynamic_other = other[0]->allow_dynamic_; - bool allow_unsafe_hashes = other[0]->allow_unsafe_hashes_; - bool is_hash_or_nonce_present_other = other[0]->IsHashOrNoncePresent(); - HashSet<String> nonces_b = other[0]->nonces_; - HashSet<CSPHashValue> hashes_b = other[0]->hashes_; - - HeapVector<Member<CSPSource>> normalized_b = - other[0]->GetSources(other[0]->policy_->GetSelfSource()); - for (wtf_size_t i = 1; i < other.size(); i++) { - allow_inline_other = allow_inline_other && other[i]->allow_inline_; - allow_eval_other = allow_eval_other && other[i]->allow_eval_; - allow_wasm_eval_other = allow_wasm_eval_other && other[i]->allow_wasm_eval_; - allow_dynamic_other = allow_dynamic_other && other[i]->allow_dynamic_; - allow_unsafe_hashes = allow_unsafe_hashes && other[i]->allow_unsafe_hashes_; - is_hash_or_nonce_present_other = - is_hash_or_nonce_present_other && other[i]->IsHashOrNoncePresent(); - nonces_b = other[i]->GetIntersectNonces(nonces_b); - hashes_b = other[i]->GetIntersectHashes(hashes_b); - normalized_b = other[i]->GetIntersectCSPSources(normalized_b); - } - - if (!SubsumesNoncesAndHashes(nonces_b, hashes_b)) - return false; - - const ContentSecurityPolicy::DirectiveType type = - ContentSecurityPolicy::GetDirectiveType(directive_name_); - if (ContentSecurityPolicy::IsScriptDirective(type) || - ContentSecurityPolicy::IsStyleDirective(type)) { - if (!allow_eval_ && allow_eval_other) - return false; - if (!allow_wasm_eval_ && allow_wasm_eval_other) - return false; - if (!allow_unsafe_hashes_ && allow_unsafe_hashes) - return false; - bool allow_all_inline_other = - allow_inline_other && !is_hash_or_nonce_present_other && - (!ContentSecurityPolicy::IsScriptDirective(type) || - !allow_dynamic_other); - if (!AllowAllInline() && allow_all_inline_other) - return false; - } - - if (ContentSecurityPolicy::IsScriptDirective(type) && - (allow_dynamic_ || allow_dynamic_other)) { - // If `this` does not allow `strict-dynamic`, then it must be that `other` - // does allow, so the result is `false`. - if (!allow_dynamic_) - return false; - // All keyword source expressions have been considered so only CSPSource - // subsumption is left. However, `strict-dynamic` ignores all CSPSources so - // for subsumption to be true either `other` must allow `strict-dynamic` or - // have no allowed CSPSources. - return allow_dynamic_other || !normalized_b.size(); - } - - // If embedding CSP specifies `self`, `self` refers to the embedee's origin. - HeapVector<Member<CSPSource>> normalized_a = - GetSources(other[0]->policy_->GetSelfSource()); - return CSPSource::FirstSubsumesSecond(normalized_a, normalized_b); -} - network::mojom::blink::CSPSourceListPtr SourceListDirective::ExposeForNavigationalChecks() const { WTF::Vector<network::mojom::blink::CSPSourcePtr> sources; @@ -777,104 +673,6 @@ allow_wasm_eval_, allow_dynamic_, allow_unsafe_hashes_, report_sample_); } -bool SourceListDirective::SubsumesNoncesAndHashes( - const HashSet<String>& nonces, - const HashSet<CSPHashValue> hashes) const { - if (!nonces.IsEmpty() && nonces_.IsEmpty()) - return false; - - for (const auto& hash : hashes) { - if (!hashes_.Contains(hash)) - return false; - } - - return true; -} - -HashSet<String> SourceListDirective::GetIntersectNonces( - const HashSet<String>& other) const { - if (!nonces_.size() || !other.size()) - return !nonces_.size() ? nonces_ : other; - - HashSet<String> normalized; - for (const auto& nonce : nonces_) { - if (other.Contains(nonce)) - normalized.insert(nonce); - } - - return normalized; -} - -HashSet<CSPHashValue> SourceListDirective::GetIntersectHashes( - const HashSet<CSPHashValue>& other) const { - if (!hashes_.size() || !other.size()) - return !hashes_.size() ? hashes_ : other; - - HashSet<CSPHashValue> normalized; - for (const auto& hash : hashes_) { - if (other.Contains(hash)) - normalized.insert(hash); - } - - return normalized; -} - -HeapHashMap<String, Member<CSPSource>> -SourceListDirective::GetIntersectSchemesOnly( - const HeapVector<Member<CSPSource>>& other) const { - HeapHashMap<String, Member<CSPSource>> schemes_a; - for (const auto& source_a : list_) { - if (source_a->IsSchemeOnly()) - AddSourceToMap(schemes_a, source_a); - } - // Add schemes only sources if they are present in both `this` and `other`, - // allowing upgrading `http` to `https` and `ws` to `wss`. - HeapHashMap<String, Member<CSPSource>> intersect; - for (const auto& source_b : other) { - if (source_b->IsSchemeOnly()) { - if (schemes_a.Contains(source_b->GetScheme())) - AddSourceToMap(intersect, source_b); - else if (source_b->GetScheme() == "http" && schemes_a.Contains("https")) - intersect.insert("https", schemes_a.at("https")); - else if (source_b->GetScheme() == "ws" && schemes_a.Contains("wss")) - intersect.insert("wss", schemes_a.at("wss")); - } - } - - return intersect; -} - -HeapVector<Member<CSPSource>> SourceListDirective::GetIntersectCSPSources( - const HeapVector<Member<CSPSource>>& other) const { - auto schemes_map = GetIntersectSchemesOnly(other); - HeapVector<Member<CSPSource>> normalized; - // Add all normalized scheme source expressions. - for (const auto& it : schemes_map) { - // We do not add secure versions if insecure schemes are present. - if ((it.key != "https" || !schemes_map.Contains("http")) && - (it.key != "wss" || !schemes_map.Contains("ws"))) { - normalized.push_back(it.value); - } - } - - HeapVector<Member<CSPSource>> this_vector = - GetSources(policy_->GetSelfSource()); - for (const auto& source_a : this_vector) { - if (schemes_map.Contains(source_a->GetScheme())) - continue; - - for (const auto& source_b : other) { - // No need to add a host source expression if it is subsumed by the - // matching scheme source expression. - if (schemes_map.Contains(source_b->GetScheme())) - continue; - if (CSPSource* match = source_b->Intersect(source_a)) - normalized.push_back(match); - } - } - return normalized; -} - void SourceListDirective::Trace(Visitor* visitor) const { visitor->Trace(policy_); visitor->Trace(list_);
diff --git a/third_party/blink/renderer/core/frame/csp/source_list_directive.h b/third_party/blink/renderer/core/frame/csp/source_list_directive.h index 4472f7b..37f0dec 100644 --- a/third_party/blink/renderer/core/frame/csp/source_list_directive.h +++ b/third_party/blink/renderer/core/frame/csp/source_list_directive.h
@@ -62,14 +62,7 @@ String DirectiveName() const { return directive_name_; } private: - FRIEND_TEST_ALL_PREFIXES(SourceListDirectiveTest, GetIntersectCSPSources); - FRIEND_TEST_ALL_PREFIXES(SourceListDirectiveTest, - GetIntersectCSPSourcesSchemes); - FRIEND_TEST_ALL_PREFIXES(SourceListDirectiveTest, GetIntersectNonces); - FRIEND_TEST_ALL_PREFIXES(SourceListDirectiveTest, GetIntersectHashes); - FRIEND_TEST_ALL_PREFIXES(SourceListDirectiveTest, GetSources); FRIEND_TEST_ALL_PREFIXES(SourceListDirectiveTest, ParseHost); - FRIEND_TEST_ALL_PREFIXES(CSPDirectiveListTest, GetSourceVector); FRIEND_TEST_ALL_PREFIXES(CSPDirectiveListTest, OperativeDirectiveGivenType); bool ParseSource(const UChar* begin, @@ -109,20 +102,7 @@ void AddSourceHash(const ContentSecurityPolicyHashAlgorithm&, const DigestValue& hash); - static void AddSourceToMap(HeapHashMap<String, Member<CSPSource>>&, - CSPSource*); - bool HasSourceMatchInList(const KURL&, ResourceRequest::RedirectStatus) const; - HashSet<String> GetIntersectNonces(const HashSet<String>& other) const; - HashSet<CSPHashValue> GetIntersectHashes( - const HashSet<CSPHashValue>& other) const; - HeapVector<Member<CSPSource>> GetIntersectCSPSources( - const HeapVector<Member<CSPSource>>& other) const; - HeapHashMap<String, Member<CSPSource>> GetIntersectSchemesOnly( - const HeapVector<Member<CSPSource>>& other) const; - bool SubsumesNoncesAndHashes(const HashSet<String>& nonces, - const HashSet<CSPHashValue> hashes) const; - HeapVector<Member<CSPSource>> GetSources(Member<CSPSource>) const; Member<ContentSecurityPolicy> policy_; HeapVector<Member<CSPSource>> list_;
diff --git a/third_party/blink/renderer/core/frame/csp/source_list_directive_test.cc b/third_party/blink/renderer/core/frame/csp/source_list_directive_test.cc index bf0e951..b3d195b 100644 --- a/third_party/blink/renderer/core/frame/csp/source_list_directive_test.cc +++ b/third_party/blink/renderer/core/frame/csp/source_list_directive_test.cc
@@ -220,328 +220,6 @@ ResourceRequest::RedirectStatus::kFollowedRedirect)); } -TEST_F(SourceListDirectiveTest, GetIntersectCSPSources) { - String sources = - "http://example1.com/foo/ http://*.example2.com/bar/ " - "http://*.example3.com:*/bar/"; - SourceListDirective source_list("script-src", sources, csp.Get()); - struct TestCase { - String sources; - String expected; - } cases[] = { - {"http://example1.com/foo/ http://sub.example2.com/bar/", - "http://example1.com/foo/ http://sub.example2.com/bar/"}, - // Normalizing schemes. - {"https://example1.com/foo/ http://sub.example2.com/bar/", - "https://example1.com/foo/ http://sub.example2.com/bar/"}, - {"https://example1.com/foo/ https://sub.example2.com/bar/", - "https://example1.com/foo/ https://sub.example2.com/bar/"}, - {"https://example1.com/foo/ wss://sub.example2.com/bar/", - "https://example1.com/foo/"}, - // Normalizing hosts. - {"http://*.com/foo/ http://*.example2.com/bar/", - "http://example1.com/foo/ http://*.example2.com/bar/"}, - {"http://*.com/foo/ http://foo.example2.com/bar/", - "http://example1.com/foo/ http://foo.example2.com/bar/"}, - // Normalizing ports. - {"http://example1.com/foo/ http://sub.example2.com/bar/", - "http://example1.com/foo/ http://sub.example2.com/bar/"}, - {"http://example1.com/foo/ http://sub.example2.com:90/bar/", - "http://example1.com/foo/"}, - {"http://example1.com:*/foo/ http://sub.example2.com/bar/", - "http://example1.com/foo/ http://sub.example2.com/bar/"}, - {"http://*.example3.com:100/bar/ http://example1.com/foo/", - "http://example1.com/foo/ http://*.example3.com:100/bar/"}, - // Normalizing paths. - {"http://example1.com/ http://sub.example2.com/", - "http://example1.com/foo/ http://sub.example2.com/bar/"}, - {"http://example1.com/foo/index.html http://sub.example2.com/bar/", - "http://example1.com/foo/index.html http://sub.example2.com/bar/"}, - {"http://example1.com/bar http://sub.example2.com/bar/", - "http://sub.example2.com/bar/"}, - // Not similar to be normalized - {"http://non-example1.com/foo/ http://non-example2.com/bar/", ""}, - {"https://non-example1.com/foo/ wss://non-example2.com/bar/", ""}, - }; - - for (const auto& test : cases) { - SourceListDirective second_list("script-src", test.sources, csp.Get()); - HeapVector<Member<CSPSource>> normalized = - source_list.GetIntersectCSPSources(second_list.list_); - SourceListDirective helper_source_list("script-src", test.expected, - csp.Get()); - HeapVector<Member<CSPSource>> expected = helper_source_list.list_; - EXPECT_EQ(normalized.size(), expected.size()); - for (wtf_size_t i = 0; i < normalized.size(); i++) { - Source a = {normalized[i]->scheme_, normalized[i]->host_, - normalized[i]->port_, normalized[i]->path_, - normalized[i]->host_wildcard_, normalized[i]->port_wildcard_}; - Source b = {expected[i]->scheme_, expected[i]->host_, - expected[i]->port_, expected[i]->path_, - expected[i]->host_wildcard_, expected[i]->port_wildcard_}; - EXPECT_TRUE(EqualSources(a, b)); - } - } -} - -TEST_F(SourceListDirectiveTest, GetIntersectCSPSourcesSchemes) { - SourceListDirective list_a("script-src", - "http: http://example1.com/foo/ " - "https://example1.com/foo/ " - "http://example1.com/bar/page.html " - "wss: ws://another.test/bar/", - csp.Get()); - struct TestCase { - String sources; - String expected; - } cases[] = {{"http:", "http:"}, - {"https:", "https:"}, - {"ws:", "wss: ws://another.test/bar/"}, - {"wss:", "wss:"}, - {"https: ws:", "wss: https: ws://another.test/bar/"}, - {"https: http: wss:", "http: wss:"}, - {"https: http: wss:", "http: wss:"}, - {"https: http://another-example1.com/bar/", - "https: http://another-example1.com/bar/"}, - {"http://*.com/", - "http://*.com/ http://example1.com/foo/ " - "https://example1.com/foo/ http://example1.com/bar/page.html"}, - {"http://example1.com/foo/ https://example1.com/foo/", - "http://example1.com/foo/ https://example1.com/foo/ " - "http://example1.com/foo/ https://example1.com/foo/ " - "https://example1.com/foo/ https://example1.com/foo/"}, - {"https://example1.com/foo/ http://example1.com/foo/", - "https://example1.com/foo/ http://example1.com/foo/ " - "https://example1.com/foo/ http://example1.com/foo/ " - "https://example1.com/foo/ https://example1.com/foo/"}, - // If exactly the same policy is specified, it is optimized. - {"http: http://example1.com/foo/ https://example1.com/foo/ " - "http://example1.com/bar/page.html wss: ws://another.test/bar/", - "http: wss: ws://another.test/bar/"}}; - - for (const auto& test : cases) { - SourceListDirective list_b("script-src", test.sources, csp.Get()); - HeapVector<Member<CSPSource>> normalized = - list_a.GetIntersectCSPSources(list_b.list_); - - SourceListDirective helper_source_list("script-src", test.expected, - csp.Get()); - HeapVector<Member<CSPSource>> expected = helper_source_list.list_; - EXPECT_EQ(normalized.size(), expected.size()); - for (wtf_size_t i = 0; i < expected.size(); i++) { - Source a = {expected[i]->scheme_, expected[i]->host_, - expected[i]->port_, expected[i]->path_, - expected[i]->host_wildcard_, expected[i]->port_wildcard_}; - Source b = {normalized[i]->scheme_, normalized[i]->host_, - normalized[i]->port_, normalized[i]->path_, - normalized[i]->host_wildcard_, normalized[i]->port_wildcard_}; - EXPECT_TRUE(EqualSources(a, b)); - } - } -} - -TEST_F(SourceListDirectiveTest, Subsumes) { - KURL base; - String required_sources = - "http://example1.com/foo/ http://*.example2.com/bar/ " - "http://*.example3.com:*/bar/"; - SourceListDirective required("script-src", required_sources, csp.Get()); - - struct TestCase { - Vector<String> sources_vector; - bool expected; - } cases[] = { - // Non-intersecting source lists give an effective policy of 'none', which - // is always subsumed. - {{"http://example1.com/bar/", "http://*.example3.com:*/bar/"}, true}, - {{"http://example1.com/bar/", - "http://*.example3.com:*/bar/ http://*.example2.com/bar/"}, - true}, - // Lists that intersect into one of the required sources are subsumed. - {{"http://example1.com/foo/"}, true}, - {{"http://*.example2.com/bar/"}, true}, - {{"http://*.example3.com:*/bar/"}, true}, - {{"https://example1.com/foo/", - "http://*.example1.com/foo/ http://*.example2.com/bar/"}, - true}, - {{"http://sub.example2.com/bar/", - "http://*.example3.com:*/bar/ http://*.example2.com/bar/"}, - true}, - {{"http://example3.com:100/bar/", - "http://*.example3.com:*/bar/ http://*.example2.com/bar/"}, - true}, - // Lists that intersect into two of the required sources are subsumed. - {{"http://example1.com/foo/ http://*.example2.com/bar/"}, true}, - {{"http://example1.com/foo/ http://sub.example2.com/bar/", - "http://sub.example2.com/bar/ http://example1.com/foo/"}, - true}, - // Ordering should not matter. - {{"https://example1.com/foo/ https://sub.example2.com/bar/", - "http://sub.example2.com/bar/ http://example1.com/foo/"}, - true}, - // Lists that intersect into a policy identical to the required list are - // subsumed. - {{"http://example1.com/foo/ http://*.example2.com/bar/ " - "http://*.example3.com:*/bar/ http://example1.com/foo/"}, - true}, - {{"http://example1.com/foo/ http://*.example2.com/bar/ " - "http://*.example3.com:*/bar/"}, - true}, - {{"http://example1.com/foo/ http://*.example2.com/bar/ " - "http://*.example3.com:*/bar/", - "http://example1.com/foo/ http://*.example2.com/bar/ " - "http://*.example3.com:*/bar/ http://example4.com/foo/"}, - true}, - {{"http://example1.com/foo/ http://*.example2.com/bar/ " - "http://*.example3.com:*/bar/", - "http://example1.com/foo/ http://*.example2.com/bar/ " - "http://*.example3.com:*/bar/ http://example1.com/foo/"}, - true}, - // Lists that include sources that aren't subsumed by the required list - // are not subsumed. - {{"http://example1.com/foo/ http://*.example2.com/bar/ " - "http://*.example3.com:*/bar/ http://*.example4.com:*/bar/"}, - false}, - {{"http://example1.com/foo/ http://sub.example2.com/foo/"}, false}, - {{"http://*.com/bar/", "http://example1.com/bar/"}, false}, - {{"http://*.example1.com/foo/"}, false}, - {{"wss://sub.example2.com/bar/"}, false}, - {{"http://*.non-example3.com:*/bar/"}, false}, - {{"http://sub.example3.com/foo/"}, false}, - {{"http://not-example1.com", "http://not-example1.com"}, false}, - {{"http://*", "http://*.com http://*.example3.com:*/bar/"}, false}, - }; - - for (const auto& test : cases) { - HeapVector<Member<SourceListDirective>> returned; - - for (const auto& sources : test.sources_vector) { - SourceListDirective* member = MakeGarbageCollected<SourceListDirective>( - "script-src", sources, csp.Get()); - returned.push_back(member); - } - - EXPECT_EQ(required.Subsumes(returned), test.expected); - } -} - -TEST_F(SourceListDirectiveTest, SubsumesWithSelf) { - SourceListDirective a("script-src", - "http://example1.com/foo/ http://*.example2.com/bar/ " - "http://*.example3.com:*/bar/ 'self'", - csp.Get()); - - struct TestCase { - Vector<const char*> sources_b; - const char* origin_b; - bool expected; - } cases[] = { - // "https://example.test/" is a secure origin for both A and B. - {{"'self'"}, "https://example.test/", true}, - {{"'self' 'self' 'self'"}, "https://example.test/", true}, - {{"'self'", "'self'", "'self'"}, "https://example.test/", true}, - {{"'self'", "'self'", "https://*.example.test/"}, - "https://example.test/", - true}, - {{"'self'", "'self'", "https://*.example.test/bar/"}, - "https://example.test/", - true}, - {{"'self' https://another.test/bar", "'self' http://*.example.test/bar", - "https://*.example.test/bar/"}, - "https://example.test/", - true}, - {{"http://example1.com/foo/ 'self'"}, "https://example.test/", true}, - {{"http://example1.com/foo/ https://example.test/"}, - "https://example.test/", - true}, - {{"http://example1.com/foo/ http://*.example2.com/bar/"}, - "https://example.test/", - true}, - {{"http://example1.com/foo/ http://*.example2.com/bar/ " - "http://*.example3.com:*/bar/ https://example.test/"}, - "https://example.test/", - true}, - {{"http://example1.com/foo/ http://*.example2.com/bar/ " - "http://*.example3.com:*/bar/ 'self'"}, - "https://example.test/", - true}, - {{"'self'", "'self'", "https://example.test/"}, - "https://example.test/", - true}, - {{"'self'", "https://example.test/folder/"}, - "https://example.test/", - true}, - {{"'self'", "http://example.test/folder/"}, - "https://example.test/", - true}, - {{"'self' https://example.com/", "https://example.com/"}, - "https://example.test/", - false}, - {{"http://example1.com/foo/ http://*.example2.com/bar/", - "http://example1.com/foo/ http://*.example2.com/bar/ 'self'"}, - "https://example.test/", - true}, - {{"http://*.example1.com/foo/", "http://*.example1.com/foo/ 'self'"}, - "https://example.test/", - false}, - {{"https://*.example.test/", "https://*.example.test/ 'self'"}, - "https://example.test/", - false}, - {{"http://example.test/"}, "https://example.test/", false}, - {{"https://example.test/"}, "https://example.test/", true}, - // Origins of A and B do not match. - {{"https://example.test/"}, "https://other-origin.test/", false}, - {{"'self'"}, "https://other-origin.test/", true}, - {{"http://example1.com/foo/ http://*.example2.com/bar/ " - "http://*.example3.com:*/bar/ 'self'"}, - "https://other-origin.test/", - true}, - {{"http://example1.com/foo/ http://*.example2.com/bar/ " - "http://*.example3.com:*/bar/ https://other-origin.test/"}, - "https://other-origin.test/", - true}, - {{"http://example1.com/foo/ 'self'"}, "https://other-origin.test/", true}, - {{"'self'", "https://example.test/"}, "https://other-origin.test/", true}, - {{"'self' https://example.test/", "https://example.test/"}, - "https://other-origin.test/", - false}, - {{"https://example.test/", "http://example.test/"}, - "https://other-origin.test/", - false}, - {{"'self'", "http://other-origin.test/"}, - "https://other-origin.test/", - true}, - {{"'self'", "https://non-example.test/"}, - "https://other-origin.test/", - true}, - // B's origin matches one of sources in the source list of A. - {{"'self'", "http://*.example1.com/foo/"}, "http://example1.com/", true}, - {{"http://*.example2.com/bar/", "'self'"}, - "http://example2.com/bar/", - true}, - {{"'self' http://*.example1.com/foo/", "http://*.example1.com/foo/"}, - "http://example1.com/", - false}, - {{"http://*.example2.com/bar/ http://example1.com/", - "'self' http://example1.com/"}, - "http://example2.com/bar/", - false}, - }; - - for (const auto& test : cases) { - ContentSecurityPolicy* csp_b = SetUpWithOrigin(String(test.origin_b)); - - HeapVector<Member<SourceListDirective>> vector_b; - for (auto* const sources : test.sources_b) { - SourceListDirective* member = MakeGarbageCollected<SourceListDirective>( - "script-src", sources, csp_b); - vector_b.push_back(member); - } - - EXPECT_EQ(test.expected, a.Subsumes(vector_b)); - } -} - TEST_F(SourceListDirectiveTest, AllowAllInline) { struct TestCase { String sources; @@ -599,204 +277,6 @@ } } -TEST_F(SourceListDirectiveTest, SubsumesAllowAllInline) { - struct TestCase { - bool is_script_src; - String sources_a; - Vector<String> sources_b; - bool expected; - } cases[] = { - // `sourcesA` allows all inline behavior. - {false, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'strict-dynamic'", - {"'unsafe-inline' http://example1.com/foo/bar.html"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline'", - {"http://example1.com/foo/ 'unsafe-inline'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline'", - {"'unsafe-inline' 'nonce-yay'", "'unsafe-inline'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline'", - {"'unsafe-inline' 'nonce-yay'", "'unsafe-inline'", "'strict-dynamic'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline'", - {"'unsafe-inline' 'nonce-yay'", "'unsafe-inline'", - "'strict-dynamic' 'nonce-yay'"}, - true}, - // `sourcesA` does not allow all inline behavior. - {false, - "http://example1.com/foo/ 'self' 'strict-dynamic'", - {"'unsafe-inline' http://example1.com/foo/bar.html"}, - false}, - {true, "http://example1.com/foo/ 'self'", {"'unsafe-inline'"}, false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline'", - {"'unsafe-inline' 'nonce-yay'", "'nonce-abc'"}, - true}, - {true, - "http://example1.com/foo/ 'self'", - {"'unsafe-inline' https://example.test/"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'strict-dynamic'", - {"'unsafe-inline' https://example.test/"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'strict-dynamic'", - {"'unsafe-inline' 'strict-dynamic'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'nonce-yay'", - {"'unsafe-inline' 'nonce-yay'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'strict-dynamic' " - "'nonce-yay'", - {"'unsafe-inline' 'nonce-yay'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'strict-dynamic' " - "'nonce-yay'", - {"http://example1.com/foo/ 'unsafe-inline' 'strict-dynamic'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'sha512-321cba' " - "'strict-dynamic'", - {"'unsafe-inline' 'sha512-321cba'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'strict-dynamic' " - "'sha512-321cba'", - {"http://example1.com/foo/ 'unsafe-inline' 'strict-dynamic'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'sha512-321cba'", - {"http://example1.com/foo/ 'unsafe-inline'", - "http://example1.com/foo/ 'sha512-321cba'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'sha512-321cba'", - {"http://example1.com/foo/ 'unsafe-inline'", - "http://example1.com/foo/ 'unsafe-inline' 'sha512-321cba'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'sha512-321cba'", - {"http://example1.com/foo/ 'unsafe-inline' 'nonce-yay'", - "http://example1.com/foo/ 'unsafe-inline' 'sha512-321cba'"}, - true}, - }; - - for (const auto& test : cases) { - SourceListDirective a(test.is_script_src ? "script-src" : "style-src", - test.sources_a, csp.Get()); - ContentSecurityPolicy* csp_b = - SetUpWithOrigin("https://another.test/image.png"); - - HeapVector<Member<SourceListDirective>> vector_b; - for (const auto& sources : test.sources_b) { - SourceListDirective* member = MakeGarbageCollected<SourceListDirective>( - test.is_script_src ? "script-src" : "style-src", sources, csp_b); - vector_b.push_back(member); - } - - EXPECT_EQ(a.Subsumes(vector_b), test.expected); - } -} - -TEST_F(SourceListDirectiveTest, SubsumesUnsafeAttributes) { - struct TestCase { - bool is_script_src; - String sources_a; - Vector<String> sources_b; - bool expected; - } cases[] = { - // A or policiesB contain `unsafe-eval`. - {false, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'strict-dynamic' " - "'unsafe-eval'", - {"http://example1.com/foo/bar.html 'unsafe-eval'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-eval'", - {"http://example1.com/foo/ 'unsafe-inline'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-eval'", - {"http://example1.com/foo/ 'unsafe-inline' 'unsafe-eval'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-eval'", - {"http://example1.com/foo/ 'unsafe-eval'", - "http://example1.com/foo/bar 'self' unsafe-eval'", - "http://non-example.com/foo/ 'unsafe-eval' 'self'"}, - true}, - {true, - "http://example1.com/foo/ 'self'", - {"http://example1.com/foo/ 'unsafe-eval'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline'", - {"http://example1.com/foo/ 'unsafe-eval'", - "http://example1.com/foo/bar 'self' 'unsafe-eval'", - "http://non-example.com/foo/ 'unsafe-eval' 'self'"}, - false}, - // A or policiesB contain `unsafe-hashes`. - {false, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'unsafe-eval' " - "'strict-dynamic' " - "'unsafe-hashes'", - {"http://example1.com/foo/bar.html 'unsafe-hashes'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-hashes'", - {"http://example1.com/foo/ 'unsafe-inline'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-hashes'", - {"http://example1.com/foo/ 'unsafe-inline' 'unsafe-hashes'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-eval' " - "'unsafe-hashes'", - {"http://example1.com/foo/ 'unsafe-eval' 'unsafe-hashes'", - "http://example1.com/foo/bar 'self' 'unsafe-hashes'", - "http://non-example.com/foo/ 'unsafe-hashes' 'self'"}, - true}, - {true, - "http://example1.com/foo/ 'self'", - {"http://example1.com/foo/ 'unsafe-hashes'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline'", - {"http://example1.com/foo/ 'unsafe-hashes'", - "http://example1.com/foo/bar 'self' 'unsafe-hashes'", - "https://example1.com/foo/bar 'unsafe-hashes' 'self'"}, - false}, - }; - - ContentSecurityPolicy* csp_b = - SetUpWithOrigin("https://another.test/image.png"); - - for (const auto& test : cases) { - SourceListDirective a(test.is_script_src ? "script-src" : "style-src", - test.sources_a, csp.Get()); - - HeapVector<Member<SourceListDirective>> vector_b; - for (const auto& sources : test.sources_b) { - SourceListDirective* member = MakeGarbageCollected<SourceListDirective>( - test.is_script_src ? "script-src" : "style-src", sources, csp_b); - vector_b.push_back(member); - } - - EXPECT_EQ(a.Subsumes(vector_b), test.expected); - } -} - TEST_F(SourceListDirectiveTest, IsNone) { struct TestCase { String sources; @@ -925,516 +405,6 @@ } } -TEST_F(SourceListDirectiveTest, GetIntersectNonces) { - SourceListDirective list_a( - "script-src", - "http://example.com 'nonce-abc' 'nonce-xyz' 'nonce-' 'unsafe-inline'", - csp.Get()); - struct TestCase { - String sources; - String expected; - } cases[] = { - {"http:", ""}, - {"http://example.com", ""}, - {"example.com", ""}, - {"'unsafe-inline'", ""}, - {"'nonce-abc'", "'nonce-abc'"}, - {"'nonce-xyz'", "'nonce-xyz'"}, - {"'nonce-123'", ""}, - {"'nonce-abc' 'nonce-xyz'", "'nonce-abc' 'nonce-xyz'"}, - {"'nonce-abc' 'nonce-xyz' 'nonce'", "'nonce-abc' 'nonce-xyz'"}, - {"'nonce-abc' 'nonce-123'", "'nonce-abc'"}, - {"'nonce-123' 'nonce-123'", ""}, - {"'nonce-123' 'nonce-abc'", "'nonce-abc'"}, - {"'nonce-123' 'nonce-xyz'", "'nonce-xyz'"}, - {"'nonce-123' 'nonce-xyx'", ""}, - }; - - for (const auto& test : cases) { - SourceListDirective list_b("script-src", test.sources, csp.Get()); - HashSet<String> normalized = list_a.GetIntersectNonces(list_b.nonces_); - - SourceListDirective expected_list("script-src", test.expected, csp.Get()); - HashSet<String> expected = expected_list.nonces_; - EXPECT_EQ(normalized.size(), expected.size()); - for (const auto& nonce : normalized) { - EXPECT_TRUE(expected.Contains(nonce)); - } - } -} - -TEST_F(SourceListDirectiveTest, GetIntersectHashes) { - SourceListDirective list_a( - "script-src", - "http://example.com 'sha256-abc123' 'sha384-' 'sha512-321cba' 'self'", - csp.Get()); - struct TestCase { - String sources; - String expected; - } cases[] = { - {"http:", ""}, - {"http://example.com", ""}, - {"example.com", ""}, - {"'unsafe-inline'", ""}, - {"'sha384-abc'", ""}, - {"'sha384-'", ""}, - {"'sha256-abc123'", "'sha256-abc123'"}, - {"'sha256-abc123' 'sha384-'", "'sha256-abc123'"}, - {"'sha256-abc123' 'sha512-321cba'", "'sha512-321cba' 'sha256-abc123'"}, - {"'sha256-abc123' 'sha384-' 'sha512-321cba'", - "'sha256-abc123' 'sha512-321cba' "}, - {"'sha256-else' 'sha384-' 'sha512-321cba'", "'sha512-321cba' "}, - {"'hash-123'", ""}, - {"'sha256-123'", ""}, - }; - - for (const auto& test : cases) { - SourceListDirective list_b("script-src", test.sources, csp.Get()); - HashSet<CSPHashValue> normalized = - list_a.GetIntersectHashes(list_b.hashes_); - - SourceListDirective expected_list("script-src", test.expected, csp.Get()); - HashSet<CSPHashValue> expected = expected_list.hashes_; - EXPECT_EQ(normalized.size(), expected.size()); - for (const auto& hash : normalized) { - EXPECT_TRUE(expected.Contains(hash)); - } - } -} - -TEST_F(SourceListDirectiveTest, SubsumesNoncesAndHashes) { - struct TestCase { - bool is_script_src; - String sources_a; - Vector<String> sources_b; - bool expected; - } cases[] = { - // Check nonces. - {true, - "http://example1.com/foo/ 'unsafe-inline' 'nonce-abc'", - {"'unsafe-inline'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'nonce-abc'", - {"'nonce-abc'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline'", - {"'unsafe-inline' 'nonce-yay'", "'nonce-yay'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'nonce-yay'", - {"'unsafe-inline' 'nonce-yay'", "'nonce-yay'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'nonce-abc' 'nonce-yay'", - {"'unsafe-inline' https://example.test/"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'nonce-abc' 'nonce-yay'", - {"'nonce-abc' https://example1.com/foo/"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'nonce-yay' " - "'strict-dynamic'", - {"https://example.test/ 'nonce-yay'"}, - false}, - {false, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'nonce-yay' " - "'strict-dynamic'", - {"'nonce-yay' https://example1.com/foo/"}, - true}, - {true, - "http://example1.com/foo/ 'nonce-abc'", - {"http://example1.com/foo/ 'nonce-xyz'"}, - true}, - {false, - "http://example1.com/foo/ 'nonce-abc'", - {"http://example1.com/foo/ 'nonce-xyz'"}, - true}, - // Check hashes. - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'sha512-321cba'", - {"http://example1.com/foo/page.html 'strict-dynamic'", - "https://example1.com/foo/ 'sha512-321cba'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'sha512-321cba'", - {"http://some-other.com/ 'strict-dynamic' 'sha512-321cba'", - "http://example1.com/foo/ 'unsafe-inline' 'sha512-321cba'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'sha512-321cba'", - {"http://example1.com/foo/ 'sha512-321abc' 'sha512-321cba'", - "http://example1.com/foo/ 'sha512-321abc' 'sha512-321cba'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'sha512-321cba'", - {"http://example1.com/foo/ 'unsafe-inline'", - "http://example1.com/foo/ 'sha512-321cba'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'sha512-321abc'", - {"http://example1.com/foo/ 'unsafe-inline' 'sha512-321abc'", - "http://example1.com/foo/ 'sha512-321abc'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'sha512-321abc'", - {"'unsafe-inline' 'sha512-321abc'", - "http://example1.com/foo/ 'sha512-321abc'"}, - true}, - // Nonces and hashes together. - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'sha512-321abc' " - "'nonce-abc'", - {"'unsafe-inline' 'sha512-321abc' 'self'", - "'unsafe-inline''sha512-321abc' https://example.test/"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'sha512-321abc' " - "'nonce-abc'", - {"'unsafe-inline' 'sha512-321abc' 'self' 'nonce-abc'", - "'sha512-321abc' https://example.test/"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'sha512-321abc' " - "'nonce-abc'", - {"'unsafe-inline' 'sha512-321abc' 'self'", - " 'sha512-321abc' https://example.test/ 'nonce-abc'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'sha512-321abc' " - "'nonce-abc'", - {"'unsafe-inline' 'sha512-321abc' 'self' 'nonce-xyz'", - "unsafe-inline' 'sha512-321abc' https://example.test/ 'nonce-xyz'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'sha512-321abc' " - "'nonce-abc'", - {"'unsafe-inline' 'sha512-321abc' 'self' 'sha512-xyz'", - "unsafe-inline' 'sha512-321abc' https://example.test/ 'sha512-xyz'"}, - false}, - {true, - "http://example1.com/foo/ 'nonce-abc' 'sha512-321abc'", - {"http://example1.com/foo/ 'nonce-xyz' 'sha512-321abc'"}, - true}, - {false, - "http://example1.com/foo/ 'nonce-abc' 'sha512-321abc'", - {"http://example1.com/foo/ 'nonce-xyz' 'sha512-321abc'"}, - true}, - {true, - "http://example1.com/foo/ 'nonce-abc' 'sha512-321abc'", - {"http://example1.com/foo/ 'nonce-xyz' 'sha512-xyz'"}, - false}, - {false, - "http://example1.com/foo/ 'nonce-abc' 'sha512-321abc'", - {"http://example1.com/foo/ 'nonce-xyz' 'sha512-xyz'", - "http://example1.com/foo/ 'nonce-zyx' 'nonce-xyz' 'sha512-xyz'"}, - false}, - }; - - for (const auto& test : cases) { - SourceListDirective a(test.is_script_src ? "script-src" : "style-src", - test.sources_a, csp.Get()); - ContentSecurityPolicy* csp_b = - SetUpWithOrigin("https://another.test/image.png"); - - HeapVector<Member<SourceListDirective>> vector_b; - for (const auto& sources : test.sources_b) { - SourceListDirective* member = MakeGarbageCollected<SourceListDirective>( - test.is_script_src ? "script-src" : "style-src", sources, csp_b); - vector_b.push_back(member); - } - - EXPECT_EQ(a.Subsumes(vector_b), test.expected); - } -} - -TEST_F(SourceListDirectiveTest, SubsumesStrictDynamic) { - struct TestCase { - bool is_script_src; - String sources_a; - Vector<String> sources_b; - bool expected; - } cases[] = { - // Neither A nor effective policy of list B has `strict-dynamic`. - {false, - "http://example1.com/foo/ 'self' 'nonce-yay' 'strict-dynamic'", - {"'strict-dynamic' 'nonce-yay'", "'nonce-yay' 'strict-dynamic'"}, - true}, - {false, - "http://example1.com/foo/ 'self' 'nonce-yay' 'strict-dynamic'", - {"'strict-dynamic' 'nonce-yay'", "'nonce-abc' 'strict-dynamic'"}, - true}, - {false, - "http://example1.com/foo/ 'self' 'sha512-321abc'", - {"'strict-dynamic' 'nonce-yay' 'sha512-321abc'", - "'sha512-321abc' 'strict-dynamic'"}, - true}, - {false, - "http://example1.com/foo/ 'self' 'sha512-321abc'", - {"'strict-dynamic' 'nonce-yay' 'sha512-321abc'", - "'sha512-321abc' 'strict-dynamic'", "'strict-dynamic'"}, - true}, - {false, - "http://example1.com/foo/ 'self' 'sha512-321abc'", - {"'strict-dynamic' 'nonce-yay' http://example1.com/", - "http://example1.com/ 'strict-dynamic'"}, - false}, - // A has `strict-dynamic`, effective policy of list B does not. - {true, - "http://example1.com/foo/ 'self' 'nonce-yay' 'strict-dynamic'", - {"'strict-dynamic' 'nonce-yay'", "'nonce-yay'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'sha512-321abc' 'strict-dynamic'", - {"'strict-dynamic' 'sha512-321abc'", "'unsafe-inline' 'sha512-321abc'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'sha512-321abc' 'strict-dynamic'", - {"'sha512-321abc'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'sha512-321abc' 'strict-dynamic'", - {"http://example1.com/foo/ 'sha512-321abc'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'sha512-321abc' 'strict-dynamic'", - {"'self' 'sha512-321abc'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'strict-dynamic'", - {"'strict-dynamic' 'nonce-yay'", "'nonce-yay'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'strict-dynamic'", - {"http://example1.com/ 'sha512-321abc'", - "http://example1.com/ 'sha512-321abc'"}, - false}, - {true, - "http://example1.com/foo/ 'sha512-321abc' 'strict-dynamic'", - {"https://example1.com/foo/ 'sha512-321abc'", - "http://example1.com/foo/ 'sha512-321abc'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'nonce-yay' 'strict-dynamic'", - {"'strict-dynamic' 'nonce-yay'", "'nonce-yay'", "'sha512-321abc'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-hashes' " - "'strict-dynamic'", - {"'strict-dynamic' 'unsafe-hashes'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'nonce-yay' 'strict-dynamic'", - {"'strict-dynamic' 'nonce-yay' 'unsafe-hashes'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-eval' 'strict-dynamic'", - {"'strict-dynamic' 'unsafe-eval'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'nonce-yay' 'strict-dynamic'", - {"'strict-dynamic' 'nonce-yay' 'unsafe-eval'"}, - false}, - // A does not have `strict-dynamic`, but effective policy of list B does. - // Note that any subsumption in this set-up should be `false`. - {true, - "http://example1.com/foo/ 'self' 'nonce-yay'", - {"'strict-dynamic' 'nonce-yay'", "'sha512-321abc' 'strict-dynamic'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'sha512-321abc'", - {"'strict-dynamic' 'sha512-321abc'", "'strict-dynamic' 'sha512-321abc'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline'", - {"'strict-dynamic'"}, - false}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'sha512-321abc'", - {"'strict-dynamic'"}, - false}, - // Both A and effective policy of list B has `strict-dynamic`. - {true, - "'strict-dynamic'", - {"'strict-dynamic'", "'strict-dynamic'", "'strict-dynamic'"}, - true}, - {true, - "'strict-dynamic'", - {"'strict-dynamic'", "'strict-dynamic' 'nonce-yay'", - "'strict-dynamic' 'nonce-yay'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'strict-dynamic'", - {"'strict-dynamic' 'nonce-yay'", "'strict-dynamic'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'strict-dynamic'", - {"'strict-dynamic' http://another.com/", - "http://another.com/ 'strict-dynamic'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'unsafe-inline' 'strict-dynamic'", - {"'self' 'sha512-321abc' 'strict-dynamic'", - "'self' 'strict-dynamic' 'sha512-321abc'"}, - false}, - {true, - "http://example1.com/foo/ 'sha512-321abc' 'strict-dynamic'", - {"'self' 'sha512-321abc' 'strict-dynamic'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'sha512-321abc' 'strict-dynamic'", - {"'unsafe-inline' 'strict-dynamic'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'sha512-321abc' 'strict-dynamic'", - {"'unsafe-inline' 'sha512-123xyz' 'strict-dynamic'"}, - false}, - {true, - "'unsafe-eval' 'self' 'sha512-321abc' 'strict-dynamic'", - {"'unsafe-eval' 'strict-dynamic'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'sha512-321abc' 'strict-dynamic'", - {"'unsafe-eval' 'strict-dynamic'"}, - false}, - {true, - "'unsafe-hashes' 'self' 'sha512-321abc' 'strict-dynamic'", - {"'unsafe-hashes' 'strict-dynamic'"}, - true}, - {true, - "http://example1.com/foo/ 'self' 'sha512-321abc' 'strict-dynamic'", - {"'unsafe-hashes' 'strict-dynamic'"}, - false}, - }; - - for (const auto& test : cases) { - SourceListDirective a(test.is_script_src ? "script-src" : "style-src", - test.sources_a, csp.Get()); - ContentSecurityPolicy* csp_b = - SetUpWithOrigin("https://another.test/image.png"); - - HeapVector<Member<SourceListDirective>> vector_b; - for (const auto& sources : test.sources_b) { - SourceListDirective* member = MakeGarbageCollected<SourceListDirective>( - test.is_script_src ? "script-src" : "style-src", sources, csp_b); - vector_b.push_back(member); - } - - EXPECT_EQ(a.Subsumes(vector_b), test.expected); - } -} - -TEST_F(SourceListDirectiveTest, SubsumesListWildcard) { - struct TestCase { - const char* sources_a; - Vector<const char*> sources_b; - bool expected; - } cases[] = { - // `A` subsumes `policiesB`.. - {"*", {""}, true}, - {"*", {"'none'"}, true}, - {"*", {"*"}, true}, - {"*", {"*", "*", "*"}, true}, - {"*", {"*", "* https: http: ftp: ws: wss:"}, true}, - {"*", {"*", "https: http: ftp: ws: wss:"}, true}, - {"https: http: ftp: ws: wss:", {"*", "https: http: ftp: ws: wss:"}, true}, - {"http: ftp: ws:", {"*", "https: http: ftp: ws: wss:"}, true}, - {"http: ftp: ws:", {"*", "https: 'strict-dynamic'"}, true}, - {"http://another.test", {"*", "'self'"}, true}, - {"http://another.test/", {"*", "'self'"}, true}, - {"http://another.test", {"https:", "'self'"}, true}, - {"'self'", {"*", "'self'"}, true}, - {"'unsafe-eval' * ", {"'unsafe-eval'"}, true}, - {"'unsafe-hashes' * ", {"'unsafe-hashes'"}, true}, - {"'unsafe-inline' * ", {"'unsafe-inline'"}, true}, - {"*", {"*", "http://a.com ws://b.com ftp://c.com"}, true}, - {"*", {"* data: blob:", "http://a.com ws://b.com ftp://c.com"}, true}, - {"*", {"data: blob:", "http://a.com ws://b.com ftp://c.com"}, true}, - {"*", {"*", "data://a.com ws://b.com ftp://c.com"}, true}, - {"* data:", - {"data: blob: *", "data://a.com ws://b.com ftp://c.com"}, - true}, - {"http://a.com ws://b.com ftp://c.com", - {"*", "http://a.com ws://b.com ftp://c.com"}, - true}, - // `A` does not subsume `policiesB`.. - {"*", Vector<const char*>(), false}, - {"", {"*"}, false}, - {"'none'", {"*"}, false}, - {"*", {"data:"}, false}, - {"*", {"blob:"}, false}, - {"http: ftp: ws:", - {"* 'strict-dynamic'", "https: 'strict-dynamic'"}, - false}, - {"https://another.test", {"*"}, false}, - {"*", {"* 'unsafe-eval'"}, false}, - {"*", {"* 'unsafe-hashes'"}, false}, - {"*", {"* 'unsafe-inline'"}, false}, - {"'unsafe-eval'", {"* 'unsafe-eval'"}, false}, - {"'unsafe-hashes'", {"* 'unsafe-hashes'"}, false}, - {"'unsafe-inline'", {"* 'unsafe-inline'"}, false}, - {"*", {"data: blob:", "data://a.com ws://b.com ftp://c.com"}, false}, - {"* data:", - {"data: blob:", "blob://a.com ws://b.com ftp://c.com"}, - false}, - }; - - for (const auto& test : cases) { - SourceListDirective a("script-src", test.sources_a, csp.Get()); - ContentSecurityPolicy* csp_b = - SetUpWithOrigin("https://another.test/image.png"); - - HeapVector<Member<SourceListDirective>> vector_b; - for (auto* const sources : test.sources_b) { - SourceListDirective* member = MakeGarbageCollected<SourceListDirective>( - "script-src", sources, csp_b); - vector_b.push_back(member); - } - - EXPECT_EQ(a.Subsumes(vector_b), test.expected); - } -} - -TEST_F(SourceListDirectiveTest, GetSources) { - struct TestCase { - const char* sources; - const char* expected; - } cases[] = { - {"", ""}, - {"*", "ftp: ws: http: https:"}, - {"* data:", "data: ftp: ws: http: https:"}, - {"blob: *", "blob: ftp: ws: http: https:"}, - {"* 'self'", "ftp: ws: http: https:"}, - {"https: 'self'", "https: https://example.test"}, - {"https://b.com/bar/", "https://b.com/bar/"}, - {"'self' http://a.com/foo/ https://b.com/bar/", - "http://a.com/foo/ https://b.com/bar/ https://example.test"}, - {"http://a.com/foo/ https://b.com/bar/ 'self'", - "http://a.com/foo/ https://b.com/bar/ https://example.test"}, - }; - - for (const auto& test : cases) { - SourceListDirective list("script-src", test.sources, csp.Get()); - HeapVector<Member<CSPSource>> normalized = - list.GetSources(csp.Get()->GetSelfSource()); - - SourceListDirective expected_list("script-src", test.expected, csp.Get()); - HeapVector<Member<CSPSource>> expected = expected_list.list_; - EXPECT_EQ(normalized.size(), expected.size()); - for (wtf_size_t i = 0; i < expected.size(); i++) { - Source a = {expected[i]->scheme_, expected[i]->host_, - expected[i]->port_, expected[i]->path_, - expected[i]->host_wildcard_, expected[i]->port_wildcard_}; - Source b = {normalized[i]->scheme_, normalized[i]->host_, - normalized[i]->port_, normalized[i]->path_, - normalized[i]->host_wildcard_, normalized[i]->port_wildcard_}; - EXPECT_TRUE(EqualSources(a, b)); - } - } -} - TEST_F(SourceListDirectiveTest, ParseHost) { struct TestCase { String sources;
diff --git a/third_party/blink/renderer/core/html/html_frame_owner_element.cc b/third_party/blink/renderer/core/html/html_frame_owner_element.cc index 59fe141..dd3ab7c 100644 --- a/third_party/blink/renderer/core/html/html_frame_owner_element.cc +++ b/third_party/blink/renderer/core/html/html_frame_owner_element.cc
@@ -20,7 +20,6 @@ #include "third_party/blink/renderer/core/html/html_frame_owner_element.h" -#include "services/network/public/cpp/features.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/mojom/feature_policy/feature_policy.mojom-blink.h" #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h" @@ -385,9 +384,6 @@ } void HTMLFrameOwnerElement::CSPAttributeChanged() { - if (!base::FeatureList::IsEnabled(network::features::kOutOfBlinkCSPEE)) - return; - // Don't notify about updates if ContentFrame() is null, for example when // the subframe hasn't been created yet; or if we are in the middle of // swapping one frame for another, in which case the final state
diff --git a/third_party/blink/renderer/core/html/html_iframe_element.cc b/third_party/blink/renderer/core/html/html_iframe_element.cc index a367672..aa3cfaf 100644 --- a/third_party/blink/renderer/core/html/html_iframe_element.cc +++ b/third_party/blink/renderer/core/html/html_iframe_element.cc
@@ -233,35 +233,18 @@ UpdateContainerPolicy(); } } else if (name == html_names::kCspAttr) { - if (base::FeatureList::IsEnabled(network::features::kOutOfBlinkCSPEE)) { - if (value.Contains('\n') || value.Contains('\r') || value.Contains(',')) { - required_csp_ = g_null_atom; - GetDocument().AddConsoleMessage(MakeGarbageCollected<ConsoleMessage>( - mojom::blink::ConsoleMessageSource::kOther, - mojom::blink::ConsoleMessageLevel::kError, - "'csp' attribute is invalid: " + value)); - return; - } - if (required_csp_ != value) { - required_csp_ = value; - CSPAttributeChanged(); - UseCounter::Count(GetDocument(), WebFeature::kIFrameCSPAttribute); - } - } else { - if (!ContentSecurityPolicy::IsValidCSPAttr( - value.GetString(), GetDocument().RequiredCSP().GetString())) { - required_csp_ = g_null_atom; - GetDocument().AddConsoleMessage(MakeGarbageCollected<ConsoleMessage>( - mojom::blink::ConsoleMessageSource::kOther, - mojom::blink::ConsoleMessageLevel::kError, - "'csp' attribute is not a valid policy: " + value)); - return; - } - if (required_csp_ != value) { - required_csp_ = value; - FrameOwnerPropertiesChanged(); - UseCounter::Count(GetDocument(), WebFeature::kIFrameCSPAttribute); - } + if (value.Contains('\n') || value.Contains('\r') || value.Contains(',')) { + required_csp_ = g_null_atom; + GetDocument().AddConsoleMessage(MakeGarbageCollected<ConsoleMessage>( + mojom::blink::ConsoleMessageSource::kOther, + mojom::blink::ConsoleMessageLevel::kError, + "'csp' attribute is invalid: " + value)); + return; + } + if (required_csp_ != value) { + required_csp_ = value; + CSPAttributeChanged(); + UseCounter::Count(GetDocument(), WebFeature::kIFrameCSPAttribute); } } else if (name == html_names::kAllowAttr) { if (allow_ != value) { @@ -449,24 +432,8 @@ HTMLFrameElementBase::InsertedInto(insertion_point); auto* html_doc = DynamicTo<HTMLDocument>(GetDocument()); - if (html_doc && insertion_point.IsInDocumentTree()) { + if (html_doc && insertion_point.IsInDocumentTree()) html_doc->AddNamedItem(name_); - if (!base::FeatureList::IsEnabled(network::features::kOutOfBlinkCSPEE) && - !ContentSecurityPolicy::IsValidCSPAttr( - required_csp_, GetDocument().RequiredCSP().GetString())) { - if (!required_csp_.IsEmpty()) { - GetDocument().AddConsoleMessage(MakeGarbageCollected<ConsoleMessage>( - mojom::ConsoleMessageSource::kOther, - mojom::ConsoleMessageLevel::kError, - "'csp' attribute is not a valid policy: " + required_csp_)); - } - if (required_csp_ != GetDocument().RequiredCSP()) { - required_csp_ = GetDocument().RequiredCSP(); - FrameOwnerPropertiesChanged(); - UseCounter::Count(GetDocument(), WebFeature::kIFrameCSPAttribute); - } - } - } LogAddElementIfIsolatedWorldAndInDocument("iframe", html_names::kSrcAttr); return result; }
diff --git a/third_party/blink/renderer/core/inspector/inspect_tools.cc b/third_party/blink/renderer/core/inspector/inspect_tools.cc index 2b3e48f..5f569398 100644 --- a/third_party/blink/renderer/core/inspector/inspect_tools.cc +++ b/third_party/blink/renderer/core/inspector/inspect_tools.cc
@@ -403,11 +403,21 @@ return OverlayNames::OVERLAY_PERSISTENT; } -void PersistentTool::AddGridConfig( - Node* node, - std::unique_ptr<InspectorGridHighlightConfig> grid_highlight_config) { - grid_node_highlights_.emplace_back( - std::make_pair(node, std::move(grid_highlight_config))); +bool PersistentTool::IsEmpty() { + return !grid_node_highlights_.size() && !flex_container_configs_.size(); +} + +void PersistentTool::SetGridConfigs( + Vector<std::pair<Member<Node>, + std::unique_ptr<InspectorGridHighlightConfig>>> configs) { + grid_node_highlights_ = std::move(configs); +} + +void PersistentTool::SetFlexContainerConfigs( + Vector<std::pair<Member<Node>, + std::unique_ptr<InspectorFlexContainerHighlightConfig>>> + configs) { + flex_container_configs_ = std::move(configs); } bool PersistentTool::ForwardEventsToOverlay() { @@ -430,6 +440,14 @@ continue; overlay_->EvaluateInOverlay("drawGridHighlight", std::move(highlight)); } + for (auto& entry : flex_container_configs_) { + std::unique_ptr<protocol::Value> highlight = + InspectorFlexContainerHighlight(entry.first.Get(), *(entry.second)); + if (!highlight) + continue; + overlay_->EvaluateInOverlay("drawFlexContainerHighlight", + std::move(highlight)); + } } std::unique_ptr<protocol::DictionaryValue>
diff --git a/third_party/blink/renderer/core/inspector/inspect_tools.h b/third_party/blink/renderer/core/inspector/inspect_tools.h index 94e3ee8..94c53106 100644 --- a/third_party/blink/renderer/core/inspector/inspect_tools.h +++ b/third_party/blink/renderer/core/inspector/inspect_tools.h
@@ -133,14 +133,19 @@ // ----------------------------------------------------------------------------- +using GirdConfigs = Vector< + std::pair<Member<Node>, std::unique_ptr<InspectorGridHighlightConfig>>>; +using FlexContainerConfigs = + Vector<std::pair<Member<Node>, + std::unique_ptr<InspectorFlexContainerHighlightConfig>>>; class PersistentTool : public InspectTool { using InspectTool::InspectTool; public: void Draw(float scale) override; - void AddGridConfig( - Node* node, - std::unique_ptr<InspectorGridHighlightConfig> grid_highlight_config); + bool IsEmpty(); + void SetGridConfigs(GirdConfigs); + void SetFlexContainerConfigs(FlexContainerConfigs); std::unique_ptr<protocol::DictionaryValue> GetGridInspectorHighlightsAsJson() const; @@ -151,8 +156,8 @@ bool HideOnHideHighlight() override; String GetOverlayName() override; - Vector<std::pair<Member<Node>, std::unique_ptr<InspectorGridHighlightConfig>>> - grid_node_highlights_; + GirdConfigs grid_node_highlights_; + FlexContainerConfigs flex_container_configs_; DISALLOW_COPY_AND_ASSIGN(PersistentTool); };
diff --git a/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.cc b/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.cc index 087618b..20c93e0 100644 --- a/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.cc
@@ -38,6 +38,7 @@ #include "third_party/blink/renderer/core/dom/events/event.h" #include "third_party/blink/renderer/core/dom/events/event_target.h" #include "third_party/blink/renderer/core/dom/node.h" +#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/inspector/inspector_dom_agent.h" #include "third_party/blink/renderer/core/inspector/resolve_node.h" @@ -45,7 +46,6 @@ #include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/inspector_protocol/crdtp/json.h" - using crdtp::SpanFrom; using crdtp::json::ConvertCBORToJSON; @@ -209,7 +209,8 @@ enabled_(&agent_state_, /*default_value=*/false), pause_on_all_xhrs_(&agent_state_, /*default_value=*/false), xhr_breakpoints_(&agent_state_, /*default_value=*/false), - event_listener_breakpoints_(&agent_state_, /*default_value*/ false) {} + event_listener_breakpoints_(&agent_state_, /*default_value*/ false), + csp_violation_breakpoints_(&agent_state_, /*default_value*/ false) {} InspectorDOMDebuggerAgent::~InspectorDOMDebuggerAgent() = default; @@ -340,7 +341,39 @@ default: break; } - return ""; + return WTF::g_empty_string; +} + +bool IsValidViolationType(const String& violationString) { + if (violationString == + protocol::DOMDebugger::CSPViolationTypeEnum::TrustedtypeSinkViolation) { + return true; + } + if (violationString == + protocol::DOMDebugger::CSPViolationTypeEnum::TrustedtypePolicyViolation) { + return true; + } + return false; +} + +Response InspectorDOMDebuggerAgent::setBreakOnCSPViolation( + std::unique_ptr<protocol::Array<String>> violationTypes) { + csp_violation_breakpoints_.Clear(); + if (violationTypes->empty()) { + DidRemoveBreakpoint(); + return Response::Success(); + } + for (const auto& violationString : *violationTypes) { + if (IsValidViolationType(violationString)) { + csp_violation_breakpoints_.Set(violationString, true); + } else { + csp_violation_breakpoints_.Clear(); + DidRemoveBreakpoint(); + return Response::InvalidParams("Invalid violation type"); + } + } + DidAddBreakpoint(); + return Response::Success(); } Response InspectorDOMDebuggerAgent::setDOMBreakpoint( @@ -707,7 +740,7 @@ // Returns the breakpoint url if a match is found, or WTF::String(). String InspectorDOMDebuggerAgent::MatchXHRBreakpoints(const String& url) const { if (pause_on_all_xhrs_.Get()) - return ""; + return WTF::g_empty_string; for (const WTF::String& breakpoint : xhr_breakpoints_.Keys()) { if (url.Contains(breakpoint)) return breakpoint; @@ -748,6 +781,8 @@ void InspectorDOMDebuggerAgent::DidRemoveBreakpoint() { if (!dom_breakpoints_.IsEmpty()) return; + if (!csp_violation_breakpoints_.IsEmpty()) + return; if (!event_listener_breakpoints_.IsEmpty()) return; if (!xhr_breakpoints_.IsEmpty()) @@ -793,4 +828,39 @@ true); } +String ViolationTypeToString( + const ContentSecurityPolicy::ContentSecurityPolicyViolationType type) { + switch (type) { + case ContentSecurityPolicy::ContentSecurityPolicyViolationType:: + kTrustedTypesSinkViolation: + return protocol::DOMDebugger::CSPViolationTypeEnum:: + TrustedtypeSinkViolation; + case ContentSecurityPolicy::ContentSecurityPolicyViolationType:: + kTrustedTypesPolicyViolation: + return protocol::DOMDebugger::CSPViolationTypeEnum:: + TrustedtypePolicyViolation; + default: + return WTF::g_empty_string; + } +} + +void InspectorDOMDebuggerAgent::OnContentSecurityPolicyViolation( + const ContentSecurityPolicy::ContentSecurityPolicyViolationType + violationType) { + auto violationString = ViolationTypeToString(violationType); + if (!csp_violation_breakpoints_.Get(violationString)) + return; + + std::unique_ptr<protocol::DictionaryValue> event_data = + protocol::DictionaryValue::create(); + event_data->setString("violationType", violationString); + std::vector<uint8_t> json; + ConvertCBORToJSON(SpanFrom(event_data->Serialize()), &json); + v8_inspector::StringView json_view(json.data(), json.size()); + auto listener = ToV8InspectorStringView( + v8_inspector::protocol::Debugger::API::Paused::ReasonEnum::CSPViolation); + + v8_session_->breakProgram(listener, json_view); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.h b/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.h index 7ea3296e..c8228069 100644 --- a/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.h +++ b/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.h
@@ -34,6 +34,7 @@ #include "base/macros.h" #include "third_party/blink/renderer/bindings/core/v8/v8_event_listener_info.h" #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" #include "third_party/blink/renderer/core/inspector/inspector_base_agent.h" #include "third_party/blink/renderer/core/inspector/inspector_dom_agent.h" #include "third_party/blink/renderer/core/inspector/protocol/DOMDebugger.h" @@ -69,6 +70,8 @@ ~InspectorDOMDebuggerAgent() override; void Trace(Visitor*) const override; + protocol::Response setBreakOnCSPViolation( + std::unique_ptr<protocol::Array<String>> violationTypes) override; // DOMDebugger API for frontend protocol::Response setDOMBreakpoint(int node_id, const String& type) override; protocol::Response removeDOMBreakpoint(int node_id, @@ -114,6 +117,8 @@ void DidCloseAudioContext(); void DidResumeAudioContext(); void DidSuspendAudioContext(); + void OnContentSecurityPolicyViolation( + const ContentSecurityPolicy::ContentSecurityPolicyViolationType); protocol::Response disable() override; void Restore() override; @@ -177,6 +182,7 @@ InspectorAgentState::Boolean pause_on_all_xhrs_; InspectorAgentState::BooleanMap xhr_breakpoints_; InspectorAgentState::BooleanMap event_listener_breakpoints_; + InspectorAgentState::BooleanMap csp_violation_breakpoints_; DISALLOW_COPY_AND_ASSIGN(InspectorDOMDebuggerAgent); };
diff --git a/third_party/blink/renderer/core/inspector/inspector_highlight.cc b/third_party/blink/renderer/core/inspector/inspector_highlight.cc index ab85e46..7caf27b 100644 --- a/third_party/blink/renderer/core/inspector/inspector_highlight.cc +++ b/third_party/blink/renderer/core/inspector/inspector_highlight.cc
@@ -1762,6 +1762,29 @@ return grid_info; } +std::unique_ptr<protocol::DictionaryValue> InspectorFlexContainerHighlight( + Node* node, + const InspectorFlexContainerHighlightConfig& config) { + if (DisplayLockUtilities::NearestLockedExclusiveAncestor(*node)) { + // Skip if node is part of display locked tree. + return nullptr; + } + + LocalFrameView* frame_view = node->GetDocument().View(); + if (!frame_view) + return nullptr; + + float scale = 1.f / frame_view->GetChromeClient()->WindowToViewportScalar( + &frame_view->GetFrame(), 1.f); + LayoutObject* layout_object = node->GetLayoutObject(); + if (!layout_object || !(layout_object->StyleRef().IsDisplayFlexibleBox() && + layout_object->IsFlexibleBoxIncludingNG())) { + return nullptr; + } + + return BuildFlexInfo(node, config, scale); +} + // static InspectorHighlightConfig InspectorHighlight::DefaultConfig() { InspectorHighlightConfig config;
diff --git a/third_party/blink/renderer/core/inspector/inspector_highlight.h b/third_party/blink/renderer/core/inspector/inspector_highlight.h index 7ac8537a..5330c1f 100644 --- a/third_party/blink/renderer/core/inspector/inspector_highlight.h +++ b/third_party/blink/renderer/core/inspector/inspector_highlight.h
@@ -207,6 +207,10 @@ Node*, const InspectorGridHighlightConfig& config); +std::unique_ptr<protocol::DictionaryValue> InspectorFlexContainerHighlight( + Node* node, + const InspectorFlexContainerHighlightConfig& config); + } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_INSPECTOR_HIGHLIGHT_H_
diff --git a/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc b/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc index 6564fe7..b99d5f2 100644 --- a/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc
@@ -706,24 +706,56 @@ Response InspectorOverlayAgent::setShowGridOverlays( std::unique_ptr<protocol::Array<protocol::Overlay::GridNodeHighlightConfig>> grid_node_highlight_configs) { - persistent_tool_ = nullptr; - - if (grid_node_highlight_configs->size()) { - PersistentTool* grid_tool = + if (!persistent_tool_) { + persistent_tool_ = MakeGarbageCollected<PersistentTool>(this, GetFrontend()); - for (std::unique_ptr<protocol::Overlay::GridNodeHighlightConfig>& config : - *grid_node_highlight_configs) { - Node* node = nullptr; - Response response = dom_agent_->AssertNode(config->getNodeId(), node); - if (!response.IsSuccess()) - return response; - grid_tool->AddGridConfig(node, - InspectorOverlayAgent::ToGridHighlightConfig( - config->getGridHighlightConfig())); - } - persistent_tool_ = grid_tool; } + Vector<std::pair<Member<Node>, std::unique_ptr<InspectorGridHighlightConfig>>> + configs; + for (std::unique_ptr<protocol::Overlay::GridNodeHighlightConfig>& config : + *grid_node_highlight_configs) { + Node* node = nullptr; + Response response = dom_agent_->AssertNode(config->getNodeId(), node); + if (!response.IsSuccess()) + return response; + configs.push_back( + std::make_pair(node, InspectorOverlayAgent::ToGridHighlightConfig( + config->getGridHighlightConfig()))); + } + + persistent_tool_->SetGridConfigs(std::move(configs)); + + PickTheRightTool(); + + return Response::Success(); +} + +Response InspectorOverlayAgent::setShowFlexOverlays( + std::unique_ptr<protocol::Array<protocol::Overlay::FlexNodeHighlightConfig>> + flex_node_highlight_configs) { + if (!persistent_tool_) { + persistent_tool_ = + MakeGarbageCollected<PersistentTool>(this, GetFrontend()); + } + + Vector<std::pair<Member<Node>, + std::unique_ptr<InspectorFlexContainerHighlightConfig>>> + configs; + + for (std::unique_ptr<protocol::Overlay::FlexNodeHighlightConfig>& config : + *flex_node_highlight_configs) { + Node* node = nullptr; + Response response = dom_agent_->AssertNode(config->getNodeId(), node); + if (!response.IsSuccess()) + return response; + configs.push_back(std::make_pair( + node, InspectorOverlayAgent::ToFlexContainerHighlightConfig( + config->getFlexContainerHighlightConfig()))); + } + + persistent_tool_->SetFlexContainerConfigs(std::move(configs)); + PickTheRightTool(); return Response::Success(); @@ -820,17 +852,20 @@ Response InspectorOverlayAgent::getGridHighlightObjectsForTest( std::unique_ptr<protocol::Array<int>> node_ids, std::unique_ptr<protocol::DictionaryValue>* highlights) { - PersistentTool grid_highlight_tool(this, GetFrontend()); + PersistentTool persistent_tool(this, GetFrontend()); + Vector<std::pair<Member<Node>, std::unique_ptr<InspectorGridHighlightConfig>>> + configs; for (const int node_id : *node_ids) { Node* node = nullptr; Response response = dom_agent_->AssertNode(node_id, node); if (!response.IsSuccess()) return response; - grid_highlight_tool.AddGridConfig( - node, std::make_unique<InspectorGridHighlightConfig>( - InspectorHighlight::DefaultGridConfig())); + configs.push_back( + std::make_pair(node, std::make_unique<InspectorGridHighlightConfig>( + InspectorHighlight::DefaultGridConfig()))); } - *highlights = grid_highlight_tool.GetGridInspectorHighlightsAsJson(); + persistent_tool.SetGridConfigs(std::move(configs)); + *highlights = persistent_tool.GetGridInspectorHighlightsAsJson(); return Response::Success(); } @@ -1300,6 +1335,9 @@ void InspectorOverlayAgent::PickTheRightTool() { InspectTool* inspect_tool = nullptr; + if (persistent_tool_ && persistent_tool_->IsEmpty()) + persistent_tool_ = nullptr; + String inspect_mode = inspect_mode_.Get(); if (inspect_mode == protocol::Overlay::InspectModeEnum::SearchForNode || inspect_mode ==
diff --git a/third_party/blink/renderer/core/inspector/inspector_overlay_agent.h b/third_party/blink/renderer/core/inspector/inspector_overlay_agent.h index 4c3e12da..992d18d 100644 --- a/third_party/blink/renderer/core/inspector/inspector_overlay_agent.h +++ b/third_party/blink/renderer/core/inspector/inspector_overlay_agent.h
@@ -220,6 +220,10 @@ std::unique_ptr< protocol::Array<protocol::Overlay::GridNodeHighlightConfig>> grid_node_highlight_configs) override; + protocol::Response setShowFlexOverlays( + std::unique_ptr< + protocol::Array<protocol::Overlay::FlexNodeHighlightConfig>> + flex_node_highlight_configs) override; // InspectorBaseAgent overrides. void Restore() override;
diff --git a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc index 9876247..3d7a5a8 100644 --- a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc
@@ -947,6 +947,13 @@ GetFrontend()->frameNavigated(BuildObjectForFrame(loader->GetFrame())); } +void InspectorPageAgent::DidOpenDocument(LocalFrame* frame, + DocumentLoader* loader) { + GetFrontend()->documentOpened(BuildObjectForFrame(loader->GetFrame())); + LifecycleEvent(frame, loader, "init", + base::TimeTicks::Now().since_origin().InSecondsF()); +} + void InspectorPageAgent::FrameAttachedToParent(LocalFrame* frame) { Frame* parent_frame = frame->Tree().Parent(); std::unique_ptr<SourceLocation> location =
diff --git a/third_party/blink/renderer/core/inspector/inspector_page_agent.h b/third_party/blink/renderer/core/inspector/inspector_page_agent.h index faeb95d..2d4d6ae 100644 --- a/third_party/blink/renderer/core/inspector/inspector_page_agent.h +++ b/third_party/blink/renderer/core/inspector/inspector_page_agent.h
@@ -175,6 +175,7 @@ void DomContentLoadedEventFired(LocalFrame*); void LoadEventFired(LocalFrame*); void WillCommitLoad(LocalFrame*, DocumentLoader*); + void DidOpenDocument(LocalFrame*, DocumentLoader*); void FrameAttachedToParent(LocalFrame*); void FrameDetachedFromParent(LocalFrame*, FrameDetachType); void FrameStartedLoading(LocalFrame*);
diff --git a/third_party/blink/renderer/core/inspector/thread_debugger.cc b/third_party/blink/renderer/core/inspector/thread_debugger.cc index db878a62..b84fc93 100644 --- a/third_party/blink/renderer/core/inspector/thread_debugger.cc +++ b/third_party/blink/renderer/core/inspector/thread_debugger.cc
@@ -24,6 +24,7 @@ #include "third_party/blink/renderer/bindings/core/v8/v8_trusted_html.h" #include "third_party/blink/renderer/bindings/core/v8/v8_trusted_script.h" #include "third_party/blink/renderer/bindings/core/v8/v8_trusted_script_url.h" +#include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/inspector/console_message.h" #include "third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.h" @@ -206,6 +207,43 @@ TrustedScriptURL* trusted_script_url = V8TrustedScriptURL::ToImplWithTypeCheck(isolate_, value); return ToV8InspectorStringBuffer(trusted_script_url->toString()); + } else if (V8Node::HasInstance(value, isolate_)) { + Node* node = V8Node::ToImplWithTypeCheck(isolate_, value); + StringBuilder description; + switch (node->getNodeType()) { + case Node::kElementNode: { + const auto* element = To<blink::Element>(node); + description.Append(element->TagQName().ToString()); + + const AtomicString& id = element->GetIdAttribute(); + if (!id.IsEmpty()) { + description.Append('#'); + description.Append(id); + } + if (element->HasClass()) { + auto element_class_names = element->ClassNames(); + auto n_classes = element_class_names.size(); + for (unsigned i = 0; i < n_classes; ++i) { + description.Append('.'); + description.Append(element_class_names[i]); + } + } + break; + } + case Node::kDocumentTypeNode: { + description.Append("<!DOCTYPE "); + description.Append(node->nodeName()); + description.Append('>'); + break; + } + default: { + description.Append(node->nodeName()); + break; + } + } + DCHECK(description.length()); + + return ToV8InspectorStringBuffer(description.ToString()); } return nullptr; }
diff --git a/third_party/blink/renderer/core/layout/scroll_anchor.cc b/third_party/blink/renderer/core/layout/scroll_anchor.cc index 330000c..c39d0c56 100644 --- a/third_party/blink/renderer/core/layout/scroll_anchor.cc +++ b/third_party/blink/renderer/core/layout/scroll_anchor.cc
@@ -577,11 +577,6 @@ // This minimizes redundant calls to findAnchor. // TODO(skobes): add UMA metric for this. ClearSelf(); - - DEFINE_STATIC_LOCAL(EnumerationHistogram, suppressed_by_sanaclap_histogram, - ("Layout.ScrollAnchor.SuppressedBySanaclap", 2)); - suppressed_by_sanaclap_histogram.Count(1); - return; } @@ -589,10 +584,6 @@ scroller_->GetScrollOffset() + FloatSize(adjustment), mojom::blink::ScrollType::kAnchoring); - // Update UMA metric. - DEFINE_STATIC_LOCAL(EnumerationHistogram, adjusted_offset_histogram, - ("Layout.ScrollAnchor.AdjustedScrollOffset", 2)); - adjusted_offset_histogram.Count(1); UseCounter::Count(ScrollerLayoutBox(scroller_)->GetDocument(), WebFeature::kScrollAnchored); } @@ -603,8 +594,6 @@ } SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Layout.ScrollAnchor.TimeToRestoreAnchor"); - DEFINE_STATIC_LOCAL(EnumerationHistogram, restoration_status_histogram, - ("Layout.ScrollAnchor.RestorationStatus", kStatusCount)); if (anchor_object_ && serialized_anchor.selector == saved_selector_) { return true; @@ -629,12 +618,10 @@ AtomicString(serialized_anchor.selector), exception_state); if (exception_state.HadException()) { - restoration_status_histogram.Count(kFailedBadSelector); return false; } if (found_elements->length() < 1) { - restoration_status_histogram.Count(kFailedNoMatches); return false; } @@ -679,12 +666,9 @@ } saved_selector_ = serialized_anchor.selector; - restoration_status_histogram.Count(kSuccess); - return true; } - restoration_status_histogram.Count(kFailedNoValidMatches); return false; }
diff --git a/third_party/blink/renderer/core/layout/scroll_anchor.h b/third_party/blink/renderer/core/layout/scroll_anchor.h index cabe85bb..7deea3e 100644 --- a/third_party/blink/renderer/core/layout/scroll_anchor.h +++ b/third_party/blink/renderer/core/layout/scroll_anchor.h
@@ -82,16 +82,6 @@ // Only meaningful if anchorObject() is non-null. Corner GetCorner() const { return corner_; } - // This enum must remain in sync with the corresponding enum in enums.xml. - enum RestorationStatus { - kSuccess = 0, - kFailedNoMatches, - kFailedNoValidMatches, - kFailedBadSelector, - kStatusCount // Special value used to count the number of enum values; not - // to be used as an actual status. Add new values above. - }; - // Attempt to restore |serialized_anchor| by scrolling to the element // identified by its selector, adjusting by its relative_offset. bool RestoreAnchor(const SerializedAnchor&);
diff --git a/third_party/blink/renderer/core/layout/scroll_anchor_test.cc b/third_party/blink/renderer/core/layout/scroll_anchor_test.cc index 0be2891e..85e852d 100644 --- a/third_party/blink/renderer/core/layout/scroll_anchor_test.cc +++ b/third_party/blink/renderer/core/layout/scroll_anchor_test.cc
@@ -4,6 +4,7 @@ #include "third_party/blink/renderer/core/layout/scroll_anchor.h" +#include "base/test/metrics/histogram_tester.h" #include "build/build_config.h" #include "third_party/blink/public/common/input/web_mouse_event.h" #include "third_party/blink/renderer/core/dom/static_node_list.h" @@ -19,7 +20,6 @@ #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" #include "third_party/blink/renderer/core/scroll/scroll_animator_base.h" #include "third_party/blink/renderer/core/testing/core_unit_test_helper.h" -#include "third_party/blink/renderer/platform/testing/histogram_tester.h" #include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" @@ -141,7 +141,7 @@ // TODO(ymalik): Currently, this should be the first test in the file to avoid // failure when running with other tests. Dig into this more and fix. TEST_P(ScrollAnchorTest, UMAMetricUpdated) { - HistogramTester histogram_tester; + base::HistogramTester histogram_tester; SetBodyInnerHTML(R"HTML( <style> body { height: 1000px } div { height: 100px } </style> <div id='block1'>abc</div> @@ -153,15 +153,10 @@ // Scroll position not adjusted, metric not updated. ScrollLayoutViewport(ScrollOffset(0, 150)); - histogram_tester.ExpectTotalCount("Layout.ScrollAnchor.AdjustedScrollOffset", - 0); histogram_tester.ExpectTotalCount( "Layout.ScrollAnchor.TimeToComputeAnchorNodeSelector", 0); - // Height changed, verify metric updated once. SetHeight(GetDocument().getElementById("block1"), 200); - histogram_tester.ExpectUniqueSample( - "Layout.ScrollAnchor.AdjustedScrollOffset", 1, 1); EXPECT_EQ(250, viewport->ScrollOffsetInt().Height()); EXPECT_EQ(GetDocument().getElementById("block2")->GetLayoutObject(), @@ -180,18 +175,10 @@ SerializedAnchor bad_anchor("##foobar", LayoutPoint(0, 0)); EXPECT_FALSE(GetScrollAnchor(LayoutViewport()).RestoreAnchor(bad_anchor)); - histogram_tester.ExpectBucketCount("Layout.ScrollAnchor.RestorationStatus", - ScrollAnchor::kFailedBadSelector, 1); - SerializedAnchor bad_anchor2("#bl", LayoutPoint(0, 0)); EXPECT_FALSE(GetScrollAnchor(LayoutViewport()).RestoreAnchor(bad_anchor2)); - histogram_tester.ExpectBucketCount("Layout.ScrollAnchor.RestorationStatus", - ScrollAnchor::kFailedNoMatches, 1); - SerializedAnchor bad_anchor3("script", LayoutPoint(0, -1000)); EXPECT_FALSE(GetScrollAnchor(LayoutViewport()).RestoreAnchor(bad_anchor3)); - histogram_tester.ExpectBucketCount("Layout.ScrollAnchor.RestorationStatus", - ScrollAnchor::kFailedNoValidMatches, 1); SerializedAnchor serialized_anchor("#block1", LayoutPoint(0, 0)); EXPECT_TRUE( @@ -199,8 +186,6 @@ histogram_tester.ExpectTotalCount("Layout.ScrollAnchor.TimeToRestoreAnchor", 4); - histogram_tester.ExpectBucketCount("Layout.ScrollAnchor.RestorationStatus", - ScrollAnchor::kSuccess, 1); } // TODO(skobes): Convert this to web-platform-tests when visual viewport API is
diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc index f1cd9f4..bf308749 100644 --- a/third_party/blink/renderer/core/loader/document_loader.cc +++ b/third_party/blink/renderer/core/loader/document_loader.cc
@@ -202,7 +202,6 @@ content_security_policy ? content_security_policy : MakeGarbageCollected<ContentSecurityPolicy>()), - was_blocked_by_csp_(!content_security_policy), // Loading the document was blocked by the CSP check. Pretend that this // was an empty document instead and don't reuse the original URL. More // details in: https://crbug.com/622385. @@ -214,13 +213,9 @@ // Note: this doesn't use |url_| for the origin calculation, because // redirects are not yet accounted for (this happens later in // StartLoadingInternal). - origin_to_commit_( - was_blocked_by_csp_ - ? blink::SecurityOrigin::Create(response_.CurrentRequestUrl()) - ->DeriveNewOpaqueOrigin() - : params_->origin_to_commit.IsNull() - ? nullptr - : params_->origin_to_commit.Get()->IsolatedCopy()), + origin_to_commit_(params_->origin_to_commit.IsNull() + ? nullptr + : params_->origin_to_commit.Get()->IsolatedCopy()), navigation_type_(navigation_type), document_load_timing_(*this), service_worker_network_provider_( @@ -300,7 +295,7 @@ if (is_client_redirect_) redirect_chain_.push_back(frame_->GetDocument()->Url()); - if (was_blocked_by_csp_ || was_blocked_by_document_policy_) + if (was_blocked_by_document_policy_) ReplaceWithEmptyDocument(); if (commit_reason_ != CommitReason::kInitialization) @@ -2018,16 +2013,6 @@ } void DocumentLoader::RecordConsoleMessagesForCommit() { - // Log if the document was blocked by CSP checks now that the new Document has - // been created and console messages will be properly displayed. - if (was_blocked_by_csp_) { - ConsoleError("Refused to display '" + - response_.CurrentRequestUrl().ElidedString() + - "' because it has not opted into the following policy " - "required by its embedder: '" + - GetFrameLoader().RequiredCSP() + "'."); - } - if (was_blocked_by_document_policy_) { // TODO(chenleihu): Add which document policy violated in error string, // instead of just displaying serialized required document policy.
diff --git a/third_party/blink/renderer/core/loader/document_loader.h b/third_party/blink/renderer/core/loader/document_loader.h index 91aceaf..3af4329 100644 --- a/third_party/blink/renderer/core/loader/document_loader.h +++ b/third_party/blink/renderer/core/loader/document_loader.h
@@ -484,7 +484,6 @@ bool data_received_; const Member<ContentSecurityPolicy> content_security_policy_; - const bool was_blocked_by_csp_; mojo::Remote<mojom::blink::ContentSecurityNotifier> content_security_notifier_;
diff --git a/third_party/blink/renderer/core/loader/frame_fetch_context.cc b/third_party/blink/renderer/core/loader/frame_fetch_context.cc index fd7c4f76..4469427c 100644 --- a/third_party/blink/renderer/core/loader/frame_fetch_context.cc +++ b/third_party/blink/renderer/core/loader/frame_fetch_context.cc
@@ -438,9 +438,6 @@ if (GetResourceFetcherProperties().IsDetached()) return; - // Record the latest requiredCSP value that will be used when sending this - // request. - GetFrame()->Loader().RecordLatestRequiredCSP(); GetFrame()->Loader().ModifyRequestForCSP( resource_request, &GetResourceFetcherProperties().GetFetchClientSettingsObject(),
diff --git a/third_party/blink/renderer/core/loader/frame_fetch_context_test.cc b/third_party/blink/renderer/core/loader/frame_fetch_context_test.cc index 5247e15..0efe39b 100644 --- a/third_party/blink/renderer/core/loader/frame_fetch_context_test.cc +++ b/third_party/blink/renderer/core/loader/frame_fetch_context_test.cc
@@ -273,7 +273,6 @@ protected: void ModifyRequestForCSP(ResourceRequest& resource_request, mojom::RequestContextFrameType frame_type) { - document->GetFrame()->Loader().RecordLatestRequiredCSP(); document->GetFrame()->Loader().ModifyRequestForCSP( resource_request, &document->Fetcher()->GetProperties().GetFetchClientSettingsObject(), @@ -353,21 +352,6 @@ EXPECT_EQ(expected_value, resource_request.IsAutomaticUpgrade()); } - void ExpectSetRequiredCSPRequestHeader( - const char* input, - mojom::RequestContextFrameType frame_type, - const AtomicString& expected_required_csp) { - const KURL input_url(input); - ResourceRequest resource_request(input_url); - resource_request.SetRequestContext( - mojom::blink::RequestContextType::SCRIPT); - - ModifyRequestForCSP(resource_request, frame_type); - - EXPECT_EQ(expected_required_csp, - resource_request.HttpHeaderField(http_names::kSecRequiredCSP)); - } - void SetFrameOwnerBasedOnFrameType(mojom::RequestContextFrameType frame_type, HTMLIFrameElement* iframe, const AtomicString& potential_value) { @@ -552,44 +536,6 @@ } } -TEST_F(FrameFetchContextModifyRequestTest, SendRequiredCSPHeader) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndDisableFeature(network::features::kOutOfBlinkCSPEE); - - struct TestCase { - const char* to_request; - mojom::RequestContextFrameType frame_type; - } tests[] = { - {"https://example.test/page.html", - mojom::RequestContextFrameType::kAuxiliary}, - {"https://example.test/page.html", - mojom::RequestContextFrameType::kNested}, - {"https://example.test/page.html", mojom::RequestContextFrameType::kNone}, - {"https://example.test/page.html", - mojom::RequestContextFrameType::kTopLevel}}; - - auto* iframe = MakeGarbageCollected<HTMLIFrameElement>(*document); - const AtomicString& required_csp = AtomicString("default-src 'none'"); - const AtomicString& another_required_csp = AtomicString("default-src 'self'"); - - for (const auto& test : tests) { - SetFrameOwnerBasedOnFrameType(test.frame_type, iframe, required_csp); - ExpectSetRequiredCSPRequestHeader( - test.to_request, test.frame_type, - test.frame_type == mojom::RequestContextFrameType::kNested - ? required_csp - : g_null_atom); - - SetFrameOwnerBasedOnFrameType(test.frame_type, iframe, - another_required_csp); - ExpectSetRequiredCSPRequestHeader( - test.to_request, test.frame_type, - test.frame_type == mojom::RequestContextFrameType::kNested - ? another_required_csp - : g_null_atom); - } -} - class FrameFetchContextHintsTest : public FrameFetchContextTest { public: FrameFetchContextHintsTest() = default;
diff --git a/third_party/blink/renderer/core/loader/frame_loader.cc b/third_party/blink/renderer/core/loader/frame_loader.cc index 01e6a52..0c4725a 100644 --- a/third_party/blink/renderer/core/loader/frame_loader.cc +++ b/third_party/blink/renderer/core/loader/frame_loader.cc
@@ -350,8 +350,7 @@ } void FrameLoader::DidExplicitOpen() { - probe::LifecycleEvent(frame_, GetDocumentLoader(), "init", - base::TimeTicks::Now().since_origin().InSecondsF()); + probe::DidOpenDocument(frame_, GetDocumentLoader()); if (empty_document_status_ == EmptyDocumentStatus::kOnlyEmpty) empty_document_status_ = EmptyDocumentStatus::kOnlyEmptyButExplicitlyOpened; @@ -761,10 +760,6 @@ origin_window->GetContentSecurityPolicy()); } - // Record the latest requiredCSP value that will be used when loading the - // document at navigation commit time. - RecordLatestRequiredCSP(); - // TODO(arthursonzogni): 'frame-src' check is disabled on the // renderer side, but is enforced on the browser side. // See http://crbug.com/692595 for understanding why it @@ -1020,8 +1015,6 @@ // with regards to the last commit. // In this rare case, we intentionally proceed as cross-document. - RecordLatestRequiredCSP(); - if (!CancelProvisionalLoaderForNewNavigation()) return; @@ -1042,6 +1035,8 @@ navigation_params->origin_policy, last_origin_window_csp_.Release(), commit_reason); + DCHECK(content_security_policy); + for (auto& csp : navigation_params->forced_content_security_policies) { content_security_policy->AddPolicyFromHeaderValue( csp, network::mojom::ContentSecurityPolicyType::kEnforce, @@ -1623,14 +1618,6 @@ const FetchClientSettingsObject* fetch_client_settings_object, LocalDOMWindow* window_for_logging, mojom::RequestContextFrameType frame_type) const { - if (!base::FeatureList::IsEnabled(network::features::kOutOfBlinkCSPEE) && - !RequiredCSP().IsEmpty()) { - DCHECK( - ContentSecurityPolicy::IsValidCSPAttr(RequiredCSP().GetString(), "")); - resource_request.SetHttpHeaderField(http_names::kSecRequiredCSP, - RequiredCSP()); - } - // Tack an 'Upgrade-Insecure-Requests' header to outgoing navigational // requests, as described in // https://w3c.github.io/webappsec-upgrade-insecure-requests/#feature-detect @@ -1721,11 +1708,6 @@ console_message)); } -void FrameLoader::RecordLatestRequiredCSP() { - required_csp_ = - frame_->Owner() ? frame_->Owner()->RequiredCsp() : g_null_atom; -} - std::unique_ptr<TracedValue> FrameLoader::ToTracedValue() const { auto traced_value = std::make_unique<TracedValue>(); traced_value->BeginDictionary("frame"); @@ -1829,35 +1811,6 @@ csp->CopyPluginTypesFrom(inherited_csp); } - // When the embedder used the 'required-csp', its embeddee must either: - // 1) Use the 'allow-csp' header for opting in inheriting them. - // 2) Ensure its own CSP subsume them, or it will be blocked. - // - // See: - // - https://w3c.github.io/webappsec-cspee/#required-csp-header - // - https://w3c.github.io/webappsec-cspee/#allow-csp-from-header - if (RequiredCSP().IsEmpty() || - base::FeatureList::IsEnabled(network::features::kOutOfBlinkCSPEE)) { - return csp; - } - - const SecurityOrigin* parent_security_origin = - frame_->Tree().Parent()->GetSecurityContext()->GetSecurityOrigin(); - if (parent_security_origin && - ContentSecurityPolicy::ShouldEnforceEmbeddersPolicy( - response, parent_security_origin)) { - csp->AddPolicyFromHeaderValue( - RequiredCSP(), network::mojom::ContentSecurityPolicyType::kEnforce, - network::mojom::ContentSecurityPolicySource::kHTTP); - } else { - auto* required_csp = MakeGarbageCollected<ContentSecurityPolicy>(); - required_csp->AddPolicyFromHeaderValue( - RequiredCSP(), network::mojom::ContentSecurityPolicyType::kEnforce, - network::mojom::ContentSecurityPolicySource::kHTTP); - if (!required_csp->Subsumes(*csp)) - return nullptr; // Document blocked. - } - return csp; }
diff --git a/third_party/blink/renderer/core/loader/frame_loader.h b/third_party/blink/renderer/core/loader/frame_loader.h index 0202103..646a6b68 100644 --- a/third_party/blink/renderer/core/loader/frame_loader.h +++ b/third_party/blink/renderer/core/loader/frame_loader.h
@@ -173,9 +173,6 @@ Frame* Opener(); void SetOpener(LocalFrame*); - const AtomicString& RequiredCSP() const { return required_csp_; } - void RecordLatestRequiredCSP(); - void Detach(); void FinishedParsing(); @@ -327,8 +324,6 @@ // confused by several navigations submitted in a row. Member<ContentSecurityPolicy> last_origin_window_csp_; - AtomicString required_csp_; - // The origins for which a legacy TLS version warning has been printed. The // size of this set is capped, after which no more warnings are printed. HashSet<String> tls_version_warning_origins_;
diff --git a/third_party/blink/renderer/core/loader/resource/script_resource.cc b/third_party/blink/renderer/core/loader/resource/script_resource.cc index 86112d3..9807de8 100644 --- a/third_party/blink/renderer/core/loader/resource/script_resource.cc +++ b/third_party/blink/renderer/core/loader/resource/script_resource.cc
@@ -256,9 +256,9 @@ CheckStreamingState(); CHECK(!ErrorOccurred()); - streamer_ = MakeGarbageCollected<ScriptStreamer>( - this, std::move(data_pipe), response_body_loader_client, - v8::ScriptCompiler::kNoCompileOptions, loader_task_runner); + streamer_ = MakeGarbageCollected<ScriptStreamer>(this, std::move(data_pipe), + response_body_loader_client, + loader_task_runner); CHECK_EQ(no_streamer_reason_, ScriptStreamer::NotStreamingReason::kInvalid); AdvanceStreamingState(StreamingState::kStreaming); }
diff --git a/third_party/blink/renderer/core/probe/core_probes.h b/third_party/blink/renderer/core/probe/core_probes.h index 2c0b2b9..789c6a3 100644 --- a/third_party/blink/renderer/core/probe/core_probes.h +++ b/third_party/blink/renderer/core/probe/core_probes.h
@@ -35,6 +35,7 @@ #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/ad_tracker.h" +#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/platform/loader/fetch/resource.h"
diff --git a/third_party/blink/renderer/core/probe/core_probes.json5 b/third_party/blink/renderer/core/probe/core_probes.json5 index b09f3779..f15a5dc7 100644 --- a/third_party/blink/renderer/core/probe/core_probes.json5 +++ b/third_party/blink/renderer/core/probe/core_probes.json5
@@ -104,6 +104,7 @@ "DidCloseAudioContext", "DidResumeAudioContext", "DidSuspendAudioContext", + "OnContentSecurityPolicyViolation", ] }, InspectorDOMSnapshotAgent: { @@ -190,6 +191,7 @@ "DidResizeMainFrame", "DidRunJavaScriptDialog", "DomContentLoadedEventFired", + "DidOpenDocument", "FileChooserOpened", "FrameAttachedToParent", "FrameClearedScheduledNavigation",
diff --git a/third_party/blink/renderer/core/probe/core_probes.pidl b/third_party/blink/renderer/core/probe/core_probes.pidl index a6d5f86b..2c6c58cc 100644 --- a/third_party/blink/renderer/core/probe/core_probes.pidl +++ b/third_party/blink/renderer/core/probe/core_probes.pidl
@@ -118,6 +118,7 @@ void WillCommitLoad([Keep] LocalFrame*, DocumentLoader*); void DidCommitLoad([Keep] LocalFrame*, DocumentLoader*); void DidNavigateWithinDocument([Keep] LocalFrame*); + void DidOpenDocument([Keep] LocalFrame*, DocumentLoader*); void FrameDocumentUpdated([Keep] LocalFrame*); void FrameOwnerContentUpdated([Keep] LocalFrame*, HTMLFrameOwnerElement*); void FrameStartedLoading([Keep] LocalFrame*); @@ -185,4 +186,5 @@ void LocalFontsEnabled(ExecutionContext*, bool* result); void DidUpdateComputedStyle([Keep] Element*, const ComputedStyle* old_style, const ComputedStyle* new_style); void GetDisabledImageTypes(ExecutionContext*, HashSet<String>* result); + void OnContentSecurityPolicyViolation(ExecutionContext* context, const blink::ContentSecurityPolicy::ContentSecurityPolicyViolationType violationType); }
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_type_policy_factory.cc b/third_party/blink/renderer/core/trustedtypes/trusted_type_policy_factory.cc index 2682e853..582a14d0 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_type_policy_factory.cc +++ b/third_party/blink/renderer/core/trustedtypes/trusted_type_policy_factory.cc
@@ -15,6 +15,7 @@ #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" #include "third_party/blink/renderer/core/frame/local_frame.h" +#include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/core/trustedtypes/trusted_type_policy.h" #include "third_party/blink/renderer/core/trustedtypes/trusted_types_util.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" @@ -56,6 +57,15 @@ ->AllowTrustedTypePolicy( policy_name, policy_map_.Contains(policy_name), violation_details); + if (violation_details != ContentSecurityPolicy::ContentSecurityPolicy:: + AllowTrustedTypePolicyDetails::kAllowed) { + // We may report a violation here even when disallowed is false + // in case policy is a report-only one. + probe::OnContentSecurityPolicyViolation( + GetExecutionContext(), + ContentSecurityPolicy::ContentSecurityPolicyViolationType:: + kTrustedTypesPolicyViolation); + } if (disallowed) { // For a better error message, we'd like to disambiguate between // "disallowed" and "disallowed because of a duplicate name".
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_types_util.cc b/third_party/blink/renderer/core/trustedtypes/trusted_types_util.cc index 29586e78..2aeec43 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_types_util.cc +++ b/third_party/blink/renderer/core/trustedtypes/trusted_types_util.cc
@@ -14,6 +14,7 @@ #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" #include "third_party/blink/renderer/core/inspector/console_message.h" +#include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/core/script/script_element_base.h" #include "third_party/blink/renderer/core/trustedtypes/trusted_html.h" #include "third_party/blink/renderer/core/trustedtypes/trusted_script.h" @@ -194,6 +195,10 @@ mojom::blink::ConsoleMessageLevel::kInfo, kFunctionConstructorFailureConsoleMessage)); } + probe::OnContentSecurityPolicyViolation( + const_cast<ExecutionContext*>(execution_context), + ContentSecurityPolicy::ContentSecurityPolicyViolationType:: + kTrustedTypesSinkViolation); if (!allow) { exception_state.ThrowTypeError(GetMessage(kind));
diff --git a/third_party/blink/renderer/modules/BUILD.gn b/third_party/blink/renderer/modules/BUILD.gn index 5f15c06..cd50e62 100644 --- a/third_party/blink/renderer/modules/BUILD.gn +++ b/third_party/blink/renderer/modules/BUILD.gn
@@ -561,6 +561,21 @@ ] } + fuzzer_test("sanitizer_api_fuzzer") { + sources = [ "sanitizer_api/sanitizer_api_fuzzer.cc" ] + deps = [ + ":modules", + "//third_party/blink/renderer/bindings/modules/v8:bindings_modules_impl_generated", + "//third_party/blink/renderer/controller:blink_bindings_test_sources", + "//third_party/blink/renderer/core:testing", + "//third_party/blink/renderer/modules/sanitizer_api:sanitizer_config_proto", + "//third_party/blink/renderer/platform:blink_fuzzer_test_support", + "//third_party/libprotobuf-mutator", + "//third_party/protobuf:protobuf_lite", + ] + dict = "sanitizer_api/sanitizer_api.dict" + } + fuzzer_test("webcodecs_video_decoder_fuzzer") { sources = [ "webcodecs/fuzzer_utils.cc",
diff --git a/third_party/blink/renderer/modules/clipboard/clipboard_reader.h b/third_party/blink/renderer/modules/clipboard/clipboard_reader.h index af847af..8ac8767 100644 --- a/third_party/blink/renderer/modules/clipboard/clipboard_reader.h +++ b/third_party/blink/renderer/modules/clipboard/clipboard_reader.h
@@ -20,8 +20,10 @@ // Reading a type from the system clipboard to a Blob is accomplished by: // (1) Reading - the format from the system clipboard. // (2) Encoding - the system clipboard's contents for a format. Encoding may be -// time-consuming, and so is done on a background thread whenever possible. -// (3) Writing - the decoded contents to a Blob. +// time-consuming, so it is done on a background thread whenever possible. +// An example where encoding is done on the main thread is HTML, where +// Blink's HTML encoder can only be used on the main thread. +// (3) Writing - the encoded contents to a Blob. // // ClipboardReader takes as input a ClipboardPromise, from which it expects // a clipboard format, and to which it provides a Blob containing an encoded @@ -59,9 +61,12 @@ virtual void NextRead(Vector<uint8_t> utf8_bytes) = 0; SystemClipboard* system_clipboard() { return system_clipboard_; } - // This ClipboardPromise owns this ClipboardReader. + // This ClipboardPromise owns this ClipboardReader. Subclasses use `promise_` + // to report the Blob output, or to obtain the execution context. Member<ClipboardPromise> promise_; + // Every subclass method that runs on the main thread should + // DCHECK_CALLED_ON_VALID_SEQUENCE with this checker. SEQUENCE_CHECKER(sequence_checker_); private:
diff --git a/third_party/blink/renderer/modules/clipboard/clipboard_writer.cc b/third_party/blink/renderer/modules/clipboard/clipboard_writer.cc index cec4830..23056c6 100644 --- a/third_party/blink/renderer/modules/clipboard/clipboard_writer.cc +++ b/third_party/blink/renderer/modules/clipboard/clipboard_writer.cc
@@ -28,7 +28,7 @@ namespace { // anonymous namespace for ClipboardWriter's derived classes. -// Writes a blob with image/png content to the System Clipboard. +// Writes a Blob with image/png content to the System Clipboard. class ClipboardImageWriter final : public ClipboardWriter { public: ClipboardImageWriter(SystemClipboard* system_clipboard, @@ -59,7 +59,7 @@ true, ImageDecoder::kAlphaPremultiplied, ImageDecoder::kDefaultBitDepth, ColorBehavior::Tag()); sk_sp<SkImage> image = nullptr; - // |decoder| is nullptr if |png_data| doesn't begin with the PNG signature. + // `decoder` is nullptr if `png_data` doesn't begin with the PNG signature. if (decoder) image = ImageBitmap::GetSkImageFromDecoder(std::move(decoder)); @@ -81,7 +81,7 @@ } }; -// Writes a blob with text/plain content to the System Clipboard. +// Writes a Blob with text/plain content to the System Clipboard. class ClipboardTextWriter final : public ClipboardWriter { public: ClipboardTextWriter(SystemClipboard* system_clipboard, @@ -173,8 +173,6 @@ ~ClipboardSvgWriter() override = default; private: - // This must be called on the main thread because XML DOM nodes can - // only be used on the main thread void StartWrite( DOMArrayBuffer* svg_data, scoped_refptr<base::SingleThreadTaskRunner> task_runner) override { @@ -184,7 +182,8 @@ String::FromUTF8(reinterpret_cast<const LChar*>(svg_data->Data()), svg_data->ByteLength()); - // Now sanitize the SVG string. + // Sanitizing on the main thread because SVG/XML DOM nodes can only be used + // on the main thread. KURL url; unsigned fragment_start = 0; unsigned fragment_end = svg_string.length(); @@ -204,7 +203,7 @@ } }; -// Writes a blob with arbitrary, unsanitized content to the System Clipboard. +// Writes a Blob with arbitrary, unsanitized content to the System Clipboard. class ClipboardRawDataWriter final : public ClipboardWriter { public: ClipboardRawDataWriter(RawSystemClipboard* raw_system_clipboard,
diff --git a/third_party/blink/renderer/modules/clipboard/clipboard_writer.h b/third_party/blink/renderer/modules/clipboard/clipboard_writer.h index 2ca24aa3..3a03782 100644 --- a/third_party/blink/renderer/modules/clipboard/clipboard_writer.h +++ b/third_party/blink/renderer/modules/clipboard/clipboard_writer.h
@@ -19,15 +19,33 @@ class SystemClipboard; class RawSystemClipboard; -// Interface for writing async-clipboard-compatible types as a Blob to the -// System Clipboard, asynchronously. +// Interface for writing an individual Clipboard API format as a Blob to the +// System Clipboard, safely and asynchronously. +// +// ClipboardWriter takes as input a ClipboardPromise, which manages writing +// multiple formats and passes in unsanitized clipboard payloads. +// ClipboardWriter then sanitizes a Blob payload and writes it onto the +// underlying system clipboard. All System Clipboard operations should be +// called from the main thread. // // Writing a Blob's data to the system clipboard is accomplished by: -// (1) Reading the blob's contents using a FileReaderLoader. -// (2) Decoding the blob's contents to avoid RCE in native applications that may -// take advantage of vulnerabilities in their decoders. In -// ClipboardRawDataWriter, this decoding is skipped. -// (3) Writing the blob's decoded contents to the system clipboard. +// (1) Reading - the Blob's contents using a FileReaderLoader. +// (2) Decoding - or sanitizing the Blob's contents to avoid RCE in native +// applications that may take advantage of vulnerabilities in their +// decoders, whenever possible. Decoding may be time-consuming, so it +// is done on a background thread whenever possible. An example where +// decoding is done on the main thread is HTML, where Blink's HTML decoder +// can only be used on the main thread. +// (3) Writing - the Blob's decoded contents to the system clipboard. +// +// Subclasses of ClipboardWriter should be implemented for each supported +// format. Subclasses should: +// (1) Begin execution by implementing ClipboardWriter::StartWrite(). +// (2) Decode the payload on a background thread (if possible) by implementing +// a static DecodeOnBackgroundThread() function. This function is called by +// StartWrite() via worker_pool::PostTask(). +// (3) Write the decoded content to the system clipboard by implementing +// ClipboardWriter::Write(); // // ClipboardWriter is owned only by itself and ClipboardPromise. It keeps // itself alive for the duration of FileReaderLoader's async operations using @@ -36,20 +54,23 @@ class ClipboardWriter : public GarbageCollected<ClipboardWriter>, public FileReaderLoaderClient { public: + // For writing sanitized MIME types. static ClipboardWriter* Create(SystemClipboard* system_clipboard, const String& mime_type, ClipboardPromise* promise); + // For writing unsanitized types. static ClipboardWriter* Create(RawSystemClipboard* raw_system_clipboard, const String& mime_type, ClipboardPromise* promise); - static ClipboardWriter* Create(SystemClipboard* system_clipboard, - const String& mime_type, - ClipboardPromise* promise, - LocalFrame* frame); ~ClipboardWriter() override; - static bool IsValidType(const String& type, bool is_raw); - void WriteToSystem(Blob*); + // Returns whether ClipboardWriter has implemented support for this type. + // + // If this API returns false for a `mime_type`, Create() must not be called + // with that `mime_type`. + static bool IsValidType(const String& mime_type, bool is_raw); + // Begins the sequence of writing the Blob to the system clipbaord. + void WriteToSystem(Blob* blob); // FileReaderLoaderClient. void DidStartLoading() override; @@ -69,15 +90,18 @@ virtual void StartWrite( DOMArrayBuffer* raw_data, scoped_refptr<base::SingleThreadTaskRunner> task_runner) = 0; - // This ClipboardPromise owns this ClipboardWriter. - Member<ClipboardPromise> promise_; - - // Ensure that System Clipboard operations occur on the main thread. - SEQUENCE_CHECKER(sequence_checker_); SystemClipboard* system_clipboard() { return system_clipboard_; } RawSystemClipboard* raw_system_clipboard() { return raw_system_clipboard_; } + // This ClipboardPromise owns this ClipboardWriter. Subclasses use `promise_` + // to report success or failure, or to obtain the execution context. + Member<ClipboardPromise> promise_; + + // Every subclass method that runs on the main thread should + // DCHECK_CALLED_ON_VALID_SEQUENCE with this checker. + SEQUENCE_CHECKER(sequence_checker_); + private: ClipboardWriter(SystemClipboard* system_clipboard, RawSystemClipboard* raw_system_clipboard,
diff --git a/third_party/blink/renderer/modules/csspaint/paint_worklet_proxy_client.cc b/third_party/blink/renderer/modules/csspaint/paint_worklet_proxy_client.cc index bd7c861..8620797 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_worklet_proxy_client.cc +++ b/third_party/blink/renderer/modules/csspaint/paint_worklet_proxy_client.cc
@@ -220,7 +220,8 @@ animated_property_values) { for (const auto& property_value : animated_property_values) { DCHECK(property_value.second.has_value()); - String property_name(property_value.first.c_str()); + String property_name( + property_value.first.custom_property_name.value().c_str()); DCHECK(style_map->StyleMapData().Contains(property_name)); CrossThreadStyleValue* old_value = style_map->StyleMapData().at(property_name);
diff --git a/third_party/blink/renderer/modules/sanitizer_api/BUILD.gn b/third_party/blink/renderer/modules/sanitizer_api/BUILD.gn index 2232023..9f3163b 100644 --- a/third_party/blink/renderer/modules/sanitizer_api/BUILD.gn +++ b/third_party/blink/renderer/modules/sanitizer_api/BUILD.gn
@@ -3,6 +3,8 @@ # found in the LICENSE file. import("//third_party/blink/renderer/modules/modules.gni") +import("//third_party/libprotobuf-mutator/fuzzable_proto_library.gni") +import("//third_party/protobuf/proto_library.gni") blink_modules_sources("sanitizer_api") { sources = [ @@ -10,3 +12,8 @@ "sanitizer.h", ] } +if (use_libfuzzer) { + fuzzable_proto_library("sanitizer_config_proto") { + sources = [ "sanitizer_config.proto" ] + } +}
diff --git a/third_party/blink/renderer/modules/sanitizer_api/DEPS b/third_party/blink/renderer/modules/sanitizer_api/DEPS new file mode 100644 index 0000000..79fef16 --- /dev/null +++ b/third_party/blink/renderer/modules/sanitizer_api/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+testing/libfuzzer/proto/lpm_interface.h", +]
diff --git a/third_party/blink/renderer/modules/sanitizer_api/sanitizer_api.dict b/third_party/blink/renderer/modules/sanitizer_api/sanitizer_api.dict new file mode 100644 index 0000000..e28e042 --- /dev/null +++ b/third_party/blink/renderer/modules/sanitizer_api/sanitizer_api.dict
@@ -0,0 +1,30 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file + +" " +"<" +">" +"//" +"," +"'" +"{" +"}" +"[" +"]" +"*" +"script" +"div" +"body" +"html" +"svg" +"a" +"src" +"id" +"style" +"title" +"frame" +"iframe" +"video" +"audio" +"template"
diff --git a/third_party/blink/renderer/modules/sanitizer_api/sanitizer_api_fuzzer.cc b/third_party/blink/renderer/modules/sanitizer_api/sanitizer_api_fuzzer.cc new file mode 100644 index 0000000..51aa7086 --- /dev/null +++ b/third_party/blink/renderer/modules/sanitizer_api/sanitizer_api_fuzzer.cc
@@ -0,0 +1,94 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "sanitizer.h" + +#include "testing/libfuzzer/proto/lpm_interface.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" +#include "third_party/blink/renderer/bindings/modules/v8/string_or_document_fragment_or_document.h" +#include "third_party/blink/renderer/bindings/modules/v8/string_or_trusted_html_or_document_fragment_or_document.h" +#include "third_party/blink/renderer/bindings/modules/v8/v8_sanitizer_config.h" +#include "third_party/blink/renderer/core/frame/local_dom_window.h" +#include "third_party/blink/renderer/core/testing/dummy_page_holder.h" +#include "third_party/blink/renderer/modules/sanitizer_api/sanitizer_config.pb.h" +#include "third_party/blink/renderer/platform/bindings/exception_state.h" +#include "third_party/blink/renderer/platform/heap/handle.h" +#include "third_party/blink/renderer/platform/heap/thread_state.h" +#include "third_party/blink/renderer/platform/testing/blink_fuzzer_test_support.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" +#include "third_party/blink/renderer/platform/wtf/vector.h" + +namespace blink { + +Vector<String> ToVector( + const google::protobuf::RepeatedPtrField<std::string>& inputs) { + Vector<String> elements; + for (auto i : inputs) { + elements.push_back(i.c_str()); + } + return elements; +} + +void MakeConfiguration(SanitizerConfig* sanitizer_config, + const SanitizerConfigProto& proto) { + if (proto.allow_elements_size()) { + sanitizer_config->setAllowElements(ToVector(proto.allow_elements())); + } + if (proto.block_elements_size()) { + sanitizer_config->setBlockElements(ToVector(proto.block_elements())); + } + if (proto.drop_elements_size()) { + sanitizer_config->setDropElements(ToVector(proto.drop_elements())); + } + if (proto.allow_attributes_size()) { + Vector<std::pair<String, Vector<String>>> allow_attributes; + for (auto i : proto.allow_attributes()) { + allow_attributes.push_back(std::pair<String, Vector<String>>( + i.first.c_str(), ToVector(i.second.element()))); + } + sanitizer_config->setAllowAttributes(allow_attributes); + } + if (proto.drop_attributes_size()) { + Vector<std::pair<String, Vector<String>>> drop_attributes; + for (auto i : proto.drop_attributes()) { + drop_attributes.push_back(std::pair<String, Vector<String>>( + i.first.c_str(), ToVector(i.second.element()))); + } + sanitizer_config->setDropAttributes(drop_attributes); + } +} + +DEFINE_TEXT_PROTO_FUZZER(const SanitizerConfigProto& proto) { + static BlinkFuzzerTestSupport test_support = BlinkFuzzerTestSupport(); + // Scope cannot be created before BlinkFuzzerTestSupport because it requires + // that Oilpan be initialized to access blink::ThreadState::Current. + LEAK_SANITIZER_DISABLED_SCOPE; + static DummyPageHolder* g_page_holder = new DummyPageHolder(); + + ScriptState* script_state = + ToScriptStateForMainWorld(&g_page_holder->GetFrame()); + + // Create random Sanitizer. + auto* sanitizer_config = MakeGarbageCollected<SanitizerConfig>(); + MakeConfiguration(sanitizer_config, proto); + auto* sanitizer = MakeGarbageCollected<Sanitizer>(sanitizer_config); + + // Sanitize random strings. + StringOrTrustedHTMLOrDocumentFragmentOrDocument str1 = + StringOrTrustedHTMLOrDocumentFragmentOrDocument::FromString( + proto.html_string().c_str()); + sanitizer->sanitize(script_state, str1, IGNORE_EXCEPTION_FOR_TESTING); + + StringOrDocumentFragmentOrDocument str2 = + StringOrDocumentFragmentOrDocument::FromString( + proto.html_string().c_str()); + sanitizer->sanitizeToString(script_state, str2, IGNORE_EXCEPTION_FOR_TESTING); + + // Request a garbage collection. + ThreadState::Current()->CollectAllGarbageForTesting( + BlinkGC::kNoHeapPointersOnStack); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/modules/sanitizer_api/sanitizer_config.proto b/third_party/blink/renderer/modules/sanitizer_api/sanitizer_config.proto new file mode 100644 index 0000000..2cb47ce --- /dev/null +++ b/third_party/blink/renderer/modules/sanitizer_api/sanitizer_config.proto
@@ -0,0 +1,17 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +syntax = "proto2"; + +message SanitizerConfigProto { + message Elements { repeated string element = 1; } + repeated string allow_elements = 1; + repeated string block_elements = 2; + repeated string drop_elements = 3; + + map<string, Elements> allow_attributes = 4; + map<string, Elements> drop_attributes = 5; + + required string html_string = 6; +}
diff --git a/third_party/blink/renderer/platform/network/http_names.json5 b/third_party/blink/renderer/platform/network/http_names.json5 index 345bf46..087a389 100644 --- a/third_party/blink/renderer/platform/network/http_names.json5 +++ b/third_party/blink/renderer/platform/network/http_names.json5
@@ -62,7 +62,6 @@ "Require-Document-Policy", "Save-Data", "Sec-CH-Lang", - "Sec-Required-CSP", "Server-Timing", "SourceMap", "Timing-Allow-Origin",
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 8682501..e5ff21dd 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -338,6 +338,9 @@ status: "experimental", }, { + name: "ClickPointerEventIntegerCoordinates", + }, + { name: "ClickRetargetting", status: "experimental", },
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index b94820e..12dd94c 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -81,6 +81,7 @@ crbug.com/901056 virtual/synchronous_html_parser/http/tests/inspector-protocol/issues/mixed-content-issue-creation-css.js [ Timeout ] crbug.com/901056 virtual/synchronous_html_parser/http/tests/inspector-protocol/issues/mixed-content-issue-creation-js-within-iframe.js [ Timeout ] crbug.com/901056 virtual/synchronous_html_parser/http/tests/inspector-protocol/issues/mixed-content-issue-creation-js.js [ Timeout ] +crbug.com/901056 virtual/synchronous_html_parser/http/tests/inspector-protocol/page/iframe-src-write-delay.js [ Pass Failure Timeout ] # Minor issues, need rebaselining crbug.com/901056 virtual/synchronous_html_parser/fast/css/focus-display-block-inline.html [ Failure ] crbug.com/901056 virtual/synchronous_html_parser/fast/css/fontfaceset-multiple-families.html [ Failure ] @@ -5669,6 +5670,9 @@ # Temporarily disable test to allow devtools-frontend changes crbug.com/1095733 http/tests/devtools/tabbed-pane-closeable-persistence.js [ Skip ] +crbug.com/1144127 http/tests/devtools/modules-load-elements.js [ Pass Failure ] +crbug.com/1144127 http/tests/devtools/modules-load-network.js [ Pass Failure ] +crbug.com/1144127 http/tests/devtools/console/console-xpath.js [ Pass Failure ] # Sheriff 2020-06-17 crbug.com/1095969 [ Mac ] fast/canvas/OffscreenCanvas-MessageChannel-transfer.html [ Pass Failure ] @@ -5979,10 +5983,6 @@ crbug.com/1144273 http/tests/devtools/sources/debugger-ui/continue-to-location-markers-in-top-level-function.js [ Pass Failure Timeout ] crbug.com/1145742 [ Fuchsia ] virtual/stable/http/tests/navigation/location-assign-adds-history-item.html [ Pass Crash Timeout ] -# Disabled until CL with fix gets merged https://chromium-review.googlesource.com/c/chromium/src/+/2504259 -crbug.com/1127115 inspector-protocol/runtime/runtime-console-log-node-letter-case.js [ Failure ] -crbug.com/1127115 inspector-protocol/runtime/runtime-console-log-node-document-type.js [ Failure ] - # Sheriff 2020-11-06 crbug.com/1146560 [ Win ] fast/canvas/color-space/canvas-createImageBitmap-e_srgb.html [ Failure Pass ]
diff --git a/third_party/blink/web_tests/VirtualTestSuites b/third_party/blink/web_tests/VirtualTestSuites index ac11976..2d21a7f4 100644 --- a/third_party/blink/web_tests/VirtualTestSuites +++ b/third_party/blink/web_tests/VirtualTestSuites
@@ -708,11 +708,6 @@ "args": ["--disable-features=LinkDisabledNewSpecBehavior"] }, { - "prefix": "out-of-blink-cspee", - "bases": [ "external/wpt/content-security-policy/embedded-enforcement" ], - "args": [ "--disable-features=OutOfBlinkCSPEE" ] - }, - { "prefix": "policy-container", "bases": [ "external/wpt/referrer-policy", "fast/dom/DOMImplementation" ],
diff --git a/third_party/blink/web_tests/external/wpt/fetch/api/cors/cors-preflight-referrer.any.js b/third_party/blink/web_tests/external/wpt/fetch/api/cors/cors-preflight-referrer.any.js index 6d69b32..5df9fcf 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/api/cors/cors-preflight-referrer.any.js +++ b/third_party/blink/web_tests/external/wpt/fetch/api/cors/cors-preflight-referrer.any.js
@@ -35,8 +35,11 @@ corsPreflightReferrer("Referrer policy: no-referrer", corsUrl, "no-referrer", undefined, ""); corsPreflightReferrer("Referrer policy: no-referrer", corsUrl, "no-referrer", "myreferrer", ""); -corsPreflightReferrer("Referrer policy: \"\"", corsUrl, "", undefined, location.toString()) -corsPreflightReferrer("Referrer policy: \"\"", corsUrl, "", "myreferrer", new URL("myreferrer", location).toString()); +corsPreflightReferrer("Referrer policy: \"\"", corsUrl, "", undefined, origin); +corsPreflightReferrer("Referrer policy: \"\"", corsUrl, "", "myreferrer", origin); + +corsPreflightReferrer("Referrer policy: no-referrer-when-downgrade", corsUrl, "no-referrer-when-downgrade", undefined, location.toString()) +corsPreflightReferrer("Referrer policy: no-referrer-when-downgrade", corsUrl, "no-referrer-when-downgrade", "myreferrer", new URL("myreferrer", location).toString()); corsPreflightReferrer("Referrer policy: origin", corsUrl, "origin", undefined, origin); corsPreflightReferrer("Referrer policy: origin", corsUrl, "origin", "myreferrer", origin);
diff --git a/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-src-about-blank.html b/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-src-about-blank.html index 0f8a633f..479019d 100644 --- a/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-src-about-blank.html +++ b/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-src-about-blank.html
@@ -6,12 +6,14 @@ <div id=log></div> <iframe></iframe> <script> - setup({ single_test: true }); + setup({ + single_test: true + }); onload = function() { var fr = document.querySelector("iframe") fr.src = "about:blank" fr.onload = function() { - assert_equals(fr.contentDocument.referrer, document.URL) + assert_equals(fr.contentDocument.referrer, document.location.origin + '/') done() } }
diff --git a/third_party/blink/web_tests/external/wpt/html/browsers/windows/browsing-context.html b/third_party/blink/web_tests/external/wpt/html/browsers/windows/browsing-context.html index 430598f..b2900d3 100644 --- a/third_party/blink/web_tests/external/wpt/html/browsers/windows/browsing-context.html +++ b/third_party/blink/web_tests/external/wpt/html/browsers/windows/browsing-context.html
@@ -40,7 +40,7 @@ }, "Check that new document nodes extant, empty"); test(function () { - assert_equals(doc.referrer, document.URL, "The document's referrer should be its creator document's address."); + assert_equals(doc.referrer, document.location.origin + '/', "The document's referrer should be its creator document's origin."); assert_equals(iframe.contentWindow.parent.document, document); }, "Check the document properties corresponding to the creator browsing context"); </script>
diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/access-from-coop-page-to-opener_coop-ro_cross-origin.https.html b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/access-from-coop-page-to-opener_coop-ro_cross-origin.https.html index 2c78d01..6755ffa5 100644 --- a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/access-from-coop-page-to-opener_coop-ro_cross-origin.https.html +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/access-from-coop-page-to-opener_coop-ro_cross-origin.https.html
@@ -22,7 +22,7 @@ const report_token = token(); const openee_token = token(); - const opener_url = location.href; + const opener_origin = location.origin + '/'; const reportTo = reportToHeaders(report_token); const openee_url = cross_origin + executor_path + @@ -52,7 +52,7 @@ assert_equals(report.body.openerURL, ""); assert_equals(report.body.openeeURL, undefined); assert_equals(report.body.otherDocumentURL, undefined); - assert_equals(report.body.referrer, opener_url); + assert_equals(report.body.referrer, opener_origin); assert_equals(report.body.initialPopupURL, undefined); }, name);
diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/access-to-coop-page-from-opener_coop-ro_cross-origin.https.html b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/access-to-coop-page-from-opener_coop-ro_cross-origin.https.html index 1ed7c3a..19e794dc 100644 --- a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/access-to-coop-page-from-opener_coop-ro_cross-origin.https.html +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/access-to-coop-page-from-opener_coop-ro_cross-origin.https.html
@@ -23,7 +23,7 @@ const openee_token = token(); const opener_token = token(); // The current test window. - const opener_url = location.href; + const opener_origin = location.origin + '/'; const reportTo = reportToHeaders(report_token); const openee_url = cross_origin + executor_path + @@ -59,7 +59,7 @@ assert_equals(report.body.openerURL, ""); assert_equals(report.body.openeeURL, undefined); assert_equals(report.body.otherDocumentURL, undefined); - assert_equals(report.body.referrer, opener_url); + assert_equals(report.body.referrer, opener_origin); assert_equals(report.body.initialPopupURL, undefined); }, name);
diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin.https.html b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin.https.html index 2fa4e02..7c891bd0 100644 --- a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin.https.html +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin.https.html
@@ -31,7 +31,7 @@ "disposition": "enforce", "effectivePolicy": "same-origin", "previousResponseURL": "", - "referrer": `${location.href}`, // referrer + "referrer": `${location.origin}/`, // referrer "type": "navigation-to-response" }, "url": /uuid=EXECUTOR_UUID$/, @@ -84,7 +84,7 @@ "body": { "disposition": "enforce", "previousResponseURL": "", - "referrer": `${location.href}`, // referrer + "referrer": `${location.origin}/`, // referrer "type": "navigation-to-response" }, "url": /uuid=EXECUTOR_UUID$/,
diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https.html b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https.html index 05bb150..b6f429c 100644 --- a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https.html +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https.html
@@ -109,7 +109,7 @@ "disposition": "enforce", "effectivePolicy": "same-origin", "previousResponseURL": ``, - "referrer": `${location.href}`, // referrer + "referrer": `${location.origin}/`, // referrer "type": "navigation-to-response" }, "url": /uuid=EXECUTOR_UUID$/,
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/a-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/a-tag.http.html index 2641813..5e2f9f55 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/a-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/a-tag.http.html
@@ -16,26 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "no-redirect", "source_context_list": [], @@ -43,16 +23,6 @@ "subresource": "a-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-https origin and no-redirect redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/fetch.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/fetch.http.html index 8f682e68..74334b36 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/fetch.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/fetch.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "fetch", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/iframe-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/iframe-tag.http.html index 31111c3..569b0ac 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/iframe-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/iframe-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "iframe-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/img-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/img-tag.http.html index 5985002..e04c767 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/img-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/img-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "img-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/script-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/script-tag.http.html index 4a62f71b..ca1042d 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/script-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/script-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "script-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/xhr.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/xhr.http.html index 95ef48c..7814f34 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/xhr.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.http-rp/unset/xhr.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "xhr", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/a-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/a-tag.http.html index 2641813..5e2f9f55 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/a-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/a-tag.http.html
@@ -16,26 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "no-redirect", "source_context_list": [], @@ -43,16 +23,6 @@ "subresource": "a-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-https origin and no-redirect redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/fetch.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/fetch.http.html index 8f682e68..74334b36 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/fetch.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/fetch.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "fetch", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/iframe-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/iframe-tag.http.html index 31111c3..569b0ac 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/iframe-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/iframe-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "iframe-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/img-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/img-tag.http.html index 5985002..e04c767 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/img-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/img-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "img-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/script-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/script-tag.http.html index 4a62f71b..ca1042d 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/script-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/script-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "script-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/xhr.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/xhr.http.html index 95ef48c..7814f34 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/xhr.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K+1/gen/top.meta/unset/xhr.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "xhr", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/a-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/a-tag.http.html index 19c5551..570a250 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/a-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/a-tag.http.html
@@ -16,26 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "no-redirect", "source_context_list": [], @@ -43,16 +23,6 @@ "subresource": "a-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-https origin and no-redirect redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/fetch.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/fetch.http.html index d0cb720..2b840d4 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/fetch.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/fetch.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "fetch", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/iframe-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/iframe-tag.http.html index fbb87846..cf60592 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/iframe-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/iframe-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "iframe-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/img-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/img-tag.http.html index 1433505..111862a 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/img-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/img-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "img-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/script-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/script-tag.http.html index 0e7bad7..abdb1951 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/script-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/script-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "script-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/xhr.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/xhr.http.html index 81df08c..b0bcb0a9 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/xhr.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.http-rp/unset/xhr.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "xhr", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/a-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/a-tag.http.html index 19c5551..570a250 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/a-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/a-tag.http.html
@@ -16,26 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "no-redirect", "source_context_list": [], @@ -43,16 +23,6 @@ "subresource": "a-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-https origin and no-redirect redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/fetch.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/fetch.http.html index d0cb720..2b840d4 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/fetch.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/fetch.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "fetch", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/iframe-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/iframe-tag.http.html index fbb87846..cf60592 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/iframe-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/iframe-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "iframe-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/img-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/img-tag.http.html index 1433505..111862a 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/img-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/img-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "img-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/script-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/script-tag.http.html index 0e7bad7..abdb1951 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/script-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/script-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "script-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/xhr.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/xhr.http.html index 81df08c..b0bcb0a9 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/xhr.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K-1/gen/top.meta/unset/xhr.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "xhr", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/a-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/a-tag.http.html index 55a4ab5..14f57e9 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/a-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/a-tag.http.html
@@ -16,26 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "no-redirect", "source_context_list": [], @@ -43,16 +23,6 @@ "subresource": "a-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-https origin and no-redirect redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/fetch.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/fetch.http.html index f766c2d..f382044 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/fetch.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/fetch.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "fetch", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/iframe-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/iframe-tag.http.html index 213d16b..45a6cbc9 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/iframe-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/iframe-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "iframe-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/img-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/img-tag.http.html index 2b3587e8..00f7e69 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/img-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/img-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "img-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/script-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/script-tag.http.html index 888ef81..c498ec6 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/script-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/script-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "script-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/xhr.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/xhr.http.html index 6b16811..4bbf83c 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/xhr.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.http-rp/unset/xhr.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "xhr", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/a-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/a-tag.http.html index 55a4ab5..14f57e9 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/a-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/a-tag.http.html
@@ -16,26 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "no-redirect", "source_context_list": [], @@ -43,16 +23,6 @@ "subresource": "a-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-https origin and no-redirect redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/fetch.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/fetch.http.html index f766c2d..f382044 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/fetch.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/fetch.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "fetch", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/iframe-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/iframe-tag.http.html index 213d16b..45a6cbc9 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/iframe-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/iframe-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "iframe-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/img-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/img-tag.http.html index 2b3587e8..00f7e69 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/img-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/img-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "img-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/script-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/script-tag.http.html index 888ef81..c498ec6 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/script-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/script-tag.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "script-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/xhr.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/xhr.http.html index 6b16811..4bbf83c 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/xhr.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/4K/gen/top.meta/unset/xhr.http.html
@@ -16,66 +16,6 @@ [ { "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "cross-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", "origin": "same-http", "redirection": "keep-origin", "source_context_list": [], @@ -93,46 +33,6 @@ "subresource": "xhr", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/a-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/a-tag.http.html index e50b1f6..6f6e891 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/a-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/a-tag.http.html
@@ -15,7 +15,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -27,10 +27,10 @@ "source_scheme": "http", "subresource": "a-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for a-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -42,7 +42,22 @@ "source_scheme": "http", "subresource": "a-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for a-tag to cross-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "a-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for a-tag to same-https origin and no-redirect redirection from http context." }, { "expectation": "stripped-referrer", @@ -58,21 +73,6 @@ "subresource": "a-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-https origin and no-redirect redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/fetch.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/fetch.http.html index d87289b..49fa13a1 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/fetch.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/fetch.http.html
@@ -15,7 +15,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -27,10 +27,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -42,10 +42,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -57,10 +57,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -72,10 +72,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -87,10 +87,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -102,7 +102,67 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -133,66 +193,6 @@ "subresource": "fetch", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/iframe-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/iframe-tag.http.html index 5f76c24..6c71bf7 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/iframe-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/iframe-tag.http.html
@@ -15,7 +15,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -27,10 +27,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -42,10 +42,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -57,10 +57,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -72,10 +72,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -87,10 +87,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -102,7 +102,67 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -133,66 +193,6 @@ "subresource": "iframe-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/img-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/img-tag.http.html index 8c95386a..8758daa 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/img-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/img-tag.http.html
@@ -15,7 +15,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -27,10 +27,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -42,10 +42,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -57,10 +57,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -72,10 +72,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -87,10 +87,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -102,7 +102,67 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -133,66 +193,6 @@ "subresource": "img-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/script-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/script-tag.http.html index cdfdb24d..cd40ed1 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/script-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/script-tag.http.html
@@ -15,7 +15,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -27,10 +27,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -42,10 +42,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -57,10 +57,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -72,10 +72,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -87,10 +87,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -102,7 +102,67 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -133,66 +193,6 @@ "subresource": "script-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/xhr.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/xhr.http.html index beb2a4f..17bb7fd 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/xhr.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.http-rp/unset/xhr.http.html
@@ -15,7 +15,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -27,10 +27,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -42,10 +42,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -57,10 +57,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -72,10 +72,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -87,10 +87,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -102,7 +102,67 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -133,66 +193,6 @@ "subresource": "xhr", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/a-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/a-tag.http.html index e50b1f6..6f6e891 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/a-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/a-tag.http.html
@@ -15,7 +15,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -27,10 +27,10 @@ "source_scheme": "http", "subresource": "a-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for a-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -42,7 +42,22 @@ "source_scheme": "http", "subresource": "a-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for a-tag to cross-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "a-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for a-tag to same-https origin and no-redirect redirection from http context." }, { "expectation": "stripped-referrer", @@ -58,21 +73,6 @@ "subresource": "a-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-https origin and no-redirect redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/fetch.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/fetch.http.html index d87289b..49fa13a1 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/fetch.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/fetch.http.html
@@ -15,7 +15,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -27,10 +27,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -42,10 +42,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -57,10 +57,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -72,10 +72,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -87,10 +87,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -102,7 +102,67 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -133,66 +193,6 @@ "subresource": "fetch", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/iframe-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/iframe-tag.http.html index 5f76c24..6c71bf7 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/iframe-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/iframe-tag.http.html
@@ -15,7 +15,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -27,10 +27,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -42,10 +42,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -57,10 +57,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -72,10 +72,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -87,10 +87,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -102,7 +102,67 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -133,66 +193,6 @@ "subresource": "iframe-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/img-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/img-tag.http.html index 8c95386a..8758daa 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/img-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/img-tag.http.html
@@ -15,7 +15,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -27,10 +27,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -42,10 +42,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -57,10 +57,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -72,10 +72,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -87,10 +87,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -102,7 +102,67 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -133,66 +193,6 @@ "subresource": "img-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/script-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/script-tag.http.html index cdfdb24d..cd40ed1 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/script-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/script-tag.http.html
@@ -15,7 +15,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -27,10 +27,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -42,10 +42,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -57,10 +57,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -72,10 +72,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -87,10 +87,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -102,7 +102,67 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -133,66 +193,6 @@ "subresource": "script-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/xhr.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/xhr.http.html index beb2a4f..17bb7fd 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/xhr.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/iframe.meta/unset/xhr.http.html
@@ -15,7 +15,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -27,10 +27,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -42,10 +42,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -57,10 +57,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -72,10 +72,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -87,10 +87,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -102,7 +102,67 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "iframe" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -133,66 +193,6 @@ "subresource": "xhr", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "iframe" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/a-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/a-tag.http.html index c00ba92..6ed5f3bb 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/a-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/a-tag.http.html
@@ -14,7 +14,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -26,10 +26,10 @@ "source_scheme": "http", "subresource": "a-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for a-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -41,7 +41,22 @@ "source_scheme": "http", "subresource": "a-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for a-tag to cross-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "a-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for a-tag to same-https origin and no-redirect redirection from http context." }, { "expectation": "stripped-referrer", @@ -57,21 +72,6 @@ "subresource": "a-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-https origin and no-redirect redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/fetch.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/fetch.http.html index ed3bc61f..6ce6800 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/fetch.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/fetch.http.html
@@ -14,7 +14,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -26,10 +26,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -41,10 +41,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -56,10 +56,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -71,10 +71,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -86,10 +86,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -101,7 +101,67 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -132,66 +192,6 @@ "subresource": "fetch", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/iframe-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/iframe-tag.http.html index a4fb7d8..6a0c5286 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/iframe-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/iframe-tag.http.html
@@ -14,7 +14,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -26,10 +26,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -41,10 +41,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -56,10 +56,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -71,10 +71,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -86,10 +86,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -101,7 +101,67 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -132,66 +192,6 @@ "subresource": "iframe-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/img-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/img-tag.http.html index 948089a..aed2787 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/img-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/img-tag.http.html
@@ -14,7 +14,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -26,10 +26,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -41,10 +41,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -56,10 +56,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -71,10 +71,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -86,10 +86,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -101,7 +101,67 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -132,66 +192,6 @@ "subresource": "img-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/script-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/script-tag.http.html index 5d152c9..74212a6 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/script-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/script-tag.http.html
@@ -14,7 +14,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -26,10 +26,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -41,10 +41,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -56,10 +56,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -71,10 +71,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -86,10 +86,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -101,7 +101,67 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -132,66 +192,6 @@ "subresource": "script-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/xhr.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/xhr.http.html index 20d3eb1..a54c8de 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/xhr.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.http-rp/unset/xhr.http.html
@@ -14,7 +14,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -26,10 +26,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -41,10 +41,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -56,10 +56,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -71,10 +71,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -86,10 +86,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -101,7 +101,67 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -132,66 +192,6 @@ "subresource": "xhr", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/a-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/a-tag.http.html index c00ba92..6ed5f3bb 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/a-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/a-tag.http.html
@@ -14,7 +14,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -26,10 +26,10 @@ "source_scheme": "http", "subresource": "a-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for a-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -41,7 +41,22 @@ "source_scheme": "http", "subresource": "a-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for a-tag to cross-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "a-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for a-tag to same-https origin and no-redirect redirection from http context." }, { "expectation": "stripped-referrer", @@ -57,21 +72,6 @@ "subresource": "a-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-https origin and no-redirect redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/fetch.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/fetch.http.html index ed3bc61f..6ce6800 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/fetch.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/fetch.http.html
@@ -14,7 +14,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -26,10 +26,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -41,10 +41,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -56,10 +56,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -71,10 +71,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -86,10 +86,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -101,7 +101,67 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -132,66 +192,6 @@ "subresource": "fetch", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/iframe-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/iframe-tag.http.html index a4fb7d8..6a0c5286 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/iframe-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/iframe-tag.http.html
@@ -14,7 +14,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -26,10 +26,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -41,10 +41,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -56,10 +56,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -71,10 +71,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -86,10 +86,10 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -101,7 +101,67 @@ "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -132,66 +192,6 @@ "subresource": "iframe-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/img-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/img-tag.http.html index 948089a..aed2787 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/img-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/img-tag.http.html
@@ -14,7 +14,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -26,10 +26,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -41,10 +41,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -56,10 +56,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -71,10 +71,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -86,10 +86,10 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -101,7 +101,67 @@ "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -132,66 +192,6 @@ "subresource": "img-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/script-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/script-tag.http.html index 5d152c9..74212a6 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/script-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/script-tag.http.html
@@ -14,7 +14,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -26,10 +26,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -41,10 +41,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -56,10 +56,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -71,10 +71,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -86,10 +86,10 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -101,7 +101,67 @@ "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -132,66 +192,6 @@ "subresource": "script-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/xhr.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/xhr.http.html index 20d3eb1..a54c8de 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/xhr.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/srcdoc-inherit.meta/unset/xhr.http.html
@@ -14,7 +14,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -26,10 +26,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -41,10 +41,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -56,10 +56,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -71,10 +71,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -86,10 +86,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -101,7 +101,67 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "srcdoc" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -132,66 +192,6 @@ "subresource": "xhr", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "srcdoc" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/a-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/a-tag.http.html index 67702eb..72e159c7 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/a-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/a-tag.http.html
@@ -14,24 +14,34 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "a-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for a-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "a-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for a-tag to cross-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [], + "source_scheme": "http", + "subresource": "a-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for a-tag to same-https origin and no-redirect redirection from http context." }, { "expectation": "stripped-referrer", @@ -42,16 +52,6 @@ "subresource": "a-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-https origin and no-redirect redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/fetch.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/fetch.http.html index 5c2ed383..1dfb592e 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/fetch.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/fetch.http.html
@@ -14,64 +14,104 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -92,46 +132,6 @@ "subresource": "fetch", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/iframe-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/iframe-tag.http.html index 26d595f..557d6a5 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/iframe-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/iframe-tag.http.html
@@ -14,64 +14,104 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -92,46 +132,6 @@ "subresource": "iframe-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/img-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/img-tag.http.html index 0827ebd..3987df1 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/img-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/img-tag.http.html
@@ -14,64 +14,104 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -92,46 +132,6 @@ "subresource": "img-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/script-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/script-tag.http.html index c5cad6a..788c8d0 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/script-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/script-tag.http.html
@@ -14,64 +14,104 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -92,46 +132,6 @@ "subresource": "script-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/xhr.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/xhr.http.html index b3380b89..866577c 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/xhr.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.http-rp/unset/xhr.http.html
@@ -14,64 +14,104 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -92,46 +132,6 @@ "subresource": "xhr", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/a-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/a-tag.http.html index 67702eb..72e159c7 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/a-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/a-tag.http.html
@@ -14,24 +14,34 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "a-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for a-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "a-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for a-tag to cross-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [], + "source_scheme": "http", + "subresource": "a-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for a-tag to same-https origin and no-redirect redirection from http context." }, { "expectation": "stripped-referrer", @@ -42,16 +52,6 @@ "subresource": "a-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "a-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for a-tag to same-https origin and no-redirect redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/fetch.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/fetch.http.html index 5c2ed383..1dfb592e 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/fetch.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/fetch.http.html
@@ -14,64 +14,104 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -92,46 +132,6 @@ "subresource": "fetch", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/iframe-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/iframe-tag.http.html index 26d595f..557d6a5 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/iframe-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/iframe-tag.http.html
@@ -14,64 +14,104 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "iframe-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for iframe-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "iframe-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for iframe-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -92,46 +132,6 @@ "subresource": "iframe-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "iframe-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for iframe-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/img-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/img-tag.http.html index 0827ebd..3987df1 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/img-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/img-tag.http.html
@@ -14,64 +14,104 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "img-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for img-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "img-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for img-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -92,46 +132,6 @@ "subresource": "img-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "img-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for img-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/script-tag.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/script-tag.http.html index c5cad6a..788c8d0 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/script-tag.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/script-tag.http.html
@@ -14,64 +14,104 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "script-tag", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for script-tag to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "script-tag", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for script-tag to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -92,46 +132,6 @@ "subresource": "script-tag", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "script-tag", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for script-tag to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/xhr.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/xhr.http.html index b3380b89..866577c 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/xhr.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/top.meta/unset/xhr.http.html
@@ -14,64 +14,104 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [], "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [], "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [], "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -92,46 +132,6 @@ "subresource": "xhr", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/worker-classic.http-rp/unset/fetch.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/worker-classic.http-rp/unset/fetch.http.html index 3d3478f..8b83056 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/worker-classic.http-rp/unset/fetch.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/worker-classic.http-rp/unset/fetch.http.html
@@ -15,7 +15,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -27,10 +27,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -42,10 +42,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -57,10 +57,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -72,10 +72,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -87,10 +87,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -102,7 +102,67 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "worker-classic" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "worker-classic" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "worker-classic" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "worker-classic" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -133,66 +193,6 @@ "subresource": "fetch", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "worker-classic" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "worker-classic" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "worker-classic" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "worker-classic" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/worker-classic.http-rp/unset/xhr.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/worker-classic.http-rp/unset/xhr.http.html index ff58f80..2fc20e2 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/worker-classic.http-rp/unset/xhr.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/worker-classic.http-rp/unset/xhr.http.html
@@ -15,7 +15,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -27,10 +27,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -42,10 +42,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -57,10 +57,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -72,10 +72,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -87,10 +87,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -102,7 +102,67 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "worker-classic" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "worker-classic" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "worker-classic" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "worker-classic" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -133,66 +193,6 @@ "subresource": "xhr", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "worker-classic" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "worker-classic" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "worker-classic" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "worker-classic" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/worker-module.http-rp/unset/fetch.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/worker-module.http-rp/unset/fetch.http.html index 790fcc5..fbd245a4d 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/worker-module.http-rp/unset/fetch.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/worker-module.http-rp/unset/fetch.http.html
@@ -15,7 +15,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -27,10 +27,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -42,10 +42,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -57,10 +57,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -72,10 +72,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -87,10 +87,10 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -102,7 +102,67 @@ "source_scheme": "http", "subresource": "fetch", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for fetch to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "worker-module" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "worker-module" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "worker-module" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "worker-module" + } + ], + "source_scheme": "http", + "subresource": "fetch", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for fetch to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -133,66 +193,6 @@ "subresource": "fetch", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "worker-module" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "worker-module" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "worker-module" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "worker-module" - } - ], - "source_scheme": "http", - "subresource": "fetch", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for fetch to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/worker-module.http-rp/unset/xhr.http.html b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/worker-module.http-rp/unset/xhr.http.html index da200bb..1c72732b 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/gen/worker-module.http-rp/unset/xhr.http.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/gen/worker-module.http-rp/unset/xhr.http.html
@@ -15,7 +15,7 @@ TestCase( [ { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "keep-origin", "source_context_list": [ @@ -27,10 +27,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "no-redirect", "source_context_list": [ @@ -42,10 +42,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-http", "redirection": "swap-origin", "source_context_list": [ @@ -57,10 +57,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-http origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-http origin and swap-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "keep-origin", "source_context_list": [ @@ -72,10 +72,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and keep-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and keep-origin redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "no-redirect", "source_context_list": [ @@ -87,10 +87,10 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and no-redirect redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and no-redirect redirection from http context." }, { - "expectation": "stripped-referrer", + "expectation": "origin", "origin": "cross-https", "redirection": "swap-origin", "source_context_list": [ @@ -102,7 +102,67 @@ "source_scheme": "http", "subresource": "xhr", "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to cross-https origin and swap-origin redirection from http context." + "test_description": "Referrer Policy: Expects origin for xhr to cross-https origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-http", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "worker-module" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-http origin and swap-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "keep-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "worker-module" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and keep-origin redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "no-redirect", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "worker-module" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and no-redirect redirection from http context." + }, + { + "expectation": "origin", + "origin": "same-https", + "redirection": "swap-origin", + "source_context_list": [ + { + "policyDeliveries": [], + "sourceContextType": "worker-module" + } + ], + "source_scheme": "http", + "subresource": "xhr", + "subresource_policy_deliveries": [], + "test_description": "Referrer Policy: Expects origin for xhr to same-https origin and swap-origin redirection from http context." }, { "expectation": "stripped-referrer", @@ -133,66 +193,6 @@ "subresource": "xhr", "subresource_policy_deliveries": [], "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-http", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "worker-module" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-http origin and swap-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "keep-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "worker-module" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and keep-origin redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "no-redirect", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "worker-module" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and no-redirect redirection from http context." - }, - { - "expectation": "stripped-referrer", - "origin": "same-https", - "redirection": "swap-origin", - "source_context_list": [ - { - "policyDeliveries": [], - "sourceContextType": "worker-module" - } - ], - "source_scheme": "http", - "subresource": "xhr", - "subresource_policy_deliveries": [], - "test_description": "Referrer Policy: Expects stripped-referrer for xhr to same-https origin and swap-origin redirection from http context." } ], new SanityChecker()
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-history-about-srcdoc-expected.txt b/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-history-about-srcdoc-expected.txt index 6ce57a6..4c55513 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-history-about-srcdoc-expected.txt +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-history-about-srcdoc-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -FAIL History navigation reuses original policy. assert_equals: History navigation reuses original policy. expected "http://web-platform.test:8001/" but got "http://web-platform.test:8001/custom" +FAIL History navigation reuses original policy. assert_equals: History navigation reuses original policy. expected (undefined) undefined but got (string) "http://web-platform.test:8001/custom" PASS New srcdoc iframe uses new policy. Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-history-about-srcdoc.html b/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-history-about-srcdoc.html index 31d2a33..c16ead7 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-history-about-srcdoc.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-history-about-srcdoc.html
@@ -4,7 +4,7 @@ <script src="/resources/testharnessreport.js"></script> <script src="/common/get-host-info.sub.js"></script> <script src="resources/make-html-script.js"></script> -<meta name="referrer" content="origin"> +<meta name="referrer" content="no-referrer"> <div id="log"></div> <script> let reportedReferrer = () => { @@ -47,9 +47,9 @@ // Despite the main document has changed its referrer policy in (2), the // reported referrer for the history navigation to about:srcdoc in (4) must // match with the one originally reported in (1). - assert_equals(await referrer_1, self.origin + '/', + assert_equals(await referrer_1, undefined, "First navigation uses correct policy."); - assert_equals(await referrer_2, self.origin + '/', + assert_equals(await referrer_2, undefined, "History navigation reuses original policy."); }, "History navigation reuses original policy.");
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript-child-expected.txt b/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript-child-expected.txt index 581193b..719ac1b 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript-child-expected.txt +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript-child-expected.txt
@@ -1,7 +1,7 @@ This is a testharness.js-based test. -FAIL Referrer Policy: iframes with javascript url reuse referrer policy assert_equals: expected "http://web-platform.test:8001/" but got "http://web-platform.test:8001/custom" -FAIL Referrer Policy: iframes with javascript url reuse referrer policy 1 assert_equals: expected (undefined) undefined but got (string) "http://web-platform.test:8001/custom" -PASS Referrer Policy: iframes with javascript url reuse referrer policy 2 -FAIL Referrer Policy: iframes with javascript url reuse referrer policy 3 assert_equals: expected (undefined) undefined but got (string) "http://web-platform.test:8001/" +FAIL Referrer Policy: iframes with javascript url reuse referrer policy assert_equals: expected "http://web-platform.test:8001/custom" but got "http://web-platform.test:8001/" +FAIL Referrer Policy: iframes with javascript url reuse referrer policy 1 assert_equals: expected (undefined) undefined but got (string) "http://web-platform.test:8001/" +FAIL Referrer Policy: iframes with javascript url reuse referrer policy 2 assert_equals: expected (undefined) undefined but got (string) "http://web-platform.test:8001/referrer-policy/generic/inheritance/iframe-inheritance-javascript-child.html" +FAIL Referrer Policy: iframes with javascript url reuse referrer policy 3 assert_equals: expected (undefined) undefined but got (string) "http://web-platform.test:8001/referrer-policy/generic/inheritance/iframe-inheritance-javascript-child.html" Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript-child.html b/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript-child.html index 670f78a..b7f8dab 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript-child.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript-child.html
@@ -4,13 +4,13 @@ <script src="/resources/testharnessreport.js"></script> <script src="/common/get-host-info.sub.js"></script> <script src="resources/make-html-script.js"></script> -<meta name="referrer" content="origin"> +<meta name="referrer" content="unsafe-url"> <div id="log"></div> <script> [ { srcDocPolicy: ``, - expected: self.origin + "/" + expected: location.origin + "/custom" }, { srcDocPolicy: `<meta name="referrer" content="no-referrer">`, @@ -45,7 +45,8 @@ [ { srcDocPolicy: ``, - expected: self.origin + "/" + expected: undefined // Because the URL of <iframe src="javascript:..."> is about:blank, + // the referrer should be no referrer. }, { srcDocPolicy: `<meta name="referrer" content="no-referrer">`,
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript-expected.txt b/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript-expected.txt index 4f0da80a..fde0832b 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript-expected.txt +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. PASS Referrer Policy: iframes with javascript url reuse referrer policy -FAIL Referrer Policy: iframes with javascript url reuse referrer policy 1 assert_equals: expected "http://web-platform.test:8001/" but got "http://web-platform.test:8001/custom" +FAIL Referrer Policy: iframes with javascript url reuse referrer policy 1 assert_equals: expected "http://web-platform.test:8001/custom" but got "http://web-platform.test:8001/" Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript.html b/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript.html index e8de690c..cf1f099 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript.html
@@ -4,7 +4,7 @@ <script src="/resources/testharnessreport.js"></script> <script src="/common/get-host-info.sub.js"></script> <script src="resources/make-html-script.js"></script> -<meta name="referrer" content="origin"> +<meta name="referrer" content="unsafe-url"> <div id="log"></div> <script> @@ -26,7 +26,7 @@ // Document's origin == location.orgin. Furthermore, since the iframe // inherits its parent's referrer policy, the URL should be restricted to // its origin. - expected: self.origin + "/" + expected: self.origin + "/custom" } ].forEach(({ fetchReferrer, expected }) => { promise_test(t => {
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/generic/multiple-headers-one-invalid.html b/third_party/blink/web_tests/external/wpt/referrer-policy/generic/multiple-headers-one-invalid.html index 5561cd85..eca73460 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/generic/multiple-headers-one-invalid.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/generic/multiple-headers-one-invalid.html
@@ -16,9 +16,13 @@ <script> promise_test(() => { var urlPath = '/common/security-features/subresource/image.py?cache_destroyer=' + (new Date()).getTime(); - var url = location.protocol + "//www1." + location.hostname + ":" + location.port + - urlPath; - return requestViaImage(url, null, 'no-referrer') + // The default referrer policy is strict-origin-when-cross-origin. + // This document's headers contain the 'origin' and 'no-referrer' tokens, + // and we're making a same-origin image load, so, if the image request, + // uses the default policy (which is what this test's verifying), we + // should see the full initiating URL in the referrer, rather than just + // the origin or an empty string. + return requestViaImage(urlPath, null, 'no-referrer') .then(function(message) { assert_equals(message.referrer, document.location.href); });
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/generic/unsupported-csp-referrer-directive.html b/third_party/blink/web_tests/external/wpt/referrer-policy/generic/unsupported-csp-referrer-directive.html index a7f2221..27a3a991 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/generic/unsupported-csp-referrer-directive.html +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/generic/unsupported-csp-referrer-directive.html
@@ -17,9 +17,7 @@ <script> promise_test(function() { var urlPath = '/common/security-features/subresource/image.py?cache_destroyer=' + (new Date()).getTime(); - var url = location.protocol + "//www1." + location.hostname + ":" + location.port + - urlPath; - return requestViaImage(url, null, 'always') + return requestViaImage(urlPath, null, 'always') .then(function(message) { assert_equals(message.referrer, document.location.href); });
diff --git a/third_party/blink/web_tests/external/wpt/referrer-policy/spec.src.json b/third_party/blink/web_tests/external/wpt/referrer-policy/spec.src.json index 8d2a6d2..ff40591 100644 --- a/third_party/blink/web_tests/external/wpt/referrer-policy/spec.src.json +++ b/third_party/blink/web_tests/external/wpt/referrer-policy/spec.src.json
@@ -5,25 +5,46 @@ { // unset-referrer-policy "title": "Referrer Policy is not explicitly defined", - "description": "Check that referrer URL follows no-referrer-when-downgrade policy when no explicit Referrer Policy is set.", + "description": "Check that referrer URL follows the strict-origin-when-cross-origin policy when no explicit Referrer Policy is set.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policies", "test_expansion": [ { - // insecure-protocol + // same-insecure "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": null, "redirection": "*", - "origin": [ - "same-http", - "cross-http" - ], + "origin": "same-http", "subresource": "*", "expectation": "stripped-referrer" }, { + // same-insecure + "expansion": "override", + "source_scheme": "http", + "source_context_list": "*", + "delivery_type": "*", + "delivery_value": null, + "redirection": "swap-origin", + "origin": "same-http", + "subresource": "*", + "expectation": "origin" + }, + { + // cross-insecure + "expansion": "default", + "source_scheme": "http", + "source_context_list": "*", + "delivery_type": "*", + "delivery_value": null, + "redirection": "*", + "origin": "cross-http", + "subresource": "*", + "expectation": "origin" + }, + { // upgrade-protocol "expansion": "default", "source_scheme": "http", @@ -36,7 +57,7 @@ "cross-https" ], "subresource": "*", - "expectation": "stripped-referrer" + "expectation": "origin" }, { // downgrade-protocol @@ -54,19 +75,40 @@ "expectation": "omitted" }, { - // secure-protocol + // same-secure "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": null, "redirection": "*", - "origin": [ - "same-https", - "cross-https" - ], + "origin": "same-https", "subresource": "*", "expectation": "stripped-referrer" + }, + { + // same-secure + "expansion": "override", + "source_scheme": "https", + "source_context_list": "*", + "delivery_type": "*", + "delivery_value": null, + "redirection": "swap-origin", + "origin": "same-https", + "subresource": "*", + "expectation": "origin" + }, + { + // cross-secure + "expansion": "default", + "source_scheme": "https", + "source_context_list": "*", + "delivery_type": "*", + "delivery_value": null, + "redirection": "*", + "origin": "cross-https", + "subresource": "*", + "expectation": "origin" } ] },
diff --git a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/fetch-event-referrer-policy.https.html b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/fetch-event-referrer-policy.https.html index 804fd9b4..af4b20a 100644 --- a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/fetch-event-referrer-policy.https.html +++ b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/fetch-event-referrer-policy.https.html
@@ -22,7 +22,7 @@ do_test(referrer, response_text, 'Referrer: ' + href + '\n' + - 'ReferrerPolicy: no-referrer-when-downgrade', + 'ReferrerPolicy: strict-origin-when-cross-origin', 'Service Worker should respond to fetch with the referrer URL when a member of RequestInit is present'); var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() + '/resources/simple.html?referrerFull'; @@ -34,7 +34,7 @@ do_test(referrer, response_text, 'Referrer: \n' + - 'ReferrerPolicy: no-referrer-when-downgrade', + 'ReferrerPolicy: strict-origin-when-cross-origin', 'Service Worker should respond to fetch with no referrer when a member of RequestInit is present with an HTTP request'); return frame.contentWindow.fetch('resources/simple.html?referrerFull', {referrerPolicy: "", referrer: referrer}); @@ -44,7 +44,7 @@ do_test(referrer, response_text, 'Referrer: ' + href + '\n' + - 'ReferrerPolicy: no-referrer-when-downgrade', + 'ReferrerPolicy: strict-origin-when-cross-origin', 'Service Worker should respond to fetch with the referrer with ""'); var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() + '/resources/simple.html?referrerFull'; @@ -56,7 +56,7 @@ do_test(referrer, response_text, 'Referrer: \n' + - 'ReferrerPolicy: no-referrer-when-downgrade', + 'ReferrerPolicy: strict-origin-when-cross-origin', 'Service Worker should respond to fetch with no referrer with ""'); return frame.contentWindow.fetch('resources/simple.html?referrerFull', {referrerPolicy: "origin", referrer: referrer}); @@ -253,7 +253,7 @@ .then(function(f) { frame = f; test(() => { - assert_equals(frame.contentDocument.body.textContent, 'ReferrerPolicy: no-referrer-when-downgrade'); + assert_equals(frame.contentDocument.body.textContent, 'ReferrerPolicy: strict-origin-when-cross-origin'); }, 'Service Worker should respond to fetch with the default referrer policy'); // First, run the referrer policy tests without passing a referrer in RequestInit. return run_referrer_policy_tests(frame, undefined, frame.contentDocument.location.href,
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_fetch_error-downgraded.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_fetch_error-downgraded.tentative.html index 845b7e0..420eaaa 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_fetch_error-downgraded.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_fetch_error-downgraded.tentative.html
@@ -31,7 +31,7 @@ type: "sxg.failed", elapsed_time: 0, status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -51,7 +51,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_fetch_error.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_fetch_error.tentative.html index 476af82..bab50b7 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_fetch_error.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_fetch_error.tentative.html
@@ -31,7 +31,7 @@ // the report must not be downgraded. type: "sxg.cert_fetch_error", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -51,7 +51,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_parse_error-downgraded.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_parse_error-downgraded.tentative.html index d962b88..99c5c7b 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_parse_error-downgraded.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_parse_error-downgraded.tentative.html
@@ -33,7 +33,7 @@ type: "sxg.failed", elapsed_time: 0, status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -53,7 +53,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_parse_error.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_parse_error.tentative.html index 11dc4141..0fd0c8c 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_parse_error.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_parse_error.tentative.html
@@ -31,7 +31,7 @@ // the report must not be downgraded. type: "sxg.cert_parse_error", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -51,7 +51,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_verification_error-downgraded.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_verification_error-downgraded.tentative.html index a1358e75..042f7d7 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_verification_error-downgraded.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_verification_error-downgraded.tentative.html
@@ -32,7 +32,7 @@ type: "sxg.failed", elapsed_time: 0, status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -52,7 +52,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_verification_error.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_verification_error.tentative.html index 81520f9d..feb705d0 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_verification_error.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-cert_verification_error.tentative.html
@@ -28,7 +28,7 @@ phase: "sxg", type: "sxg.cert_verification_error", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -48,7 +48,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-failed-zero-success-fraction.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-failed-zero-success-fraction.tentative.html index c0e06c8..477eb55d 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-failed-zero-success-fraction.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-failed-zero-success-fraction.tentative.html
@@ -31,7 +31,7 @@ type: "sxg.failed", elapsed_time: 0, status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -54,7 +54,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-invalid_integrity_header.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-invalid_integrity_header.tentative.html index aaad0c8..9d8852cb 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-invalid_integrity_header.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-invalid_integrity_header.tentative.html
@@ -29,7 +29,7 @@ phase: "sxg", type: "sxg.invalid_integrity_header", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -49,7 +49,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-mi_error.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-mi_error.tentative.html index 33a42f9..b31f3d0 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-mi_error.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-mi_error.tentative.html
@@ -36,7 +36,7 @@ phase: "sxg", type: "sxg.mi_error", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -56,7 +56,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-ok.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-ok.tentative.html index ee9a509..61c9bbd 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-ok.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-ok.tentative.html
@@ -27,7 +27,7 @@ phase: "sxg", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -47,7 +47,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-parse_error.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-parse_error.tentative.html index f835c6a..444d281 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-parse_error.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-parse_error.tentative.html
@@ -35,7 +35,7 @@ phase: "sxg", type: "sxg.parse_error", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, cert_url: [] @@ -53,7 +53,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-signature_verification_error-downgraded.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-signature_verification_error-downgraded.tentative.html index 87bbc36..c92fc6c2 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-signature_verification_error-downgraded.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-signature_verification_error-downgraded.tentative.html
@@ -32,7 +32,7 @@ type: "sxg.failed", elapsed_time: 0, status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -52,7 +52,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-signature_verification_error.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-signature_verification_error.tentative.html index f57fd4d5..8c77317b 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-signature_verification_error.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-navigation-signature_verification_error.tentative.html
@@ -28,7 +28,7 @@ phase: "sxg", type: "sxg.signature_verification_error", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -48,7 +48,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_fetch_error-downgraded.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_fetch_error-downgraded.tentative.html index f663f35c..82b5d8f 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_fetch_error-downgraded.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_fetch_error-downgraded.tentative.html
@@ -29,7 +29,7 @@ type: "sxg.failed", elapsed_time: 0, status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -49,7 +49,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_fetch_error.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_fetch_error.tentative.html index c17fc5c..32e3cad1 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_fetch_error.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_fetch_error.tentative.html
@@ -28,7 +28,7 @@ // the report must not be downgraded. type: "sxg.cert_fetch_error", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -48,7 +48,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_parse_error-downgraded.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_parse_error-downgraded.tentative.html index f1a5eb17..bbad603 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_parse_error-downgraded.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_parse_error-downgraded.tentative.html
@@ -30,7 +30,7 @@ type: "sxg.failed", elapsed_time: 0, status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -50,7 +50,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_parse_error.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_parse_error.tentative.html index 00f41c0..a6ea9e4 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_parse_error.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_parse_error.tentative.html
@@ -28,7 +28,7 @@ // the report must not be downgraded. type: "sxg.cert_parse_error", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -48,7 +48,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_verification_error-downgraded.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_verification_error-downgraded.tentative.html index 4836dc1b..b25bf49 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_verification_error-downgraded.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_verification_error-downgraded.tentative.html
@@ -29,7 +29,7 @@ type: "sxg.failed", elapsed_time: 0, status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -49,7 +49,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_verification_error.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_verification_error.tentative.html index 441a17af..f31a4c4 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_verification_error.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-cert_verification_error.tentative.html
@@ -25,7 +25,7 @@ phase: "sxg", type: "sxg.cert_verification_error", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -45,7 +45,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-failed-zero-success-feaction.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-failed-zero-success-feaction.tentative.html index b0f71030..faa02bc 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-failed-zero-success-feaction.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-failed-zero-success-feaction.tentative.html
@@ -29,7 +29,7 @@ type: "sxg.failed", elapsed_time: 0, status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -52,7 +52,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-invalid_integrity_header.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-invalid_integrity_header.tentative.html index 1fd431c..990b4a3 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-invalid_integrity_header.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-invalid_integrity_header.tentative.html
@@ -26,7 +26,7 @@ phase: "sxg", type: "sxg.invalid_integrity_header", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -46,7 +46,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-mi_error.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-mi_error.tentative.html index 2bbf0e8f..f265a92 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-mi_error.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-mi_error.tentative.html
@@ -26,7 +26,7 @@ phase: "sxg", type: "sxg.mi_error", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -46,7 +46,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-ok.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-ok.tentative.html index fb5fb58..e3c6a0e 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-ok.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-ok.tentative.html
@@ -24,7 +24,7 @@ phase: "sxg", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -44,7 +44,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-parse_error.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-parse_error.tentative.html index 171baf1..2e2b860 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-parse_error.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-parse_error.tentative.html
@@ -24,7 +24,7 @@ phase: "sxg", type: "sxg.parse_error", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, cert_url: [] @@ -42,7 +42,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-signature_verification_error-downgraded.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-signature_verification_error-downgraded.tentative.html index 7340b75..fbeaeec 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-signature_verification_error-downgraded.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-signature_verification_error-downgraded.tentative.html
@@ -29,7 +29,7 @@ type: "sxg.failed", elapsed_time: 0, status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -49,7 +49,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-signature_verification_error.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-signature_verification_error.tentative.html index d552c4a8..f3805ad6 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-signature_verification_error.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/reporting/sxg-reporting-prefetch-signature_verification_error.tentative.html
@@ -25,7 +25,7 @@ phase: "sxg", type: "sxg.signature_verification_error", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', sxg: { outer_url: sxg_url, inner_url: @@ -45,7 +45,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href, + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/subresource/sxg-subresource-header-integrity-mismatch.tentative.html b/third_party/blink/web_tests/external/wpt/signed-exchange/subresource/sxg-subresource-header-integrity-mismatch.tentative.html index 8a26b21..26e63b9 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/subresource/sxg-subresource-header-integrity-mismatch.tentative.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/subresource/sxg-subresource-header-integrity-mismatch.tentative.html
@@ -41,7 +41,7 @@ phase: "application", type: "ok", status_code: 200, - referrer: location.href + referrer: location.origin + '/', }, metadata: { content_type: "application/reports+json",
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/sxg-referrer-remote-physical-remote-logical.tentative.https.html b/third_party/blink/web_tests/external/wpt/signed-exchange/sxg-referrer-remote-physical-remote-logical.tentative.https.html index d33324e..67de083 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/sxg-referrer-remote-physical-remote-logical.tentative.https.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/sxg-referrer-remote-physical-remote-logical.tentative.https.html
@@ -16,7 +16,7 @@ origin: REMOTE_ORIGIN, sxg: REMOTE_ORIGIN_SXG, referrerPolicy: undefined, - expectedReferrer: document.location.href + expectedReferrer: document.location.origin + '/' }, { origin: REMOTE_ORIGIN,
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/sxg-referrer-remote-physical-same-logical.tentative.https.html b/third_party/blink/web_tests/external/wpt/signed-exchange/sxg-referrer-remote-physical-same-logical.tentative.https.html index b3c77d1..4d8aff80 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/sxg-referrer-remote-physical-same-logical.tentative.https.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/sxg-referrer-remote-physical-same-logical.tentative.https.html
@@ -15,7 +15,7 @@ origin: REMOTE_ORIGIN, sxg: SAME_ORIGIN_SXG, referrerPolicy: undefined, - expectedReferrer: document.location.href + expectedReferrer: document.location.origin + '/' }, { origin: REMOTE_ORIGIN,
diff --git a/third_party/blink/web_tests/external/wpt/signed-exchange/sxg-referrer-same-physical-remote-logical.tentative.https.html b/third_party/blink/web_tests/external/wpt/signed-exchange/sxg-referrer-same-physical-remote-logical.tentative.https.html index 8a6cdd99..fc6f187b 100644 --- a/third_party/blink/web_tests/external/wpt/signed-exchange/sxg-referrer-same-physical-remote-logical.tentative.https.html +++ b/third_party/blink/web_tests/external/wpt/signed-exchange/sxg-referrer-same-physical-remote-logical.tentative.https.html
@@ -15,7 +15,7 @@ origin: SAME_ORIGIN, sxg: REMOTE_ORIGIN_SXG, referrerPolicy: undefined, - expectedReferrer: document.location.href + expectedReferrer: document.location.origin + '/' }, { origin: SAME_ORIGIN,
diff --git a/third_party/blink/web_tests/external/wpt/webrtc/RTCPeerConnection-getStats.https.html b/third_party/blink/web_tests/external/wpt/webrtc/RTCPeerConnection-getStats.https.html index 1fc4a25..49f8813 100644 --- a/third_party/blink/web_tests/external/wpt/webrtc/RTCPeerConnection-getStats.https.html +++ b/third_party/blink/web_tests/external/wpt/webrtc/RTCPeerConnection-getStats.https.html
@@ -386,12 +386,12 @@ const kMinimumTimeElapsedBetweenGetStatsCallsMs = 500; const pc = new RTCPeerConnection(); t.add_cleanup(() => pc.close()); - const t0 = performance.now(); + const t0 = Math.floor(performance.now()); const t0Stats = getRequiredStats(await pc.getStats(), 'peer-connection'); await new Promise( r => t.step_timeout(r, kMinimumTimeElapsedBetweenGetStatsCallsMs)); const t1Stats = getRequiredStats(await pc.getStats(), 'peer-connection'); - const t1 = performance.now(); + const t1 = Math.ceil(performance.now()); const maximumTimeElapsedBetweenGetStatsCallsMs = t1 - t0; const deltaTimestampMs = t1Stats.timestamp - t0Stats.timestamp; // The delta must be at least the time we waited between calls.
diff --git a/third_party/blink/web_tests/http/tests/css/css-resources-referrer-srcdoc.html b/third_party/blink/web_tests/http/tests/css/css-resources-referrer-srcdoc.html index ea6b2cb..68e5f331 100644 --- a/third_party/blink/web_tests/http/tests/css/css-resources-referrer-srcdoc.html +++ b/third_party/blink/web_tests/http/tests/css/css-resources-referrer-srcdoc.html
@@ -1,5 +1,5 @@ <!DOCTYPE html> -<iframe srcdoc=" +<iframe srcdoc="<meta name='referrer' content='no-referrer-when-downgrade'> <base href='http://example.com/from/iframe.html'> <style> @font-face { @@ -29,8 +29,10 @@ "></iframe> <script> -if (window.testRunner) { + if (window.testRunner) { testRunner.waitUntilDone(); - document.fonts.ready.then(function() { testRunner.notifyDone(); }); -} + document.fonts.ready.then(function() { + testRunner.notifyDone(); + }); + } </script>
diff --git a/third_party/blink/web_tests/http/tests/fetch/referrer/resources/origin-when-cross-origin-serviceworker-from-document.html b/third_party/blink/web_tests/http/tests/fetch/referrer/resources/origin-when-cross-origin-serviceworker-from-document.html index 10e5def..2868df9d 100644 --- a/third_party/blink/web_tests/http/tests/fetch/referrer/resources/origin-when-cross-origin-serviceworker-from-document.html +++ b/third_party/blink/web_tests/http/tests/fetch/referrer/resources/origin-when-cross-origin-serviceworker-from-document.html
@@ -1,75 +1,84 @@ <!doctype html> <html> + <body> -<script src = "/resources/get-host-info.js?pipe=sub"></script> -<script src = "/resources/testharness.js"></script> -<script src = "/resources/testharnessreport.js"></script> -<script src = "/serviceworker/resources/test-helpers.js"></script> -<script src = "/fetch/resources/fetch-test-helpers.js"></script> -<script src = "/fetch/resources/fetch-test-options.js"></script> -<script> -const SCRIPT = - '/fetch/referrer/resources/origin-when-cross-origin-simple-onfetch-js.php'; -const SCOPE = location.href; + <script src="/resources/get-host-info.js?pipe=sub"></script> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/serviceworker/resources/test-helpers.js"></script> + <script src="/fetch/resources/fetch-test-helpers.js"></script> + <script src="/fetch/resources/fetch-test-options.js"></script> + <script> + const SCRIPT = + '/fetch/referrer/resources/origin-when-cross-origin-simple-onfetch-js.php'; + const SCOPE = location.href; -const {BASE_ORIGIN, OTHER_ORIGIN} = get_fetch_test_options(); -const BASE_URL = BASE_ORIGIN + '/fetch/resources/referrer.php'; -const OTHER_URL = OTHER_ORIGIN + '/fetch/resources/referrer.php'; -const REFERRER_SOURCE = location.href; + const { + BASE_ORIGIN, + OTHER_ORIGIN + } = get_fetch_test_options(); + const BASE_URL = BASE_ORIGIN + '/fetch/resources/referrer.php'; + const OTHER_URL = OTHER_ORIGIN + '/fetch/resources/referrer.php'; + const REFERRER_SOURCE = location.href; -promise_test(t => { - return navigator.serviceWorker.register(SCRIPT, {scope: SCOPE}).then(r => { + promise_test(t => { + return navigator.serviceWorker.register(SCRIPT, { + scope: SCOPE + }).then(r => { return r.ready; }).then(() => { if (navigator.serviceWorker.controller === null) { location.reload(); } }); - }); + }); -const TESTS = [ - [BASE_URL, 'about:client', '', REFERRER_SOURCE], - [BASE_URL, 'about:client', 'no-referrer', '[no-referrer]'], - [BASE_URL, 'about:client', 'no-referrer-when-downgrade', REFERRER_SOURCE], - [BASE_URL, 'about:client', 'origin', BASE_ORIGIN + '/'], - [BASE_URL, 'about:client', 'origin-when-cross-origin', REFERRER_SOURCE], - [BASE_URL, 'about:client', 'unsafe-url', REFERRER_SOURCE], - [OTHER_URL, 'about:client', '', REFERRER_SOURCE], - [OTHER_URL, 'about:client', 'no-referrer', '[no-referrer]'], - [OTHER_URL, 'about:client', 'no-referrer-when-downgrade', REFERRER_SOURCE], - [OTHER_URL, 'about:client', 'origin', BASE_ORIGIN + '/'], - [OTHER_URL, 'about:client', 'origin-when-cross-origin', BASE_ORIGIN + '/'], - [OTHER_URL, 'about:client', 'unsafe-url', REFERRER_SOURCE], + const TESTS = [ + [BASE_URL, 'about:client', '', REFERRER_SOURCE], + [BASE_URL, 'about:client', 'no-referrer', '[no-referrer]'], + [BASE_URL, 'about:client', 'no-referrer-when-downgrade', REFERRER_SOURCE], + [BASE_URL, 'about:client', 'origin', BASE_ORIGIN + '/'], + [BASE_URL, 'about:client', 'origin-when-cross-origin', REFERRER_SOURCE], + [BASE_URL, 'about:client', 'unsafe-url', REFERRER_SOURCE], + [OTHER_URL, 'about:client', '', BASE_ORIGIN + '/'], + [OTHER_URL, 'about:client', 'no-referrer', '[no-referrer]'], + [OTHER_URL, 'about:client', 'no-referrer-when-downgrade', REFERRER_SOURCE], + [OTHER_URL, 'about:client', 'origin', BASE_ORIGIN + '/'], + [OTHER_URL, 'about:client', 'origin-when-cross-origin', BASE_ORIGIN + '/'], + [OTHER_URL, 'about:client', 'strict-origin-when-cross-origin', BASE_ORIGIN + '/'], + [OTHER_URL, 'about:client', 'unsafe-url', REFERRER_SOURCE], - [BASE_URL, '', '', '[no-referrer]'], - [BASE_URL, '', 'no-referrer', '[no-referrer]'], - [BASE_URL, '', 'no-referrer-when-downgrade', '[no-referrer]'], - [BASE_URL, '', 'origin', '[no-referrer]'], - [BASE_URL, '', 'origin-when-cross-origin', '[no-referrer]'], - [BASE_URL, '', 'unsafe-url', '[no-referrer]'], - [OTHER_URL, '', '', '[no-referrer]'], - [OTHER_URL, '', 'no-referrer', '[no-referrer]'], - [OTHER_URL, '', 'no-referrer-when-downgrade', '[no-referrer]'], - [OTHER_URL, '', 'origin', '[no-referrer]'], - [OTHER_URL, '', 'origin-when-cross-origin', '[no-referrer]'], - [OTHER_URL, '', 'unsafe-url', '[no-referrer]'], + [BASE_URL, '', '', '[no-referrer]'], + [BASE_URL, '', 'no-referrer', '[no-referrer]'], + [BASE_URL, '', 'no-referrer-when-downgrade', '[no-referrer]'], + [BASE_URL, '', 'origin', '[no-referrer]'], + [BASE_URL, '', 'origin-when-cross-origin', '[no-referrer]'], + [BASE_URL, '', 'unsafe-url', '[no-referrer]'], + [OTHER_URL, '', '', '[no-referrer]'], + [OTHER_URL, '', 'no-referrer', '[no-referrer]'], + [OTHER_URL, '', 'no-referrer-when-downgrade', '[no-referrer]'], + [OTHER_URL, '', 'origin', '[no-referrer]'], + [OTHER_URL, '', 'origin-when-cross-origin', '[no-referrer]'], + [OTHER_URL, '', 'unsafe-url', '[no-referrer]'], - [BASE_URL, '/foo', '', BASE_ORIGIN + '/foo'], - [BASE_URL, '/foo', 'no-referrer', '[no-referrer]'], - [BASE_URL, '/foo', 'no-referrer-when-downgrade', BASE_ORIGIN + '/foo'], - [BASE_URL, '/foo', 'origin', BASE_ORIGIN + '/'], - [BASE_URL, '/foo', 'origin-when-cross-origin', BASE_ORIGIN + '/foo'], - [BASE_URL, '/foo', 'unsafe-url', BASE_ORIGIN + '/foo'], - [OTHER_URL, '/foo', '', BASE_ORIGIN + '/foo'], - [OTHER_URL, '/foo', 'no-referrer', '[no-referrer]'], - [OTHER_URL, '/foo', 'no-referrer-when-downgrade', BASE_ORIGIN + '/foo'], - [OTHER_URL, '/foo', 'origin', BASE_ORIGIN + '/'], - [OTHER_URL, '/foo', 'origin-when-cross-origin', BASE_ORIGIN + '/'], - [OTHER_URL, '/foo', 'unsafe-url', BASE_ORIGIN + '/foo'], -]; + [BASE_URL, '/foo', '', BASE_ORIGIN + '/foo'], + [BASE_URL, '/foo', 'no-referrer', '[no-referrer]'], + [BASE_URL, '/foo', 'no-referrer-when-downgrade', BASE_ORIGIN + '/foo'], + [BASE_URL, '/foo', 'origin', BASE_ORIGIN + '/'], + [BASE_URL, '/foo', 'origin-when-cross-origin', BASE_ORIGIN + '/foo'], + [BASE_URL, '/foo', 'unsafe-url', BASE_ORIGIN + '/foo'], + [OTHER_URL, '/foo', '', BASE_ORIGIN + '/'], + [OTHER_URL, '/foo', 'no-referrer', '[no-referrer]'], + [OTHER_URL, '/foo', 'no-referrer-when-downgrade', BASE_ORIGIN + '/foo'], + [OTHER_URL, '/foo', 'origin', BASE_ORIGIN + '/'], + [OTHER_URL, '/foo', 'origin-when-cross-origin', BASE_ORIGIN + '/'], + [OTHER_URL, '/foo', 'strict-origin-when-cross-origin', BASE_ORIGIN + '/'], + [OTHER_URL, '/foo', 'unsafe-url', BASE_ORIGIN + '/foo'], + ]; -add_referrer_tests(TESTS); -done(); -</script> + add_referrer_tests(TESTS); + done(); + </script> </body> + </html>
diff --git a/third_party/blink/web_tests/http/tests/fetch/referrer/serviceworker-echo-referrer-from-default-document.html b/third_party/blink/web_tests/http/tests/fetch/referrer/serviceworker-echo-referrer-from-default-document.html index 865e23d..8a2c0b69 100644 --- a/third_party/blink/web_tests/http/tests/fetch/referrer/serviceworker-echo-referrer-from-default-document.html +++ b/third_party/blink/web_tests/http/tests/fetch/referrer/serviceworker-echo-referrer-from-default-document.html
@@ -16,7 +16,7 @@ const TESTS = [ [URL, 'about:client', - '', REFERRER_SOURCE, 'no-referrer-when-downgrade'], + '', REFERRER_SOURCE, 'strict-origin-when-cross-origin'], [URL, 'about:client', 'no-referrer', '', 'no-referrer'], [URL, 'about:client', 'no-referrer-when-downgrade',
diff --git a/third_party/blink/web_tests/http/tests/fetch/script-tests/referrer.js b/third_party/blink/web_tests/http/tests/fetch/script-tests/referrer.js index c684ed6..5b323349 100644 --- a/third_party/blink/web_tests/http/tests/fetch/script-tests/referrer.js +++ b/third_party/blink/web_tests/http/tests/fetch/script-tests/referrer.js
@@ -16,11 +16,12 @@ [BASE_URL, 'about:client', 'origin', BASE_ORIGIN + '/'], [BASE_URL, 'about:client', 'origin-when-cross-origin', REFERRER_SOURCE], [BASE_URL, 'about:client', 'unsafe-url', REFERRER_SOURCE], - [OTHER_URL, 'about:client', '', REFERRER_SOURCE], + [OTHER_URL, 'about:client', '', BASE_ORIGIN + '/'], [OTHER_URL, 'about:client', 'no-referrer', '[no-referrer]'], [OTHER_URL, 'about:client', 'no-referrer-when-downgrade', REFERRER_SOURCE], [OTHER_URL, 'about:client', 'origin', BASE_ORIGIN + '/'], [OTHER_URL, 'about:client', 'origin-when-cross-origin', BASE_ORIGIN + '/'], + [OTHER_URL, 'about:client', 'strict-origin-when-cross-origin', BASE_ORIGIN + '/'], [OTHER_URL, 'about:client', 'unsafe-url', REFERRER_SOURCE], [BASE_URL, '', '', '[no-referrer]'], @@ -42,11 +43,12 @@ [BASE_URL, '/foo', 'origin', BASE_ORIGIN + '/'], [BASE_URL, '/foo', 'origin-when-cross-origin', BASE_ORIGIN + '/foo'], [BASE_URL, '/foo', 'unsafe-url', BASE_ORIGIN + '/foo'], - [OTHER_URL, '/foo', '', BASE_ORIGIN + '/foo'], + [OTHER_URL, '/foo', '', BASE_ORIGIN + '/'], [OTHER_URL, '/foo', 'no-referrer', '[no-referrer]'], [OTHER_URL, '/foo', 'no-referrer-when-downgrade', BASE_ORIGIN + '/foo'], [OTHER_URL, '/foo', 'origin', BASE_ORIGIN + '/'], [OTHER_URL, '/foo', 'origin-when-cross-origin', BASE_ORIGIN + '/'], + [OTHER_URL, '/foo', 'strict-origin-when-cross-origin', BASE_ORIGIN + '/'], [OTHER_URL, '/foo', 'unsafe-url', BASE_ORIGIN + '/foo'], [BASE_URL,
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-enforced-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-enforced-expected.txt new file mode 100644 index 0000000..2f7d59a --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-enforced-expected.txt
@@ -0,0 +1,6 @@ +Breakpoint on Trusted Type violations +violation type: trustedtype-policy-violation +paused reason: CSPViolation +violation type: trustedtype-sink-violation +paused reason: CSPViolation +
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-enforced.js b/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-enforced.js new file mode 100644 index 0000000..e61444e --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-enforced.js
@@ -0,0 +1,25 @@ +(async function(testRunner) { + const {session, dp} = + await testRunner.startURL( + 'https://devtools.test:8443/inspector-protocol/resources/content-security-policy-issue-trusted-types-policy.php', + 'Breakpoint on Trusted Type violations'); + await dp.Debugger.enable(); + await dp.DOM.enable(); + await dp.DOMDebugger.setBreakOnCSPViolation({violationTypes:['trustedtype-sink-violation','trustedtype-policy-violation']}); + + const code1 = `trustedTypes.createPolicy("policy2", {});`; + session.evaluate(code1); + const pause1 = await dp.Debugger.oncePaused(); + testRunner.log(`violation type: ${pause1.params.data.violationType}`); + testRunner.log(`paused reason: ${pause1.params.reason}`); + dp.Debugger.resume(); + + const code2 = `document.body.innerHTML="a";`; + session.evaluate(code2); + const pause2 = await dp.Debugger.oncePaused(); + testRunner.log(`violation type: ${pause2.params.data.violationType}`); + testRunner.log(`paused reason: ${pause2.params.reason}`); + dp.Debugger.resume(); + + testRunner.completeTest(); +})
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-report-only-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-report-only-expected.txt new file mode 100644 index 0000000..2f7d59a --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-report-only-expected.txt
@@ -0,0 +1,6 @@ +Breakpoint on Trusted Type violations +violation type: trustedtype-policy-violation +paused reason: CSPViolation +violation type: trustedtype-sink-violation +paused reason: CSPViolation +
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-report-only.js b/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-report-only.js new file mode 100644 index 0000000..76e8caf8 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-report-only.js
@@ -0,0 +1,27 @@ +(async function(testRunner) { + const {session, dp} = + await testRunner.startURL( + 'https://devtools.test:8443/inspector-protocol/resources/content-security-policy-issue-trusted-types-policy.php?rpt', + 'Breakpoint on Trusted Type violations'); + await dp.Debugger.enable(); + await dp.DOM.enable(); + await dp.DOMDebugger.setBreakOnCSPViolation({violationTypes:['trustedtype-sink-violation','trustedtype-policy-violation']}); + + const code = ` + trustedTypes.createPolicy("policy2", {}); + document.body.innerHTML="a"; + `; + session.evaluate(code); + + const pause1 = await dp.Debugger.oncePaused(); + testRunner.log(`violation type: ${pause1.params.data.violationType}`); + testRunner.log(`paused reason: ${pause1.params.reason}`); + dp.Debugger.resume(); + + const pause2 = await dp.Debugger.oncePaused(); + testRunner.log(`violation type: ${pause2.params.data.violationType}`); + testRunner.log(`paused reason: ${pause2.params.reason}`); + dp.Debugger.resume(); + + testRunner.completeTest(); +})
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-with-exception-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-with-exception-expected.txt new file mode 100644 index 0000000..4796542 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-with-exception-expected.txt
@@ -0,0 +1,5 @@ +Breakpoint on Trusted Type violations with exception +violation type: trustedtype-sink-violation +paused reason: CSPViolation +paused reason: exception +
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-with-exception.js b/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-with-exception.js new file mode 100644 index 0000000..2421a71 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/dom/breakpoint-csp-violation-with-exception.js
@@ -0,0 +1,27 @@ +(async function(testRunner) { + const {session, dp} = await testRunner.startURL( + 'https://devtools.test:8443/inspector-protocol/resources/content-security-policy-issue-trusted-types-policy.php', + 'Breakpoint on Trusted Type violations with exception'); + await dp.Debugger.enable(); + await dp.DOM.enable(); + + await dp.DOMDebugger.setBreakOnCSPViolation({ + violationTypes: + ['trustedtype-sink-violation', 'trustedtype-policy-violation'] + }); + await dp.Debugger.setPauseOnExceptions({state: 'all'}); + + const code = `document.firstElementChild.innerHTML = "a";`; + session.evaluate(code); + + const pause1 = await dp.Debugger.oncePaused(); + testRunner.log(`violation type: ${pause1.params.data.violationType}`); + testRunner.log(`paused reason: ${pause1.params.reason}`); + dp.Debugger.resume(); + + const pause2 = await dp.Debugger.oncePaused(); + testRunner.log(`paused reason: ${pause2.params.reason}`); + dp.Debugger.resume(); + + testRunner.completeTest(); + }) \ No newline at end of file
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src-expected.txt new file mode 100644 index 0000000..883168b --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src-expected.txt
@@ -0,0 +1,5 @@ +Tests sending of info for iframe with src +Frame navigated to http://devtools.test:8000/inspector-protocol/page/resources/iframe-src.html +Frame navigated to http://devtools.test:8000/inspector-protocol/resources/empty.html +Received information about 2 frame(s). +
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src-write-delay-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src-write-delay-expected.txt new file mode 100644 index 0000000..cf53c20 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src-write-delay-expected.txt
@@ -0,0 +1,6 @@ +Tests sending of info for iframe with src which is being written to after a delay +Frame navigated to http://devtools.test:8000/inspector-protocol/page/resources/iframe-src-write-delay.html +Frame navigated to http://devtools.test:8000/inspector-protocol/resources/empty.html +Document opened, new url: http://devtools.test:8000/inspector-protocol/page/resources/iframe-src-write-delay.html +Received information about 2 frame(s). +
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src-write-delay.js b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src-write-delay.js new file mode 100644 index 0000000..feaf2c8 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src-write-delay.js
@@ -0,0 +1,24 @@ +(async function(testRunner) { + const {page, dp} = await testRunner.startBlank( + `Tests sending of info for iframe with src which is being written to after a delay`); + + await dp.Page.enable(); + const frameIDs = new Set(); + + page.navigate('http://devtools.test:8000/inspector-protocol/page/resources/iframe-src-write-delay.html'); + + let frame = (await dp.Page.onceFrameNavigated()).params.frame; + testRunner.log(`Frame navigated to ${frame.url}`); + frameIDs.add(frame.id); + + frame = (await dp.Page.onceFrameNavigated()).params.frame; + testRunner.log(`Frame navigated to ${frame.url}`); + frameIDs.add(frame.id); + + frame = (await dp.Page.onceDocumentOpened()).params.frame; + testRunner.log(`Document opened, new url: ${frame.url}`); + frameIDs.add(frame.id); + + testRunner.log(`Received information about ${frameIDs.size} frame(s).`); + testRunner.completeTest(); +})
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src-write-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src-write-expected.txt new file mode 100644 index 0000000..adea53d --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src-write-expected.txt
@@ -0,0 +1,5 @@ +Tests sending of info for iframe with src which is being written to +Frame navigated to http://devtools.test:8000/inspector-protocol/page/resources/iframe-src-write.html +Document opened, new url: http://devtools.test:8000/inspector-protocol/page/resources/iframe-src-write.html +Received information about 2 frame(s). +
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src-write.js b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src-write.js new file mode 100644 index 0000000..2f6f940 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src-write.js
@@ -0,0 +1,20 @@ +(async function(testRunner) { + const {page, dp} = await testRunner.startBlank( + `Tests sending of info for iframe with src which is being written to`); + + await dp.Page.enable(); + const frameIDs = new Set(); + + dp.Page.onFrameNavigated((event) => { + testRunner.log(`Frame navigated to ${event.params.frame.url}`); + frameIDs.add(event.params.frame.id); + }); + dp.Page.onDocumentOpened((event) => { + testRunner.log(`Document opened, new url: ${event.params.frame.url}`); + frameIDs.add(event.params.frame.id); + }); + + await page.navigate('http://devtools.test:8000/inspector-protocol/page/resources/iframe-src-write.html'); + testRunner.log(`Received information about ${frameIDs.size} frame(s).`); + testRunner.completeTest(); +})
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src.js b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src.js new file mode 100644 index 0000000..70c2e9b --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-src.js
@@ -0,0 +1,20 @@ +(async function(testRunner) { + const {page, dp} = await testRunner.startBlank( + `Tests sending of info for iframe with src`); + + await dp.Page.enable(); + const frameIDs = new Set(); + + dp.Page.onFrameNavigated((event) => { + testRunner.log(`Frame navigated to ${event.params.frame.url}`); + frameIDs.add(event.params.frame.id); + }); + dp.Page.onDocumentOpened((event) => { + testRunner.log(`Document opened, new url: ${event.params.frame.url}`); + frameIDs.add(event.params.frame.id); + }); + + await page.navigate('http://devtools.test:8000/inspector-protocol/page/resources/iframe-src.html'); + testRunner.log(`Received information about ${frameIDs.size} frame(s).`); + testRunner.completeTest(); +})
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc-expected.txt new file mode 100644 index 0000000..3c5e2e7 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc-expected.txt
@@ -0,0 +1,5 @@ +Tests sending of info for iframe with srcdoc +Frame navigated to http://devtools.test:8000/inspector-protocol/page/resources/iframe-srcdoc.html +Frame navigated to about:srcdoc +Received information about 2 frame(s). +
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc-write-delay-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc-write-delay-expected.txt new file mode 100644 index 0000000..048ab79 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc-write-delay-expected.txt
@@ -0,0 +1,6 @@ +Tests sending of info for iframe with srcdoc which is being written to after a delay +Frame navigated to http://devtools.test:8000/inspector-protocol/page/resources/iframe-srcdoc-write-delay.html +Frame navigated to about:srcdoc +Document opened, new url: http://devtools.test:8000/inspector-protocol/page/resources/iframe-srcdoc-write-delay.html +Received information about 2 frame(s). +
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc-write-delay.js b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc-write-delay.js new file mode 100644 index 0000000..92a2651 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc-write-delay.js
@@ -0,0 +1,25 @@ +(async function(testRunner) { + const {page, dp} = await testRunner.startBlank( + `Tests sending of info for iframe with srcdoc which is being written to after a delay`); + + await dp.Page.enable(); + const frameIDs = new Set(); + + page.navigate('http://devtools.test:8000/inspector-protocol/page/resources/iframe-srcdoc-write-delay.html'); + + let frame = (await dp.Page.onceFrameNavigated()).params.frame; + testRunner.log(`Frame navigated to ${frame.url}`); + frameIDs.add(frame.id); + + frame = (await dp.Page.onceFrameNavigated()).params.frame; + testRunner.log(`Frame navigated to ${frame.url}`); + frameIDs.add(frame.id); + + frame = (await dp.Page.onceDocumentOpened()).params.frame; + testRunner.log(`Document opened, new url: ${frame.url}`); + frameIDs.add(frame.id); + + testRunner.log(`Received information about ${frameIDs.size} frame(s).`); + testRunner.completeTest(); +}) +
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc-write-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc-write-expected.txt new file mode 100644 index 0000000..972abc1 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc-write-expected.txt
@@ -0,0 +1,5 @@ +Tests sending of info for iframe with srcdoc which is being written to +Frame navigated to http://devtools.test:8000/inspector-protocol/page/resources/iframe-srcdoc-write.html +Document opened, new url: http://devtools.test:8000/inspector-protocol/page/resources/iframe-srcdoc-write.html +Received information about 2 frame(s). +
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc-write.js b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc-write.js new file mode 100644 index 0000000..f03d75a41 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc-write.js
@@ -0,0 +1,20 @@ +(async function(testRunner) { + const {page, dp} = await testRunner.startBlank( + `Tests sending of info for iframe with srcdoc which is being written to`); + + await dp.Page.enable(); + const frameIDs = new Set(); + + dp.Page.onFrameNavigated((event) => { + testRunner.log(`Frame navigated to ${event.params.frame.url}`); + frameIDs.add(event.params.frame.id); + }); + dp.Page.onDocumentOpened((event) => { + testRunner.log(`Document opened, new url: ${event.params.frame.url}`); + frameIDs.add(event.params.frame.id); + }); + + await page.navigate('http://devtools.test:8000/inspector-protocol/page/resources/iframe-srcdoc-write.html'); + testRunner.log(`Received information about ${frameIDs.size} frame(s).`); + testRunner.completeTest(); +})
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc.js b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc.js new file mode 100644 index 0000000..7ba63fa --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/iframe-srcdoc.js
@@ -0,0 +1,20 @@ +(async function(testRunner) { + const {page, dp} = await testRunner.startBlank( + `Tests sending of info for iframe with srcdoc`); + + await dp.Page.enable(); + const frameIDs = new Set(); + + dp.Page.onFrameNavigated((event) => { + testRunner.log(`Frame navigated to ${event.params.frame.url}`); + frameIDs.add(event.params.frame.id); + }); + dp.Page.onDocumentOpened((event) => { + testRunner.log(`Document opened, new url: ${event.params.frame.url}`); + frameIDs.add(event.params.frame.id); + }); + + await page.navigate('http://devtools.test:8000/inspector-protocol/page/resources/iframe-srcdoc.html'); + testRunner.log(`Received information about ${frameIDs.size} frame(s).`); + testRunner.completeTest(); +})
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-src-write-delay.html b/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-src-write-delay.html new file mode 100644 index 0000000..9bcf519 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-src-write-delay.html
@@ -0,0 +1,9 @@ +<iframe id="frame" src="http://devtools.test:8000/inspector-protocol/resources/empty.html"></iframe> +<script> + window.setTimeout(() => { + const doc = document.getElementById('frame').contentDocument; + doc.open(); + doc.write("<h1>Hello world!</h1>"); + doc.close(); + }, 0); +</script>
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-src-write.html b/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-src-write.html new file mode 100644 index 0000000..526d6a64 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-src-write.html
@@ -0,0 +1,7 @@ +<iframe id="frame" src="http://devtools.test:8000/inspector-protocol/resources/empty.html"></iframe> +<script> + const doc = document.getElementById('frame').contentDocument; + doc.open(); + doc.write("<h1>Hello world!</h1>"); + doc.close(); +</script>
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-src.html b/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-src.html new file mode 100644 index 0000000..9d95a02 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-src.html
@@ -0,0 +1 @@ +<iframe id="frame" src="http://devtools.test:8000/inspector-protocol/resources/empty.html"></iframe>
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-srcdoc-write-delay.html b/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-srcdoc-write-delay.html new file mode 100644 index 0000000..d584f8b --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-srcdoc-write-delay.html
@@ -0,0 +1,10 @@ +<iframe srcdoc id="frame"></iframe> + +<script> + window.setTimeout(() => { + const doc = document.getElementById('frame').contentDocument; + doc.open(); + doc.write("<h1>Hello world!</h1>"); + doc.close(); + }, 0); +</script> \ No newline at end of file
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-srcdoc-write.html b/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-srcdoc-write.html new file mode 100644 index 0000000..59f6731 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-srcdoc-write.html
@@ -0,0 +1,9 @@ + +<iframe srcdoc id="frame"></iframe> + +<script> + const doc = document.getElementById('frame').contentDocument; + doc.open(); + doc.write("<h1>Hello world!</h1>"); + doc.close(); +</script>
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-srcdoc.html b/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-srcdoc.html new file mode 100644 index 0000000..0c61e6b9 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/resources/iframe-srcdoc.html
@@ -0,0 +1,2 @@ + +<iframe srcdoc id="frame"></iframe>
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/resources/content-security-policy-issue-trusted-types-policy.php b/third_party/blink/web_tests/http/tests/inspector-protocol/resources/content-security-policy-issue-trusted-types-policy.php index c32d70e5..623f265a 100644 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/resources/content-security-policy-issue-trusted-types-policy.php +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/resources/content-security-policy-issue-trusted-types-policy.php
@@ -1,5 +1,9 @@ <?php -header("Content-Security-Policy: require-trusted-types-for 'script'; trusted-types policy1"); +if(isset($_GET['rpt'])) { + header("Content-Security-Policy-Report-Only: require-trusted-types-for 'script'; trusted-types policy1"); +} else { + header("Content-Security-Policy: require-trusted-types-for 'script'; trusted-types policy1"); +} ?> <!DOCTYPE html> <html>
diff --git a/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-get-expected.txt b/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-get-expected.txt index 73c7968..bb9b551d 100644 --- a/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-get-expected.txt +++ b/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-get-expected.txt
@@ -13,7 +13,7 @@ HTTP_CONNECTION = keep-alive HTTP_HOST = localhost:8080 -HTTP_REFERER = http://127.0.0.1:8000/navigation/form-targets-cross-site-frame-get.html +HTTP_REFERER = http://127.0.0.1:8000/ HTTP_SEC_CH_UA = "content_shell";v="999" HTTP_SEC_CH_UA_MOBILE = ?0 HTTP_SEC_FETCH_DEST = iframe
diff --git a/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-post-expected.txt b/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-post-expected.txt index d68b7c3..c1d0c3f 100644 --- a/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-post-expected.txt +++ b/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-post-expected.txt
@@ -15,7 +15,7 @@ HTTP_CONNECTION = keep-alive HTTP_HOST = localhost:8080 HTTP_ORIGIN = http://127.0.0.1:8000 -HTTP_REFERER = http://127.0.0.1:8000/navigation/form-targets-cross-site-frame-post.html +HTTP_REFERER = http://127.0.0.1:8000/ HTTP_SEC_CH_UA = "content_shell";v="999" HTTP_SEC_CH_UA_MOBILE = ?0 HTTP_SEC_FETCH_DEST = iframe
diff --git a/third_party/blink/web_tests/http/tests/navigation/form-with-enctype-targets-cross-site-frame-expected.txt b/third_party/blink/web_tests/http/tests/navigation/form-with-enctype-targets-cross-site-frame-expected.txt index 7080586..c1d0c3f 100644 --- a/third_party/blink/web_tests/http/tests/navigation/form-with-enctype-targets-cross-site-frame-expected.txt +++ b/third_party/blink/web_tests/http/tests/navigation/form-with-enctype-targets-cross-site-frame-expected.txt
@@ -15,7 +15,7 @@ HTTP_CONNECTION = keep-alive HTTP_HOST = localhost:8080 HTTP_ORIGIN = http://127.0.0.1:8000 -HTTP_REFERER = http://127.0.0.1:8000/navigation/form-with-enctype-targets-cross-site-frame.html +HTTP_REFERER = http://127.0.0.1:8000/ HTTP_SEC_CH_UA = "content_shell";v="999" HTTP_SEC_CH_UA_MOBILE = ?0 HTTP_SEC_FETCH_DEST = iframe
diff --git a/third_party/blink/web_tests/http/tests/security/resources/referrer-attr-anchor-target.html b/third_party/blink/web_tests/http/tests/security/resources/referrer-attr-anchor-target.html index ceb33b1..2315ccf 100644 --- a/third_party/blink/web_tests/http/tests/security/resources/referrer-attr-anchor-target.html +++ b/third_party/blink/web_tests/http/tests/security/resources/referrer-attr-anchor-target.html
@@ -16,7 +16,7 @@ else if (hash === "unsafe-url") expected_referrer = "http://127.0.0.1:8000/security/referrer-policy-attribute-anchor-unsafe-url.html"; else if (hash === "no-policy") - expected_referrer = "http://127.0.0.1:8000/security/referrer-policy-attribute-no-policy.html"; + expected_referrer = "http://127.0.0.1:8000/"; else if (hash === "origin-when-crossorigin") expected_referrer = "http://127.0.0.1:8000/"; else if (hash === "no-referrer" ||
diff --git a/third_party/blink/web_tests/http/tests/sendbeacon/beacon-cross-origin-expected.txt b/third_party/blink/web_tests/http/tests/sendbeacon/beacon-cross-origin-expected.txt index 3b8deb41e9..e639cba 100644 --- a/third_party/blink/web_tests/http/tests/sendbeacon/beacon-cross-origin-expected.txt +++ b/third_party/blink/web_tests/http/tests/sendbeacon/beacon-cross-origin-expected.txt
@@ -7,7 +7,7 @@ PASS Beacon sent successfully PASS Content-Type: text/plain;charset=UTF-8 PASS Origin: http://127.0.0.1:8000 -PASS Referer: http://127.0.0.1:8000/sendbeacon/beacon-cross-origin.html +PASS Referer: http://127.0.0.1:8000/ PASS Request-Method: POST PASS Length: 11 PASS Body: CrossOrigin
diff --git a/third_party/blink/web_tests/virtual/out-of-blink-cspee/README.md b/third_party/blink/web_tests/virtual/out-of-blink-cspee/README.md deleted file mode 100644 index 0ef9577..0000000 --- a/third_party/blink/web_tests/virtual/out-of-blink-cspee/README.md +++ /dev/null
@@ -1,6 +0,0 @@ -This directory is for testing out-of-blink CSP Embedded Enforcement. - -The feature has been now turned on by default, so we keep this virtual test -suite for the previous, in-blink functionality. - -This test suite runs the tests with --disable-features=OutOfBlinkCSPEE.
diff --git a/third_party/blink/web_tests/virtual/policy-container/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-history-about-srcdoc-expected.txt b/third_party/blink/web_tests/virtual/policy-container/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-history-about-srcdoc-expected.txt new file mode 100644 index 0000000..0db8bcd --- /dev/null +++ b/third_party/blink/web_tests/virtual/policy-container/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-history-about-srcdoc-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +FAIL History navigation reuses original policy. assert_equals: History navigation reuses original policy. expected (undefined) undefined but got (string) "http://web-platform.test:8001/" +PASS New srcdoc iframe uses new policy. +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/virtual/policy-container/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript-child-expected.txt b/third_party/blink/web_tests/virtual/policy-container/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript-child-expected.txt index a1d79636..ddbff285 100644 --- a/third_party/blink/web_tests/virtual/policy-container/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript-child-expected.txt +++ b/third_party/blink/web_tests/virtual/policy-container/external/wpt/referrer-policy/generic/inheritance/iframe-inheritance-javascript-child-expected.txt
@@ -1,7 +1,7 @@ This is a testharness.js-based test. PASS Referrer Policy: iframes with javascript url reuse referrer policy PASS Referrer Policy: iframes with javascript url reuse referrer policy 1 -PASS Referrer Policy: iframes with javascript url reuse referrer policy 2 +FAIL Referrer Policy: iframes with javascript url reuse referrer policy 2 assert_equals: expected (undefined) undefined but got (string) "http://web-platform.test:8001/referrer-policy/generic/inheritance/iframe-inheritance-javascript-child.html" PASS Referrer Policy: iframes with javascript url reuse referrer policy 3 Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/virtual/stable/http/tests/navigation/form-targets-cross-site-frame-get-expected.txt b/third_party/blink/web_tests/virtual/stable/http/tests/navigation/form-targets-cross-site-frame-get-expected.txt index b8ac378..c0fe7221 100644 --- a/third_party/blink/web_tests/virtual/stable/http/tests/navigation/form-targets-cross-site-frame-get-expected.txt +++ b/third_party/blink/web_tests/virtual/stable/http/tests/navigation/form-targets-cross-site-frame-get-expected.txt
@@ -13,7 +13,7 @@ HTTP_CONNECTION = keep-alive HTTP_HOST = localhost:8080 -HTTP_REFERER = http://127.0.0.1:8000/navigation/form-targets-cross-site-frame-get.html +HTTP_REFERER = http://127.0.0.1:8000/ HTTP_SEC_FETCH_DEST = iframe HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = cross-site
diff --git a/third_party/blink/web_tests/virtual/stable/http/tests/navigation/form-targets-cross-site-frame-post-expected.txt b/third_party/blink/web_tests/virtual/stable/http/tests/navigation/form-targets-cross-site-frame-post-expected.txt index 56e67f46..7bae065f 100644 --- a/third_party/blink/web_tests/virtual/stable/http/tests/navigation/form-targets-cross-site-frame-post-expected.txt +++ b/third_party/blink/web_tests/virtual/stable/http/tests/navigation/form-targets-cross-site-frame-post-expected.txt
@@ -15,7 +15,7 @@ HTTP_CONNECTION = keep-alive HTTP_HOST = localhost:8080 HTTP_ORIGIN = http://127.0.0.1:8000 -HTTP_REFERER = http://127.0.0.1:8000/navigation/form-targets-cross-site-frame-post.html +HTTP_REFERER = http://127.0.0.1:8000/ HTTP_SEC_FETCH_DEST = iframe HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = cross-site
diff --git a/third_party/blink/web_tests/virtual/stable/http/tests/navigation/form-with-enctype-targets-cross-site-frame-expected.txt b/third_party/blink/web_tests/virtual/stable/http/tests/navigation/form-with-enctype-targets-cross-site-frame-expected.txt index 16e7e64..7bae065f 100644 --- a/third_party/blink/web_tests/virtual/stable/http/tests/navigation/form-with-enctype-targets-cross-site-frame-expected.txt +++ b/third_party/blink/web_tests/virtual/stable/http/tests/navigation/form-with-enctype-targets-cross-site-frame-expected.txt
@@ -15,7 +15,7 @@ HTTP_CONNECTION = keep-alive HTTP_HOST = localhost:8080 HTTP_ORIGIN = http://127.0.0.1:8000 -HTTP_REFERER = http://127.0.0.1:8000/navigation/form-with-enctype-targets-cross-site-frame.html +HTTP_REFERER = http://127.0.0.1:8000/ HTTP_SEC_FETCH_DEST = iframe HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = cross-site
diff --git a/third_party/nearby/README.chromium b/third_party/nearby/README.chromium index 71bd237..57683e95 100644 --- a/third_party/nearby/README.chromium +++ b/third_party/nearby/README.chromium
@@ -1,7 +1,7 @@ Name: Nearby Connections Library Short Name: Nearby URL: https://github.com/google/nearby-connections -Version: 7df0f96a015af09bb7b9b0b42b2b3637d428f012 +Version: 2097279b66bfec0f36970973d2b69357d2ff49b4 License: Apache 2.0 License File: LICENSE Security Critical: yes
diff --git a/tools/clang/scripts/package.py b/tools/clang/scripts/package.py index cfed526..7b08806 100755 --- a/tools/clang/scripts/package.py +++ b/tools/clang/scripts/package.py
@@ -397,6 +397,8 @@ if sys.platform.startswith('linux'): os.symlink('lld', os.path.join(pdir, 'bin', 'ld.lld')) + os.symlink('lld', os.path.join(pdir, 'bin', 'ld64.lld')) + os.symlink('lld', os.path.join(pdir, 'bin', 'ld64.lld.darwinnew')) os.symlink('lld', os.path.join(pdir, 'bin', 'lld-link')) # Copy libc++ headers. @@ -473,8 +475,10 @@ os.path.join(llddir, 'bin')) shutil.copy(os.path.join(LLVM_RELEASE_DIR, 'bin', 'llvm-ar'), os.path.join(llddir, 'bin')) - os.symlink('lld', os.path.join(llddir, 'bin', 'lld-link')) os.symlink('lld', os.path.join(llddir, 'bin', 'ld.lld')) + os.symlink('lld', os.path.join(llddir, 'bin', 'ld64.lld')) + os.symlink('lld', os.path.join(llddir, 'bin', 'ld64.lld.darwinnew')) + os.symlink('lld', os.path.join(llddir, 'bin', 'lld-link')) with tarfile.open(llddir + '.tgz', 'w:gz') as tar: tar.add(os.path.join(llddir, 'bin'), arcname='bin', filter=PrintTarProgress)
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py index 3fdf468..8498dc83 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py
@@ -38,7 +38,7 @@ # https://chromium.googlesource.com/chromium/src/+/master/docs/updating_clang.md # Reverting problematic clang rolls is safe, though. # This is the output of `git describe` and is usable as a commit-ish. -CLANG_REVISION = 'llvmorg-12-init-11462-g418f18c6' +CLANG_REVISION = 'llvmorg-12-init-11780-g6ef07111' CLANG_SUB_REVISION = 1 PACKAGE_VERSION = '%s-%s' % (CLANG_REVISION, CLANG_SUB_REVISION) @@ -178,12 +178,28 @@ sys.exit(1) +def DownloadAndUnpackClangMacRuntime(output_dir): + cds_file = "clang-%s.tgz" % PACKAGE_VERSION + cds_full_url = GetPlatformUrlPrefix('mac') + cds_file + path_prefixes = [ + 'lib/clang/' + RELEASE_VERSION + '/lib/darwin', 'include/c++/v1' + ] + try: + DownloadAndUnpack(cds_full_url, output_dir, path_prefixes) + except URLError: + print('Failed to download prebuilt clang %s' % cds_file) + print('Use build.py if you want to build locally.') + print('Exiting.') + sys.exit(1) + + # TODO(hans): Create a clang-win-runtime package instead. def DownloadAndUnpackClangWinRuntime(output_dir): - cds_file = "clang-%s.tgz" % PACKAGE_VERSION + cds_file = "clang-%s.tgz" % PACKAGE_VERSION cds_full_url = GetPlatformUrlPrefix('win') + cds_file - path_prefixes = [ 'lib/clang/' + RELEASE_VERSION + '/lib/', - 'bin/llvm-symbolizer.exe' ] + path_prefixes = [ + 'lib/clang/' + RELEASE_VERSION + '/lib/windows', 'bin/llvm-symbolizer.exe' + ] try: DownloadAndUnpack(cds_full_url, output_dir, path_prefixes) except URLError: @@ -256,6 +272,8 @@ DownloadAndUnpackPackage(package_file, LLVM_BUILD_DIR, host_os) + if package_name == 'clang' and 'mac' in target_os: + DownloadAndUnpackClangMacRuntime(LLVM_BUILD_DIR) if package_name == 'clang' and 'win' in target_os: # When doing win/cross builds on other hosts, get the Windows runtime # libraries, and llvm-symbolizer.exe (needed in asan builds).
diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec index d365f01..de0e7384 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec
@@ -254,7 +254,8 @@ "chrome/browser/resources/sync_file_system_internals/sync_file_system_internals_resources.grd": { "includes": [2180], }, - "chrome/browser/resources/usb_internals/resources.grd": { + "<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/usb_internals/resources.grd": { + "META": {"sizes": {"includes": [20]}}, "includes": [2200], }, "chrome/browser/resources/webapks/webapks_ui_resources.grd": {
diff --git a/tools/json_schema_compiler/cpp_bundle_generator.py b/tools/json_schema_compiler/cpp_bundle_generator.py index 1f35fd9..d874aec 100644 --- a/tools/json_schema_compiler/cpp_bundle_generator.py +++ b/tools/json_schema_compiler/cpp_bundle_generator.py
@@ -347,7 +347,8 @@ c.Append('#include <algorithm>') c.Append('#include <iterator>') c.Append() - c.Append('#include "base/ranges/algorithm.h"') + c.Append('#include "base/containers/fixed_flat_map.h"') + c.Append('#include "base/strings/string_piece.h"') c.Append() c.Append('namespace {') for api in self._bundle._api_defs: @@ -379,33 +380,18 @@ c.Append('// static') c.Sblock('base::StringPiece %s::Get(base::StringPiece name) {' % self._bundle._GenerateBundleClass('GeneratedSchemas')) - c.Sblock('static constexpr struct kSchemaMapping {') - c.Append('const base::StringPiece name;') - c.Append('const base::StringPiece schema;') - c.Sblock('constexpr bool operator<(const kSchemaMapping& that) const {') - c.Append('return name < that.name;') - c.Eblock('}') - c.Eblock() - c.Sblock('} kSchemas[] = {') + + c.Append('static constexpr auto kSchemas = ' + 'base::MakeFixedFlatMap<base::StringPiece, base::StringPiece>({') + c.Sblock() namespaces = [self._bundle._model.namespaces[api.get('namespace')].name for api in self._bundle._api_defs] for namespace in sorted(namespaces): schema_constant_name = _FormatNameAsConstant(namespace) c.Append('{"%s", %s},' % (namespace, schema_constant_name)) - c.Eblock('};') - c.Append('static_assert(base::ranges::is_sorted(kSchemas), "|kSchemas| ' - 'should be sorted.");') - - c.Sblock('auto it = std::lower_bound(std::begin(kSchemas), ' - 'std::end(kSchemas),') - c.Append('kSchemaMapping{name, base::StringPiece()});') - c.Eblock() - - c.Sblock('if (it != std::end(kSchemas) && it->name == name)') - c.Append('return it->schema;') - c.Eblock() - - c.Append('return base::StringPiece();') + c.Eblock('});') + c.Append('auto it = kSchemas.find(name);') + c.Append('return it != kSchemas.end() ? it->second : base::StringPiece();') c.Eblock('}') c.Append() c.Concat(cpp_util.CloseNamespace(self._bundle._cpp_namespace))
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index d52cc64..2ebded1c 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -6625,6 +6625,8 @@ <int value="233" label="RWH_CLOSE_PORTAL"/> <int value="234" label="MSDH_INVALID_STREAM_TYPE"/> <int value="235" label="RFH_CREATE_CHILD_FRAME_TOKENS_NOT_FOUND"/> + <int value="236" label="ASGH_ASSOCIATED_INTERFACE_REQUEST"/> + <int value="237" label="ASGH_RECEIVED_CONTROL_MESSAGE"/> </enum> <enum name="BadMessageReasonExtensions"> @@ -8739,6 +8741,7 @@ Borealis DLC"/> <int value="8" label="Device needs more space to use Borealis DLC"/> <int value="9" label="DLC faced an unknown error"/> + <int value="10" label="Device is offline"/> </enum> <enum name="BorealisStartupResult"> @@ -25360,6 +25363,8 @@ <int value="1530" label="ACCESSIBILITY_PRIVATE_UPDATESELECTTOSPEAKPANEL"/> <int value="1531" label="TAB_GROUPS_MOVE"/> <int value="1532" label="SCRIPTING_EXECUTESCRIPT"/> + <int value="1533" label="DECLARATIVENETREQUEST_UPDATESESSIONRULES"/> + <int value="1534" label="DECLARATIVENETREQUEST_GETSESSIONRULES"/> </enum> <enum name="ExtensionIconState"> @@ -42050,6 +42055,7 @@ <int value="-1956349722" label="disable-smooth-scrolling"/> <int value="-1956231275" label="ForceSpectreVariant2Mitigation:enabled"/> <int value="-1955923385" label="EnableGamepadButtonAxisEvents:enabled"/> + <int value="-1954918413" label="AccountManagementFlowsV2:disabled"/> <int value="-1954246274" label="enable-experimental-accessibility-switch-access"/> <int value="-1953145846" label="TargetEmbeddingLookalikes:disabled"/> @@ -46139,6 +46145,7 @@ <int value="2000291475" label="AutofillEnableInfoBarAccountIndicationFooterForSyncUsers:enabled"/> <int value="2001505416" label="CorbAllowlistAlsoAppliesToOorCors:enabled"/> + <int value="2001520126" label="AccountManagementFlowsV2:enabled"/> <int value="2001562962" label="enable-manual-fallback-for-password-saving:enabled"/> <int value="2002573873" label="ChromeHomeMenuItemsExpandSheet:enabled"/> @@ -60648,6 +60655,13 @@ <int value="5" label="Signed Out: Old avatar"/> </enum> +<enum name="ProfileColorsUniqueness"> + <int value="0" label="Single profile"/> + <int value="1" label="Unique colors (with default theme at most once)"/> + <int value="2" label="Unique colors (with default theme repeated)"/> + <int value="3" label="Repeated colors"/> +</enum> + <enum name="ProfileCreateResult"> <int value="0" label="Failed locally"/> <int value="1" label="Failed remotely"/>
diff --git a/tools/metrics/histograms/histograms_xml/extensions/histograms.xml b/tools/metrics/histograms/histograms_xml/extensions/histograms.xml index 6210065..984266d6 100644 --- a/tools/metrics/histograms/histograms_xml/extensions/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/extensions/histograms.xml
@@ -670,7 +670,7 @@ </histogram> <histogram name="Extensions.DeclarativeNetRequest.ReadDynamicRulesJSONStatus" - enum="ReadDynamicRulesJSONStatus" expires_after="2020-12-30"> + enum="ReadDynamicRulesJSONStatus" expires_after="2021-06-01"> <owner>karandeepb@chromium.org</owner> <owner>rdevlin.cronin@chromium.org</owner> <summary> @@ -754,7 +754,7 @@ </histogram> <histogram name="Extensions.DeclarativeNetRequest.RulesetReindexSuccessful" - enum="BooleanSuccess" expires_after="2020-12-30"> + enum="BooleanSuccess" expires_after="2021-06-01"> <owner>karandeepb@chromium.org</owner> <owner>lazyboy@chromium.org</owner> <summary> @@ -766,7 +766,7 @@ </histogram> <histogram name="Extensions.DeclarativeNetRequest.UpdateDynamicRulesStatus" - enum="UpdateDynamicRulesStatus" expires_after="2020-12-30"> + enum="UpdateDynamicRulesStatus" expires_after="2021-06-01"> <owner>karandeepb@chromium.org</owner> <owner>rdevlin.cronin@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/gpu/histograms.xml b/tools/metrics/histograms/histograms_xml/gpu/histograms.xml index 49f9871..29b1d419 100644 --- a/tools/metrics/histograms/histograms_xml/gpu/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/gpu/histograms.xml
@@ -305,12 +305,12 @@ </histogram> <histogram name="GPU.D3D12FeatureLevel" enum="D3D12FeatureLevel" - expires_after="2020-12-01"> - <owner>vmiura@chromium.org</owner> + expires_after="2021-12-01"> <owner>magchen@chromium.org</owner> + <owner>zmo@chromium.org</owner> <summary> The maximum D3D12 feature level supported in the gpu drivers. It is recorded - 15 seconds after the browser launch. + in the browser process 120 seconds after the browser launch. </summary> </histogram> @@ -640,7 +640,10 @@ </histogram> <histogram name="GPU.GPUChannelHostWaitTime2" units="ms" - expires_after="2020-11-29"> + expires_after="2020-11-18"> + <obsolete> + Used by GPU watchdog V2 finch. Obsolete since 11/18/2020. + </obsolete> <owner>magchen@chromium.org</owner> <owner>zmo@chromium.org</owner> <summary> @@ -650,6 +653,17 @@ </summary> </histogram> +<histogram name="GPU.GPUChannelHostWaitTime3" units="microseconds" + expires_after="2021-12-01"> + <owner>magchen@chromium.org</owner> + <owner>zmo@chromium.org</owner> + <summary> + The wait time between the IPC message sent from the GPU channel host and the + event sync from the GPU process. This is the time the browser UI thread + spends blocked. Recorded only for users with high-resolution clocks. + </summary> +</histogram> + <histogram name="GPU.GPUInitializationTime.V2" units="ms" expires_after="2021-01-08"> <owner>magchen@chromium.org</owner> @@ -1046,12 +1060,12 @@ </histogram> <histogram name="GPU.SupportsDX12" enum="BooleanSupported" - expires_after="2020-12-01"> - <owner>vmiura@chromium.org</owner> + expires_after="2021-12-01"> <owner>magchen@chromium.org</owner> + <owner>zmo@chromium.org</owner> <summary> - This metric shows whether the GPU supports D3D12. It is recorded 120 seconds - after the browser launch. + This metric shows whether the GPU supports D3D12. It is recorded in the + browser process 120 seconds after the browser launch. </summary> </histogram>
diff --git a/tools/metrics/histograms/histograms_xml/others/histograms.xml b/tools/metrics/histograms/histograms_xml/others/histograms.xml index 0aeb0d6..5345ee0 100644 --- a/tools/metrics/histograms/histograms_xml/others/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/others/histograms.xml
@@ -7807,6 +7807,9 @@ <histogram name="Layout.ScrollAnchor.AdjustedScrollOffset" enum="BooleanHit" expires_after="M77"> + <obsolete> + Removed in M89. + </obsolete> <owner>skobes@chromium.org</owner> <summary> Records the number of times ScrollAnchor adjusts the scroll offset. @@ -7815,6 +7818,9 @@ <histogram name="Layout.ScrollAnchor.RestorationStatus" enum="ScrollAnchorRestorationStatus" expires_after="M77"> + <obsolete> + Removed in M89. + </obsolete> <owner>pnoland@chromium.org</owner> <summary> Records the status of attempts to restore a serialized scroll anchor. @@ -7832,6 +7838,9 @@ <histogram name="Layout.ScrollAnchor.SuppressedBySanaclap" enum="BooleanHit" expires_after="M81"> + <obsolete> + Removed in M89. + </obsolete> <owner>ymalik@chromium.org</owner> <summary> Records the number of times scroll anchoring is suppressed because of the @@ -16037,7 +16046,7 @@ </histogram> <histogram name="Viz.DisplayCompositor.RootDamageRect.Overlay" - enum="BooleanOverlayDamageRect" expires_after="2021-03-15"> + enum="BooleanOverlayDamageRect" expires_after="2021-12-01"> <owner>magchen@chromium.org</owner> <owner>zmo@chromium.org</owner> <summary> @@ -16046,7 +16055,7 @@ </histogram> <histogram name="Viz.DisplayCompositor.RootDamageRect.Underlay" - enum="UnderlayDamageRect" expires_after="2020-12-31"> + enum="UnderlayDamageRect" expires_after="2021-12-01"> <owner>magchen@chromium.org</owner> <owner>zmo@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/page/histograms.xml b/tools/metrics/histograms/histograms_xml/page/histograms.xml index 41cca22..43fd03d 100644 --- a/tools/metrics/histograms/histograms_xml/page/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/page/histograms.xml
@@ -695,7 +695,7 @@ </summary> </histogram> -<histogram name="PageLoad.Cpu.TotalUsage" units="ms" expires_after="2021-04-04"> +<histogram name="PageLoad.Cpu.TotalUsage" units="ms" expires_after="2021-11-18"> <owner>alexmt@chromium.org</owner> <owner>johnidel@chromium.org</owner> <summary> @@ -707,7 +707,7 @@ </histogram> <histogram name="PageLoad.Cpu.TotalUsageForegrounded" units="ms" - expires_after="2020-11-18"> + expires_after="2021-11-18"> <owner>alexmt@chromium.org</owner> <owner>johnidel@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/profile/histograms.xml b/tools/metrics/histograms/histograms_xml/profile/histograms.xml index 0fbd7e99..2b0fd18 100644 --- a/tools/metrics/histograms/histograms_xml/profile/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/profile/histograms.xml
@@ -102,6 +102,17 @@ </summary> </histogram> +<histogram name="Profile.ColorsUniqueness" enum="ProfileColorsUniqueness" + expires_after="2021-05-30"> + <owner>jkrcal@chromium.org</owner> + <owner>droger@chromium.org</owner> + <summary> + Records how profile colors are unique on all profiles of the installation. + Recorded every 24 hours (or at the soonest moment after that when Chrome is + started again). + </summary> +</histogram> + <histogram name="Profile.CookiesSize" units="MB" expires_after="2018-08-30"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <summary>Size of the cookies database.</summary>
diff --git a/tools/metrics/histograms/histograms_xml/subresource/histograms.xml b/tools/metrics/histograms/histograms_xml/subresource/histograms.xml index f1d208d..ce6d988 100644 --- a/tools/metrics/histograms/histograms_xml/subresource/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/subresource/histograms.xml
@@ -606,6 +606,36 @@ </summary> </histogram> +<histogram name="SubresourceRedirect.RobotsRulesFetcher.CacheHit" units="ms" + expires_after="M92"> + <owner>rajendrant@chromium.org</owner> + <owner>mcrouse@chromium.org</owner> + <summary> + Records whether LitePages robots rules was fetched from Chrome network + cache. Recorded for every fetch. + </summary> +</histogram> + +<histogram name="SubresourceRedirect.RobotsRulesFetcher.NetErrorCode" + enum="NetErrorCodes" expires_after="M92"> + <owner>rajendrant@chromium.org</owner> + <owner>mcrouse@chromium.org</owner> + <summary> + Net error codes for the LitePages robots rules fetcher. Recorded on every + fetch after completion or failure. + </summary> +</histogram> + +<histogram name="SubresourceRedirect.RobotsRulesFetcher.ResponseCode" + units="ms" expires_after="M92"> + <owner>rajendrant@chromium.org</owner> + <owner>mcrouse@chromium.org</owner> + <summary> + HTTP response code for the LitePages robots rules fetcher. Recorded on every + fetch after completion or failure. + </summary> +</histogram> + </histograms> </histogram-configuration>
diff --git a/tools/traffic_annotation/summary/annotations.xml b/tools/traffic_annotation/summary/annotations.xml index 0bd8fb7..1ec703f 100644 --- a/tools/traffic_annotation/summary/annotations.xml +++ b/tools/traffic_annotation/summary/annotations.xml
@@ -167,6 +167,7 @@ <item id="kaleidoscope_service" added_in_milestone="87" hash_code="49759694" type="0" content_hash_code="14307563" os_list="linux,windows" file_path="chrome/browser/media/kaleidoscope/kaleidoscope_service.cc"/> <item id="kids_chrome_management_client_classify_url" added_in_milestone="77" hash_code="109987793" type="0" deprecated="2019-07-30" content_hash_code="112740597" file_path=""/> <item id="lib_address_input" added_in_milestone="62" hash_code="50816767" type="0" content_hash_code="57977576" os_list="linux,windows" file_path="third_party/libaddressinput/chromium/chrome_metadata_source.cc"/> + <item id="litepages_robots_rules" added_in_milestone="89" hash_code="50910588" type="0" content_hash_code="72567080" os_list="linux,windows" file_path="chrome/browser/subresource_redirect/origin_robots_rules.cc"/> <item id="load_autofill_gstatic_data" added_in_milestone="78" hash_code="119416099" type="0" content_hash_code="8433621" os_list="linux,windows" file_path="chrome/browser/autofill/autofill_gstatic_reader.cc"/> <item id="logo_service" added_in_milestone="73" hash_code="35473769" type="0" content_hash_code="20271299" os_list="linux,windows" file_path="components/search_provider_logos/logo_service_impl.cc"/> <item id="logo_tracker" added_in_milestone="62" hash_code="36859107" type="0" deprecated="2018-12-07" content_hash_code="67588075" file_path=""/>
diff --git a/tools/traffic_annotation/summary/grouping.xml b/tools/traffic_annotation/summary/grouping.xml index a484d46f..d0fbce4 100644 --- a/tools/traffic_annotation/summary/grouping.xml +++ b/tools/traffic_annotation/summary/grouping.xml
@@ -297,6 +297,7 @@ <traffic_annotation unique_id="optimization_guide_model"/> <traffic_annotation unique_id="optimization_guide_model_download"/> <traffic_annotation unique_id="previews_litepage_prober"/> + <traffic_annotation unique_id="litepages_robots_rules"/> </sender> <sender name="Network"> <traffic_annotation unique_id="network_time_component"/>
diff --git a/ui/file_manager/BUILD.gn b/ui/file_manager/BUILD.gn index 1712fa4..1f19e68 100644 --- a/ui/file_manager/BUILD.gn +++ b/ui/file_manager/BUILD.gn
@@ -63,6 +63,7 @@ "file_manager/common/js:js_test_gen_html_modules", "file_manager/foreground/elements:js_test_gen_html", "file_manager/foreground/js:js_test_gen_html", + "file_manager/foreground/js:js_test_gen_html_modules", "file_manager/foreground/js/metadata:js_test_gen_html", "file_manager/foreground/js/metadata:js_test_gen_html_modules", "file_manager/foreground/js/ui:js_test_gen_html",
diff --git a/ui/file_manager/audio_player/js/BUILD.gn b/ui/file_manager/audio_player/js/BUILD.gn index 714316e..9c3921b 100644 --- a/ui/file_manager/audio_player/js/BUILD.gn +++ b/ui/file_manager/audio_player/js/BUILD.gn
@@ -30,6 +30,7 @@ ":background.m", ":error_util.m", ":main.m", + ":metadata_worker.m", ] } @@ -91,6 +92,13 @@ ] } +js_library("metadata_worker.m") { + sources = + [ "$root_gen_dir/ui/file_manager/audio_player/js/metadata_worker.m.js" ] + deps = [ "//ui/file_manager/file_manager/foreground/js/metadata:metadata_dispatcher.m" ] + extra_deps = [ ":modulize" ] +} + js_library("test_util") { } @@ -118,6 +126,7 @@ input_files = [ "background.js", "error_util.js", + "metadata_worker.js", "test_util.js", ] }
diff --git a/ui/file_manager/audio_player/js/metadata_worker.js b/ui/file_manager/audio_player/js/metadata_worker.js index dec52ec..524e2cc 100644 --- a/ui/file_manager/audio_player/js/metadata_worker.js +++ b/ui/file_manager/audio_player/js/metadata_worker.js
@@ -2,7 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Load the worker script of the Files app. -importScripts( - 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + - 'foreground/js/metadata/metadata_dispatcher.js'); +// clang-format off +// #import './metadata_dispatcher.m.js'; + +/* #ignore */ // Load the worker script of the Files app. +/* #ignore */ importScripts( +/* #ignore */ 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + +/* #ignore */ 'foreground/js/metadata/metadata_dispatcher.js'); +// clang-format on
diff --git a/ui/file_manager/file_manager/foreground/js/BUILD.gn b/ui/file_manager/file_manager/foreground/js/BUILD.gn index 6341318..a9c52c4 100644 --- a/ui/file_manager/file_manager/foreground/js/BUILD.gn +++ b/ui/file_manager/file_manager/foreground/js/BUILD.gn
@@ -5,6 +5,7 @@ import("//third_party/closure_compiler/compile_js.gni") import("//third_party/closure_compiler/js_unit_tests.gni") import("//ui/file_manager/base/gn/js_test_gen_html.gni") +import("//ui/webui/resources/tools/js_modulizer.gni") visibility = [ "//ui/file_manager/file_manager/foreground/*", @@ -15,12 +16,19 @@ testonly = true visibility += [ "//ui/file_manager:closure_compile" ] deps = [ + ":closure_compile_jsmodules", ":closure_compile_module", + ":js_test_gen_html_modules_type_check_auto", ":js_test_gen_html_type_check_auto", ":test_support_type_check", ] } +js_type_check("closure_compile_jsmodules") { + uses_js_modules = true + deps = [ ":thumbnail_loader.m" ] +} + js_type_check("closure_compile_module") { deps = [ ":actions_controller", @@ -835,11 +843,27 @@ ] } -js_unittest("thumbnail_loader_unittest") { +js_library("thumbnail_loader.m") { + sources = [ "$root_gen_dir/ui/file_manager/file_manager/foreground/js/thumbnail_loader.m.js" ] deps = [ - ":thumbnail_loader", - "//ui/file_manager/base/js:test_error_reporting", - "//ui/file_manager/file_manager/common/js:mock_entry", + "//ui/file_manager/file_manager/common/js:file_type.m", + "//ui/file_manager/file_manager/foreground/js/metadata:image_orientation.m", + "//ui/file_manager/image_loader:image_loader_client.m", + "//ui/file_manager/image_loader:load_image_request.m", + "//ui/webui/resources/js:assert.m", + ] + + extra_deps = [ ":modulize" ] +} + +js_unittest("thumbnail_loader_unittest.m") { + deps = [ + ":thumbnail_loader.m", + "//chrome/test/data/webui:chai_assert", + "//ui/file_manager/base/js:test_error_reporting.m", + "//ui/file_manager/file_manager/common/js:mock_entry.m", + "//ui/file_manager/image_loader:image_loader_client.m", + "//ui/file_manager/image_loader:load_image_request.m", ] } @@ -864,6 +888,19 @@ ] } +js_test_gen_html("js_test_gen_html_modules") { + deps = [ ":thumbnail_loader_unittest.m" ] + js_module = true + + closure_flags = + strict_error_checking_closure_args + [ + "js_module_root=./gen/ui", + "js_module_root=../../ui", + "browser_resolver_prefix_replacements=\"chrome://test/=./\"", + "hide_warnings_for=third_party/", + ] +} + js_test_gen_html("js_test_gen_html") { deps = [ ":actions_model_unittest", @@ -880,7 +917,10 @@ ":providers_model_unittest", ":spinner_controller_unittest", ":task_controller_unittest", - ":thumbnail_loader_unittest", ] mocks = [ "$externs_path/file_manager_private.js" ] } + +js_modulizer("modulize") { + input_files = [ "thumbnail_loader.js" ] +}
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/BUILD.gn b/ui/file_manager/file_manager/foreground/js/metadata/BUILD.gn index b09d3c2..3cc8c5a 100644 --- a/ui/file_manager/file_manager/foreground/js/metadata/BUILD.gn +++ b/ui/file_manager/file_manager/foreground/js/metadata/BUILD.gn
@@ -5,6 +5,7 @@ import("//third_party/closure_compiler/compile_js.gni") import("//third_party/closure_compiler/js_unit_tests.gni") import("//ui/file_manager/base/gn/js_test_gen_html.gni") +import("//ui/webui/resources/js/cr.gni") import("//ui/webui/resources/tools/js_modulizer.gni") # TODO(tapted): This entire folder should move to //ui/file_manager/base. @@ -24,20 +25,26 @@ uses_js_modules = true deps = [ ":byte_reader.m", + ":content_metadata_provider.m", ":exif_constants.m", ":exif_parser.m", ":external_metadata_provider.m", ":file_system_metadata_provider.m", ":function_parallel.m", ":function_sequence.m", + ":id3_parser.m", ":image_orientation.m", ":image_parsers.m", ":metadata_cache_item.m", + ":metadata_cache_set.m", + ":metadata_dispatcher.m", ":metadata_item.m", + ":metadata_model.m", ":metadata_parser.m", ":metadata_provider.m", ":metadata_request.m", ":mpeg_parser.m", + ":multi_metadata_provider.m", ] } @@ -86,10 +93,28 @@ ] } -js_unittest("content_metadata_provider_unittest") { +js_library("content_metadata_provider.m") { + sources = [ "$root_gen_dir/ui/file_manager/file_manager/foreground/js/metadata/content_metadata_provider.m.js" ] deps = [ - ":content_metadata_provider", - "//ui/file_manager/base/js:test_error_reporting", + ":metadata_item.m", + ":metadata_provider.m", + "//ui/file_manager/file_manager/common/js:file_type.m", + "//ui/file_manager/file_manager/common/js:util.m", + "//ui/file_manager/file_manager/foreground/js:thumbnail_loader.m", + "//ui/file_manager/image_loader:image_loader_client.m", + "//ui/file_manager/image_loader:load_image_request.m", + "//ui/webui/resources/js:assert.m", + ] + + extra_deps = [ ":modulize" ] +} + +js_unittest("content_metadata_provider_unittest.m") { + deps = [ + ":content_metadata_provider.m", + ":metadata_request.m", + "//chrome/test/data/webui:chai_assert", + "//ui/file_manager/base/js:test_error_reporting.m", ] } @@ -219,6 +244,19 @@ ] } +js_library("id3_parser.m") { + sources = [ "$root_gen_dir/ui/file_manager/file_manager/foreground/js/metadata/id3_parser.m.js" ] + deps = [ + ":byte_reader.m", + ":function_parallel.m", + ":function_sequence.m", + ":metadata_parser.m", + "//ui/file_manager/externs:metadata_worker_window.m", + ] + + extra_deps = [ ":modulize" ] +} + js_library("image_orientation") { } @@ -287,10 +325,23 @@ ] } -js_unittest("metadata_cache_set_unittest") { +js_library("metadata_cache_set.m") { + sources = [ "$root_gen_dir/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.m.js" ] deps = [ - ":metadata_cache_set", - "//ui/file_manager/base/js:test_error_reporting", + ":metadata_cache_item.m", + ":metadata_item.m", + ":metadata_request.m", + "//ui/file_manager/file_manager/common/js:util.m", + "//ui/webui/resources/js/cr:event_target.m", + ] + + extra_deps = [ ":modulize" ] +} + +js_unittest("metadata_cache_set_unittest.m") { + deps = [ + ":metadata_cache_set.m", + "//chrome/test/data/webui:chai_assert", ] } @@ -306,6 +357,21 @@ externs_list = [ "//ui/file_manager/externs/platform.js" ] } +js_library("metadata_dispatcher.m") { + sources = [ "$root_gen_dir/ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher.m.js" ] + deps = [ + ":exif_parser.m", + ":id3_parser.m", + ":image_parsers.m", + ":metadata_parser.m", + ":mpeg_parser.m", + "//ui/file_manager/externs:metadata_worker_window.m", + ] + externs_list = [ "//ui/file_manager/externs/platform.js" ] + + extra_deps = [ ":modulize" ] +} + js_library("metadata_item") { } @@ -329,10 +395,29 @@ ] } -js_unittest("metadata_model_unittest") { +js_library("metadata_model.m") { + sources = [ "$root_gen_dir/ui/file_manager/file_manager/foreground/js/metadata/metadata_model.m.js" ] deps = [ - ":metadata_model", - "//ui/file_manager/base/js:test_error_reporting", + ":content_metadata_provider.m", + ":external_metadata_provider.m", + ":file_system_metadata_provider.m", + ":metadata_cache_set.m", + ":metadata_item.m", + ":metadata_provider.m", + ":multi_metadata_provider.m", + "//ui/file_manager/externs:volume_manager.m", + "//ui/file_manager/file_manager/common/js:util.m", + ] + + extra_deps = [ ":modulize" ] +} + +js_unittest("metadata_model_unittest.m") { + deps = [ + ":metadata_model.m", + ":metadata_provider.m", + "//chrome/test/data/webui:chai_assert", + "//ui/file_manager/base/js:test_error_reporting.m", ] } @@ -407,10 +492,34 @@ ] } -js_unittest("multi_metadata_provider_unittest") { +js_library("multi_metadata_provider.m") { + sources = [ "$root_gen_dir/ui/file_manager/file_manager/foreground/js/metadata/multi_metadata_provider.m.js" ] deps = [ - ":multi_metadata_provider", - "//ui/file_manager/base/js:test_error_reporting", + ":content_metadata_provider.m", + ":external_metadata_provider.m", + ":file_system_metadata_provider.m", + ":metadata_item.m", + ":metadata_provider.m", + ":metadata_request.m", + "//ui/file_manager/base/js:volume_manager_types.m", + "//ui/file_manager/externs:volume_manager.m", + "//ui/webui/resources/js:assert.m", + ] + + extra_deps = [ ":modulize" ] +} + +js_unittest("multi_metadata_provider_unittest.m") { + deps = [ + ":content_metadata_provider.m", + ":external_metadata_provider.m", + ":file_system_metadata_provider.m", + ":metadata_request.m", + ":multi_metadata_provider.m", + "//chrome/test/data/webui:chai_assert", + "//ui/file_manager/base/js:test_error_reporting.m", + "//ui/file_manager/base/js:volume_manager_types.m", + "//ui/file_manager/externs:volume_manager.m", ] } @@ -428,11 +537,15 @@ js_test_gen_html("js_test_gen_html_modules") { deps = [ + ":content_metadata_provider_unittest.m", ":exif_parser_unittest.m", ":external_metadata_provider_unittest.m", ":file_system_metadata_provider_unittest.m", ":image_orientation_unittest.m", ":metadata_cache_item_unittest.m", + ":metadata_cache_set_unittest.m", + ":metadata_model_unittest.m", + ":multi_metadata_provider_unittest.m", ] js_module = true @@ -441,36 +554,39 @@ "js_module_root=./gen/ui", "js_module_root=../../ui", "browser_resolver_prefix_replacements=\"chrome://test/=./\"", + "hide_warnings_for=third_party/", ] } js_test_gen_html("js_test_gen_html") { - deps = [ - ":content_metadata_provider_unittest", - ":metadata_cache_set_unittest", - ":metadata_model_unittest", - ":multi_metadata_provider_unittest", - ":thumbnail_model_unittest", - ] + deps = [ ":thumbnail_model_unittest" ] mocks = [ "metadata_dispatcher_mock_deps.js" ] } js_modulizer("modulize") { input_files = [ "byte_reader.js", + "content_metadata_provider.js", "exif_constants.js", "exif_parser.js", "external_metadata_provider.js", "file_system_metadata_provider.js", "function_parallel.js", "function_sequence.js", + "id3_parser.js", + "image_orientation.js", "image_parsers.js", "metadata_cache_item.js", + "metadata_cache_set.js", + "metadata_dispatcher.js", "metadata_item.js", + "metadata_model.js", "metadata_parser.js", "metadata_request.js", - "image_orientation.js", "metadata_provider.js", "mpeg_parser.js", + "multi_metadata_provider.js", ] + + namespace_rewrites = cr_namespace_rewrites }
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/content_metadata_provider.js b/ui/file_manager/file_manager/foreground/js/metadata/content_metadata_provider.js index e37d03a6..6899565 100644 --- a/ui/file_manager/file_manager/foreground/js/metadata/content_metadata_provider.js +++ b/ui/file_manager/file_manager/foreground/js/metadata/content_metadata_provider.js
@@ -2,8 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// clang-format off +// #import {MetadataItem} from './metadata_item.m.js'; +// #import {MetadataProvider} from './metadata_provider.m.js'; +// #import {ThumbnailLoader} from '../thumbnail_loader.m.js'; +// #import * as wrappedUtil from '../../../common/js/util.m.js'; const {util} = wrappedUtil; +// #import {ImageLoaderClient} from '../../../../image_loader/image_loader_client.m.js'; +// #import {LoadImageRequest, LoadImageResponseStatus} from '../../../../image_loader/load_image_request.m.js'; +// #import {FileType} from '../../../common/js/file_type.m.js'; +// #import {assert, assertNotReached} from 'chrome://resources/js/assert.m.js'; +// clang-format on + /** @final */ -class ContentMetadataProvider extends MetadataProvider { +/* #export */ class ContentMetadataProvider extends MetadataProvider { /** * @param {!MessagePort=} opt_messagePort Message port overriding the default * worker port.
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/content_metadata_provider_unittest.js b/ui/file_manager/file_manager/foreground/js/metadata/content_metadata_provider_unittest.m.js similarity index 92% rename from ui/file_manager/file_manager/foreground/js/metadata/content_metadata_provider_unittest.js rename to ui/file_manager/file_manager/foreground/js/metadata/content_metadata_provider_unittest.m.js index 26b71a68..b1be91e 100644 --- a/ui/file_manager/file_manager/foreground/js/metadata/content_metadata_provider_unittest.js +++ b/ui/file_manager/file_manager/foreground/js/metadata/content_metadata_provider_unittest.m.js
@@ -2,6 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {assertEquals} from 'chrome://test/chai_assert.js'; +import {reportPromise} from '../../../../base/js/test_error_reporting.m.js'; +import {ContentMetadataProvider} from './content_metadata_provider.m.js'; +import {MetadataRequest} from './metadata_request.m.js'; + function makeFileEntryFromDataURL(name, dataUrl) { const mimeString = dataUrl.split(',')[0].split(':')[1].split(';')[0]; const data = atob(dataUrl.split('base64,')[1]); @@ -59,7 +64,7 @@ const entryB = makeFileEntryFromDataURL('empty.jpg', 'data:image/jpeg;base64,'); -function testExternalMetadataProviderBasic(callback) { +export function testExternalMetadataProviderBasic(callback) { // Mocking SharedWorker's port. const port = /** @type {!MessagePort} */ ({ postMessage: function(message) {
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/id3_parser.js b/ui/file_manager/file_manager/foreground/js/metadata/id3_parser.js index 1e46966c..ac00c96 100644 --- a/ui/file_manager/file_manager/foreground/js/metadata/id3_parser.js +++ b/ui/file_manager/file_manager/foreground/js/metadata/id3_parser.js
@@ -2,16 +2,24 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -importScripts( - 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/metadata/function_sequence.js'); -importScripts( - 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/metadata/function_parallel.js'); +// clang-format off +// #import {ByteReader} from './byte_reader.m.js'; +// #import {FunctionParallel} from './function_parallel.m.js'; +// #import {FunctionSequence} from './function_sequence.m.js'; +// #import {MetadataParser} from './metadata_parser.m.js'; +// #import {MetadataParserLogger} from '../../../../externs/metadata_worker_window.m.js'; + +/* #ignore */ importScripts( +/* #ignore */ 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/metadata/function_sequence.js'); +/* #ignore */ importScripts( +/* #ignore */ 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/metadata/function_parallel.js'); +// clang-format on /** * ID3 parser. * @final */ -class Id3Parser extends MetadataParser { +/* #export */ class Id3Parser extends MetadataParser { /** * @param {!MetadataParserLogger} parent A metadata dispatcher. */
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js b/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js index 570d357..3920221e 100644 --- a/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js +++ b/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js
@@ -2,10 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// clang-format off +// #import {MetadataCacheItem} from './metadata_cache_item.m.js'; +// #import {MetadataItem} from './metadata_item.m.js'; +// #import {MetadataRequest} from './metadata_request.m.js'; +// #import * as wrappedUtil from '../../../common/js/util.m.js'; const {util} = wrappedUtil; +// #import {NativeEventTarget as EventTarget} from 'chrome://resources/js/cr/event_target.m.js'; +// clang-format on + /** * Set of MetadataCacheItem. */ -class MetadataCacheSet extends cr.EventTarget { +/* #export */ class MetadataCacheSet extends cr.EventTarget { /** * @param {!MetadataCacheSetStorage} items Storage object containing * MetadataCacheItem. @@ -185,7 +193,7 @@ * Interface of raw strage for MetadataCacheItem. * @interface */ -class MetadataCacheSetStorage { +/* #export */ class MetadataCacheSetStorage { /** * Returns an item corresponding to the given URL. * @param {string} url Entry URL. @@ -224,7 +232,7 @@ * Implementation of MetadataCacheSetStorage by using raw object. * @implements {MetadataCacheSetStorage} */ -class MetadataCacheSetStorageForObject { +/* #export */ class MetadataCacheSetStorageForObject { /** @param {Object} items Map of URL and MetadataCacheItem. */ constructor(items) { this.items_ = items;
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set_unittest.js b/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set_unittest.m.js similarity index 89% rename from ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set_unittest.js rename to ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set_unittest.m.js index f1c526c6..d7a3fdf 100644 --- a/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set_unittest.js +++ b/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set_unittest.m.js
@@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {assertEquals, assertFalse, assertTrue} from 'chrome://test/chai_assert.js'; +import {MetadataCacheSet, MetadataCacheSetStorageForObject} from './metadata_cache_set.m.js'; + /** @const {!Entry} */ const entryA = /** @type {!Entry} */ ({ toURL: function() { @@ -16,7 +19,7 @@ }, }); -function testMetadataCacheSetBasic() { +export function testMetadataCacheSetBasic() { const set = new MetadataCacheSet(new MetadataCacheSetStorageForObject({})); const loadRequested = set.createRequests([entryA, entryB], ['property']); assertEquals(2, loadRequested.length); @@ -37,7 +40,7 @@ assertEquals('valueB', results[1].property); } -function testMetadataCacheSetStorePartial() { +export function testMetadataCacheSetStorePartial() { const set = new MetadataCacheSet(new MetadataCacheSetStorageForObject({})); set.startRequests(1, set.createRequests([entryA, entryB], ['property'])); @@ -54,7 +57,7 @@ assertEquals('valueB', results[1].property); } -function testMetadataCacheSetCachePartial() { +export function testMetadataCacheSetCachePartial() { const set = new MetadataCacheSet(new MetadataCacheSetStorageForObject({})); set.startRequests(1, set.createRequests([entryA], ['property'])); set.storeProperties(1, [entryA], [{property: 'valueA'}], []); @@ -67,7 +70,7 @@ assertEquals('property', loadRequested[0].names[0]); } -function testMetadataCacheSetInvalidatePartial() { +export function testMetadataCacheSetInvalidatePartial() { const set = new MetadataCacheSet(new MetadataCacheSetStorageForObject({})); set.startRequests(1, set.createRequests([entryA, entryB], ['property'])); set.invalidate(2, [entryA]); @@ -87,7 +90,7 @@ assertEquals('property', loadRequested[0].names[0]); } -function testMetadataCacheSetCreateSnapshot() { +export function testMetadataCacheSetCreateSnapshot() { const setA = new MetadataCacheSet(new MetadataCacheSetStorageForObject({})); setA.startRequests(1, setA.createRequests([entryA, entryB], ['property'])); const setB = setA.createSnapshot([entryA]); @@ -112,7 +115,7 @@ assertEquals(undefined, results[1].property); } -function testMetadataCacheSetHasFreshCache() { +export function testMetadataCacheSetHasFreshCache() { const set = new MetadataCacheSet(new MetadataCacheSetStorageForObject({})); assertFalse(set.hasFreshCache([entryA, entryB], ['property'])); @@ -127,12 +130,12 @@ assertTrue(set.hasFreshCache([entryA], ['property'])); } -function testMetadataCacheSetHasFreshCacheWithEmptyNames() { +export function testMetadataCacheSetHasFreshCacheWithEmptyNames() { const set = new MetadataCacheSet(new MetadataCacheSetStorageForObject({})); assertTrue(set.hasFreshCache([entryA, entryB], [])); } -function testMetadataCacheSetClear() { +export function testMetadataCacheSetClear() { const set = new MetadataCacheSet(new MetadataCacheSetStorageForObject({})); set.startRequests(1, set.createRequests([entryA], ['propertyA'])); set.storeProperties(1, [entryA], [{propertyA: 'value'}], []); @@ -147,7 +150,7 @@ assertFalse(set.hasFreshCache([entryA], ['propertyB'])); } -function testMetadataCacheSetUpdateEvent() { +export function testMetadataCacheSetUpdateEvent() { const set = new MetadataCacheSet(new MetadataCacheSetStorageForObject({})); let event = null; set.addEventListener('update', inEvent => { @@ -162,7 +165,7 @@ assertFalse(event.names.has('propertyA')); } -function testMetadataCacheSetClearAll() { +export function testMetadataCacheSetClearAll() { const set = new MetadataCacheSet(new MetadataCacheSetStorageForObject({})); set.startRequests(1, set.createRequests([entryA, entryB], ['propertyA'])); set.storeProperties(
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher.js b/ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher.js index 61a95344..45ad92f 100644 --- a/ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher.js +++ b/ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher.js
@@ -2,21 +2,33 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// clang-format off +// #import {BmpParser, GifParser, IcoParser, PngParser, WebpParser} from './image_parsers.m.js'; +// #import {ExifParser} from './exif_parser.m.js'; +// #import {Id3Parser} from './id3_parser.m.js'; +// #import {MetadataParser} from './metadata_parser.m.js'; +// #import {MpegParser} from './mpeg_parser.m.js'; +// #import {MetadataParserLogger} from '../../../../externs/metadata_worker_window.m.js'; +// clang-format on + // All of these scripts could be imported with a single call to importScripts, // but then load and compile time errors would all be reported from the same // line. Note: update component_extension_resources.grd when adding new parsers. -importScripts( - 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/metadata/metadata_parser.js'); -importScripts( - 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/metadata/byte_reader.js'); -importScripts( - 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/metadata/exif_parser.js'); -importScripts( - 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/metadata/image_parsers.js'); -importScripts( - 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/metadata/mpeg_parser.js'); -importScripts( - 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/metadata/id3_parser.js'); + +// clang-format off +/* #ignore */ importScripts( +/* #ignore */ 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/metadata/metadata_parser.js'); +/* #ignore */ importScripts( +/* #ignore */ 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/metadata/byte_reader.js'); +/* #ignore */ importScripts( +/* #ignore */ 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/metadata/exif_parser.js'); +/* #ignore */ importScripts( +/* #ignore */ 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/metadata/image_parsers.js'); +/* #ignore */ importScripts( +/* #ignore */ 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/metadata/mpeg_parser.js'); +/* #ignore */ importScripts( +/* #ignore */ 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/metadata/id3_parser.js'); +// clang-format on /** * Dispatches metadata requests to the correct parser. @@ -195,7 +207,7 @@ // Step two, turn the url into an entry. function getEntry(parser) { - webkitResolveLocalFileSystemURL(fileURL, entry => { + globalThis.webkitResolveLocalFileSystemURL(fileURL, entry => { nextStep(entry, parser); }, onError); },
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/metadata_model.js b/ui/file_manager/file_manager/foreground/js/metadata/metadata_model.js index 239ac2fd..de501bd0 100644 --- a/ui/file_manager/file_manager/foreground/js/metadata/metadata_model.js +++ b/ui/file_manager/file_manager/foreground/js/metadata/metadata_model.js
@@ -2,11 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// clang-format off +// #import {ContentMetadataProvider} from './content_metadata_provider.m.js'; +// #import {ExternalMetadataProvider} from './external_metadata_provider.m.js'; +// #import {FileSystemMetadataProvider} from './file_system_metadata_provider.m.js'; +// #import {MetadataCacheSet, MetadataCacheSetStorageForObject} from './metadata_cache_set.m.js'; +// #import {MetadataItem} from './metadata_item.m.js'; +// #import {MetadataProvider} from './metadata_provider.m.js'; +// #import {MultiMetadataProvider} from './multi_metadata_provider.m.js'; +// #import * as wrappedUtil from '../../../common/js/util.m.js'; const {util} = wrappedUtil; +// #import {VolumeManager} from '../../../../externs/volume_manager.m.js'; +// clang-format on + /** * Stats collected about Metadata handling for tests. * @final */ -class MetadataStats { +/* #export */ class MetadataStats { constructor() { /** @public {number} Total of entries fulfilled from cache. */ this.fromCache = 0; @@ -25,7 +37,7 @@ } } -class MetadataModel { +/* #export */ class MetadataModel { /** * @param {!MetadataProvider} rawProvider */
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/metadata_model_unittest.js b/ui/file_manager/file_manager/foreground/js/metadata/metadata_model_unittest.m.js similarity index 89% rename from ui/file_manager/file_manager/foreground/js/metadata/metadata_model_unittest.js rename to ui/file_manager/file_manager/foreground/js/metadata/metadata_model_unittest.m.js index e98c56d..4493879 100644 --- a/ui/file_manager/file_manager/foreground/js/metadata/metadata_model_unittest.js +++ b/ui/file_manager/file_manager/foreground/js/metadata/metadata_model_unittest.m.js
@@ -2,6 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {assertEquals, assertThrows} from 'chrome://test/chai_assert.js'; +import {reportPromise} from '../../../../base/js/test_error_reporting.m.js'; +import {MetadataModel} from './metadata_model.m.js'; +import {MetadataProvider} from './metadata_provider.m.js'; + /** @final */ class TestMetadataProvider extends MetadataProvider { constructor() { @@ -80,7 +85,7 @@ return result[property]; } -function testMetadataModelBasic(callback) { +export function testMetadataModelBasic(callback) { let provider = new TestMetadataProvider(); const model = new MetadataModel(provider); @@ -96,7 +101,7 @@ callback); } -function testMetadataModelRequestForCachedProperty(callback) { +export function testMetadataModelRequestForCachedProperty(callback) { let provider = new TestMetadataProvider(); const model = new MetadataModel(provider); @@ -118,7 +123,8 @@ callback); } -function testMetadataModelRequestForCachedAndNonCachedProperty(callback) { +export function testMetadataModelRequestForCachedAndNonCachedProperty( + callback) { let provider = new TestMetadataProvider(); const model = new MetadataModel(provider); @@ -151,7 +157,7 @@ callback); } -function testMetadataModelRequestForCachedAndNonCachedEntry(callback) { +export function testMetadataModelRequestForCachedAndNonCachedEntry(callback) { let provider = new TestMetadataProvider(); const model = new MetadataModel(provider); @@ -176,7 +182,8 @@ callback); } -function testMetadataModelRequestBeforeCompletingPreviousRequest(callback) { +export function testMetadataModelRequestBeforeCompletingPreviousRequest( + callback) { let provider = new TestMetadataProvider(); const model = new MetadataModel(provider); @@ -195,7 +202,7 @@ callback); } -function testMetadataModelNotUpdateCachedResultAfterRequest(callback) { +export function testMetadataModelNotUpdateCachedResultAfterRequest(callback) { let provider = new ManualTestMetadataProvider(); const model = new MetadataModel(provider); @@ -226,7 +233,7 @@ callback); } -function testMetadataModelGetCache(callback) { +export function testMetadataModelGetCache(callback) { let provider = new TestMetadataProvider(); const model = new MetadataModel(provider); @@ -245,7 +252,7 @@ callback); } -function testMetadataModelUnknownProperty() { +export function testMetadataModelUnknownProperty() { const provider = new TestMetadataProvider(); const model = new MetadataModel(provider); @@ -254,7 +261,7 @@ }); } -function testMetadataModelEmptyResult(callback) { +export function testMetadataModelEmptyResult(callback) { const provider = new TestEmptyMetadataProvider(); const model = new MetadataModel(provider);
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/multi_metadata_provider.js b/ui/file_manager/file_manager/foreground/js/metadata/multi_metadata_provider.js index 5c5f045..38d8957 100644 --- a/ui/file_manager/file_manager/foreground/js/metadata/multi_metadata_provider.js +++ b/ui/file_manager/file_manager/foreground/js/metadata/multi_metadata_provider.js
@@ -2,8 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// clang-format off +// #import {ContentMetadataProvider} from './content_metadata_provider.m.js'; +// #import {ExternalMetadataProvider} from './external_metadata_provider.m.js'; +// #import {FileSystemMetadataProvider} from './file_system_metadata_provider.m.js'; +// #import {MetadataItem} from './metadata_item.m.js'; +// #import {MetadataProvider} from './metadata_provider.m.js'; +// #import {MetadataRequest} from './metadata_request.m.js'; +// #import * as wrappedVolumeManagerCommon from '../../../../base/js/volume_manager_types.m.js'; const {VolumeManagerCommon} = wrappedVolumeManagerCommon; +// #import {VolumeManager} from '../../../../externs/volume_manager.m.js'; +// #import {assert} from 'chrome://resources/js/assert.m.js'; +// clang-format on + /** @final */ -class MultiMetadataProvider extends MetadataProvider { +/* #export */ class MultiMetadataProvider extends MetadataProvider { /** * @param {!FileSystemMetadataProvider} fileSystemMetadataProvider * @param {!ExternalMetadataProvider} externalMetadataProvider
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/multi_metadata_provider_unittest.js b/ui/file_manager/file_manager/foreground/js/metadata/multi_metadata_provider_unittest.m.js similarity index 87% rename from ui/file_manager/file_manager/foreground/js/metadata/multi_metadata_provider_unittest.js rename to ui/file_manager/file_manager/foreground/js/metadata/multi_metadata_provider_unittest.m.js index 12cdecb5..e64389d4 100644 --- a/ui/file_manager/file_manager/foreground/js/metadata/multi_metadata_provider_unittest.js +++ b/ui/file_manager/file_manager/foreground/js/metadata/multi_metadata_provider_unittest.m.js
@@ -2,6 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {assertArrayEquals, assertEquals, assertNotReached, assertTrue} from 'chrome://test/chai_assert.js'; +import {reportPromise} from '../../../../base/js/test_error_reporting.m.js'; +import * as wrappedVolumeManagerCommon from '../../../../base/js/volume_manager_types.m.js'; +const {VolumeManagerCommon} = wrappedVolumeManagerCommon; +import {ContentMetadataProvider} from './content_metadata_provider.m.js'; +import {ExternalMetadataProvider} from './external_metadata_provider.m.js'; +import {FileSystemMetadataProvider} from './file_system_metadata_provider.m.js'; +import {MetadataRequest} from './metadata_request.m.js'; +import {MultiMetadataProvider} from './multi_metadata_provider.m.js'; +import {VolumeManager} from '../../../../externs/volume_manager.m.js'; + const entryA = /** @type {!Entry} */ ({ toURL: function() { return 'filesystem://A'; @@ -49,7 +60,7 @@ } }); -function testMultiMetadataProviderBasic(callback) { +export function testMultiMetadataProviderBasic(callback) { const model = new MultiMetadataProvider( /** @type {!FileSystemMetadataProvider} */ ({ get: function(requests) { @@ -111,7 +122,7 @@ callback); } -function testMultiMetadataProviderExternalAndContentProperty(callback) { +export function testMultiMetadataProviderExternalAndContentProperty(callback) { const model = new MultiMetadataProvider( /** @type {!FileSystemMetadataProvider} */ ({ get: function(requests) { @@ -164,7 +175,7 @@ /** * Tests that we only use ExternalMetadataProvider for a DocumentsProvider file. */ -function testMultiMetadataProviderFileSystemAndExternalForDP(callback) { +export function testMultiMetadataProviderFileSystemAndExternalForDP(callback) { const model = new MultiMetadataProvider( /** @type {!FileSystemMetadataProvider} */ ({ get: function(requests) {
diff --git a/ui/file_manager/file_manager/foreground/js/thumbnail_loader.js b/ui/file_manager/file_manager/foreground/js/thumbnail_loader.js index 4ee992f..c324353 100644 --- a/ui/file_manager/file_manager/foreground/js/thumbnail_loader.js +++ b/ui/file_manager/file_manager/foreground/js/thumbnail_loader.js
@@ -2,12 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// clang-format off +// #import {ImageTransformParam} from './metadata/image_orientation.m.js'; +// #import {FileType} from '../../common/js/file_type.m.js'; +// #import {ImageLoaderClient} from '../../../image_loader/image_loader_client.m.js'; +// #import {LoadImageRequest, LoadImageResponse, LoadImageResponseStatus} from '../../../image_loader/load_image_request.m.js'; +// #import {assert, assertNotReached} from 'chrome://resources/js/assert.m.js'; +// clang-format on + /** * Loads a thumbnail using provided url. In CANVAS mode, loaded images * are attached as <canvas> element, while in IMAGE mode as <img>. * <canvas> renders faster than <img>, however has bigger memory overhead. */ -class ThumbnailLoader { +/* #export */ class ThumbnailLoader { /** * @param {!Entry} entry File entry. * @param {!ThumbnailLoader.LoaderType=} opt_loaderType Canvas or Image
diff --git a/ui/file_manager/file_manager/foreground/js/thumbnail_loader_unittest.js b/ui/file_manager/file_manager/foreground/js/thumbnail_loader_unittest.m.js similarity index 88% rename from ui/file_manager/file_manager/foreground/js/thumbnail_loader_unittest.js rename to ui/file_manager/file_manager/foreground/js/thumbnail_loader_unittest.m.js index b220b3a..a72718b 100644 --- a/ui/file_manager/file_manager/foreground/js/thumbnail_loader_unittest.js +++ b/ui/file_manager/file_manager/foreground/js/thumbnail_loader_unittest.m.js
@@ -2,6 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {assertEquals, assertTrue} from 'chrome://test/chai_assert.js'; +import {reportPromise} from '../../../base/js/test_error_reporting.m.js'; +import {ImageLoaderClient} from '../../../image_loader/image_loader_client.m.js'; +import {LoadImageRequest} from '../../../image_loader/load_image_request.m.js'; +import {MockEntry, MockFileSystem} from '../../common/js/mock_entry.m.js'; +import {ThumbnailLoader} from './thumbnail_loader.m.js'; + function getLoadTarget(entry, metadata) { return new ThumbnailLoader(entry, ThumbnailLoader.LoaderType.CANVAS, metadata) .getLoadTarget(); @@ -38,7 +45,7 @@ }; } -function testShouldUseMetadataThumbnail() { +export function testShouldUseMetadataThumbnail() { const mockFileSystem = new MockFileSystem('volumeId'); const imageEntry = new MockEntry(mockFileSystem, '/test.jpg'); const pdfEntry = new MockEntry(mockFileSystem, '/test.pdf'); @@ -66,7 +73,7 @@ pdfEntry, {external: {thumbnailUrl: 'url', present: true}})); } -function testLoadAsDataUrlFromImageClient(callback) { +export function testLoadAsDataUrlFromImageClient(callback) { installMockLoad((request, callback) => { callback({status: 'success', data: 'imageDataUrl', width: 32, height: 32}); }); @@ -82,7 +89,7 @@ callback); } -function testLoadAsDataUrlFromExifThumbnail(callback) { +export function testLoadAsDataUrlFromExifThumbnail(callback) { installMockLoad((request, callback) => { // Assert that data url is passed. assertTrue(/^data:/i.test(request.url)); @@ -106,7 +113,8 @@ callback); } -function testLoadAsDataUrlFromExifThumbnailPropagatesTransform(callback) { +export function testLoadAsDataUrlFromExifThumbnailPropagatesTransform( + callback) { installMockLoad((request, callback) => { // Assert that data url and transform info is passed. assertTrue(/^data:/i.test(request.url)); @@ -143,7 +151,7 @@ callback); } -function testLoadAsDataUrlFromExternal(callback) { +export function testLoadAsDataUrlFromExternal(callback) { const externalThumbnailUrl = 'https://external-thumbnail-url/'; const externalCroppedThumbnailUrl = 'https://external-cropped-thumbnail-url/'; const externalThumbnailDataUrl = generateSampleImageDataUrl(32, 32); @@ -176,7 +184,8 @@ callback); } -function testLoadDetachedFromExifInCavnasModeThumbnailDoesNotRotate(callback) { +export function testLoadDetachedFromExifInCavnasModeThumbnailDoesNotRotate( + callback) { installMockLoad((request, callback) => { // Assert that data url is passed. assertTrue(/^data:/i.test(request.url));
diff --git a/ui/gfx/x/xlib_support.h b/ui/gfx/x/xlib_support.h index 37ea34a..2d50399 100644 --- a/ui/gfx/x/xlib_support.h +++ b/ui/gfx/x/xlib_support.h
@@ -5,6 +5,7 @@ #ifndef UI_GFX_X_XLIB_SUPPORT_H_ #define UI_GFX_X_XLIB_SUPPORT_H_ +#include <memory> #include <string> #include "base/component_export.h"
diff --git a/ui/webui/resources/cr_components/chromeos/network/cr_policy_network_behavior_mojo.js b/ui/webui/resources/cr_components/chromeos/network/cr_policy_network_behavior_mojo.js index 21cb6cf..3587a0dc 100644 --- a/ui/webui/resources/cr_components/chromeos/network/cr_policy_network_behavior_mojo.js +++ b/ui/webui/resources/cr_components/chromeos/network/cr_policy_network_behavior_mojo.js
@@ -97,6 +97,42 @@ }, /** + * @param {!chromeos.networkConfig.mojom.ManagedBoolean| + * !chromeos.networkConfig.mojom.ManagedInt32| + * !chromeos.networkConfig.mojom.ManagedString| + * !chromeos.networkConfig.mojom.ManagedStringList| + * !chromeos.networkConfig.mojom.ManagedApnList} property + * @return {boolean|number|string|!Array<string>| + * !Array<!chromeos.networkConfig.mojom.ApnProperties>|null} + * |property.policyValue| if the property is policy-enforced or null + * otherwise. + */ + getEnforcedPolicyValue(property) { + if (!property || !this.isNetworkPolicyEnforced(property)) { + return null; + } + return property.policyValue === undefined ? null : property.policyValue; + }, + + /** + * @param {!chromeos.networkConfig.mojom.ManagedBoolean| + * !chromeos.networkConfig.mojom.ManagedInt32| + * !chromeos.networkConfig.mojom.ManagedString| + * !chromeos.networkConfig.mojom.ManagedStringList| + * !chromeos.networkConfig.mojom.ManagedApnList} property + * @return {boolean|number|string|!Array<string>| + * !Array<!chromeos.networkConfig.mojom.ApnProperties>|null} + * |property.policyValue| if the property is policy-recommended or + * null otherwise. + */ + getRecommendedPolicyValue(property) { + if (!property || !this.isNetworkPolicyRecommended(property)) { + return null; + } + return property.policyValue === undefined ? null : property.policyValue; + }, + + /** * @param {!chromeos.networkConfig.mojom.OncSource} source * @return {boolean} * @protected
diff --git a/ui/webui/resources/cr_components/chromeos/network/network_ip_config.js b/ui/webui/resources/cr_components/chromeos/network/network_ip_config.js index c1317265..7994ae85 100644 --- a/ui/webui/resources/cr_components/chromeos/network/network_ip_config.js +++ b/ui/webui/resources/cr_components/chromeos/network/network_ip_config.js
@@ -203,22 +203,42 @@ return !ipConfigType || !this.isNetworkPolicyEnforced(ipConfigType); }, + /** + * Overrides null values of |ipv4| with defaults so |ipv4| passes validation + * after being converted to ONC StaticIPConfig. + * TODO(https://crbug.com/1148841): Setting defaults here is strange, find + * some better way. + * @param {!OncMojo.IPConfigUIProperties} ipv4 this will be modified in place + * @private + */ + setIpv4Defaults_(ipv4) { + if (!ipv4.gateway) { + ipv4.gateway = '192.168.1.1'; + } + if (!ipv4.ipAddress) { + ipv4.ipAddress = '192.168.1.1'; + } + if (!ipv4.netmask) { + ipv4.netmask = '255.255.255.0'; + } + if (!ipv4.type) { + ipv4.type = 'IPv4'; + } + }, + /** @private */ onAutomaticChange_() { if (!this.automatic_) { - const defaultIpv4 = { - gateway: '192.168.1.1', - ipAddress: '192.168.1.1', - netmask: '255.255.255.0', - type: 'IPv4', - }; - // Ensure that there is a valid IPConfig object. Copy any set properties - // over the default properties to ensure all properties are set. - if (this.ipConfig_) { - this.ipConfig_.ipv4 = Object.assign(defaultIpv4, this.ipConfig_.ipv4); - } else { - this.ipConfig_ = {ipv4: defaultIpv4}; + if (!this.ipConfig_) { + this.ipConfig_ = {}; } + if (this.savedStaticIp_) { + this.ipConfig_.ipv4 = this.savedStaticIp_; + } + if (!this.ipConfig_.ipv4) { + this.ipConfig_.ipv4 = {}; + } + this.setIpv4Defaults_(this.ipConfig_.ipv4); this.sendStaticIpConfig_(); return; }
diff --git a/ui/webui/resources/cr_components/chromeos/network/network_nameservers.html b/ui/webui/resources/cr_components/chromeos/network/network_nameservers.html index e4f1e22..4cd9b91 100644 --- a/ui/webui/resources/cr_components/chromeos/network/network_nameservers.html +++ b/ui/webui/resources/cr_components/chromeos/network/network_nameservers.html
@@ -106,7 +106,7 @@ nameserversTypeEnum_.CUSTOM)]]"> <div class="property-box single-column two-line"> <template is="dom-repeat" items="[[nameservers_]]"> - <cr-input id="nameserver[[index]]" value="[[item]]" + <cr-input id="nameserver[[index]]" value="{{item}}" aria-label="[[getCustomNameServerInputA11yLabel_(index)]]" on-change="onValueChange_" disabled="[[!canEditCustomNameServers_(nameserversType_,
diff --git a/ui/webui/resources/cr_components/chromeos/network/network_nameservers.js b/ui/webui/resources/cr_components/chromeos/network/network_nameservers.js index 71324b62..9a69c00b 100644 --- a/ui/webui/resources/cr_components/chromeos/network/network_nameservers.js +++ b/ui/webui/resources/cr_components/chromeos/network/network_nameservers.js
@@ -87,10 +87,18 @@ MAX_NAMESERVERS: 4, /** - * Saved nameservers when switching to NameserversType.AUTOMATIC. + * Saved nameservers from the NameserversType.CUSTOM tab. If this is empty, it + * means that the user has not entered any custom nameservers yet. * @private {!Array<string>} */ - savedNameservers_: [], + savedCustomNameservers_: [], + + /** + * The last manually performed selection of the nameserver type. If this is + * null, no explicit selection has been done for this network yet. + * @private {?NameserversType} + */ + savedNameserversType_: null, /* * Returns the nameserver type CrRadioGroupElement. @@ -101,36 +109,67 @@ }, /** + * Returns true if the nameservers in |nameservers1| match the nameservers in + * |nameservers2|, ignoring order and empty / 0.0.0.0 entries. + * @param {!Array<string>} nameservers1 + * @param {!Array<string>} nameservers2 + */ + nameserversMatch_(nameservers1, nameservers2) { + const nonEmptySortedNameservers1 = + this.clearEmptyNameServers_(nameservers1).sort(); + const nonEmptySortedNameservers2 = + this.clearEmptyNameServers_(nameservers2).sort(); + if (nonEmptySortedNameservers1.length !== + nonEmptySortedNameservers2.length) { + return false; + } + for (let i = 0; i < nonEmptySortedNameservers1.length; i++) { + if (nonEmptySortedNameservers1[i] !== nonEmptySortedNameservers2[i]) { + return false; + } + } + return true; + }, + + /** * Returns true if |nameservers| contains any all google nameserver entries * and only google nameserver entries or empty entries. * @param {!Array<string>} nameservers * @private */ isGoogleNameservers_(nameservers) { - const matches = []; - for (let i = 0; i < nameservers.length; ++i) { - const nameserver = nameservers[i]; - if (nameserver === this.EMPTY_NAMESERVER) { - continue; - } - let valid = false; - for (let j = 0; j < this.GOOGLE_NAMESERVERS.length; ++j) { - if (nameserver === this.GOOGLE_NAMESERVERS[j]) { - valid = true; - matches[j] = true; - break; - } - } - if (!valid) { - return false; - } + return this.nameserversMatch_(nameservers, this.GOOGLE_NAMESERVERS); + }, + + /** + * Returns the nameservers enforced by policy. If nameservers are not being + * enforced, returns null. + * @return {Array<string>|null} + */ + getPolicyEnforcedNameservers_() { + const staticIpConfig = + this.managedProperties && this.managedProperties.staticIpConfig; + if (!staticIpConfig || !staticIpConfig.nameServers) { + return null; } - for (let j = 0; j < this.GOOGLE_NAMESERVERS.length; ++j) { - if (!matches[j]) { - return false; - } + return /** @type {Array<string>|null} */ ( + this.getEnforcedPolicyValue(staticIpConfig.nameServers)); + }, + + /** + * Returns the nameservers recommended by policy. If nameservers are not being + * recommended, returns null. Note: also returns null if nameservers are being + * enforced by policy. + * @return {Array<string>|null} + */ + getPolicyRecommendedNameservers_() { + const staticIpConfig = + this.managedProperties && this.managedProperties.staticIpConfig; + if (!staticIpConfig || !staticIpConfig.nameServers) { + return null; } - return true; + return /** @type {Array<string>|null} */ ( + this.getRecommendedPolicyValue(staticIpConfig.nameServers)); }, /** @private */ @@ -140,23 +179,24 @@ } if (!oldValue || newValue.guid !== oldValue.guid) { - this.savedNameservers_ = []; + this.savedCustomNameservers_ = []; + this.savedNameserversType_ = null; } // Update the 'nameservers' property. let nameservers = []; const ipv4 = OncMojo.getIPConfigForType(this.managedProperties, 'IPv4'); if (ipv4 && ipv4.nameServers) { - nameservers = ipv4.nameServers; + nameservers = ipv4.nameServers.slice(); } // Update the 'nameserversType' property. const configType = OncMojo.getActiveValue(this.managedProperties.nameServersConfigType); - /** @type {NameserversType} */ - let type; + /** @type {NameserversType} */ let type; if (configType === 'Static') { - if (this.isGoogleNameservers_(nameservers)) { + if (this.isGoogleNameservers_(nameservers) && + this.savedNameserversType_ !== NameserversType.CUSTOM) { type = NameserversType.GOOGLE; nameservers = this.GOOGLE_NAMESERVERS; // Use consistent order. } else { @@ -182,18 +222,14 @@ for (let i = nameservers.length; i < this.MAX_NAMESERVERS; ++i) { nameservers[i] = this.EMPTY_NAMESERVER; } - if (!this.isGoogleNameservers_(nameservers)) { - this.savedNameservers_ = nameservers.slice(); - } + } else { + nameservers = this.clearEmptyNameServers_(nameservers); } this.nameservers_ = nameservers; - // Set nameserversType_ after dom-repeat has been stamped. - this.async(() => { - this.nameserversType_ = nameserversType; - if (sendNameservers) { - this.sendNameServers_(); - } - }); + this.nameserversType_ = nameserversType; + if (sendNameservers) { + this.sendNameServers_(); + } }, /** @@ -208,12 +244,6 @@ if (this.isNetworkPolicyEnforced(managedProperties.nameServersConfigType)) { return false; } - if (managedProperties.staticIpConfig && - managedProperties.staticIpConfig.nameServers && - this.isNetworkPolicyEnforced( - managedProperties.staticIpConfig.nameServers)) { - return false; - } return true; }, @@ -266,6 +296,37 @@ }, /** + * Returns currently configured custom nameservers, to be used when toggling + * to 'custom' from 'automatic' or 'google', prefer nameservers in the + * following priority: + * + * 1) policy-enforced nameservers, + * 2) previously manually entered nameservers (|savedCustomNameservers_|), + * 3) policy-recommended nameservers, + * 4) active nameservers (e.g. from DHCP). + * @return {!Array<string>} nameservers + * @private + */ + getCustomNameServers_() { + const policyEnforcedNameservers = this.getPolicyEnforcedNameservers_(); + if (policyEnforcedNameservers !== null) { + return policyEnforcedNameservers.slice(); + } + + if (this.savedCustomNameservers_.length > 0) { + return this.savedCustomNameservers_; + } + + const policyRecommendedNameservers = + this.getPolicyRecommendedNameservers_(); + if (policyRecommendedNameservers !== null) { + return policyRecommendedNameservers.slice(); + } + + return this.nameservers_; + }, + + /** * Event triggered when the selected type changes. Updates nameservers and * sends the change value if necessary. * @private @@ -273,25 +334,24 @@ onTypeChange_() { const type = this.$$('#nameserverType').selected; this.nameserversType_ = type; + this.savedNameserversType_ = type; if (type === NameserversType.CUSTOM) { - // Restore the saved nameservers. - this.setNameservers_(type, this.savedNameservers_, true /* send */); + this.setNameservers_(type, this.getCustomNameServers_(), true /* send */); return; } this.sendNameServers_(); }, /** - * Event triggered when a nameserver value changes. + * Event triggered when a |nameservers_| value changes through the custom + * namservers UI. + * This gets called after data-binding updates a |nameservers_[i]| entry. + * This saves the custom nameservers and reflects that change to the backend + * (sending the custom nameservers). * @private */ onValueChange_() { - if (this.nameserversType_ !== NameserversType.CUSTOM) { - // If a user inputs Google nameservers in the custom nameservers fields, - // |nameserversType| will change to NameserversType.GOOGLE so don't send - // the values. - return; - } + this.savedCustomNameservers_ = this.nameservers_.slice(); this.sendNameServers_(); }, @@ -303,16 +363,9 @@ const type = this.nameserversType_; if (type === NameserversType.CUSTOM) { - const nameservers = new Array(this.MAX_NAMESERVERS); - for (let i = 0; i < this.MAX_NAMESERVERS; ++i) { - const nameserverInput = this.$$('#nameserver' + i); - nameservers[i] = nameserverInput ? nameserverInput.value : ''; - } - this.nameservers_ = nameservers; - this.savedNameservers_ = nameservers.slice(); this.fire('nameservers-change', { field: 'nameServers', - value: nameservers, + value: this.nameservers_, }); } else if (type === NameserversType.GOOGLE) { this.nameservers_ = this.GOOGLE_NAMESERVERS; @@ -342,7 +395,8 @@ * @private */ clearEmptyNameServers_(nameservers) { - return nameservers.filter((nameserver) => !!nameserver); + return nameservers.filter( + (nameserver) => (!!nameserver && nameserver !== this.EMPTY_NAMESERVER)); }, /**