diff --git a/.gitignore b/.gitignore index e35dd4e..a874677 100644 --- a/.gitignore +++ b/.gitignore
@@ -192,6 +192,8 @@ /components/resources/default_300_percent/google_chrome /components/search_engines/prepopulated_engines.xml /components/suggestions.xml +/components/test/data/paint_preview/**/*.pb +/components/test/data/paint_preview/**/*.skp /components/variations.xml /components/zucchini/testdata/*.exe /content/browser/service_worker/proto.xml
diff --git a/DEPS b/DEPS index 95e7fcbe..f13b958 100644 --- a/DEPS +++ b/DEPS
@@ -175,11 +175,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '0154105fc14ca16bfd3c920140348d501a450fef', + 'skia_revision': 'c27e70235ff5e7011182b1d41f63ec6acc5cdd8f', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': 'd4ed59c4ed609eacc9062bd22ebca409ef7c6d1c', + 'v8_revision': '3c2d9f15b6f6c156fcc42cb6251806595664535c', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -187,7 +187,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': '0c9b6abde90cbf6fd88fe4d86c2d66ef145607b5', + 'angle_revision': 'f77f10f33266a3ea55b41f946f8d971c720e0374', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -246,7 +246,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': '5e9dd1d5e265e3aee96d1d088f72902e448e306d', + 'devtools_frontend_revision': '0d9de2003ea9da8a9008b85aa8e9c37b96b6177c', # 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. @@ -286,7 +286,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. - 'spv_tools_revision': '66a682b6a8f973ba79b0e250221d53a4fbd11f4c', + 'spv_tools_revision': '4c027048d88bcdd047ddace38081b6d6f896aba4', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -955,7 +955,7 @@ Var('chromium_git') + '/codecs/libgav1.git' + '@' + 'fa1c3c4e673cf12ffa22b8fbe4a7c79314571f1b', 'src/third_party/glslang/src': - Var('chromium_git') + '/external/github.com/KhronosGroup/glslang.git' + '@' + '6861ea4e10a1f9dbbab14daac1107528025126a7', + Var('chromium_git') + '/external/github.com/KhronosGroup/glslang.git' + '@' + 'f333272eb504735a78f91c76acd814c38ed0c142', 'src/third_party/google_toolbox_for_mac/src': { 'url': Var('chromium_git') + '/external/github.com/google/google-toolbox-for-mac.git' + '@' + Var('google_toolbox_for_mac_revision'), @@ -1250,7 +1250,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'b0a8b6693f9bb964258415e6d401f02b135903cc', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '1234c8aa625fe7fbe838bcc14f5700aaa81e53a1', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1454,7 +1454,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'ec18cc3262922e7dcdbe70243c6f40606f979144', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '39be828c846a6a6c01164158243207ad6efbf955', + Var('webrtc_git') + '/src.git' + '@' + '2d525fe9bd56bea6017ed724be1c3339db2ba830', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1529,7 +1529,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@43f79a1d77b29ded6d4a932521119bd592579882', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@ebcfc4bfc670af33372ea17f1472ee79ef60d9e6', 'condition': 'checkout_src_internal', }, @@ -4120,6 +4120,20 @@ 'src/third_party/arcore-android-sdk/test-apks/update.py', ], }, + # Pull down Paint Preview test data. + { + 'name': 'paint_preview_testdata', + 'pattern': '\\.sha1', + 'condition': 'checkout_android', + 'action': [ 'python', + 'src/third_party/depot_tools/download_from_google_storage.py', + '--no_auth', + '--num_threads=4', + '--bucket', 'chromium-android-tools/paint-preview-test-data', + '--recursive', + '-d', 'src/components/test/data/paint_preview', + ], + }, # Download Oculus SDK if appropriate. { 'name': 'libovr',
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index c7db4e0..68f160e 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -0.20200308.3.1 \ No newline at end of file +0.20200309.2.1 \ No newline at end of file
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index c7db4e0..68f160e 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -0.20200308.3.1 \ No newline at end of file +0.20200309.2.1 \ No newline at end of file
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index ef41d5cf..bafb47d6 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -940,6 +940,7 @@ "//chrome/test/data/translate/", "//chrome/test/media_router/resources/", "//components/test/data/autofill/", + "//components/test/data/paint_preview/", "//components/test/data/payments/", "//content/test/data/browsing_data/", "//content/test/data/android/authenticator.html",
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinator.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinator.java index b4f9525..64c3147 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinator.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinator.java
@@ -8,7 +8,6 @@ import android.text.SpannableString; import android.text.method.LinkMovementMethod; import android.view.LayoutInflater; -import android.view.View; import android.widget.ScrollView; import android.widget.TextView; @@ -29,16 +28,18 @@ import org.chromium.ui.text.NoUnderlineClickableSpan; import org.chromium.ui.text.SpanApplier; -import java.util.Arrays; +import java.util.Map; /** * Coordinator responsible for showing the onboarding screen when the user is using the Autofill * Assistant for the first time. */ class AssistantOnboardingCoordinator { - private static final String SMALL_ONBOARDING_EXPERIMENT_ID = "4257013"; + private static final String INTENT_IDENTFIER = "INTENT"; + private static final String RENT_CAR_INTENT = "RENT_CAR"; private final String mExperimentIds; + private final Map<String, String> mParameters; private final Context mContext; private final BottomSheetController mController; @Nullable @@ -53,9 +54,10 @@ private boolean mOnboardingShown; - AssistantOnboardingCoordinator(String experimentIds, Context context, - BottomSheetController controller, @Nullable Tab tab) { + AssistantOnboardingCoordinator(String experimentIds, Map<String, String> parameters, + Context context, BottomSheetController controller, @Nullable Tab tab) { mExperimentIds = experimentIds; + mParameters = parameters; mContext = context; mController = controller; mTab = tab; @@ -170,19 +172,11 @@ initView.findViewById(R.id.button_init_not_ok) .setOnClickListener(unusedView -> onClicked(false, callback)); - // Hide views that should not be displayed when showing the small onboarding. - if (Arrays.asList(mExperimentIds.split(",")).contains(SMALL_ONBOARDING_EXPERIMENT_ID)) { - hide(initView, R.id.onboarding_subtitle); - hide(initView, R.id.onboarding_separator); - } + updateViewBasedOnIntent(initView); mContent.setContent(initView, initView); } - private static void hide(View root, int resId) { - root.findViewById(resId).setVisibility(View.GONE); - } - private void onClicked(boolean accept, Callback<Boolean> callback) { AutofillAssistantPreferencesUtil.setInitialPreferences(accept); AutofillAssistantMetrics.recordOnBoarding( @@ -194,4 +188,17 @@ callback.onResult(accept); hide(); } + + private void updateViewBasedOnIntent(ScrollView initView) { + if (!mParameters.containsKey(INTENT_IDENTFIER)) { + return; + } + + TextView termsTextView = initView.findViewById(R.id.onboarding_subtitle); + switch (mParameters.get(INTENT_IDENTFIER)) { + case RENT_CAR_INTENT: + termsTextView.setText(R.string.autofill_assistant_init_message_rent_car); + break; + } + } }
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandlerImpl.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandlerImpl.java index 6908e4e..7a6bc46 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandlerImpl.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandlerImpl.java
@@ -71,9 +71,11 @@ } @Override - public void performOnboarding(String experimentIds, Callback<Boolean> callback) { + public void performOnboarding( + String experimentIds, Bundle arguments, Callback<Boolean> callback) { + Map<String, String> parameters = toArgumentMap(arguments); AssistantOnboardingCoordinator coordinator = new AssistantOnboardingCoordinator( - experimentIds, mContext, mBottomSheetController, mGetCurrentTab.get()); + experimentIds, parameters, mContext, mBottomSheetController, mGetCurrentTab.get()); coordinator.show(accepted -> { coordinator.hide(); callback.onResult(accepted); @@ -89,15 +91,16 @@ return; } + Map<String, String> argumentMap = toArgumentMap(arguments); Callback<AssistantOnboardingCoordinator> afterOnboarding = (onboardingCoordinator) -> { - Map<String, String> argumentMap = toArgumentMap(arguments); callback.onResult(client.performDirectAction( name, experimentIds, argumentMap, onboardingCoordinator)); }; if (!AutofillAssistantPreferencesUtil.isAutofillOnboardingAccepted()) { - AssistantOnboardingCoordinator coordinator = new AssistantOnboardingCoordinator( - experimentIds, mContext, mBottomSheetController, mGetCurrentTab.get()); + AssistantOnboardingCoordinator coordinator = + new AssistantOnboardingCoordinator(experimentIds, argumentMap, mContext, + mBottomSheetController, mGetCurrentTab.get()); coordinator.show(accepted -> { if (!accepted) { coordinator.hide();
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantModuleEntryImpl.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantModuleEntryImpl.java index ea8773f..a43ef1d 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantModuleEntryImpl.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantModuleEntryImpl.java
@@ -39,7 +39,7 @@ ChromeActivity activity = ((TabImpl) tab).getActivity(); AssistantOnboardingCoordinator onboardingCoordinator = new AssistantOnboardingCoordinator( - experimentIds, activity, activity.getBottomSheetController(), tab); + experimentIds, parameters, activity, activity.getBottomSheetController(), tab); onboardingCoordinator.show(accepted -> { if (!accepted) return;
diff --git a/chrome/android/features/autofill_assistant/java/strings/android_chrome_autofill_assistant_strings.grd b/chrome/android/features/autofill_assistant/java/strings/android_chrome_autofill_assistant_strings.grd index 9a9a06a..7bc54de0 100644 --- a/chrome/android/features/autofill_assistant/java/strings/android_chrome_autofill_assistant_strings.grd +++ b/chrome/android/features/autofill_assistant/java/strings/android_chrome_autofill_assistant_strings.grd
@@ -172,6 +172,9 @@ <message name="IDS_AUTOFILL_ASSISTANT_INIT_TITLE" desc="The title of the onboarding screen."> Try \n Google Assistant \n in Chrome </message> + <message name="IDS_AUTOFILL_ASSISTANT_INIT_MESSAGE_RENT_CAR" desc="Onboarding message describing autofill assistant's capability for car rentals."> + Quickly complete the car rental flow with just a few taps. + </message> <message name="IDS_AUTOFILL_ASSISTANT_INIT_MESSAGE" desc="Onboarding message describing autofill assistant's capability."> Google Assistant saves you time by helping you complete actions on the web, like search and checkout. </message>
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinatorTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinatorTest.java index 24d9186..4367dce 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinatorTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinatorTest.java
@@ -23,6 +23,7 @@ import static org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiTestUtil.waitUntilViewMatchesCondition; import android.support.test.filters.MediumTest; +import android.widget.TextView; import androidx.annotation.IdRes; @@ -51,6 +52,7 @@ import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; /** @@ -82,15 +84,15 @@ } private AssistantOnboardingCoordinator createCoordinator(Tab tab) { - AssistantOnboardingCoordinator coordinator = - new AssistantOnboardingCoordinator("", mActivity, mBottomSheetController, mTab); + AssistantOnboardingCoordinator coordinator = new AssistantOnboardingCoordinator( + "", new HashMap<String, String>(), mActivity, mBottomSheetController, mTab); coordinator.disableAnimationForTesting(); return coordinator; } @Test @MediumTest - @DisableIf.Build(sdk_is_greater_than = 22) // TODO(crbug/990118): re-enable + @DisableIf.Build(sdk_is_greater_than = 22) // TODO(crbug/991938): re-enable public void testAcceptOnboarding() throws Exception { testOnboarding(R.id.button_init_ok, true); } @@ -168,6 +170,42 @@ assertTrue(coordinator.getOnboardingShown()); } + @Test + @MediumTest + public void testShowDifferentInformationalText() throws Exception { + AutofillAssistantPreferencesUtil.setInitialPreferences(true); + + HashMap<String, String> parameters = new HashMap(); + parameters.put("INTENT", "RENT_CAR"); + AssistantOnboardingCoordinator coordinator = new AssistantOnboardingCoordinator( + "", parameters, mActivity, mBottomSheetController, mTab); + coordinator.disableAnimationForTesting(); + showOnboardingAndWait(coordinator, mCallback); + + TextView view = mBottomSheetController.getBottomSheetViewForTesting().findViewById( + R.id.onboarding_subtitle); + assertEquals( + mActivity.getResources().getText(R.string.autofill_assistant_init_message_rent_car), + view.getText()); + } + + @Test + @MediumTest + public void testShowStandardInformationalText() throws Exception { + AutofillAssistantPreferencesUtil.setInitialPreferences(true); + + HashMap<String, String> parameters = new HashMap(); + AssistantOnboardingCoordinator coordinator = new AssistantOnboardingCoordinator( + "", parameters, mActivity, mBottomSheetController, mTab); + coordinator.disableAnimationForTesting(); + showOnboardingAndWait(coordinator, mCallback); + + TextView view = mBottomSheetController.getBottomSheetViewForTesting().findViewById( + R.id.onboarding_subtitle); + assertEquals(mActivity.getResources().getText(R.string.autofill_assistant_init_message), + view.getText()); + } + /** Trigger onboarding and wait until it is fully displayed. */ private void showOnboardingAndWait( AssistantOnboardingCoordinator coordinator, Callback<Boolean> callback) {
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandler.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandler.java index cf737cc..3c604023 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandler.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandler.java
@@ -53,7 +53,7 @@ List<AutofillAssistantDirectAction> getActions(); /** Performs onboarding and returns the result to the callback. */ - void performOnboarding(String experimentIds, Callback<Boolean> callback); + void performOnboarding(String experimentIds, Bundle arguments, Callback<Boolean> callback); /** * Performs an AA action.
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandler.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandler.java index a2075f0..7999b5f 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandler.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandler.java
@@ -171,7 +171,7 @@ return; } if (ONBOARDING_ACTION.equals(actionId)) { - delegate.performOnboarding(experimentIds, booleanCallback); + delegate.performOnboarding(experimentIds, arguments, booleanCallback); return; }
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksSurfaceMediator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksSurfaceMediator.java index 1cd1ed4..1b9c81d1 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksSurfaceMediator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksSurfaceMediator.java
@@ -7,6 +7,7 @@ import static org.chromium.chrome.browser.tasks.TasksSurfaceProperties.FAKE_SEARCH_BOX_CLICK_LISTENER; import static org.chromium.chrome.browser.tasks.TasksSurfaceProperties.FAKE_SEARCH_BOX_TEXT_WATCHER; import static org.chromium.chrome.browser.tasks.TasksSurfaceProperties.INCOGNITO_COOKIE_CONTROLS_CARD_VISIBILITY; +import static org.chromium.chrome.browser.tasks.TasksSurfaceProperties.INCOGNITO_COOKIE_CONTROLS_ICON_CLICK_LISTENER; import static org.chromium.chrome.browser.tasks.TasksSurfaceProperties.INCOGNITO_COOKIE_CONTROLS_MANAGER; import static org.chromium.chrome.browser.tasks.TasksSurfaceProperties.INCOGNITO_COOKIE_CONTROLS_TOGGLE_CHECKED; import static org.chromium.chrome.browser.tasks.TasksSurfaceProperties.INCOGNITO_COOKIE_CONTROLS_TOGGLE_CHECKED_LISTENER; @@ -98,6 +99,7 @@ mIncognitoCookieControlsManager.addObserver(mIncognitoCookieControlsObserver); mModel.set( INCOGNITO_COOKIE_CONTROLS_TOGGLE_CHECKED_LISTENER, mIncognitoCookieControlsManager); + mModel.set(INCOGNITO_COOKIE_CONTROLS_ICON_CLICK_LISTENER, mIncognitoCookieControlsManager); // Set the initial state. mModel.set(IS_FAKE_SEARCH_BOX_VISIBLE, true);
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksSurfaceProperties.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksSurfaceProperties.java index 24ef1dd..bef83ba 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksSurfaceProperties.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksSurfaceProperties.java
@@ -35,6 +35,9 @@ public static final PropertyModel .WritableBooleanPropertyKey INCOGNITO_COOKIE_CONTROLS_CARD_VISIBILITY = new PropertyModel.WritableBooleanPropertyKey(); + public static final PropertyModel.WritableObjectPropertyKey<View.OnClickListener> + INCOGNITO_COOKIE_CONTROLS_ICON_CLICK_LISTENER = + new PropertyModel.WritableObjectPropertyKey<View.OnClickListener>(); public static final PropertyModel .WritableBooleanPropertyKey INCOGNITO_COOKIE_CONTROLS_TOGGLE_CHECKED = new PropertyModel.WritableBooleanPropertyKey(); @@ -66,7 +69,8 @@ public static final PropertyKey[] ALL_KEYS = new PropertyKey[] {IS_FAKE_SEARCH_BOX_VISIBLE, IS_INCOGNITO, IS_INCOGNITO_DESCRIPTION_INITIALIZED, IS_INCOGNITO_DESCRIPTION_VISIBLE, IS_TAB_CAROUSEL_VISIBLE, IS_VOICE_RECOGNITION_BUTTON_VISIBLE, - INCOGNITO_COOKIE_CONTROLS_CARD_VISIBILITY, INCOGNITO_COOKIE_CONTROLS_TOGGLE_CHECKED, + INCOGNITO_COOKIE_CONTROLS_CARD_VISIBILITY, + INCOGNITO_COOKIE_CONTROLS_ICON_CLICK_LISTENER, INCOGNITO_COOKIE_CONTROLS_TOGGLE_CHECKED, INCOGNITO_COOKIE_CONTROLS_TOGGLE_CHECKED_LISTENER, INCOGNITO_COOKIE_CONTROLS_TOGGLE_ENFORCEMENT, INCOGNITO_COOKIE_CONTROLS_MANAGER, INCOGNITO_LEARN_MORE_CLICK_LISTENER, FAKE_SEARCH_BOX_CLICK_LISTENER,
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksView.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksView.java index b709b59b..56bd0cfe 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksView.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksView.java
@@ -43,6 +43,7 @@ private OnCheckedChangeListener mIncognitoCookieControlsToggleCheckedListener; private @CookieControlsEnforcement int mIncognitoCookieControlsToggleEnforcement = CookieControlsEnforcement.NO_ENFORCEMENT; + private View.OnClickListener mIncognitoCookieControlsIconClickListener; /** Default constructor needed to inflate via XML. */ public TasksView(Context context, AttributeSet attrs) { @@ -169,16 +170,17 @@ mIncognitoDescriptionView = (IncognitoDescriptionView) stub.inflate(); if (mIncognitoDescriptionLearnMoreListener != null) { setIncognitoDescriptionLearnMoreClickListener(mIncognitoDescriptionLearnMoreListener); - mIncognitoDescriptionLearnMoreListener = null; } setIncognitoCookieControlsCardVisibility(mIncognitoCookieControlsCardIsVisible); setIncognitoCookieControlsToggleChecked(mIncognitoCookieControlsToggleIsChecked); if (mIncognitoCookieControlsToggleCheckedListener != null) { setIncognitoCookieControlsToggleCheckedListener( mIncognitoCookieControlsToggleCheckedListener); - mIncognitoCookieControlsToggleCheckedListener = null; } setIncognitoCookieControlsToggleEnforcement(mIncognitoCookieControlsToggleEnforcement); + if (mIncognitoCookieControlsIconClickListener != null) { + setIncognitoCookieControlsIconClickListener(mIncognitoCookieControlsIconClickListener); + } } /** @@ -194,11 +196,11 @@ * @param listener The given click listener. */ void setIncognitoDescriptionLearnMoreClickListener(View.OnClickListener listener) { - if (mIncognitoDescriptionView == null) { - mIncognitoDescriptionLearnMoreListener = listener; - return; + mIncognitoDescriptionLearnMoreListener = listener; + if (mIncognitoDescriptionView != null) { + mIncognitoDescriptionView.findViewById(R.id.learn_more).setOnClickListener(listener); + mIncognitoDescriptionLearnMoreListener = null; } - mIncognitoDescriptionView.findViewById(R.id.learn_more).setOnClickListener(listener); } /** @@ -231,6 +233,7 @@ mIncognitoCookieControlsToggleCheckedListener = listener; if (mIncognitoDescriptionView != null) { mIncognitoDescriptionView.setCookieControlsToggleOnCheckedChangeListener(listener); + mIncognitoCookieControlsToggleCheckedListener = null; } } @@ -244,4 +247,16 @@ mIncognitoDescriptionView.setCookieControlsEnforcement(enforcement); } } + + /** + * Set the incognito cookie controls icon click listener. + * @param listener The given onclick listener. + */ + void setIncognitoCookieControlsIconClickListener(OnClickListener listener) { + mIncognitoCookieControlsIconClickListener = listener; + if (mIncognitoDescriptionView != null) { + mIncognitoDescriptionView.setCookieControlsIconOnclickListener(listener); + mIncognitoCookieControlsIconClickListener = null; + } + } }
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksViewBinder.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksViewBinder.java index a8f424e..b808a860 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksViewBinder.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksViewBinder.java
@@ -7,6 +7,7 @@ import static org.chromium.chrome.browser.tasks.TasksSurfaceProperties.FAKE_SEARCH_BOX_CLICK_LISTENER; import static org.chromium.chrome.browser.tasks.TasksSurfaceProperties.FAKE_SEARCH_BOX_TEXT_WATCHER; import static org.chromium.chrome.browser.tasks.TasksSurfaceProperties.INCOGNITO_COOKIE_CONTROLS_CARD_VISIBILITY; +import static org.chromium.chrome.browser.tasks.TasksSurfaceProperties.INCOGNITO_COOKIE_CONTROLS_ICON_CLICK_LISTENER; import static org.chromium.chrome.browser.tasks.TasksSurfaceProperties.INCOGNITO_COOKIE_CONTROLS_MANAGER; import static org.chromium.chrome.browser.tasks.TasksSurfaceProperties.INCOGNITO_COOKIE_CONTROLS_TOGGLE_CHECKED; import static org.chromium.chrome.browser.tasks.TasksSurfaceProperties.INCOGNITO_COOKIE_CONTROLS_TOGGLE_CHECKED_LISTENER; @@ -37,6 +38,9 @@ } else if (propertyKey == INCOGNITO_COOKIE_CONTROLS_CARD_VISIBILITY) { view.setIncognitoCookieControlsCardVisibility( model.get(INCOGNITO_COOKIE_CONTROLS_CARD_VISIBILITY)); + } else if (propertyKey == INCOGNITO_COOKIE_CONTROLS_ICON_CLICK_LISTENER) { + view.setIncognitoCookieControlsIconClickListener( + model.get(INCOGNITO_COOKIE_CONTROLS_ICON_CLICK_LISTENER)); } else if (propertyKey == INCOGNITO_COOKIE_CONTROLS_TOGGLE_CHECKED) { view.setIncognitoCookieControlsToggleChecked( model.get(INCOGNITO_COOKIE_CONTROLS_TOGGLE_CHECKED));
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegate.java index bcbebfa..14593a9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegate.java
@@ -115,6 +115,12 @@ void maybeSetPendingReferrer(Intent intent, @NonNull String referrerUrl); /** + * Adjusts any desired extras related to intents to instant apps based on the value of + * |insIntentToInstantApp}. + */ + void maybeAdjustInstantAppExtras(Intent intent, boolean isIntentToInstantApp); + + /** * Records the pending incognito URL if desired. Called only if the * navigation is occurring in the context of incognito mode. */ @@ -162,6 +168,12 @@ boolean isIntentForTrustedCallingApp(Intent intent); /** + * @param intent The intent to launch. + * @return Whether the Intent points to an instant app. + */ + boolean isIntentToInstantApp(Intent intent); + + /** * @param packageName The package to check. * @return Whether the package is a valid WebAPK package. */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImpl.java index 6339289..04d6949 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImpl.java
@@ -588,6 +588,16 @@ } @Override + public void maybeAdjustInstantAppExtras(Intent intent, boolean isIntentToInstantApp) { + if (isIntentToInstantApp) { + intent.putExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER, true); + } else { + // Make sure this extra is not sent unless we've done the verification. + intent.removeExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER); + } + } + + @Override public void maybeSetPendingReferrer(Intent intent, String referrerUrl) { IntentHandler.setPendingReferrer(intent, referrerUrl); } @@ -680,6 +690,11 @@ } @Override + public boolean isIntentToInstantApp(Intent intent) { + return InstantAppsHandler.isIntentToInstantApp(intent); + } + + @Override public boolean isValidWebApk(String packageName) { return WebApkValidator.isValidWebApk(ContextUtils.getApplicationContext(), packageName); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java index 961fe25..c80917cf 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
@@ -27,7 +27,6 @@ import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordUserAction; import org.chromium.chrome.browser.flags.ChromeFeatureList; -import org.chromium.chrome.browser.instantapps.InstantAppsHandler; import org.chromium.chrome.browser.tab.TabRedirectHandler; import org.chromium.components.embedder_support.util.UrlConstants; import org.chromium.components.embedder_support.util.UrlUtilities; @@ -206,7 +205,7 @@ private @OverrideUrlLoadingResult int handleFallbackUrl( ExternalNavigationParams params, Intent targetIntent, String browserFallbackUrl) { - if (InstantAppsHandler.isIntentToInstantApp(targetIntent)) { + if (mDelegate.isIntentToInstantApp(targetIntent)) { RecordHistogram.recordEnumeratedHistogram("Android.InstantApps.DirectInstantAppsIntent", AiaIntent.FALLBACK_USED, AiaIntent.NUM_ENTRIES); } @@ -438,7 +437,7 @@ } /** - * The "about:", "chrome:", "chrome-native:", "chrome-devtools:", and "devtools:" schemes + * The "about:", "chrome:", "chrome-native:", and "devtools:" schemes * are internal to the browser; don't want these to be dispatched to other apps. */ private boolean hasInternalScheme( @@ -455,8 +454,7 @@ if (url.startsWith(ContentUrlConstants.ABOUT_SCHEME) || url.startsWith(UrlConstants.CHROME_URL_SHORT_PREFIX) || url.startsWith(UrlConstants.CHROME_NATIVE_URL_SHORT_PREFIX) - || url.startsWith(UrlConstants.DEVTOOLS_URL_SHORT_PREFIX) - || url.startsWith(UrlConstants.DEVTOOLS_FALLBACK_URL_SHORT_PREFIX)) { + || url.startsWith(UrlConstants.DEVTOOLS_URL_SHORT_PREFIX)) { if (DEBUG) Log.i(TAG, "Navigating to a chrome-internal page"); return true; } @@ -675,13 +673,11 @@ if (params.isIncognito()) mDelegate.maybeSetPendingIncognitoUrl(targetIntent); + mDelegate.maybeAdjustInstantAppExtras(targetIntent, shouldProxyForInstantApps); + if (shouldProxyForInstantApps) { RecordHistogram.recordEnumeratedHistogram("Android.InstantApps.DirectInstantAppsIntent", AiaIntent.SERP, AiaIntent.NUM_ENTRIES); - targetIntent.putExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER, true); - } else { - // Make sure this extra is not sent unless we've done the verification. - targetIntent.removeExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER); } // The intent can be used to launch Chrome itself, record the user @@ -883,7 +879,7 @@ } boolean isDirectInstantAppsIntent = - isExternalProtocol && InstantAppsHandler.isIntentToInstantApp(targetIntent); + isExternalProtocol && mDelegate.isIntentToInstantApp(targetIntent); boolean shouldProxyForInstantApps = isDirectInstantAppsIntent && mDelegate.isSerpReferrer(); if (preventDirectInstantAppsIntent(isDirectInstantAppsIntent, shouldProxyForInstantApps)) { return OverrideUrlLoadingResult.NO_OVERRIDE;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/SyncErrorInfoBar.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/SyncErrorInfoBar.java index 5d12c68..0e9b57e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/SyncErrorInfoBar.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/SyncErrorInfoBar.java
@@ -37,10 +37,10 @@ extends ConfirmInfoBar implements ProfileSyncService.SyncStateChangedListener { // Preference key to save the latest time this infobar is viewed. @VisibleForTesting - public static final String PREF_SYNC_ERROR_INFOBAR_SHOWN_AT_TIME = + static final String PREF_SYNC_ERROR_INFOBAR_SHOWN_AT_TIME = "sync_error_infobar_shown_shown_at_time"; @VisibleForTesting - public static final long MINIMAL_DURATION_BETWEEN_INFOBARS_MS = + static final long MINIMAL_DURATION_BETWEEN_INFOBARS_MS = TimeUnit.MILLISECONDS.convert(24, TimeUnit.HOURS); @IntDef({SyncErrorInfoBarType.NOT_SHOWN, SyncErrorInfoBarType.AUTH_ERROR,
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoCookieControlsManager.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoCookieControlsManager.java index 428da67..a0bb5ca 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoCookieControlsManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoCookieControlsManager.java
@@ -4,14 +4,19 @@ package org.chromium.chrome.browser.ntp; +import android.os.Bundle; +import android.view.View; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import org.chromium.base.ObserverList; import org.chromium.chrome.R; import org.chromium.chrome.browser.flags.ChromeFeatureList; +import org.chromium.chrome.browser.settings.SettingsLauncher; import org.chromium.chrome.browser.settings.website.CookieControlsServiceBridge; import org.chromium.chrome.browser.settings.website.CookieControlsServiceBridge.CookieControlsServiceObserver; +import org.chromium.chrome.browser.settings.website.SingleCategorySettings; +import org.chromium.chrome.browser.settings.website.SiteSettingsCategory; import org.chromium.components.content_settings.CookieControlsEnforcement; /** @@ -22,7 +27,7 @@ * cookie controls view. */ public class IncognitoCookieControlsManager - implements CookieControlsServiceObserver, OnCheckedChangeListener { + implements CookieControlsServiceObserver, OnCheckedChangeListener, View.OnClickListener { /** * Interface for a class that wants to receive updates from this manager. */ @@ -96,9 +101,20 @@ @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - if (mShowCard && mEnforcement == CookieControlsEnforcement.NO_ENFORCEMENT + if (mEnforcement == CookieControlsEnforcement.NO_ENFORCEMENT && (buttonView.getId() == R.id.cookie_controls_card_toggle)) { mServiceBridge.handleCookieControlsToggleChanged(isChecked); } } + + @Override + public void onClick(View v) { + if (v.getId() == R.id.cookie_controls_card_managed_icon) { + Bundle fragmentArguments = new Bundle(); + fragmentArguments.putString(SingleCategorySettings.EXTRA_CATEGORY, + SiteSettingsCategory.preferenceKey(SiteSettingsCategory.Type.COOKIES)); + SettingsLauncher.getInstance().launchSettingsPage( + v.getContext(), SingleCategorySettings.class, fragmentArguments); + } + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoDescriptionView.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoDescriptionView.java index 33c18aa..da9bf4d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoDescriptionView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoDescriptionView.java
@@ -85,6 +85,14 @@ mCookieControlsToggle.setChecked(enabled); } + /** + * Set cookie controls icon on click listener. + * @param listener The given listener. + */ + public void setCookieControlsIconOnclickListener(OnClickListener listener) { + mCookieControlsManagedIcon.setOnClickListener(listener); + } + @Override protected void onFinishInflate() { super.onFinishInflate();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPage.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPage.java index a4d2244..af5faf2 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPage.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPage.java
@@ -93,6 +93,8 @@ mCookieControlsManager.addObserver(mCookieControlsObserver); mIncognitoNewTabPageView.setIncognitoCookieControlsToggleCheckedListener( mCookieControlsManager); + mIncognitoNewTabPageView.setIncognitoCookieControlsIconOnclickListener( + mCookieControlsManager); mCookieControlsManager.updateIfNecessary(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPageView.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPageView.java index aa68f8b..9bf42ff9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPageView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPageView.java
@@ -160,4 +160,12 @@ void setIncognitoCookieControlsToggleEnforcement(@CookieControlsEnforcement int enforcement) { mDescriptionView.setCookieControlsEnforcement(enforcement); } + + /** + * Set the incognito cookie controls icon click listener. + * @param listener The given onclick listener. + */ + void setIncognitoCookieControlsIconOnclickListener(OnClickListener listener) { + mDescriptionView.setCookieControlsIconOnclickListener(listener); + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninFragment.java index 9f2f08a..238592cb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninFragment.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninFragment.java
@@ -104,9 +104,8 @@ || accessPoint == SigninAccessPoint.NTP_CONTENT_SUGGESTIONS || accessPoint == SigninAccessPoint.RECENT_TABS || accessPoint == SigninAccessPoint.SETTINGS - || accessPoint == SigninAccessPoint.SIGNIN_PROMO || accessPoint - == SigninAccessPoint.START_PAGE : "invalid access point: " + accessPoint; + == SigninAccessPoint.SIGNIN_PROMO : "invalid access point: " + accessPoint; mSigninAccessPoint = accessPoint; mPromoAction = getSigninArguments().getInt(ARGUMENT_PERSONALIZED_PROMO_ACTION, PromoAction.NONE);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java index 4145ffb..280b6d3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
@@ -125,11 +125,6 @@ "disable-features=" + ChromeFeatureList.CONTEXTUAL_SEARCH_ML_TAP_SUPPRESSION}) @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) @RetryOnFailure -// -// NOTE -- THIS WHOLE TEST CLASS IS TEMPORARILY DISABLED: -// -@DisabledTest(message = "See https://crbug.com/1058362") -// public class ContextualSearchManagerTest { @Rule public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = @@ -147,7 +142,7 @@ private static final String LOW_PRIORITY_INVALID_SEARCH_ENDPOINT = "/s/invalid"; private static final String CONTEXTUAL_SEARCH_PREFETCH_PARAM = "&pf=c"; // The number of ms to delay startup for all tests. - private static final int ACTIVITY_STARTUP_DELAY_MS = 1000; + private static final int ACTIVITY_STARTUP_DELAY_MS = 5000; // TODO(donnd): reduce! private ActivityMonitor mActivityMonitor; private ContextualSearchFakeServer mFakeServer;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImplTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImplTest.java index 65d7112..2df89b1f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImplTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImplTest.java
@@ -46,6 +46,9 @@ + "B.org.chromium.chrome.browser.autofill_assistant.ENABLED=true;" + "S." + ExternalNavigationHandler.EXTRA_BROWSER_FALLBACK_URL + "=" + Uri.encode("https://www.example.com") + ";end"; + private static final String[] SUPERVISOR_START_ACTIONS = { + "com.google.android.instantapps.START", "com.google.android.instantapps.nmr1.INSTALL", + "com.google.android.instantapps.nmr1.VIEW"}; class ExternalNavigationDelegateImplForTesting extends ExternalNavigationDelegateImpl { public ExternalNavigationDelegateImplForTesting() { @@ -267,6 +270,71 @@ @Test @SmallTest + public void testIsIntentToInstantApp() { + ExternalNavigationDelegateImpl delegate = new ExternalNavigationDelegateImpl( + mActivityTestRule.getActivity().getActivityTab()); + + // Check that the delegate correctly distinguishes instant app intents from others. + String vanillaUrl = "http://www.example.com"; + Intent vanillaIntent = new Intent(Intent.ACTION_VIEW); + vanillaIntent.setData(Uri.parse(vanillaUrl)); + + String instantAppIntentUrl = "intent://buzzfeed.com/tasty#Intent;scheme=http;" + + "package=com.google.android.instantapps.supervisor;" + + "action=com.google.android.instantapps.START;" + + "S.com.google.android.instantapps.FALLBACK_PACKAGE=" + + "com.android.chrome;S.com.google.android.instantapps.INSTANT_APP_PACKAGE=" + + "com.yelp.android;S.android.intent.extra.REFERRER_NAME=" + + "https%3A%2F%2Fwww.google.com;end"; + Intent instantAppIntent; + try { + instantAppIntent = Intent.parseUri(instantAppIntentUrl, Intent.URI_INTENT_SCHEME); + } catch (Exception ex) { + Assert.assertTrue(false); + return; + } + + Assert.assertFalse(delegate.isIntentToInstantApp(vanillaIntent)); + Assert.assertTrue(delegate.isIntentToInstantApp(instantAppIntent)); + + // Check that Supervisor is detected by action even without package. + for (String action : SUPERVISOR_START_ACTIONS) { + String intentWithoutPackageUrl = "intent://buzzfeed.com/tasty#Intent;scheme=http;" + + "action=" + action + ";" + + "S.com.google.android.instantapps.FALLBACK_PACKAGE=" + + "com.android.chrome;S.com.google.android.instantapps.INSTANT_APP_PACKAGE=" + + "com.yelp.android;S.android.intent.extra.REFERRER_NAME=" + + "https%3A%2F%2Fwww.google.com;end"; + try { + instantAppIntent = + Intent.parseUri(intentWithoutPackageUrl, Intent.URI_INTENT_SCHEME); + } catch (Exception ex) { + Assert.assertTrue(false); + return; + } + Assert.assertTrue(delegate.isIntentToInstantApp(instantAppIntent)); + } + } + + @Test + @SmallTest + public void testMaybeAdjustInstantAppExtras() { + ExternalNavigationDelegateImpl delegate = new ExternalNavigationDelegateImpl( + mActivityTestRule.getActivity().getActivityTab()); + + String url = "http://www.example.com"; + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(url)); + + delegate.maybeAdjustInstantAppExtras(intent, /*isIntentToInstantApp=*/true); + Assert.assertTrue(intent.hasExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER)); + + delegate.maybeAdjustInstantAppExtras(intent, /*isIntentToInstantApp=*/false); + Assert.assertFalse(intent.hasExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER)); + } + + @Test + @SmallTest public void testMaybeSetPendingReferrer() { ExternalNavigationDelegateImpl delegate = new ExternalNavigationDelegateImpl( mActivityTestRule.getActivity().getActivityTab());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java index 16844dcb..babd212 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java
@@ -37,7 +37,6 @@ import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider; import org.chromium.chrome.browser.externalnav.ExternalNavigationHandler.OverrideUrlLoadingResult; import org.chromium.chrome.browser.flags.ChromeFeatureList; -import org.chromium.chrome.browser.instantapps.InstantAppsHandler; import org.chromium.chrome.browser.tab.TabRedirectHandler; import org.chromium.chrome.browser.webapps.WebappInfo; import org.chromium.chrome.browser.webapps.WebappScopePolicy; @@ -132,6 +131,8 @@ + "S." + ExternalNavigationHandler.EXTRA_BROWSER_FALLBACK_URL + "=" + Uri.encode("https://www.example.com") + ";end"; + private static final String IS_INSTANT_APP_EXTRA = "IS_INSTANT_APP"; + private Context mContext; private final TestExternalNavigationDelegate mDelegate; private ExternalNavigationHandler mUrlHandler; @@ -312,7 +313,6 @@ "chrome://history", "chrome-native://newtab", "devtools://foo", - "chrome-devtools://foo", "intent:chrome-urls#Intent;package=com.android.chrome;scheme=about;end;", "intent:chrome-urls#Intent;package=com.android.chrome;scheme=chrome;end;", "intent://com.android.chrome.FileProvider/foo.html#Intent;scheme=content;end;", @@ -744,8 +744,7 @@ @Test @SmallTest - public void - testInstantAppsIntent_serpReferrer() { + public void testHandlingOfInstantApps() { String intentUrl = "intent://buzzfeed.com/tasty#Intent;scheme=http;" + "package=com.google.android.instantapps.supervisor;" + "action=com.google.android.instantapps.START;" @@ -753,43 +752,28 @@ + "com.android.chrome;S.com.google.android.instantapps.INSTANT_APP_PACKAGE=" + "com.yelp.android;S.android.intent.extra.REFERRER_NAME=" + "https%3A%2F%2Fwww.google.com;end"; + mDelegate.setIsSerpReferrer(true); + mDelegate.setIsIntentToInstantApp(true); checkUrl(intentUrl) .expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT, START_OTHER_ACTIVITY | PROXY_FOR_INSTANT_APPS); - Assert.assertTrue(mDelegate.startActivityIntent.hasExtra( - InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER)); + Assert.assertTrue( + mDelegate.startActivityIntent.getBooleanExtra(IS_INSTANT_APP_EXTRA, false)); - // Check that we block all instant app intent:// URLs not from SERP + // Check that we block all instant app intent:// URLs not from SERP. mDelegate.setIsSerpReferrer(false); checkUrl(intentUrl) .expecting(OverrideUrlLoadingResult.NO_OVERRIDE, IGNORE); - // Check that IS_GOOGLE_SEARCH_REFERRER param is stripped on non-supervisor intents. + // Check that that just having the SERP referrer alone doesn't cause intents to be treated + // as intents to instant apps if the delegate indicates that they shouldn't be. mDelegate.setIsSerpReferrer(true); - String nonSupervisor = "intent://buzzfeed.com/tasty#Intent;scheme=http;" - + "package=com.imdb;action=com.google.VIEW;" - + "S.com.google.android.gms.instantapps.IS_GOOGLE_SEARCH_REFERRER=" - + "true;S.android.intent.extra.REFERRER_NAME=" - + "https%3A%2F%2Fwww.google.com;end"; - checkUrl(nonSupervisor) - .expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT, - START_OTHER_ACTIVITY); - Assert.assertFalse(mDelegate.startActivityIntent.hasExtra( - InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER)); - - // Check that Supervisor is detected by action even without package - for (String action : SUPERVISOR_START_ACTIONS) { - String intentWithoutPackage = "intent://buzzfeed.com/tasty#Intent;scheme=http;" - + "action=" + action + ";" - + "S.com.google.android.instantapps.FALLBACK_PACKAGE=" - + "com.android.chrome;S.com.google.android.instantapps.INSTANT_APP_PACKAGE=" - + "com.yelp.android;S.android.intent.extra.REFERRER_NAME=" - + "https%3A%2F%2Fwww.google.com;end"; - mDelegate.setIsSerpReferrer(false); - checkUrl(intentWithoutPackage) - .expecting(OverrideUrlLoadingResult.NO_OVERRIDE, IGNORE); - } + mDelegate.setIsIntentToInstantApp(false); + checkUrl(intentUrl).expecting( + OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT, START_OTHER_ACTIVITY); + Assert.assertFalse( + mDelegate.startActivityIntent.getBooleanExtra(IS_INSTANT_APP_EXTRA, true)); } @Test @@ -1869,6 +1853,15 @@ } @Override + public void maybeAdjustInstantAppExtras(Intent intent, boolean isIntentToInstantApp) { + if (isIntentToInstantApp) { + intent.putExtra(IS_INSTANT_APP_EXTRA, true); + } else { + intent.putExtra(IS_INSTANT_APP_EXTRA, false); + } + } + + @Override public void maybeSetPendingIncognitoUrl(Intent intent) {} @Override @@ -1908,6 +1901,11 @@ } @Override + public boolean isIntentToInstantApp(Intent intent) { + return mIsIntentToInstantApp; + } + + @Override public boolean isValidWebApk(String packageName) { for (IntentActivity activity : mIntentActivities) { if (activity.packageName().equals(packageName)) { @@ -1982,6 +1980,10 @@ mIsCallingAppTrusted = trusted; } + public void setIsIntentToInstantApp(boolean value) { + mIsIntentToInstantApp = value; + } + public Intent startActivityIntent; public boolean startIncognitoIntentCalled; public boolean startFileIntentCalled; @@ -2001,6 +2003,7 @@ public boolean mCalledWithProxy; public boolean mIsChromeAppInForeground = true; private boolean mIsCallingAppTrusted; + private boolean mIsIntentToInstantApp; public boolean shouldRequestFileAccess; }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/SyncErrorInfoBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/SyncErrorInfoBarTest.java index 3fe1483f..e09ed65 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/SyncErrorInfoBarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/SyncErrorInfoBarTest.java
@@ -14,21 +14,25 @@ import org.chromium.base.ContextUtils; import org.chromium.base.test.util.CommandLineFlags; +import org.chromium.base.test.util.Feature; +import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.SyncFirstSetupCompleteSource; import org.chromium.chrome.browser.flags.ChromeFeatureList; -import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.sync.FakeProfileSyncService; import org.chromium.chrome.browser.sync.GoogleServiceAuthError; import org.chromium.chrome.browser.sync.SyncTestRule; import org.chromium.chrome.browser.sync.settings.SyncSettingsUtils; import org.chromium.chrome.browser.sync.settings.SyncSettingsUtils.SyncError; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.util.ChromeRenderTestRule; import org.chromium.chrome.test.util.InfoBarUtil; import org.chromium.chrome.test.util.browser.Features; import org.chromium.chrome.test.util.browser.sync.SyncTestUtil; import org.chromium.components.embedder_support.util.UrlConstants; import org.chromium.content_public.browser.test.util.TestThreadUtils; +import java.io.IOException; + @RunWith(ChromeJUnit4ClassRunner.class) @CommandLineFlags .Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) @@ -37,13 +41,16 @@ private FakeProfileSyncService mFakeProfileSyncService; @Rule - public SyncTestRule mSyncTestRule = new SyncTestRule() { + public final SyncTestRule mSyncTestRule = new SyncTestRule() { @Override protected FakeProfileSyncService createProfileSyncService() { return new FakeProfileSyncService(); } }; + @Rule + public final ChromeRenderTestRule mRenderTestRule = new ChromeRenderTestRule(); + @Before public void setUp() { deleteSyncErrorInfoBarShowTimePref(); @@ -56,12 +63,7 @@ public void testSyncErrorInfoBarShownForAuthError() throws Exception { Assert.assertEquals("InfoBar should not be shown before signing in", 0, mSyncTestRule.getInfoBars().size()); - mSyncTestRule.setUpTestAccountAndSignIn(); - TestThreadUtils.runOnUiThreadBlocking(() -> { - mFakeProfileSyncService.setAuthError( - GoogleServiceAuthError.State.INVALID_GAIA_CREDENTIALS); - }); - mSyncTestRule.loadUrlInNewTab(UrlConstants.CHROME_BLANK_URL); + showSyncErrorInfoBarForAuthError(); Assert.assertEquals("InfoBar should be shown", 1, mSyncTestRule.getInfoBars().size()); // Resolving the error should not show the infobar again. @@ -76,8 +78,7 @@ public void testSyncErrorInfoBarShownForSyncSetupIncomplete() { Assert.assertEquals("InfoBar should not be shown before signing in", 0, mSyncTestRule.getInfoBars().size()); - mSyncTestRule.setUpTestAccountAndSignInWithSyncSetupAsIncomplete(); - mSyncTestRule.loadUrlInNewTab(UrlConstants.CHROME_BLANK_URL); + showSyncErrorInfoBarForSyncSetupIncomplete(); Assert.assertEquals("InfoBar should be shown", 1, mSyncTestRule.getInfoBars().size()); // Resolving the error should not show the infobar again. @@ -94,15 +95,7 @@ public void testSyncErrorInfoBarShownForPassphraseRequired() { Assert.assertEquals("InfoBar should not be shown before signing in", 0, mSyncTestRule.getInfoBars().size()); - mSyncTestRule.setUpTestAccountAndSignIn(); - TestThreadUtils.runOnUiThreadBlocking(() -> { - // TODO(https://crbug.com/1056677): call syncStateChanged inside - // setPassphraseRequiredForPreferredDataTypes - mFakeProfileSyncService.setEngineInitialized(true); - mFakeProfileSyncService.setPassphraseRequiredForPreferredDataTypes(true); - mFakeProfileSyncService.syncStateChanged(); - }); - mSyncTestRule.loadUrlInNewTab(UrlConstants.CHROME_BLANK_URL); + showSyncErrorInfoBarForPassphraseRequired(); Assert.assertEquals("InfoBar should be shown", 1, mSyncTestRule.getInfoBars().size()); // Resolving the error should not show the infobar again. @@ -146,12 +139,7 @@ // Initiate auth error to show the infobar. Assert.assertEquals("InfoBar should not be shown before signing in", 0, mSyncTestRule.getInfoBars().size()); - mSyncTestRule.setUpTestAccountAndSignIn(); - TestThreadUtils.runOnUiThreadBlocking(() -> { - mFakeProfileSyncService.setAuthError( - GoogleServiceAuthError.State.INVALID_GAIA_CREDENTIALS); - }); - mSyncTestRule.loadUrlInNewTab(UrlConstants.CHROME_BLANK_URL); + showSyncErrorInfoBarForAuthError(); Assert.assertEquals("InfoBar should be shown", 1, mSyncTestRule.getInfoBars().size()); // Create another new tab. @@ -171,6 +159,59 @@ mSyncTestRule.getInfoBars().size()); } + @Test + @LargeTest + @Feature("RenderTest") + public void testSyncErrorInfoBarForAuthErrorView() throws IOException { + showSyncErrorInfoBarForAuthError(); + mRenderTestRule.render(mSyncTestRule.getInfoBarContainer().getContainerViewForTesting(), + "sync_error_infobar_auth_error"); + } + + @Test + @LargeTest + @Feature("RenderTest") + public void testSyncErrorInfoBarForSyncSetupIncompleteView() throws IOException { + showSyncErrorInfoBarForSyncSetupIncomplete(); + mRenderTestRule.render(mSyncTestRule.getInfoBarContainer().getContainerViewForTesting(), + "sync_error_infobar_sync_setup_incomplete"); + } + + @Test + @LargeTest + @Feature("RenderTest") + public void testSyncErrorInfoBarForPassphraseRequiredView() throws IOException { + showSyncErrorInfoBarForPassphraseRequired(); + mRenderTestRule.render(mSyncTestRule.getInfoBarContainer().getContainerViewForTesting(), + "sync_error_infobar_passphrase_required"); + } + + private void showSyncErrorInfoBarForAuthError() { + mSyncTestRule.setUpTestAccountAndSignIn(); + TestThreadUtils.runOnUiThreadBlocking(() -> { + mFakeProfileSyncService.setAuthError( + GoogleServiceAuthError.State.INVALID_GAIA_CREDENTIALS); + }); + mSyncTestRule.loadUrlInNewTab(UrlConstants.CHROME_BLANK_URL); + } + + private void showSyncErrorInfoBarForPassphraseRequired() { + mSyncTestRule.setUpTestAccountAndSignIn(); + TestThreadUtils.runOnUiThreadBlocking(() -> { + // TODO(https://crbug.com/1056677): call syncStateChanged inside + // setPassphraseRequiredForPreferredDataTypes + mFakeProfileSyncService.setEngineInitialized(true); + mFakeProfileSyncService.setPassphraseRequiredForPreferredDataTypes(true); + mFakeProfileSyncService.syncStateChanged(); + }); + mSyncTestRule.loadUrlInNewTab(UrlConstants.CHROME_BLANK_URL); + } + + private void showSyncErrorInfoBarForSyncSetupIncomplete() { + mSyncTestRule.setUpTestAccountAndSignInWithSyncSetupAsIncomplete(); + mSyncTestRule.loadUrlInNewTab(UrlConstants.CHROME_BLANK_URL); + } + private void deleteSyncErrorInfoBarShowTimePref() { ContextUtils.getAppSharedPreferences() .edit()
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp index dc03cad2..21dde9c6 100644 --- a/chrome/app/chromeos_strings.grdp +++ b/chrome/app/chromeos_strings.grdp
@@ -959,6 +959,9 @@ <message name="IDS_DISCOVER_PIN_SETUP_DONE" desc="Label for the done button on the success screen in 'PIN-unlock' setup dialog."> Done </message> + <message name="IDS_APP_START_PREPARING_PROFILE_MESSAGE" desc="Message displayed while preparing profile in which the app will be run."> + Preparing app profile... + </message> <message name="IDS_APP_START_NETWORK_WAIT_MESSAGE" desc="Message displayed while installing and/or launching web application in kiosk mode."> Waiting for network connection... </message>
diff --git a/chrome/app/chromium_strings_grd/IDS_APP_START_PREPARING_PROFILE_MESSAGE.png.sha1 b/chrome/app/chromium_strings_grd/IDS_APP_START_PREPARING_PROFILE_MESSAGE.png.sha1 new file mode 100644 index 0000000..a6478d97 --- /dev/null +++ b/chrome/app/chromium_strings_grd/IDS_APP_START_PREPARING_PROFILE_MESSAGE.png.sha1
@@ -0,0 +1 @@ +12b000c73d729c233b7fd0622515f8ed8f42416d \ No newline at end of file
diff --git a/chrome/app/settings_chromium_strings.grdp b/chrome/app/settings_chromium_strings.grdp index 7d9cb0b..c65e65e 100644 --- a/chrome/app/settings_chromium_strings.grdp +++ b/chrome/app/settings_chromium_strings.grdp
@@ -16,7 +16,7 @@ Updating Chromium (<ph name="PROGRESS_PERCENT">$1<ex>90%</ex></ph>) </message> <message name="IDS_SETTINGS_UPGRADE_SUCCESSFUL_RELAUNCH" desc="Status label: Successfully updated Chromium"> - Nearly up to date! Relaunch Chromium to finish updating. + Nearly up to date! Relaunch Chromium to finish updating. Incognito windows won't reopen. </message> <message name="IDS_SETTINGS_UPGRADE_UP_TO_DATE" desc="Status label: Already up to date (Chromium)"> Chromium is up to date @@ -89,12 +89,30 @@ <message name="IDS_SETTINGS_SAFETY_CHECK_PARENT_PRIMARY_LABEL_BEFORE" desc="This text describes what the safety check is. (It's an area of the Settings page where users can quickly check whether their safety-related settings are fully protecting them.)"> Chromium can help keep you safe from data breaches, bad extensions, and more </message> - <message name="IDS_SETTINGS_SAFETY_CHECK_UPDATES_FAILED_OFFLINE" desc="This text describles that Chrome cannot check for updates because there currently is no internet connection."> + <message name="IDS_SETTINGS_SAFETY_CHECK_UPDATES_FAILED_OFFLINE" desc="This text describes that Chromium cannot check for updates because there currently is no internet connection."> Chromium can't check for updates. Try checking your internet connection. </message> - <message name="IDS_SETTINGS_SAFETY_CHECK_UPDATES_FAILED" desc="This text describles that Chrome cannot update due to an unknown error."> + <message name="IDS_SETTINGS_SAFETY_CHECK_UPDATES_FAILED" desc="This text describes that Chromium cannot update due to an unknown error."> Chromium didn't update, something went wrong. <ph name="BEGIN_LINK"><a target="_blank" href="$1"></ph>Fix Chromium update problems and failed updates.<ph name="END_LINK"></a></ph> </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_OFFLINE" desc="This text points out that the password check cannot run due to not having internet connection."> + Chromium can't check your passwords. Try checking your internet connection. + </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_SIGNED_OUT" desc="This text points out that the password check can only run when the user is signed in."> + Chromium can't check your passwords because you're not signed in + </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_QUOTA_LIMIT" desc="This text points out that the password check cannot run and that the user should try again tomorrow."> + Chromium can't check all your passwords. Try again after 24 hours. + </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_TOO_MANY_PASSWORDS" desc="This text points out that the password check cannot run due to the user having too many saved passwords."> + Chromium can't check your passwords because there are too many + </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_ERROR" desc="This text points out that the password check encountered an unknown error."> + Chromium can't check your passwords. Try again later. + </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_EXTENSIONS_ERROR" desc="This text describes that safety check could not check extensions for an unkown reason."> + Chromium can't check your extensions. Try again later. + </message> <!-- People Page --> <message name="IDS_SETTINGS_SYNC_DISCONNECT_DELETE_PROFILE_WARNING_WITH_COUNTS_SINGULAR" desc="Warning message displayed in the Sign out of Chrome dialog that indicates profile browsing data will be removed from the device.">
diff --git a/chrome/app/settings_google_chrome_strings.grdp b/chrome/app/settings_google_chrome_strings.grdp index 7a9ec5d..935d92b4 100644 --- a/chrome/app/settings_google_chrome_strings.grdp +++ b/chrome/app/settings_google_chrome_strings.grdp
@@ -89,12 +89,30 @@ <message name="IDS_SETTINGS_SAFETY_CHECK_PARENT_PRIMARY_LABEL_BEFORE" desc="This text describes what the safety check is. (It's an area of the Settings page where users can quickly check whether their safety-related settings are fully protecting them.)"> Chrome can help keep you safe from data breaches, bad extensions, and more </message> - <message name="IDS_SETTINGS_SAFETY_CHECK_UPDATES_FAILED_OFFLINE" desc="This text describles that Chrome cannot check for updates because there currently is no internet connection."> + <message name="IDS_SETTINGS_SAFETY_CHECK_UPDATES_FAILED_OFFLINE" desc="This text describes that Chrome cannot check for updates because there currently is no internet connection."> Chrome can't check for updates. Try checking your internet connection. </message> - <message name="IDS_SETTINGS_SAFETY_CHECK_UPDATES_FAILED" desc="This text describles that Chrome cannot update due to an unknown error."> + <message name="IDS_SETTINGS_SAFETY_CHECK_UPDATES_FAILED" desc="This text describes that Chrome cannot update due to an unknown error."> Chrome didn't update, something went wrong. <ph name="BEGIN_LINK"><a target="_blank" href="$1"></ph>Fix Chrome update problems and failed updates.<ph name="END_LINK"></a></ph> </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_OFFLINE" desc="This text points out that the password check cannot run due to not having internet connection."> + Chrome can't check your passwords. Try checking your internet connection. + </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_SIGNED_OUT" desc="This text points out that the password check can only run when the user is signed in."> + Chrome can't check your passwords because you're not signed in + </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_QUOTA_LIMIT" desc="This text points out that the password check cannot run and that the user should try again tomorrow."> + Chrome can't check all your passwords. Try again after 24 hours. + </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_TOO_MANY_PASSWORDS" desc="This text points out that the password check cannot run due to the user having too many saved passwords."> + Chrome can't check your passwords because there are too many + </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_ERROR" desc="This text points out that the password check encountered an unknown error."> + Chrome can't check your passwords. Try again later. + </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_EXTENSIONS_ERROR" desc="This text describes that safety check could not check extensions for an unkown reason."> + Chrome can't check your extensions. Try again later. + </message> <!-- People Page --> <message name="IDS_SETTINGS_SYNC_DISCONNECT_DELETE_PROFILE_WARNING_WITH_COUNTS_SINGULAR" desc="Warning message displayed in the Sign out of Chrome dialog that indicates profile browsing data will be removed from the device.">
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index 2081816..f49707f 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -326,12 +326,18 @@ <message name="IDS_SETTINGS_CHECK_PASSWORDS_DESCRIPTION" desc="Explanation of the passwords bulk check feature found within the password settings."> Keep your passwords safe from data breaches and other security issues </message> - <message name="IDS_SETTINGS_LEAKED_PASSWORDS_COUNT" desc="Number of compromised passwords found during bulk check."> - <ph name="COUNT">$1<ex>5</ex></ph> compromised passwords + <message name="IDS_SETTINGS_COMPROMISED_PASSWORDS_COUNT" desc="Number of compromised passwords present in the database"> + {COUNT, plural, + =0 {No compromised passwords found} + =1 {{COUNT} compromised password} + other {{COUNT} compromised passwords}} </message> <message name="IDS_SETTINGS_CHECK_PASSWORDS_AGAIN" desc="Button to start bulk password check manually in passwords check section."> Check again </message> + <message name="IDS_SETTINGS_PASSWORDS_JUST_NOW" desc="Label shown when a compromised credential was found less than a minute ago"> + Just now + </message> <message name="IDS_SETTINGS_COMPROMISED_PASSWORDS" desc="Title for list of compromised credentials after passwords bulk check."> Compromised passwords </message> @@ -341,6 +347,9 @@ <message name="IDS_SETTINGS_CHANGE_PASSWORD_BUTTON" desc="Button inside password check section which opens url for changing leaked password."> Change password </message> + <message name="IDS_SETTINGS_CHANGE_PASSWORD_IN_APP_LABEL" desc="Label which is shown only if compromised credentials can't be fixed by visiting website (e.g. password from mobile app)."> + Open the app to change your password + </message> <message name="IDS_SETTINGS_COMPROMISED_PASSWORD_REASON_LEAKED" desc="Password compromise reason shown when a password was found in a data breach."> Found in data breach </message> @@ -1543,15 +1552,29 @@ <message name="IDS_SETTINGS_SAFETY_CHECK_PARENT_BUTTON" desc="'Check' is a verb. By clicking this button, the user can quickly check whether their safety-related settings are fully protecting them."> Check now </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_PARENT_BUTTON_ARIA_LABEL" desc="Accessibility text for the button with which the user can quickly check whether their safety-related settings are fully protecting them."> + Run safety check now + </message> <message name="IDS_SETTINGS_SAFETY_CHECK_UPDATES_PRIMARY_LABEL" desc="'Updates' is an element in safety check that shows the update status of Chrome."> Updates </message> - <message name="IDS_SETTINGS_SAFETY_CHECK_UPDATES_DISABLED_BY_ADMIN" desc="This text describles that updates are managed by the administrator."> - Updates are managed by your <ph name="BEGIN_LINK"><a target="_blank" href="$1"></ph>administrator<ph name="END_LINK"></a></ph> + <message name="IDS_SETTINGS_SAFETY_CHECK_UPDATES_DISABLED_BY_ADMIN" desc="This text describes that updates are managed by the administrator."> + Updates are managed by <ph name="BEGIN_LINK"><a target="_blank" href="$1"></ph>your administrator<ph name="END_LINK"></a></ph> </message> <message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_PRIMARY_LABEL" desc="'Passwords' is an element in safety check that allows users to check for their passwords being compromised."> Passwords </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_SAFE" desc="This text points out that the safety check password check has not found any compromised passwords."> + No compromised passwords found + </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_COMPROMISED" desc="This text points out that the safety check password check has found compromised passwords. The placeholder will be a numeral."> + {NUM_PASSWORDS, plural, + =1 {1 compromised password} + other {# compromised passwords}} + </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_NO_PASSWORDS" desc="This text points out that password check cannot run due to the user not having saved passwords."> + No saved passwords + </message> <message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_BUTTON" desc="This button allows users to change their compromised passwords."> Change passwords </message> @@ -1562,7 +1585,7 @@ Safe Browsing is off. To stay safe on the web, turn it on. </message> <message name="IDS_SETTINGS_SAFETY_CHECK_SAFE_BROWSING_DISABLED_BY_ADMIN" desc="This text points out that Safe Browsing is disabled by an administrator."> - Your <ph name="BEGIN_LINK"><a target="_blank" href="$1"></ph>administrator<ph name="END_LINK"></a></ph> has turned off Safe Browsing + <ph name="BEGIN_LINK"><a target="_blank" href="$1"></ph>Your administrator<ph name="END_LINK"></a></ph> has turned off Safe Browsing </message> <message name="IDS_SETTINGS_SAFETY_CHECK_SAFE_BROWSING_DISABLED_BY_EXTENSION" desc="This text points out that Safe Browsing is disabled by an extension."> An extension has turned off Safe Browsing @@ -1570,12 +1593,36 @@ <message name="IDS_SETTINGS_SAFETY_CHECK_SAFE_BROWSING_BUTTON" desc="This is the text for the button that allows users to manage their Safe Browsing settings."> Manage </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_SAFE_BROWSING_BUTTON_ARIA_LABEL" desc="Accessibility text for the button that allows users to manage their Safe Browsing settings."> + Manage Safe Browsing + </message> <message name="IDS_SETTINGS_SAFETY_CHECK_EXTENSIONS_PRIMARY_LABEL" desc="'Extensions' is an element in safety check that shows the safety check status of installed extensions."> Extensions </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_EXTENSIONS_SAFE" desc="This text describes that the user is protected from potentially harmful extensions."> + You're protected from potentially harmful extensions + </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_EXTENSIONS_BLOCKLISTED_OFF" desc="This text describes that potentially harmful extensions have been disabled. The placeholder will be a numeral."> + {NUM_EXTENSIONS, plural, + =1 {1 potentially harmful extension is off. You can also remove it.} + other {# potentially harmful extensions are off. You can also remove them.}} + </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_EXTENSIONS_BLOCKLISTED_ON_USER" desc="This text describes that the user has turned potentially harmful extensions back on. The placeholder will be a numeral."> + {NUM_EXTENSIONS, plural, + =1 {You turned 1 potentially harmful extension back on} + other {You turned # potentially harmful extensions back on}} + </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_EXTENSIONS_BLOCKLISTED_ON_ADMIN" desc="This text describes that an administrator has turned potentially harmful extensions back on."> + {NUM_EXTENSIONS, plural, + =1 {Your administrator turned 1 potentially harmful extension back on} + other {Your administrator turned # potentially harmful extensions back on}} + </message> <message name="IDS_SETTINGS_SAFETY_CHECK_EXTENSIONS_BUTTON" desc="This button allows users to review their extensions settings."> Review </message> + <message name="IDS_SETTINGS_SAFETY_CHECK_EXTENSIONS_BUTTON_ARIA_LABEL" desc="Accessibility text for the button that allows users to review their extensions settings."> + Review extensions + </message> <message name="IDS_SETTINGS_NETWORK_PREDICTION_ENABLED_LABEL" desc="In the advanced options tab, the text next to the checkbox that enables prediction of network actions. Actions include browser-initiated DNS prefetching, TCP and SSL preconnection, and prerendering of webpages."> Preload pages for faster browsing and searching </message>
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_CHANGE_PASSWORD_IN_APP_LABEL.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_CHANGE_PASSWORD_IN_APP_LABEL.png.sha1 new file mode 100644 index 0000000..c698b38 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_CHANGE_PASSWORD_IN_APP_LABEL.png.sha1
@@ -0,0 +1 @@ +8138fdfdf26bc43fe1802a2b621b68e613c46bbc \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPROMISED_PASSWORDS_COUNT.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPROMISED_PASSWORDS_COUNT.png.sha1 new file mode 100644 index 0000000..1eec7bf --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPROMISED_PASSWORDS_COUNT.png.sha1
@@ -0,0 +1 @@ +6d986169cb55c2109ba001bff3da1a2118946e46 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_LEAKED_PASSWORDS_COUNT.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_LEAKED_PASSWORDS_COUNT.png.sha1 deleted file mode 100644 index b275f77..0000000 --- a/chrome/app/settings_strings_grdp/IDS_SETTINGS_LEAKED_PASSWORDS_COUNT.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -956520bbbe69fb947a771b72de567f1bac2ac5c4 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_PASSWORDS_JUST_NOW.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_PASSWORDS_JUST_NOW.png.sha1 new file mode 100644 index 0000000..93948e1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_PASSWORDS_JUST_NOW.png.sha1
@@ -0,0 +1 @@ +c72fcd2625754a7a383ccd2885c322bb1b100f00 \ No newline at end of file
diff --git a/chrome/app/shared_settings_strings.grdp b/chrome/app/shared_settings_strings.grdp index 1db232e..ce7360f 100644 --- a/chrome/app/shared_settings_strings.grdp +++ b/chrome/app/shared_settings_strings.grdp
@@ -144,6 +144,9 @@ <message name="IDS_SETTINGS_SYNC_ADVANCED_PAGE_TITLE" desc="Name of the settings page which manages data used by sync."> Manage sync </message> + <message name="IDS_SETTINGS_NEW_SYNC_ADVANCED_PAGE_TITLE" desc="Name of the settings page which manages data used by sync."> + Manage what you sync + </message> <message name="IDS_SETTINGS_PEOPLE_SYNC_ANOTHER_ACCOUNT" desc="The label for the button that lets the user choose another account to sync with."> Use another account </message> @@ -177,15 +180,9 @@ <message name="IDS_SETTINGS_NON_PERSONALIZED_SERVICES_SECTION_LABEL" desc="Title for a section that shows options for various Google services"> Other Google services </message> - <message name="IDS_SETTINGS_SYNC_EVERYTHING_HINT" desc="Hint for the radio button which causes all properties to be synced."> - Sync all data types including ones that might be added in the future - </message> <message name="IDS_SETTINGS_CUSTOMIZE_SYNC" desc="Label for the radio button to customize sync data types."> Customize sync </message> - <message name="IDS_SETTINGS_CUSTOMIZE_SYNC_HINT" desc="Hint or the radio button to customize sync data types."> - Sync only selected data types - </message> <message name="IDS_SETTINGS_SYNC_DATA" desc="Title for sync data types list."> Sync data </message>
diff --git a/chrome/browser/android/tab_web_contents_delegate_android.cc b/chrome/browser/android/tab_web_contents_delegate_android.cc index 001e858f..7d5b490 100644 --- a/chrome/browser/android/tab_web_contents_delegate_android.cc +++ b/chrome/browser/android/tab_web_contents_delegate_android.cc
@@ -402,7 +402,7 @@ // At this point the |new_contents| is beyond the popup blocker, but we use // the same logic for determining if the popup tracker needs to be attached. if (source && ConsiderForPopupBlocking(disposition)) - PopupTracker::CreateForWebContents(new_contents.get(), source); + PopupTracker::CreateForWebContents(new_contents.get(), source, disposition); TabHelpers::AttachTabHelpers(new_contents.get());
diff --git a/chrome/browser/android/webapk/webapk_icon_hasher.cc b/chrome/browser/android/webapk/webapk_icon_hasher.cc index 4f33029f..f17e7b02 100644 --- a/chrome/browser/android/webapk/webapk_icon_hasher.cc +++ b/chrome/browser/android/webapk/webapk_icon_hasher.cc
@@ -102,7 +102,7 @@ if (net::DataURL::Parse(icon_url, &mime_type, &char_set, &data) && !data.empty()) { icon.hash = ComputeMurmur2Hash(data); - icon.data = std::move(data); + icon.unsafe_data = std::move(data); } base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), std::move(icon))); @@ -160,8 +160,8 @@ // malicious data. Decoding unsanitized bitmap data to an SkBitmap in the // browser process is a security bug. Icon icon; - icon.data = std::move(*response_body); - icon.hash = ComputeMurmur2Hash(icon.data); + icon.unsafe_data = std::move(*response_body); + icon.hash = ComputeMurmur2Hash(icon.unsafe_data); RunCallback(std::move(icon)); }
diff --git a/chrome/browser/android/webapk/webapk_icon_hasher.h b/chrome/browser/android/webapk/webapk_icon_hasher.h index 73e6080..b4d7530 100644 --- a/chrome/browser/android/webapk/webapk_icon_hasher.h +++ b/chrome/browser/android/webapk/webapk_icon_hasher.h
@@ -29,7 +29,11 @@ public: // Result struct for holding the downloaded icon data and its hash. struct Icon { - std::string data; + // The result of fetching the |icon|. This is untrusted data from the web + // and should not be processed or decoded by the browser process. + std::string unsafe_data; + + // The murmur2 hash of |unsafe_data|. std::string hash; };
diff --git a/chrome/browser/android/webapk/webapk_icon_hasher_unittest.cc b/chrome/browser/android/webapk/webapk_icon_hasher_unittest.cc index 0a3f536..92cc43a 100644 --- a/chrome/browser/android/webapk/webapk_icon_hasher_unittest.cc +++ b/chrome/browser/android/webapk/webapk_icon_hasher_unittest.cc
@@ -125,7 +125,7 @@ WebApkIconHasherRunner runner; runner.Run(test_url_loader_factory(), GURL(icon_url)); EXPECT_EQ(kIconMurmur2Hash, runner.icon().hash); - EXPECT_FALSE(runner.icon().data.empty()); + EXPECT_FALSE(runner.icon().unsafe_data.empty()); } TEST_F(WebApkIconHasherTest, DataUri) { @@ -135,7 +135,7 @@ WebApkIconHasherRunner runner; runner.Run(test_url_loader_factory(), icon_url); EXPECT_EQ("536500236142107998", runner.icon().hash); - EXPECT_FALSE(runner.icon().data.empty()); + EXPECT_FALSE(runner.icon().unsafe_data.empty()); } TEST_F(WebApkIconHasherTest, MultipleIconUrls) { @@ -164,7 +164,7 @@ auto result = runner.RunMultiple(test_url_loader_factory(), {icon_url1}); ASSERT_EQ(result.size(), 1u); EXPECT_EQ(result[icon_url1.spec()].hash, kIconMurmur2Hash); - EXPECT_FALSE(result[icon_url1.spec()].data.empty()); + EXPECT_FALSE(result[icon_url1.spec()].unsafe_data.empty()); } { @@ -172,10 +172,10 @@ runner.RunMultiple(test_url_loader_factory(), {icon_url1, icon_url2}); ASSERT_EQ(result.size(), 2u); EXPECT_EQ(result[icon_url1.spec()].hash, kIconMurmur2Hash); - EXPECT_FALSE(result[icon_url1.spec()].data.empty()); + EXPECT_FALSE(result[icon_url1.spec()].unsafe_data.empty()); EXPECT_EQ(result[icon_url2.spec()].hash, "536500236142107998"); - EXPECT_FALSE(result[icon_url2.spec()].data.empty()); + EXPECT_FALSE(result[icon_url2.spec()].unsafe_data.empty()); } } @@ -184,7 +184,7 @@ WebApkIconHasherRunner runner; runner.Run(test_url_loader_factory(), icon_url); EXPECT_TRUE(runner.icon().hash.empty()); - EXPECT_TRUE(runner.icon().data.empty()); + EXPECT_TRUE(runner.icon().unsafe_data.empty()); } TEST_F(WebApkIconHasherTest, InvalidUrl) { @@ -192,7 +192,7 @@ WebApkIconHasherRunner runner; runner.Run(test_url_loader_factory(), icon_url); EXPECT_TRUE(runner.icon().hash.empty()); - EXPECT_TRUE(runner.icon().data.empty()); + EXPECT_TRUE(runner.icon().unsafe_data.empty()); } TEST_F(WebApkIconHasherTest, DownloadTimedOut) { @@ -200,7 +200,7 @@ WebApkIconHasherRunner runner; runner.Run(test_url_loader_factory(), GURL(icon_url)); EXPECT_TRUE(runner.icon().hash.empty()); - EXPECT_TRUE(runner.icon().data.empty()); + EXPECT_TRUE(runner.icon().unsafe_data.empty()); } // Test that the hash callback is called with an empty string if an HTTP error @@ -220,5 +220,5 @@ WebApkIconHasherRunner runner; runner.Run(test_url_loader_factory(), GURL(icon_url)); EXPECT_TRUE(runner.icon().hash.empty()); - EXPECT_TRUE(runner.icon().data.empty()); + EXPECT_TRUE(runner.icon().unsafe_data.empty()); }
diff --git a/chrome/browser/android/webapk/webapk_installer.cc b/chrome/browser/android/webapk/webapk_installer.cc index 9f959bc8..ef0af530 100644 --- a/chrome/browser/android/webapk/webapk_installer.cc +++ b/chrome/browser/android/webapk/webapk_installer.cc
@@ -293,7 +293,7 @@ if (icon_url == shortcut_info.splash_image_url.spec()) { if (shortcut_info.splash_image_url != shortcut_info.best_primary_icon_url) { - image->set_image_data(it->second.data); + image->set_image_data(it->second.unsafe_data); } image->add_usages(webapk::Image::SPLASH_ICON); image->add_purposes(webapk::Image::ANY); @@ -316,10 +316,11 @@ // Don't move the hash to avoid clearing it in case of duplicates. shortcut_icon->set_hash(shortcut_hash_it->second.hash); - if (shortcut_hash_it->second.data.size() <= kMaxIconSizeInBytes) { + if (shortcut_hash_it->second.unsafe_data.size() <= + kMaxIconSizeInBytes) { // Duplicate icons will have an empty |image_data|. shortcut_icon->set_image_data( - std::move(shortcut_hash_it->second.data)); + std::move(shortcut_hash_it->second.unsafe_data)); } } }
diff --git a/chrome/browser/android/webapk/webapk_installer_unittest.cc b/chrome/browser/android/webapk/webapk_installer_unittest.cc index c4cf1bdf..4113622 100644 --- a/chrome/browser/android/webapk/webapk_installer_unittest.cc +++ b/chrome/browser/android/webapk/webapk_installer_unittest.cc
@@ -605,7 +605,7 @@ manifest.icons(1).hash()); EXPECT_THAT(manifest.icons(1).usages(), testing::ElementsAre(webapk::Image::SPLASH_ICON)); - EXPECT_EQ(icon_url_to_murmur2_hash[best_splash_icon_url].data, + EXPECT_EQ(icon_url_to_murmur2_hash[best_splash_icon_url].unsafe_data, manifest.icons(1).image_data()); // Check protobuf fields for unused icon. @@ -620,7 +620,7 @@ EXPECT_EQ(manifest.shortcuts(0).icons(0).hash(), icon_url_to_murmur2_hash[best_shortcut_icon_url].hash); EXPECT_EQ(manifest.shortcuts(0).icons(0).image_data(), - icon_url_to_murmur2_hash[best_shortcut_icon_url].data); + icon_url_to_murmur2_hash[best_shortcut_icon_url].unsafe_data); } // Tests a WebApk install or update request is built properly when the Chrome @@ -672,7 +672,7 @@ EXPECT_EQ(manifest.shortcuts(0).icons(0).hash(), icon_url_to_murmur2_hash[best_icon_url].hash); EXPECT_EQ(manifest.shortcuts(0).icons(0).image_data(), - icon_url_to_murmur2_hash[best_icon_url].data); + icon_url_to_murmur2_hash[best_icon_url].unsafe_data); } TEST_F(WebApkInstallerTest, BuildWebApkProtoWhenWithMultipleShortcuts) { @@ -700,14 +700,14 @@ EXPECT_EQ(manifest.shortcuts(0).icons(0).hash(), icon_url_to_murmur2_hash[best_shortcut_icon_url1].hash); EXPECT_EQ(manifest.shortcuts(0).icons(0).image_data(), - icon_url_to_murmur2_hash[best_shortcut_icon_url1].data); + icon_url_to_murmur2_hash[best_shortcut_icon_url1].unsafe_data); ASSERT_EQ(manifest.shortcuts(1).icons_size(), 1); EXPECT_EQ(manifest.shortcuts(1).icons(0).src(), best_shortcut_icon_url2); EXPECT_EQ(manifest.shortcuts(1).icons(0).hash(), icon_url_to_murmur2_hash[best_shortcut_icon_url2].hash); EXPECT_EQ(manifest.shortcuts(1).icons(0).image_data(), - icon_url_to_murmur2_hash[best_shortcut_icon_url2].data); + icon_url_to_murmur2_hash[best_shortcut_icon_url2].unsafe_data); } TEST_F(WebApkInstallerTest, @@ -733,7 +733,7 @@ EXPECT_EQ(manifest.shortcuts(0).icons(0).hash(), icon_url_to_murmur2_hash[best_shortcut_icon_url].hash); EXPECT_EQ(manifest.shortcuts(0).icons(0).image_data(), - icon_url_to_murmur2_hash[best_shortcut_icon_url].data); + icon_url_to_murmur2_hash[best_shortcut_icon_url].unsafe_data); ASSERT_EQ(manifest.shortcuts(1).icons_size(), 1); EXPECT_EQ(manifest.shortcuts(1).icons(0).src(), best_shortcut_icon_url); @@ -777,7 +777,7 @@ testing::ElementsAre(webapk::Image::SPLASH_ICON)); EXPECT_TRUE(manifest.icons(1).has_image_data()); EXPECT_EQ(manifest.icons(1).image_data(), - icon_url_to_murmur2_hash[best_icon_url].data); + icon_url_to_murmur2_hash[best_icon_url].unsafe_data); // Check protobuf fields for unused icon. EXPECT_EQ(kUnusedIconPath, manifest.icons(2).src()); @@ -792,5 +792,5 @@ icon_url_to_murmur2_hash[best_icon_url].hash); EXPECT_TRUE(manifest.shortcuts(0).icons(0).has_image_data()); EXPECT_EQ(manifest.shortcuts(0).icons(0).image_data(), - icon_url_to_murmur2_hash[best_icon_url].data); + icon_url_to_murmur2_hash[best_icon_url].unsafe_data); }
diff --git a/chrome/browser/android/webapk/webapk_ukm_recorder.cc b/chrome/browser/android/webapk/webapk_ukm_recorder.cc index 8e64476..0357663 100644 --- a/chrome/browser/android/webapk/webapk_ukm_recorder.cc +++ b/chrome/browser/android/webapk/webapk_ukm_recorder.cc
@@ -101,6 +101,17 @@ .Record(ukm::UkmRecorder::Get()); } +// static +void WebApkUkmRecorder::RecordWebApkableVisit(const GURL& manifest_url) { + if (!manifest_url.is_valid()) + return; + + ukm::SourceId source_id = + ukm::UkmRecorder::GetSourceIdForWebApkManifestUrl(manifest_url); + ukm::builders::PWA_Visit(source_id).SetWebAPKableSiteVisit(1).Record( + ukm::UkmRecorder::Get()); +} + // Called by the Java counterpart to record the Session Duration UKM metric. void JNI_WebApkUkmRecorder_RecordSessionDuration( JNIEnv* env,
diff --git a/chrome/browser/android/webapk/webapk_ukm_recorder.h b/chrome/browser/android/webapk/webapk_ukm_recorder.h index d9c324d..5bcf4258 100644 --- a/chrome/browser/android/webapk/webapk_ukm_recorder.h +++ b/chrome/browser/android/webapk/webapk_ukm_recorder.h
@@ -37,6 +37,15 @@ int64_t launch_count, int64_t install_duration); + // RecordWebApkableVisit records a visit to an installable PWA from a + // non-installed surface on Android (ie, if an installable site is visited + // from within a regular browser tab). + // + // Note that the metric will be recorded whether or not the PWA is actually + // installed - all that matters is that it is being visited from a + // "non-installed experience" (ie, as a normal browser tab). + static void RecordWebApkableVisit(const GURL& manifest_url); + private: DISALLOW_IMPLICIT_CONSTRUCTORS(WebApkUkmRecorder); };
diff --git a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier_unittest.cc b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier_unittest.cc index 8d28833..3c595f6f 100644 --- a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier_unittest.cc +++ b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier_unittest.cc
@@ -52,5 +52,12 @@ metrics::OmniboxInputType::QUERY); } +TEST_F(ChromeAutocompleteSchemeClassifierTest, DevToolsUrl) { + GURL url("devtools://foo"); + // An internal scheme should also be recognized as a URL. + EXPECT_EQ(scheme_classifier_->GetInputTypeForScheme(url.scheme()), + metrics::OmniboxInputType::URL); +} + // Can't test registered apps handling with mocking of shell_integration // because shell_integration is implemented via namespace shell_integration.
diff --git a/chrome/browser/banners/app_banner_manager_android.cc b/chrome/browser/banners/app_banner_manager_android.cc index 3cc8415..fdf39f0 100644 --- a/chrome/browser/banners/app_banner_manager_android.cc +++ b/chrome/browser/banners/app_banner_manager_android.cc
@@ -15,6 +15,7 @@ #include "chrome/browser/android/tab_android.h" #include "chrome/browser/android/tab_web_contents_delegate_android.h" #include "chrome/browser/android/webapk/webapk_metrics.h" +#include "chrome/browser/android/webapk/webapk_ukm_recorder.h" #include "chrome/browser/android/webapk/webapk_web_manifest_checker.h" #include "chrome/browser/android/webapps/add_to_homescreen_coordinator.h" #include "chrome/browser/android/webapps/add_to_homescreen_params.h" @@ -186,6 +187,14 @@ AppBannerManager::PerformInstallableWebAppCheck(); } +void AppBannerManagerAndroid::OnDidPerformInstallableWebAppCheck( + const InstallableData& data) { + if (data.errors.empty()) + WebApkUkmRecorder::RecordWebApkableVisit(data.manifest_url); + + AppBannerManager::OnDidPerformInstallableWebAppCheck(data); +} + void AppBannerManagerAndroid::ResetCurrentPageData() { AppBannerManager::ResetCurrentPageData(); native_app_data_.Reset();
diff --git a/chrome/browser/banners/app_banner_manager_android.h b/chrome/browser/banners/app_banner_manager_android.h index 3782f6b..bde7f8c 100644 --- a/chrome/browser/banners/app_banner_manager_android.h +++ b/chrome/browser/banners/app_banner_manager_android.h
@@ -84,6 +84,8 @@ void PerformInstallableChecks() override; InstallableParams ParamsToPerformInstallableWebAppCheck() override; void PerformInstallableWebAppCheck() override; + void OnDidPerformInstallableWebAppCheck( + const InstallableData& result) override; void ResetCurrentPageData() override; void ShowBannerUi(WebappInstallSource install_source) override; void MaybeShowAmbientBadge() override;
diff --git a/chrome/browser/browser_switcher/browser_switcher_browsertest.cc b/chrome/browser/browser_switcher/browser_switcher_browsertest.cc index 77799b1..9cf36e5 100644 --- a/chrome/browser/browser_switcher/browser_switcher_browsertest.cc +++ b/chrome/browser/browser_switcher/browser_switcher_browsertest.cc
@@ -149,8 +149,6 @@ private: base::ScopedTempDir temp_dir_; policy::MockConfigurationPolicyProvider provider_; - - DISALLOW_COPY_AND_ASSIGN(BrowserSwitcherBrowserTest); }; IN_PROC_BROWSER_TEST_F(BrowserSwitcherBrowserTest, RunsExternalCommand) {
diff --git a/chrome/browser/browser_switcher/browser_switcher_policy_migrator.h b/chrome/browser/browser_switcher/browser_switcher_policy_migrator.h index 0a2d5e1..a8fbfbf 100644 --- a/chrome/browser/browser_switcher/browser_switcher_policy_migrator.h +++ b/chrome/browser/browser_switcher/browser_switcher_policy_migrator.h
@@ -17,10 +17,11 @@ BrowserSwitcherPolicyMigrator(); ~BrowserSwitcherPolicyMigrator() override; - void Migrate(policy::PolicyBundle* bundle) override; + BrowserSwitcherPolicyMigrator(const BrowserSwitcherPolicyMigrator&) = delete; + BrowserSwitcherPolicyMigrator& operator=( + const BrowserSwitcherPolicyMigrator&) = delete; - private: - DISALLOW_COPY_AND_ASSIGN(BrowserSwitcherPolicyMigrator); + void Migrate(policy::PolicyBundle* bundle) override; }; } // namespace browser_switcher
diff --git a/chrome/browser/browser_switcher/browser_switcher_service_browsertest.cc b/chrome/browser/browser_switcher/browser_switcher_service_browsertest.cc index b9d1ba2..33d1bb4 100644 --- a/chrome/browser/browser_switcher/browser_switcher_service_browsertest.cc +++ b/chrome/browser/browser_switcher/browser_switcher_service_browsertest.cc
@@ -176,8 +176,6 @@ #if defined(OS_WIN) base::ScopedTempDir fake_appdata_dir_; #endif - - DISALLOW_COPY_AND_ASSIGN(BrowserSwitcherServiceTest); }; IN_PROC_BROWSER_TEST_F(BrowserSwitcherServiceTest, ExternalSitelistInvalidUrl) {
diff --git a/chrome/browser/browser_switcher/browser_switcher_service_factory.h b/chrome/browser/browser_switcher/browser_switcher_service_factory.h index 17a5289f..9cd9103a 100644 --- a/chrome/browser/browser_switcher/browser_switcher_service_factory.h +++ b/chrome/browser/browser_switcher/browser_switcher_service_factory.h
@@ -24,6 +24,10 @@ static BrowserSwitcherService* GetForBrowserContext( content::BrowserContext* browser_context); + BrowserSwitcherServiceFactory(const BrowserSwitcherServiceFactory&) = delete; + BrowserSwitcherServiceFactory& operator=( + const BrowserSwitcherServiceFactory&) = delete; + private: friend struct base::DefaultSingletonTraits<BrowserSwitcherServiceFactory>; @@ -35,8 +39,6 @@ content::BrowserContext* context) const override; content::BrowserContext* GetBrowserContextToUse( content::BrowserContext* context) const override; - - DISALLOW_COPY_AND_ASSIGN(BrowserSwitcherServiceFactory); }; } // namespace browser_switcher
diff --git a/chrome/browser/browser_switcher/browser_switcher_sitelist.h b/chrome/browser/browser_switcher/browser_switcher_sitelist.h index f53a5c5..f1c5ad68 100644 --- a/chrome/browser/browser_switcher/browser_switcher_sitelist.h +++ b/chrome/browser/browser_switcher/browser_switcher_sitelist.h
@@ -94,6 +94,10 @@ explicit BrowserSwitcherSitelistImpl(const BrowserSwitcherPrefs* prefs); ~BrowserSwitcherSitelistImpl() override; + BrowserSwitcherSitelistImpl(const BrowserSwitcherSitelistImpl&) = delete; + BrowserSwitcherSitelistImpl& operator=(const BrowserSwitcherSitelistImpl&) = + delete; + // BrowserSwitcherSitelist Decision GetDecision(const GURL& url) const override; void SetIeemSitelist(ParsedXml&& sitelist) override; @@ -112,8 +116,6 @@ RuleSet external_sitelist_; const BrowserSwitcherPrefs* const prefs_; - - DISALLOW_COPY_AND_ASSIGN(BrowserSwitcherSitelistImpl); }; } // namespace browser_switcher
diff --git a/chrome/browser/browser_switcher/ieem_sitelist_parser.h b/chrome/browser/browser_switcher/ieem_sitelist_parser.h index bb16966..222a5e3b 100644 --- a/chrome/browser/browser_switcher/ieem_sitelist_parser.h +++ b/chrome/browser/browser_switcher/ieem_sitelist_parser.h
@@ -21,11 +21,11 @@ base::Optional<std::string>&& error); ~ParsedXml(); + ParsedXml(const ParsedXml&) = delete; + ParsedXml& operator=(const ParsedXml&) = delete; + std::vector<std::string> rules; base::Optional<std::string> error; - - private: - DISALLOW_COPY_AND_ASSIGN(ParsedXml); }; // Parses the XML contained in |xml|, and calls |callback| with the parsed XML
diff --git a/chrome/browser/browser_switcher/ieem_sitelist_parser_browsertest.cc b/chrome/browser/browser_switcher/ieem_sitelist_parser_browsertest.cc index 57651fc..b732b06 100644 --- a/chrome/browser/browser_switcher/ieem_sitelist_parser_browsertest.cc +++ b/chrome/browser/browser_switcher/ieem_sitelist_parser_browsertest.cc
@@ -39,9 +39,6 @@ public: IeemSitelistParserTest() = default; ~IeemSitelistParserTest() override = default; - - private: - DISALLOW_COPY_AND_ASSIGN(IeemSitelistParserTest); }; IN_PROC_BROWSER_TEST_F(IeemSitelistParserTest, BadXml) {
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc index 8e31b51c..4fe5cb38 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
@@ -39,6 +39,7 @@ #include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.h" #include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings_factory.h" #include "chrome/browser/domain_reliability/service_factory.h" +#include "chrome/browser/downgrade/user_data_downgrade.h" #include "chrome/browser/download/download_prefs.h" #include "chrome/browser/external_protocol/external_protocol_handler.h" #include "chrome/browser/heavy_ad_intervention/heavy_ad_blocklist.h" @@ -1183,6 +1184,21 @@ // Remove external protocol data. if (remove_mask & DATA_TYPE_EXTERNAL_PROTOCOL_DATA) ExternalProtocolHandler::ClearData(profile_); + +#if BUILDFLAG(ENABLE_DOWNGRADE_PROCESSING) + ////////////////////////////////////////////////////////////////////////////// + // Remove data for this profile contained in any snapshots. + if (remove_mask && + filter_builder->GetMode() == BrowsingDataFilterBuilder::BLACKLIST) { + base::PostTaskAndReply( + FROM_HERE, + {base::ThreadPool(), base::TaskPriority::USER_VISIBLE, + base::MayBlock()}, + base::BindOnce(&downgrade::RemoveDataForProfile, delete_begin_, + profile_->GetPath(), remove_mask), + CreateTaskCompletionClosure(TracingDataType::kUserDataSnapshot)); + } +#endif // BUILDFLAG(ENABLE_DOWNGRADE_PROCESSING) } void ChromeBrowsingDataRemoverDelegate::OnTaskStarted(
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h index 664f7be9..aa40f97 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h
@@ -228,7 +228,8 @@ kLeakedCredentials = 32, // deprecated kFieldInfo = 33, kCompromisedCredentials = 34, - kMaxValue = kCompromisedCredentials, + kUserDataSnapshot = 35, + kMaxValue = kUserDataSnapshot, }; // Called by CreateTaskCompletionClosure().
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 068d9f2..530aeb13 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -1720,9 +1720,11 @@ "platform_keys/key_permissions.h", "platform_keys/key_permissions_policy_handler.cc", "platform_keys/key_permissions_policy_handler.h", - "platform_keys/platform_keys.cc", - "platform_keys/platform_keys.h", - "platform_keys/platform_keys_nss.cc", + "platform_keys/platform_keys_service.cc", + "platform_keys/platform_keys_service.h", + "platform_keys/platform_keys_service_factory.cc", + "platform_keys/platform_keys_service_factory.h", + "platform_keys/platform_keys_service_nss.cc", "plugin_vm/plugin_vm_drive_image_download_service.cc", "plugin_vm/plugin_vm_drive_image_download_service.h", "plugin_vm/plugin_vm_engagement_metrics_service.cc", @@ -2605,6 +2607,8 @@ "login/test/test_predicate_waiter.h", "login/version_updater/mock_version_updater_delegate.cc", "login/version_updater/mock_version_updater_delegate.h", + "platform_keys/mock_platform_keys_service.cc", + "platform_keys/mock_platform_keys_service.h", "printing/printing_stubs.cc", "printing/printing_stubs.h", "scoped_set_running_on_chromeos_for_testing.cc",
diff --git a/chrome/browser/chromeos/arc/enterprise/cert_store/arc_cert_store_bridge.cc b/chrome/browser/chromeos/arc/enterprise/cert_store/arc_cert_store_bridge.cc index fdbd32a..725f0b0 100644 --- a/chrome/browser/chromeos/arc/enterprise/cert_store/arc_cert_store_bridge.cc +++ b/chrome/browser/chromeos/arc/enterprise/cert_store/arc_cert_store_bridge.cc
@@ -14,7 +14,7 @@ #include "base/logging.h" #include "base/memory/singleton.h" #include "chrome/browser/chromeos/platform_keys/key_permissions.h" -#include "chrome/browser/chromeos/platform_keys/platform_keys.h" +#include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" #include "chrome/browser/net/nss_context.h" #include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/chromeos/arc/enterprise/cert_store/arc_cert_store_bridge_browsertest.cc b/chrome/browser/chromeos/arc/enterprise/cert_store/arc_cert_store_bridge_browsertest.cc index 7df6808..5f554c2a 100644 --- a/chrome/browser/chromeos/arc/enterprise/cert_store/arc_cert_store_bridge_browsertest.cc +++ b/chrome/browser/chromeos/arc/enterprise/cert_store/arc_cert_store_bridge_browsertest.cc
@@ -16,7 +16,7 @@ #include "chrome/browser/chromeos/arc/session/arc_service_launcher.h" #include "chrome/browser/chromeos/login/test/local_policy_test_server_mixin.h" #include "chrome/browser/chromeos/platform_keys/key_permissions.h" -#include "chrome/browser/chromeos/platform_keys/platform_keys.h" +#include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" #include "chrome/browser/chromeos/policy/user_policy_test_helper.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/net/nss_context.h"
diff --git a/chrome/browser/chromeos/arc/enterprise/cert_store/arc_smart_card_manager_bridge.cc b/chrome/browser/chromeos/arc/enterprise/cert_store/arc_smart_card_manager_bridge.cc index e1a6bfd..6a65553 100644 --- a/chrome/browser/chromeos/arc/enterprise/cert_store/arc_smart_card_manager_bridge.cc +++ b/chrome/browser/chromeos/arc/enterprise/cert_store/arc_smart_card_manager_bridge.cc
@@ -15,7 +15,7 @@ #include "chrome/browser/chromeos/arc/policy/arc_policy_bridge.h" #include "chrome/browser/chromeos/certificate_provider/certificate_provider_service.h" #include "chrome/browser/chromeos/certificate_provider/certificate_provider_service_factory.h" -#include "chrome/browser/chromeos/platform_keys/platform_keys.h" +#include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" #include "chrome/common/net/x509_certificate_model_nss.h" #include "components/arc/arc_browser_context_keyed_service_factory_base.h" #include "components/policy/core/common/policy_map.h"
diff --git a/chrome/browser/chromeos/login/app_launch_controller.cc b/chrome/browser/chromeos/login/app_launch_controller.cc index d9b91ea..bd516d9 100644 --- a/chrome/browser/chromeos/login/app_launch_controller.cc +++ b/chrome/browser/chromeos/login/app_launch_controller.cc
@@ -298,8 +298,9 @@ void AppLaunchController::OnNetworkConfigFinished() { DCHECK(network_config_requested_); network_config_requested_ = false; + showing_network_dialog_ = false; app_launch_splash_screen_view_->UpdateAppLaunchState( - AppLaunchSplashScreenView::APP_LAUNCH_STATE_PREPARING_NETWORK); + AppLaunchSplashScreenView::APP_LAUNCH_STATE_PREPARING_PROFILE); startup_app_launcher_->RestartLauncher(); } @@ -307,10 +308,12 @@ if (!waiting_for_network_) return; - if (online && !network_config_requested_) + // If the network timed out, we should exit network config dialog as soon as + // we are back online. + if (online && (network_wait_timedout_ || !showing_network_dialog_)) { + ClearNetworkWaitTimer(); startup_app_launcher_->ContinueWithNetworkReady(); - else if (network_wait_timedout_) - MaybeShowNetworkConfigureUI(); + } } void AppLaunchController::OnDeletingSplashScreenView() { @@ -467,10 +470,18 @@ FROM_HERE, base::TimeDelta::FromSeconds(network_wait_time_in_seconds), this, &AppLaunchController::OnNetworkWaitTimedout); + // Regardless of the network state, we should notify the view that network + // connection is required. app_launch_splash_screen_view_->UpdateAppLaunchState( AppLaunchSplashScreenView::APP_LAUNCH_STATE_PREPARING_NETWORK); -} + // If network configure ui was scheduled to be shown, we should display it + // before starting to install the app. + if (app_launch_splash_screen_view_->IsNetworkReady() && + !show_network_config_ui_after_profile_load_) { + OnNetworkStateChanged(/*online*/ true); + } +} bool AppLaunchController::IsNetworkReady() { return app_launch_splash_screen_view_ && app_launch_splash_screen_view_->IsNetworkReady();
diff --git a/chrome/browser/chromeos/login/login_browsertest.cc b/chrome/browser/chromeos/login/login_browsertest.cc index 9ac30bd..348963b0 100644 --- a/chrome/browser/chromeos/login/login_browsertest.cc +++ b/chrome/browser/chromeos/login/login_browsertest.cc
@@ -17,6 +17,7 @@ #include "chrome/browser/chromeos/login/test/guest_session_mixin.h" #include "chrome/browser/chromeos/login/test/login_manager_mixin.h" #include "chrome/browser/chromeos/login/test/offline_gaia_test_mixin.h" +#include "chrome/browser/chromeos/login/test/session_manager_state_waiter.h" #include "chrome/browser/chromeos/login/ui/login_display_host_webui.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/chrome_constants.h" @@ -172,10 +173,13 @@ offline_gaia_test_mixin_.PrepareOfflineGaiaLogin(); } -// Flaking: https://crbug.com/1023591 IN_PROC_BROWSER_TEST_F(LoginTest, GaiaAuthOffline) { offline_gaia_test_mixin_.GoOffline(); - offline_gaia_test_mixin_.SignIn(test_user_.account_id, kPassword); + offline_gaia_test_mixin_.InitOfflineLogin(test_user_.account_id, kPassword); + offline_gaia_test_mixin_.CheckManagedStatus(false); + offline_gaia_test_mixin_.SubmitGaiaAuthOfflineForm( + test_user_.account_id.GetUserEmail(), kPassword, + true /* wait for sign-in */); TestSystemTrayIsVisible(false); }
diff --git a/chrome/browser/chromeos/login/screens/gesture_navigation_screen.cc b/chrome/browser/chromeos/login/screens/gesture_navigation_screen.cc index e880238..186db4ed 100644 --- a/chrome/browser/chromeos/login/screens/gesture_navigation_screen.cc +++ b/chrome/browser/chromeos/login/screens/gesture_navigation_screen.cc
@@ -10,6 +10,7 @@ #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" #include "chrome/browser/chromeos/login/users/chrome_user_manager_util.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chromeos/constants/chromeos_switches.h" #include "components/prefs/pref_service.h" namespace chromeos { @@ -36,19 +37,24 @@ } void GestureNavigationScreen::ShowImpl() { - // TODO(mmourgos): If clamshell mode is enabled and device is detachable, then - // show the gesture navigation flow. - AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); if (chrome_user_manager_util::IsPublicSessionOrEphemeralLogin() || !ash::features::IsHideShelfControlsInTabletModeEnabled() || - !ash::TabletMode::Get()->InTabletMode() || accessibility_manager->IsSpokenFeedbackEnabled() || accessibility_manager->IsAutoclickEnabled() || accessibility_manager->IsSwitchAccessEnabled()) { exit_callback_.Run(); return; } + + // Skip the screen if the device is not in tablet mode, unless tablet mode + // first user run is forced on the device. + if (!ash::TabletMode::Get()->InTabletMode() && + !chromeos::switches::ShouldOobeUseTabletModeFirstRun()) { + exit_callback_.Run(); + return; + } + view_->Show(); }
diff --git a/chrome/browser/chromeos/login/screens/gesture_navigation_screen_browsertest.cc b/chrome/browser/chromeos/login/screens/gesture_navigation_screen_browsertest.cc index b7102a50..c8797fb 100644 --- a/chrome/browser/chromeos/login/screens/gesture_navigation_screen_browsertest.cc +++ b/chrome/browser/chromeos/login/screens/gesture_navigation_screen_browsertest.cc
@@ -17,10 +17,19 @@ #include "chrome/browser/chromeos/login/test/oobe_base_test.h" #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" #include "chrome/browser/chromeos/login/wizard_controller.h" +#include "chromeos/constants/chromeos_switches.h" namespace chromeos { -class GestureNavigationScreenTest : public OobeBaseTest { +namespace { + +enum class TestMode { kTablet, kClamshellWithForcedTabletFirstRun }; + +} // namespace + +class GestureNavigationScreenTest + : public OobeBaseTest, + public ::testing::WithParamInterface<TestMode> { public: GestureNavigationScreenTest() { feature_list_.InitAndEnableFeature( @@ -29,8 +38,13 @@ ~GestureNavigationScreenTest() override = default; // InProcessBrowserTest: + void SetUpCommandLine(base::CommandLine* command_line) override { + if (GetParam() == TestMode::kClamshellWithForcedTabletFirstRun) + command_line->AppendSwitch(switches::kOobeForceTabletFirstRun); + OobeBaseTest::SetUpCommandLine(command_line); + } void SetUpOnMainThread() override { - ash::ShellTestApi().SetTabletModeEnabledForTest(true); + ash::ShellTestApi().SetTabletModeEnabledForTest(StartInTabletMode()); GestureNavigationScreen* gesture_screen = static_cast<GestureNavigationScreen*>( @@ -43,6 +57,12 @@ OobeBaseTest::SetUpOnMainThread(); } + bool StartInTabletMode() const { return GetParam() == TestMode::kTablet; } + + bool ShouldBeSkippedInClamshell() const { + return GetParam() != TestMode::kClamshellWithForcedTabletFirstRun; + } + // Shows the gesture navigation screen. void ShowGestureNavigationScreen() { WizardController::default_controller()->AdvanceToScreen( @@ -95,8 +115,14 @@ base::test::ScopedFeatureList feature_list_; }; +INSTANTIATE_TEST_SUITE_P( + All, + GestureNavigationScreenTest, + testing::Values(TestMode::kTablet, + TestMode::kClamshellWithForcedTabletFirstRun)); + // Ensure a working flow for the gesture navigation screen. -IN_PROC_BROWSER_TEST_F(GestureNavigationScreenTest, FlowTest) { +IN_PROC_BROWSER_TEST_P(GestureNavigationScreenTest, FlowTest) { ShowGestureNavigationScreen(); OobeScreenWaiter(GestureNavigationScreenView::kScreenId).Wait(); @@ -139,16 +165,20 @@ } // Ensure the flow is skipped when in clamshell mode. -IN_PROC_BROWSER_TEST_F(GestureNavigationScreenTest, ScreenSkippedInClamshell) { +IN_PROC_BROWSER_TEST_P(GestureNavigationScreenTest, ScreenSkippedInClamshell) { ash::ShellTestApi().SetTabletModeEnabledForTest(false); ShowGestureNavigationScreen(); - WaitForScreenExit(); + if (ShouldBeSkippedInClamshell()) { + WaitForScreenExit(); + } else { + OobeScreenWaiter(GestureNavigationScreenView::kScreenId).Wait(); + } } // Ensure the flow is skipped when spoken feedback is enabled. -IN_PROC_BROWSER_TEST_F(GestureNavigationScreenTest, +IN_PROC_BROWSER_TEST_P(GestureNavigationScreenTest, ScreenSkippedWithSpokenFeedbackEnabled) { AccessibilityManager::Get()->EnableSpokenFeedback(true); @@ -158,7 +188,7 @@ } // Ensure the flow is skipped when autoclick is enabled. -IN_PROC_BROWSER_TEST_F(GestureNavigationScreenTest, +IN_PROC_BROWSER_TEST_P(GestureNavigationScreenTest, ScreenSkippedWithAutoclickEnabled) { AccessibilityManager::Get()->EnableAutoclick(true); @@ -168,7 +198,7 @@ } // Ensure the flow is skipped when switch access is enabled. -IN_PROC_BROWSER_TEST_F(GestureNavigationScreenTest, +IN_PROC_BROWSER_TEST_P(GestureNavigationScreenTest, ScreenSkippedWithSwitchAccessEnabled) { AccessibilityManager::Get()->SetSwitchAccessEnabled(true);
diff --git a/chrome/browser/chromeos/login/screens/marketing_opt_in_screen.cc b/chrome/browser/chromeos/login/screens/marketing_opt_in_screen.cc index f7361948..c2bd86b 100644 --- a/chrome/browser/chromeos/login/screens/marketing_opt_in_screen.cc +++ b/chrome/browser/chromeos/login/screens/marketing_opt_in_screen.cc
@@ -76,7 +76,8 @@ // user login. Also skip the screen if clamshell mode is active. // TODO(mmourgos): Enable this screen for clamshell mode. if (chrome_user_manager_util::IsPublicSessionOrEphemeralLogin() || - !ash::TabletMode::Get()->InTabletMode()) { + (!ash::TabletMode::Get()->InTabletMode() && + did_skip_gesture_navigation_screen)) { exit_callback_.Run(); return; }
diff --git a/chrome/browser/chromeos/login/test/offline_gaia_test_mixin.cc b/chrome/browser/chromeos/login/test/offline_gaia_test_mixin.cc index e3b23e98..fbc6712 100644 --- a/chrome/browser/chromeos/login/test/offline_gaia_test_mixin.cc +++ b/chrome/browser/chromeos/login/test/offline_gaia_test_mixin.cc
@@ -68,14 +68,14 @@ network_state_test_helper_.reset(); } -void OfflineGaiaTestMixin::SignIn(const AccountId& test_account_id, - const std::string& password) { - ASSERT_TRUE((test_account_id.HasAccountIdKey())); - - InitOfflineLogin(test_account_id, password); - SubmitGaiaAuthOfflineForm(test_account_id.GetUserEmail(), password); - SessionStateWaiter(session_manager::SessionState::LOGGED_IN_NOT_ACTIVE) - .Wait(); +void OfflineGaiaTestMixin::CheckManagedStatus(bool expected_is_managed) { + if (expected_is_managed) { + test::OobeJS().ExpectVisiblePath( + {"gaia-signin", "offline-gaia", "managedBy"}); + } else { + test::OobeJS().ExpectHiddenPath( + {"gaia-signin", "offline-gaia", "managedBy"}); + } } void OfflineGaiaTestMixin::InitOfflineLogin(const AccountId& test_account_id, @@ -102,7 +102,8 @@ void OfflineGaiaTestMixin::SubmitGaiaAuthOfflineForm( const std::string& user_email, - const std::string& password) { + const std::string& password, + bool wait_for_signin) { test::OobeJS().ExpectVisiblePath({"gaia-signin", "offline-gaia"}); test::OobeJS().ExpectHiddenPath({"gaia-signin", "signin-frame-dialog"}); test::OobeJS() @@ -129,6 +130,10 @@ {"gaia-signin", "offline-gaia", "passwordInput"}); test::OobeJS().ClickOnPath( {"gaia-signin", "offline-gaia", "next-button"}); + if (wait_for_signin) { + SessionStateWaiter(session_manager::SessionState::LOGGED_IN_NOT_ACTIVE) + .Wait(); + } } } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/test/offline_gaia_test_mixin.h b/chrome/browser/chromeos/login/test/offline_gaia_test_mixin.h index 0a0dc06c..1593378 100644 --- a/chrome/browser/chromeos/login/test/offline_gaia_test_mixin.h +++ b/chrome/browser/chromeos/login/test/offline_gaia_test_mixin.h
@@ -34,23 +34,25 @@ void GoOffline(); void GoOnline(); - // Loads offline GAIA page and signs-in. - // Expects user to be already registered (probably via LoginManagerMixin). - // Expects networking to be disabled (probably by caling GoOffline()) - void SignIn(const AccountId& test_account_id, const std::string& password); + // Checks if UI displays management notification. + void CheckManagedStatus(bool expected_is_managed); - private: // Initializes UserManager for offline Login. + // Expects networking to be disabled (probably by calling GoOffline()) void InitOfflineLogin(const AccountId& test_account_id, const std::string& password); + // Fills in and submits offline GAIA login. + // Expects user to be already registered (probably via LoginManagerMixin). + // Optionally waits for sign-in to complete. + void SubmitGaiaAuthOfflineForm(const std::string& user_email, + const std::string& password, + bool wait_for_signin); + + private: // Triggers Offlige Gaia screen. void StartGaiaAuthOffline(); - // Fills in and submits offline GAIA login. - void SubmitGaiaAuthOfflineForm(const std::string& user_email, - const std::string& password); - // This is ised to disable networking. std::unique_ptr<chromeos::NetworkStateTestHelper> network_state_test_helper_;
diff --git a/chrome/browser/chromeos/platform_keys/extension_platform_keys_service.cc b/chrome/browser/chromeos/platform_keys/extension_platform_keys_service.cc index 64dfab2..57e59c8 100644 --- a/chrome/browser/chromeos/platform_keys/extension_platform_keys_service.cc +++ b/chrome/browser/chromeos/platform_keys/extension_platform_keys_service.cc
@@ -16,7 +16,8 @@ #include "base/optional.h" #include "base/stl_util.h" #include "base/values.h" -#include "chrome/browser/chromeos/platform_keys/platform_keys.h" +#include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" +#include "chrome/browser/chromeos/platform_keys/platform_keys_service_factory.h" #include "content/public/browser/browser_thread.h" #include "extensions/browser/state_store.h" #include "net/cert/x509_certificate.h" @@ -74,14 +75,12 @@ const std::string& extension_id, const GenerateKeyCallback& callback, KeyPermissions* key_permissions, - ExtensionPlatformKeysService* service, - content::BrowserContext* browser_context) + ExtensionPlatformKeysService* service) : token_id_(token_id), extension_id_(extension_id), callback_(callback), key_permissions_(key_permissions), - service_(service), - browser_context_(browser_context) {} + service_(service) {} ~GenerateKeyTask() override = default; @@ -103,7 +102,6 @@ extension_permissions_; KeyPermissions* const key_permissions_; ExtensionPlatformKeysService* const service_; - content::BrowserContext* const browser_context_; private: void DoStep() { @@ -183,14 +181,12 @@ const std::string& extension_id, const GenerateKeyCallback& callback, KeyPermissions* key_permissions, - ExtensionPlatformKeysService* service, - content::BrowserContext* browser_context) + ExtensionPlatformKeysService* service) : GenerateKeyTask(token_id, extension_id, callback, key_permissions, - service, - browser_context), + service), modulus_length_(modulus_length) {} ~GenerateRSAKeyTask() override {} @@ -198,8 +194,8 @@ private: // Generates the RSA key. void GenerateKey(GenerateKeyCallback callback) override { - platform_keys::subtle::GenerateRSAKey(token_id_, modulus_length_, callback, - browser_context_); + service_->platform_keys_service_->GenerateRSAKey(token_id_, modulus_length_, + callback); } const unsigned int modulus_length_; @@ -215,14 +211,12 @@ const std::string& extension_id, const GenerateKeyCallback& callback, KeyPermissions* key_permissions, - ExtensionPlatformKeysService* service, - content::BrowserContext* browser_context) + ExtensionPlatformKeysService* service) : GenerateKeyTask(token_id, extension_id, callback, key_permissions, - service, - browser_context), + service), named_curve_(named_curve) {} ~GenerateECKeyTask() override {} @@ -230,8 +224,8 @@ private: // Generates the EC key. void GenerateKey(GenerateKeyCallback callback) override { - platform_keys::subtle::GenerateECKey(token_id_, named_curve_, callback, - browser_context_); + service_->platform_keys_service_->GenerateECKey(token_id_, named_curve_, + callback); } const std::string named_curve_; @@ -327,10 +321,9 @@ } void GetKeyLocations() { - platform_keys::GetKeyLocations( + service_->platform_keys_service_->GetKeyLocations( public_key_spki_der_, - base::BindRepeating(&SignTask::GotKeyLocation, base::Unretained(this)), - service_->browser_context_); + base::BindRepeating(&SignTask::GotKeyLocation, base::Unretained(this))); } void GotKeyLocation(const std::vector<std::string>& token_ids, @@ -356,24 +349,21 @@ switch (key_type_) { case platform_keys::KeyType::kRsassaPkcs1V15: { if (raw_pkcs1_) { - platform_keys::subtle::SignRSAPKCS1Raw( + service_->platform_keys_service_->SignRSAPKCS1Raw( token_id_, data_, public_key_spki_der_, - base::Bind(&SignTask::DidSign, weak_factory_.GetWeakPtr()), - service_->browser_context_); + base::Bind(&SignTask::DidSign, weak_factory_.GetWeakPtr())); } else { - platform_keys::subtle::SignRSAPKCS1Digest( + service_->platform_keys_service_->SignRSAPKCS1Digest( token_id_, data_, public_key_spki_der_, hash_algorithm_, - base::Bind(&SignTask::DidSign, weak_factory_.GetWeakPtr()), - service_->browser_context_); + base::Bind(&SignTask::DidSign, weak_factory_.GetWeakPtr())); } break; } case platform_keys::KeyType::kEcdsa: { - platform_keys::subtle::SignECDSADigest( + service_->platform_keys_service_->SignECDSADigest( token_id_, data_, public_key_spki_der_, hash_algorithm_, - base::Bind(&SignTask::DidSign, weak_factory_.GetWeakPtr()), - service_->browser_context_); + base::Bind(&SignTask::DidSign, weak_factory_.GetWeakPtr())); break; } } @@ -511,10 +501,9 @@ // Retrieves all certificates matching |request_|. Will call back to // |GotMatchingCerts()|. void GetMatchingCerts() { - platform_keys::subtle::SelectClientCertificates( + service_->platform_keys_service_->SelectClientCertificates( request_.certificate_authorities, - base::Bind(&SelectTask::GotMatchingCerts, weak_factory_.GetWeakPtr()), - service_->browser_context_); + base::Bind(&SelectTask::GotMatchingCerts, weak_factory_.GetWeakPtr())); } // If the certificate request could be processed successfully, |matches| will @@ -574,11 +563,10 @@ const std::string public_key_spki_der( platform_keys::GetSubjectPublicKeyInfo(certificate)); - platform_keys::GetKeyLocations( + service_->platform_keys_service_->GetKeyLocations( public_key_spki_der, base::BindRepeating(&SelectTask::GotKeyLocations, - base::Unretained(this), certificate), - service_->browser_context_); + base::Unretained(this), certificate)); } void GotKeyLocations(const scoped_refptr<net::X509Certificate>& certificate, @@ -739,10 +727,14 @@ content::BrowserContext* browser_context, extensions::StateStore* state_store) : browser_context_(browser_context), + platform_keys_service_( + platform_keys::PlatformKeysServiceFactory::GetForBrowserContext( + browser_context)), key_permissions_(profile_is_managed, profile_prefs, profile_policies, state_store) { + DCHECK(platform_keys_service_); DCHECK(browser_context); DCHECK(state_store); } @@ -761,8 +753,8 @@ const GenerateKeyCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); StartOrQueueTask(std::make_unique<GenerateRSAKeyTask>( - token_id, modulus_length, extension_id, callback, &key_permissions_, this, - browser_context_)); + token_id, modulus_length, extension_id, callback, &key_permissions_, + this)); } void ExtensionPlatformKeysService::GenerateECKey( @@ -772,8 +764,7 @@ const GenerateKeyCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); StartOrQueueTask(std::make_unique<GenerateECKeyTask>( - token_id, named_curve, extension_id, callback, &key_permissions_, this, - browser_context_)); + token_id, named_curve, extension_id, callback, &key_permissions_, this)); } void ExtensionPlatformKeysService::SignDigest(
diff --git a/chrome/browser/chromeos/platform_keys/extension_platform_keys_service.h b/chrome/browser/chromeos/platform_keys/extension_platform_keys_service.h index 1c2d38c..16f4b5e5 100644 --- a/chrome/browser/chromeos/platform_keys/extension_platform_keys_service.h +++ b/chrome/browser/chromeos/platform_keys/extension_platform_keys_service.h
@@ -14,7 +14,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/chromeos/platform_keys/key_permissions.h" -#include "chrome/browser/chromeos/platform_keys/platform_keys.h" +#include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" #include "components/keyed_service/core/keyed_service.h" class PrefService; @@ -215,7 +215,8 @@ const std::string& public_key_spki_der, const std::string& error_message); - content::BrowserContext* browser_context_; + content::BrowserContext* const browser_context_ = nullptr; + platform_keys::PlatformKeysService* const platform_keys_service_ = nullptr; KeyPermissions key_permissions_; std::unique_ptr<SelectDelegate> select_delegate_; base::queue<std::unique_ptr<Task>> tasks_;
diff --git a/chrome/browser/chromeos/platform_keys/extension_platform_keys_service_factory.cc b/chrome/browser/chromeos/platform_keys/extension_platform_keys_service_factory.cc index 6e0880d..c08bc0f 100644 --- a/chrome/browser/chromeos/platform_keys/extension_platform_keys_service_factory.cc +++ b/chrome/browser/chromeos/platform_keys/extension_platform_keys_service_factory.cc
@@ -14,6 +14,7 @@ #include "base/memory/singleton.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/chromeos/platform_keys/extension_platform_keys_service.h" +#include "chrome/browser/chromeos/platform_keys/platform_keys_service_factory.h" #include "chrome/browser/extensions/extension_system_factory.h" #include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/browser/profiles/incognito_helpers.h" @@ -89,6 +90,7 @@ "ExtensionPlatformKeysService", BrowserContextDependencyManager::GetInstance()) { DependsOn(extensions::ExtensionSystemFactory::GetInstance()); + DependsOn(chromeos::platform_keys::PlatformKeysServiceFactory::GetInstance()); } ExtensionPlatformKeysServiceFactory::~ExtensionPlatformKeysServiceFactory() {}
diff --git a/chrome/browser/chromeos/platform_keys/mock_platform_keys_service.cc b/chrome/browser/chromeos/platform_keys/mock_platform_keys_service.cc new file mode 100644 index 0000000..9477c157 --- /dev/null +++ b/chrome/browser/chromeos/platform_keys/mock_platform_keys_service.cc
@@ -0,0 +1,19 @@ +// 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/platform_keys/mock_platform_keys_service.h" + +namespace chromeos { +namespace platform_keys { + +MockPlatformKeysService::MockPlatformKeysService() = default; +MockPlatformKeysService::~MockPlatformKeysService() = default; + +std::unique_ptr<KeyedService> BuildMockPlatformKeysService( + content::BrowserContext*) { + return std::make_unique<MockPlatformKeysService>(); +} + +} // namespace platform_keys +} // namespace chromeos
diff --git a/chrome/browser/chromeos/platform_keys/mock_platform_keys_service.h b/chrome/browser/chromeos/platform_keys/mock_platform_keys_service.h new file mode 100644 index 0000000..83ae43e8 --- /dev/null +++ b/chrome/browser/chromeos/platform_keys/mock_platform_keys_service.h
@@ -0,0 +1,105 @@ +// 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_PLATFORM_KEYS_MOCK_PLATFORM_KEYS_SERVICE_H_ +#define CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_MOCK_PLATFORM_KEYS_SERVICE_H_ + +#include <memory> + +#include "base/callback.h" +#include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" +#include "testing/gmock/include/gmock/gmock.h" + +namespace chromeos { +namespace platform_keys { + +class MockPlatformKeysService : public PlatformKeysService { + public: + MockPlatformKeysService(); + MockPlatformKeysService(const MockPlatformKeysService&) = delete; + MockPlatformKeysService& operator=(const MockPlatformKeysService&) = delete; + ~MockPlatformKeysService() override; + + MOCK_METHOD(void, + GenerateRSAKey, + (const std::string& token_id, + unsigned int modulus_length_bits, + const GenerateKeyCallback& callback), + (override)); + + MOCK_METHOD(void, + GenerateECKey, + (const std::string& token_id, + const std::string& named_curve, + const GenerateKeyCallback& callback), + (override)); + + MOCK_METHOD(void, + SignRSAPKCS1Digest, + (const std::string& token_id, + const std::string& data, + const std::string& public_key_spki_der, + HashAlgorithm hash_algorithm, + const SignCallback& callback), + (override)); + + MOCK_METHOD(void, + SignRSAPKCS1Raw, + (const std::string& token_id, + const std::string& data, + const std::string& public_key_spki_der, + const SignCallback& callback), + (override)); + + MOCK_METHOD(void, + SignECDSADigest, + (const std::string& token_id, + const std::string& data, + const std::string& public_key_spki_der, + HashAlgorithm hash_algorithm, + const SignCallback& callback), + (override)); + + MOCK_METHOD(void, + SelectClientCertificates, + (const std::vector<std::string>& certificate_authorities, + const SelectCertificatesCallback& callback), + (override)); + + MOCK_METHOD(void, + GetCertificates, + (const std::string& token_id, + const GetCertificatesCallback& callback), + (override)); + + MOCK_METHOD(void, + ImportCertificate, + (const std::string& token_id, + const scoped_refptr<net::X509Certificate>& certificate, + const ImportCertificateCallback& callback), + (override)); + + MOCK_METHOD(void, + RemoveCertificate, + (const std::string& token_id, + const scoped_refptr<net::X509Certificate>& certificate, + const RemoveCertificateCallback& callback), + (override)); + + MOCK_METHOD(void, GetTokens, (const GetTokensCallback& callback), (override)); + + MOCK_METHOD(void, + GetKeyLocations, + (const std::string& public_key_spki_der, + const GetKeyLocationsCallback& callback), + (override)); +}; + +std::unique_ptr<KeyedService> BuildMockPlatformKeysService( + content::BrowserContext* context); + +} // namespace platform_keys +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_MOCK_PLATFORM_KEYS_SERVICE_H_
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys.cc b/chrome/browser/chromeos/platform_keys/platform_keys_service.cc similarity index 76% rename from chrome/browser/chromeos/platform_keys/platform_keys.cc rename to chrome/browser/chromeos/platform_keys/platform_keys_service.cc index 8262e520..6a1def7 100644 --- a/chrome/browser/chromeos/platform_keys/platform_keys.cc +++ b/chrome/browser/chromeos/platform_keys/platform_keys_service.cc
@@ -1,8 +1,8 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// 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/platform_keys/platform_keys.h" +#include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" #include <map> @@ -15,9 +15,11 @@ #include "net/cert/x509_certificate.h" namespace chromeos { - namespace platform_keys { +const char kTokenIdUser[] = "user"; +const char kTokenIdSystem[] = "system"; + namespace { void IntersectOnWorkerThread(const net::CertificateList& certs1, @@ -47,18 +49,6 @@ } // namespace -const char kTokenIdUser[] = "user"; -const char kTokenIdSystem[] = "system"; - -ClientCertificateRequest::ClientCertificateRequest() { -} - -ClientCertificateRequest::ClientCertificateRequest( - const ClientCertificateRequest& other) = default; - -ClientCertificateRequest::~ClientCertificateRequest() { -} - void IntersectCertificates( const net::CertificateList& certs1, const net::CertificateList& certs2, @@ -78,6 +68,25 @@ base::Bind(callback, base::Passed(&intersection))); } -} // namespace platform_keys +// =================== ClientCertificateRequest ================================ +ClientCertificateRequest::ClientCertificateRequest() = default; + +ClientCertificateRequest::ClientCertificateRequest( + const ClientCertificateRequest& other) = default; + +ClientCertificateRequest::~ClientCertificateRequest() = default; + +// =================== PlatformKeysServiceImpl ================================= + +PlatformKeysServiceImpl::PlatformKeysServiceImpl( + content::BrowserContext* context) + : browser_context_(context) {} + +PlatformKeysServiceImpl::~PlatformKeysServiceImpl() = default; + +// The rest of the methods - the NSS-specific part of the implementation - +// resides in the platform_keys_service_nss.cc file. + +} // namespace platform_keys } // namespace chromeos
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_service.h b/chrome/browser/chromeos/platform_keys/platform_keys_service.h new file mode 100644 index 0000000..3dd00c43 --- /dev/null +++ b/chrome/browser/chromeos/platform_keys/platform_keys_service.h
@@ -0,0 +1,298 @@ +// 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_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_ +#define CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_ + +#include <stddef.h> + +#include <memory> +#include <string> +#include <vector> + +#include "base/callback_forward.h" +#include "base/memory/ref_counted.h" +#include "base/memory/weak_ptr.h" +#include "components/keyed_service/core/keyed_service.h" +#include "net/cert/x509_certificate.h" + +namespace content { +class BrowserContext; +} + +namespace chromeos { +namespace platform_keys { + +// A token is a store for keys or certs and can provide cryptographic +// operations. +// ChromeOS provides itself a user token and conditionally a system wide token, +// thus these tokens use static identifiers. The platform keys API is designed +// to support arbitrary other tokens in the future, which could then use +// run-time generated IDs. +extern const char kTokenIdUser[]; +extern const char kTokenIdSystem[]; + +// Supported key types. +enum class KeyType { kRsassaPkcs1V15, kEcdsa }; + +// Supported hash algorithms. +enum HashAlgorithm { + HASH_ALGORITHM_NONE, // The value if no hash function is selected. + HASH_ALGORITHM_SHA1, + HASH_ALGORITHM_SHA256, + HASH_ALGORITHM_SHA384, + HASH_ALGORITHM_SHA512 +}; + +// Returns the DER encoding of the X.509 Subject Public Key Info of the public +// key in |certificate|. +std::string GetSubjectPublicKeyInfo( + const scoped_refptr<net::X509Certificate>& certificate); + +// Intersects the two certificate lists |certs1| and |certs2| and passes the +// intersection to |callback|. The intersction preserves the order of |certs1|. +void IntersectCertificates( + const net::CertificateList& certs1, + const net::CertificateList& certs2, + const base::Callback<void(std::unique_ptr<net::CertificateList>)>& + callback); + +// Obtains information about the public key in |certificate|. +// If |certificate| contains an RSA key, sets |key_size_bits| to the modulus +// length, and |key_type| to type RSA and returns true. +// If |certificate| contains any other key type, or if the public exponent of +// the RSA key in |certificate| is not F4, returns false and does not update any +// of the output parameters. +// All pointer arguments must not be null. +bool GetPublicKey(const scoped_refptr<net::X509Certificate>& certificate, + net::X509Certificate::PublicKeyType* key_type, + size_t* key_size_bits); + +struct ClientCertificateRequest { + ClientCertificateRequest(); + ClientCertificateRequest(const ClientCertificateRequest& other); + ~ClientCertificateRequest(); + + // The list of the types of certificates requested, sorted in order of the + // server's preference. + std::vector<net::X509Certificate::PublicKeyType> certificate_key_types; + + // List of distinguished names of certificate authorities allowed by the + // server. Each entry must be a DER-encoded X.509 DistinguishedName. + std::vector<std::string> certificate_authorities; +}; + +using GenerateKeyCallback = + base::Callback<void(const std::string& public_key_spki_der, + const std::string& error_message)>; + +using SignCallback = base::Callback<void(const std::string& signature, + const std::string& error_message)>; + +// If the certificate request could be processed successfully, |matches| will +// contain the list of matching certificates (which may be empty) and +// |error_message| will be empty. If an error occurred, |matches| will be null +// and |error_message| contain an error message. +using SelectCertificatesCallback = + base::Callback<void(std::unique_ptr<net::CertificateList> matches, + const std::string& error_message)>; + +// If the list of certificates could be successfully retrieved, |certs| will +// contain the list of available certificates (maybe empty) and |error_message| +// will be empty. If an error occurred, |certs| will be empty and +// |error_message| contain an error message. +using GetCertificatesCallback = + base::Callback<void(std::unique_ptr<net::CertificateList> certs, + const std::string& error_message)>; + +// If an error occurred during import, |error_message| will be set to an error +// message. +using ImportCertificateCallback = + base::Callback<void(const std::string& error_message)>; + +// If an error occurred during removal, |error_message| will be set to an error +// message. +using RemoveCertificateCallback = + base::Callback<void(const std::string& error_message)>; + +// If the list of available tokens could be successfully retrieved, |token_ids| +// will contain the token ids. If an error occurs, |token_ids| will be nullptr +// and |error_message| will be set to an error message. +using GetTokensCallback = + base::Callback<void(std::unique_ptr<std::vector<std::string>> token_ids, + const std::string& error_message)>; + +// If token ids have been successfully retrieved, |error_message| will be empty. +// Two cases are possible then: +// If |token_ids| is not empty, |token_ids| has been filled with the identifiers +// of the tokens the private key was found on and the user has access to. +// Currently, valid token identifiers are |kTokenIdUser| and |kTokenIdSystem|. +// If |token_ids| is empty, the private key has not been found on any token the +// user has access to. Note that this is also the case if the key exists on the +// system token, but the current user does not have access to the system token. +// If an error occurred during processing, |token_ids| will be empty and +// |error_message| will be set to an error message. +// TODO(pmarko): This is currently a RepeatingCallback because of +// GetNSSCertDatabaseForResourceContext semantics. +using GetKeyLocationsCallback = + base::RepeatingCallback<void(const std::vector<std::string>& token_ids, + const std::string& error_message)>; + +// Functions of this class shouldn't be called directly from the context of +// an extension. Instead use ExtensionPlatformKeysService which enforces +// restrictions upon extensions. +class PlatformKeysService : public KeyedService { + public: + PlatformKeysService() = default; + PlatformKeysService(const PlatformKeysService&) = delete; + PlatformKeysService& operator=(const PlatformKeysService&) = delete; + ~PlatformKeysService() override = default; + + // Generates a RSA key pair with |modulus_length_bits|. |token_id| specifies + // the token to store the key pair on and can currently be |kTokenIdUser| or + // |kTokenIdSystem|. |callback| will be invoked with the resulting public key + // or an error. + virtual void GenerateRSAKey(const std::string& token_id, + unsigned int modulus_length_bits, + const GenerateKeyCallback& callback) = 0; + + // Generates a EC key pair with |named_curve|. |token_id| specifies the token + // to store the key pair on and can currently be |kTokenIdUser| or + // |kTokenIdSystem|. |callback| will be invoked with the resulting public key + // or an error. + virtual void GenerateECKey(const std::string& token_id, + const std::string& named_curve, + const GenerateKeyCallback& callback) = 0; + + // Digests |data|, applies PKCS1 padding and afterwards signs the data with + // the private key matching |public_key_spki_der|. If a non empty token id is + // provided and the key is not found in that token, the operation aborts. + // |callback| will be invoked with the signature or an error message. + virtual void SignRSAPKCS1Digest(const std::string& token_id, + const std::string& data, + const std::string& public_key_spki_der, + HashAlgorithm hash_algorithm, + const SignCallback& callback) = 0; + + // Applies PKCS1 padding and afterwards signs the data with the private key + // matching |public_key_spki_der|. |data| is not digested. If a non empty + // token id is provided and the key is not found in that token, the operation + // aborts. The size of |data| (number of octets) must be smaller than k - 11, + // where k is the key size in octets. |callback| will be invoked with the + // signature or an error message. + virtual void SignRSAPKCS1Raw(const std::string& token_id, + const std::string& data, + const std::string& public_key_spki_der, + const SignCallback& callback) = 0; + + // Digests |data| and afterwards signs the data with the private key matching + // |public_key_spki_der|. If a non empty token id is provided and the key is + // not found in that token, the operation aborts. |callback| will be invoked + // with the ECDSA signature or an error message. + virtual void SignECDSADigest(const std::string& token_id, + const std::string& data, + const std::string& public_key_spki_der, + HashAlgorithm hash_algorithm, + const SignCallback& callback) = 0; + + // Returns the list of all certificates that were issued by one of the + // |certificate_authorities|. If |certificate_authorities| is empty, all + // certificates will be returned. |callback| will be invoked with the matches + // or an error message. + virtual void SelectClientCertificates( + const std::vector<std::string>& certificate_authorities, + const SelectCertificatesCallback& callback) = 0; + + // Returns the list of all certificates with stored private key available from + // the given token. If an empty |token_id| is provided, all certificates the + // user associated with |browser_context| has access to are listed. Otherwise, + // only certificates from the specified token are listed. |callback| will be + // invoked with the list of available certificates or an error message. + virtual void GetCertificates(const std::string& token_id, + const GetCertificatesCallback& callback) = 0; + + // Imports |certificate| to the given token if the certified key is already + // stored in this token. Any intermediate of |certificate| will be ignored. + // |token_id| specifies the token to store the certificate on and can + // currently be |kTokenIdUser| or |kTokenIdSystem|. The private key must be + // stored on the same token. |callback| will be invoked when the import is + // finished, possibly with an error message. + virtual void ImportCertificate( + const std::string& token_id, + const scoped_refptr<net::X509Certificate>& certificate, + const ImportCertificateCallback& callback) = 0; + + // Removes |certificate| from the given token if present. Any intermediate of + // |certificate| will be ignored. |token_id| specifies the token to remove the + // certificate from and can currently be empty (any token), |kTokenIdUser| or + // |kTokenIdSystem|. |callback| will be invoked when the removal is finished, + // possibly with an error message. + virtual void RemoveCertificate( + const std::string& token_id, + const scoped_refptr<net::X509Certificate>& certificate, + const RemoveCertificateCallback& callback) = 0; + + // Gets the list of available tokens. |callback| will be invoked when the list + // of available tokens is determined, possibly with an error message. + // Must be called and calls |callback| on the UI thread. + virtual void GetTokens(const GetTokensCallback& callback) = 0; + + // Determines the token(s) on which the private key corresponding to + // |public_key_spki_der| is stored. |callback| will be invoked when the token + // ids are determined, possibly with an error message. Must be called and + // calls |callback| on the UI thread. + virtual void GetKeyLocations(const std::string& public_key_spki_der, + const GetKeyLocationsCallback& callback) = 0; +}; + +class PlatformKeysServiceImpl final : public PlatformKeysService { + public: + explicit PlatformKeysServiceImpl(content::BrowserContext* context); + ~PlatformKeysServiceImpl() override; + + // PlatformKeysService + void GenerateRSAKey(const std::string& token_id, + unsigned int modulus_length_bits, + const GenerateKeyCallback& callback) override; + void GenerateECKey(const std::string& token_id, + const std::string& named_curve, + const GenerateKeyCallback& callback) override; + void SignRSAPKCS1Digest(const std::string& token_id, + const std::string& data, + const std::string& public_key_spki_der, + HashAlgorithm hash_algorithm, + const SignCallback& callback) override; + void SignRSAPKCS1Raw(const std::string& token_id, + const std::string& data, + const std::string& public_key_spki_der, + const SignCallback& callback) override; + void SignECDSADigest(const std::string& token_id, + const std::string& data, + const std::string& public_key_spki_der, + HashAlgorithm hash_algorithm, + const SignCallback& callback) override; + void SelectClientCertificates( + const std::vector<std::string>& certificate_authorities, + const SelectCertificatesCallback& callback) override; + void GetCertificates(const std::string& token_id, + const GetCertificatesCallback& callback) override; + void ImportCertificate(const std::string& token_id, + const scoped_refptr<net::X509Certificate>& certificate, + const ImportCertificateCallback& callback) override; + void RemoveCertificate(const std::string& token_id, + const scoped_refptr<net::X509Certificate>& certificate, + const RemoveCertificateCallback& callback) override; + void GetTokens(const GetTokensCallback& callback) override; + void GetKeyLocations(const std::string& public_key_spki_der, + const GetKeyLocationsCallback& callback) override; + + private: + content::BrowserContext* const browser_context_; + base::WeakPtrFactory<PlatformKeysServiceImpl> weak_factory_{this}; +}; + +} // namespace platform_keys +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_service_factory.cc b/chrome/browser/chromeos/platform_keys/platform_keys_service_factory.cc new file mode 100644 index 0000000..796ee5b --- /dev/null +++ b/chrome/browser/chromeos/platform_keys/platform_keys_service_factory.cc
@@ -0,0 +1,45 @@ +// 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/platform_keys/platform_keys_service_factory.h" + +#include "base/memory/singleton.h" +#include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" +#include "chrome/browser/profiles/incognito_helpers.h" +#include "components/keyed_service/content/browser_context_dependency_manager.h" + +namespace chromeos { +namespace platform_keys { + +// static +PlatformKeysService* PlatformKeysServiceFactory::GetForBrowserContext( + content::BrowserContext* context) { + return static_cast<PlatformKeysService*>( + GetInstance()->GetServiceForBrowserContext(context, true)); +} + +// static +PlatformKeysServiceFactory* PlatformKeysServiceFactory::GetInstance() { + return base::Singleton<PlatformKeysServiceFactory>::get(); +} + +PlatformKeysServiceFactory::PlatformKeysServiceFactory() + : BrowserContextKeyedServiceFactory( + "PlatformKeysService", + BrowserContextDependencyManager::GetInstance()) {} + +PlatformKeysServiceFactory::~PlatformKeysServiceFactory() = default; + +KeyedService* PlatformKeysServiceFactory::BuildServiceInstanceFor( + content::BrowserContext* context) const { + return new PlatformKeysServiceImpl(context); +} + +content::BrowserContext* PlatformKeysServiceFactory::GetBrowserContextToUse( + content::BrowserContext* context) const { + return chrome::GetBrowserContextRedirectedInIncognito(context); +} + +} // namespace platform_keys +} // namespace chromeos
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_service_factory.h b/chrome/browser/chromeos/platform_keys/platform_keys_service_factory.h new file mode 100644 index 0000000..bd2902a --- /dev/null +++ b/chrome/browser/chromeos/platform_keys/platform_keys_service_factory.h
@@ -0,0 +1,46 @@ +// 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_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_FACTORY_H_ +#define CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_FACTORY_H_ + +#include "components/keyed_service/content/browser_context_keyed_service_factory.h" + +namespace base { +template <typename T> +struct DefaultSingletonTraits; +} // namespace base + +namespace chromeos { +namespace platform_keys { + +class PlatformKeysService; + +// Factory to create PlatformKeysService. +class PlatformKeysServiceFactory : public BrowserContextKeyedServiceFactory { + public: + static PlatformKeysService* GetForBrowserContext( + content::BrowserContext* context); + + static PlatformKeysServiceFactory* GetInstance(); + + private: + friend struct base::DefaultSingletonTraits<PlatformKeysServiceFactory>; + + PlatformKeysServiceFactory(); + PlatformKeysServiceFactory(const PlatformKeysServiceFactory&) = delete; + PlatformKeysServiceFactory& operator=(const PlatformKeysServiceFactory&) = + delete; + ~PlatformKeysServiceFactory() override; + + // BrowserContextKeyedServiceFactory: + content::BrowserContext* GetBrowserContextToUse( + content::BrowserContext* context) const override; + KeyedService* BuildServiceInstanceFor( + content::BrowserContext* context) const override; +}; +} // namespace platform_keys +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_FACTORY_H_
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc b/chrome/browser/chromeos/platform_keys/platform_keys_service_nss.cc similarity index 79% rename from chrome/browser/chromeos/platform_keys/platform_keys_nss.cc rename to chrome/browser/chromeos/platform_keys/platform_keys_service_nss.cc index 9e6f3cb2..4d99a1d2 100644 --- a/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc +++ b/chrome/browser/chromeos/platform_keys/platform_keys_service_nss.cc
@@ -1,7 +1,9 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// 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/platform_keys/platform_keys_service.h" + #include <cert.h> #include <cryptohi.h> #include <keyhi.h> @@ -26,7 +28,6 @@ #include "chrome/browser/browser_process_platform_part_chromeos.h" #include "chrome/browser/chromeos/certificate_provider/certificate_provider.h" #include "chrome/browser/chromeos/net/client_cert_store_chromeos.h" -#include "chrome/browser/chromeos/platform_keys/platform_keys.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h" #include "chrome/browser/net/nss_context.h" @@ -63,29 +64,39 @@ // The current maximal RSA modulus length that ChromeOS's TPM supports for key // generation. const unsigned int kMaxRSAModulusLengthBits = 2048; -} +} // namespace namespace chromeos { - namespace platform_keys { namespace { +using ServiceWeakPtr = base::WeakPtr<PlatformKeysServiceImpl>; + // Base class to store state that is common to all NSS database operations and // to provide convenience methods to call back. // Keeps track of the originating task runner. class NSSOperationState { public: - NSSOperationState(); - virtual ~NSSOperationState() {} + explicit NSSOperationState(ServiceWeakPtr weak_ptr); + virtual ~NSSOperationState() = default; // Called if an error occurred during the execution of the NSS operation // described by this object. virtual void OnError(const base::Location& from, const std::string& error_message) = 0; + static void RunCallback(base::OnceClosure callback, ServiceWeakPtr weak_ptr) { + if (weak_ptr) { + std::move(callback).Run(); + } + } + crypto::ScopedPK11Slot slot_; + // Weak pointer to the PlatformKeysServiceImpl that created this state. Used + // to check if the callback should be still called. + ServiceWeakPtr service_weak_ptr_; // The task runner on which the NSS operation was called. Any reply must be // posted to this runner. scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner_; @@ -94,7 +105,7 @@ DISALLOW_COPY_AND_ASSIGN(NSSOperationState); }; -typedef base::Callback<void(net::NSSCertDatabase* cert_db)> GetCertDBCallback; +using GetCertDBCallback = base::Callback<void(net::NSSCertDatabase* cert_db)>; // Used by GetCertDatabaseOnIOThread and called back with the requested // NSSCertDatabase. @@ -156,9 +167,10 @@ class GenerateRSAKeyState : public NSSOperationState { public: - GenerateRSAKeyState(unsigned int modulus_length_bits, - const subtle::GenerateKeyCallback& callback); - ~GenerateRSAKeyState() override {} + GenerateRSAKeyState(ServiceWeakPtr weak_ptr, + unsigned int modulus_length_bits, + const GenerateKeyCallback& callback); + ~GenerateRSAKeyState() override = default; void OnError(const base::Location& from, const std::string& error_message) override { @@ -168,22 +180,26 @@ void CallBack(const base::Location& from, const std::string& public_key_spki_der, const std::string& error_message) { + auto bound_callback = + base::BindOnce(callback_, public_key_spki_der, error_message); origin_task_runner_->PostTask( - from, base::Bind(callback_, public_key_spki_der, error_message)); + from, base::BindOnce(&NSSOperationState::RunCallback, + std::move(bound_callback), service_weak_ptr_)); } const unsigned int modulus_length_bits_; private: // Must be called on origin thread, therefore use CallBack(). - subtle::GenerateKeyCallback callback_; + GenerateKeyCallback callback_; }; class GenerateECKeyState : public NSSOperationState { public: - GenerateECKeyState(const std::string& named_curve, - const subtle::GenerateKeyCallback& callback); - ~GenerateECKeyState() override {} + GenerateECKeyState(ServiceWeakPtr weak_ptr, + const std::string& named_curve, + const GenerateKeyCallback& callback); + ~GenerateECKeyState() override = default; void OnError(const base::Location& from, const std::string& error_message) override { @@ -193,26 +209,30 @@ void CallBack(const base::Location& from, const std::string& public_key_spki_der, const std::string& error_message) { + auto bound_callback = + base::BindOnce(callback_, public_key_spki_der, error_message); origin_task_runner_->PostTask( - from, base::Bind(callback_, public_key_spki_der, error_message)); + from, base::BindOnce(&NSSOperationState::RunCallback, + std::move(bound_callback), service_weak_ptr_)); } const std::string named_curve_; private: // Must be called on origin thread, therefore use CallBack(). - subtle::GenerateKeyCallback callback_; + GenerateKeyCallback callback_; }; class SignState : public NSSOperationState { public: - SignState(const std::string& data, + 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, - const subtle::SignCallback& callback); - ~SignState() override {} + const SignCallback& callback); + ~SignState() override = default; void OnError(const base::Location& from, const std::string& error_message) override { @@ -222,8 +242,10 @@ void CallBack(const base::Location& from, const std::string& signature, const std::string& error_message) { + auto bound_callback = base::BindOnce(callback_, signature, error_message); origin_task_runner_->PostTask( - from, base::Bind(callback_, signature, error_message)); + from, base::BindOnce(&NSSOperationState::RunCallback, + std::move(bound_callback), service_weak_ptr_)); } crypto::ScopedSECKEYPrivateKey GetPrivateKey() { @@ -259,15 +281,16 @@ private: // Must be called on origin thread, therefore use CallBack(). - subtle::SignCallback callback_; + SignCallback callback_; }; class SelectCertificatesState : public NSSOperationState { public: explicit SelectCertificatesState( + ServiceWeakPtr weak_ptr, const scoped_refptr<net::SSLCertRequestInfo>& request, - const subtle::SelectCertificatesCallback& callback); - ~SelectCertificatesState() override {} + const SelectCertificatesCallback& callback); + ~SelectCertificatesState() override = default; void OnError(const base::Location& from, const std::string& error_message) override { @@ -278,8 +301,11 @@ void CallBack(const base::Location& from, std::unique_ptr<net::CertificateList> matches, const std::string& error_message) { + auto bound_callback = + base::BindOnce(callback_, base::Passed(&matches), error_message); origin_task_runner_->PostTask( - from, base::Bind(callback_, base::Passed(&matches), error_message)); + from, base::BindOnce(&NSSOperationState::RunCallback, + std::move(bound_callback), service_weak_ptr_)); } scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; @@ -287,13 +313,14 @@ private: // Must be called on origin thread, therefore use CallBack(). - subtle::SelectCertificatesCallback callback_; + SelectCertificatesCallback callback_; }; class GetCertificatesState : public NSSOperationState { public: - explicit GetCertificatesState(const GetCertificatesCallback& callback); - ~GetCertificatesState() override {} + explicit GetCertificatesState(ServiceWeakPtr weak_ptr, + const GetCertificatesCallback& callback); + ~GetCertificatesState() override = default; void OnError(const base::Location& from, const std::string& error_message) override { @@ -305,8 +332,11 @@ void CallBack(const base::Location& from, std::unique_ptr<net::CertificateList> certs, const std::string& error_message) { + auto bound_callback = + base::BindOnce(callback_, base::Passed(&certs), error_message); origin_task_runner_->PostTask( - from, base::Bind(callback_, base::Passed(&certs), error_message)); + from, base::BindOnce(&NSSOperationState::RunCallback, + std::move(bound_callback), service_weak_ptr_)); } net::ScopedCERTCertificateList certs_; @@ -318,9 +348,10 @@ class ImportCertificateState : public NSSOperationState { public: - ImportCertificateState(const scoped_refptr<net::X509Certificate>& certificate, + ImportCertificateState(ServiceWeakPtr weak_ptr, + const scoped_refptr<net::X509Certificate>& certificate, const ImportCertificateCallback& callback); - ~ImportCertificateState() override {} + ~ImportCertificateState() override = default; void OnError(const base::Location& from, const std::string& error_message) override { @@ -328,7 +359,10 @@ } void CallBack(const base::Location& from, const std::string& error_message) { - origin_task_runner_->PostTask(from, base::Bind(callback_, error_message)); + auto bound_callback = base::BindOnce(callback_, error_message); + origin_task_runner_->PostTask( + from, base::BindOnce(&NSSOperationState::RunCallback, + std::move(bound_callback), service_weak_ptr_)); } scoped_refptr<net::X509Certificate> certificate_; @@ -340,9 +374,10 @@ class RemoveCertificateState : public NSSOperationState { public: - RemoveCertificateState(const scoped_refptr<net::X509Certificate>& certificate, + RemoveCertificateState(ServiceWeakPtr weak_ptr, + const scoped_refptr<net::X509Certificate>& certificate, const RemoveCertificateCallback& callback); - ~RemoveCertificateState() override {} + ~RemoveCertificateState() override = default; void OnError(const base::Location& from, const std::string& error_message) override { @@ -350,7 +385,10 @@ } void CallBack(const base::Location& from, const std::string& error_message) { - origin_task_runner_->PostTask(from, base::Bind(callback_, error_message)); + auto bound_callback = base::BindOnce(callback_, error_message); + origin_task_runner_->PostTask( + from, base::BindOnce(&NSSOperationState::RunCallback, + std::move(bound_callback), service_weak_ptr_)); } scoped_refptr<net::X509Certificate> certificate_; @@ -362,8 +400,9 @@ class GetTokensState : public NSSOperationState { public: - explicit GetTokensState(const GetTokensCallback& callback); - ~GetTokensState() override {} + explicit GetTokensState(ServiceWeakPtr weak_ptr, + const GetTokensCallback& callback); + ~GetTokensState() override = default; void OnError(const base::Location& from, const std::string& error_message) override { @@ -375,8 +414,11 @@ void CallBack(const base::Location& from, std::unique_ptr<std::vector<std::string>> token_ids, const std::string& error_message) { + auto bound_callback = + base::BindOnce(callback_, base::Passed(&token_ids), error_message); origin_task_runner_->PostTask( - from, base::Bind(callback_, base::Passed(&token_ids), error_message)); + from, base::BindOnce(&NSSOperationState::RunCallback, + std::move(bound_callback), service_weak_ptr_)); } private: @@ -386,9 +428,10 @@ class GetKeyLocationsState : public NSSOperationState { public: - GetKeyLocationsState(const std::string& public_key_spki_der, + GetKeyLocationsState(ServiceWeakPtr weak_ptr, + const std::string& public_key_spki_der, const GetKeyLocationsCallback& callback); - ~GetKeyLocationsState() override {} + ~GetKeyLocationsState() override = default; void OnError(const base::Location& from, const std::string& error_message) override { @@ -398,8 +441,10 @@ void CallBack(const base::Location& from, const std::vector<std::string>& token_ids, const std::string& error_message) { + auto bound_callback = base::BindOnce(callback_, token_ids, error_message); origin_task_runner_->PostTask( - from, base::BindOnce(callback_, token_ids, error_message)); + from, base::BindOnce(&NSSOperationState::RunCallback, + std::move(bound_callback), service_weak_ptr_)); } // Must be a DER encoding of a SubjectPublicKeyInfo. @@ -410,26 +455,33 @@ GetKeyLocationsCallback callback_; }; -NSSOperationState::NSSOperationState() - : origin_task_runner_(base::ThreadTaskRunnerHandle::Get()) {} +NSSOperationState::NSSOperationState(ServiceWeakPtr weak_ptr) + : service_weak_ptr_(weak_ptr), + origin_task_runner_(base::ThreadTaskRunnerHandle::Get()) {} -GenerateRSAKeyState::GenerateRSAKeyState( - unsigned int modulus_length_bits, - const subtle::GenerateKeyCallback& callback) - : modulus_length_bits_(modulus_length_bits), callback_(callback) {} +GenerateRSAKeyState::GenerateRSAKeyState(ServiceWeakPtr weak_ptr, + unsigned int modulus_length_bits, + const GenerateKeyCallback& callback) + : NSSOperationState(weak_ptr), + modulus_length_bits_(modulus_length_bits), + callback_(callback) {} -GenerateECKeyState::GenerateECKeyState( - const std::string& named_curve, - const subtle::GenerateKeyCallback& callback) - : named_curve_(named_curve), callback_(callback) {} +GenerateECKeyState::GenerateECKeyState(ServiceWeakPtr weak_ptr, + const std::string& named_curve, + const GenerateKeyCallback& callback) + : NSSOperationState(weak_ptr), + named_curve_(named_curve), + callback_(callback) {} -SignState::SignState(const std::string& data, +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, - const subtle::SignCallback& callback) - : data_(data), + const SignCallback& callback) + : NSSOperationState(weak_ptr), + data_(data), public_key_spki_der_(public_key_spki_der), raw_pkcs1_(raw_pkcs1), hash_algorithm_(hash_algorithm), @@ -437,35 +489,45 @@ callback_(callback) {} SelectCertificatesState::SelectCertificatesState( + ServiceWeakPtr weak_ptr, const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, - const subtle::SelectCertificatesCallback& callback) - : cert_request_info_(cert_request_info), callback_(callback) {} + const SelectCertificatesCallback& callback) + : NSSOperationState(weak_ptr), + cert_request_info_(cert_request_info), + callback_(callback) {} GetCertificatesState::GetCertificatesState( + ServiceWeakPtr weak_ptr, const GetCertificatesCallback& callback) - : callback_(callback) { -} + : NSSOperationState(weak_ptr), callback_(callback) {} ImportCertificateState::ImportCertificateState( + ServiceWeakPtr weak_ptr, const scoped_refptr<net::X509Certificate>& certificate, const ImportCertificateCallback& callback) - : certificate_(certificate), callback_(callback) { -} + : NSSOperationState(weak_ptr), + certificate_(certificate), + callback_(callback) {} RemoveCertificateState::RemoveCertificateState( + ServiceWeakPtr weak_ptr, const scoped_refptr<net::X509Certificate>& certificate, const RemoveCertificateCallback& callback) - : certificate_(certificate), callback_(callback) { -} + : NSSOperationState(weak_ptr), + certificate_(certificate), + callback_(callback) {} -GetTokensState::GetTokensState(const GetTokensCallback& callback) - : callback_(callback) { -} +GetTokensState::GetTokensState(ServiceWeakPtr weak_ptr, + const GetTokensCallback& callback) + : NSSOperationState(weak_ptr), callback_(callback) {} GetKeyLocationsState::GetKeyLocationsState( + ServiceWeakPtr weak_ptr, const std::string& public_key_spki_der, const GetKeyLocationsCallback& callback) - : public_key_spki_der_(public_key_spki_der), callback_(callback) {} + : NSSOperationState(weak_ptr), + public_key_spki_der_(public_key_spki_der), + callback_(callback) {} // Does the actual RSA key generation on a worker thread. Used by // GenerateRSAKeyWithDB(). @@ -748,8 +810,8 @@ it != state->certs_.end(); ++it) { CERTCertificate* cert_handle = it->get(); crypto::ScopedPK11Slot cert_slot(PK11_KeyForCertExists(cert_handle, - NULL, // keyPtr - NULL)); // wincx + nullptr, // keyPtr + nullptr)); // wincx // Keep only user certificates, i.e. certs for which the private key is // present and stored in the queried slot. @@ -823,7 +885,7 @@ // Check that the private key is in the correct slot. crypto::ScopedPK11Slot slot( - PK11_KeyForCertExists(nss_cert.get(), NULL, NULL)); + PK11_KeyForCertExists(nss_cert.get(), nullptr, nullptr)); if (slot.get() != state->slot_.get()) { state->OnError(FROM_HERE, kErrorKeyNotFound); return; @@ -935,15 +997,13 @@ } // namespace -namespace subtle { - -void GenerateRSAKey(const std::string& token_id, - unsigned int modulus_length_bits, - const GenerateKeyCallback& callback, - BrowserContext* browser_context) { +void PlatformKeysServiceImpl::GenerateRSAKey( + const std::string& token_id, + unsigned int modulus_length_bits, + const GenerateKeyCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - auto state = - std::make_unique<GenerateRSAKeyState>(modulus_length_bits, callback); + auto state = std::make_unique<GenerateRSAKeyState>( + weak_factory_.GetWeakPtr(), modulus_length_bits, callback); if (modulus_length_bits > kMaxRSAModulusLengthBits) { state->OnError(FROM_HERE, kErrorAlgorithmNotSupported); @@ -954,32 +1014,33 @@ NSSOperationState* state_ptr = state.get(); GetCertDatabase(token_id, base::Bind(&GenerateRSAKeyWithDB, base::Passed(&state)), - browser_context, state_ptr); + browser_context_, state_ptr); } -void GenerateECKey(const std::string& token_id, - const std::string& named_curve, - const GenerateKeyCallback& callback, - BrowserContext* browser_context) { +void PlatformKeysServiceImpl::GenerateECKey( + const std::string& token_id, + const std::string& named_curve, + const GenerateKeyCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - auto state = std::make_unique<GenerateECKeyState>(named_curve, callback); + auto state = std::make_unique<GenerateECKeyState>(weak_factory_.GetWeakPtr(), + named_curve, callback); // Get the pointer to |state| before base::Passed releases |state|. NSSOperationState* state_ptr = state.get(); GetCertDatabase(token_id, base::Bind(&GenerateECKeyWithDB, base::Passed(&state)), - browser_context, state_ptr); + browser_context_, state_ptr); } -void SignRSAPKCS1Digest(const std::string& token_id, - const std::string& data, - const std::string& public_key_spki_der, - HashAlgorithm hash_algorithm, - const SignCallback& callback, - content::BrowserContext* browser_context) { +void PlatformKeysServiceImpl::SignRSAPKCS1Digest( + const std::string& token_id, + const std::string& data, + const std::string& public_key_spki_der, + HashAlgorithm hash_algorithm, + const SignCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); auto state = std::make_unique<SignState>( - data, public_key_spki_der, + weak_factory_.GetWeakPtr(), data, public_key_spki_der, /*raw_pkcs1=*/false, hash_algorithm, /*key_type=*/KeyType::kRsassaPkcs1V15, callback); @@ -990,17 +1051,17 @@ // we would get more informative error messages and we can double check that // we use a key of the correct token. GetCertDatabase(token_id, base::Bind(&SignWithDB, base::Passed(&state)), - browser_context, state_ptr); + browser_context_, state_ptr); } -void SignRSAPKCS1Raw(const std::string& token_id, - const std::string& data, - const std::string& public_key_spki_der, - const SignCallback& callback, - content::BrowserContext* browser_context) { +void PlatformKeysServiceImpl::SignRSAPKCS1Raw( + const std::string& token_id, + const std::string& data, + const std::string& public_key_spki_der, + const SignCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); auto state = std::make_unique<SignState>( - data, public_key_spki_der, + weak_factory_.GetWeakPtr(), data, public_key_spki_der, /*raw_pkcs1=*/true, HASH_ALGORITHM_NONE, /*key_type=*/KeyType::kRsassaPkcs1V15, callback); @@ -1011,20 +1072,20 @@ // we would get more informative error messages and we can double check that // we use a key of the correct token. GetCertDatabase(token_id, base::Bind(&SignWithDB, base::Passed(&state)), - browser_context, state_ptr); + browser_context_, state_ptr); } -void SignECDSADigest(const std::string& token_id, - const std::string& data, - const std::string& public_key_spki_der, - HashAlgorithm hash_algorithm, - const SignCallback& callback, - content::BrowserContext* browser_context) { +void PlatformKeysServiceImpl::SignECDSADigest( + const std::string& token_id, + const std::string& data, + const std::string& public_key_spki_der, + HashAlgorithm hash_algorithm, + const SignCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - auto state = - std::make_unique<SignState>(data, public_key_spki_der, - /*raw_pkcs1=*/false, hash_algorithm, - /*key_type=*/KeyType::kEcdsa, callback); + auto state = std::make_unique<SignState>( + weak_factory_.GetWeakPtr(), data, public_key_spki_der, + /*raw_pkcs1=*/false, hash_algorithm, + /*key_type=*/KeyType::kEcdsa, callback); // Get the pointer to |state| before base::Passed releases |state|. NSSOperationState* state_ptr = state.get(); @@ -1033,13 +1094,12 @@ // we would get more informative error messages and we can double check that // we use a key of the correct token. GetCertDatabase(token_id, base::Bind(&SignWithDB, base::Passed(&state)), - browser_context, state_ptr); + browser_context_, state_ptr); } -void SelectClientCertificates( +void PlatformKeysServiceImpl::SelectClientCertificates( const std::vector<std::string>& certificate_authorities, - const SelectCertificatesCallback& callback, - content::BrowserContext* browser_context) { + const SelectCertificatesCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); auto cert_request_info = base::MakeRefCounted<net::SSLCertRequestInfo>(); @@ -1052,14 +1112,14 @@ const user_manager::User* user = chromeos::ProfileHelper::Get()->GetUserByProfile( - Profile::FromBrowserContext(browser_context)); + Profile::FromBrowserContext(browser_context_)); // Use the device-wide system key slot only if the user is affiliated on the // device. const bool use_system_key_slot = user->IsAffiliated(); - auto state = - std::make_unique<SelectCertificatesState>(cert_request_info, callback); + auto state = std::make_unique<SelectCertificatesState>( + weak_factory_.GetWeakPtr(), cert_request_info, callback); state->cert_store_ = std::make_unique<ClientCertStoreChromeOS>( nullptr, // no additional provider @@ -1073,8 +1133,6 @@ base::BindOnce(&DidSelectCertificates, std::move(state))); } -} // namespace subtle - std::string GetSubjectPublicKeyInfo( const scoped_refptr<net::X509Certificate>& certificate) { base::StringPiece spki_bytes; @@ -1130,24 +1188,26 @@ return true; } -void GetCertificates(const std::string& token_id, - const GetCertificatesCallback& callback, - BrowserContext* browser_context) { +void PlatformKeysServiceImpl::GetCertificates( + const std::string& token_id, + const GetCertificatesCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - auto state = std::make_unique<GetCertificatesState>(callback); + auto state = std::make_unique<GetCertificatesState>( + weak_factory_.GetWeakPtr(), callback); // Get the pointer to |state| before base::Passed releases |state|. NSSOperationState* state_ptr = state.get(); GetCertDatabase(token_id, base::Bind(&GetCertificatesWithDB, base::Passed(&state)), - browser_context, state_ptr); + browser_context_, state_ptr); } -void ImportCertificate(const std::string& token_id, - const scoped_refptr<net::X509Certificate>& certificate, - const ImportCertificateCallback& callback, - BrowserContext* browser_context) { +void PlatformKeysServiceImpl::ImportCertificate( + const std::string& token_id, + const scoped_refptr<net::X509Certificate>& certificate, + const ImportCertificateCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - auto state = std::make_unique<ImportCertificateState>(certificate, callback); + auto state = std::make_unique<ImportCertificateState>( + weak_factory_.GetWeakPtr(), certificate, callback); // Get the pointer to |state| before base::Passed releases |state|. NSSOperationState* state_ptr = state.get(); @@ -1156,15 +1216,16 @@ // we use a key of the correct token. GetCertDatabase(token_id, base::Bind(&ImportCertificateWithDB, base::Passed(&state)), - browser_context, state_ptr); + browser_context_, state_ptr); } -void RemoveCertificate(const std::string& token_id, - const scoped_refptr<net::X509Certificate>& certificate, - const RemoveCertificateCallback& callback, - BrowserContext* browser_context) { +void PlatformKeysServiceImpl::RemoveCertificate( + const std::string& token_id, + const scoped_refptr<net::X509Certificate>& certificate, + const RemoveCertificateCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - auto state = std::make_unique<RemoveCertificateState>(certificate, callback); + auto state = std::make_unique<RemoveCertificateState>( + weak_factory_.GetWeakPtr(), certificate, callback); // Get the pointer to |state| before base::Passed releases |state|. NSSOperationState* state_ptr = state.get(); @@ -1172,34 +1233,33 @@ // we would get more informative error messages. GetCertDatabase(token_id, base::Bind(&RemoveCertificateWithDB, base::Passed(&state)), - browser_context, state_ptr); + browser_context_, state_ptr); } -void GetTokens(const GetTokensCallback& callback, - content::BrowserContext* browser_context) { +void PlatformKeysServiceImpl::GetTokens(const GetTokensCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - auto state = std::make_unique<GetTokensState>(callback); + auto state = + std::make_unique<GetTokensState>(weak_factory_.GetWeakPtr(), callback); // Get the pointer to |state| before base::Passed releases |state|. NSSOperationState* state_ptr = state.get(); GetCertDatabase(std::string() /* don't get any specific slot */, base::Bind(&GetTokensWithDB, base::Passed(&state)), - browser_context, state_ptr); + browser_context_, state_ptr); } -void GetKeyLocations(const std::string& public_key_spki_der, - const GetKeyLocationsCallback& callback, - content::BrowserContext* browser_context) { +void PlatformKeysServiceImpl::GetKeyLocations( + const std::string& public_key_spki_der, + const GetKeyLocationsCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - auto state = - std::make_unique<GetKeyLocationsState>(public_key_spki_der, callback); + auto state = std::make_unique<GetKeyLocationsState>( + weak_factory_.GetWeakPtr(), public_key_spki_der, callback); NSSOperationState* state_ptr = state.get(); GetCertDatabase( std::string() /* don't get any specific slot - we need all slots */, base::BindRepeating(&GetKeyLocationsWithDB, base::Passed(&state)), - browser_context, state_ptr); + browser_context_, state_ptr); } } // namespace platform_keys - } // namespace chromeos
diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc index 69293f91..77b07b5 100644 --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc
@@ -2415,7 +2415,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsPolicyTest, OpenBlackListedDevTools) { base::ListValue blacklist; - blacklist.AppendString("chrome-devtools://*"); + blacklist.AppendString("devtools://*"); policy::PolicyMap policies; policies.Set(policy::key::kURLBlacklist, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD,
diff --git a/chrome/browser/downgrade/snapshot_file_collector.cc b/chrome/browser/downgrade/snapshot_file_collector.cc index daec8b2..892c5a10 100644 --- a/chrome/browser/downgrade/snapshot_file_collector.cc +++ b/chrome/browser/downgrade/snapshot_file_collector.cc
@@ -7,6 +7,7 @@ #include <utility> #include "build/build_config.h" +#include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" #include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/common/chrome_constants.h" #include "components/autofill/core/browser/payments/strike_database.h" @@ -15,6 +16,7 @@ #include "components/password_manager/core/browser/password_manager_constants.h" #include "components/sessions/core/session_constants.h" #include "components/webdata/common/webdata_constants.h" +#include "content/public/browser/browsing_data_remover.h" #if defined(OS_WIN) #include "chrome/browser/profiles/profile_shortcut_manager_win.h" @@ -24,74 +26,106 @@ namespace downgrade { SnapshotItemDetails::SnapshotItemDetails(base::FilePath path, - ItemType item_type) - : path(std::move(path)), is_directory(item_type == ItemType::kDirectory) {} + ItemType item_type, + int data_types) + : path(std::move(path)), + is_directory(item_type == ItemType::kDirectory), + data_types(data_types) {} // Returns a list of items to snapshot that should be directly under the user // data directory. -std::vector<SnapshotItemDetails> CollectUserDataItems(uint16_t version) { +std::vector<SnapshotItemDetails> CollectUserDataItems() { std::vector<SnapshotItemDetails> user_data_items{ SnapshotItemDetails(base::FilePath(chrome::kLocalStateFilename), - SnapshotItemDetails::ItemType::kDirectory), + SnapshotItemDetails::ItemType::kFile, 0), SnapshotItemDetails(base::FilePath(profiles::kHighResAvatarFolderName), - SnapshotItemDetails::ItemType::kDirectory)}; + SnapshotItemDetails::ItemType::kDirectory, 0)}; #if defined(OS_WIN) - user_data_items.emplace_back( - SnapshotItemDetails(base::FilePath(web_app::kLastBrowserFile), - SnapshotItemDetails::ItemType::kFile)); + user_data_items.emplace_back(base::FilePath(web_app::kLastBrowserFile), + SnapshotItemDetails::ItemType::kFile, 0); #endif // defined(OS_WIN) return user_data_items; } // Returns a list of items to snapshot that should be under a profile directory. -std::vector<SnapshotItemDetails> CollectProfileItems(uint16_t version) { +std::vector<SnapshotItemDetails> CollectProfileItems() { + // Data mask to delete the pref files if any of the following types is + // deleted. When cookies are deleted, the kZeroSuggestCachedResults pref has + // to be reset. When history and isolated origins are deleted, the + // kPrefLastLaunchTime and kUserTriggeredIsolatedOrigins prefs have to be + // reset. When data type content is deleted, blacklisted sites are deleted + // from the translation prefs. + int pref_data_type = + content::BrowsingDataRemover::DATA_TYPE_COOKIES | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_ISOLATED_ORIGINS | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_CONTENT_SETTINGS; std::vector<SnapshotItemDetails> profile_items{ // General Profile files SnapshotItemDetails(base::FilePath(chrome::kPreferencesFilename), - SnapshotItemDetails::ItemType::kFile), + SnapshotItemDetails::ItemType::kFile, pref_data_type), SnapshotItemDetails(base::FilePath(chrome::kSecurePreferencesFilename), - SnapshotItemDetails::ItemType::kFile), + SnapshotItemDetails::ItemType::kFile, pref_data_type), // History files SnapshotItemDetails(base::FilePath(history::kHistoryFilename), - SnapshotItemDetails::ItemType::kFile), + SnapshotItemDetails::ItemType::kFile, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY), SnapshotItemDetails(base::FilePath(history::kFaviconsFilename), - SnapshotItemDetails::ItemType::kFile), + SnapshotItemDetails::ItemType::kFile, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY), SnapshotItemDetails(base::FilePath(history::kTopSitesFilename), - SnapshotItemDetails::ItemType::kFile), + SnapshotItemDetails::ItemType::kFile, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY), // Bookmarks - SnapshotItemDetails(base::FilePath(bookmarks::kBookmarksFileName), - SnapshotItemDetails::ItemType::kFile), + SnapshotItemDetails( + base::FilePath(bookmarks::kBookmarksFileName), + SnapshotItemDetails::ItemType::kFile, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_BOOKMARKS), // Tab Restore and sessions SnapshotItemDetails(base::FilePath(sessions::kCurrentTabSessionFileName), - SnapshotItemDetails::ItemType::kFile), + SnapshotItemDetails::ItemType::kFile, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY), SnapshotItemDetails(base::FilePath(sessions::kCurrentSessionFileName), - SnapshotItemDetails::ItemType::kFile), + SnapshotItemDetails::ItemType::kFile, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY), // Sign-in state SnapshotItemDetails(base::FilePath(profiles::kGAIAPictureFileName), - SnapshotItemDetails::ItemType::kFile), + SnapshotItemDetails::ItemType::kFile, 0), // Password / Autofill SnapshotItemDetails( base::FilePath(password_manager::kAffiliationDatabaseFileName), - SnapshotItemDetails::ItemType::kFile), + SnapshotItemDetails::ItemType::kFile, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA), SnapshotItemDetails( base::FilePath(password_manager::kLoginDataForProfileFileName), - SnapshotItemDetails::ItemType::kFile), + SnapshotItemDetails::ItemType::kFile, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA), SnapshotItemDetails( base::FilePath(password_manager::kLoginDataForAccountFileName), - SnapshotItemDetails::ItemType::kFile), - SnapshotItemDetails(base::FilePath(kWebDataFilename), - SnapshotItemDetails::ItemType::kFile), - SnapshotItemDetails(base::FilePath(autofill::kStrikeDatabaseFileName), - SnapshotItemDetails::ItemType::kFile), + SnapshotItemDetails::ItemType::kFile, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA), + SnapshotItemDetails( + base::FilePath(kWebDataFilename), + SnapshotItemDetails::ItemType::kFile, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA), + SnapshotItemDetails( + base::FilePath(autofill::kStrikeDatabaseFileName), + SnapshotItemDetails::ItemType::kFile, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA), // Cookies SnapshotItemDetails(base::FilePath(chrome::kCookieFilename), - SnapshotItemDetails::ItemType::kFile)}; + SnapshotItemDetails::ItemType::kFile, + content::BrowsingDataRemover::DATA_TYPE_COOKIES)}; #if defined(OS_WIN) // Sign-in state - profile_items.emplace_back( - SnapshotItemDetails(base::FilePath(profiles::kProfileIconFileName), - SnapshotItemDetails::ItemType::kFile)); + profile_items.emplace_back(base::FilePath(profiles::kProfileIconFileName), + SnapshotItemDetails::ItemType::kFile, 0); #endif // defined(OS_WIN) return profile_items; }
diff --git a/chrome/browser/downgrade/snapshot_file_collector.h b/chrome/browser/downgrade/snapshot_file_collector.h index a6817875..6d8c8e1 100644 --- a/chrome/browser/downgrade/snapshot_file_collector.h +++ b/chrome/browser/downgrade/snapshot_file_collector.h
@@ -14,18 +14,22 @@ struct SnapshotItemDetails { enum class ItemType { kFile, kDirectory }; - SnapshotItemDetails(base::FilePath path, ItemType type); + SnapshotItemDetails(base::FilePath path, ItemType type, int data_types); ~SnapshotItemDetails() = default; const base::FilePath path; const bool is_directory; + + // Bitfield from ChromeBrowsingDataRemoverDelegate::DataType representing + // the data types affected by this item. + int data_types; }; // Returns a list of items to snapshot that should be directly under the user // data directory. -std::vector<SnapshotItemDetails> CollectUserDataItems(uint16_t version); +std::vector<SnapshotItemDetails> CollectUserDataItems(); // Returns a list of items to snapshot that should be under a profile directory. -std::vector<SnapshotItemDetails> CollectProfileItems(uint16_t version); +std::vector<SnapshotItemDetails> CollectProfileItems(); } // namespace downgrade
diff --git a/chrome/browser/downgrade/snapshot_manager.cc b/chrome/browser/downgrade/snapshot_manager.cc index 768cfcdc..43532f06c 100644 --- a/chrome/browser/downgrade/snapshot_manager.cc +++ b/chrome/browser/downgrade/snapshot_manager.cc
@@ -13,6 +13,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" #include "chrome/browser/downgrade/downgrade_utils.h" #include "chrome/browser/downgrade/snapshot_file_collector.h" #include "chrome/browser/downgrade/user_data_downgrade.h" @@ -154,16 +155,15 @@ SnapshotOperationResult::kFailedToCreateSnapshotDirectory); return; } - const uint16_t milestone = version.components()[0]; // Copy items to be preserved at the top-level of User Data. - for (const auto& file : GetUserSnapshotItemDetails(milestone)) { + for (const auto& file : GetUserSnapshotItemDetails()) { record_success_error( CopyItemToSnapshotDirectory(base::FilePath(file.path), user_data_dir_, snapshot_dir, file.is_directory)); } - auto profile_snapshot_item_details = GetProfileSnapshotItemDetails(milestone); + const auto profile_snapshot_item_details = GetProfileSnapshotItemDetails(); // Copy items to be preserved in each Profile directory. for (const auto& profile_dir : GetUserProfileDirectories(user_data_dir_)) { @@ -324,14 +324,64 @@ } } -std::vector<SnapshotItemDetails> SnapshotManager::GetProfileSnapshotItemDetails( - uint16_t milestone) const { - return CollectProfileItems(milestone); +void SnapshotManager::DeleteSnapshotDataForProfile( + base::Time delete_begin, + const base::FilePath& profile_base_name, + int remove_mask) { + using DataType = ChromeBrowsingDataRemoverDelegate; + + bool delete_all = + (((remove_mask & DataType::WIPE_PROFILE) == DataType::WIPE_PROFILE) || + ((remove_mask & DataType::ALL_DATA_TYPES) == + DataType::ALL_DATA_TYPES)) && + delete_begin.is_null(); + std::vector<base::FilePath> files_to_delete; + if (!delete_all) { + for (const auto& item : CollectProfileItems()) { + if (item.data_types & remove_mask) + files_to_delete.push_back(item.path); + } + } + + if (!delete_all && files_to_delete.empty()) + return; + + const auto snapshot_dir = user_data_dir_.Append(kSnapshotsDir); + auto available_snapshots = GetAvailableSnapshots(snapshot_dir); + + base::File::Info file_info; + for (const auto& snapshot : available_snapshots) { + auto snapshot_path = snapshot_dir.AppendASCII(snapshot.GetString()); + // If we are not able to get the file info, it probably has been deleted. + if (!base::GetFileInfo(snapshot_path, &file_info)) + continue; + auto profile_absolute_path = snapshot_path.Append(profile_base_name); + // Deletes the whole profile from the snapshots if it is being wiped + // regardless of |delete_begin|, otherwise deletes the required files from + // the snapshot if it was created after |delete_begin|. + if (delete_all) { + base::DeleteFile(profile_absolute_path, /*recursive=*/true); + } else if (delete_begin <= file_info.creation_time && + base::PathExists(profile_absolute_path)) { + for (const auto& filename : files_to_delete) { + base::DeleteFile(profile_absolute_path.Append(filename), + /*recursive=*/true); + } + // Non recursive deletion will fail if the directory is not empty. In this + // case we only want to delete the directory if it is empty. + base::DeleteFile(profile_absolute_path, /*recursive=*/false); + } + } } -std::vector<SnapshotItemDetails> SnapshotManager::GetUserSnapshotItemDetails( - uint16_t milestone) const { - return CollectUserDataItems(milestone); +std::vector<SnapshotItemDetails> +SnapshotManager::GetProfileSnapshotItemDetails() const { + return CollectProfileItems(); +} + +std::vector<SnapshotItemDetails> SnapshotManager::GetUserSnapshotItemDetails() + const { + return CollectUserDataItems(); } } // namespace downgrade
diff --git a/chrome/browser/downgrade/snapshot_manager.h b/chrome/browser/downgrade/snapshot_manager.h index 877c0fe..f989ba8 100644 --- a/chrome/browser/downgrade/snapshot_manager.h +++ b/chrome/browser/downgrade/snapshot_manager.h
@@ -9,6 +9,7 @@ #include <vector> #include "base/files/file_path.h" +#include "base/time/time.h" #include "base/version.h" namespace downgrade { @@ -44,11 +45,17 @@ // by moving invalid and older snapshots for later deletion. void PurgeInvalidAndOldSnapshots(int max_number_of_snapshots) const; + // Deletes snapshot data created after |delete_begin| for |profile_base_name|. + // |remove_mask| (of bits from ChromeBrowsingDataRemoverDelegate::DataType) + // indicates the types of data to be cleared from the profile's snapshots. + void DeleteSnapshotDataForProfile(base::Time delete_begin, + const base::FilePath& profile_base_name, + int remove_mask); + private: - virtual std::vector<SnapshotItemDetails> GetUserSnapshotItemDetails( - uint16_t milestone) const; - virtual std::vector<SnapshotItemDetails> GetProfileSnapshotItemDetails( - uint16_t milestone) const; + virtual std::vector<SnapshotItemDetails> GetUserSnapshotItemDetails() const; + virtual std::vector<SnapshotItemDetails> GetProfileSnapshotItemDetails() + const; const base::FilePath user_data_dir_; };
diff --git a/chrome/browser/downgrade/snapshot_manager_unittest.cc b/chrome/browser/downgrade/snapshot_manager_unittest.cc index 2b09c07d..61f77f3 100644 --- a/chrome/browser/downgrade/snapshot_manager_unittest.cc +++ b/chrome/browser/downgrade/snapshot_manager_unittest.cc
@@ -108,21 +108,20 @@ ~TestSnapshotManager() = default; private: - std::vector<SnapshotItemDetails> GetUserSnapshotItemDetails( - uint16_t milestone) const override { + std::vector<SnapshotItemDetails> GetUserSnapshotItemDetails() const override { return std::vector<SnapshotItemDetails>{ SnapshotItemDetails(base::FilePath(kUserDataFile), - SnapshotItemDetails::ItemType::kFile), + SnapshotItemDetails::ItemType::kFile, 0), SnapshotItemDetails(base::FilePath(kUserDataFolder), - SnapshotItemDetails::ItemType::kDirectory)}; + SnapshotItemDetails::ItemType::kDirectory, 0)}; } - std::vector<SnapshotItemDetails> GetProfileSnapshotItemDetails( - uint16_t milestone) const override { + std::vector<SnapshotItemDetails> GetProfileSnapshotItemDetails() + const override { return std::vector<SnapshotItemDetails>{ SnapshotItemDetails(base::FilePath(kProfileDataFile), - SnapshotItemDetails::ItemType::kFile), + SnapshotItemDetails::ItemType::kFile, 0), SnapshotItemDetails(base::FilePath(kProfileDataFolder), - SnapshotItemDetails::ItemType::kDirectory)}; + SnapshotItemDetails::ItemType::kDirectory, 0)}; } };
diff --git a/chrome/browser/downgrade/user_data_downgrade.cc b/chrome/browser/downgrade/user_data_downgrade.cc index 735653bb..2d03a50 100644 --- a/chrome/browser/downgrade/user_data_downgrade.cc +++ b/chrome/browser/downgrade/user_data_downgrade.cc
@@ -14,6 +14,7 @@ #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/downgrade/snapshot_manager.h" #include "chrome/common/pref_names.h" #include "components/prefs/pref_service.h" @@ -34,6 +35,12 @@ #endif // OS_WIN } +bool IsValidSnapshotDirectory(const base::FilePath& path) { + base::Version snapshot_version = GetVersionFromFileName(path); + return snapshot_version.IsValid() && + base::PathExists(path.Append(kDowngradeLastVersionFile)); +} + } // namespace const base::FilePath::StringPieceType kDowngradeLastVersionFile( @@ -95,11 +102,8 @@ base::FileEnumerator::DIRECTORIES); for (base::FilePath path = enumerator.Next(); !path.empty(); path = enumerator.Next()) { - base::Version snapshot_version = GetVersionFromFileName(path); - if (!snapshot_version.IsValid() || - !base::PathExists(path.Append(kDowngradeLastVersionFile))) { + if (!IsValidSnapshotDirectory(path)) result.push_back(std::move(path)); - } } return result; } @@ -116,4 +120,12 @@ return base::nullopt; } +void RemoveDataForProfile(base::Time delete_begin, + const base::FilePath& profile_path, + int remove_mask) { + SnapshotManager snapshot_manager(profile_path.DirName()); + snapshot_manager.DeleteSnapshotDataForProfile( + delete_begin, profile_path.BaseName(), remove_mask); +} + } // namespace downgrade
diff --git a/chrome/browser/downgrade/user_data_downgrade.h b/chrome/browser/downgrade/user_data_downgrade.h index a2af327..16bbfe2c2 100644 --- a/chrome/browser/downgrade/user_data_downgrade.h +++ b/chrome/browser/downgrade/user_data_downgrade.h
@@ -8,8 +8,13 @@ #include "base/containers/flat_set.h" #include "base/files/file_path.h" #include "base/optional.h" +#include "base/time/time.h" #include "base/version.h" +namespace base { +class Time; +} + namespace downgrade { // The suffix of pending deleted directory. @@ -50,6 +55,13 @@ const base::Version& version, const base::FilePath& user_data_dir); +// Removes snapshot data created after |delete_begin| for |profile_path|. +// |remove_mask| (of bits from ChromeBrowsingDataRemoverDelegate::DataType) +// indicates the types of data to be cleared from the profile's snapshots. +void RemoveDataForProfile(base::Time delete_begin, + const base::FilePath& profile_path, + int remove_mask); + } // namespace downgrade #endif // CHROME_BROWSER_DOWNGRADE_USER_DATA_DOWNGRADE_H_
diff --git a/chrome/browser/downgrade/user_data_downgrade_unittest.cc b/chrome/browser/downgrade/user_data_downgrade_unittest.cc index 4ee0859..ccaf6db 100644 --- a/chrome/browser/downgrade/user_data_downgrade_unittest.cc +++ b/chrome/browser/downgrade/user_data_downgrade_unittest.cc
@@ -10,6 +10,10 @@ #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/optional.h" +#include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" +#include "chrome/browser/downgrade/snapshot_file_collector.h" +#include "chrome/common/chrome_constants.h" +#include "content/public/browser/browsing_data_remover.h" #include "testing/gtest/include/gtest/gtest.h" namespace downgrade { @@ -93,4 +97,91 @@ base::Version("30.0.0")); } +TEST(UserDataDowngradeTests, RemoveDataForProfile) { + base::ScopedTempDir user_data_dir; + ASSERT_TRUE(user_data_dir.CreateUniqueTempDir()); + const base::FilePath snapshot_dir = + user_data_dir.GetPath().Append(kSnapshotsDir); + const auto profile_path_default = + user_data_dir.GetPath().AppendASCII("Default"); + const auto profile_path_1 = user_data_dir.GetPath().AppendASCII("Profile 1"); + const auto snapshot_profile_path_default = + snapshot_dir.AppendASCII("1").AppendASCII("Default"); + const auto snapshot_profile_path_1 = + snapshot_dir.AppendASCII("1").AppendASCII("Profile 1"); + ASSERT_TRUE(base::CreateDirectory(profile_path_default)); + ASSERT_TRUE(base::CreateDirectory(profile_path_1)); + ASSERT_TRUE(base::CreateDirectory(snapshot_profile_path_default)); + ASSERT_TRUE(base::CreateDirectory(snapshot_profile_path_1)); + base::File(profile_path_default.Append(kDowngradeLastVersionFile), + base::File::FLAG_CREATE | base::File::FLAG_WRITE); + base::File(profile_path_1.Append(kDowngradeLastVersionFile), + base::File::FLAG_CREATE | base::File::FLAG_WRITE); + base::File(snapshot_dir.AppendASCII("1").Append(kDowngradeLastVersionFile), + base::File::FLAG_CREATE | base::File::FLAG_WRITE); + + const auto profile_items = CollectProfileItems(); + DCHECK(!profile_items.empty()); + for (const auto& item : profile_items) { + if (item.is_directory) { + ASSERT_TRUE(base::CreateDirectory( + snapshot_profile_path_default.Append(item.path))); + ASSERT_TRUE( + base::CreateDirectory(snapshot_profile_path_1.Append(item.path))); + } else { + base::File(snapshot_profile_path_default.Append(item.path), + base::File::FLAG_CREATE | base::File::FLAG_WRITE); + base::File(snapshot_profile_path_1.Append(item.path), + base::File::FLAG_CREATE | base::File::FLAG_WRITE); + } + } + + base::File::Info snapshot_info; + ASSERT_TRUE(base::GetFileInfo(snapshot_dir, &snapshot_info)); + + // Test that data is deleted only if it was created after the deletion time + // range start. + RemoveDataForProfile(base::Time::Now(), profile_path_default, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_BOOKMARKS); + RemoveDataForProfile(snapshot_info.creation_time, profile_path_1, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_BOOKMARKS); + EXPECT_TRUE(base::PathExists( + snapshot_profile_path_default.Append(chrome::kPreferencesFilename))); + EXPECT_TRUE(base::PathExists( + snapshot_profile_path_1.Append(chrome::kPreferencesFilename))); + EXPECT_TRUE(base::PathExists(snapshot_profile_path_default.Append( + chrome::kSecurePreferencesFilename))); + EXPECT_TRUE(base::PathExists( + snapshot_profile_path_1.Append(chrome::kSecurePreferencesFilename))); + + for (const auto& item : profile_items) { + EXPECT_TRUE( + base::PathExists(snapshot_profile_path_default.Append(item.path))); + EXPECT_EQ((item.data_types & + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_BOOKMARKS) == 0, + base::PathExists(snapshot_profile_path_1.Append(item.path))); + } + + const auto remove_mask = + content::BrowsingDataRemover::DATA_TYPE_COOKIES | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_ISOLATED_ORIGINS | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_CONTENT_SETTINGS | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA; + + // Delete some data from default profile. + RemoveDataForProfile(snapshot_info.creation_time, profile_path_default, + remove_mask); + for (const auto& item : profile_items) { + EXPECT_EQ( + (item.data_types & remove_mask) == 0, + base::PathExists(snapshot_profile_path_default.Append(item.path))); + } + // Wipe profile 1 + RemoveDataForProfile(base::Time(), profile_path_1, + ChromeBrowsingDataRemoverDelegate::WIPE_PROFILE); + EXPECT_FALSE(base::PathExists(snapshot_profile_path_1)); +} + } // namespace downgrade
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index a23b3d3..375e609 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn
@@ -930,6 +930,8 @@ sources += [ "api/autofill_assistant_private/autofill_assistant_private_api.cc", "api/autofill_assistant_private/autofill_assistant_private_api.h", + "api/autofill_assistant_private/extension_access_token_fetcher.cc", + "api/autofill_assistant_private/extension_access_token_fetcher.h", ] deps += [ "//components/autofill_assistant/browser" ] }
diff --git a/chrome/browser/extensions/api/autofill_assistant_private/autofill_assistant_private_api.cc b/chrome/browser/extensions/api/autofill_assistant_private/autofill_assistant_private_api.cc index 5e448f9..c257161 100644 --- a/chrome/browser/extensions/api/autofill_assistant_private/autofill_assistant_private_api.cc +++ b/chrome/browser/extensions/api/autofill_assistant_private/autofill_assistant_private_api.cc
@@ -11,7 +11,10 @@ #include "base/time/default_tick_clock.h" #include "base/values.h" #include "chrome/browser/autofill/personal_data_manager_factory.h" +#include "chrome/browser/extensions/api/autofill_assistant_private/extension_access_token_fetcher.h" +#include "chrome/browser/extensions/chrome_extension_function_details.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/ui/browser.h" #include "components/autofill/core/browser/field_types.h" #include "extensions/browser/event_router_factory.h" @@ -233,9 +236,15 @@ AutofillAssistantPrivateAPI::AutofillAssistantPrivateAPI( content::BrowserContext* context) - : browser_context_(context) {} + : browser_context_(context) { + access_token_fetcher_ = std::make_unique<ExtensionAccessTokenFetcher>( + IdentityManagerFactory::GetForProfile( + Profile::FromBrowserContext(browser_context_))); +} -AutofillAssistantPrivateAPI::~AutofillAssistantPrivateAPI() = default; +AutofillAssistantPrivateAPI::~AutofillAssistantPrivateAPI() { + access_token_fetcher_.reset(); +} void AutofillAssistantPrivateAPI::CreateAutofillAssistantController( content::WebContents* web_contents) { @@ -312,7 +321,7 @@ autofill_assistant::AccessTokenFetcher* AutofillAssistantPrivateAPI::GetAccessTokenFetcher() { - return nullptr; + return access_token_fetcher_.get(); } autofill::PersonalDataManager* @@ -327,7 +336,7 @@ } std::string AutofillAssistantPrivateAPI::GetServerUrl() { - // TODO(crbug.com/1015753): Consider the autofill-assistant-url for endpoing + // TODO(crbug.com/1015753): Consider the autofill-assistant-url for endpoint // overrides and share the kDefaultAutofillAssistantServerUrl to expose it // here. return "https://automate-pa.googleapis.com";
diff --git a/chrome/browser/extensions/api/autofill_assistant_private/autofill_assistant_private_api.h b/chrome/browser/extensions/api/autofill_assistant_private/autofill_assistant_private_api.h index 37705c2..649fa9e1f 100644 --- a/chrome/browser/extensions/api/autofill_assistant_private/autofill_assistant_private_api.h +++ b/chrome/browser/extensions/api/autofill_assistant_private/autofill_assistant_private_api.h
@@ -232,6 +232,7 @@ std::unique_ptr<AutofillAssistantPrivateEventRouter> event_router; }; std::unique_ptr<ActiveAutofillAssistant> active_autofill_assistant_; + std::unique_ptr<autofill_assistant::AccessTokenFetcher> access_token_fetcher_; }; } // namespace extensions
diff --git a/chrome/browser/extensions/api/autofill_assistant_private/extension_access_token_fetcher.cc b/chrome/browser/extensions/api/autofill_assistant_private/extension_access_token_fetcher.cc new file mode 100644 index 0000000..04d1c01 --- /dev/null +++ b/chrome/browser/extensions/api/autofill_assistant_private/extension_access_token_fetcher.cc
@@ -0,0 +1,63 @@ +// 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/extensions/api/autofill_assistant_private/extension_access_token_fetcher.h" + +#include "base/callback.h" +#include "components/signin/public/identity_manager/access_token_fetcher.h" +#include "components/signin/public/identity_manager/access_token_info.h" +#include "components/signin/public/identity_manager/scope_set.h" +#include "google_apis/gaia/gaia_constants.h" + +namespace extensions { + +ExtensionAccessTokenFetcher::ExtensionAccessTokenFetcher( + signin::IdentityManager* identity_manager) + : identity_manager_(identity_manager) {} + +ExtensionAccessTokenFetcher::~ExtensionAccessTokenFetcher() = default; + +void ExtensionAccessTokenFetcher::FetchAccessToken( + base::OnceCallback<void(bool, const std::string&)> callback) { + // TODO(b/143736397): Use a more flexible logic to pick this account. + auto account_info = identity_manager_->GetPrimaryAccountInfo(); + + callback_ = std::move(callback); + signin::ScopeSet scopes; + scopes.insert(GaiaConstants::kGoogleUserInfoProfile); + auto mode = signin::AccessTokenFetcher::Mode::kImmediate; + access_token_fetcher_ = identity_manager_->CreateAccessTokenFetcherForAccount( + account_info.account_id, + /*consumer_name=*/"AccessTokenFetcher", scopes, + base::BindOnce(&ExtensionAccessTokenFetcher::OnCompleted, + // It is safe to use base::Unretained as + // |this| owns |access_token_fetcher_|. + base::Unretained(this)), + mode); +} + +void ExtensionAccessTokenFetcher::InvalidateAccessToken( + const std::string& access_token) { + // TODO(b/143736397) Implement this by providing the data required for + // RemoveAccessTokenFromCache? +} + +void ExtensionAccessTokenFetcher::OnCompleted( + GoogleServiceAuthError error, + signin::AccessTokenInfo access_token_info) { + access_token_fetcher_.reset(); + + if (!callback_) + return; + + if (error.state() == GoogleServiceAuthError::NONE) { + std::move(callback_).Run(true, access_token_info.token); + } else { + VLOG(2) << "Access token fetching failed with error state " << error.state() + << " and message " << error.ToString(); + std::move(callback_).Run(false, ""); + } +} + +} // namespace extensions
diff --git a/chrome/browser/extensions/api/autofill_assistant_private/extension_access_token_fetcher.h b/chrome/browser/extensions/api/autofill_assistant_private/extension_access_token_fetcher.h new file mode 100644 index 0000000..f94060e --- /dev/null +++ b/chrome/browser/extensions/api/autofill_assistant_private/extension_access_token_fetcher.h
@@ -0,0 +1,39 @@ +// 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_EXTENSIONS_API_AUTOFILL_ASSISTANT_PRIVATE_EXTENSION_ACCESS_TOKEN_FETCHER_H_ +#define CHROME_BROWSER_EXTENSIONS_API_AUTOFILL_ASSISTANT_PRIVATE_EXTENSION_ACCESS_TOKEN_FETCHER_H_ + +#include "components/autofill_assistant/browser/access_token_fetcher.h" +#include "components/signin/public/identity_manager/identity_manager.h" + +namespace extensions { + +// A class that fetches tokens as needed for requests to Autofill Assistant +// backends. This is an implementation provided to a service in the AA +// component. +class ExtensionAccessTokenFetcher + : public autofill_assistant::AccessTokenFetcher { + public: + explicit ExtensionAccessTokenFetcher( + signin::IdentityManager* identity_manager); + ~ExtensionAccessTokenFetcher() override; + + // AccessTokenFetcher: + void FetchAccessToken( + base::OnceCallback<void(bool, const std::string&)> callback) override; + void InvalidateAccessToken(const std::string& access_token) override; + + private: + void OnCompleted(GoogleServiceAuthError error, + signin::AccessTokenInfo access_token_info); + + signin::IdentityManager* identity_manager_; + std::unique_ptr<signin::AccessTokenFetcher> access_token_fetcher_; + base::OnceCallback<void(bool, const std::string&)> callback_; +}; + +} // namespace extensions + +#endif // CHROME_BROWSER_EXTENSIONS_API_AUTOFILL_ASSISTANT_PRIVATE_EXTENSION_ACCESS_TOKEN_FETCHER_H_
diff --git a/chrome/browser/extensions/api/autofill_assistant_private/extension_access_token_fetcher_unittest.cc b/chrome/browser/extensions/api/autofill_assistant_private/extension_access_token_fetcher_unittest.cc new file mode 100644 index 0000000..1719cf4 --- /dev/null +++ b/chrome/browser/extensions/api/autofill_assistant_private/extension_access_token_fetcher_unittest.cc
@@ -0,0 +1,58 @@ +// Copyright 2013 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/extensions/api/autofill_assistant_private/extension_access_token_fetcher.h" + +#include "base/test/gmock_callback_support.h" +#include "base/test/mock_callback.h" +#include "base/test/task_environment.h" +#include "components/signin/public/identity_manager/identity_test_environment.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace extensions { + +class ExtensionAccessTokenFetcherTest : public testing::Test { + public: + ExtensionAccessTokenFetcherTest() = default; + ~ExtensionAccessTokenFetcherTest() override = default; + + void SetUp() override { + identity_test_env_.MakePrimaryAccountAvailable("primary@example.com"); + } + + void TearDown() override {} + + protected: + // The environment needs to be the first member to be initialized. + base::test::TaskEnvironment task_environment_; + + signin::IdentityTestEnvironment identity_test_env_; +}; + +TEST_F(ExtensionAccessTokenFetcherTest, SuccessfulAccessTokenFetch) { + base::MockCallback<base::OnceCallback<void(bool, const std::string&)>> + callback; + EXPECT_CALL(callback, Run(true, "access_token")); + + ExtensionAccessTokenFetcher fetcher(identity_test_env_.identity_manager()); + fetcher.FetchAccessToken(callback.Get()); + + identity_test_env_.WaitForAccessTokenRequestIfNecessaryAndRespondWithToken( + "access_token", base::Time::Max()); +} + +TEST_F(ExtensionAccessTokenFetcherTest, FailedAccessTokenFetch) { + base::MockCallback<base::OnceCallback<void(bool, const std::string&)>> + callback; + EXPECT_CALL(callback, Run(false, "")); + + ExtensionAccessTokenFetcher fetcher(identity_test_env_.identity_manager()); + fetcher.FetchAccessToken(callback.Get()); + + identity_test_env_.WaitForAccessTokenRequestIfNecessaryAndRespondWithError( + GoogleServiceAuthError::FromConnectionError( + GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); +} + +} // namespace extensions
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc index 74b5f57..f914473 100644 --- a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc +++ b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc
@@ -11,7 +11,8 @@ #include "base/values.h" #include "chrome/browser/chromeos/platform_keys/extension_platform_keys_service.h" #include "chrome/browser/chromeos/platform_keys/extension_platform_keys_service_factory.h" -#include "chrome/browser/chromeos/platform_keys/platform_keys.h" +#include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" +#include "chrome/browser/chromeos/platform_keys/platform_keys_service_factory.h" #include "chrome/browser/extensions/api/platform_keys/platform_keys_api.h" #include "chrome/common/extensions/api/enterprise_platform_keys.h" #include "chrome/common/extensions/api/enterprise_platform_keys_internal.h" @@ -111,12 +112,14 @@ if (!platform_keys::ValidateToken(params->token_id, &platform_keys_token_id)) return RespondNow(Error(platform_keys::kErrorInvalidToken)); - chromeos::platform_keys::GetCertificates( + chromeos::platform_keys::PlatformKeysService* platform_keys_service = + chromeos::platform_keys::PlatformKeysServiceFactory::GetForBrowserContext( + browser_context()); + platform_keys_service->GetCertificates( platform_keys_token_id, base::Bind( &EnterprisePlatformKeysGetCertificatesFunction::OnGotCertificates, - this), - browser_context()); + this)); return RespondLater(); } @@ -167,12 +170,16 @@ if (!cert_x509.get()) return RespondNow(Error(kEnterprisePlatformErrorInvalidX509Cert)); - chromeos::platform_keys::ImportCertificate( + chromeos::platform_keys::PlatformKeysService* platform_keys_service = + chromeos::platform_keys::PlatformKeysServiceFactory::GetForBrowserContext( + browser_context()); + CHECK(platform_keys_service); + + platform_keys_service->ImportCertificate( platform_keys_token_id, cert_x509, base::Bind(&EnterprisePlatformKeysImportCertificateFunction:: OnImportedCertificate, - this), - browser_context()); + this)); return RespondLater(); } @@ -209,12 +216,16 @@ if (!cert_x509.get()) return RespondNow(Error(kEnterprisePlatformErrorInvalidX509Cert)); - chromeos::platform_keys::RemoveCertificate( + chromeos::platform_keys::PlatformKeysService* platform_keys_service = + chromeos::platform_keys::PlatformKeysServiceFactory::GetForBrowserContext( + browser_context()); + CHECK(platform_keys_service); + + platform_keys_service->RemoveCertificate( platform_keys_token_id, cert_x509, base::Bind(&EnterprisePlatformKeysRemoveCertificateFunction:: OnRemovedCertificate, - this), - browser_context()); + this)); return RespondLater(); } @@ -234,10 +245,13 @@ EnterprisePlatformKeysInternalGetTokensFunction::Run() { EXTENSION_FUNCTION_VALIDATE(args_->empty()); - chromeos::platform_keys::GetTokens( - base::Bind(&EnterprisePlatformKeysInternalGetTokensFunction::OnGotTokens, - this), - browser_context()); + chromeos::platform_keys::PlatformKeysService* platform_keys_service = + chromeos::platform_keys::PlatformKeysServiceFactory::GetForBrowserContext( + browser_context()); + CHECK(platform_keys_service); + + platform_keys_service->GetTokens(base::Bind( + &EnterprisePlatformKeysInternalGetTokensFunction::OnGotTokens, this)); return RespondLater(); }
diff --git a/chrome/browser/extensions/api/passwords_private/password_check_delegate.cc b/chrome/browser/extensions/api/passwords_private/password_check_delegate.cc index e0b3954..afc1d9c 100644 --- a/chrome/browser/extensions/api/passwords_private/password_check_delegate.cc +++ b/chrome/browser/extensions/api/passwords_private/password_check_delegate.cc
@@ -69,6 +69,8 @@ return api::passwords_private::PASSWORD_CHECK_STATE_IDLE; case BulkLeakCheckService::State::kRunning: return api::passwords_private::PASSWORD_CHECK_STATE_RUNNING; + case BulkLeakCheckService::State::kCanceled: + return api::passwords_private::PASSWORD_CHECK_STATE_CANCELED; case BulkLeakCheckService::State::kSignedOut: return api::passwords_private::PASSWORD_CHECK_STATE_SIGNED_OUT; case BulkLeakCheckService::State::kNetworkError: @@ -202,9 +204,18 @@ compromised_credential_id_generator_.GenerateId(credential); api_credential.signon_realm = credential.signon_realm; api_credential.username = base::UTF16ToUTF8(credential.username); - api_credential.elapsed_time_since_compromise = base::UTF16ToUTF8( - TimeFormat::Simple(TimeFormat::FORMAT_ELAPSED, TimeFormat::LENGTH_LONG, - base::Time::Now() - credential.create_time)); + api_credential.compromise_time = + credential.create_time.ToJsTimeIgnoringNull(); + base::TimeDelta elapsed_time = base::Time::Now() - credential.create_time; + if (elapsed_time < base::TimeDelta::FromMinutes(1)) { + api_credential.elapsed_time_since_compromise = + l10n_util::GetStringUTF8(IDS_SETTINGS_PASSWORDS_JUST_NOW); + } else { + api_credential.elapsed_time_since_compromise = + base::UTF16ToUTF8(TimeFormat::SimpleWithMonthAndYear( + TimeFormat::FORMAT_ELAPSED, TimeFormat::LENGTH_LONG, elapsed_time, + true)); + } api_credential.compromise_type = ConvertCompromiseType(credential.compromise_type); credentials_info.compromised_credentials.push_back(
diff --git a/chrome/browser/extensions/api/passwords_private/password_check_delegate_unittest.cc b/chrome/browser/extensions/api/passwords_private/password_check_delegate_unittest.cc index ea91984..9f29b07 100644 --- a/chrome/browser/extensions/api/passwords_private/password_check_delegate_unittest.cc +++ b/chrome/browser/extensions/api/passwords_private/password_check_delegate_unittest.cc
@@ -176,15 +176,19 @@ const std::string& formatted_origin, const std::string& change_password_url, const std::string& username, - const std::string& elapsed_time_since_compromise, + base::TimeDelta elapsed_time_since_compromise, + const std::string& elapsed_time_since_compromise_str, api::passwords_private::CompromiseType compromise_type) { return AllOf( Field(&CompromisedCredential::formatted_origin, formatted_origin), Field(&CompromisedCredential::change_password_url, Pointee(change_password_url)), Field(&CompromisedCredential::username, username), + Field(&CompromisedCredential::compromise_time, + (base::Time::Now() - elapsed_time_since_compromise) + .ToJsTimeIgnoringNull()), Field(&CompromisedCredential::elapsed_time_since_compromise, - elapsed_time_since_compromise), + elapsed_time_since_compromise_str), Field(&CompromisedCredential::compromise_type, compromise_type)); } @@ -251,16 +255,63 @@ EXPECT_THAT( delegate().GetCompromisedCredentialsInfo().compromised_credentials, ElementsAre(ExpectCompromisedCredential( - "example.com", kExampleCom, kUsername2, "2 minutes ago", + "example.com", kExampleCom, kUsername2, + base::TimeDelta::FromMinutes(2), "2 minutes ago", api::passwords_private::COMPROMISE_TYPE_PHISHED), ExpectCompromisedCredential( - "example.org", kExampleOrg, kUsername1, "4 minutes ago", + "example.org", kExampleOrg, kUsername1, + base::TimeDelta::FromMinutes(4), "4 minutes ago", api::passwords_private::COMPROMISE_TYPE_PHISHED), ExpectCompromisedCredential( - "example.com", kExampleCom, kUsername1, "1 minute ago", + "example.com", kExampleCom, kUsername1, + base::TimeDelta::FromMinutes(1), "1 minute ago", api::passwords_private::COMPROMISE_TYPE_LEAKED), ExpectCompromisedCredential( - "example.org", kExampleOrg, kUsername2, "3 minutes ago", + "example.org", kExampleOrg, kUsername2, + base::TimeDelta::FromMinutes(3), "3 minutes ago", + api::passwords_private::COMPROMISE_TYPE_LEAKED))); +} + +// Verifies that the formatted timestamp associated with a compromised +// credential covers the "Just now" cases (less than a minute ago), as well as +// months and years. +TEST_F(PasswordCheckDelegateTest, GetCompromisedCredentialsHandlesTimes) { + store().AddLogin(MakeSavedPassword(kExampleCom, kUsername1)); + store().AddLogin(MakeSavedPassword(kExampleCom, kUsername2)); + store().AddLogin(MakeSavedPassword(kExampleOrg, kUsername1)); + store().AddLogin(MakeSavedPassword(kExampleOrg, kUsername2)); + + store().AddCompromisedCredentials( + MakeCompromised(kExampleCom, kUsername1, base::TimeDelta::FromSeconds(59), + CompromiseType::kLeaked)); + store().AddCompromisedCredentials( + MakeCompromised(kExampleCom, kUsername2, base::TimeDelta::FromSeconds(60), + CompromiseType::kLeaked)); + store().AddCompromisedCredentials( + MakeCompromised(kExampleOrg, kUsername1, base::TimeDelta::FromDays(100), + CompromiseType::kLeaked)); + store().AddCompromisedCredentials( + MakeCompromised(kExampleOrg, kUsername2, base::TimeDelta::FromDays(800), + CompromiseType::kLeaked)); + RunUntilIdle(); + + EXPECT_THAT( + delegate().GetCompromisedCredentialsInfo().compromised_credentials, + ElementsAre(ExpectCompromisedCredential( + "example.com", kExampleCom, kUsername1, + base::TimeDelta::FromSeconds(59), "Just now", + api::passwords_private::COMPROMISE_TYPE_LEAKED), + ExpectCompromisedCredential( + "example.com", kExampleCom, kUsername2, + base::TimeDelta::FromSeconds(60), "1 minute ago", + api::passwords_private::COMPROMISE_TYPE_LEAKED), + ExpectCompromisedCredential( + "example.org", kExampleOrg, kUsername1, + base::TimeDelta::FromDays(100), "3 months ago", + api::passwords_private::COMPROMISE_TYPE_LEAKED), + ExpectCompromisedCredential( + "example.org", kExampleOrg, kUsername2, + base::TimeDelta::FromDays(800), "2 years ago", api::passwords_private::COMPROMISE_TYPE_LEAKED))); } @@ -286,13 +337,16 @@ EXPECT_THAT( delegate().GetCompromisedCredentialsInfo().compromised_credentials, ElementsAre(ExpectCompromisedCredential( - "Example App", kExampleCom, kUsername2, "3 days ago", + "Example App", kExampleCom, kUsername2, + base::TimeDelta::FromDays(3), "3 days ago", api::passwords_private::COMPROMISE_TYPE_PHISHED), ExpectCompromisedCredential( - "App (com.example.app)", "", kUsername1, "4 days ago", + "App (com.example.app)", "", kUsername1, + base::TimeDelta::FromDays(4), "4 days ago", api::passwords_private::COMPROMISE_TYPE_PHISHED), ExpectCompromisedCredential( - "example.com", kExampleCom, kUsername1, "5 minutes ago", + "example.com", kExampleCom, kUsername1, + base::TimeDelta::FromMinutes(5), "5 minutes ago", api::passwords_private::COMPROMISE_TYPE_LEAKED))); } @@ -762,6 +816,7 @@ // Verify that the event gets fired once the saved passwords provider is // initialized. + store().AddLogin(MakeSavedPassword(kExampleCom, kUsername1)); RunUntilIdle(); EXPECT_EQ(events::PASSWORDS_PRIVATE_ON_PASSWORD_CHECK_STATUS_CHANGED, event_router_observer().events().at(kEventName)->histogram_value);
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc index f7c0781..f94bcfc 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc
@@ -181,6 +181,7 @@ credential.change_password_url = std::make_unique<std::string>("https://example.com/change-password"); credential.compromise_type = api::passwords_private::COMPROMISE_TYPE_LEAKED; + credential.compromise_time = 1583236800000; // Mar 03 2020 12:00:00 UTC credential.elapsed_time_since_compromise = base::UTF16ToUTF8( TimeFormat::Simple(TimeFormat::FORMAT_ELAPSED, TimeFormat::LENGTH_LONG, base::TimeDelta::FromDays(3)));
diff --git a/chrome/browser/extensions/api/platform_keys/platform_keys_api.cc b/chrome/browser/extensions/api/platform_keys/platform_keys_api.cc index 00547e59..be4e536 100644 --- a/chrome/browser/extensions/api/platform_keys/platform_keys_api.cc +++ b/chrome/browser/extensions/api/platform_keys/platform_keys_api.cc
@@ -14,7 +14,7 @@ #include "base/values.h" #include "chrome/browser/chromeos/platform_keys/extension_platform_keys_service.h" #include "chrome/browser/chromeos/platform_keys/extension_platform_keys_service_factory.h" -#include "chrome/browser/chromeos/platform_keys/platform_keys.h" +#include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" #include "chrome/browser/extensions/api/platform_keys/verify_trust_api.h" #include "chrome/common/extensions/api/platform_keys_internal.h" #include "components/web_modal/web_contents_modal_dialog_manager.h"
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index 632d959..3e85d983 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc
@@ -1005,6 +1005,11 @@ if (!success && (!expected_id_.empty() || extension())) { switch (error->type()) { case CrxInstallErrorType::DECLINED: + if (error->detail() == CrxInstallErrorDetail::DISALLOWED_BY_POLICY) { + installation_reporter + ->ReportExtensionTypeForPolicyDisallowedExtension( + extension_id, extension()->GetType()); + } installation_reporter->ReportCrxInstallError( extension_id, InstallationReporter::FailureReason::CRX_INSTALL_ERROR_DECLINED,
diff --git a/chrome/browser/extensions/forced_extensions/installation_reporter.cc b/chrome/browser/extensions/forced_extensions/installation_reporter.cc index 8597466..64e9e9c 100644 --- a/chrome/browser/extensions/forced_extensions/installation_reporter.cc +++ b/chrome/browser/extensions/forced_extensions/installation_reporter.cc
@@ -110,13 +110,18 @@ NotifyObserversOfFailure(id, reason, data); } +void InstallationReporter::ReportExtensionTypeForPolicyDisallowedExtension( + const ExtensionId& id, + Manifest::Type extension_type) { + InstallationData& data = installation_data_map_[id]; + data.extension_type = extension_type; +} + void InstallationReporter::ReportCrxInstallError( const ExtensionId& id, FailureReason reason, CrxInstallErrorDetail crx_install_error) { DCHECK(reason == FailureReason::CRX_INSTALL_ERROR_DECLINED || - reason == - FailureReason::CRX_INSTALL_ERROR_SANDBOXED_UNPACKER_FAILURE || reason == FailureReason::CRX_INSTALL_ERROR_OTHER); InstallationData& data = installation_data_map_[id]; data.failure_reason = reason;
diff --git a/chrome/browser/extensions/forced_extensions/installation_reporter.h b/chrome/browser/extensions/forced_extensions/installation_reporter.h index dac5858..dac4359 100644 --- a/chrome/browser/extensions/forced_extensions/installation_reporter.h +++ b/chrome/browser/extensions/forced_extensions/installation_reporter.h
@@ -199,6 +199,9 @@ // CRX_INSTALL_ERROR_SANDBOXED_UNPACKER_FAILURE. base::Optional<extensions::SandboxedUnpackerFailureReason> unpacker_failure_reason; + // Type of extension, assigned when CRX installation error detail is + // DISALLOWED_BY_POLICY. + base::Optional<Manifest::Type> extension_type; }; class Observer : public base::CheckedObserver { @@ -235,6 +238,11 @@ void ReportDownloadingCacheStatus( const ExtensionId& id, ExtensionDownloaderDelegate::CacheStatus cache_status); + // Assigns the extension type. See InstallationData::extension_type for more + // details. + void ReportExtensionTypeForPolicyDisallowedExtension( + const ExtensionId& id, + Manifest::Type extension_type); void ReportCrxInstallError(const ExtensionId& id, FailureReason reason, CrxInstallErrorDetail crx_install_error);
diff --git a/chrome/browser/extensions/forced_extensions/installation_tracker.cc b/chrome/browser/extensions/forced_extensions/installation_tracker.cc index 066d8d8..b2d52c1 100644 --- a/chrome/browser/extensions/forced_extensions/installation_tracker.cc +++ b/chrome/browser/extensions/forced_extensions/installation_tracker.cc
@@ -10,6 +10,8 @@ #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/values.h" +#include "chrome/browser/extensions/extension_management.h" +#include "chrome/browser/extensions/extension_management_constants.h" #include "chrome/browser/extensions/external_provider_impl.h" #include "chrome/browser/extensions/forced_extensions/installation_reporter.h" #include "chrome/browser/profiles/profile.h" @@ -198,6 +200,24 @@ ReportResults(); } +bool InstallationTracker::IsMisconfiguration( + const InstallationReporter::InstallationData& installation_data, + const ExtensionId& id) { + ExtensionManagement* management = + ExtensionManagementFactory::GetForBrowserContext(profile_); + CrxInstallErrorDetail detail = installation_data.install_error_detail.value(); + if (detail == CrxInstallErrorDetail::KIOSK_MODE_ONLY) + return true; + + if (detail == CrxInstallErrorDetail::DISALLOWED_BY_POLICY && + !management->IsAllowedManifestType( + installation_data.extension_type.value(), id)) { + return true; + } + + return false; +} + #if defined(OS_CHROMEOS) // Returns the type of session in case extension fails to install. InstallationTracker::SessionType InstallationTracker::GetSessionType() { @@ -329,8 +349,7 @@ if (installation.install_error_detail) { CrxInstallErrorDetail detail = installation.install_error_detail.value(); - // KIOSK_MODE_ONLY is a type of misconfiguration failure. - if (detail == CrxInstallErrorDetail::KIOSK_MODE_ONLY) + if (IsMisconfiguration(installation, extension_id)) misconfigured_extensions++; UMA_HISTOGRAM_ENUMERATION( "Extensions.ForceInstalledFailureCrxInstallError", detail); @@ -349,6 +368,7 @@ "ForceInstalledSessionsWithNonMisconfigurationFailureOccured", non_misconfigured_failure_occurred); } + void InstallationTracker::ReportResults() { DCHECK(!reported_); // Report only if there was non-empty list of force-installed extensions.
diff --git a/chrome/browser/extensions/forced_extensions/installation_tracker.h b/chrome/browser/extensions/forced_extensions/installation_tracker.h index cedc19a..c3c3c78 100644 --- a/chrome/browser/extensions/forced_extensions/installation_tracker.h +++ b/chrome/browser/extensions/forced_extensions/installation_tracker.h
@@ -114,6 +114,13 @@ // Loads list of force-installed extensions if available. void OnForcedExtensionsPrefChanged(); + // Returns true only in case of some well-known misconfigurations which are + // easy to detect. Can return false for misconfigurations which are hard to + // distinguish with other errors. + bool IsMisconfiguration( + const InstallationReporter::InstallationData& installation_data, + const ExtensionId& id); + #if defined(OS_CHROMEOS) // Returns Session Type in case extension fails to install. SessionType GetSessionType();
diff --git a/chrome/browser/extensions/forced_extensions/installation_tracker_unittest.cc b/chrome/browser/extensions/forced_extensions/installation_tracker_unittest.cc index 1b280d7f..db59f44 100644 --- a/chrome/browser/extensions/forced_extensions/installation_tracker_unittest.cc +++ b/chrome/browser/extensions/forced_extensions/installation_tracker_unittest.cc
@@ -19,6 +19,7 @@ #include "extensions/browser/pref_names.h" #include "extensions/common/extension.h" #include "extensions/common/extension_builder.h" +#include "extensions/common/manifest.h" #include "extensions/common/value_builder.h" #include "net/base/net_errors.h" #include "testing/gtest/include/gtest/gtest.h" @@ -30,8 +31,10 @@ #endif // defined(OS_CHROMEOS) namespace { -constexpr char kExtensionId1[] = "id1"; -constexpr char kExtensionId2[] = "id2"; + +// The extension ids used here should be valid extension ids. +constexpr char kExtensionId1[] = "abcdefghijklmnopabcdefghijklmnop"; +constexpr char kExtensionId2[] = "bcdefghijklmnopabcdefghijklmnopa"; constexpr char kExtensionName1[] = "name1"; constexpr char kExtensionName2[] = "name2"; constexpr char kExtensionUpdateUrl[] = @@ -396,11 +399,11 @@ } // Session in which either all the extensions installed successfully, or all -// failures are admin-side misconfigurations. Misconfiguration failure includes -// error KIOSK_MODE_ONLY, when force installed extension fails to install with -// failure reason CRX_INSTALL_ERROR. +// failures are admin-side misconfigurations. This test verifies that failure +// CRX_INSTALL_ERROR with detailed error KIOSK_MODE_ONLY is considered as +// misconfiguration. TEST_F(ForcedExtensionsInstallationTrackerTest, - NonMisconfigurationFailureNotPresent) { + NonMisconfigurationFailureNotPresentKioskModeOnlyError) { SetupForceList(); auto extension = ExtensionBuilder(kExtensionName1).SetID(kExtensionId1).Build(); @@ -416,6 +419,68 @@ 1); } +// Session in which either all the extensions installed successfully, or all +// failures are admin-side misconfigurations. This test verifies that failure +// CRX_INSTALL_ERROR with detailed error DISALLOWED_BY_POLICY and when extension +// type which is not allowed to install according to policy +// kExtensionAllowedTypes is considered as misconfiguration. +TEST_F(ForcedExtensionsInstallationTrackerTest, + NonMisconfigurationFailureNotPresentDisallowedByPolicyTypeError) { + SetupForceList(); + // Set TYPE_EXTENSION and TYPE_THEME as the allowed extension types. + std::unique_ptr<base::Value> list = + ListBuilder().Append("extension").Append("theme").Build(); + prefs_->SetManagedPref(pref_names::kAllowedTypes, std::move(list)); + + auto extension = + ExtensionBuilder(kExtensionName1).SetID(kExtensionId1).Build(); + tracker_->OnExtensionLoaded(&profile_, extension.get()); + // Hosted app is not a valid extension type, so this should report an error. + installation_reporter_->ReportExtensionTypeForPolicyDisallowedExtension( + kExtensionId2, Manifest::Type::TYPE_HOSTED_APP); + installation_reporter_->ReportCrxInstallError( + kExtensionId2, + InstallationReporter::FailureReason::CRX_INSTALL_ERROR_DECLINED, + CrxInstallErrorDetail::DISALLOWED_BY_POLICY); + // InstallationTracker shuts down timer because all extension are either + // loaded or failed. + EXPECT_FALSE(fake_timer_->IsRunning()); + histogram_tester_.ExpectBucketCount( + kPossibleNonMisconfigurationFailures, + 0 /*Misconfiguration failure not present*/, 1 /*Count of the sample*/); +} + +// Session in which at least one non misconfiguration failure occurred. One of +// the extension fails to install with DISALLOWED_BY_POLICY error but has +// extension type which is allowed by policy ExtensionAllowedTypes. This is not +// a misconfiguration failure. +TEST_F(ForcedExtensionsInstallationTrackerTest, + NonMisconfigurationFailurePresentDisallowedByPolicyError) { + SetupForceList(); + + // Set TYPE_EXTENSION and TYPE_THEME as the allowed extension types. + std::unique_ptr<base::Value> list = + ListBuilder().Append("extension").Append("theme").Build(); + prefs_->SetManagedPref(pref_names::kAllowedTypes, std::move(list)); + + auto extension = + ExtensionBuilder(kExtensionName1).SetID(kExtensionId1).Build(); + tracker_->OnExtensionLoaded(&profile_, extension.get()); + installation_reporter_->ReportExtensionTypeForPolicyDisallowedExtension( + kExtensionId2, Manifest::Type::TYPE_EXTENSION); + installation_reporter_->ReportCrxInstallError( + kExtensionId2, + InstallationReporter::FailureReason::CRX_INSTALL_ERROR_DECLINED, + CrxInstallErrorDetail::DISALLOWED_BY_POLICY); + + // InstallationTracker shuts down timer because all extension are either + // loaded or failed. + EXPECT_FALSE(fake_timer_->IsRunning()); + histogram_tester_.ExpectBucketCount(kPossibleNonMisconfigurationFailures, + 1 /*Misconfiguration failure present*/, + 1 /*Count of the sample*/); +} + // Session in which at least one non misconfiguration failure occurred. // Misconfiguration failure includes error KIOSK_MODE_ONLY, when force installed // extension fails to install with failure reason CRX_INSTALL_ERROR.
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index b7177238..b4c6e1c 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -3388,6 +3388,11 @@ "expiry_milestone": 84 }, { + "name": "ssl-committed-interstitials", + "owners": [ "livvielin" ], + "expiry_milestone": 84 + }, + { "name": "stop-in-background", "owners": [ "chrome-catan@google.com" ], "expiry_milestone": 76
diff --git a/chrome/browser/media/router/providers/cast/cast_session_tracker.cc b/chrome/browser/media/router/providers/cast/cast_session_tracker.cc index a44efeab..f540484 100644 --- a/chrome/browser/media/router/providers/cast/cast_session_tracker.cc +++ b/chrome/browser/media/router/providers/cast/cast_session_tracker.cc
@@ -105,6 +105,7 @@ void CastSessionTracker::HandleMediaStatusMessage(const MediaSinkInternal& sink, const base::Value& message) { + DVLOG(2) << "Initial MEDIA_STATUS: " << message; auto session_it = sessions_by_sink_id_.find(sink.sink().id()); if (session_it == sessions_by_sink_id_.end()) { DVLOG(2) << "Got media status message, but no session for: " @@ -131,17 +132,7 @@ return; } - // First filter out any idle media objects. - updated_status->EraseListValueIf([](const base::Value& media) { - const std::string* player_state = media.FindStringKey("playerState"); - return player_state && *player_state == "IDLE"; - }); - base::Value::ListView media_list = updated_status->GetList(); - if (media_list.size() > 1) { - DVLOG(2) << "Media list unexpectedly contains more than one live media: " - << media_list.size() << ", session: " << session_id; - } // Backfill messages from receivers to make them compatible with Cast SDK. for (auto& media : media_list) { @@ -158,7 +149,7 @@ CopySavedMediaFieldsToMediaList(session, media_list); - DVLOG(2) << "Final updated status: " << updated_status; + DVLOG(2) << "Final updated MEDIA_STATUS: " << *updated_status; session->UpdateMedia(*updated_status); base::Optional<int> request_id =
diff --git a/chrome/browser/media/router/providers/cast/cast_session_tracker_unittest.cc b/chrome/browser/media/router/providers/cast/cast_session_tracker_unittest.cc index 84b522c..8d1d3ba 100644 --- a/chrome/browser/media/router/providers/cast/cast_session_tracker_unittest.cc +++ b/chrome/browser/media/router/providers/cast/cast_session_tracker_unittest.cc
@@ -169,9 +169,6 @@ AddSinkAndSendReceiverStatusResponse(); // Expect that: - // - // - Any 'status' entries with 'playerState' equal to "IDLE" are filtered out. - // // - The session ID is copied into the output message and all values in in the // 'status' list. // @@ -187,8 +184,10 @@ "sessionId": "theSessionId", "supportedMediaCommands": [], }, - ], - })"), + { + "playerState": "IDLE", + "sessionId": "theSessionId" + }]})"), base::Optional<int>())); // This should call session_tracker_.HandleMediaStatusMessage(...). @@ -211,6 +210,10 @@ "playerState": "anything but IDLE", "sessionId": "theSessionId", "supportedMediaCommands": [], + }, + { + "playerState": "IDLE", + "sessionId": "theSessionId" }])")); } @@ -219,8 +222,6 @@ // Expect that: // - // - Any 'status' entries with 'playerState' equal to "IDLE" are filtered out. - // // - The session ID is copied into the output message and all values in in the // 'status' list. // @@ -241,7 +242,10 @@ "supportedMediaCommands": ["pause"], "xyzzy": "xyzzyValue1", }, - ], + { + "playerState": "IDLE", + "sessionId": "theSessionId" + }], "xyzzy": "xyzzyValue2", })"), base::make_optional(12345))); @@ -270,6 +274,10 @@ "sessionId": "theSessionId", "supportedMediaCommands": ["pause"], "xyzzy": "xyzzyValue1", + }, + { + "playerState": "IDLE", + "sessionId": "theSessionId" }])")); }
diff --git a/chrome/browser/password_manager/account_storage/account_password_store_factory.cc b/chrome/browser/password_manager/account_storage/account_password_store_factory.cc index 3734f58..2f8df20 100644 --- a/chrome/browser/password_manager/account_storage/account_password_store_factory.cc +++ b/chrome/browser/password_manager/account_storage/account_password_store_factory.cc
@@ -15,7 +15,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/web_data_service_factory.h" -#include "chrome/common/channel_info.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/password_manager/core/browser/login_database.h" #include "components/password_manager/core/browser/password_manager_constants.h" @@ -121,7 +120,6 @@ scoped_refptr<PasswordStore> ps = new password_manager::PasswordStoreDefault(std::move(login_db)); if (!ps->Init(/*flare=*/base::DoNothing(), profile->GetPrefs(), - chrome::GetChannel(), base::BindRepeating(&SyncEnabledOrDisabled, profile))) { // TODO(crbug.com/479725): Remove the LOG once this error is visible in the // UI.
diff --git a/chrome/browser/password_manager/password_store_factory.cc b/chrome/browser/password_manager/password_store_factory.cc index 84c6bab..5ebc850 100644 --- a/chrome/browser/password_manager/password_store_factory.cc +++ b/chrome/browser/password_manager/password_store_factory.cc
@@ -17,7 +17,6 @@ #include "chrome/browser/sync/glue/sync_start_util.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/web_data_service_factory.h" -#include "chrome/common/channel_info.h" #include "chrome/common/chrome_paths_internal.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/password_manager/core/browser/login_database.h" @@ -164,7 +163,7 @@ #endif DCHECK(ps); if (!ps->Init(sync_start_util::GetFlareForSyncableService(profile->GetPath()), - profile->GetPrefs(), chrome::GetChannel())) { + profile->GetPrefs())) { // TODO(crbug.com/479725): Remove the LOG once this error is visible in the // UI. LOG(WARNING) << "Could not initialize password store.";
diff --git a/chrome/browser/payments/BUILD.gn b/chrome/browser/payments/BUILD.gn new file mode 100644 index 0000000..f97970f7 --- /dev/null +++ b/chrome/browser/payments/BUILD.gn
@@ -0,0 +1,76 @@ +# 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("browsertests") { + testonly = true + + sources = [ + "empty_parameters_browsertest.cc", + "has_enrolled_instrument_browsertest.cc", + "has_enrolled_instrument_query_quota_browsertest.cc", + "journey_logger_browsertest.cc", + "payment_handler_change_shipping_address_option_browsertest.cc", + "payment_handler_enable_delegations_browsertest.cc", + "payment_handler_exploit_browsertest.cc", + "payment_handler_just_in_time_installation_browsertest.cc", + "payment_request_can_make_payment_browsertest.cc", + "payment_request_can_make_payment_event_browsertest.cc", + "sec_fetch_site_browsertest.cc", + ] + + defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] + + deps = [ + "//base/test:test_support", + "//chrome/test:test_support", + "//chrome/test/payments:test_support", + "//components/payments/content", + "//components/payments/core:test_support", + "//components/ukm:test_support", + ] + + if (is_android) { + sources += [ + "expandable_payment_handler_browsertest.cc", + "hybrid_request_skip_ui_browsertest.cc", + ] + } + + if (!is_android) { + sources += [ + "manifest_verifier_browsertest.cc", + "payment_manifest_parser_browsertest.cc", + "service_worker_payment_app_finder_browsertest.cc", + "site_per_process_payments_browsertest.cc", + ] + + deps += [ + "//chrome/test:test_support_ui", + "//components/payments/content:utils", + "//components/payments/content/utility", + "//components/permissions:permissions", + ] + } +} + +source_set("unittests") { + testonly = true + + sources = [ "payment_handler_permission_context_unittest.cc" ] + + deps = [ + "//chrome/test:test_support", + "//components/content_settings/core/test:test_support", + "//components/permissions:permissions", + ] + + if (is_android) { + sources += [ + "android/android_payment_app_finder_unittest.cc", + "android/payment_manifest_verifier_unittest.cc", + ] + + deps += [ "//chrome/android:native_j_unittests_jni_headers" ] + } +}
diff --git a/chrome/browser/payments/has_enrolled_instrument_browsertest.cc b/chrome/browser/payments/has_enrolled_instrument_browsertest.cc index 16c1922..1d60f91 100644 --- a/chrome/browser/payments/has_enrolled_instrument_browsertest.cc +++ b/chrome/browser/payments/has_enrolled_instrument_browsertest.cc
@@ -7,8 +7,8 @@ #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "build/build_config.h" -#include "chrome/browser/payments/personal_data_manager_test_util.h" #include "chrome/test/payments/payment_request_platform_browsertest_base.h" +#include "chrome/test/payments/personal_data_manager_test_util.h" #include "components/payments/core/features.h" #include "components/payments/core/journey_logger.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/payments/payment_request_can_make_payment_browsertest.cc b/chrome/browser/payments/payment_request_can_make_payment_browsertest.cc index d70f4a53..cb35801 100644 --- a/chrome/browser/payments/payment_request_can_make_payment_browsertest.cc +++ b/chrome/browser/payments/payment_request_can_make_payment_browsertest.cc
@@ -10,10 +10,10 @@ #include "base/strings/utf_string_conversions.h" #include "base/test/scoped_feature_list.h" #include "chrome/browser/autofill/personal_data_manager_factory.h" -#include "chrome/browser/payments/personal_data_manager_test_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/test/base/chrome_test_utils.h" #include "chrome/test/payments/payment_request_platform_browsertest_base.h" +#include "chrome/test/payments/personal_data_manager_test_util.h" #include "components/autofill/core/browser/autofill_test_utils.h" #include "components/autofill/core/browser/data_model/credit_card.h" #include "components/autofill/core/browser/personal_data_manager.h"
diff --git a/chrome/browser/profiles/profile_metrics.h b/chrome/browser/profiles/profile_metrics.h index 3e52f71..415103e 100644 --- a/chrome/browser/profiles/profile_metrics.h +++ b/chrome/browser/profiles/profile_metrics.h
@@ -85,9 +85,10 @@ NUM_PROFILE_NET_METRICS }; - // Sign in is logged once the user has entered their GAIA information. - // The options for sync are logged after the user has submitted the options - // form. See sync_setup_handler.h. + // The options for sync are logged after the user has changed their sync + // setting. See people_handler.h. + // These values are persisted to logs. Entries should not be renumbered and + // numeric values should never be reused. enum ProfileSync { SYNC_CUSTOMIZE = 0, // User decided to customize sync SYNC_CHOOSE, // User chose what to sync
diff --git a/chrome/browser/renderer_preferences_util.cc b/chrome/browser/renderer_preferences_util.cc index d599d9d4..776c050 100644 --- a/chrome/browser/renderer_preferences_util.cc +++ b/chrome/browser/renderer_preferences_util.cc
@@ -182,7 +182,7 @@ if (::features::IsFormControlsRefreshEnabled()) { #if defined(OS_MACOSX) - prefs->focus_ring_color = SkColorSetRGB(0xCC, 0x5F, 0x00); + prefs->focus_ring_color = SkColorSetRGB(0x00, 0x5F, 0xCC); #else prefs->focus_ring_color = SkColorSetRGB(0x10, 0x10, 0x10); #endif
diff --git a/chrome/browser/resources/chromeos/login/offline_gaia.js b/chrome/browser/resources/chromeos/login/offline_gaia.js index 1bc61fd..78a2e3c 100644 --- a/chrome/browser/resources/chromeos/login/offline_gaia.js +++ b/chrome/browser/resources/chromeos/login/offline_gaia.js
@@ -21,6 +21,7 @@ domain: { type: String, + value: null, }, emailDomain: String,
diff --git a/chrome/browser/resources/chromeos/login/security_token_pin.js b/chrome/browser/resources/chromeos/login/security_token_pin.js index 36ce748a..569f43c 100644 --- a/chrome/browser/resources/chromeos/login/security_token_pin.js +++ b/chrome/browser/resources/chromeos/login/security_token_pin.js
@@ -7,6 +7,14 @@ * sign-in. */ +(function() { + +// Only inform the user about the number of attempts left if it's smaller or +// equal to this constant. (This is a pure UX heuristic.) +// Please keep this constant in sync with the one in +// //chromeos/components/security_token_pin/error_generator.cc. +const ATTEMPTS_LEFT_THRESHOLD = 3; + Polymer({ is: 'security-token-pin', @@ -206,7 +214,8 @@ * @private */ isAttemptsLeftVisible_(parameters) { - return parameters && parameters.attemptsLeft != -1; + return parameters && parameters.attemptsLeft >= 0 && + parameters.attemptsLeft <= ATTEMPTS_LEFT_THRESHOLD; }, /** @@ -245,15 +254,13 @@ // != NONE, so |errorLabelId| will be defined. assert(errorLabelId); // Format the error and, if present, the number of left attempts. - if (parameters && !parameters.enableUserInput) { + if ((parameters && !parameters.enableUserInput) || + !this.isAttemptsLeftVisible_(parameters)) { return this.i18n(errorLabelId); } - if (!this.isAttemptsLeftVisible_(parameters)) { - return this.i18nRecursive( - locale, 'securityTokenPinDialogErrorRetry', errorLabelId); - } return this.i18n( - 'securityTokenPinDialogErrorRetryAttempts', this.i18n(errorLabelId), + 'securityTokenPinDialogErrorAttempts', this.i18n(errorLabelId), parameters.attemptsLeft); }, }); +})();
diff --git a/chrome/browser/resources/settings/autofill_page/BUILD.gn b/chrome/browser/resources/settings/autofill_page/BUILD.gn index ab9cfaa..0bbe17b 100644 --- a/chrome/browser/resources/settings/autofill_page/BUILD.gn +++ b/chrome/browser/resources/settings/autofill_page/BUILD.gn
@@ -92,6 +92,7 @@ js_library("password_check") { deps = [ ":password_manager_proxy", + "..:plural_string_proxy", "//ui/webui/resources/js:i18n_behavior", ] }
diff --git a/chrome/browser/resources/settings/autofill_page/password_check.html b/chrome/browser/resources/settings/autofill_page/password_check.html index 4952d80..34b5e35e 100644 --- a/chrome/browser/resources/settings/autofill_page/password_check.html +++ b/chrome/browser/resources/settings/autofill_page/password_check.html
@@ -3,6 +3,7 @@ <link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html"> <link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html"> <link rel="import" href="../i18n_setup.html"> +<link rel="import" href="../plural_string_proxy.html"> <link rel="import" href="../settings_shared_css.html"> <link rel="import" href="chrome://resources/cr_elements/icons.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> @@ -30,9 +31,8 @@ • [[lastCompletedCheck_]] </span> </div> - <div class="secondary" id="passwordLeakCount" - name="[[passwordLeakCount_]]"> - [[getLeakedPasswordsCount_(passwordLeakCount_)]] + <div class="secondary" id="passwordLeakCount"> + [[compromisedPasswordsCount_]] </div> </div> <cr-button id="controlPasswordCheckButton"
diff --git a/chrome/browser/resources/settings/autofill_page/password_check.js b/chrome/browser/resources/settings/autofill_page/password_check.js index 4ae334c46..f198b03 100644 --- a/chrome/browser/resources/settings/autofill_page/password_check.js +++ b/chrome/browser/resources/settings/autofill_page/password_check.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. +(function() { +'use strict'; + +const CheckState = chrome.passwordsPrivate.PasswordCheckState; + Polymer({ is: 'settings-password-check', @@ -9,15 +14,15 @@ properties: { /** @private */ - passwordLeakCount_: { - type: Number, - value: 0, - }, - - /** @private */ lastCompletedCheck_: String, /** + * The number of compromised passwords as a formatted string. + * @private + */ + compromisedPasswordsCount_: String, + + /** * An array of leaked passwords to display. * @type {!Array<!PasswordManagerProxy.CompromisedCredential>} */ @@ -28,9 +33,27 @@ // load. value: () => [], }, + + /** + * The status indicates progress and affects banner, title and icon. + * @type {!PasswordManagerProxy.PasswordCheckStatus} + * @private + */ + status_: { + type: PasswordManagerProxy.PasswordCheckStatus, + value: () => { + return {state: CheckState.IDLE}; + }, + } }, /** + * @type {?function(!PasswordManagerProxy.PasswordCheckStatus):void} + * @private + */ + statusChangedListener_: null, + + /** * @type {?function(!PasswordManagerProxy.CompromisedCredentialsInfo):void} * @private */ @@ -53,25 +76,39 @@ // Set the manager. These can be overridden by tests. this.passwordManager_ = PasswordManagerImpl.getInstance(); + const statusChangeListener = status => this.status_ = status; const setLeakedCredentialsListener = info => { this.leakedPasswords = info.compromisedCredentials; - this.passwordLeakCount_ = info.compromisedCredentials.length; this.lastCompletedCheck_ = info.elapsedTimeSinceLastCheck; + + settings.PluralStringProxyImpl.getInstance() + .getPluralString('compromisedPasswords', this.leakedPasswords.length) + .then(count => { + this.compromisedPasswordsCount_ = count; + }); }; + this.statusChangedListener_ = statusChangeListener; this.leakedCredentialsListener_ = setLeakedCredentialsListener; // Request initial data. + this.passwordManager_.getPasswordCheckStatus().then( + this.statusChangedListener_); this.passwordManager_.getCompromisedCredentialsInfo().then( this.leakedCredentialsListener_); // Listen for changes. + this.passwordManager_.addPasswordCheckStatusListener( + this.statusChangedListener_); this.passwordManager_.addCompromisedCredentialsListener( this.leakedCredentialsListener_); }, /** @override */ detached() { + this.passwordManager_.removePasswordCheckStatusListener( + assert(this.statusChangedListener_)); + this.statusChangedListener_ = null; this.passwordManager_.removeCompromisedCredentialsListener( assert(this.leakedCredentialsListener_)); this.leakedCredentialsListener_ = null; @@ -88,14 +125,6 @@ }, /** - * @return {string} - * @private - */ - getLeakedPasswordsCount_() { - return this.i18n('checkPasswordLeakCount', this.passwordLeakCount_); - }, - - /** * Returns true if there are any compromised credentials. * @param {!Array<!PasswordManagerProxy.CompromisedCredential>} list * @return {boolean} @@ -136,3 +165,4 @@ // TODO(crbug.com/1047726) Implement dialog. }, }); +})();
diff --git a/chrome/browser/resources/settings/autofill_page/password_check_list_item.html b/chrome/browser/resources/settings/autofill_page/password_check_list_item.html index 105939d..15977ebb 100644 --- a/chrome/browser/resources/settings/autofill_page/password_check_list_item.html +++ b/chrome/browser/resources/settings/autofill_page/password_check_list_item.html
@@ -65,7 +65,8 @@ </div> </div> </div> - <div class="button-container"> + <template is="dom-if" if="[[item.changePasswordUrl]]"> + <div class="button-container" id="changePasswordUrl"> <!-- TODO:(https://crbug.com/1047726) add 'Already changed this password?' link --> <cr-button class="action-button" on-click="onChangePasswordClick_"> $i18n{changePasswordButton} @@ -73,6 +74,10 @@ </iron-icon> </cr-button> </div> + </template> + <template is="dom-if" if="[[!item.changePasswordUrl]]"> + <span id="changePasswordInApp">$i18n{changePasswordInApp}</span> + </template> <cr-icon-button class="icon-more-vert" id="more" title="$i18n{moreActions}" on-click="onMoreClick_"> </cr-icon-button>
diff --git a/chrome/browser/resources/settings/autofill_page/password_manager_proxy.html b/chrome/browser/resources/settings/autofill_page/password_manager_proxy.html index e33c98a3..b5f7328e 100644 --- a/chrome/browser/resources/settings/autofill_page/password_manager_proxy.html +++ b/chrome/browser/resources/settings/autofill_page/password_manager_proxy.html
@@ -1,2 +1,2 @@ <link rel="import" href="chrome://resources/html/polymer.html"> -<script src="password_manager_proxy.js"></script> \ No newline at end of file +<script src="password_manager_proxy.js"></script>
diff --git a/chrome/browser/resources/settings/autofill_page/password_manager_proxy.js b/chrome/browser/resources/settings/autofill_page/password_manager_proxy.js index 14bfe1b6..503c919 100644 --- a/chrome/browser/resources/settings/autofill_page/password_manager_proxy.js +++ b/chrome/browser/resources/settings/autofill_page/password_manager_proxy.js
@@ -161,6 +161,12 @@ getCompromisedCredentialsInfo() {} /** + * Returns the current status of the check via |callback|. + * @return {!Promise<(PasswordManagerProxy.PasswordCheckStatus)>} + */ + getPasswordCheckStatus() {} + + /** * Add an observer to the compromised passwords change. * @param {function(!PasswordManagerProxy.CompromisedCredentialsInfo):void} * listener @@ -173,6 +179,18 @@ * listener */ removeCompromisedCredentialsListener(listener) {} + + /** + * Remove an observer to the compromised passwords change. + * @param {function(!PasswordManagerProxy.PasswordCheckStatus):void} listener + */ + addPasswordCheckStatusListener(listener) {} + + /** + * Remove an observer to the compromised passwords change. + * @param {function(!PasswordManagerProxy.PasswordCheckStatus):void} listener + */ + removePasswordCheckStatusListener(listener) {} } /** @typedef {chrome.passwordsPrivate.PasswordUiEntry} */ @@ -198,6 +216,9 @@ /** @typedef {chrome.passwordsPrivate.CompromisedCredentialsInfo} */ PasswordManagerProxy.CompromisedCredentialsInfo; +/** @typedef {chrome.passwordsPrivate.PasswordCheckStatus} */ +PasswordManagerProxy.PasswordCheckStatus; + /** * Implementation that accesses the private API. * @implements {PasswordManagerProxy} @@ -322,6 +343,13 @@ } /** @override */ + getPasswordCheckStatus() { + return new Promise(resolve => { + chrome.passwordsPrivate.getPasswordCheckStatus(resolve); + }); + } + + /** @override */ startBulkPasswordCheck() { chrome.passwordsPrivate.startPasswordCheck(); } @@ -344,6 +372,17 @@ chrome.passwordsPrivate.onCompromisedCredentialsInfoChanged.removeListener( listener); } + + /** @override */ + addPasswordCheckStatusListener(listener) { + chrome.passwordsPrivate.onPasswordCheckStatusChanged.addListener(listener); + } + + /** @override */ + removePasswordCheckStatusListener(listener) { + chrome.passwordsPrivate.onPasswordCheckStatusChanged.removeListener( + listener); + } } cr.addSingletonGetter(PasswordManagerImpl);
diff --git a/chrome/browser/resources/settings/people_page/sync_controls.html b/chrome/browser/resources/settings/people_page/sync_controls.html index 7a1f558..b388c24 100644 --- a/chrome/browser/resources/settings/people_page/sync_controls.html +++ b/chrome/browser/resources/settings/people_page/sync_controls.html
@@ -24,15 +24,6 @@ .list-item > div { flex: 1; } - - cr-radio-button[name='sync-everything'] > .secondary { - border-bottom: var(--cr-separator-line); - padding-bottom: var(--cr-section-vertical-padding); - } - - cr-radio-button[name='customize-sync'] { - padding-top: var(--cr-section-vertical-padding); - } </style> <template is="dom-if" if="[[!syncSetupFriendlySettings_]]"> @@ -55,11 +46,9 @@ on-selected-changed="onSyncDataRadioSelectionChanged_"> <cr-radio-button name="sync-everything"> $i18n{syncEverythingCheckboxLabel} - <div class="secondary">$i18n{syncEverythingHint}</div> </cr-radio-button> <cr-radio-button name="customize-sync"> $i18n{customizeSyncLabel} - <div class="secondary">$i18n{customizeSyncHint}</div> </cr-radio-button> </cr-radio-group> </div>
diff --git a/chrome/browser/resources/settings/safety_check_page/safety_check_browser_proxy.js b/chrome/browser/resources/settings/safety_check_page/safety_check_browser_proxy.js index 9be718b..7bb2657 100644 --- a/chrome/browser/resources/settings/safety_check_page/safety_check_browser_proxy.js +++ b/chrome/browser/resources/settings/safety_check_page/safety_check_browser_proxy.js
@@ -64,11 +64,11 @@ const SafetyCheckExtensionsStatus = { CHECKING: 0, ERROR: 1, - NO_BLACKLISTED_EXTENSIONS: 2, - BLACKLISTED_ALL_DISABLED: 3, - BLACKLISTED_REENABLED_ALL_BY_USER: 4, - BLACKLISTED_REENABLED_SOME_BY_USER: 5, - BLACKLISTED_REENABLED_ALL_BY_ADMIN: 6, + NO_BLOCKLISTED_EXTENSIONS: 2, + BLOCKLISTED_ALL_DISABLED: 3, + BLOCKLISTED_REENABLED_ALL_BY_USER: 4, + BLOCKLISTED_REENABLED_SOME_BY_USER: 5, + BLOCKLISTED_REENABLED_ALL_BY_ADMIN: 6, }; /** @interface */
diff --git a/chrome/browser/resources/settings/safety_check_page/safety_check_page.html b/chrome/browser/resources/settings/safety_check_page/safety_check_page.html index b1379da..87358c1 100644 --- a/chrome/browser/resources/settings/safety_check_page/safety_check_page.html +++ b/chrome/browser/resources/settings/safety_check_page/safety_check_page.html
@@ -51,7 +51,8 @@ } } </style> - <div class="settings-box first two-line"> + <div id="safetyCheckParent" class="settings-box first two-line" tabindex="0" + aria-label="[[getParentAriaLabel_(parentStatus_)]]"> <iron-icon icon="[[getParentIcon_(parentStatus_)]]" src="[[getParentIconSrc_(parentStatus_)]]" class$="[[getParentIconClass_(parentStatus_)]]"> @@ -63,7 +64,8 @@ restamp> <div class="separator"></div> <cr-button id="safetyCheckParentButton" class="action-button" - on-click="onRunSafetyCheckClick_" no-search> + on-click="onRunSafetyCheckClick_" no-search + aria-label="$i18n{safetyCheckParentButtonAriaLabel}"> $i18n{safetyCheckParentButton} </cr-button> </template> @@ -72,13 +74,15 @@ <div class="separator"></div> <cr-icon-button id="safetyCheckParentIconButton" iron-icon="settings:refresh" - on-click="onRunSafetyCheckClick_"> + on-click="onRunSafetyCheckClick_" + aria-label="$i18n{safetyCheckParentButtonAriaLabel}"> </cr-icon-button> </template> </div> <iron-collapse id="safetyCheckCollapse" opened="[[shouldShowChildren_(parentStatus_)]]"> - <div class="settings-box two-line"> + <div class="settings-box two-line" tabindex="0" + aria-label="[[getUpdatesAriaLabel_(updatesStatus_)]]"> <iron-icon icon="[[getUpdatesIcon_(updatesStatus_)]]" src="[[getUpdatesIconSrc_(updatesStatus_)]]" class$="[[getUpdatesIconClass_(updatesStatus_)]]"> @@ -93,7 +97,8 @@ if="[[shouldShowUpdatesButton_(updatesStatus_)]]" restamp> <div class="separator"></div> <cr-button id="safetyCheckUpdatesButton" class="action-button" - on-click="onSafetyCheckUpdatesButtonClicked_" no-search> + on-click="onSafetyCheckUpdatesButtonClicked_" no-search + aria-label="$i18n{safetyCheckUpdatesButtonAriaLabel}"> $i18n{aboutRelaunch} </cr-button> </template> @@ -104,7 +109,8 @@ </iron-icon> </template> </div> - <div class="settings-box two-line"> + <div class="settings-box two-line" tabindex="0" + aria-label="[[getPasswordsAriaLabel_(passwordsStatus_)]]"> <iron-icon icon="[[getPasswordsIcon_(passwordsStatus_)]]" src="[[getPasswordsIconSrc_(passwordsStatus_)]]" class$="[[getPasswordsIconClass_(passwordsStatus_)]]"> @@ -119,12 +125,14 @@ if="[[shouldShowPasswordsButton_(passwordsStatus_)]]" restamp> <div class="separator"></div> <cr-button id="safetyCheckPasswordsButton" class="action-button" - on-click="onPasswordsButtonClick_" no-search> + on-click="onPasswordsButtonClick_" no-search + aria-label="$i18n{safetyCheckPasswordsButton}"> $i18n{safetyCheckPasswordsButton} </cr-button> </template> </div> - <div class="settings-box two-line"> + <div class="settings-box two-line" tabindex="0" + aria-label="[[getSafeBrowsingAriaLabel_(safeBrowsingStatus_)]]"> <iron-icon icon="[[getSafeBrowsingIcon_(safeBrowsingStatus_)]]" src="[[getSafeBrowsingIconSrc_(safeBrowsingStatus_)]]" class$="[[getSafeBrowsingIconClass_(safeBrowsingStatus_)]]"> @@ -139,7 +147,8 @@ if="[[shouldShowSafeBrowsingButton_(safeBrowsingStatus_)]]" restamp> <div class="separator"></div> <cr-button id="safetyCheckSafeBrowsingButton" class="action-button" - on-click="onSafeBrowsingButtonClick_" no-search> + on-click="onSafeBrowsingButtonClick_" no-search + aria-label="$i18n{safetyCheckSafeBrowsingButtonAriaLabel}"> $i18n{safetyCheckSafeBrowsingButton} </cr-button> </template> @@ -150,7 +159,8 @@ </iron-icon> </template> </div> - <div class="settings-box two-line"> + <div class="settings-box two-line" tabindex="0" + aria-label="[[getExtensionsAriaLabel_(extensionsStatus_)]]"> <iron-icon icon="[[getExtensionsIcon_(extensionsStatus_)]]" src="[[getExtensionsIconSrc_(extensionsStatus_)]]" class$="[[getExtensionsIconClass_(extensionsStatus_)]]"> @@ -166,7 +176,8 @@ <div class="separator"></div> <cr-button id="safetyCheckExtensionsButton" class$="[[getExtensionsButtonClass_(extensionsStatus_)]]" - on-click="onSafetyCheckExtensionsButtonClicked_" no-search> + on-click="onSafetyCheckExtensionsButtonClicked_" no-search + aria-label="$i18n{safetyCheckExtensionsButtonAriaLabel}"> $i18n{safetyCheckExtensionsButton} </cr-button> </template>
diff --git a/chrome/browser/resources/settings/safety_check_page/safety_check_page.js b/chrome/browser/resources/settings/safety_check_page/safety_check_page.js index c1e42e4d..199b8d5 100644 --- a/chrome/browser/resources/settings/safety_check_page/safety_check_page.js +++ b/chrome/browser/resources/settings/safety_check_page/safety_check_page.js
@@ -310,6 +310,7 @@ /** @private */ onRunSafetyCheckClick_: function() { this.runSafetyCheck_(); + this.focusParent_(); }, /** @@ -331,6 +332,21 @@ /** * @private + * @return {string} + */ + getParentAriaLabel_: function() { + return this.i18n('safetyCheckSectionTitle') + ': ' + + this.getParentPrimaryLabelText_(); + }, + + /** @private */ + focusParent_() { + const parent = /** @type {!Element} */ (this.$$('#safetyCheckParent')); + parent.focus(); + }, + + /** + * @private * @return {boolean} */ shouldShowChildren_: function() { @@ -439,6 +455,15 @@ /** * @private + * @return {string} + */ + getUpdatesAriaLabel_: function() { + return this.i18n('safetyCheckUpdatesPrimaryLabel') + ': ' + + this.getUpdatesSubLabelText_(); + }, + + /** + * @private * @return {boolean} */ shouldShowPasswordsButton_: function() { @@ -472,6 +497,15 @@ /** * @private + * @return {string} + */ + getPasswordsAriaLabel_: function() { + return this.i18n('passwords') + ': ' + this.passwordsDisplayString_; + }, + + + /** + * @private * @return {?string} */ getPasswordsIconSrc_: function() { @@ -598,6 +632,15 @@ } }, + /** + * @private + * @return {string} + */ + getSafeBrowsingAriaLabel_: function() { + return this.i18n('safeBrowsingSectionLabel') + ': ' + + this.getSafeBrowsingSubLabelText_(); + }, + /** @private */ onSafeBrowsingButtonClick_: function() { settings.Router.getInstance().navigateTo(settings.routes.SECURITY); @@ -609,11 +652,11 @@ */ shouldShowExtensionsButton_: function() { switch (this.extensionsStatus_) { - case settings.SafetyCheckExtensionsStatus.BLACKLISTED_ALL_DISABLED: + case settings.SafetyCheckExtensionsStatus.BLOCKLISTED_ALL_DISABLED: case settings.SafetyCheckExtensionsStatus - .BLACKLISTED_REENABLED_ALL_BY_USER: + .BLOCKLISTED_REENABLED_ALL_BY_USER: case settings.SafetyCheckExtensionsStatus - .BLACKLISTED_REENABLED_SOME_BY_USER: + .BLOCKLISTED_REENABLED_SOME_BY_USER: return true; default: return false; @@ -626,7 +669,7 @@ */ shouldShowExtensionsManagedIcon_: function() { return this.extensionsStatus_ == - settings.SafetyCheckExtensionsStatus.BLACKLISTED_REENABLED_ALL_BY_ADMIN; + settings.SafetyCheckExtensionsStatus.BLOCKLISTED_REENABLED_ALL_BY_ADMIN; }, /** @private */ @@ -644,15 +687,15 @@ return null; case settings.SafetyCheckExtensionsStatus.ERROR: case settings.SafetyCheckExtensionsStatus - .BLACKLISTED_REENABLED_ALL_BY_ADMIN: + .BLOCKLISTED_REENABLED_ALL_BY_ADMIN: return 'cr:info'; - case settings.SafetyCheckExtensionsStatus.NO_BLACKLISTED_EXTENSIONS: - case settings.SafetyCheckExtensionsStatus.BLACKLISTED_ALL_DISABLED: + case settings.SafetyCheckExtensionsStatus.NO_BLOCKLISTED_EXTENSIONS: + case settings.SafetyCheckExtensionsStatus.BLOCKLISTED_ALL_DISABLED: return 'cr:check'; case settings.SafetyCheckExtensionsStatus - .BLACKLISTED_REENABLED_ALL_BY_USER: + .BLOCKLISTED_REENABLED_ALL_BY_USER: case settings.SafetyCheckExtensionsStatus - .BLACKLISTED_REENABLED_SOME_BY_USER: + .BLOCKLISTED_REENABLED_SOME_BY_USER: return 'cr:warning'; default: assertNotReached(); @@ -679,13 +722,13 @@ getExtensionsIconClass_: function() { switch (this.extensionsStatus_) { case settings.SafetyCheckExtensionsStatus.CHECKING: - case settings.SafetyCheckExtensionsStatus.NO_BLACKLISTED_EXTENSIONS: - case settings.SafetyCheckExtensionsStatus.BLACKLISTED_ALL_DISABLED: + case settings.SafetyCheckExtensionsStatus.NO_BLOCKLISTED_EXTENSIONS: + case settings.SafetyCheckExtensionsStatus.BLOCKLISTED_ALL_DISABLED: return 'icon-blue'; case settings.SafetyCheckExtensionsStatus - .BLACKLISTED_REENABLED_ALL_BY_USER: + .BLOCKLISTED_REENABLED_ALL_BY_USER: case settings.SafetyCheckExtensionsStatus - .BLACKLISTED_REENABLED_SOME_BY_USER: + .BLOCKLISTED_REENABLED_SOME_BY_USER: return 'icon-red'; default: return ''; @@ -696,12 +739,21 @@ * @private * @return {string} */ + getExtensionsAriaLabel_: function() { + return this.i18n('safetyCheckExtensionsPrimaryLabel') + ': ' + + this.extensionsDisplayString_; + }, + + /** + * @private + * @return {string} + */ getExtensionsButtonClass_: function() { switch (this.extensionsStatus_) { case settings.SafetyCheckExtensionsStatus - .BLACKLISTED_REENABLED_ALL_BY_USER: + .BLOCKLISTED_REENABLED_ALL_BY_USER: case settings.SafetyCheckExtensionsStatus - .BLACKLISTED_REENABLED_SOME_BY_USER: + .BLOCKLISTED_REENABLED_SOME_BY_USER: return 'action-button'; default: return '';
diff --git a/chrome/browser/sync/test/integration/single_client_user_events_sync_test.cc b/chrome/browser/sync/test/integration/single_client_user_events_sync_test.cc index bdefbf76..2fcf761 100644 --- a/chrome/browser/sync/test/integration/single_client_user_events_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_user_events_sync_test.cc
@@ -225,6 +225,8 @@ // Clear the "Sync paused" state again. GetClient(0)->ExitSyncPausedStateForPrimaryAccount(); + // Once the auth error is gone, wait for Sync to start up again. + GetClient(0)->AwaitSyncSetupCompletion(); ASSERT_TRUE(GetSyncService(0)->IsSyncFeatureActive()); // Just checking that we don't see test_event isn't very convincing yet,
diff --git a/chrome/browser/ui/blocked_content/popup_blocker_tab_helper.cc b/chrome/browser/ui/blocked_content/popup_blocker_tab_helper.cc index 5f7c7f3..29c396c 100644 --- a/chrome/browser/ui/blocked_content/popup_blocker_tab_helper.cc +++ b/chrome/browser/ui/blocked_content/popup_blocker_tab_helper.cc
@@ -141,7 +141,8 @@ #endif if (popup->params.navigated_or_inserted_contents) { auto* tracker = PopupTracker::CreateForWebContents( - popup->params.navigated_or_inserted_contents, web_contents()); + popup->params.navigated_or_inserted_contents, web_contents(), + popup->params.disposition); tracker->set_is_trusted(true); if (popup->params.disposition == WindowOpenDisposition::NEW_POPUP) {
diff --git a/chrome/browser/ui/blocked_content/popup_opener_tab_helper_unittest.cc b/chrome/browser/ui/blocked_content/popup_opener_tab_helper_unittest.cc index 7f325324..320c8af 100644 --- a/chrome/browser/ui/blocked_content/popup_opener_tab_helper_unittest.cc +++ b/chrome/browser/ui/blocked_content/popup_opener_tab_helper_unittest.cc
@@ -35,6 +35,7 @@ #include "services/metrics/public/cpp/ukm_builders.h" #include "services/metrics/public/cpp/ukm_source.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/window_open_disposition.h" #include "url/gurl.h" #if defined(OS_ANDROID) @@ -96,7 +97,8 @@ content::WebContents* raw_popup = popup.get(); popups_.push_back(std::move(popup)); - PopupTracker::CreateForWebContents(raw_popup, web_contents() /* opener */); + PopupTracker::CreateForWebContents(raw_popup, web_contents() /* opener */, + WindowOpenDisposition::NEW_POPUP); web_contents()->WasHidden(); raw_popup->WasShown(); return raw_popup;
diff --git a/chrome/browser/ui/blocked_content/popup_tracker.cc b/chrome/browser/ui/blocked_content/popup_tracker.cc index bd930481..6d3ba7d 100644 --- a/chrome/browser/ui/blocked_content/popup_tracker.cc +++ b/chrome/browser/ui/blocked_content/popup_tracker.cc
@@ -16,13 +16,15 @@ #include "services/metrics/public/cpp/ukm_builders.h" #include "services/metrics/public/cpp/ukm_recorder.h" -PopupTracker* PopupTracker::CreateForWebContents(content::WebContents* contents, - content::WebContents* opener) { +PopupTracker* PopupTracker::CreateForWebContents( + content::WebContents* contents, + content::WebContents* opener, + WindowOpenDisposition disposition) { DCHECK(contents); DCHECK(opener); auto* tracker = FromWebContents(contents); if (!tracker) { - tracker = new PopupTracker(contents, opener); + tracker = new PopupTracker(contents, opener, disposition); contents->SetUserData(UserDataKey(), base::WrapUnique(tracker)); } return tracker; @@ -31,13 +33,15 @@ PopupTracker::~PopupTracker() = default; PopupTracker::PopupTracker(content::WebContents* contents, - content::WebContents* opener) + content::WebContents* opener, + WindowOpenDisposition disposition) : content::WebContentsObserver(contents), scoped_observer_(this), visibility_tracker_( base::DefaultTickClock::GetInstance(), contents->GetVisibility() != content::Visibility::HIDDEN), - opener_source_id_(ukm::GetSourceIdForWebContentsDocument(opener)) { + opener_source_id_(ukm::GetSourceIdForWebContentsDocument(opener)), + window_open_disposition_(disposition) { if (auto* popup_opener = PopupOpenerTabHelper::FromWebContents(opener)) popup_opener->OnOpenedPopup(this); @@ -83,6 +87,7 @@ .SetTrusted(is_trusted_) .SetNumInteractions(capped_interactions) .SetSafeBrowsingStatus(static_cast<int>(safe_browsing_status_)) + .SetWindowOpenDisposition(static_cast<int>(window_open_disposition_)) .Record(ukm::UkmRecorder::Get()); } }
diff --git a/chrome/browser/ui/blocked_content/popup_tracker.h b/chrome/browser/ui/blocked_content/popup_tracker.h index e693471..088e122 100644 --- a/chrome/browser/ui/blocked_content/popup_tracker.h +++ b/chrome/browser/ui/blocked_content/popup_tracker.h
@@ -15,6 +15,7 @@ #include "content/public/browser/web_contents_user_data.h" #include "services/metrics/public/cpp/ukm_source_id.h" #include "ui/base/scoped_visibility_tracker.h" +#include "ui/base/window_open_disposition.h" namespace content { class WebContents; @@ -38,7 +39,8 @@ }; static PopupTracker* CreateForWebContents(content::WebContents* contents, - content::WebContents* opener); + content::WebContents* opener, + WindowOpenDisposition disposition); ~PopupTracker() override; void set_is_trusted(bool is_trusted) { is_trusted_ = is_trusted; } @@ -46,7 +48,9 @@ private: friend class content::WebContentsUserData<PopupTracker>; - PopupTracker(content::WebContents* contents, content::WebContents* opener); + PopupTracker(content::WebContents* contents, + content::WebContents* opener, + WindowOpenDisposition disposition); // content::WebContentsObserver: void WebContentsDestroyed() override; @@ -89,6 +93,9 @@ PopupSafeBrowsingStatus safe_browsing_status_ = PopupSafeBrowsingStatus::kNoValue; + // The window open disposition used when creating the popup. + const WindowOpenDisposition window_open_disposition_; + WEB_CONTENTS_USER_DATA_KEY_DECL(); DISALLOW_COPY_AND_ASSIGN(PopupTracker);
diff --git a/chrome/browser/ui/blocked_content/popup_tracker_browsertest.cc b/chrome/browser/ui/blocked_content/popup_tracker_browsertest.cc index a374cd5..ec6c537 100644 --- a/chrome/browser/ui/blocked_content/popup_tracker_browsertest.cc +++ b/chrome/browser/ui/blocked_content/popup_tracker_browsertest.cc
@@ -50,6 +50,7 @@ const char kUkmTrusted[] = "Trusted"; const char kUkmNumInteractions[] = "NumInteractions"; const char kUkmSafeBrowsingStatus[] = "SafeBrowsingStatus"; +const char kUkmWindowOpenDisposition[] = "WindowOpenDisposition"; } // namespace using UkmEntry = ukm::builders::Popup_Closed; @@ -476,3 +477,66 @@ static_cast<int>(PopupTracker::PopupSafeBrowsingStatus::kUnsafe)); } } + +IN_PROC_BROWSER_TEST_F(PopupTrackerBrowserTest, PopupInTab_IsWindowFalse) { + const GURL first_url = embedded_test_server()->GetURL("/title1.html"); + ui_test_utils::NavigateToURL(browser(), first_url); + + content::TestNavigationObserver navigation_observer(nullptr, 1); + navigation_observer.StartWatchingNewWebContents(); + + EXPECT_TRUE( + content::ExecJs(browser()->tab_strip_model()->GetActiveWebContents(), + "window.open('/title1.html')")); + navigation_observer.Wait(); + + EXPECT_EQ(2, browser()->tab_strip_model()->count()); + content::WebContents* popup = + browser()->tab_strip_model()->GetActiveWebContents(); + EXPECT_TRUE(PopupTracker::FromWebContents(popup)); + + // Close the popup and check metric. + int active_index = browser()->tab_strip_model()->active_index(); + content::WebContentsDestroyedWatcher destroyed_watcher(popup); + browser()->tab_strip_model()->CloseWebContentsAt( + active_index, TabStripModel::CLOSE_USER_GESTURE); + destroyed_watcher.Wait(); + + auto* entry = ExpectAndGetEntry(first_url); + test_ukm_recorder_->ExpectEntryMetric( + entry, kUkmWindowOpenDisposition, + static_cast<int>(WindowOpenDisposition::NEW_FOREGROUND_TAB)); +} + +IN_PROC_BROWSER_TEST_F(PopupTrackerBrowserTest, PopupInWindow_IsWindowTrue) { + const GURL first_url = embedded_test_server()->GetURL("/title1.html"); + ui_test_utils::NavigateToURL(browser(), first_url); + + content::TestNavigationObserver navigation_observer(nullptr, 1); + navigation_observer.StartWatchingNewWebContents(); + EXPECT_TRUE(content::ExecJs( + browser()->tab_strip_model()->GetActiveWebContents(), + "window.open('/title1.html', 'new_window', " + "'location=yes,height=570,width=520,scrollbars=yes,status=yes')")); + navigation_observer.Wait(); + EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); + + Browser* created_browser = chrome::FindLastActive(); + + EXPECT_EQ(1, created_browser->tab_strip_model()->count()); + content::WebContents* popup = + created_browser->tab_strip_model()->GetActiveWebContents(); + EXPECT_TRUE(PopupTracker::FromWebContents(popup)); + + // Close the popup and check metric. + int active_index = created_browser->tab_strip_model()->active_index(); + content::WebContentsDestroyedWatcher destroyed_watcher(popup); + created_browser->tab_strip_model()->CloseWebContentsAt( + active_index, TabStripModel::CLOSE_USER_GESTURE); + destroyed_watcher.Wait(); + + auto* entry = ExpectAndGetEntry(first_url); + test_ukm_recorder_->ExpectEntryMetric( + entry, kUkmWindowOpenDisposition, + static_cast<int>(WindowOpenDisposition::NEW_POPUP)); +}
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 8bab3bd2..eb80c2e 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc
@@ -1663,7 +1663,7 @@ if (is_popup && nav_params.navigated_or_inserted_contents) { auto* tracker = PopupTracker::CreateForWebContents( - nav_params.navigated_or_inserted_contents, source); + nav_params.navigated_or_inserted_contents, source, params.disposition); tracker->set_is_trusted(params.triggering_event_info != blink::TriggeringEventInfo::kFromUntrustedEvent); } @@ -1725,7 +1725,7 @@ // At this point the |new_contents| is beyond the popup blocker, but we use // the same logic for determining if the popup tracker needs to be attached. if (source && ConsiderForPopupBlocking(disposition)) - PopupTracker::CreateForWebContents(new_contents.get(), source); + PopupTracker::CreateForWebContents(new_contents.get(), source, disposition); chrome::AddWebContents(this, source, std::move(new_contents), disposition, initial_rect);
diff --git a/chrome/browser/ui/chrome_pages.cc b/chrome/browser/ui/chrome_pages.cc index cf81d06..54e84ee 100644 --- a/chrome/browser/ui/chrome_pages.cc +++ b/chrome/browser/ui/chrome_pages.cc
@@ -449,6 +449,11 @@ ShowSettingsSubPage(browser, kPasswordManagerSubPage); } +void ShowPasswordCheck(Browser* browser) { + base::RecordAction(UserMetricsAction("Options_ShowPasswordCheck")); + ShowSettingsSubPage(browser, kPasswordCheckSubPage); +} + void ShowImportDialog(Browser* browser) { base::RecordAction(UserMetricsAction("Import_ShowDlg")); ShowSettingsSubPage(browser, kImportDataSubPage);
diff --git a/chrome/browser/ui/chrome_pages.h b/chrome/browser/ui/chrome_pages.h index 4fcd83c3..9022072 100644 --- a/chrome/browser/ui/chrome_pages.h +++ b/chrome/browser/ui/chrome_pages.h
@@ -125,6 +125,7 @@ const std::string& sub_page); void ShowClearBrowsingDataDialog(Browser* browser); void ShowPasswordManager(Browser* browser); +void ShowPasswordCheck(Browser* browser); void ShowImportDialog(Browser* browser); void ShowAboutChrome(Browser* browser); void ShowSearchEngineSettings(Browser* browser);
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc index f82c46f..adedcf5 100644 --- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc +++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
@@ -42,6 +42,7 @@ #include "components/password_manager/core/browser/password_ui_utils.h" #include "components/password_manager/core/browser/statistics_table.h" #include "components/password_manager/core/common/credential_manager_types.h" +#include "components/password_manager/core/common/password_manager_features.h" #include "components/signin/public/identity_manager/identity_manager.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/web_contents.h" @@ -493,8 +494,14 @@ } void ManagePasswordsUIController::NavigateToPasswordCheckup() { - NavigateToPasswordCheckupPage( - Profile::FromBrowserContext(web_contents()->GetBrowserContext())); + if (base::FeatureList::IsEnabled( + password_manager::features::kPasswordCheck)) { + chrome::ShowPasswordCheck( + chrome::FindBrowserWithWebContents(web_contents())); + } else { + NavigateToPasswordCheckupPage( + Profile::FromBrowserContext(web_contents()->GetBrowserContext())); + } } void ManagePasswordsUIController::EnableSync(const AccountInfo& account,
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc index a8fb327..c7dbf1e 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc +++ b/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc
@@ -514,7 +514,7 @@ sync_harness()->EnterSyncPausedStateForPrimaryAccount(); // Check that the setup was successful. ASSERT_TRUE(identity_manager()->HasPrimaryAccount()); - ASSERT_FALSE(sync_service()->HasDisableReason( + ASSERT_TRUE(sync_service()->HasDisableReason( syncer::SyncService::DISABLE_REASON_PAUSED)); RunTest();
diff --git a/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc index 244bfc2..491031f 100644 --- a/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc
@@ -127,6 +127,13 @@ SetLaunchText( l10n_util::GetStringUTF8(GetProgressMessageFromState(state_))); } + + // When we are asked to initialize network, we should remember that this app + // requires network. + if (state_ == AppLaunchState::APP_LAUNCH_STATE_PREPARING_NETWORK) { + network_required_ = true; + } + UpdateState(NetworkError::ERROR_REASON_UPDATE); } @@ -135,13 +142,14 @@ } void AppLaunchSplashScreenHandler::ShowNetworkConfigureUI() { + network_config_shown_ = true; + NetworkStateInformer::State state = network_state_informer_->state(); - if (state == NetworkStateInformer::ONLINE) { - online_state_ = true; - if (!network_config_requested_) { - delegate_->OnNetworkStateChanged(true); - return; - } + + // We should not block users when the network was not required by the + // controller. + if (!network_required_) { + state = NetworkStateInformer::ONLINE; } const std::string network_path = network_state_informer_->network_path(); @@ -197,16 +205,16 @@ void AppLaunchSplashScreenHandler::UpdateState( NetworkError::ErrorReason reason) { - if (!delegate_ || (state_ != APP_LAUNCH_STATE_PREPARING_NETWORK && - state_ != APP_LAUNCH_STATE_NETWORK_WAIT_TIMEOUT)) { + if (!delegate_) return; - } - bool new_online_state = network_state_informer_->state() == NetworkStateInformer::ONLINE; delegate_->OnNetworkStateChanged(new_online_state); - online_state_ = new_online_state; + // Redraw network configure UI when the network state changes. + if (network_config_shown_) { + ShowNetworkConfigureUI(); + } } void AppLaunchSplashScreenHandler::PopulateAppInfo( @@ -233,6 +241,8 @@ int AppLaunchSplashScreenHandler::GetProgressMessageFromState( AppLaunchState state) { switch (state) { + case APP_LAUNCH_STATE_PREPARING_PROFILE: + return IDS_APP_START_PREPARING_PROFILE_MESSAGE; case APP_LAUNCH_STATE_PREPARING_NETWORK: return IDS_APP_START_NETWORK_WAIT_MESSAGE; case APP_LAUNCH_STATE_INSTALLING_APPLICATION: @@ -264,21 +274,18 @@ } void AppLaunchSplashScreenHandler::HandleNetworkConfigRequested() { - if (!delegate_ || network_config_done_) + if (!delegate_) return; - - network_config_requested_ = true; delegate_->OnNetworkConfigRequested(); } void AppLaunchSplashScreenHandler::HandleContinueAppLaunch() { - DCHECK(online_state_); - if (delegate_ && online_state_) { - network_config_requested_ = false; - network_config_done_ = true; - delegate_->OnNetworkConfigFinished(); - Show(); - } + if (!delegate_) + return; + + network_config_shown_ = false; + delegate_->OnNetworkConfigFinished(); + Show(); } } // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.h index 1197a7e..b34bb34 100644 --- a/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.h
@@ -45,6 +45,7 @@ }; enum AppLaunchState { + APP_LAUNCH_STATE_PREPARING_PROFILE, APP_LAUNCH_STATE_PREPARING_NETWORK, APP_LAUNCH_STATE_INSTALLING_APPLICATION, APP_LAUNCH_STATE_WAITING_APP_WINDOW, @@ -125,19 +126,15 @@ Delegate* delegate_ = nullptr; bool show_on_init_ = false; - AppLaunchState state_ = APP_LAUNCH_STATE_PREPARING_NETWORK; + AppLaunchState state_ = APP_LAUNCH_STATE_PREPARING_PROFILE; scoped_refptr<NetworkStateInformer> network_state_informer_; ErrorScreen* error_screen_; - // True if we are online. - bool online_state_ = false; - - // True if we have network config screen was already shown before. - bool network_config_done_ = false; - - // True if we have manually requested network config screen. - bool network_config_requested_ = false; + // Whether network configure UI is being shown. + bool network_config_shown_ = false; + // Whether the network is required in order to proceed with app launch. + bool network_required_ = false; DISALLOW_COPY_AND_ASSIGN(AppLaunchSplashScreenHandler); };
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc index fc3f52cf..186a788 100644 --- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
@@ -64,6 +64,7 @@ #include "chrome/common/pref_names.h" #include "chrome/grit/generated_resources.h" #include "chrome/installer/util/google_update_settings.h" +#include "chromeos/components/security_token_pin/constants.h" #include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_switches.h" #include "chromeos/constants/devicetype.h" @@ -676,10 +677,8 @@ IDS_SAML_SECURITY_TOKEN_PIN_DIALOG_TRY_AGAIN); builder->Add("securityTokenPinDialogAttemptsLeft", IDS_REQUEST_PIN_DIALOG_ATTEMPTS_LEFT); - builder->Add("securityTokenPinDialogErrorRetry", - IDS_REQUEST_PIN_DIALOG_ERROR_RETRY); - builder->Add("securityTokenPinDialogErrorRetryAttempts", - IDS_REQUEST_PIN_DIALOG_ERROR_RETRY_ATTEMPTS); + builder->Add("securityTokenPinDialogErrorAttempts", + IDS_REQUEST_PIN_DIALOG_ERROR_ATTEMPTS); builder->Add("securityTokenPinDialogUnknownError", IDS_REQUEST_PIN_DIALOG_UNKNOWN_ERROR); builder->Add("securityTokenPinDialogUnknownInvalidPin",
diff --git a/chrome/browser/ui/webui/policy_ui_handler.cc b/chrome/browser/ui/webui/policy_ui_handler.cc index 6cc6a9f..b84b5b670 100644 --- a/chrome/browser/ui/webui/policy_ui_handler.cc +++ b/chrome/browser/ui/webui/policy_ui_handler.cc
@@ -153,6 +153,17 @@ return status; } +base::string16 GetTimeSinceLastRefreshString(base::Time last_refresh_time) { + if (last_refresh_time.is_null()) + return l10n_util::GetStringUTF16(IDS_POLICY_NEVER_FETCHED); + base::Time now = base::Time::NowFromSystemTime(); + base::TimeDelta elapsed_time; + if (now > last_refresh_time) + elapsed_time = now - last_refresh_time; + return ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_ELAPSED, + ui::TimeFormat::LENGTH_SHORT, elapsed_time); +} + void GetStatusFromCore(const policy::CloudPolicyCore* core, base::DictionaryValue* dict) { const policy::CloudPolicyStore* store = core->store(); @@ -195,13 +206,8 @@ "refreshInterval", ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_DURATION, ui::TimeFormat::LENGTH_SHORT, refresh_interval)); - dict->SetString( - "timeSinceLastRefresh", - last_refresh_time.is_null() - ? l10n_util::GetStringUTF16(IDS_POLICY_NEVER_FETCHED) - : ui::TimeFormat::Simple( - ui::TimeFormat::FORMAT_ELAPSED, ui::TimeFormat::LENGTH_SHORT, - base::Time::NowFromSystemTime() - last_refresh_time)); + dict->SetString("timeSinceLastRefresh", + GetTimeSinceLastRefreshString(last_refresh_time)); } #if defined(OS_CHROMEOS) @@ -522,6 +528,8 @@ base::DictionaryValue* dict) { policy::CloudPolicyStore* store = core_->store(); policy::CloudPolicyClient* client = core_->client(); + policy::CloudPolicyRefreshScheduler* refresh_scheduler = + core_->refresh_scheduler(); policy::BrowserDMTokenStorage* dmTokenStorage = policy::BrowserDMTokenStorage::Get(); @@ -531,7 +539,9 @@ ui::TimeFormat::Simple( ui::TimeFormat::FORMAT_DURATION, ui::TimeFormat::LENGTH_SHORT, base::TimeDelta::FromMilliseconds( - policy::CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs))); + refresh_scheduler ? refresh_scheduler->GetActualRefreshDelay() + : policy::CloudPolicyRefreshScheduler:: + kDefaultRefreshDelayMs))); if (dmTokenStorage) { dict->SetString("enrollmentToken", @@ -545,12 +555,10 @@ dict->SetString("status", status); const em::PolicyData* policy = store->policy(); if (policy) { - dict->SetString( - "timeSinceLastRefresh", - ui::TimeFormat::Simple( - ui::TimeFormat::FORMAT_ELAPSED, ui::TimeFormat::LENGTH_SHORT, - base::Time::NowFromSystemTime() - - base::Time::FromJavaTime(policy->timestamp()))); + dict->SetString("timeSinceLastRefresh", + GetTimeSinceLastRefreshString( + refresh_scheduler ? refresh_scheduler->last_refresh() + : base::Time())); std::string username = policy->username(); dict->SetString("domain", gaia::ExtractDomainName(username)); } @@ -668,13 +676,8 @@ ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_DURATION, ui::TimeFormat::LENGTH_SHORT, refresh_interval)); - dict->SetString( - "timeSinceLastRefresh", - last_refresh_time.is_null() - ? l10n_util::GetStringUTF16(IDS_POLICY_NEVER_FETCHED) - : ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_ELAPSED, - ui::TimeFormat::LENGTH_SHORT, - base::Time::Now() - last_refresh_time)); + dict->SetString("timeSinceLastRefresh", + GetTimeSinceLastRefreshString(last_refresh_time)); GetUserAffiliationStatus(dict, profile_); }
diff --git a/chrome/browser/ui/webui/settings/safety_check_handler.cc b/chrome/browser/ui/webui/settings/safety_check_handler.cc index 7efcf60..f14c130d 100644 --- a/chrome/browser/ui/webui/settings/safety_check_handler.cc +++ b/chrome/browser/ui/webui/settings/safety_check_handler.cc
@@ -157,6 +157,7 @@ using password_manager::BulkLeakCheckService; switch (state) { case BulkLeakCheckService::State::kIdle: + case BulkLeakCheckService::State::kCanceled: // TODO(crbug.com/1015841): Implement retrieving the number // of leaked passwords (if any) once PasswordsPrivateDelegate provides an // API for that (see crrev.com/c/2072742).
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc index c490581..465b4fdf 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -731,12 +731,12 @@ {"checkPasswords", IDS_SETTINGS_CHECK_PASSWORDS}, {"checkedPasswords", IDS_SETTINGS_CHECKED_PASSWORDS}, {"checkPasswordsDescription", IDS_SETTINGS_CHECK_PASSWORDS_DESCRIPTION}, - {"checkPasswordLeakCount", IDS_SETTINGS_LEAKED_PASSWORDS_COUNT}, {"checkPasswordsAgain", IDS_SETTINGS_CHECK_PASSWORDS_AGAIN}, {"compromisedPasswords", IDS_SETTINGS_COMPROMISED_PASSWORDS}, {"compromisedPasswordsDescription", IDS_SETTINGS_COMPROMISED_PASSWORDS_ADVICE}, {"changePasswordButton", IDS_SETTINGS_CHANGE_PASSWORD_BUTTON}, + {"changePasswordInApp", IDS_SETTINGS_CHANGE_PASSWORD_IN_APP_LABEL}, {"leakedPassword", IDS_SETTINGS_COMPROMISED_PASSWORD_REASON_LEAKED}, {"phishedPassword", IDS_SETTINGS_COMPROMISED_PASSWORD_REASON_PHISHED}, {"noCompromisedCredentials", @@ -1130,10 +1130,14 @@ {"safetyCheckParentPrimaryLabelAfter", IDS_SETTINGS_SAFETY_CHECK_PARENT_PRIMARY_LABEL_AFTER}, {"safetyCheckParentButton", IDS_SETTINGS_SAFETY_CHECK_PARENT_BUTTON}, + {"safetyCheckParentButtonAriaLabel", + IDS_SETTINGS_SAFETY_CHECK_PARENT_BUTTON_ARIA_LABEL}, {"safetyCheckUpdatesPrimaryLabel", IDS_SETTINGS_SAFETY_CHECK_UPDATES_PRIMARY_LABEL}, {"safetyCheckUpdatesSubLabelFailedOffline", IDS_SETTINGS_SAFETY_CHECK_UPDATES_FAILED_OFFLINE}, + {"safetyCheckUpdatesButtonAriaLabel", + IDS_UPDATE_RECOMMENDED_DIALOG_TITLE}, {"safetyCheckPasswordsButton", IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_BUTTON}, {"safetyCheckSafeBrowsingSubLabelEnabled", @@ -1144,10 +1148,14 @@ IDS_SETTINGS_SAFETY_CHECK_SAFE_BROWSING_DISABLED_BY_EXTENSION}, {"safetyCheckSafeBrowsingButton", IDS_SETTINGS_SAFETY_CHECK_SAFE_BROWSING_BUTTON}, + {"safetyCheckSafeBrowsingButtonAriaLabel", + IDS_SETTINGS_SAFETY_CHECK_SAFE_BROWSING_BUTTON_ARIA_LABEL}, {"safetyCheckExtensionsPrimaryLabel", IDS_SETTINGS_SAFETY_CHECK_EXTENSIONS_PRIMARY_LABEL}, {"safetyCheckExtensionsButton", IDS_SETTINGS_SAFETY_CHECK_EXTENSIONS_BUTTON}, + {"safetyCheckExtensionsButtonAriaLabel", + IDS_SETTINGS_SAFETY_CHECK_EXTENSIONS_BUTTON_ARIA_LABEL}, }; AddLocalizedStringsBulk(html_source, kLocalizedStrings);
diff --git a/chrome/browser/ui/webui/settings/settings_ui.cc b/chrome/browser/ui/webui/settings/settings_ui.cc index 0de1dea..79dd8d9c 100644 --- a/chrome/browser/ui/webui/settings/settings_ui.cc +++ b/chrome/browser/ui/webui/settings/settings_ui.cc
@@ -305,7 +305,10 @@ base::WrapUnique(ResetSettingsHandler::Create(html_source, profile))); // Add a handler to provide pluralized strings. - web_ui->AddMessageHandler(std::make_unique<PluralStringHandler>()); + auto plural_string_handler = std::make_unique<PluralStringHandler>(); + plural_string_handler->AddLocalizedString( + "compromisedPasswords", IDS_SETTINGS_COMPROMISED_PASSWORDS_COUNT); + web_ui->AddMessageHandler(std::move(plural_string_handler)); // Add the metrics handler to write uma stats. web_ui->AddMessageHandler(std::make_unique<MetricsHandler>());
diff --git a/chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.cc index e971e14..616e3b5 100644 --- a/chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.cc
@@ -120,9 +120,7 @@ IDS_AUTOFILL_ENABLE_PAYMENTS_INTEGRATION_CHECKBOX_LABEL}, {"nonPersonalizedServicesSectionLabel", IDS_SETTINGS_NON_PERSONALIZED_SERVICES_SECTION_LABEL}, - {"syncEverythingHint", IDS_SETTINGS_SYNC_EVERYTHING_HINT}, {"customizeSyncLabel", IDS_SETTINGS_CUSTOMIZE_SYNC}, - {"customizeSyncHint", IDS_SETTINGS_CUSTOMIZE_SYNC_HINT}, {"syncData", IDS_SETTINGS_SYNC_DATA}, }; AddLocalizedStringsBulk(html_source, kLocalizedStrings); @@ -141,9 +139,16 @@ IDS_SETTINGS_PEOPLE_SYNC_PASSWORDS_NOT_WORKING}, {"peopleSignOut", IDS_SETTINGS_PEOPLE_SIGN_OUT}, {"useAnotherAccount", IDS_SETTINGS_PEOPLE_SYNC_ANOTHER_ACCOUNT}, - {"syncAdvancedPageTitle", IDS_SETTINGS_SYNC_ADVANCED_PAGE_TITLE}, }; AddLocalizedStringsBulk(html_source, kLocalizedStrings); + if (base::FeatureList::IsEnabled(features::kSyncSetupFriendlySettings)) { + html_source->AddLocalizedString("syncAdvancedPageTitle", + IDS_SETTINGS_NEW_SYNC_ADVANCED_PAGE_TITLE); + + } else { + html_source->AddLocalizedString("syncAdvancedPageTitle", + IDS_SETTINGS_SYNC_ADVANCED_PAGE_TITLE); + } } #if defined(OS_CHROMEOS)
diff --git a/chrome/common/extensions/api/passwords_private.idl b/chrome/common/extensions/api/passwords_private.idl index af1e0ba..4db9a9b 100644 --- a/chrome/common/extensions/api/passwords_private.idl +++ b/chrome/common/extensions/api/passwords_private.idl
@@ -119,7 +119,7 @@ long id; // The formatted origin of the compromised credential. Can be the origin of - // a website (exluding scheme) or the name of an App. + // a website (excluding scheme) or the name of an App. DOMString formattedOrigin; // The URL where the compromised password can be changed. Might be not set @@ -136,6 +136,11 @@ // requested. DOMString? password; + // The timestamp of when this credential was determined to be compromised. + // Specified in milliseconds since the UNIX epoch. Intended to be passed to + // the JavaScript Date() constructor. + double compromiseTime; + // The elapsed time since this credential was determined to be compromised. // This is passed as an already formatted string, since JavaScript lacks the // required formatting APIs. Example: "5 minutes ago"
diff --git a/chrome/common/extensions/docs/templates/articles/xhr.html b/chrome/common/extensions/docs/templates/articles/xhr.html index c1ee41b..0c26bd5f 100644 --- a/chrome/common/extensions/docs/templates/articles/xhr.html +++ b/chrome/common/extensions/docs/templates/articles/xhr.html
@@ -6,12 +6,17 @@ <a href="https://www.w3.org/TR/XMLHttpRequest/">XMLHttpRequest</a> object to send and receive data from remote servers, but they're limited by the -<a href="https://en.wikipedia.org/wiki/Same_origin_policy">same origin policy</a> -(and since Chrome 73 <a href="content_scripts">content scripts</a> are also -subject to the same restrictions as the web page they are injected into). -Extensions aren't so limited - a script executing in an -extension's origin can talk to remote servers outside of its origin, -as long as the extension requests cross-origin permissions.</p> +<a href="https://en.wikipedia.org/wiki/Same_origin_policy">same origin policy</a>. +<a href="content_scripts">Content scripts</a> initiate requests on +behalf of the web origin that the content script has been injected into +and therefore content scripts are also subject to the +<a href="https://en.wikipedia.org/wiki/Same_origin_policy">same origin policy</a>. +(Content scripts have been subject to +<a href="https://www.chromium.org/Home/chromium-security/extension-content-script-fetches" + >CORB since Chrome 73 and CORS since Chrome 83</a>.) +Extension origins aren't so limited - a script executing in an extension's +background page or foreground tab can talk to remote servers outside of its +origin, as long as the extension requests cross-origin permissions.</p> <h2 id="extension-origin">Extension origin</h2> <p>Each running extension exists within its own separate security origin.
diff --git a/chrome/common/webui_url_constants.cc b/chrome/common/webui_url_constants.cc index 7cd8d7b4..5ee76985 100644 --- a/chrome/common/webui_url_constants.cc +++ b/chrome/common/webui_url_constants.cc
@@ -374,6 +374,7 @@ const char kImportDataSubPage[] = "importData"; const char kLanguageOptionsSubPage[] = "languages"; const char kOnStartupSubPage[] = "onStartup"; +const char kPasswordCheckSubPage[] = "passwords/check"; const char kPasswordManagerSubPage[] = "passwords"; const char kPaymentsSubPage[] = "payments"; const char kPrintingSettingsSubPage[] = "printing";
diff --git a/chrome/common/webui_url_constants.h b/chrome/common/webui_url_constants.h index 2c20f86..f2a850e 100644 --- a/chrome/common/webui_url_constants.h +++ b/chrome/common/webui_url_constants.h
@@ -330,6 +330,7 @@ extern const char kLanguageOptionsSubPage[]; extern const char kManageProfileSubPage[]; extern const char kOnStartupSubPage[]; +extern const char kPasswordCheckSubPage[]; extern const char kPasswordManagerSubPage[]; extern const char kPaymentsSubPage[]; extern const char kPeopleSubPage[];
diff --git a/chrome/installer/util/install_service_work_item_unittest.cc b/chrome/installer/util/install_service_work_item_unittest.cc index 9e71f614..da94d35 100644 --- a/chrome/installer/util/install_service_work_item_unittest.cc +++ b/chrome/installer/util/install_service_work_item_unittest.cc
@@ -42,34 +42,6 @@ return GetImpl(item)->IsServiceCorrectlyConfigured(config); } - - void SetUp() override { - base::win::RegKey key; - if (ERROR_SUCCESS == - key.Open(HKEY_LOCAL_MACHINE, - install_static::GetClientStateKeyPath().c_str(), - KEY_READ | KEY_WOW64_32KEY)) { - preexisting_clientstate_key_ = true; - } else { - ASSERT_EQ(ERROR_SUCCESS, - key.Create(HKEY_LOCAL_MACHINE, - install_static::GetClientStateKeyPath().c_str(), - KEY_READ | KEY_WOW64_32KEY)); - } - } - - void TearDown() override { - if (!preexisting_clientstate_key_) { - base::win::RegKey key; - if (key.Open(HKEY_LOCAL_MACHINE, - install_static::GetClientStateKeyPath().c_str(), - DELETE | KEY_WOW64_32KEY)) { - EXPECT_EQ(ERROR_SUCCESS, key.DeleteKey(L"")); - } - } - } - - bool preexisting_clientstate_key_ = false; }; TEST_F(InstallServiceWorkItemTest, Do_MultiSzToVector) { @@ -162,6 +134,12 @@ } TEST_F(InstallServiceWorkItemTest, Do_ServiceName) { + base::win::RegKey key; + ASSERT_EQ(ERROR_SUCCESS, + key.Create(HKEY_LOCAL_MACHINE, + install_static::GetClientStateKeyPath().c_str(), + KEY_WRITE | KEY_WOW64_32KEY)); + key.DeleteValue(kServiceName); auto item = std::make_unique<InstallServiceWorkItem>( kServiceName, kServiceDisplayName, base::CommandLine(base::FilePath(kServiceProgramPath))); @@ -185,12 +163,7 @@ .c_str(), GetImpl(item.get())->GetCurrentServiceDisplayName().c_str()); - base::win::RegKey key; - ASSERT_EQ(ERROR_SUCCESS, - key.Open(HKEY_LOCAL_MACHINE, - install_static::GetClientStateKeyPath().c_str(), - KEY_WRITE | KEY_WOW64_32KEY)); - EXPECT_EQ(ERROR_SUCCESS, key.DeleteValue(kServiceName)); + EXPECT_EQ(ERROR_SUCCESS, key.DeleteKey(L"")); } } // namespace installer
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index a9d71bc..ae1a664 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -154,10 +154,6 @@ "logging/win/mof_data_parser.h", "logging/win/test_log_collector.cc", "logging/win/test_log_collector.h", - "payments/payment_request_platform_browsertest_base.h", - "payments/payment_request_test_controller.h", - "payments/test_event_waiter.cc", - "payments/test_event_waiter.h", ] configs += [ "//build/config:precompiled_headers" ] @@ -239,12 +235,6 @@ ] if (is_android) { - sources += [ - "payments/android/payment_request_test_bridge.cc", - "payments/android/payment_request_test_bridge.h", - "payments/payment_request_test_controller_android.cc", - ] - deps += [ ":test_support_jni_headers" ] if (enable_vr) { public_deps += [ "//chrome/browser/android/vr:test_support" ] @@ -266,7 +256,6 @@ "base/dialog_test_browser_window.h", "base/test_browser_window.cc", "base/test_browser_window.h", - "payments/payment_request_test_controller_desktop.cc", "pixel/browser_skia_gold_pixel_diff.cc", "pixel/browser_skia_gold_pixel_diff.h", ] @@ -515,6 +504,7 @@ "//chrome:chrome_android_core", "//chrome/android:app_hooks_java", "//chrome/browser/metrics:test_support", + "//chrome/browser/payments:browsertests", "//chrome/browser/profiling_host:profiling_browsertests", "//components/crash/android:crashpad_main", "//components/games/core/test:test_support", @@ -536,26 +526,10 @@ "../browser/engagement/important_sites_util_browsertest.cc", "../browser/games/games_service_browsertest.cc", "../browser/metrics/metrics_service_user_demographics_browsertest.cc", - "../browser/payments/empty_parameters_browsertest.cc", - "../browser/payments/expandable_payment_handler_browsertest.cc", - "../browser/payments/has_enrolled_instrument_browsertest.cc", - "../browser/payments/has_enrolled_instrument_query_quota_browsertest.cc", - "../browser/payments/hybrid_request_skip_ui_browsertest.cc", - "../browser/payments/journey_logger_browsertest.cc", - "../browser/payments/payment_handler_change_shipping_address_option_browsertest.cc", - "../browser/payments/payment_handler_enable_delegations_browsertest.cc", - "../browser/payments/payment_handler_exploit_browsertest.cc", - "../browser/payments/payment_handler_just_in_time_installation_browsertest.cc", - "../browser/payments/payment_request_can_make_payment_browsertest.cc", - "../browser/payments/payment_request_can_make_payment_event_browsertest.cc", - "../browser/payments/personal_data_manager_test_util.cc", - "../browser/payments/personal_data_manager_test_util.h", - "../browser/payments/sec_fetch_site_browsertest.cc", "../browser/profiles/profile_browsertest_android.cc", "../browser/ssl/crlset_browsertest.cc", "android/browsertests_apk/android_browsertests_jni_onload.cc", "base/android/android_browser_test_browsertest_android.cc", - "payments/payment_request_platform_browsertest_base.cc", ] data = [ @@ -692,6 +666,7 @@ "//chrome/browser/image_decoder:browser_tests", "//chrome/browser/metrics:test_support", "//chrome/browser/notifications/scheduler/test:test_support", + "//chrome/browser/payments:browsertests", "//chrome/browser/profiling_host:profiling_browsertests", "//chrome/browser/web_applications:browser_tests", "//chrome/renderer", @@ -1936,23 +1911,6 @@ } if (toolkit_views) { sources += [ - "../browser/payments/empty_parameters_browsertest.cc", - "../browser/payments/has_enrolled_instrument_browsertest.cc", - "../browser/payments/has_enrolled_instrument_query_quota_browsertest.cc", - "../browser/payments/journey_logger_browsertest.cc", - "../browser/payments/manifest_verifier_browsertest.cc", - "../browser/payments/payment_handler_change_shipping_address_option_browsertest.cc", - "../browser/payments/payment_handler_enable_delegations_browsertest.cc", - "../browser/payments/payment_handler_exploit_browsertest.cc", - "../browser/payments/payment_handler_just_in_time_installation_browsertest.cc", - "../browser/payments/payment_manifest_parser_browsertest.cc", - "../browser/payments/payment_request_can_make_payment_browsertest.cc", - "../browser/payments/payment_request_can_make_payment_event_browsertest.cc", - "../browser/payments/personal_data_manager_test_util.cc", - "../browser/payments/personal_data_manager_test_util.h", - "../browser/payments/sec_fetch_site_browsertest.cc", - "../browser/payments/service_worker_payment_app_finder_browsertest.cc", - "../browser/payments/site_per_process_payments_browsertest.cc", "../browser/ui/global_error/global_error_browsertest.cc", "../browser/ui/global_error/global_error_service_browsertest.cc", "../browser/ui/media_router/presentation_receiver_window_controller_browsertest.cc", @@ -2061,7 +2019,6 @@ "../browser/ui/views/translate/translate_bubble_view_browsertest.cc", "../browser/ui/views/translate/translate_language_browsertest.cc", "../browser/ui/views/web_apps/web_app_uninstall_dialog_browsertest.cc", - "payments/payment_request_platform_browsertest_base.cc", ] if (!is_chromeos) { sources += [ @@ -3302,7 +3259,6 @@ "../browser/page_load_metrics/observers/ukm_page_load_metrics_observer_unittest.cc", "../browser/password_manager/chrome_password_manager_client_unittest.cc", "../browser/password_manager/password_store_x_unittest.cc", - "../browser/payments/payment_handler_permission_context_unittest.cc", "../browser/performance_hints/performance_hints_observer_unittest.cc", "../browser/performance_manager/decorators/frame_priority_decorator_unittest.cc", "../browser/performance_manager/decorators/frozen_frame_aggregator_unittest.cc", @@ -3703,6 +3659,7 @@ "//chrome/browser/media/router:unittests", "//chrome/browser/notifications:unit_tests", "//chrome/browser/paint_preview/services:unit_tests", + "//chrome/browser/payments:unittests", "//chrome/browser/updates/announcement_notification:unit_tests", "//chrome/common:test_support", "//chrome/common/media_router:test_support", @@ -3877,8 +3834,6 @@ "../browser/password_manager/password_generation_controller_impl_unittest.cc", "../browser/password_manager/save_password_infobar_delegate_android_unittest.cc", "../browser/password_manager/update_password_infobar_delegate_android_unittest.cc", - "../browser/payments/android/android_payment_app_finder_unittest.cc", - "../browser/payments/android/payment_manifest_verifier_unittest.cc", "../browser/permissions/permission_prompt_android_unittest.cc", "../browser/tabmodel/tab_persistent_store_unittest.cc", "../browser/toolbar/toolbar_security_icon_unittest.cc", @@ -4861,6 +4816,10 @@ "../utility/image_writer/image_writer_unittest.cc", ] + if (enable_autofill_assistant_api) { + sources += [ "../browser/extensions/api/autofill_assistant_private/extension_access_token_fetcher_unittest.cc" ] + } + allow_circular_includes_from = [ "//chrome/browser/web_applications:web_applications_unit_tests", "//chrome/browser/web_applications/extensions:unit_tests",
diff --git a/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_auth_error.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_auth_error.Nexus_5-19.png.sha1 new file mode 100644 index 0000000..023e22bc --- /dev/null +++ b/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_auth_error.Nexus_5-19.png.sha1
@@ -0,0 +1 @@ +94ece76e55f5113bc51be7ae94916c17a6c17360 \ No newline at end of file
diff --git a/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_auth_error.Nexus_5X-23.png.sha1 b/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_auth_error.Nexus_5X-23.png.sha1 new file mode 100644 index 0000000..eaeaa67 --- /dev/null +++ b/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_auth_error.Nexus_5X-23.png.sha1
@@ -0,0 +1 @@ +15ccc402f0cc34c63f5b2dd840c5f47d5fa66b4a \ No newline at end of file
diff --git a/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_passphrase_required.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_passphrase_required.Nexus_5-19.png.sha1 new file mode 100644 index 0000000..8a44d5af --- /dev/null +++ b/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_passphrase_required.Nexus_5-19.png.sha1
@@ -0,0 +1 @@ +d3a18d483d3f34dba557f1a79b102112fa08cfce \ No newline at end of file
diff --git a/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_passphrase_required.Nexus_5X-23.png.sha1 b/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_passphrase_required.Nexus_5X-23.png.sha1 new file mode 100644 index 0000000..40b692e --- /dev/null +++ b/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_passphrase_required.Nexus_5X-23.png.sha1
@@ -0,0 +1 @@ +03ecb6ccb707d3652ba2cbda9ea410623c70f344 \ No newline at end of file
diff --git a/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_sync_setup_incomplete.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_sync_setup_incomplete.Nexus_5-19.png.sha1 new file mode 100644 index 0000000..60371f8e --- /dev/null +++ b/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_sync_setup_incomplete.Nexus_5-19.png.sha1
@@ -0,0 +1 @@ +3b17651c85716e57a835cd3d87e50fefef997781 \ No newline at end of file
diff --git a/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_sync_setup_incomplete.Nexus_5X-23.png.sha1 b/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_sync_setup_incomplete.Nexus_5X-23.png.sha1 new file mode 100644 index 0000000..5749e06f --- /dev/null +++ b/chrome/test/data/android/render_tests/SyncErrorInfoBarTest.sync_error_infobar_sync_setup_incomplete.Nexus_5X-23.png.sha1
@@ -0,0 +1 @@ +82985d6760779449f21a97eb76e496c780e9606e \ No newline at end of file
diff --git a/chrome/test/data/extensions/api_test/passwords_private/test.js b/chrome/test/data/extensions/api_test/passwords_private/test.js index 84f544a..91e71760 100644 --- a/chrome/test/data/extensions/api_test/passwords_private/test.js +++ b/chrome/test/data/extensions/api_test/passwords_private/test.js
@@ -6,6 +6,9 @@ // that callbacks are correctly invoked, expected parameters are correct, // and failures are detected. + +const COMPROMISE_TIME = 158322960000; + var availableTests = [ function changeSavedPassword() { var numCalls = 0; @@ -221,6 +224,9 @@ 'https://example.com/change-password', compromisedCredential.changePasswordUrl); chrome.test.assertEq('alice', compromisedCredential.username); + const compromiseTime = new Date(compromisedCredential.compromiseTime); + chrome.test.assertEq( + 'Tue, 03 Mar 2020 12:00:00 GMT', compromiseTime.toUTCString()); chrome.test.assertEq( '3 days ago', compromisedCredential.elapsedTimeSinceCompromise); chrome.test.assertEq('LEAKED', compromisedCredential.compromiseType); @@ -236,6 +242,7 @@ formattedOrigin: 'example.com', signonRealm: 'https://example.com', username: 'alice', + compromiseTime: COMPROMISE_TIME, elapsedTimeSinceCompromise: '3 days ago', compromiseType: 'LEAKED', }; @@ -254,6 +261,7 @@ formattedOrigin: 'example.com', signonRealm: 'https://example.com', username: 'alice', + compromiseTime: COMPROMISE_TIME, elapsedTimeSinceCompromise: '3 days ago', compromiseType: 'LEAKED', }; @@ -276,6 +284,7 @@ formattedOrigin: 'example.com', signonRealm: 'https://example.com', username: 'alice', + compromiseTime: COMPROMISE_TIME, elapsedTimeSinceCompromise: '3 days ago', compromiseType: 'LEAKED', }, @@ -294,6 +303,7 @@ formattedOrigin: 'example.com', signonRealm: 'https://example.com', username: 'alice', + compromiseTime: COMPROMISE_TIME, elapsedTimeSinceCompromise: '3 days ago', compromiseType: 'LEAKED', }, @@ -310,6 +320,7 @@ formattedOrigin: 'example.com', signonRealm: 'https://example.com', username: 'alice', + compromiseTime: COMPROMISE_TIME, elapsedTimeSinceCompromise: '3 days ago', compromiseType: 'LEAKED', }, @@ -329,6 +340,7 @@ formattedOrigin: 'example.com', signonRealm: 'https://example.com', username: 'alice', + compromiseTime: COMPROMISE_TIME, elapsedTimeSinceCompromise: '3 days ago', compromiseType: 'LEAKED', },
diff --git a/chrome/test/data/webui/settings/password_check_test.js b/chrome/test/data/webui/settings/password_check_test.js index 4643eec..cba80d2d 100644 --- a/chrome/test/data/webui/settings/password_check_test.js +++ b/chrome/test/data/webui/settings/password_check_test.js
@@ -5,6 +5,8 @@ /** @fileoverview Runs the Polymer Check Password tests. */ cr.define('settings_passwords_check', function() { + const PasswordCheckState = chrome.passwordsPrivate.PasswordCheckState; + function createCheckPasswordSection() { // Create a passwords-section to use for testing. const passwordsSection = @@ -14,6 +16,19 @@ return passwordsSection; } + /** + * Helper method used to create a compromised list item. + * @param {!chrome.passwordsPrivate.CompromisedCredential} entry + * @return {!PasswordCheckListItemElement} + */ + function createLeakedPasswordItem(entry) { + const leakedPasswordItem = + this.document.createElement('password-check-list-item'); + leakedPasswordItem.item = entry; + document.body.appendChild(leakedPasswordItem); + Polymer.dom.flush(); + return leakedPasswordItem; + } /** * Helper method that validates a that elements in the compromised credentials @@ -98,6 +113,17 @@ }); }); + // Test verifies that credentials from mobile app shown correctly + test('testSomeCompromisedCredentials', function() { + const password = autofill_test_util.makeCompromisedCredentials( + 'one.com', 'test4', 'LEAKED'); + password.changePasswordUrl = null; + + const checkPasswordSection = createLeakedPasswordItem(password); + assertEquals(checkPasswordSection.$$('changePasswordUrl'), null); + assert(checkPasswordSection.$$('#changePasswordInApp')); + }); + // Verify that the More Actions menu opens when the button is clicked. test('testMoreActionsMenu', function() { const leakedPasswords = [ @@ -123,5 +149,47 @@ assertTrue(menu.open); }); }); + + // A changing status is immediately reflected in title, icon and banner. + test('testUpdatesNumberOfCheckedPasswordsWhileRunning', function() { + passwordManager.data.checkStatus = + autofill_test_util.makePasswordCheckStatus( + /*state=*/ PasswordCheckState.RUNNING, + /*checked=*/ 1, + /*remaining=*/ 1); + passwordManager.data.leakedCredentials = + autofill_test_util.makeCompromisedCredentialsInfo([], 'just now'); + + const section = createCheckPasswordSection(); + return passwordManager.whenCalled('getPasswordCheckStatus').then(() => { + Polymer.dom.flush(); + expectEquals(section.status_.state, PasswordCheckState.RUNNING); + + // Change status from running to IDLE. + assert(!!passwordManager.lastCallback.addPasswordCheckStatusListener); + passwordManager.lastCallback.addPasswordCheckStatusListener( + autofill_test_util.makePasswordCheckStatus( + /*state=*/ PasswordCheckState.IDLE, + /*checked=*/ 2, + /*remaining=*/ 0)); + + Polymer.dom.flush(); + expectEquals(section.status_.state, PasswordCheckState.IDLE); + }); + }); + + // Tests that the status is queried right when the page loads. + test('testQueriesCheckedStatusImmediately', function() { + const data = passwordManager.data; + assertEquals(PasswordCheckState.IDLE, data.checkStatus.state); + assertEquals(0, data.leakedCredentials.compromisedCredentials.length); + + const checkPasswordSection = createCheckPasswordSection(); + return passwordManager.whenCalled('getPasswordCheckStatus').then(() => { + Polymer.dom.flush(); + expectEquals( + checkPasswordSection.status_.state, PasswordCheckState.IDLE); + }, () => assert(false)); + }); }); });
diff --git a/chrome/test/data/webui/settings/passwords_and_autofill_fake_data.js b/chrome/test/data/webui/settings/passwords_and_autofill_fake_data.js index f43055d..6cad2dc 100644 --- a/chrome/test/data/webui/settings/passwords_and_autofill_fake_data.js +++ b/chrome/test/data/webui/settings/passwords_and_autofill_fake_data.js
@@ -146,6 +146,21 @@ } /** + * Creates a new password check status. + * @param {!chrome.passwordsPrivate.PasswordCheckState} state + * @param {number} checked + * @param {number} remaining + * @return {!chrome.passwordsPrivate.PasswordCheckStatus} + */ + function makePasswordCheckStatus(state, checked, remaining) { + return { + state: state || chrome.passwordsPrivate.PasswordCheckState.IDLE, + alreadyProcessed: checked || 0, + remainingInQueue: remaining || 0 + }; + } + + /** * Creates a new random GUID for testing. * @return {string} * @private @@ -411,6 +426,7 @@ createCreditCardEntry: createCreditCardEntry, makeCompromisedCredentials: makeCompromisedCredentials, makeCompromisedCredentialsInfo: makeCompromisedCredentialsInfo, + makePasswordCheckStatus: makePasswordCheckStatus, TestPaymentsManager: TestPaymentsManager, PaymentsManagerExpectations: PaymentsManagerExpectations, TestAutofillManager: TestAutofillManager,
diff --git a/chrome/test/data/webui/settings/safety_check_page_test.js b/chrome/test/data/webui/settings/safety_check_page_test.js index 3881160d3..306636e 100644 --- a/chrome/test/data/webui/settings/safety_check_page_test.js +++ b/chrome/test/data/webui/settings/safety_check_page_test.js
@@ -80,7 +80,7 @@ fireSafetyCheckSafeBrowsingEvent( settings.SafetyCheckSafeBrowsingStatus.ENABLED); fireSafetyCheckExtensionsEvent( - settings.SafetyCheckExtensionsStatus.NO_BLACKLISTED_EXTENSIONS); + settings.SafetyCheckExtensionsStatus.NO_BLOCKLISTED_EXTENSIONS); Polymer.dom.flush(); @@ -228,39 +228,39 @@ test('extensionsSafeUiTest', function() { fireSafetyCheckExtensionsEvent( - settings.SafetyCheckExtensionsStatus.NO_BLACKLISTED_EXTENSIONS); + settings.SafetyCheckExtensionsStatus.NO_BLOCKLISTED_EXTENSIONS); Polymer.dom.flush(); assertFalse(!!page.$$('#safetyCheckExtensionsButton')); assertFalse(!!page.$$('#safetyCheckExtensionsManagedIcon')); }); - test('extensionsBlacklistedOffUiTest', function() { + test('extensionsBlocklistedOffUiTest', function() { fireSafetyCheckExtensionsEvent( - settings.SafetyCheckExtensionsStatus.BLACKLISTED_ALL_DISABLED); + settings.SafetyCheckExtensionsStatus.BLOCKLISTED_ALL_DISABLED); Polymer.dom.flush(); assertTrue(!!page.$$('#safetyCheckExtensionsButton')); assertFalse(!!page.$$('#safetyCheckExtensionsManagedIcon')); }); - test('extensionsBlacklistedOnAllUserUiTest', function() { + test('extensionsBlocklistedOnAllUserUiTest', function() { fireSafetyCheckExtensionsEvent( - settings.SafetyCheckExtensionsStatus.BLACKLISTED_REENABLED_ALL_BY_USER); + settings.SafetyCheckExtensionsStatus.BLOCKLISTED_REENABLED_ALL_BY_USER); Polymer.dom.flush(); assertTrue(!!page.$$('#safetyCheckExtensionsButton')); assertFalse(!!page.$$('#safetyCheckExtensionsManagedIcon')); }); - test('extensionsBlacklistedOnUserAdminUiTest', function() { + test('extensionsBlocklistedOnUserAdminUiTest', function() { fireSafetyCheckExtensionsEvent(settings.SafetyCheckExtensionsStatus - .BLACKLISTED_REENABLED_SOME_BY_USER); + .BLOCKLISTED_REENABLED_SOME_BY_USER); Polymer.dom.flush(); assertTrue(!!page.$$('#safetyCheckExtensionsButton')); assertFalse(!!page.$$('#safetyCheckExtensionsManagedIcon')); }); - test('extensionsBlacklistedOnAllAdminUiTest', function() { + test('extensionsBlocklistedOnAllAdminUiTest', function() { fireSafetyCheckExtensionsEvent(settings.SafetyCheckExtensionsStatus - .BLACKLISTED_REENABLED_ALL_BY_ADMIN); + .BLOCKLISTED_REENABLED_ALL_BY_ADMIN); Polymer.dom.flush(); assertFalse(!!page.$$('#safetyCheckExtensionsButton')); assertTrue(!!page.$$('#safetyCheckExtensionsManagedIcon'));
diff --git a/chrome/test/data/webui/settings/test_password_manager_proxy.js b/chrome/test/data/webui/settings/test_password_manager_proxy.js index f2feb2e..5036c12 100644 --- a/chrome/test/data/webui/settings/test_password_manager_proxy.js +++ b/chrome/test/data/webui/settings/test_password_manager_proxy.js
@@ -15,6 +15,7 @@ 'requestPlaintextPassword', 'startBulkPasswordCheck', 'getCompromisedCredentialsInfo', + 'getPasswordCheckStatus', ]); this.actual_ = new autofill_test_util.PasswordManagerExpectations(); @@ -25,10 +26,12 @@ exceptions: [], leakedCredentials: autofill_test_util.makeCompromisedCredentialsInfo([], ''), + checkStatus: autofill_test_util.makePasswordCheckStatus(), }; // Holds the last callbacks so they can be called when needed/ this.lastCallback = { + addPasswordCheckStatusListener: null, addSavedPasswordListChangedListener: null, addExceptionListChangedListener: null, requestPlaintextPassword: null, @@ -157,8 +160,22 @@ } /** @override */ + getPasswordCheckStatus() { + this.methodCalled('getPasswordCheckStatus'); + return Promise.resolve(this.data.checkStatus); + } + + /** @override */ addCompromisedCredentialsListener(listener) {} /** @override */ removeCompromisedCredentialsListener(listener) {} + + /** @override */ + addPasswordCheckStatusListener(listener) { + this.lastCallback.addPasswordCheckStatusListener = listener; + } + + /** @override */ + removePasswordCheckStatusListener(listener) {} }
diff --git a/chrome/test/payments/BUILD.gn b/chrome/test/payments/BUILD.gn new file mode 100644 index 0000000..d46bd3d --- /dev/null +++ b/chrome/test/payments/BUILD.gn
@@ -0,0 +1,46 @@ +# 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. + +static_library("test_support") { + testonly = true + + sources = [ + "payment_request_platform_browsertest_base.cc", + "payment_request_platform_browsertest_base.h", + "payment_request_test_controller.h", + "personal_data_manager_test_util.cc", + "personal_data_manager_test_util.h", + "test_event_waiter.cc", + "test_event_waiter.h", + ] + + deps = [ + "//chrome/browser", + "//chrome/test:test_support", + "//components/autofill/core/browser:test_support", + "//components/payments/content", + "//components/payments/content:utils", + "//content/test:test_support", + "//net:test_support", + ] + + if (is_android) { + sources += [ + "android/payment_request_test_bridge.cc", + "android/payment_request_test_bridge.h", + "payment_request_test_controller_android.cc", + ] + + deps += [ + "//chrome/test:test_support_jni_headers", + "//chrome/test:test_support_ui_android", + ] + } + + if (!is_android) { + sources += [ "payment_request_test_controller_desktop.cc" ] + + deps += [ "//chrome/test:test_support_ui" ] + } +}
diff --git a/chrome/test/payments/payment_request_platform_browsertest_base.h b/chrome/test/payments/payment_request_platform_browsertest_base.h index b697882..70d18cf4 100644 --- a/chrome/test/payments/payment_request_platform_browsertest_base.h +++ b/chrome/test/payments/payment_request_platform_browsertest_base.h
@@ -15,8 +15,8 @@ #include "base/run_loop.h" #include "base/strings/string16.h" #include "build/build_config.h" -#include "chrome/browser/payments/personal_data_manager_test_util.h" #include "chrome/test/payments/payment_request_test_controller.h" +#include "chrome/test/payments/personal_data_manager_test_util.h" #include "chrome/test/payments/test_event_waiter.h" #include "components/autofill/core/browser/autofill_test_utils.h" #include "content/public/browser/web_contents.h"
diff --git a/chrome/browser/payments/personal_data_manager_test_util.cc b/chrome/test/payments/personal_data_manager_test_util.cc similarity index 95% rename from chrome/browser/payments/personal_data_manager_test_util.cc rename to chrome/test/payments/personal_data_manager_test_util.cc index 0f92f52..72751b66 100644 --- a/chrome/browser/payments/personal_data_manager_test_util.cc +++ b/chrome/test/payments/personal_data_manager_test_util.cc
@@ -2,8 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/payments/personal_data_manager_test_util.h" +#include "chrome/test/payments/personal_data_manager_test_util.h" +#include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/autofill/personal_data_manager_factory.h" #include "chrome/browser/profiles/profile.h" @@ -12,7 +13,7 @@ #include "components/autofill/core/browser/data_model/credit_card.h" #include "components/autofill/core/browser/personal_data_manager.h" #include "components/autofill/core/browser/personal_data_manager_observer.h" -#include "content/public/test/browser_test_utils.h" +#include "testing/gtest/include/gtest/gtest.h" namespace payments { namespace test {
diff --git a/chrome/browser/payments/personal_data_manager_test_util.h b/chrome/test/payments/personal_data_manager_test_util.h similarity index 80% rename from chrome/browser/payments/personal_data_manager_test_util.h rename to chrome/test/payments/personal_data_manager_test_util.h index 2868242..0aad486a 100644 --- a/chrome/browser/payments/personal_data_manager_test_util.h +++ b/chrome/test/payments/personal_data_manager_test_util.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_PAYMENTS_PERSONAL_DATA_MANAGER_TEST_UTIL_H_ -#define CHROME_BROWSER_PAYMENTS_PERSONAL_DATA_MANAGER_TEST_UTIL_H_ +#ifndef CHROME_TEST_PAYMENTS_PERSONAL_DATA_MANAGER_TEST_UTIL_H_ +#define CHROME_TEST_PAYMENTS_PERSONAL_DATA_MANAGER_TEST_UTIL_H_ namespace autofill { class AutofillProfile; @@ -30,4 +30,4 @@ } // namespace test } // namespace payments -#endif // CHROME_BROWSER_PAYMENTS_PERSONAL_DATA_MANAGER_TEST_UTIL_H_ +#endif // CHROME_TEST_PAYMENTS_PERSONAL_DATA_MANAGER_TEST_UTIL_H_
diff --git a/chromeos/chromeos_strings.grd b/chromeos/chromeos_strings.grd index 627545e2..163f1ef6 100644 --- a/chromeos/chromeos_strings.grd +++ b/chromeos/chromeos_strings.grd
@@ -295,13 +295,10 @@ Unknown error. </message> <message name="IDS_REQUEST_PIN_DIALOG_ATTEMPTS_LEFT" desc="The text displayed in the certificate provider PIN request dialog about the number of attempts left"> - Attempts left: <ph name="ATTEMPTS_LEFT">$1<ex>3</ex></ph> + <ph name="ATTEMPTS_LEFT">$1<ex>3</ex></ph> attempts left </message> - <message name="IDS_REQUEST_PIN_DIALOG_ERROR_RETRY" desc="The text displayed in the certificate provider PIN request dialog when the previous login attempt was unsuccessful, including the reason for the previous failure."> - <ph name="ERROR_MESSAGE">$1<ex>Invalid PIN.</ex></ph> Please try again. - </message> - <message name="IDS_REQUEST_PIN_DIALOG_ERROR_RETRY_ATTEMPTS" desc="The text displayed in the certificate provider PIN request dialog when the previous login attempt was unsuccessful but there are more attempts remaining. Includes the reason for the previous failure."> - <ph name="ERROR_MESSAGE">$1<ex>Invalid PIN.</ex></ph> Please try again. Attempts left: <ph name="ATTEMPTS_LEFT">$2<ex>3</ex></ph> + <message name="IDS_REQUEST_PIN_DIALOG_ERROR_ATTEMPTS" desc="The text displayed in the certificate provider PIN request dialog when the previous login attempt was unsuccessful but there are more attempts remaining. Includes the reason for the previous failure."> + <ph name="ERROR_MESSAGE">$1<ex>Invalid PIN.</ex></ph> <ph name="ATTEMPTS_LEFT">$2<ex>3</ex></ph> attempts left </message> </messages> </release>
diff --git a/chromeos/components/security_token_pin/error_generator.cc b/chromeos/components/security_token_pin/error_generator.cc index d4495a0..2bbe4cd 100644 --- a/chromeos/components/security_token_pin/error_generator.cc +++ b/chromeos/components/security_token_pin/error_generator.cc
@@ -11,6 +11,11 @@ namespace chromeos { namespace security_token_pin { +// Only inform the user about the number of attempts left if it's smaller or +// equal to this constant. (This is a pure UX heuristic.) +// Please keep this constant in sync with the one in security_token_pin.js. +constexpr int kAttemptsLeftThreshold = 3; + base::string16 GenerateErrorMessage(ErrorLabel error_label, int attempts_left, bool accept_input) { @@ -38,18 +43,15 @@ break; } - if (!accept_input) { + if (!accept_input || attempts_left == -1 || + attempts_left > kAttemptsLeftThreshold) { return error_message; } - if (attempts_left == -1) { - return l10n_util::GetStringFUTF16(IDS_REQUEST_PIN_DIALOG_ERROR_RETRY, - error_message); - } if (error_message.empty()) { return l10n_util::GetStringFUTF16(IDS_REQUEST_PIN_DIALOG_ATTEMPTS_LEFT, base::FormatNumber(attempts_left)); } - return l10n_util::GetStringFUTF16(IDS_REQUEST_PIN_DIALOG_ERROR_RETRY_ATTEMPTS, + return l10n_util::GetStringFUTF16(IDS_REQUEST_PIN_DIALOG_ERROR_ATTEMPTS, error_message, base::FormatNumber(attempts_left)); }
diff --git a/chromeos/constants/chromeos_switches.cc b/chromeos/constants/chromeos_switches.cc index 3f4873b..d4ae1ac1 100644 --- a/chromeos/constants/chromeos_switches.cc +++ b/chromeos/constants/chromeos_switches.cc
@@ -430,6 +430,11 @@ // user-image const char kOobeForceShowScreen[] = "oobe-force-show-screen"; +// Indicates that the first user run flow (sequence of OOBE screens after the +// first user login) should show tablet mode centric screens, even if the device +// is not in tablet mode. +const char kOobeForceTabletFirstRun[] = "oobe-force-tablet-first-run"; + // Indicates that a guest session has been started before OOBE completion. const char kOobeGuestSession[] = "oobe-guest-session"; @@ -596,5 +601,10 @@ kUnfilteredBluetoothDevices); } +bool ShouldOobeUseTabletModeFirstRun() { + return base::CommandLine::ForCurrentProcess()->HasSwitch( + kOobeForceTabletFirstRun); +} + } // namespace switches } // namespace chromeos
diff --git a/chromeos/constants/chromeos_switches.h b/chromeos/constants/chromeos_switches.h index dd350387..b10b03e 100644 --- a/chromeos/constants/chromeos_switches.h +++ b/chromeos/constants/chromeos_switches.h
@@ -171,6 +171,8 @@ extern const char kNeedArcMigrationPolicyCheck[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kNoteTakingAppIds[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kOobeForceShowScreen[]; +COMPONENT_EXPORT(CHROMEOS_CONSTANTS) +extern const char kOobeForceTabletFirstRun[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kOobeGuestSession[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kOobeSkipPostLogin[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kOobeSkipToLogin[]; @@ -253,6 +255,11 @@ // Returns true if all Bluetooth devices in UI (System Tray/Settings Page.) COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsUnfilteredBluetoothDevicesEnabled(); +// Returns whether the first user run OOBE flow (sequence of screens shown to +// the user on their first login) should show tablet mode screens when the +// device is not in tablet mode. +COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool ShouldOobeUseTabletModeFirstRun(); + } // namespace switches } // namespace chromeos
diff --git a/components/arc/mojom/net.mojom b/components/arc/mojom/net.mojom index 81791af..1344d494 100644 --- a/components/arc/mojom/net.mojom +++ b/components/arc/mojom/net.mojom
@@ -192,8 +192,8 @@ // IP configuration for the network service inside ARC. array<IPConfiguration>? ip_configs; - // Deprecated field unused from ARC P and later. - string? deprecated_mac_address; + // MAC address of the network interface inside the ARC. + string? mac_address; // The type of the underlying physical network. NetworkType type; @@ -336,7 +336,7 @@ }; // Next Method ID: 14 -// IDs 3 and 9 are missing as they belonged to deprecated methods. +// ID 3 is missing as it belonged to a deprecated method. interface NetHost { // Sends a request to get enabled / disabled status of WiFi. GetWifiEnabledState@1() => (bool is_enabled); @@ -364,6 +364,11 @@ // Disconnects from network |guid|. [MinVersion=4] StartDisconnect@8(string guid) => (NetworkResult status); + // Retrieve details (IP, SSID, etc.) about the current network connection. + [MinVersion=5] GetDefaultNetwork@9() => ( + NetworkConfiguration? logical_default, + NetworkConfiguration? physical_default); + // Sends a request to get the subset of network services existing on Chrome OS // that match the kind specified with GetNetworksRequestType. This call // supports three usages: @@ -396,7 +401,6 @@ }; // Next Method ID: 8 -// ID 2 is missing as it belonged to deprecated method. interface NetInstance { // DEPRECATED: Please use Init@6 instead. InitDeprecated@0(NetHost host_ptr); @@ -407,6 +411,11 @@ // Notifies the instance of a WiFI AP scan being completed. [MinVersion=1] ScanCompleted@1(); + // Notifies the instance of a change in the host default network service. + [MinVersion=2] DefaultNetworkChanged@2( + NetworkConfiguration? logical_default, + NetworkConfiguration? physical_default); + // Notifies the instance of a change in the state of WiFi on the host. [MinVersion=3] WifiEnabledStateChanged@3(bool is_enabled);
diff --git a/components/arc/net/arc_net_host_impl.cc b/components/arc/net/arc_net_host_impl.cc index 2a247d2..efb55dff 100644 --- a/components/arc/net/arc_net_host_impl.cc +++ b/components/arc/net/arc_net_host_impl.cc
@@ -355,6 +355,8 @@ mojo->guid = GetStringFromONCDictionary(dict, onc::network_config::kGUID, true /* required */); + mojo->mac_address = GetStringFromONCDictionary( + dict, onc::network_config::kMacAddress, false /* required */); TranslateONCNetworkTypeDetails(dict, mojo.get()); if (network_state) { @@ -454,6 +456,36 @@ std::move(callback).Run(arc::mojom::NetworkResult::FAILURE); } +void GetDefaultNetworkSuccessCallback( + base::OnceCallback<void(arc::mojom::NetworkConfigurationPtr, + arc::mojom::NetworkConfigurationPtr)> callback, + const std::string& service_path, + const base::DictionaryValue& dictionary) { + // TODO(cernekee): Figure out how to query Chrome for the default physical + // service if a VPN is connected, rather than just reporting the + // default logical service in both fields. + const chromeos::NetworkState* network_state = + GetStateHandler()->GetNetworkState(service_path); + std::move(callback).Run( + TranslateONCConfiguration(network_state, &dictionary), + TranslateONCConfiguration(network_state, &dictionary)); +} + +void GetDefaultNetworkFailureCallback( + base::OnceCallback<void(arc::mojom::NetworkConfigurationPtr, + arc::mojom::NetworkConfigurationPtr)> callback, + const std::string& error_name, + std::unique_ptr<base::DictionaryValue> error_data) { + LOG(ERROR) << "Failed to query default logical network: " << error_name; + std::move(callback).Run(nullptr, nullptr); +} + +void DefaultNetworkFailureCallback( + const std::string& error_name, + std::unique_ptr<base::DictionaryValue> error_data) { + LOG(ERROR) << "Failed to query default logical network: " << error_name; +} + void ArcVpnSuccessCallback() { DVLOG(1) << "ArcVpnSuccessCallback"; } @@ -767,8 +799,80 @@ net_instance->ScanCompleted(); } +const chromeos::NetworkState* ArcNetHostImpl::GetDefaultNetworkFromChrome() { + // If an Android VPN is connected, report the underlying physical + // connection only. Never tell Android about its own VPN. + // If a Chrome OS VPN is connected, report the Chrome OS VPN as the + // default connection. + if (arc_vpn_service_path_.empty()) { + return GetShillBackedNetwork(GetStateHandler()->DefaultNetwork()); + } + + return GetShillBackedNetwork(GetStateHandler()->ConnectedNetworkByType( + chromeos::NetworkTypePattern::NonVirtual())); +} + +void ArcNetHostImpl::GetDefaultNetwork(GetDefaultNetworkCallback callback) { + const chromeos::NetworkState* default_network = GetDefaultNetworkFromChrome(); + + if (!default_network) { + VLOG(1) << "GetDefaultNetwork: no default network"; + std::move(callback).Run(nullptr, nullptr); + return; + } + VLOG(1) << "GetDefaultNetwork: default network is " + << default_network->path(); + std::string user_id_hash = chromeos::LoginState::Get()->primary_user_hash(); + // TODO(crbug.com/730593): Remove AdaptCallbackForRepeating() by updating + // the callee interface. + auto repeating_callback = + base::AdaptCallbackForRepeating(std::move(callback)); + GetManagedConfigurationHandler()->GetProperties( + user_id_hash, default_network->path(), + base::Bind(&GetDefaultNetworkSuccessCallback, repeating_callback), + base::Bind(&GetDefaultNetworkFailureCallback, repeating_callback)); +} + +void ArcNetHostImpl::DefaultNetworkSuccessCallback( + const std::string& service_path, + const base::DictionaryValue& dictionary) { + auto* net_instance = ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service_->net(), + DefaultNetworkChanged); + if (!net_instance) + return; + + const chromeos::NetworkState* network_state = + GetStateHandler()->GetNetworkState(service_path); + net_instance->DefaultNetworkChanged( + TranslateONCConfiguration(network_state, &dictionary), + TranslateONCConfiguration(network_state, &dictionary)); +} + +void ArcNetHostImpl::UpdateDefaultNetwork() { + const chromeos::NetworkState* default_network = GetDefaultNetworkFromChrome(); + + if (!default_network) { + VLOG(1) << "No default network"; + auto* net_instance = ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service_->net(), + DefaultNetworkChanged); + if (net_instance) + net_instance->DefaultNetworkChanged(nullptr, nullptr); + return; + } + + VLOG(1) << "New default network: " << default_network->path() << " (" + << default_network->type() << ")"; + std::string user_id_hash = chromeos::LoginState::Get()->primary_user_hash(); + GetManagedConfigurationHandler()->GetProperties( + user_id_hash, default_network->path(), + base::Bind(&ArcNetHostImpl::DefaultNetworkSuccessCallback, + weak_factory_.GetWeakPtr()), + base::Bind(&DefaultNetworkFailureCallback)); +} + void ArcNetHostImpl::DefaultNetworkChanged( const chromeos::NetworkState* network) { + UpdateDefaultNetwork(); UpdateActiveNetworks(); } @@ -966,6 +1070,12 @@ void ArcNetHostImpl::NetworkConnectionStateChanged( const chromeos::NetworkState* network) { + // DefaultNetworkChanged() won't be invoked if an ARC VPN is the default + // network and the underlying physical connection changed, so check for + // that condition here. This is invoked any time any service state + // changes. + UpdateDefaultNetwork(); + const chromeos::NetworkState* shill_backed_network = GetShillBackedNetwork(network); if (!shill_backed_network) @@ -1034,6 +1144,7 @@ // During the transition when a new service comes online, it will // temporarily be ranked below "inferior" services. This callback // informs us that shill's ordering has been updated. + UpdateDefaultNetwork(); UpdateActiveNetworks(); }
diff --git a/components/arc/net/arc_net_host_impl.h b/components/arc/net/arc_net_host_impl.h index f9cb5c8..63e2f63 100644 --- a/components/arc/net/arc_net_host_impl.h +++ b/components/arc/net/arc_net_host_impl.h
@@ -96,6 +96,7 @@ const std::vector<const chromeos::NetworkState*>& networks) override; void NetworkListChanged() override; void DeviceListChanged() override; + void GetDefaultNetwork(GetDefaultNetworkCallback callback) override; // Overriden from chromeos::NetworkConnectionObserver. void DisconnectRequested(const std::string& service_path) override; @@ -106,6 +107,7 @@ private: const chromeos::NetworkState* GetDefaultNetworkFromChrome(); + void UpdateDefaultNetwork(); void UpdateActiveNetworks(); void DefaultNetworkSuccessCallback(const std::string& service_path, const base::DictionaryValue& dictionary);
diff --git a/components/autofill_assistant/browser/access_token_fetcher.h b/components/autofill_assistant/browser/access_token_fetcher.h index 9800def..c8759f7 100644 --- a/components/autofill_assistant/browser/access_token_fetcher.h +++ b/components/autofill_assistant/browser/access_token_fetcher.h
@@ -7,6 +7,8 @@ #include <string> +#include "base/callback.h" + namespace autofill_assistant { // An interface that abstracts the steps needed to choose a user to sign in,
diff --git a/components/drive/drive_notification_manager.cc b/components/drive/drive_notification_manager.cc index 24c41d3..a637c3c 100644 --- a/components/drive/drive_notification_manager.cc +++ b/components/drive/drive_notification_manager.cc
@@ -244,7 +244,6 @@ return; syncer::TopicSet topics; - syncer::ObjectIdSet ids; topics.insert(GetDriveInvalidationTopic()); for (const auto& team_drive_id : team_drive_ids_) {
diff --git a/components/embedder_support/android/java/src/org/chromium/components/embedder_support/util/UrlConstants.java b/components/embedder_support/android/java/src/org/chromium/components/embedder_support/util/UrlConstants.java index cf9cee2..8c71061 100644 --- a/components/embedder_support/android/java/src/org/chromium/components/embedder_support/util/UrlConstants.java +++ b/components/embedder_support/android/java/src/org/chromium/components/embedder_support/util/UrlConstants.java
@@ -29,7 +29,6 @@ public static final String CHROME_NATIVE_URL_SHORT_PREFIX = "chrome-native:"; public static final String FILE_URL_SHORT_PREFIX = "file:"; public static final String DEVTOOLS_URL_SHORT_PREFIX = "devtools:"; - public static final String DEVTOOLS_FALLBACK_URL_SHORT_PREFIX = "chrome-devtools:"; public static final String INTENT_URL_SHORT_PREFIX = "intent:"; public static final String APP_INTENT_URL_SHORT_PREFIX = "android-app:";
diff --git a/components/invalidation/DEPS b/components/invalidation/DEPS index beaa4be..4745992 100644 --- a/components/invalidation/DEPS +++ b/components/invalidation/DEPS
@@ -3,7 +3,6 @@ "-content", "-components/invalidation", "+components/prefs", - "+google/cacheinvalidation", "+google_apis/gaia", "+mojo/public", ]
diff --git a/components/invalidation/impl/BUILD.gn b/components/invalidation/impl/BUILD.gn index a9d5aae..7848e97 100644 --- a/components/invalidation/impl/BUILD.gn +++ b/components/invalidation/impl/BUILD.gn
@@ -137,10 +137,7 @@ "topic_invalidation_map_test_util.h", ] - public_deps = [ - ":impl", - "//third_party/cacheinvalidation", - ] + public_deps = [ ":impl" ] deps = [ "//base", "//components/gcm_driver:test_support",
diff --git a/components/invalidation/impl/fake_invalidation_service.cc b/components/invalidation/impl/fake_invalidation_service.cc index 17aa400..7795eebc 100644 --- a/components/invalidation/impl/fake_invalidation_service.cc +++ b/components/invalidation/impl/fake_invalidation_service.cc
@@ -78,8 +78,7 @@ // If no one is listening to this invalidation, do not send it out. syncer::Topics subscribed_topics = invalidator_registrar_->GetAllSubscribedTopics(); - if (subscribed_topics.find(invalidation.object_id().name()) == - subscribed_topics.end()) { + if (subscribed_topics.find(invalidation.topic()) == subscribed_topics.end()) { mock_ack_handler_.RegisterUnsentInvalidation(&invalidation_copy); return; }
diff --git a/components/invalidation/impl/fcm_invalidation_listener.cc b/components/invalidation/impl/fcm_invalidation_listener.cc index 9d6999d..bcb376f 100644 --- a/components/invalidation/impl/fcm_invalidation_listener.cc +++ b/components/invalidation/impl/fcm_invalidation_listener.cc
@@ -10,7 +10,6 @@ #include "components/invalidation/public/invalidation_util.h" #include "components/invalidation/public/topic_invalidation_map.h" #include "components/prefs/pref_service.h" -#include "google/cacheinvalidation/include/types.h" namespace syncer { @@ -79,8 +78,8 @@ return; } TopicInvalidationMap invalidations; - Invalidation inv = Invalidation::Init( - ConvertTopicToId(*expected_public_topic), version, payload); + Invalidation inv = + Invalidation::Init(*expected_public_topic, version, payload); inv.SetAckHandler(weak_factory_.GetWeakPtr(), base::ThreadTaskRunnerHandle::Get()); DVLOG(1) << "Received invalidation with version " << inv.version() << " for "
diff --git a/components/invalidation/impl/fcm_invalidation_listener_unittest.cc b/components/invalidation/impl/fcm_invalidation_listener_unittest.cc index 2b037d5..9c174c3 100644 --- a/components/invalidation/impl/fcm_invalidation_listener_unittest.cc +++ b/components/invalidation/impl/fcm_invalidation_listener_unittest.cc
@@ -337,9 +337,8 @@ EXPECT_EQ(initial_version + kRepeatCount - 1, GetVersion(topic)); } -// Fire an invalidation for an unregistered object topic with a payload. It -// should still be processed, and both the payload and the version should be -// updated. +// Fire an invalidation for an unregistered topic with a payload. It should +// still be processed, and both the payload and the version should be updated. TEST_F(FCMInvalidationListenerTest, InvalidateBeforeRegistration_Simple) { const Topic kUnregisteredId = "unregistered"; const Topic& topic = kUnregisteredId; @@ -361,7 +360,7 @@ EXPECT_EQ(kPayload1, GetPayload(topic)); } -// Fire ten invalidations before an object registers. Some invalidations will +// Fire ten invalidations before an topics registers. Some invalidations will // be dropped an replaced with an unknown version invalidation. TEST_F(FCMInvalidationListenerTest, InvalidateBeforeRegistration_Drop) { const int kRepeatCount =
diff --git a/components/invalidation/impl/invalidation_logger.h b/components/invalidation/impl/invalidation_logger.h index 46eed4a2..7b4bec3 100644 --- a/components/invalidation/impl/invalidation_logger.h +++ b/components/invalidation/impl/invalidation_logger.h
@@ -81,8 +81,8 @@ syncer::InvalidatorState last_invalidator_state_; base::Time last_invalidator_state_timestamp_; - // The map that contains every object id that is currently registered - // and its owner. + // The map that contains every topic that is currently registered and its + // owner. std::map<std::string, syncer::Topics> handler_latest_topics_map_; // The map that counts how many invalidations per Topic there has been.
diff --git a/components/invalidation/impl/invalidation_logger_unittest.cc b/components/invalidation/impl/invalidation_logger_unittest.cc index aaaf9e8c..86073f0 100644 --- a/components/invalidation/impl/invalidation_logger_unittest.cc +++ b/components/invalidation/impl/invalidation_logger_unittest.cc
@@ -154,10 +154,10 @@ log.UnregisterObserver(&observer_test); } -// Test that the updateId notification actually sends the same ObjectId that -// was sent to the Observer. +// Test that the OnUpdatedTopics() notification actually sends the same Topic +// that was sent to the Observer. // The ObserverTest rebuilds the map that was sent in pieces by the logger. -TEST(InvalidationLoggerTest, TestUpdateIdsMap) { +TEST(InvalidationLoggerTest, TestUpdatedTopicsMap) { InvalidationLogger log; InvalidationLoggerObserverTest observer_test; std::map<std::string, syncer::Topics> send_test_map;
diff --git a/components/invalidation/impl/invalidation_service_test_template.h b/components/invalidation/impl/invalidation_service_test_template.h index e273ddb..50dfae0e 100644 --- a/components/invalidation/impl/invalidation_service_test_template.h +++ b/components/invalidation/impl/invalidation_service_test_template.h
@@ -153,7 +153,7 @@ expected_invalidations.Insert( syncer::Invalidation::Init(this->topic3, 3, "3")); - // Removed object IDs should not be notified, newly-added ones should. + // Removed Topics should not be notified, newly-added ones should. this->delegate_.TriggerOnIncomingInvalidation(invalidation_map); EXPECT_EQ(2, handler.GetInvalidationCount()); EXPECT_THAT(expected_invalidations, Eq(handler.GetLastInvalidationMap())); @@ -269,8 +269,8 @@ invalidator->UnregisterInvalidationHandler(&handler1); } -// Multiple registrations by different handlers on the same object ID should -// return false. +// Multiple registrations by different handlers on the same Topic should return +// false. TYPED_TEST_P(InvalidationServiceTest, MultipleRegistrations) { invalidation::InvalidationService* const invalidator = this->CreateAndInitializeInvalidationService();
diff --git a/components/invalidation/impl/invalidation_test_util.cc b/components/invalidation/impl/invalidation_test_util.cc index 7ac4a17..1132ab1 100644 --- a/components/invalidation/impl/invalidation_test_util.cc +++ b/components/invalidation/impl/invalidation_test_util.cc
@@ -74,7 +74,7 @@ bool InvalidationEqMatcher::MatchAndExplain( const Invalidation& actual, MatchResultListener* listener) const { - if (!(expected_.object_id() == actual.object_id())) + if (expected_.topic() != actual.topic()) return false; if (expected_.is_unknown_version() && actual.is_unknown_version()) return true;
diff --git a/components/invalidation/impl/invalidator_registrar_with_memory_unittest.cc b/components/invalidation/impl/invalidator_registrar_with_memory_unittest.cc index c201aa6..227cc54 100644 --- a/components/invalidation/impl/invalidator_registrar_with_memory_unittest.cc +++ b/components/invalidation/impl/invalidator_registrar_with_memory_unittest.cc
@@ -13,23 +13,30 @@ #include "components/invalidation/public/invalidator_state.h" #include "components/invalidation/public/topic_invalidation_map.h" #include "components/prefs/testing_pref_service.h" -#include "google/cacheinvalidation/include/types.h" -#include "google/cacheinvalidation/types.pb.h" #include "testing/gtest/include/gtest/gtest.h" namespace syncer { namespace { +Topics TopicSetToTopics(const TopicSet& topic_set, + InvalidationHandler* handler) { + DCHECK(handler); + Topics result; + for (const Topic& topic : topic_set) { + result.emplace(topic, TopicMetadata{handler->IsPublicTopic(topic)}); + } + return result; +} + // Initialize the invalidator, register a handler, register some topics for that // handler, and then unregister the handler, dispatching invalidations in // between. The handler should only see invalidations when it's registered and // its topics are registered. TEST(InvalidatorRegistrarWithMemoryTest, Basic) { - const invalidation::ObjectId id1(ipc::invalidation::ObjectSource::TEST, "a"); - const invalidation::ObjectId id2(ipc::invalidation::ObjectSource::TEST, "b"); - const invalidation::ObjectId id3(ipc::invalidation::ObjectSource::TEST, "c"); - const invalidation::ObjectId id4(ipc::invalidation::ObjectSource::TEST, "d"); + const Topic kTopic1 = "a"; + const Topic kTopic2 = "b"; + const Topic kTopic3 = "c"; TestingPrefServiceSimple pref_service; InvalidatorRegistrarWithMemory::RegisterProfilePrefs(pref_service.registry()); @@ -41,35 +48,35 @@ invalidator->RegisterHandler(&handler); TopicInvalidationMap invalidation_map; - invalidation_map.Insert(Invalidation::Init(id1, 1, "1")); - invalidation_map.Insert(Invalidation::Init(id2, 2, "2")); - invalidation_map.Insert(Invalidation::Init(id3, 3, "3")); + invalidation_map.Insert(Invalidation::Init(kTopic1, 1, "1")); + invalidation_map.Insert(Invalidation::Init(kTopic2, 2, "2")); + invalidation_map.Insert(Invalidation::Init(kTopic3, 3, "3")); // Should be ignored since no topics are registered to |handler|. invalidator->DispatchInvalidationsToHandlers(invalidation_map); EXPECT_EQ(0, handler.GetInvalidationCount()); EXPECT_TRUE(invalidator->UpdateRegisteredTopics( - &handler, ConvertIdsToTopics({id1, id2}, &handler))); + &handler, TopicSetToTopics({kTopic1, kTopic2}, &handler))); invalidator->UpdateInvalidatorState(INVALIDATIONS_ENABLED); EXPECT_EQ(INVALIDATIONS_ENABLED, handler.GetInvalidatorState()); TopicInvalidationMap expected_invalidations; - expected_invalidations.Insert(Invalidation::Init(id1, 1, "1")); - expected_invalidations.Insert(Invalidation::Init(id2, 2, "2")); + expected_invalidations.Insert(Invalidation::Init(kTopic1, 1, "1")); + expected_invalidations.Insert(Invalidation::Init(kTopic2, 2, "2")); invalidator->DispatchInvalidationsToHandlers(invalidation_map); EXPECT_EQ(1, handler.GetInvalidationCount()); EXPECT_EQ(expected_invalidations, handler.GetLastInvalidationMap()); - // Remove id1, add id3. + // Remove kTopic1, add kTopic3. EXPECT_TRUE(invalidator->UpdateRegisteredTopics( - &handler, ConvertIdsToTopics({id2, id3}, &handler))); + &handler, TopicSetToTopics({kTopic2, kTopic3}, &handler))); expected_invalidations = TopicInvalidationMap(); - expected_invalidations.Insert(Invalidation::Init(id2, 2, "2")); - expected_invalidations.Insert(Invalidation::Init(id3, 3, "3")); + expected_invalidations.Insert(Invalidation::Init(kTopic2, 2, "2")); + expected_invalidations.Insert(Invalidation::Init(kTopic3, 3, "3")); // Removed topic should not be notified, newly-added ones should. invalidator->DispatchInvalidationsToHandlers(invalidation_map); @@ -95,10 +102,10 @@ // invalidations, and the ones that have registered topics should receive // invalidations for those topics. TEST(InvalidatorRegistrarWithMemoryTest, MultipleHandlers) { - const invalidation::ObjectId id1(ipc::invalidation::ObjectSource::TEST, "a"); - const invalidation::ObjectId id2(ipc::invalidation::ObjectSource::TEST, "b"); - const invalidation::ObjectId id3(ipc::invalidation::ObjectSource::TEST, "c"); - const invalidation::ObjectId id4(ipc::invalidation::ObjectSource::TEST, "d"); + const Topic kTopic1 = "a"; + const Topic kTopic2 = "b"; + const Topic kTopic3 = "c"; + const Topic kTopic4 = "d"; TestingPrefServiceSimple pref_service; InvalidatorRegistrarWithMemory::RegisterProfilePrefs(pref_service.registry()); @@ -117,12 +124,12 @@ invalidator->RegisterHandler(&handler4); EXPECT_TRUE(invalidator->UpdateRegisteredTopics( - &handler1, ConvertIdsToTopics({id1, id2}, &handler1))); + &handler1, TopicSetToTopics({kTopic1, kTopic2}, &handler1))); EXPECT_TRUE(invalidator->UpdateRegisteredTopics( - &handler2, ConvertIdsToTopics({id3}, &handler2))); + &handler2, TopicSetToTopics({kTopic3}, &handler2))); // Don't register any IDs for handler3. EXPECT_TRUE(invalidator->UpdateRegisteredTopics( - &handler4, ConvertIdsToTopics({id4}, &handler4))); + &handler4, TopicSetToTopics({kTopic4}, &handler4))); invalidator->UnregisterHandler(&handler4); @@ -133,22 +140,22 @@ EXPECT_EQ(TRANSIENT_INVALIDATION_ERROR, handler4.GetInvalidatorState()); TopicInvalidationMap invalidation_map; - invalidation_map.Insert(Invalidation::Init(id1, 1, "1")); - invalidation_map.Insert(Invalidation::Init(id2, 2, "2")); - invalidation_map.Insert(Invalidation::Init(id3, 3, "3")); - invalidation_map.Insert(Invalidation::Init(id4, 4, "4")); + invalidation_map.Insert(Invalidation::Init(kTopic1, 1, "1")); + invalidation_map.Insert(Invalidation::Init(kTopic2, 2, "2")); + invalidation_map.Insert(Invalidation::Init(kTopic3, 3, "3")); + invalidation_map.Insert(Invalidation::Init(kTopic4, 4, "4")); invalidator->DispatchInvalidationsToHandlers(invalidation_map); TopicInvalidationMap expected_invalidations1; - expected_invalidations1.Insert(Invalidation::Init(id1, 1, "1")); - expected_invalidations1.Insert(Invalidation::Init(id2, 2, "2")); + expected_invalidations1.Insert(Invalidation::Init(kTopic1, 1, "1")); + expected_invalidations1.Insert(Invalidation::Init(kTopic2, 2, "2")); EXPECT_EQ(1, handler1.GetInvalidationCount()); EXPECT_EQ(expected_invalidations1, handler1.GetLastInvalidationMap()); TopicInvalidationMap expected_invalidations2; - expected_invalidations2.Insert(Invalidation::Init(id3, 3, "3")); + expected_invalidations2.Insert(Invalidation::Init(kTopic3, 3, "3")); EXPECT_EQ(1, handler2.GetInvalidationCount()); EXPECT_EQ(expected_invalidations2, handler2.GetLastInvalidationMap()); @@ -170,7 +177,7 @@ // Multiple registrations by different handlers on the same topic should // return false. TEST(InvalidatorRegistrarWithMemoryTest, MultipleRegistrations) { - const invalidation::ObjectId id1(ipc::invalidation::ObjectSource::TEST, "a"); + const Topic kTopic1 = "a"; TestingPrefServiceSimple pref_service; InvalidatorRegistrarWithMemory::RegisterProfilePrefs(pref_service.registry()); @@ -187,9 +194,9 @@ // Registering both handlers for the same topic. First call should succeed, // second should fail. EXPECT_TRUE(invalidator->UpdateRegisteredTopics( - &handler1, ConvertIdsToTopics({id1}, &handler1))); + &handler1, TopicSetToTopics({kTopic1}, &handler1))); EXPECT_FALSE(invalidator->UpdateRegisteredTopics( - &handler2, ConvertIdsToTopics({id1}, &handler2))); + &handler2, TopicSetToTopics({kTopic1}, &handler2))); // |handler1| should still own subscription to the topic and deregistration // of its topics should update subscriptions. @@ -203,9 +210,9 @@ // Make sure that passing an empty set to UpdateRegisteredTopics clears the // corresponding entries for the handler. TEST(InvalidatorRegistrarWithMemoryTest, EmptySetUnregisters) { - const invalidation::ObjectId id1(ipc::invalidation::ObjectSource::TEST, "a"); - const invalidation::ObjectId id2(ipc::invalidation::ObjectSource::TEST, "b"); - const invalidation::ObjectId id3(ipc::invalidation::ObjectSource::TEST, "c"); + const Topic kTopic1 = "a"; + const Topic kTopic2 = "b"; + const Topic kTopic3 = "c"; TestingPrefServiceSimple pref_service; InvalidatorRegistrarWithMemory::RegisterProfilePrefs(pref_service.registry()); @@ -222,9 +229,9 @@ invalidator->RegisterHandler(&handler2); EXPECT_TRUE(invalidator->UpdateRegisteredTopics( - &handler1, ConvertIdsToTopics({id1, id2}, &handler1))); + &handler1, TopicSetToTopics({kTopic1, kTopic2}, &handler1))); EXPECT_TRUE(invalidator->UpdateRegisteredTopics( - &handler2, ConvertIdsToTopics({id3}, &handler2))); + &handler2, TopicSetToTopics({kTopic3}, &handler2))); // Unregister the topics for the first observer. It should not receive any // further invalidations. @@ -236,9 +243,9 @@ { TopicInvalidationMap invalidation_map; - invalidation_map.Insert(Invalidation::Init(id1, 1, "1")); - invalidation_map.Insert(Invalidation::Init(id2, 2, "2")); - invalidation_map.Insert(Invalidation::Init(id3, 3, "3")); + invalidation_map.Insert(Invalidation::Init(kTopic1, 1, "1")); + invalidation_map.Insert(Invalidation::Init(kTopic2, 2, "2")); + invalidation_map.Insert(Invalidation::Init(kTopic3, 3, "3")); invalidator->DispatchInvalidationsToHandlers(invalidation_map); EXPECT_EQ(0, handler1.GetInvalidationCount()); EXPECT_EQ(1, handler2.GetInvalidationCount());
diff --git a/components/invalidation/impl/per_user_topic_subscription_manager_unittest.cc b/components/invalidation/impl/per_user_topic_subscription_manager_unittest.cc index a608089..197f05b 100644 --- a/components/invalidation/impl/per_user_topic_subscription_manager_unittest.cc +++ b/components/invalidation/impl/per_user_topic_subscription_manager_unittest.cc
@@ -36,7 +36,7 @@ namespace { -size_t kInvalidationObjectIdsCount = 5; +size_t kInvalidationTopicsCount = 5; const char kInvalidationRegistrationScope[] = "https://firebaseperusertopics-pa.googleapis.com"; @@ -69,10 +69,11 @@ } Topics GetSequenceOfTopicsStartingAt(size_t start, size_t count) { - Topics ids; - for (size_t i = start; i < start + count; ++i) - ids.emplace(IndexToName(i), TopicMetadata{false}); - return ids; + Topics topics; + for (size_t i = start; i < start + count; ++i) { + topics.emplace(IndexToName(i), TopicMetadata{false}); + } + return topics; } Topics GetSequenceOfTopics(size_t count) { @@ -223,7 +224,7 @@ TEST_F(PerUserTopicSubscriptionManagerTest, EmptyPrivateTopicShouldNotUpdateSubscribedTopics) { - auto ids = GetSequenceOfTopics(kInvalidationObjectIdsCount); + auto topics = GetSequenceOfTopics(kInvalidationTopicsCount); auto per_user_topic_subscription_manager = BuildRegistrationManager(); @@ -239,7 +240,7 @@ CreateStatusForTest(net::OK, response_body)); per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); base::RunLoop().RunUntilIdle(); // The response didn't contain non-empty topic name. So nothing was @@ -249,7 +250,7 @@ } TEST_F(PerUserTopicSubscriptionManagerTest, ShouldUpdateSubscribedTopics) { - auto ids = GetSequenceOfTopics(kInvalidationObjectIdsCount); + auto topics = GetSequenceOfTopics(kInvalidationTopicsCount); auto per_user_topic_subscription_manager = BuildRegistrationManager(); ASSERT_TRUE(per_user_topic_subscription_manager->GetSubscribedTopicsForTest() @@ -258,18 +259,18 @@ AddCorrectSubscriptionResponce(); per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(TopicSetFromTopics(ids), + EXPECT_EQ(TopicSetFromTopics(topics), per_user_topic_subscription_manager->GetSubscribedTopicsForTest()); EXPECT_TRUE( per_user_topic_subscription_manager->HaveAllRequestsFinishedForTest()); - for (const auto& id : ids) { + for (const auto& topic : topics) { const base::Value* topics = GetSubscribedTopics(); const base::Value* private_topic_value = - topics->FindKeyOfType(id.first, base::Value::Type::STRING); + topics->FindKeyOfType(topic.first, base::Value::Type::STRING); ASSERT_NE(private_topic_value, nullptr); } } @@ -295,7 +296,7 @@ identity_test_env()->identity_manager()->AddDiagnosticsObserver( &identity_observer); - auto ids = GetSequenceOfTopics(kInvalidationObjectIdsCount); + auto topics = GetSequenceOfTopics(kInvalidationTopicsCount); auto per_user_topic_subscription_manager = BuildRegistrationManager(); ASSERT_TRUE(per_user_topic_subscription_manager->GetSubscribedTopicsForTest() @@ -310,7 +311,7 @@ EXPECT_CALL(identity_observer, OnAccessTokenRemovedFromCache(_, _)).Times(0); per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); // This should have resulted in a request for an access token. Return one. identity_test_env()->WaitForAccessTokenRequestIfNecessaryAndRespondWithToken( "access_token", base::Time::Max()); @@ -330,7 +331,7 @@ // Repeating subscriptions shouldn't bypass backoff. // This should have resulted in a request for an access token. Return one. per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); identity_test_env()->WaitForAccessTokenRequestIfNecessaryAndRespondWithToken( "access_token", base::Time::Max()); @@ -363,31 +364,31 @@ } TEST_F(PerUserTopicSubscriptionManagerTest, ShouldNotRepeatOngoingRequests) { - auto ids = GetSequenceOfTopics(kInvalidationObjectIdsCount); + auto topics = GetSequenceOfTopics(kInvalidationTopicsCount); auto per_user_topic_subscription_manager = BuildRegistrationManager(); per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); // Wait for the subscription requests to happen. base::RunLoop().RunUntilIdle(); // No response was set, so there should be one pending request per - // invalidation object id. + // invalidation topic. // Check pending_requests() size instead of NumPending(), because // NumPending() filters out cancelled requests. ASSERT_THAT(*url_loader_factory()->pending_requests(), - SizeIs(kInvalidationObjectIdsCount)); + SizeIs(kInvalidationTopicsCount)); per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); // Ensure that all subscription requests have happened. base::RunLoop().RunUntilIdle(); // No changes in wanted subscriptions or access token, so there should still - // be only one pending request per invalidation object id. + // be only one pending request per invalidation topic. // Check pending_requests() size instead of NumPending(), because // NumPending() filters out cancelled requests. EXPECT_THAT(*url_loader_factory()->pending_requests(), - SizeIs(kInvalidationObjectIdsCount)); + SizeIs(kInvalidationTopicsCount)); } TEST_F(PerUserTopicSubscriptionManagerTest, @@ -399,7 +400,7 @@ identity_test_env()->identity_manager()->AddDiagnosticsObserver( &identity_observer); - auto ids = GetSequenceOfTopics(kInvalidationObjectIdsCount); + auto topics = GetSequenceOfTopics(kInvalidationTopicsCount); auto per_user_topic_subscription_manager = BuildRegistrationManager(); ASSERT_TRUE(per_user_topic_subscription_manager->GetSubscribedTopicsForTest() @@ -408,7 +409,7 @@ // Emulate failure on first access token request. EXPECT_CALL(identity_observer, OnAccessTokenRequested(_, _, _)); per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); identity_test_env()->WaitForAccessTokenRequestIfNecessaryAndRespondWithError( GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED)); testing::Mock::VerifyAndClearExpectations(&identity_observer); @@ -419,7 +420,7 @@ EXPECT_CALL(identity_observer, OnAccessTokenRequested(_, _, _)).Times(0); // UpdateSubscribedTopics() call shouldn't lead to backoff bypassing. per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); FastForwardTimeBy(base::TimeDelta::FromMilliseconds(1500)); testing::Mock::VerifyAndClearExpectations(&identity_observer); @@ -453,7 +454,7 @@ identity_test_env()->identity_manager()->AddDiagnosticsObserver( &identity_observer); - auto ids = GetSequenceOfTopics(kInvalidationObjectIdsCount); + auto topics = GetSequenceOfTopics(kInvalidationTopicsCount); auto per_user_topic_subscription_manager = BuildRegistrationManager(); ASSERT_TRUE(per_user_topic_subscription_manager->GetSubscribedTopicsForTest() @@ -467,7 +468,7 @@ EXPECT_CALL(identity_observer, OnAccessTokenRemovedFromCache(_, _)); per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); // This should have resulted in a request for an access token. Return one // (which is considered invalid, e.g. already expired). identity_test_env()->WaitForAccessTokenRequestIfNecessaryAndRespondWithToken( @@ -510,7 +511,7 @@ identity_test_env()->identity_manager()->AddDiagnosticsObserver( &identity_observer); - auto ids = GetSequenceOfTopics(kInvalidationObjectIdsCount); + auto topics = GetSequenceOfTopics(kInvalidationTopicsCount); auto per_user_topic_subscription_manager = BuildRegistrationManager(); ASSERT_TRUE(per_user_topic_subscription_manager->GetSubscribedTopicsForTest() @@ -524,7 +525,7 @@ EXPECT_CALL(identity_observer, OnAccessTokenRemovedFromCache(_, _)); per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); // This should have resulted in a request for an access token. Return one // (which is considered invalid, e.g. already expired). identity_test_env()->WaitForAccessTokenRequestIfNecessaryAndRespondWithToken( @@ -565,7 +566,7 @@ TEST_F(PerUserTopicSubscriptionManagerTest, ShouldNotRepeatRequestsOnForbidden) { - auto ids = GetSequenceOfTopics(kInvalidationObjectIdsCount); + auto topics = GetSequenceOfTopics(kInvalidationTopicsCount); auto per_user_topic_subscription_manager = BuildRegistrationManager(); ASSERT_TRUE(per_user_topic_subscription_manager->GetSubscribedTopicsForTest() @@ -576,7 +577,7 @@ net::HTTP_FORBIDDEN); per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); base::RunLoop().RunUntilIdle(); EXPECT_TRUE(per_user_topic_subscription_manager->GetSubscribedTopicsForTest() @@ -586,8 +587,8 @@ } TEST_F(PerUserTopicSubscriptionManagerTest, - ShouldDisableIdsAndDeleteFromPrefs) { - auto ids = GetSequenceOfTopics(kInvalidationObjectIdsCount); + ShouldDisableTopicsAndDeleteFromPrefs) { + auto topics = GetSequenceOfTopics(kInvalidationTopicsCount); AddCorrectSubscriptionResponce(); @@ -596,41 +597,41 @@ .empty()); per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(TopicSetFromTopics(ids), + EXPECT_EQ(TopicSetFromTopics(topics), per_user_topic_subscription_manager->GetSubscribedTopicsForTest()); - // Disable some ids. - auto disabled_ids = GetSequenceOfTopics(3); - auto enabled_ids = - GetSequenceOfTopicsStartingAt(3, kInvalidationObjectIdsCount - 3); - for (const auto& id : disabled_ids) - AddCorrectUnSubscriptionResponceForTopic(id.first); + // Disable some topics. + auto disabled_topics = GetSequenceOfTopics(3); + auto enabled_topics = + GetSequenceOfTopicsStartingAt(3, kInvalidationTopicsCount - 3); + for (const auto& topic : disabled_topics) + AddCorrectUnSubscriptionResponceForTopic(topic.first); per_user_topic_subscription_manager->UpdateSubscribedTopics( - enabled_ids, kFakeInstanceIdToken); + enabled_topics, kFakeInstanceIdToken); base::RunLoop().RunUntilIdle(); - // ids were disabled, check that they're not in the prefs. - for (const auto& id : disabled_ids) { + // Topics were disabled, check that they're not in the prefs. + for (const auto& topic : disabled_topics) { const base::Value* topics = GetSubscribedTopics(); - const base::Value* private_topic_value = topics->FindKey(id.first); + const base::Value* private_topic_value = topics->FindKey(topic.first); ASSERT_EQ(private_topic_value, nullptr); } - // Check that enable ids are still in the prefs. - for (const auto& id : enabled_ids) { + // Check that enable topics are still in the prefs. + for (const auto& topic : enabled_topics) { const base::Value* topics = GetSubscribedTopics(); const base::Value* private_topic_value = - topics->FindKeyOfType(id.first, base::Value::Type::STRING); + topics->FindKeyOfType(topic.first, base::Value::Type::STRING); ASSERT_NE(private_topic_value, nullptr); } } TEST_F(PerUserTopicSubscriptionManagerTest, ShouldDropSavedTopicsOnTokenChange) { - auto ids = GetSequenceOfTopics(kInvalidationObjectIdsCount); + auto topics = GetSequenceOfTopics(kInvalidationTopicsCount); auto per_user_topic_subscription_manager = BuildRegistrationManager(); @@ -640,16 +641,16 @@ AddCorrectSubscriptionResponce("old-token-topic"); per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(TopicSetFromTopics(ids), + EXPECT_EQ(TopicSetFromTopics(topics), per_user_topic_subscription_manager->GetSubscribedTopicsForTest()); - for (const auto& id : ids) { + for (const auto& topic : topics) { const base::Value* topics = GetSubscribedTopics(); const base::Value* private_topic_value = - topics->FindKeyOfType(id.first, base::Value::Type::STRING); + topics->FindKeyOfType(topic.first, base::Value::Type::STRING); ASSERT_NE(private_topic_value, nullptr); std::string private_topic; private_topic_value->GetAsString(&private_topic); @@ -664,19 +665,19 @@ std::string token = "new-fake-token"; AddCorrectSubscriptionResponce("new-token-topic", token); - per_user_topic_subscription_manager->UpdateSubscribedTopics(ids, token); + per_user_topic_subscription_manager->UpdateSubscribedTopics(topics, token); base::RunLoop().RunUntilIdle(); EXPECT_EQ(token, *pref_service() ->GetDictionary(kActiveRegistrationTokens) ->FindStringKey(kProjectId)); - EXPECT_EQ(TopicSetFromTopics(ids), + EXPECT_EQ(TopicSetFromTopics(topics), per_user_topic_subscription_manager->GetSubscribedTopicsForTest()); - for (const auto& id : ids) { + for (const auto& topic : topics) { const base::Value* topics = GetSubscribedTopics(); const base::Value* private_topic_value = - topics->FindKeyOfType(id.first, base::Value::Type::STRING); + topics->FindKeyOfType(topic.first, base::Value::Type::STRING); ASSERT_NE(private_topic_value, nullptr); std::string private_topic; private_topic_value->GetAsString(&private_topic); @@ -686,7 +687,7 @@ TEST_F(PerUserTopicSubscriptionManagerTest, ShouldDeletTopicsFromPrefsWhenRequestFails) { - auto ids = GetSequenceOfTopics(kInvalidationObjectIdsCount); + auto topics = GetSequenceOfTopics(kInvalidationTopicsCount); AddCorrectSubscriptionResponce(); @@ -695,32 +696,32 @@ .empty()); per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(TopicSetFromTopics(ids), + EXPECT_EQ(TopicSetFromTopics(topics), per_user_topic_subscription_manager->GetSubscribedTopicsForTest()); - // Disable some ids. - auto disabled_ids = GetSequenceOfTopics(3); - auto enabled_ids = - GetSequenceOfTopicsStartingAt(3, kInvalidationObjectIdsCount - 3); - // Without configuring the responce, the request will not happen. + // Disable some topics. + auto disabled_topics = GetSequenceOfTopics(3); + auto enabled_topics = + GetSequenceOfTopicsStartingAt(3, kInvalidationTopicsCount - 3); + // Without configuring the response, the request will not happen. per_user_topic_subscription_manager->UpdateSubscribedTopics( - enabled_ids, kFakeInstanceIdToken); + enabled_topics, kFakeInstanceIdToken); base::RunLoop().RunUntilIdle(); - // Ids should still be removed from prefs. - for (const auto& id : disabled_ids) { + // Topics should still be removed from prefs. + for (const auto& topic : disabled_topics) { const base::Value* topics = GetSubscribedTopics(); - const base::Value* private_topic_value = topics->FindKey(id.first); + const base::Value* private_topic_value = topics->FindKey(topic.first); ASSERT_EQ(private_topic_value, nullptr); } - // Check that enable ids are still in the prefs. - for (const auto& id : enabled_ids) { + // Check that enable topics are still in the prefs. + for (const auto& topic : enabled_topics) { const base::Value* topics = GetSubscribedTopics(); const base::Value* private_topic_value = - topics->FindKeyOfType(id.first, base::Value::Type::STRING); + topics->FindKeyOfType(topic.first, base::Value::Type::STRING); ASSERT_NE(private_topic_value, nullptr); } } @@ -734,7 +735,7 @@ TEST_F(PerUserTopicSubscriptionManagerTest, ShouldChangeStatusToDisabledWhenTopicsRegistrationFailed) { - auto ids = GetSequenceOfTopics(kInvalidationObjectIdsCount); + auto topics = GetSequenceOfTopics(kInvalidationTopicsCount); AddCorrectSubscriptionResponce(); @@ -743,18 +744,18 @@ .empty()); per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(TopicSetFromTopics(ids), + EXPECT_EQ(TopicSetFromTopics(topics), per_user_topic_subscription_manager->GetSubscribedTopicsForTest()); EXPECT_EQ(observed_state(), SubscriptionChannelState::ENABLED); - // Disable some ids. - auto disabled_ids = GetSequenceOfTopics(3); - auto enabled_ids = - GetSequenceOfTopicsStartingAt(3, kInvalidationObjectIdsCount - 3); + // Disable some topics. + auto disabled_topics = GetSequenceOfTopics(3); + auto enabled_topics = + GetSequenceOfTopicsStartingAt(3, kInvalidationTopicsCount - 3); per_user_topic_subscription_manager->UpdateSubscribedTopics( - enabled_ids, kFakeInstanceIdToken); + enabled_topics, kFakeInstanceIdToken); base::RunLoop().RunUntilIdle(); // Clear previously configured correct response. So next requests will fail. @@ -764,14 +765,14 @@ std::string() /* content */, net::HTTP_NOT_FOUND); per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); base::RunLoop().RunUntilIdle(); EXPECT_EQ(observed_state(), SubscriptionChannelState::SUBSCRIPTION_FAILURE); // Configure correct response and retry. AddCorrectSubscriptionResponce(); per_user_topic_subscription_manager->UpdateSubscribedTopics( - ids, kFakeInstanceIdToken); + topics, kFakeInstanceIdToken); base::RunLoop().RunUntilIdle(); EXPECT_EQ(observed_state(), SubscriptionChannelState::ENABLED); } @@ -786,7 +787,7 @@ kTokenCleared = 3, }; - const Topics topics = GetSequenceOfTopics(kInvalidationObjectIdsCount); + const Topics topics = GetSequenceOfTopics(kInvalidationTopicsCount); auto per_user_topic_subscription_manager = BuildRegistrationManager(); // Subscribe to some topics (and provide an InstanceID token).
diff --git a/components/invalidation/impl/single_object_invalidation_set_unittest.cc b/components/invalidation/impl/single_object_invalidation_set_unittest.cc index f343101..d8541b9 100644 --- a/components/invalidation/impl/single_object_invalidation_set_unittest.cc +++ b/components/invalidation/impl/single_object_invalidation_set_unittest.cc
@@ -7,7 +7,6 @@ #include <memory> #include "components/invalidation/impl/invalidation_test_util.h" -#include "google/cacheinvalidation/types.pb.h" #include "testing/gtest/include/gtest/gtest.h" namespace syncer { @@ -16,20 +15,19 @@ class SingleObjectInvalidationSetTest : public testing::Test { public: - SingleObjectInvalidationSetTest() - : kId(ipc::invalidation::ObjectSource::TEST, "one") { - } + SingleObjectInvalidationSetTest() = default; + protected: - const invalidation::ObjectId kId; + const Topic kTopic = "one"; }; TEST_F(SingleObjectInvalidationSetTest, InsertionAndOrdering) { SingleObjectInvalidationSet l1; SingleObjectInvalidationSet l2; - Invalidation inv0 = Invalidation::InitUnknownVersion(kId); - Invalidation inv1 = Invalidation::Init(kId, 1, "one"); - Invalidation inv2 = Invalidation::Init(kId, 5, "five"); + Invalidation inv0 = Invalidation::InitUnknownVersion(kTopic); + Invalidation inv1 = Invalidation::Init(kTopic, 1, "one"); + Invalidation inv2 = Invalidation::Init(kTopic, 5, "five"); l1.Insert(inv0); l1.Insert(inv1); @@ -64,10 +62,10 @@ SingleObjectInvalidationSet list; EXPECT_FALSE(list.StartsWithUnknownVersion()); - list.Insert(Invalidation::Init(kId, 1, "one")); + list.Insert(Invalidation::Init(kTopic, 1, "one")); EXPECT_FALSE(list.StartsWithUnknownVersion()); - list.Insert(Invalidation::InitUnknownVersion(kId)); + list.Insert(Invalidation::InitUnknownVersion(kTopic)); EXPECT_TRUE(list.StartsWithUnknownVersion()); list.Clear();
diff --git a/components/invalidation/impl/topic_invalidation_map_unittest.cc b/components/invalidation/impl/topic_invalidation_map_unittest.cc index 11173a4..6e65cc37 100644 --- a/components/invalidation/impl/topic_invalidation_map_unittest.cc +++ b/components/invalidation/impl/topic_invalidation_map_unittest.cc
@@ -6,7 +6,6 @@ #include <memory> -#include "google/cacheinvalidation/types.pb.h" #include "testing/gtest/include/gtest/gtest.h" namespace syncer {
diff --git a/components/invalidation/impl/unacked_invalidation_set.cc b/components/invalidation/impl/unacked_invalidation_set.cc index d1f3621..c00096e5 100644 --- a/components/invalidation/impl/unacked_invalidation_set.cc +++ b/components/invalidation/impl/unacked_invalidation_set.cc
@@ -120,10 +120,10 @@ // amount of information has been lost by ensuring this list begins with // an UnknownVersion invalidation. We remove the oldest remaining // invalidation to make room for it. - invalidation::ObjectId id = invalidations_.begin()->object_id(); + Topic topic = invalidations_.begin()->topic(); invalidations_.erase(*invalidations_.begin()); - Invalidation unknown_version = Invalidation::InitUnknownVersion(id); + Invalidation unknown_version = Invalidation::InitUnknownVersion(topic); invalidations_.insert(unknown_version); }
diff --git a/components/invalidation/impl/unacked_invalidation_set_unittest.cc b/components/invalidation/impl/unacked_invalidation_set_unittest.cc index 86cc3eb1..df56ae7 100644 --- a/components/invalidation/impl/unacked_invalidation_set_unittest.cc +++ b/components/invalidation/impl/unacked_invalidation_set_unittest.cc
@@ -35,7 +35,6 @@ } const Topic kTopic = "ASDF"; - const invalidation::ObjectId kObjectId = ConvertTopicToId(kTopic); UnackedInvalidationSet unacked_invalidations_; }; @@ -48,7 +47,7 @@ // Test storage and retrieval of a single invalidation. TEST_F(UnackedInvalidationSetTest, OneInvalidation) { - Invalidation inv1 = Invalidation::Init(kObjectId, 10, "payload"); + Invalidation inv1 = Invalidation::Init(kTopic, 10, "payload"); unacked_invalidations_.Add(inv1); SingleObjectInvalidationSet set = GetStoredInvalidations(); @@ -58,7 +57,7 @@ // Test that calling Clear() returns us to the empty state. TEST_F(UnackedInvalidationSetTest, Clear) { - Invalidation inv1 = Invalidation::Init(kObjectId, 10, "payload"); + Invalidation inv1 = Invalidation::Init(kTopic, 10, "payload"); unacked_invalidations_.Add(inv1); unacked_invalidations_.Clear(); @@ -67,9 +66,9 @@ // Test that repeated unknown version invalidations are squashed together. TEST_F(UnackedInvalidationSetTest, UnknownVersions) { - Invalidation inv1 = Invalidation::Init(kObjectId, 10, "payload"); - Invalidation inv2 = Invalidation::InitUnknownVersion(kObjectId); - Invalidation inv3 = Invalidation::InitUnknownVersion(kObjectId); + Invalidation inv1 = Invalidation::Init(kTopic, 10, "payload"); + Invalidation inv2 = Invalidation::InitUnknownVersion(kTopic); + Invalidation inv3 = Invalidation::InitUnknownVersion(kTopic); unacked_invalidations_.Add(inv1); unacked_invalidations_.Add(inv2); unacked_invalidations_.Add(inv3); @@ -84,7 +83,7 @@ size_t kMax = UnackedInvalidationSet::kMaxBufferedInvalidations; for (size_t i = 0; i < kMax; ++i) { - Invalidation inv = Invalidation::Init(kObjectId, i, "payload"); + Invalidation inv = Invalidation::Init(kTopic, i, "payload"); unacked_invalidations_.Add(inv); } @@ -100,7 +99,7 @@ size_t kMax = UnackedInvalidationSet::kMaxBufferedInvalidations; for (size_t i = 0; i < kMax + 1; ++i) { - Invalidation inv = Invalidation::Init(kObjectId, i, "payload"); + Invalidation inv = Invalidation::Init(kTopic, i, "payload"); unacked_invalidations_.Add(inv); } @@ -118,7 +117,7 @@ size_t kMax = UnackedInvalidationSet::kMaxBufferedInvalidations; for (size_t i = 0; i < kMax + 1; ++i) { - Invalidation inv = Invalidation::Init(kObjectId, i, "payload"); + Invalidation inv = Invalidation::Init(kTopic, i, "payload"); unacked_invalidations_.Add(inv); } @@ -146,8 +145,8 @@ // Not that it makes much of a difference in behavior. unacked_invalidations_.SetHandlerIsRegistered(); - Invalidation inv1 = Invalidation::Init(kObjectId, 10, "payload"); - Invalidation inv2 = Invalidation::InitUnknownVersion(kObjectId); + Invalidation inv1 = Invalidation::Init(kTopic, 10, "payload"); + Invalidation inv2 = Invalidation::InitUnknownVersion(kTopic); AckHandle inv1_handle = inv1.ack_handle(); unacked_invalidations_.Add(inv1); @@ -169,8 +168,8 @@ // Not that it makes much of a difference in behavior. unacked_invalidations_.SetHandlerIsRegistered(); - Invalidation inv1 = Invalidation::Init(kObjectId, 10, "payload"); - Invalidation inv2 = Invalidation::Init(kObjectId, 15, "payload"); + Invalidation inv1 = Invalidation::Init(kTopic, 10, "payload"); + Invalidation inv2 = Invalidation::Init(kTopic, 15, "payload"); AckHandle inv1_handle = inv1.ack_handle(); unacked_invalidations_.Add(inv1);
diff --git a/components/invalidation/public/BUILD.gn b/components/invalidation/public/BUILD.gn index 0089d81..624fb699 100644 --- a/components/invalidation/public/BUILD.gn +++ b/components/invalidation/public/BUILD.gn
@@ -25,10 +25,7 @@ "topic_invalidation_map.cc", "topic_invalidation_map.h", ] - public_deps = [ - "//google_apis", - "//third_party/cacheinvalidation", - ] + public_deps = [ "//google_apis" ] deps = [ "//base", "//base:i18n",
diff --git a/components/invalidation/public/invalidation.cc b/components/invalidation/public/invalidation.cc index 6ca9a9a..3921a3e 100644 --- a/components/invalidation/public/invalidation.cc +++ b/components/invalidation/public/invalidation.cc
@@ -19,44 +19,45 @@ namespace syncer { namespace { + const char kObjectIdKey[] = "objectId"; const char kIsUnknownVersionKey[] = "isUnknownVersion"; const char kVersionKey[] = "version"; const char kPayloadKey[] = "payload"; const int64_t kInvalidVersion = -1; + +// Fills base::DictionaryValue as if legacy ObjectID still would be in use. +// Used to provide values for chrome://invalidations page. +std::unique_ptr<base::DictionaryValue> TopicToObjectIDValue( + const Topic& topic) { + auto value = std::make_unique<base::DictionaryValue>(); + // Source has been deprecated, pass 0 instead. + value->SetInteger("source", 0); + value->SetString("name", topic); + return value; } -// static -Invalidation Invalidation::Init(const invalidation::ObjectId& id, - int64_t version, - const std::string& payload) { - return Invalidation(id, false, version, payload, AckHandle::CreateUnique()); -} +} // namespace // static Invalidation Invalidation::Init(const Topic& topic, int64_t version, const std::string& payload) { - return Invalidation::Init(ConvertTopicToId(topic), version, payload); -} - -// static -Invalidation Invalidation::InitUnknownVersion( - const invalidation::ObjectId& id) { - return Invalidation( - id, true, kInvalidVersion, std::string(), AckHandle::CreateUnique()); + return Invalidation(topic, /*is_unknown_version=*/false, version, payload, + AckHandle::CreateUnique()); } // static Invalidation Invalidation::InitUnknownVersion(const Topic& topic) { - return InitUnknownVersion(ConvertTopicToId(topic)); + return Invalidation(topic, /*is_unknown_version=*/true, kInvalidVersion, + std::string(), AckHandle::CreateUnique()); } // static Invalidation Invalidation::InitFromDroppedInvalidation( const Invalidation& dropped) { - return Invalidation( - dropped.id_, true, kInvalidVersion, std::string(), dropped.ack_handle_); + return Invalidation(dropped.topic(), /*is_unknown_version=*/true, + kInvalidVersion, std::string(), dropped.ack_handle_); } Invalidation::Invalidation(const Invalidation& other) = default; @@ -64,11 +65,7 @@ Invalidation::~Invalidation() = default; Topic Invalidation::topic() const { - return id_.name(); -} - -invalidation::ObjectId Invalidation::object_id() const { - return id_; + return topic_; } bool Invalidation::is_unknown_version() const { @@ -117,13 +114,17 @@ } bool Invalidation::Equals(const Invalidation& other) const { - return id_ == other.id_ && is_unknown_version_ == other.is_unknown_version_ && + return topic_ == other.topic_ && + is_unknown_version_ == other.is_unknown_version_ && version_ == other.version_ && payload_ == other.payload_; } std::unique_ptr<base::DictionaryValue> Invalidation::ToValue() const { - std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); - value->Set(kObjectIdKey, ObjectIdToValue(id_)); + auto value = std::make_unique<base::DictionaryValue>(); + // TODO(crbug.com/1056181): ObjectID has been deprecated, but the value here + // used in the js counterpart (chrome://invalidations). Replace ObjectID with + // Topic here together with js counterpart update. + value->Set(kObjectIdKey, TopicToObjectIDValue(topic_)); if (is_unknown_version_) { value->SetBoolean(kIsUnknownVersionKey, true); } else { @@ -142,12 +143,12 @@ return output; } -Invalidation::Invalidation(const invalidation::ObjectId& id, +Invalidation::Invalidation(const Topic& topic, bool is_unknown_version, int64_t version, const std::string& payload, AckHandle ack_handle) - : id_(id), + : topic_(topic), is_unknown_version_(is_unknown_version), version_(version), payload_(payload),
diff --git a/components/invalidation/public/invalidation.h b/components/invalidation/public/invalidation.h index 01ffb3f..8bcc0c8f 100644 --- a/components/invalidation/public/invalidation.h +++ b/components/invalidation/public/invalidation.h
@@ -17,7 +17,6 @@ #include "components/invalidation/public/invalidation.h" #include "components/invalidation/public/invalidation_export.h" #include "components/invalidation/public/invalidation_util.h" -#include "google/cacheinvalidation/include/types.h" namespace syncer { @@ -29,17 +28,9 @@ class INVALIDATION_EXPORT Invalidation { public: // Factory functions. - // TODO(crbug.com/1029698): all ObjectID-based factory functions should be - // eventually replaced with Topic-based alternative. The end goal is to avoid - // any mentions of ObjectID here and in the whole components/invalidation - // directory. - static Invalidation Init(const invalidation::ObjectId& id, - int64_t version, - const std::string& payload); static Invalidation Init(const Topic& topic, int64_t version, const std::string& payload); - static Invalidation InitUnknownVersion(const invalidation::ObjectId& id); static Invalidation InitUnknownVersion(const Topic& topic); static Invalidation InitFromDroppedInvalidation(const Invalidation& dropped); @@ -50,7 +41,6 @@ bool Equals(const Invalidation& other) const; Topic topic() const; - invalidation::ObjectId object_id() const; bool is_unknown_version() const; // Safe to call only if is_unknown_version() returns false. @@ -104,14 +94,14 @@ std::string ToString() const; private: - Invalidation(const invalidation::ObjectId& id, + Invalidation(const Topic& topic, bool is_unknown_version, int64_t version, const std::string& payload, AckHandle ack_handle); - // The ObjectId to which this invalidation belongs. - invalidation::ObjectId id_; + // The Topic to which this invalidation belongs. + Topic topic_; // This flag is set to true if this is an unknown version invalidation. bool is_unknown_version_;
diff --git a/components/invalidation/public/invalidation_util.cc b/components/invalidation/public/invalidation_util.cc index 2292dab4..2abccd7c 100644 --- a/components/invalidation/public/invalidation_util.cc +++ b/components/invalidation/public/invalidation_util.cc
@@ -13,23 +13,13 @@ #include "base/values.h" #include "components/invalidation/public/invalidation.h" #include "components/invalidation/public/invalidation_handler.h" -#include "google/cacheinvalidation/include/types.h" namespace syncer { -const int kDeprecatedSourceForFCM = 2000; - -bool ObjectIdLessThan::operator()(const invalidation::ObjectId& lhs, - const invalidation::ObjectId& rhs) const { - return (lhs.source() < rhs.source()) || - (lhs.source() == rhs.source() && lhs.name() < rhs.name()); -} - bool InvalidationVersionLessThan::operator()(const Invalidation& a, const Invalidation& b) const { - DCHECK(a.object_id() == b.object_id()) - << "a: " << ObjectIdToString(a.object_id()) << ", " - << "b: " << ObjectIdToString(a.object_id()); + DCHECK(a.topic() == b.topic()) << "a: " << a.topic() << ", " + << "b: " << b.topic(); if (a.is_unknown_version() && !b.is_unknown_version()) return true; @@ -47,57 +37,6 @@ return lhs.is_public == rhs.is_public; } -std::unique_ptr<base::DictionaryValue> ObjectIdToValue( - const invalidation::ObjectId& object_id) { - std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); - value->SetInteger("source", object_id.source()); - value->SetString("name", object_id.name()); - return value; -} - -bool ObjectIdFromValue(const base::DictionaryValue& value, - invalidation::ObjectId* out) { - *out = invalidation::ObjectId(); - std::string name; - int source = 0; - if (!value.GetInteger("source", &source) || !value.GetString("name", &name)) { - return false; - } - *out = invalidation::ObjectId(source, name); - return true; -} - -std::string ObjectIdToString(const invalidation::ObjectId& object_id) { - std::string str; - base::JSONWriter::Write(*ObjectIdToValue(object_id), &str); - return str; -} - -Topics ConvertIdsToTopics(ObjectIdSet ids, InvalidationHandler* handler) { - Topics topics; - for (const auto& id : ids) - topics.emplace(id.name(), TopicMetadata{handler->IsPublicTopic(id.name())}); - return topics; -} - -ObjectIdSet ConvertTopicsToIds(TopicSet topics) { - ObjectIdSet ids; - for (const auto& topic : topics) - ids.insert(invalidation::ObjectId(kDeprecatedSourceForFCM, topic)); - return ids; -} - -ObjectIdSet ConvertTopicsToIds(Topics topics) { - ObjectIdSet ids; - for (const auto& topic : topics) - ids.insert(invalidation::ObjectId(kDeprecatedSourceForFCM, topic.first)); - return ids; -} - -invalidation::ObjectId ConvertTopicToId(const Topic& topic) { - return invalidation::ObjectId(kDeprecatedSourceForFCM, topic); -} - HandlerOwnerType OwnerNameToHandlerType(const std::string& owner_name) { if (owner_name == "Cloud") return HandlerOwnerType::kCloud;
diff --git a/components/invalidation/public/invalidation_util.h b/components/invalidation/public/invalidation_util.h index c8307f6c..12aab74 100644 --- a/components/invalidation/public/invalidation_util.h +++ b/components/invalidation/public/invalidation_util.h
@@ -17,24 +17,8 @@ #include "base/values.h" #include "components/invalidation/public/invalidation_export.h" -namespace base { -class DictionaryValue; -} // namespace base - -namespace invalidation { -class ObjectId; -} // namespace invalidation - namespace syncer { -// FCMInvalidationService and deprecated TiclInvalidationService uses ObjectId -// to keep track of objects to invalidate. There are 2 fields in ObjectId: -// source and name. TiclInvalidationService expects both of them, while -// FCMInvalidationService only works with the name. So InvalidationService -// assigns the value of source to kDeprecatedSourceForFCM when FCM (Firebase -// Cloud Messaging) is enabled. -extern const int kDeprecatedSourceForFCM; - // Used by UMA histogram, so entries shouldn't be reordered or removed. enum class HandlerOwnerType { kCloud = 0, @@ -52,19 +36,11 @@ }; class Invalidation; -class InvalidationHandler; - -struct INVALIDATION_EXPORT ObjectIdLessThan { - bool operator()(const invalidation::ObjectId& lhs, - const invalidation::ObjectId& rhs) const; -}; struct INVALIDATION_EXPORT InvalidationVersionLessThan { bool operator()(const Invalidation& a, const Invalidation& b) const; }; -typedef std::set<invalidation::ObjectId, ObjectIdLessThan> ObjectIdSet; - using Topic = std::string; // It should be std::set, since std::set_difference is used for it. using TopicSet = std::set<std::string>; @@ -80,21 +56,6 @@ using Topics = std::map<std::string, TopicMetadata>; -// Caller owns the returned DictionaryValue. -std::unique_ptr<base::DictionaryValue> ObjectIdToValue( - const invalidation::ObjectId& object_id); - -bool ObjectIdFromValue(const base::DictionaryValue& value, - invalidation::ObjectId* out); - -INVALIDATION_EXPORT std::string ObjectIdToString( - const invalidation::ObjectId& object_id); - -ObjectIdSet ConvertTopicsToIds(TopicSet topics); -ObjectIdSet ConvertTopicsToIds(Topics topics); -invalidation::ObjectId ConvertTopicToId(const Topic& topic); -Topics ConvertIdsToTopics(ObjectIdSet ids, InvalidationHandler* handler); - HandlerOwnerType OwnerNameToHandlerType(const std::string& owner_name); // Returns a |Topic| contained within both |lhs| and |rhs| or null if |lhs| and
diff --git a/components/invalidation/public/single_object_invalidation_set.h b/components/invalidation/public/single_object_invalidation_set.h index a83ef5d..57608a2f 100644 --- a/components/invalidation/public/single_object_invalidation_set.h +++ b/components/invalidation/public/single_object_invalidation_set.h
@@ -20,7 +20,7 @@ namespace syncer { -// Holds a list of invalidations that all share the same Object ID. +// Holds a list of invalidations that all share the same Topic. // // The list is kept sorted by version to make it easier to perform common // operations, like checking for an unknown version invalidation or fetching the
diff --git a/components/invalidation/public/topic_invalidation_map.cc b/components/invalidation/public/topic_invalidation_map.cc index 05938d2..9fc6970a 100644 --- a/components/invalidation/public/topic_invalidation_map.cc +++ b/components/invalidation/public/topic_invalidation_map.cc
@@ -29,7 +29,7 @@ } void TopicInvalidationMap::Insert(const Invalidation& invalidation) { - map_[invalidation.object_id().name()].Insert(invalidation); + map_[invalidation.topic()].Insert(invalidation); } TopicInvalidationMap TopicInvalidationMap::GetSubsetWithTopics(
diff --git a/components/invalidation/public/topic_invalidation_map.h b/components/invalidation/public/topic_invalidation_map.h index 3999311..efa218e 100644 --- a/components/invalidation/public/topic_invalidation_map.h +++ b/components/invalidation/public/topic_invalidation_map.h
@@ -20,7 +20,7 @@ namespace syncer { -// A set of notifications with some helper methods to organize them by object ID +// A set of notifications with some helper methods to organize them by Topic // and version number. class INVALIDATION_EXPORT TopicInvalidationMap { public:
diff --git a/components/omnibox/browser/autocomplete_input.cc b/components/omnibox/browser/autocomplete_input.cc index fed29aa..596621b 100644 --- a/components/omnibox/browser/autocomplete_input.cc +++ b/components/omnibox/browser/autocomplete_input.cc
@@ -26,7 +26,6 @@ // Hardcode constant to avoid any dependencies on content/. const char kViewSourceScheme[] = "view-source"; -const char kDevToolsScheme[] = "devtools"; void AdjustCursorPositionIfNecessary(size_t num_leading_chars_removed, size_t* cursor_position) { @@ -206,14 +205,6 @@ return metrics::OmniboxInputType::URL; } - if (base::LowerCaseEqualsASCII(parsed_scheme_utf8, kDevToolsScheme)) { - // A user might type in the fallback url when using devtools. In - // this case, |parsed_scheme_utf8| will tell us that this is a devtools URL, - // but |parts->scheme| might be empty.e.g. if the user typed - // "chrome-devtools://". - return metrics::OmniboxInputType::URL; - } - // Treat javascript: scheme queries followed by things that are unlikely to // be code as UNKNOWN, rather than script to execute (URL). if (RE2::FullMatch(base::UTF16ToUTF8(text), "(?i)javascript:([^;=().\"]*)")) {
diff --git a/components/omnibox/browser/autocomplete_input_unittest.cc b/components/omnibox/browser/autocomplete_input_unittest.cc index 1f8f2867..45d9271 100644 --- a/components/omnibox/browser/autocomplete_input_unittest.cc +++ b/components/omnibox/browser/autocomplete_input_unittest.cc
@@ -178,8 +178,12 @@ {ASCIIToUTF16("filesystem:http"), metrics::OmniboxInputType::QUERY}, {ASCIIToUTF16("filesystem:"), metrics::OmniboxInputType::QUERY}, {ASCIIToUTF16("chrome-search://"), metrics::OmniboxInputType::QUERY}, - {ASCIIToUTF16("chrome-devtools:"), metrics::OmniboxInputType::QUERY}, + {ASCIIToUTF16("chrome-devtools:"), metrics::OmniboxInputType::UNKNOWN}, + {ASCIIToUTF16("chrome-devtools://"), metrics::OmniboxInputType::UNKNOWN}, + {ASCIIToUTF16("chrome-devtools://x"), metrics::OmniboxInputType::UNKNOWN}, {ASCIIToUTF16("devtools:"), metrics::OmniboxInputType::QUERY}, + {ASCIIToUTF16("devtools://"), metrics::OmniboxInputType::QUERY}, + {ASCIIToUTF16("devtools://x"), metrics::OmniboxInputType::URL}, {ASCIIToUTF16("about://f;"), metrics::OmniboxInputType::QUERY}, {ASCIIToUTF16("://w"), metrics::OmniboxInputType::UNKNOWN}, {ASCIIToUTF16(":w"), metrics::OmniboxInputType::UNKNOWN}, @@ -199,6 +203,7 @@ {ASCIIToUTF16("example."), metrics::OmniboxInputType::UNKNOWN}, {ASCIIToUTF16(".example"), metrics::OmniboxInputType::UNKNOWN}, {ASCIIToUTF16(".example."), metrics::OmniboxInputType::UNKNOWN}, + {ASCIIToUTF16("example:"), metrics::OmniboxInputType::UNKNOWN}, {ASCIIToUTF16("example:80/ "), metrics::OmniboxInputType::URL}, {ASCIIToUTF16("http://foo.invalid"), metrics::OmniboxInputType::UNKNOWN}, {ASCIIToUTF16("foo.invalid/"), metrics::OmniboxInputType::QUERY}, @@ -369,24 +374,3 @@ input.cursor_position()); } } - -TEST(AutocompleteInputTest, InputParsedToFallback) { - struct test_data { - const base::string16 input; - const std::string parsed_input; - } input_cases[] = { - {ASCIIToUTF16("devtools://bundled/devtools/inspector.html"), - std::string("devtools://bundled/devtools/inspector.html")}, - {ASCIIToUTF16("chrome-devtools://bundled/devtools/inspector.html"), - std::string("devtools://bundled/devtools/inspector.html")}, - }; - - for (size_t i = 0; i < base::size(input_cases); ++i) { - SCOPED_TRACE(input_cases[i].input); - AutocompleteInput input(input_cases[i].input, - metrics::OmniboxEventProto::OTHER, - TestSchemeClassifier()); - input.set_prevent_inline_autocomplete(true); - EXPECT_EQ(input_cases[i].parsed_input, input.canonicalized_url().spec()); - } -}
diff --git a/components/omnibox/browser/test_scheme_classifier.cc b/components/omnibox/browser/test_scheme_classifier.cc index e1a5bfa..b9f8ad7 100644 --- a/components/omnibox/browser/test_scheme_classifier.cc +++ b/components/omnibox/browser/test_scheme_classifier.cc
@@ -26,7 +26,7 @@ url::kWssScheme, url::kFileScheme, url::kAboutScheme, url::kFtpScheme, url::kBlobScheme, url::kFileSystemScheme, "view-source", "javascript", "chrome", - "chrome-ui", + "chrome-ui", "devtools", }; for (const char* known_scheme : kKnownURLSchemes) { if (scheme == known_scheme)
diff --git a/components/page_load_metrics/browser/observers/use_counter/ukm_features.cc b/components/page_load_metrics/browser/observers/use_counter/ukm_features.cc index b93646c5..457bb0a7 100644 --- a/components/page_load_metrics/browser/observers/use_counter/ukm_features.cc +++ b/components/page_load_metrics/browser/observers/use_counter/ukm_features.cc
@@ -125,6 +125,8 @@ WebFeature::kRequestedFileSystemTemporary, WebFeature::kRequestedFileSystemPersistent, WebFeature::kSMSReceiverStart, + WebFeature::kSrcsetWDescriptor, + WebFeature::kSrcsetXDescriptor, WebFeature::kRequestFileSystem, WebFeature::kBaseElement, WebFeature::kBaseWithCrossOriginHref,
diff --git a/components/paint_preview/player/android/BUILD.gn b/components/paint_preview/player/android/BUILD.gn index cb6eb6a..6b8b368d 100644 --- a/components/paint_preview/player/android/BUILD.gn +++ b/components/paint_preview/player/android/BUILD.gn
@@ -76,7 +76,7 @@ sources = [ "javatests/src/org/chromium/components/paintpreview/player/PaintPreviewTestRule.java", - "javatests/src/org/chromium/components/paintpreview/player/TestImplementerService.java", + "javatests/src/org/chromium/components/paintpreview/player/PaintPreviewTestService.java", ] deps = [ @@ -116,15 +116,15 @@ generate_jni("javatests_jni_headers") { testonly = true - sources = [ "javatests/src/org/chromium/components/paintpreview/player/TestImplementerService.java" ] + sources = [ "javatests/src/org/chromium/components/paintpreview/player/PaintPreviewTestService.java" ] } source_set("test_support") { testonly = true sources = [ - "javatests/test_implementer_service.cc", - "javatests/test_implementer_service.h", + "javatests/paint_preview_test_service.cc", + "javatests/paint_preview_test_service.h", ] deps = [
diff --git a/components/paint_preview/player/android/javatests/paint_preview_test_service.cc b/components/paint_preview/player/android/javatests/paint_preview_test_service.cc new file mode 100644 index 0000000..965ee46 --- /dev/null +++ b/components/paint_preview/player/android/javatests/paint_preview_test_service.cc
@@ -0,0 +1,81 @@ +// 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 "components/paint_preview/player/android/javatests/paint_preview_test_service.h" + +#include <memory> + +#include "base/android/jni_android.h" +#include "base/android/jni_string.h" +#include "base/android/scoped_java_ref.h" +#include "base/files/file_path.h" +#include "components/paint_preview/browser/paint_preview_base_service.h" +#include "components/paint_preview/browser/test_paint_preview_policy.h" +#include "components/paint_preview/common/proto/paint_preview.pb.h" +#include "components/paint_preview/player/android/javatests_jni_headers/PaintPreviewTestService_jni.h" + +using base::android::JavaParamRef; + +namespace paint_preview { + +namespace { +const char kPaintPreviewDir[] = "paint_preview"; +const char kTestDirName[] = "PaintPreviewTestService"; + +void UpdateSkpPaths(const base::FilePath& test_data_dir, + const DirectoryKey& key, + PaintPreviewBaseService::OnReadProtoCallback callback, + std::unique_ptr<PaintPreviewProto> proto) { + // Update the file path for the root SKP to match the isolated test + // environment. + std::string root_skp_file_name = + base::FilePath(proto->root_frame().file_path()).BaseName().AsUTF8Unsafe(); + base::FilePath root_skp_file_path = + test_data_dir.AppendASCII(key.AsciiDirname()) + .AppendASCII(root_skp_file_name); + proto->mutable_root_frame()->set_file_path(root_skp_file_path.AsUTF8Unsafe()); + + // Update the file path for the subframe SKPs to match the isolated test + // environment. + for (auto& subframe : *(proto->mutable_subframes())) { + std::string subframe_skp_file_name = + base::FilePath(subframe.file_path()).BaseName().AsUTF8Unsafe(); + base::FilePath subframe_skp_file_path = + test_data_dir.AppendASCII(key.AsciiDirname()) + .AppendASCII(subframe_skp_file_name); + subframe.set_file_path(subframe_skp_file_path.AsUTF8Unsafe()); + } + std::move(callback).Run(std::move(proto)); +} +} // namespace + +jlong JNI_PaintPreviewTestService_GetInstance( + JNIEnv* env, + const JavaParamRef<jstring>& j_test_data_dir) { + base::FilePath file_path( + base::android::ConvertJavaStringToUTF8(env, j_test_data_dir)); + PaintPreviewTestService* service = new PaintPreviewTestService(file_path); + return reinterpret_cast<intptr_t>(service); +} + +PaintPreviewTestService::PaintPreviewTestService( + const base::FilePath& test_data_dir) + : PaintPreviewBaseService(test_data_dir, + kTestDirName, + std::make_unique<TestPaintPreviewPolicy>(), + false), + test_data_dir_(test_data_dir.AppendASCII(kPaintPreviewDir) + .AppendASCII(kTestDirName)) {} + +PaintPreviewTestService::~PaintPreviewTestService() = default; + +void PaintPreviewTestService::GetCapturedPaintPreviewProto( + const DirectoryKey& key, + OnReadProtoCallback on_read_proto_callback) { + PaintPreviewBaseService::GetCapturedPaintPreviewProto( + key, base::BindOnce(&UpdateSkpPaths, test_data_dir_, key, + std::move(on_read_proto_callback))); +} + +} // namespace paint_preview
diff --git a/components/paint_preview/player/android/javatests/paint_preview_test_service.h b/components/paint_preview/player/android/javatests/paint_preview_test_service.h new file mode 100644 index 0000000..c16d30a --- /dev/null +++ b/components/paint_preview/player/android/javatests/paint_preview_test_service.h
@@ -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. + +#ifndef COMPONENTS_PAINT_PREVIEW_PLAYER_ANDROID_JAVATESTS_PAINT_PREVIEW_TEST_SERVICE_H_ +#define COMPONENTS_PAINT_PREVIEW_PLAYER_ANDROID_JAVATESTS_PAINT_PREVIEW_TEST_SERVICE_H_ + +#include "base/files/file_path.h" +#include "components/paint_preview/browser/paint_preview_base_service.h" +#include "components/paint_preview/common/proto/paint_preview.pb.h" + +namespace paint_preview { + +// A simple implementation of PaintPreviewBaseService used in tests. +class PaintPreviewTestService : public PaintPreviewBaseService { + public: + PaintPreviewTestService(const base::FilePath& test_data_dir); + ~PaintPreviewTestService() override; + + PaintPreviewTestService(const PaintPreviewTestService&) = delete; + PaintPreviewTestService& operator=(const PaintPreviewTestService&) = delete; + + void GetCapturedPaintPreviewProto( + const DirectoryKey& key, + OnReadProtoCallback on_read_proto_callback) override; + + private: + base::FilePath test_data_dir_; +}; + +} // namespace paint_preview + +#endif // COMPONENTS_PAINT_PREVIEW_PLAYER_ANDROID_JAVATESTS_PAINT_PREVIEW_TEST_SERVICE_H_
diff --git a/components/paint_preview/player/android/javatests/src/org/chromium/components/paintpreview/player/PaintPreviewPlayerTest.java b/components/paint_preview/player/android/javatests/src/org/chromium/components/paintpreview/player/PaintPreviewPlayerTest.java index 82ff9cb..4429eba 100644 --- a/components/paint_preview/player/android/javatests/src/org/chromium/components/paintpreview/player/PaintPreviewPlayerTest.java +++ b/components/paint_preview/player/android/javatests/src/org/chromium/components/paintpreview/player/PaintPreviewPlayerTest.java
@@ -4,8 +4,9 @@ package org.chromium.components.paintpreview.player; -import android.os.Environment; import android.support.test.filters.MediumTest; +import android.view.View; +import android.view.ViewGroup; import org.junit.Rule; import org.junit.Test; @@ -14,6 +15,7 @@ import org.chromium.base.task.PostTask; import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.util.ScalableTimeout; +import org.chromium.base.test.util.UrlUtils; import org.chromium.content_public.browser.UiThreadTaskTraits; import org.chromium.content_public.browser.test.util.CriteriaHelper; import org.chromium.ui.test.util.DummyUiActivityTestCase; @@ -24,12 +26,9 @@ @RunWith(BaseJUnit4ClassRunner.class) public class PaintPreviewPlayerTest extends DummyUiActivityTestCase { private static final long TIMEOUT_MS = ScalableTimeout.scaleTimeout(5000); - private static final long POLLING_INTERVAL_MS = ScalableTimeout.scaleTimeout(50); - // TODO(crbug.com/1049303) Change to test data directory when test Proto and SKP files are - // added. - private static final String TEST_DATA_DIR = Environment.getExternalStorageDirectory().getPath(); - private static final String TEST_DIRECTORY_KEY = "test_key"; + private static final String TEST_DATA_DIR = "components/test/data/"; + private static final String TEST_DIRECTORY_KEY = "wikipedia"; @Rule public PaintPreviewTestRule mPaintPreviewTestRule = new PaintPreviewTestRule(); @@ -37,17 +36,41 @@ private PlayerManager mPlayerManager; /** - * Initializes {@link TestImplementerService} and {@link PlayerManager}. + * Tests the the player correctly initializes and displays a sample paint preview with 1 frame. */ @Test @MediumTest - public void smokeTest() { + public void singleFrameDisplayTest() { PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> { - TestImplementerService service = new TestImplementerService(TEST_DATA_DIR); + PaintPreviewTestService service = + new PaintPreviewTestService(UrlUtils.getIsolatedTestFilePath(TEST_DATA_DIR)); mPlayerManager = new PlayerManager(getActivity(), service, TEST_DIRECTORY_KEY); + getActivity().setContentView(mPlayerManager.getView()); }); + + // Wait until PlayerManager is initialized. CriteriaHelper.pollUiThread(() -> mPlayerManager != null, - "PlayerManager took too long to initialize.", TIMEOUT_MS, - POLLING_INTERVAL_MS); + "PlayerManager was not initialized.", TIMEOUT_MS, + CriteriaHelper.DEFAULT_POLLING_INTERVAL); + + final View playerHostView = mPlayerManager.getView(); + final View activityContentView = getActivity().findViewById(android.R.id.content); + + // Assert that the player view is added to the player host view. + CriteriaHelper.pollUiThread(() -> ((ViewGroup) playerHostView).getChildCount() > 0, + "Player view is not added to the host view.", TIMEOUT_MS, + CriteriaHelper.DEFAULT_POLLING_INTERVAL); + + // Assert that the player view has the same dimensions as the content view. + CriteriaHelper.pollUiThread(() -> { + boolean contentSizeNonZero = activityContentView.getWidth() > 0 + && activityContentView.getHeight() > 0; + boolean viewSizeMatchContent = + activityContentView.getWidth() == playerHostView.getWidth() + && activityContentView.getHeight() == playerHostView.getHeight(); + return contentSizeNonZero && viewSizeMatchContent; + }, + "Player size doesn't match R.id.content", TIMEOUT_MS, + CriteriaHelper.DEFAULT_POLLING_INTERVAL); } }
diff --git a/components/paint_preview/player/android/javatests/src/org/chromium/components/paintpreview/player/TestImplementerService.java b/components/paint_preview/player/android/javatests/src/org/chromium/components/paintpreview/player/PaintPreviewTestService.java similarity index 63% rename from components/paint_preview/player/android/javatests/src/org/chromium/components/paintpreview/player/TestImplementerService.java rename to components/paint_preview/player/android/javatests/src/org/chromium/components/paintpreview/player/PaintPreviewTestService.java index a9ab72c..ce6ac7fa 100644 --- a/components/paint_preview/player/android/javatests/src/org/chromium/components/paintpreview/player/TestImplementerService.java +++ b/components/paint_preview/player/android/javatests/src/org/chromium/components/paintpreview/player/PaintPreviewTestService.java
@@ -12,20 +12,20 @@ * A simple implementation of {@link NativePaintPreviewServiceProvider} used in tests. */ @JNINamespace("paint_preview") -public class TestImplementerService implements NativePaintPreviewServiceProvider { - private long mNativeTestImplementerService; +public class PaintPreviewTestService implements NativePaintPreviewServiceProvider { + private long mNativePaintPreviewTestService; - public TestImplementerService(String storagePath) { - mNativeTestImplementerService = TestImplementerServiceJni.get().getInstance(storagePath); + public PaintPreviewTestService(String testDataDir) { + mNativePaintPreviewTestService = PaintPreviewTestServiceJni.get().getInstance(testDataDir); } @Override public long getNativeService() { - return mNativeTestImplementerService; + return mNativePaintPreviewTestService; } @NativeMethods interface Natives { - long getInstance(String storagePath); + long getInstance(String testDataDir); } }
diff --git a/components/paint_preview/player/android/javatests/test_implementer_service.cc b/components/paint_preview/player/android/javatests/test_implementer_service.cc deleted file mode 100644 index d0a3c45..0000000 --- a/components/paint_preview/player/android/javatests/test_implementer_service.cc +++ /dev/null
@@ -1,41 +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 "components/paint_preview/player/android/javatests/test_implementer_service.h" - -#include <memory> - -#include "base/android/jni_android.h" -#include "base/android/jni_string.h" -#include "base/android/scoped_java_ref.h" -#include "base/files/file_path.h" -#include "components/paint_preview/browser/paint_preview_base_service.h" -#include "components/paint_preview/browser/test_paint_preview_policy.h" -#include "components/paint_preview/player/android/javatests_jni_headers/TestImplementerService_jni.h" - -using base::android::JavaParamRef; - -namespace paint_preview { - -jlong JNI_TestImplementerService_GetInstance( - JNIEnv* env, - const JavaParamRef<jstring>& j_string_path) { - base::FilePath file_path( - base::android::ConvertJavaStringToUTF8(env, j_string_path)); - TestImplementerService* service = - new TestImplementerService(file_path, false); - return reinterpret_cast<intptr_t>(service); -} - -TestImplementerService::TestImplementerService( - const base::FilePath& profile_path, - bool is_off_the_record) - : PaintPreviewBaseService(profile_path, - "TestImplementerService", - std::make_unique<TestPaintPreviewPolicy>(), - is_off_the_record) {} - -TestImplementerService::~TestImplementerService() = default; - -} // namespace paint_preview
diff --git a/components/paint_preview/player/android/javatests/test_implementer_service.h b/components/paint_preview/player/android/javatests/test_implementer_service.h deleted file mode 100644 index 5a6b240..0000000 --- a/components/paint_preview/player/android/javatests/test_implementer_service.h +++ /dev/null
@@ -1,27 +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. - -#ifndef COMPONENTS_PAINT_PREVIEW_PLAYER_ANDROID_JAVATESTS_TEST_IMPLEMENTER_SERVICE_H_ -#define COMPONENTS_PAINT_PREVIEW_PLAYER_ANDROID_JAVATESTS_TEST_IMPLEMENTER_SERVICE_H_ - -#include "base/files/file_path.h" -#include "components/paint_preview/browser/paint_preview_base_service.h" -#include "components/paint_preview/common/proto/paint_preview.pb.h" - -namespace paint_preview { - -// A simple implementation of PaintPreviewBaseService used in tests. -class TestImplementerService : public PaintPreviewBaseService { - public: - TestImplementerService(const base::FilePath& profile_dir, - bool is_off_the_record); - ~TestImplementerService() override; - - TestImplementerService(const TestImplementerService&) = delete; - TestImplementerService& operator=(const TestImplementerService&) = delete; -}; - -} // namespace paint_preview - -#endif // COMPONENTS_PAINT_PREVIEW_PLAYER_ANDROID_JAVATESTS_TEST_IMPLEMENTER_SERVICE_H_
diff --git a/components/password_manager/core/browser/BUILD.gn b/components/password_manager/core/browser/BUILD.gn index 720dffc0..42be50e 100644 --- a/components/password_manager/core/browser/BUILD.gn +++ b/components/password_manager/core/browser/BUILD.gn
@@ -283,7 +283,6 @@ "//components/sync", "//components/sync_preferences", "//components/url_formatter", - "//components/version_info:version_info", "//components/webdata/common", "//google_apis", "//net", @@ -358,6 +357,7 @@ deps = [ ":csv", "//base", + "//base/test:test_support", "//components/autofill/core/common", "//testing/gmock", "//testing/gtest",
diff --git a/components/password_manager/core/browser/DEPS b/components/password_manager/core/browser/DEPS index 9355d0c3c..7bd83f9 100644 --- a/components/password_manager/core/browser/DEPS +++ b/components/password_manager/core/browser/DEPS
@@ -16,7 +16,6 @@ "+components/sync_preferences", "+components/ukm", "+components/url_formatter", - "+components/version_info", "+components/webdata/common", "+crypto", "+google_apis",
diff --git a/components/password_manager/core/browser/bulk_leak_check_service.cc b/components/password_manager/core/browser/bulk_leak_check_service.cc index 643e32b..6d60149 100644 --- a/components/password_manager/core/browser/bulk_leak_check_service.cc +++ b/components/password_manager/core/browser/bulk_leak_check_service.cc
@@ -21,6 +21,9 @@ void BulkLeakCheckService::CheckUsernamePasswordPairs( std::vector<password_manager::LeakCheckCredential> credentials) { + DVLOG(0) << "Bulk password check, start " << credentials.size(); + if (credentials.empty()) + return; if (bulk_leak_check_) { DCHECK_EQ(State::kRunning, state_); // The check is already running. Append the credentials to the list. @@ -47,11 +50,12 @@ } void BulkLeakCheckService::Cancel() { + DVLOG(0) << "Bulk password check cancel"; if (!bulk_leak_check_) { DCHECK_NE(State::kRunning, state_); return; } - state_ = State::kIdle; + state_ = State::kCanceled; bulk_leak_check_.reset(); NotifyStateChanged(); } @@ -74,6 +78,7 @@ // (3) Notify about new state. The clients may assume that if the state is // idle then there won't be calls to OnLeakFound. if (!GetPendingChecksCount()) { + DVLOG(0) << "Bulk password check finished"; state_ = State::kIdle; bulk_leak_check_.reset(); } @@ -84,6 +89,7 @@ } void BulkLeakCheckService::OnError(LeakDetectionError error) { + DLOG(ERROR) << "Bulk password check error=" << static_cast<int>(error); switch (error) { case LeakDetectionError::kNotSignIn: state_ = State::kSignedOut;
diff --git a/components/password_manager/core/browser/bulk_leak_check_service.h b/components/password_manager/core/browser/bulk_leak_check_service.h index 5ad46e8..6e2608d 100644 --- a/components/password_manager/core/browser/bulk_leak_check_service.h +++ b/components/password_manager/core/browser/bulk_leak_check_service.h
@@ -42,6 +42,8 @@ // Those below are error states. On any error the current job is aborted. // The error is sticky until next CheckUsernamePasswordPairs() call. + // Cancel() aborted the running check. + kCanceled, // The user isn't signed-in to Chrome. kSignedOut, // Error obtaining an access token.
diff --git a/components/password_manager/core/browser/bulk_leak_check_service_unittest.cc b/components/password_manager/core/browser/bulk_leak_check_service_unittest.cc index 7c71489..de6d646 100644 --- a/components/password_manager/core/browser/bulk_leak_check_service_unittest.cc +++ b/components/password_manager/core/browser/bulk_leak_check_service_unittest.cc
@@ -100,6 +100,15 @@ EXPECT_EQ(BulkLeakCheckService::State::kIdle, service().state()); } +TEST_F(BulkLeakCheckServiceTest, StartWithZeroPasswords) { + StrictMock<MockObserver> observer; + service().AddObserver(&observer); + + service().CheckUsernamePasswordPairs({}); + EXPECT_EQ(BulkLeakCheckService::State::kIdle, service().state()); + EXPECT_EQ(0u, service().GetPendingChecksCount()); +} + TEST_F(BulkLeakCheckServiceTest, Running) { StrictMock<MockObserver> observer; service().AddObserver(&observer); @@ -192,10 +201,10 @@ StrictMock<MockObserver> observer; service().AddObserver(&observer); - EXPECT_CALL(observer, OnStateChanged(BulkLeakCheckService::State::kIdle)); + EXPECT_CALL(observer, OnStateChanged(BulkLeakCheckService::State::kCanceled)); service().Cancel(); - EXPECT_EQ(BulkLeakCheckService::State::kIdle, service().state()); + EXPECT_EQ(BulkLeakCheckService::State::kCanceled, service().state()); EXPECT_EQ(0u, service().GetPendingChecksCount()); }
diff --git a/components/password_manager/core/browser/import/csv_password.cc b/components/password_manager/core/browser/import/csv_password.cc index f855940..dabc07f 100644 --- a/components/password_manager/core/browser/import/csv_password.cc +++ b/components/password_manager/core/browser/import/csv_password.cc
@@ -9,6 +9,7 @@ #include "base/logging.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/time/time.h" #include "components/password_manager/core/browser/android_affiliation/affiliation_utils.h" #include "components/password_manager/core/browser/import/csv_field_parser.h" #include "url/gurl.h" @@ -106,6 +107,7 @@ form->origin = std::move(origin); form->username_value = Convert(username); form->password_value = Convert(password); + form->date_created = base::Time::Now(); return Status::kOK; }
diff --git a/components/password_manager/core/browser/import/csv_password_iterator_unittest.cc b/components/password_manager/core/browser/import/csv_password_iterator_unittest.cc index 423f7801a..36c2be1 100644 --- a/components/password_manager/core/browser/import/csv_password_iterator_unittest.cc +++ b/components/password_manager/core/browser/import/csv_password_iterator_unittest.cc
@@ -9,6 +9,7 @@ #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/task_environment.h" #include "components/password_manager/core/browser/import/csv_password.h" #include "testing/gtest/include/gtest/gtest.h" @@ -33,7 +34,13 @@ CSVPasswordIterator iter(kColMap, kCSV); // Because kCSV is just one row, it can be used to create a CSVPassword // directly. - EXPECT_EQ(iter->ParseValid(), CSVPassword(kColMap, kCSV).ParseValid()); + + // Mock time so that date_created matches. + { + base::test::SingleThreadTaskEnvironment env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); + EXPECT_EQ(iter->ParseValid(), CSVPassword(kColMap, kCSV).ParseValid()); + } // Copy. CSVPasswordIterator copy = iter;
diff --git a/components/password_manager/core/browser/import/csv_password_unittest.cc b/components/password_manager/core/browser/import/csv_password_unittest.cc index b2ed6b37..10d1f96d 100644 --- a/components/password_manager/core/browser/import/csv_password_unittest.cc +++ b/components/password_manager/core/browser/import/csv_password_unittest.cc
@@ -8,6 +8,8 @@ #include <utility> #include "base/strings/utf_string_conversions.h" +#include "base/test/task_environment.h" +#include "base/time/time.h" #include "testing/gtest/include/gtest/gtest.h" namespace password_manager { @@ -18,6 +20,9 @@ using Status = CSVPassword::Status; TEST(CSVPasswordTest, Construction) { + base::test::SingleThreadTaskEnvironment env( + base::test::TaskEnvironment::TimeSource::MOCK_TIME); + const CSVPassword::ColumnMap kColMap = { {0, Label::kOrigin}, {1, Label::kUsername}, @@ -31,6 +36,7 @@ EXPECT_EQ(expected_origin.GetOrigin().spec(), result.signon_realm); EXPECT_EQ(base::ASCIIToUTF16("user"), result.username_value); EXPECT_EQ(base::ASCIIToUTF16("password"), result.password_value); + EXPECT_EQ(base::Time::Now(), result.date_created); } struct TestCase { @@ -93,7 +99,11 @@ TestCase test_case_; }; -class CSVPasswordTestSuccess : public ::testing::TestWithParam<TestCase> {}; +class CSVPasswordTestSuccess : public ::testing::TestWithParam<TestCase> { + private: + base::test::SingleThreadTaskEnvironment env_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; +}; TEST_P(CSVPasswordTestSuccess, Parse) { const TestCase& test_case = GetParam(); @@ -109,6 +119,7 @@ EXPECT_EQ(base::UTF8ToUTF16(test_case.username), result.username_value); EXPECT_EQ(base::UTF8ToUTF16(test_case.password), result.password_value); + EXPECT_EQ(base::Time::Now(), result.date_created); EXPECT_EQ(result, csv_pwd.ParseValid()); }
diff --git a/components/password_manager/core/browser/leak_detection_dialog_utils.cc b/components/password_manager/core/browser/leak_detection_dialog_utils.cc index 82ed92ea..44a4083 100644 --- a/components/password_manager/core/browser/leak_detection_dialog_utils.cc +++ b/components/password_manager/core/browser/leak_detection_dialog_utils.cc
@@ -100,6 +100,10 @@ } bool ShouldCheckPasswords(CredentialLeakType leak_type) { + if (base::FeatureList::IsEnabled( + password_manager::features::kPasswordCheck)) { + return password_manager::IsPasswordUsedOnOtherSites(leak_type); + } return password_manager::IsPasswordUsedOnOtherSites(leak_type) && password_manager::IsSyncingPasswordsNormally(leak_type); }
diff --git a/components/password_manager/core/browser/leak_detection_dialog_utils_unittest.cc b/components/password_manager/core/browser/leak_detection_dialog_utils_unittest.cc index 5b8cc0d..0aea00c1 100644 --- a/components/password_manager/core/browser/leak_detection_dialog_utils_unittest.cc +++ b/components/password_manager/core/browser/leak_detection_dialog_utils_unittest.cc
@@ -3,7 +3,10 @@ // found in the LICENSE file. #include "components/password_manager/core/browser/leak_detection_dialog_utils.h" + #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_feature_list.h" +#include "components/password_manager/core/common/password_manager_features.h" #include "components/strings/grit/components_strings.h" #include "components/url_formatter/elide_url.h" #include "testing/gtest/include/gtest/gtest.h" @@ -52,6 +55,17 @@ IDS_LEAK_CHECK_CREDENTIALS, IDS_CLOSE, IDS_CREDENTIAL_LEAK_CHECK_PASSWORDS_MESSAGE, IDS_CREDENTIAL_LEAK_TITLE_CHECK, true, true}}; + +struct BulkCheckParams { + // Specifies the test case. + CredentialLeakType leak_type; + bool should_check_passwords; +} kBulkCheckTestCases[] = { + {CreateLeakType(IsSaved(false), IsReused(false), IsSyncing(false)), false}, + {CreateLeakType(IsSaved(true), IsReused(false), IsSyncing(false)), false}, + {CreateLeakType(IsSaved(false), IsReused(true), IsSyncing(false)), true}, + {CreateLeakType(IsSaved(true), IsReused(true), IsSyncing(false)), true}, + {CreateLeakType(IsSaved(true), IsReused(true), IsSyncing(true)), true}}; } // namespace TEST(CredentialLeakDialogUtilsTest, GetAcceptButtonLabel) { @@ -144,4 +158,44 @@ } } +class BulkCheckCredentialLeakDialogUtilsTest + : public testing::TestWithParam<BulkCheckParams> { + public: + BulkCheckCredentialLeakDialogUtilsTest() { + feature_list_.InitAndEnableFeature(features::kPasswordCheck); + } + + private: + base::test::ScopedFeatureList feature_list_; +}; + +TEST_P(BulkCheckCredentialLeakDialogUtilsTest, ShouldCheckPasswords) { + SCOPED_TRACE(testing::Message() << GetParam().leak_type); + EXPECT_EQ(GetParam().should_check_passwords, + ShouldCheckPasswords(GetParam().leak_type)); +} + +TEST_P(BulkCheckCredentialLeakDialogUtilsTest, Buttons) { + SCOPED_TRACE(testing::Message() << GetParam().leak_type); + EXPECT_EQ(GetParam().should_check_passwords, + ShouldShowCancelButton(GetParam().leak_type)); + EXPECT_EQ(l10n_util::GetStringUTF16(GetParam().should_check_passwords + ? IDS_LEAK_CHECK_CREDENTIALS + : IDS_OK), + GetAcceptButtonLabel(GetParam().leak_type)); + EXPECT_EQ(l10n_util::GetStringUTF16(IDS_CLOSE), GetCancelButtonLabel()); +} + +TEST_P(BulkCheckCredentialLeakDialogUtilsTest, Title) { + SCOPED_TRACE(testing::Message() << GetParam().leak_type); + EXPECT_EQ(l10n_util::GetStringUTF16(GetParam().should_check_passwords + ? IDS_CREDENTIAL_LEAK_TITLE_CHECK + : IDS_CREDENTIAL_LEAK_TITLE_CHANGE), + GetTitle(GetParam().leak_type)); +} + +INSTANTIATE_TEST_SUITE_P(InstantiationName, + BulkCheckCredentialLeakDialogUtilsTest, + testing::ValuesIn(kBulkCheckTestCases)); + } // namespace password_manager
diff --git a/components/password_manager/core/browser/mock_password_store.cc b/components/password_manager/core/browser/mock_password_store.cc index fc0754a..c88b29a 100644 --- a/components/password_manager/core/browser/mock_password_store.cc +++ b/components/password_manager/core/browser/mock_password_store.cc
@@ -19,8 +19,7 @@ } bool MockPasswordStore::InitOnBackgroundSequence( - const syncer::SyncableService::StartSyncFlare& flare, - version_info::Channel channel) { + const syncer::SyncableService::StartSyncFlare& flare) { return true; }
diff --git a/components/password_manager/core/browser/mock_password_store.h b/components/password_manager/core/browser/mock_password_store.h index 41d2acd..320a522 100644 --- a/components/password_manager/core/browser/mock_password_store.h +++ b/components/password_manager/core/browser/mock_password_store.h
@@ -126,8 +126,7 @@ scoped_refptr<base::SequencedTaskRunner> CreateBackgroundTaskRunner() const override; bool InitOnBackgroundSequence( - const syncer::SyncableService::StartSyncFlare& flare, - version_info::Channel channel) override; + const syncer::SyncableService::StartSyncFlare& flare) override; }; } // namespace password_manager
diff --git a/components/password_manager/core/browser/multi_store_password_save_manager.cc b/components/password_manager/core/browser/multi_store_password_save_manager.cc index 50ab098..5370ec53 100644 --- a/components/password_manager/core/browser/multi_store_password_save_manager.cc +++ b/components/password_manager/core/browser/multi_store_password_save_manager.cc
@@ -146,12 +146,9 @@ } void MultiStorePasswordSaveManager::MoveCredentialsToAccountStore() { - // TODO(crbug.com/1032992): There are other rare corner cases that should - // still be handled: - // 1. Credential exists only in the profile store but a PSL matched one exists - // in both profile and account store. - // 2. Moving credentials upon an update. FormFetch will have an outdated - // credentials. Fix it if this turns out to be a product requirement. + // TODO(crbug.com/1032992): Moving credentials upon an update. FormFetch will + // have an outdated credentials. Fix it if this turns out to be a product + // requirement. std::vector<const PasswordForm*> account_store_matches = AccountStoreMatches(form_fetcher_->GetNonFederatedMatches());
diff --git a/components/password_manager/core/browser/multi_store_password_save_manager_unittest.cc b/components/password_manager/core/browser/multi_store_password_save_manager_unittest.cc index 38c2081..127625e 100644 --- a/components/password_manager/core/browser/multi_store_password_save_manager_unittest.cc +++ b/components/password_manager/core/browser/multi_store_password_save_manager_unittest.cc
@@ -577,4 +577,35 @@ password_save_manager()->MoveCredentialsToAccountStore(); } +TEST_F(MultiStorePasswordSaveManagerTest, + MoveCredentialsFromProfileToAccountStoreWhenPSLMatchExistsInBothStores) { + PasswordForm saved_match_in_profile_store(saved_match_); + saved_match_in_profile_store.in_store = PasswordForm::Store::kProfileStore; + + PasswordForm psl_saved_match_in_profile_store(psl_saved_match_); + psl_saved_match_in_profile_store.in_store = + PasswordForm::Store::kProfileStore; + + PasswordForm psl_saved_match_in_account_store(psl_saved_match_); + psl_saved_match_in_account_store.in_store = + PasswordForm::Store::kAccountStore; + + SetNonFederatedAndNotifyFetchCompleted({&saved_match_in_profile_store, + &psl_saved_match_in_profile_store, + &psl_saved_match_in_account_store}); + + password_save_manager()->CreatePendingCredentials( + saved_match_in_profile_store, observed_form_, submitted_form_, + /*is_http_auth=*/false, + /*is_credential_api_save=*/false); + + EXPECT_CALL(*mock_profile_form_saver(), Remove(saved_match_in_profile_store)); + EXPECT_CALL(*mock_profile_form_saver(), + Remove(psl_saved_match_in_profile_store)); + EXPECT_CALL(*mock_account_form_saver(), + Save(saved_match_in_profile_store, _, _)); + + password_save_manager()->MoveCredentialsToAccountStore(); +} + } // namespace password_manager
diff --git a/components/password_manager/core/browser/password_store.cc b/components/password_manager/core/browser/password_store.cc index 14d4a75..7a3fe95b 100644 --- a/components/password_manager/core/browser/password_store.cc +++ b/components/password_manager/core/browser/password_store.cc
@@ -36,7 +36,6 @@ #include "components/password_manager/core/browser/statistics_table.h" #include "components/password_manager/core/browser/sync/password_sync_bridge.h" #include "components/password_manager/core/browser/sync/password_syncable_service.h" -#include "components/sync/base/report_unrecoverable_error.h" #include "components/sync/driver/sync_driver_switches.h" #include "components/sync/model_impl/client_tag_based_model_type_processor.h" #include "components/sync/model_impl/proxy_model_type_controller_delegate.h" @@ -144,7 +143,6 @@ bool PasswordStore::Init(const syncer::SyncableService::StartSyncFlare& flare, PrefService* prefs, - version_info::Channel channel, base::RepeatingClosure sync_enabled_or_disabled_cb) { main_task_runner_ = base::SequencedTaskRunnerHandle::Get(); DCHECK(main_task_runner_); @@ -160,8 +158,7 @@ "passwords", "PasswordStore::InitOnBackgroundSequence", this); base::PostTaskAndReplyWithResult( background_task_runner_.get(), FROM_HERE, - base::BindOnce(&PasswordStore::InitOnBackgroundSequence, this, flare, - channel), + base::BindOnce(&PasswordStore::InitOnBackgroundSequence, this, flare), base::BindOnce(&PasswordStore::OnInitCompleted, this)); } @@ -644,14 +641,12 @@ } bool PasswordStore::InitOnBackgroundSequence( - const syncer::SyncableService::StartSyncFlare& flare, - version_info::Channel channel) { + const syncer::SyncableService::StartSyncFlare& flare) { DCHECK(background_task_runner_->RunsTasksInCurrentSequence()); if (base::FeatureList::IsEnabled(switches::kSyncUSSPasswords)) { sync_bridge_.reset(new PasswordSyncBridge( std::make_unique<syncer::ClientTagBasedModelTypeProcessor>( - syncer::PASSWORDS, - base::BindRepeating(&syncer::ReportUnrecoverableError, channel)), + syncer::PASSWORDS, base::DoNothing()), /*password_store_sync=*/this, sync_enabled_or_disabled_cb_)); } else { DCHECK(!syncable_service_);
diff --git a/components/password_manager/core/browser/password_store.h b/components/password_manager/core/browser/password_store.h index cb43114..048c6f7 100644 --- a/components/password_manager/core/browser/password_store.h +++ b/components/password_manager/core/browser/password_store.h
@@ -25,7 +25,6 @@ #include "components/password_manager/core/browser/password_store_change.h" #include "components/password_manager/core/browser/password_store_sync.h" #include "components/sync/model/syncable_service.h" -#include "components/version_info/version_info.h" #if defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED) #include "components/password_manager/core/browser/hash_password_manager.h" @@ -39,13 +38,13 @@ namespace autofill { struct FormData; struct PasswordForm; -} // namespace autofill +} namespace syncer { class ModelTypeControllerDelegate; class ProxyModelTypeControllerDelegate; class SyncableService; -} // namespace syncer +} using StateSubscription = base::CallbackList<void(const std::string& username)>::Subscription; @@ -136,7 +135,6 @@ bool Init( const syncer::SyncableService::StartSyncFlare& flare, PrefService* prefs, - version_info::Channel channel = version_info::Channel::UNKNOWN, base::RepeatingClosure sync_enabled_or_disabled_cb = base::DoNothing()); // RefcountedKeyedService: @@ -454,8 +452,7 @@ // background sequence. Subclasses can add more logic. Returns true on // success. virtual bool InitOnBackgroundSequence( - const syncer::SyncableService::StartSyncFlare& flare, - version_info::Channel channel); + const syncer::SyncableService::StartSyncFlare& flare); // Methods below will be run in PasswordStore's own sequence. // Synchronous implementation that reports usage metrics.
diff --git a/components/password_manager/core/browser/password_store_default.cc b/components/password_manager/core/browser/password_store_default.cc index e77fd14..a6a4a56 100644 --- a/components/password_manager/core/browser/password_store_default.cc +++ b/components/password_manager/core/browser/password_store_default.cc
@@ -22,7 +22,8 @@ std::unique_ptr<LoginDatabase> login_db) : login_db_(std::move(login_db)) {} -PasswordStoreDefault::~PasswordStoreDefault() = default; +PasswordStoreDefault::~PasswordStoreDefault() { +} void PasswordStoreDefault::ShutdownOnUIThread() { PasswordStore::ShutdownOnUIThread(); @@ -30,8 +31,7 @@ } bool PasswordStoreDefault::InitOnBackgroundSequence( - const syncer::SyncableService::StartSyncFlare& flare, - version_info::Channel channel) { + const syncer::SyncableService::StartSyncFlare& flare) { DCHECK(background_task_runner()->RunsTasksInCurrentSequence()); DCHECK(login_db_); bool success = true; @@ -42,7 +42,7 @@ success = false; LOG(ERROR) << "Could not create/open login database."; } - return PasswordStore::InitOnBackgroundSequence(flare, channel) && success; + return PasswordStore::InitOnBackgroundSequence(flare) && success; } void PasswordStoreDefault::ReportMetricsImpl( @@ -155,8 +155,9 @@ const base::Callback<bool(const GURL&)>& origin_filter, base::Time delete_begin, base::Time delete_end) { - return login_db_ && login_db_->stats_table().RemoveStatsByOriginAndTime( - origin_filter, delete_begin, delete_end); + return login_db_ && + login_db_->stats_table().RemoveStatsByOriginAndTime( + origin_filter, delete_begin, delete_end); } std::vector<std::unique_ptr<PasswordForm>>
diff --git a/components/password_manager/core/browser/password_store_default.h b/components/password_manager/core/browser/password_store_default.h index 43537c0..12c7abd3 100644 --- a/components/password_manager/core/browser/password_store_default.h +++ b/components/password_manager/core/browser/password_store_default.h
@@ -34,8 +34,7 @@ // Opens |login_db_| on the background sequence. bool InitOnBackgroundSequence( - const syncer::SyncableService::StartSyncFlare& flare, - version_info::Channel channel) override; + const syncer::SyncableService::StartSyncFlare& flare) override; // Implements PasswordStore interface. void ReportMetricsImpl(const std::string& sync_username,
diff --git a/components/password_manager/core/browser/ui/bulk_leak_check_service_adapter_unittest.cc b/components/password_manager/core/browser/ui/bulk_leak_check_service_adapter_unittest.cc index 9015eda..b6630c1 100644 --- a/components/password_manager/core/browser/ui/bulk_leak_check_service_adapter_unittest.cc +++ b/components/password_manager/core/browser/ui/bulk_leak_check_service_adapter_unittest.cc
@@ -183,6 +183,9 @@ // Checks that trying to start a leak check when another check is already // running does nothing and returns false to the caller. TEST_F(BulkLeakCheckServiceAdapterTest, MultipleStarts) { + store().AddLogin(MakeSavedPassword(kExampleCom, "alice", kPassword1)); + RunUntilIdle(); + auto leak_check = std::make_unique<NiceMockBulkLeakCheck>(); auto& leak_check_ref = *leak_check; EXPECT_CALL(leak_check_ref, CheckCredentials); @@ -197,6 +200,9 @@ // Checks that stopping the leak check correctly resets the state of the bulk // leak check. TEST_F(BulkLeakCheckServiceAdapterTest, StopBulkLeakCheck) { + store().AddLogin(MakeSavedPassword(kExampleCom, "alice", kPassword1)); + RunUntilIdle(); + auto leak_check = std::make_unique<NiceMockBulkLeakCheck>(); EXPECT_CALL(*leak_check, CheckCredentials); EXPECT_CALL(factory(), TryCreateBulkLeakCheck) @@ -206,7 +212,7 @@ adapter().GetBulkLeakCheckState()); adapter().StopBulkLeakCheck(); - EXPECT_EQ(BulkLeakCheckService::State::kIdle, + EXPECT_EQ(BulkLeakCheckService::State::kCanceled, adapter().GetBulkLeakCheckState()); }
diff --git a/components/policy/core/browser/url_blacklist_manager_unittest.cc b/components/policy/core/browser/url_blacklist_manager_unittest.cc index 5fb1c8c43..5a621d3 100644 --- a/components/policy/core/browser/url_blacklist_manager_unittest.cc +++ b/components/policy/core/browser/url_blacklist_manager_unittest.cc
@@ -288,16 +288,7 @@ blacklist.Allow(allowed.get()); EXPECT_FALSE(blacklist.IsURLBlocked(GURL("http://example.com"))); - // Treats chrome-devtools and devtools schemes the same way. - blocked.reset(new base::ListValue); - blocked->AppendString("*"); - blacklist.Block(blocked.get()); - allowed.reset(new base::ListValue); - allowed->AppendString("chrome-devtools://*"); - blacklist.Allow(allowed.get()); - EXPECT_FALSE(blacklist.IsURLBlocked(GURL("devtools://something.com"))); - EXPECT_TRUE(blacklist.IsURLBlocked(GURL("https://something.com"))); - + // Devtools should not be blocked. blocked.reset(new base::ListValue); blocked->AppendString("*"); blacklist.Block(blocked.get());
diff --git a/components/policy/core/browser/url_util.cc b/components/policy/core/browser/url_util.cc index 85b5691c..8a50117 100644 --- a/components/policy/core/browser/url_util.cc +++ b/components/policy/core/browser/url_util.cc
@@ -51,9 +51,6 @@ const char kGoogleTranslateSubdomain[] = "translate."; const char kAlternateGoogleTranslateHost[] = "translate.googleusercontent.com"; -const char kDevToolsLegacyScheme[] = "chrome-devtools"; -const char kDevToolsScheme[] = "devtools"; - // Maximum filters per policy. Filters over this index are ignored. const size_t kMaxFiltersPerPolicy = 1000; @@ -299,16 +296,6 @@ std::string lc_filter = base::ToLowerASCII(filter); const std::string url_scheme = url_formatter::SegmentURL(filter, &parsed); - // This is for backward compatibility between 'chrome-devtools' and 'devtools' - // schemes. url_formatter::SegmentURL will return 'devtools' if the filter's - // scheme is the deprecated 'chrome-devtools'. To comply with that - // transformation, since both schemes are equivalent, if the filter's scheme - // was 'chrome-devtools', it should be replaced by 'devtools'. - if (url_scheme == kDevToolsScheme && - lc_filter.find(kDevToolsLegacyScheme) == 0) { - lc_filter.replace(0, 15, kDevToolsScheme); - } - // Check if it's a scheme wildcard pattern. We support both versions // (scheme:* and scheme://*) the later being consistent with old filter // definitions.
diff --git a/components/policy/core/common/cloud/cloud_policy_client.cc b/components/policy/core/common/cloud/cloud_policy_client.cc index fc14804..8287000 100644 --- a/components/policy/core/common/cloud/cloud_policy_client.cc +++ b/components/policy/core/common/cloud/cloud_policy_client.cc
@@ -1162,7 +1162,7 @@ bool CheckCommonClientCertProvisioningResponse( const em::DeviceManagementResponse& response, policy::DeviceManagementStatus* status, - CertProvisioningResponseErrorType* response_error, + base::Optional<CertProvisioningResponseErrorType>* response_error, base::Optional<int64_t>* try_later) { if (*status != DM_STATUS_SUCCESS) { return false; @@ -1201,8 +1201,7 @@ &CloudPolicyClient::RemoveJob, base::Unretained(this), job)); status_ = status; - CertProvisioningResponseErrorType response_error = - CertProvisioningResponseError::UNDEFINED; + base::Optional<CertProvisioningResponseErrorType> response_error; base::Optional<int64_t> try_later; // Single step loop for convenience. @@ -1274,8 +1273,7 @@ &CloudPolicyClient::RemoveJob, base::Unretained(this), job)); status_ = status; - CertProvisioningResponseErrorType response_error = - CertProvisioningResponseError::UNDEFINED; + base::Optional<CertProvisioningResponseErrorType> response_error; base::Optional<int64_t> try_later; // Single step loop for convenience. @@ -1308,8 +1306,7 @@ &CloudPolicyClient::RemoveJob, base::Unretained(this), job)); status_ = status; - CertProvisioningResponseErrorType response_error = - CertProvisioningResponseError::UNDEFINED; + base::Optional<CertProvisioningResponseErrorType> response_error; base::Optional<int64_t> try_later; // Single step loop for convenience.
diff --git a/components/policy/core/common/cloud/cloud_policy_client.h b/components/policy/core/common/cloud/cloud_policy_client.h index ab962d1..13dbcf1 100644 --- a/components/policy/core/common/cloud/cloud_policy_client.h +++ b/components/policy/core/common/cloud/cloud_policy_client.h
@@ -75,7 +75,8 @@ using ClientCertProvisioningStartCsrCallback = base::OnceCallback<void( DeviceManagementStatus, - enterprise_management::ClientCertificateProvisioningResponse::Error, + base::Optional< + enterprise_management::ClientCertificateProvisioningResponse::Error>, base::Optional<int64_t> try_later, const std::string& invalidation_topic, const std::string& va_challenge, @@ -84,12 +85,14 @@ using ClientCertProvisioningFinishCsrCallback = base::OnceCallback<void( DeviceManagementStatus, - enterprise_management::ClientCertificateProvisioningResponse::Error, + base::Optional< + enterprise_management::ClientCertificateProvisioningResponse::Error>, base::Optional<int64_t> try_later)>; using ClientCertProvisioningDownloadCertCallback = base::OnceCallback<void( DeviceManagementStatus, - enterprise_management::ClientCertificateProvisioningResponse::Error, + base::Optional< + enterprise_management::ClientCertificateProvisioningResponse::Error>, base::Optional<int64_t> try_later, const std::string& pem_encoded_certificate)>;
diff --git a/components/policy/core/common/cloud/cloud_policy_client_unittest.cc b/components/policy/core/common/cloud/cloud_policy_client_unittest.cc index 049ac66..a235b88 100644 --- a/components/policy/core/common/cloud/cloud_policy_client_unittest.cc +++ b/components/policy/core/common/cloud/cloud_policy_client_unittest.cc
@@ -1909,7 +1909,7 @@ MOCK_METHOD(void, Callback, (DeviceManagementStatus, - CertProvisioningResponseErrorType, + base::Optional<CertProvisioningResponseErrorType>, base::Optional<int64_t> try_later, const std::string& invalidation_topic, const std::string& va_challenge, @@ -1992,11 +1992,11 @@ } MockClientCertProvisioningStartCsrCallbackObserver callback_observer; - EXPECT_CALL(callback_observer, - Callback(DeviceManagementStatus::DM_STATUS_SUCCESS, - CertProvisioningResponseError::UNDEFINED, - testing::Eq(base::nullopt), invalidation_topic, - va_challenge, hash_algorithm, data_to_sign)) + EXPECT_CALL( + callback_observer, + Callback(DeviceManagementStatus::DM_STATUS_SUCCESS, + testing::Eq(base::nullopt), testing::Eq(base::nullopt), + invalidation_topic, va_challenge, hash_algorithm, data_to_sign)) .Times(1); RunTest(fake_response, callback_observer); @@ -2018,8 +2018,8 @@ MockClientCertProvisioningStartCsrCallbackObserver callback_observer; EXPECT_CALL(callback_observer, Callback(DeviceManagementStatus::DM_STATUS_SUCCESS, - CertProvisioningResponseError::UNDEFINED, - testing::Eq(try_later), std::string(), std::string(), + testing::Eq(base::nullopt), testing::Eq(try_later), + std::string(), std::string(), em::HashingAlgorithm::HASHING_ALGORITHM_UNSPECIFIED, std::string())) .Times(1); @@ -2042,11 +2042,12 @@ } MockClientCertProvisioningStartCsrCallbackObserver callback_observer; - EXPECT_CALL(callback_observer, - Callback(DeviceManagementStatus::DM_STATUS_SUCCESS, error, - testing::Eq(base::nullopt), std::string(), std::string(), - em::HashingAlgorithm::HASHING_ALGORITHM_UNSPECIFIED, - std::string())) + EXPECT_CALL( + callback_observer, + Callback(DeviceManagementStatus::DM_STATUS_SUCCESS, testing::Eq(error), + testing::Eq(base::nullopt), std::string(), std::string(), + em::HashingAlgorithm::HASHING_ALGORITHM_UNSPECIFIED, + std::string())) .Times(1); RunTest(fake_response, callback_observer); @@ -2059,7 +2060,7 @@ MOCK_METHOD(void, Callback, (DeviceManagementStatus, - CertProvisioningResponseErrorType, + base::Optional<CertProvisioningResponseErrorType>, base::Optional<int64_t> try_later), (const)); }; @@ -2134,8 +2135,7 @@ MockClientCertProvisioningFinishCsrCallbackObserver callback_observer; EXPECT_CALL(callback_observer, Callback(DeviceManagementStatus::DM_STATUS_SUCCESS, - CertProvisioningResponseError::UNDEFINED, - testing::Eq(base::nullopt))) + testing::Eq(base::nullopt), testing::Eq(base::nullopt))) .Times(1); RunTest(fake_response, callback_observer); @@ -2157,8 +2157,8 @@ MockClientCertProvisioningFinishCsrCallbackObserver callback_observer; EXPECT_CALL(callback_observer, - Callback(DeviceManagementStatus::DM_STATUS_SUCCESS, error, - testing::Eq(base::nullopt))) + Callback(DeviceManagementStatus::DM_STATUS_SUCCESS, + testing::Eq(error), testing::Eq(base::nullopt))) .Times(1); RunTest(fake_response, callback_observer); @@ -2171,7 +2171,7 @@ MOCK_METHOD(void, Callback, (DeviceManagementStatus, - CertProvisioningResponseErrorType, + base::Optional<CertProvisioningResponseErrorType>, base::Optional<int64_t> try_later, const std::string& pem_encoded_certificate), (const)); @@ -2246,8 +2246,8 @@ MockClientCertProvisioningDownloadCertCallbackObserver callback_observer; EXPECT_CALL(callback_observer, Callback(DeviceManagementStatus::DM_STATUS_SUCCESS, - CertProvisioningResponseError::UNDEFINED, - testing::Eq(base::nullopt), pem_encoded_cert)) + testing::Eq(base::nullopt), testing::Eq(base::nullopt), + pem_encoded_cert)) .Times(1); RunTest(fake_response, callback_observer); @@ -2269,10 +2269,10 @@ } MockClientCertProvisioningDownloadCertCallbackObserver callback_observer; - EXPECT_CALL(callback_observer, - Callback(DeviceManagementStatus::DM_STATUS_SUCCESS, - CertProvisioningResponseError::CA_ERROR, - testing::Eq(base::nullopt), std::string())) + EXPECT_CALL( + callback_observer, + Callback(DeviceManagementStatus::DM_STATUS_SUCCESS, testing::Eq(error), + testing::Eq(base::nullopt), std::string())) .Times(1); RunTest(fake_response, callback_observer);
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index 0e897a9..1dbdbd7 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -770,6 +770,7 @@ 'ReportUserIDData', 'ReportExtensionsAndPluginsData', 'ReportSafeBrowsingData', + 'CloudExtensionRequestEnabled', 'CloudReportingEnabled', ], }, @@ -3122,7 +3123,7 @@ 'id': 649, 'caption': '''List of types that should be excluded from synchronization''', 'tags': ['system-security'], - 'desc': '''If this policy is set all specified data types will be excluded from syncronzation both for Google Sync as well as for roaming profile synchronization. This can be beneficial to reduce the size of the roaming profile or limit the type of data uploaded to the Google Sync Servers. + 'desc': '''If this policy is set all specified data types will be excluded from synchronization both for Google Sync as well as for roaming profile synchronization. This can be beneficial to reduce the size of the roaming profile or limit the type of data uploaded to the Google Sync Servers. The current data types for this policy are: "bookmarks", "preferences", "passwords", "autofill", "themes", "typedUrls", "extensions", "apps", "tabs", "wifiConfiguration". Those names are case sensitive!''', },
diff --git a/components/resources/terms/terms_am.html b/components/resources/terms/terms_am.html index fcf55438..443e600 100644 --- a/components/resources/terms/terms_am.html +++ b/components/resources/terms/terms_am.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>We’re updating the terms of service for Chrome on March 31, 2020. The new terms will include Google’s Terms of Service and the Google Chrome and Chrome OS additional terms of service. Until then, the terms below continue to apply. See a <a href="https://policies.google.com/terms/chromechanges">summary of the key changes</a> (https://policies.google.com/terms/chromechanges) for more details. </p> <ul> <li>See a preview of the new <a href="https://policies.google.com/terms/update">Terms</a> (https://policies.google.com/terms/update) and <a href="https://www.google.com/chrome/terms">Additional Terms</a> (https://www.google.com/chrome/terms). </li> </ul> <p>If you don’t agree to our new Terms, you can find more information about your options in our <a href="https://policies.google.com/terms/chromechanges#faq">Frequently Asked Questions</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>የGoogle Chrome የአግልግሎት ስምምነት ውሎች </h2> <p>እነዚህ ውሎች ለሚሰራ የGoogle Chrome ኮድ ስሪት ተግባራዊ ይሆናሉ። የGoogle Chrome ሶርስ ኮድ በክፍት ሶርስ (Open source) ሶፍተዌር የፈቃድ ስምምነት ስር በዚህ chrome://credits ይገኛሉ።</p> <p><strong>1. ከGoogle ጋር ያለዎት ግንኙነት</strong></p>
diff --git a/components/resources/terms/terms_ar.html b/components/resources/terms/terms_ar.html index 6e5920a..87e654bb 100644 --- a/components/resources/terms/terms_ar.html +++ b/components/resources/terms/terms_ar.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>نحن بصدد إجراء تعديلات على بنود الخدمة الخاصة بمتصفح Google Chrome في 31 آذار (مارس) 2020. ستتضمَّن البنود الجديدة بنود خدمة Google وبنود الخدمة الإضافية لكل من متصفح Google Chrome و"نظام التشغيل Chrome". وحتى ذلك الحين، ستظل البنود الموضّحة أدناه سارية. وللحصول على مزيد من التفاصيل، يمكنك الاطّلاع <a href="https://policies.google.com/terms/changes">على ملخص لأهم التغييرات التي تم إجراؤها</a> (https://policies.google.com/terms/changes). </p> <ul> <li>يُرجى الاطّلاع على كل من <a href="https://policies.google.com/terms/update">البنود</a> (https://policies.google.com/terms/update) و<a href="https://www.google.com/chrome/terms">البنود الإضافية</a> (https://www.google.com/chrome/terms) الجديدتين. </li> </ul> <p>في حال عدم موافقتك على بنود الخدمة الجديدة، يمكنك التعرُّف على الإجراءات التي يمكنك اتخاذها في هذا الصدد بالاطّلاع على <a href="https://policies.google.com/terms/chromechanges#faq">الأسئلة الشائعة</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>بنود خدمة Google Chrome</h2> <p>تنطبق بنود الخدمة هذه على إصدار شفرة Google Chrome القابلة للتنفيذ. وتتوفر الشفرة المصدر للمتصفح Google Chrome مجانًا بموجب اتفاقيات ترخيص البرامج مفتوحة المصدر في chrome://credits.</p> <p><strong>1. علاقتك مع Google</strong></p>
diff --git a/components/resources/terms/terms_bg.html b/components/resources/terms/terms_bg.html index 9aaeaf6..4258332 100644 --- a/components/resources/terms/terms_bg.html +++ b/components/resources/terms/terms_bg.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>На 31 март 2020 г. ще актуализираме Общите условия за Chrome. Това включва Общите условия на Google и Допълнителните общи условия на Google Chrome и Chrome OS. Дотогава условията по-долу продължават да се прилагат. За повече подробности прегледайте <a href="https://policies.google.com/terms/chromechanges">обобщената информация за основните промени</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Вижте визуализация на новите <a href="https://policies.google.com/terms/update">Общи условия</a> (https://policies.google.com/terms/update) и <a href="https://www.google.com/chrome/terms">Допълнителни общи условия</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Ако не приемате новите ни Общи условия, можете да намерите повече информация за опциите, с които разполагате, в секцията ни <a href="https://policies.google.com/terms/chromechanges#faq">Често задавани въпроси</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Общи условия на Google Chrome</h2> <p>Тези Общи условия се прилагат към версията с изпълним код на Google Chrome. Изходният код на Google Chrome се предоставя безплатно съгласно лицензионните споразумения за софтуер с отворен код на адрес chrome://credits.</p> <p><strong>1. Вашите отношения с Google</strong></p>
diff --git a/components/resources/terms/terms_bn.html b/components/resources/terms/terms_bn.html index 09f7d6b..7e4f1c8 100644 --- a/components/resources/terms/terms_bn.html +++ b/components/resources/terms/terms_bn.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>We’re updating the terms of service for Chrome on March 31, 2020. The new terms will include Google’s Terms of Service and the Google Chrome and Chrome OS additional terms of service. Until then, the terms below continue to apply. See a <a href="https://policies.google.com/terms/chromechanges">summary of the key changes</a> (https://policies.google.com/terms/chromechanges) for more details. </p> <ul> <li>See a preview of the new <a href="https://policies.google.com/terms/update">Terms</a> (https://policies.google.com/terms/update) and <a href="https://www.google.com/chrome/terms">Additional Terms</a> (https://www.google.com/chrome/terms). </li> </ul> <p>If you don’t agree to our new Terms, you can find more information about your options in our <a href="https://policies.google.com/terms/chromechanges#faq">Frequently Asked Questions</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chrome পরিষেবার চুক্তি</h2> <p>পরিষেবার এই চুক্তিগুলি Google Chrome –এর প্রয়োগযোগ্য কোড সংস্করণে প্রয়োজ্য হয়৷ Google Chrome এর উত্স কোড chrome://credits-এ মুক্ত উত্স সফটওয়্যার লাইসেন্সের অধীনে বিনামূল্যে উপলব্ধ৷</p> <p><strong>1. Google-এর সাথে আপনার সম্পর্ক</strong></p>
diff --git a/components/resources/terms/terms_ca.html b/components/resources/terms/terms_ca.html index d673e888..0125ca0 100644 --- a/components/resources/terms/terms_ca.html +++ b/components/resources/terms/terms_ca.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>El 31 de març de 2020 actualitzarem les condicions del servei de Chrome. Les noves condicions inclouran les Condicions del Servei de Google i les Condicions del Servei Addicionals de Google Chrome i Chrome OS. Fins a aquesta data, continuen en vigor les condicions que trobareu més avall. Per obtenir més informació, vegeu un <a href="https://policies.google.com/terms/chromechanges">resum dels canvis més importants</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Consulteu una previsualització de les noves <a href="https://policies.google.com/terms/update">Condicions</a> (https://policies.google.com/terms/update) i les <a href="https://www.google.com/chrome/terms">Condicions Addicionals</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Si no esteu d'acord amb les noves Condicions, podeu trobar més informació sobre les opcions que teniu a les nostres <a href="https://policies.google.com/terms/chromechanges#faq">preguntes freqüents</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Condicions d'ús de Google Chrome</h2> <p>Aquestes Condicions d'ús s'apliquen a la versió de codi executable de Google Chrome. El codi font de Google Chrome està disponible de manera gratuïta a l'empara dels acords de llicència de programari de codi obert a la pàgina chrome://credits.</p> <p><strong>1. La seva relació amb Google</strong></p>
diff --git a/components/resources/terms/terms_cs.html b/components/resources/terms/terms_cs.html index 1248e063..d86d683 100644 --- a/components/resources/terms/terms_cs.html +++ b/components/resources/terms/terms_cs.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>31. března 2020 dojde k aktualizaci smluvních podmínek prohlížeče Chrome. Nové podmínky budou zahrnovat smluvní podmínky společnosti Google a dodatečné smluvní podmínky prohlížeče Google Chrome a systému Chrome OS. Do té doby budou platit níže uvedené podmínky. Další podrobnosti naleznete v <a href="https://policies.google.com/terms/chromechanges">souhrnu hlavních změn</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Prohlédněte si náhled nových <a href="https://policies.google.com/terms/update">smluvních podmínek</a> (https://policies.google.com/terms/update) a <a href="https://www.google.com/chrome/terms">dodatečných smluvních podmínek</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Pokud s našimi novými smluvními podmínkami nesouhlasíte, další informace o svých možnostech naleznete v <a href="https://policies.google.com/terms/chromechanges#faq">odpovědích na časté dotazy</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Smluvní podmínky aplikace Google Chrome </h2> <p>Tyto Smluvní podmínky platí pro spustitelný kód aplikace Google Chrome. Zdrojový kód aplikace Google Chrome je k dispozici bezplatně na základě licenční smlouvy na software s otevřeným zdrojovým kódem na adrese chrome://credits.</p> <p><strong>1. Vztah mezi vámi a společností Google</strong></p>
diff --git a/components/resources/terms/terms_da.html b/components/resources/terms/terms_da.html index e1e80fc..dcd5ee3 100644 --- a/components/resources/terms/terms_da.html +++ b/components/resources/terms/terms_da.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Vi opdaterer servicevilkårene for Chrome den 31. marts 2020. De nye vilkår kommer til at omfatte Google Servicevilkår og de yderligere servicevilkår for Google Chrome og Chrome OS. Indtil da gælder vilkårene nedenfor fortsat. Få flere oplysninger i <a href="https://policies.google.com/terms/chromechanges">oversigten over de vigtigste ændringer</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Se en forhåndsvisning af de nye <a href="https://policies.google.com/terms/update">vilkår</a> (https://policies.google.com/terms/update) og <a href="https://www.google.com/chrome/terms">yderligere vilkår</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Hvis du ikke accepterer vores nye vilkår, kan du få flere oplysninger om dine valgmuligheder under <a href="https://policies.google.com/terms/chromechanges#faq">Ofte stillede spørgsmål</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chrome Servicevilkår</h2> <p>Disse Servicevilkår gælder for den version af Google Chrome, der indeholder eksekverbar kode. Kildekode til Google Chrome kan hentes gratis under open source-licensaftaler på chrome://credits.</p> <p><strong>1. Dit forhold til Google</strong></p>
diff --git a/components/resources/terms/terms_de.html b/components/resources/terms/terms_de.html index b71895d0..c3ce195 100644 --- a/components/resources/terms/terms_de.html +++ b/components/resources/terms/terms_de.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Am 31. März 2020 aktualisieren wir die Nutzungsbedingungen für Chrome. Die neuen Bestimmungen umfassen sowohl die Nutzungsbedingungen von Google als auch die zusätzlichen Bedingungen für Google Chrome und Chrome OS. Bis dahin gelten weiterhin die unten genannten Nutzungsbedingungen. Weitere Einzelheiten können Sie in unserer <a href="https://policies.google.com/terms/chromechanges">Zusammenfassung der wichtigsten Änderungen</a> (https://policies.google.com/terms/chromechanges) nachlesen. </p> <ul> <li>Hier finden Sie eine Vorschau der neuen <a href="https://policies.google.com/terms/update">Nutzungsbedingungen</a> (https://policies.google.com/terms/update) und der <a href="https://www.google.com/chrome/terms">zusätzlichen Bedingungen</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Falls Sie mit unseren neuen Nutzungsbedingungen nicht einverstanden sind, finden Sie in unserer Rubrik <a href="https://policies.google.com/terms/chromechanges#faq">Häufig gestellte Fragen</a> (https://policies.google.com/terms/chromechanges#faq) Informationen zu Ihren Alternativen. </p></div> <h2>Google Chrome Nutzungsbedingungen</h2> <p> <strong>Diese Nutzungsbedingungen beziehen sich ausschließlich auf die herunterladbare Software-Version des Browsers Google Chrome.</strong>
diff --git a/components/resources/terms/terms_el.html b/components/resources/terms/terms_el.html index f402c5ba..bece8b0e 100644 --- a/components/resources/terms/terms_el.html +++ b/components/resources/terms/terms_el.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Στις 31 Μαρτίου 2020 θα ενημερώσουμε τους Όρους Παροχής Υπηρεσιών για το Chrome. Οι νέοι όροι θα περιλαμβάνουν τους Όρους Παροχής Υπηρεσιών της Google και τους Πρόσθετους Όρους Παροχής Υπηρεσιών του Google Chrome και του Chrome OS. Έως τότε, οι παρακάτω όροι θα εξακολουθήσουν να ισχύουν. Δείτε μια <a href="https://policies.google.com/terms/chromechanges">σύνοψη σημαντικών αλλαγών</a> (https://policies.google.com/terms/chromechanges) για περισσότερες λεπτομέρειες. </p> <ul> <li>Δείτε μια προεπισκόπηση των νέων <a href="https://policies.google.com/terms/update">Όρων</a> (https://policies.google.com/terms/update) και των <a href="https://www.google.com/chrome/terms">Πρόσθετων όρων</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Εάν δεν συμφωνείτε με τους νέους Όρους, μπορείτε να βρείτε περισσότερες πληροφορίες στις <a href="https://policies.google.com/terms/chromechanges#faq">Συνήθεις ερωτήσεις</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Όροι Παροχής Υπηρεσιών του Google Chrome</h2> <p>Οι παρόντες Όροι Παροχής Υπηρεσιών ισχύουν για την έκδοση εκτελέσιμου κώδικα του Google Chrome. Ο πηγαίος κώδικας του Google Chrome διατίθεται δωρεάν μέσω των συμφωνητικών άδειας χρήσης λογισμικού ανοικτού κώδικα στη διεύθυνση chrome://credits.</p> <p><strong>1. Η σχέση σας με την Google</strong></p>
diff --git a/components/resources/terms/terms_en-GB.html b/components/resources/terms/terms_en-GB.html index c91430d7..81778b6 100644 --- a/components/resources/terms/terms_en-GB.html +++ b/components/resources/terms/terms_en-GB.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>We’re updating the Terms of Service for Chrome on 31 March 2020. The new terms will include Google’s Terms of Service and the Google Chrome and Chrome OS additional Terms of Service. Until then, the terms below continue to apply. See a <a href="https://policies.google.com/terms/chromechanges">summary of the key changes</a> (https://policies.google.com/terms/chromechanges) for more details. </p> <ul> <li>See a preview of the new <a href="https://policies.google.com/terms/update">terms</a> (https://policies.google.com/terms/update) and <a href="https://www.google.com/chrome/terms">additional terms</a> (https://www.google.com/chrome/terms). </li> </ul> <p>If you don’t agree to our new terms, you can find more information about your options in our <a href="https://policies.google.com/terms/chromechanges#faq">Frequently asked questions</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chrome Terms of Service</h2> <p>These Terms of Service apply to the executable code version of Google Chrome. Source code for Google Chrome is available free of charge under open source software licence agreements at chrome://credits.</p> <p><strong>1. Your relationship with Google</strong></p>
diff --git a/components/resources/terms/terms_en.html b/components/resources/terms/terms_en.html index ca6a0d9..fa2fa9a0 100644 --- a/components/resources/terms/terms_en.html +++ b/components/resources/terms/terms_en.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>We’re updating the terms of service for Chrome on March 31, 2020. The new terms will include Google’s Terms of Service and the Google Chrome and Chrome OS additional terms of service. Until then, the terms below continue to apply. See a <a href="https://policies.google.com/terms/chromechanges">summary of the key changes</a> (https://policies.google.com/terms/chromechanges) for more details. </p> <ul> <li>See a preview of the new <a href="https://policies.google.com/terms/update">Terms</a> (https://policies.google.com/terms/update) and <a href="https://www.google.com/chrome/terms">Additional Terms</a> (https://www.google.com/chrome/terms). </li> </ul> <p>If you don’t agree to our new Terms, you can find more information about your options in our <a href="https://policies.google.com/terms/chromechanges#faq">Frequently Asked Questions</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chrome Terms of Service</h2> <p>These Terms of Service apply to the executable code version of Google Chrome. Source code for Google Chrome is available free of charge under open source software license agreements at chrome://credits.</p> <p><strong>1. Your relationship with Google</strong></p>
diff --git a/components/resources/terms/terms_es-419.html b/components/resources/terms/terms_es-419.html index 0e30e33f..e9fb8ed 100644 --- a/components/resources/terms/terms_es-419.html +++ b/components/resources/terms/terms_es-419.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>El 31 de marzo de 2020, actualizaremos las condiciones del servicio de Google Chrome. Las nuevas condiciones incluirán las Condiciones del Servicio de Google y las condiciones del servicio adicionales de Google Chrome y el Sistema operativo Chrome. Hasta entonces, seguirán vigentes las condiciones que se indican a continuación. Para obtener más detalles, consulte un <a href="https://policies.google.com/terms/chromechanges">resumen de los cambios clave</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Consulte una vista previa de las nuevas <a href="https://policies.google.com/terms/update">Condiciones</a> (https://policies.google.com/terms/update) y <a href="https://www.google.com/chrome/terms">Condiciones Adicionales</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Si no acepta nuestras nuevas Condiciones, puede encontrar más información sobre las opciones disponibles en nuestras <a href="https://policies.google.com/terms/chromechanges#faq">Preguntas frecuentes</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Condiciones del servicio de Google Chrome</h2> <p>Estas Condiciones del servicio se aplicarán a la versión de código ejecutable de Google Chrome. El código fuente de Google Chrome se encuentra disponible de forma gratuita sujeto a los acuerdos de licencia de software de código abierto que encontrará en la página chrome://credits.</p> <p><strong>1. Su relación con Google</strong></p>
diff --git a/components/resources/terms/terms_es.html b/components/resources/terms/terms_es.html index cfa57df9..f35c2ee9 100644 --- a/components/resources/terms/terms_es.html +++ b/components/resources/terms/terms_es.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>El 31 de marzo de 2020 actualizaremos los términos del servicio de Google Chrome. Los nuevos términos incluirán los Términos del Servicio de Google y los Términos del Servicio Adicionales de Google Chrome y Chrome OS. Hasta entonces, seguirán aplicándose los términos que se indican más abajo. Para obtener más información, consulta el <a href="https://policies.google.com/terms/chromechanges">resumen de los cambios principales</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Aquí tienes una vista previa de los nuevos <a href="https://policies.google.com/terms/update">Términos</a> (https://policies.google.com/terms/update) y de los <a href="https://www.google.com/chrome/terms">Términos Adicionales</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Si no estás de acuerdo con nuestros nuevos Términos, encontrarás más información sobre tus opciones en nuestras <a href="https://policies.google.com/terms/chromechanges#faq">preguntas frecuentes</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Condiciones del servicio de Google Chrome</h2> <p>Estas Condiciones del servicio se aplicarán a la versión de código ejecutable de Google Chrome. El código fuente de Google Chrome está disponible de forma gratuita de conformidad con los acuerdos sobre licencias de software libre que se encuentran en la página chrome://credits.</p> <p><strong>1. Su relación con Google</strong></p>
diff --git a/components/resources/terms/terms_et.html b/components/resources/terms/terms_et.html index 5d5a9bd..1f18a50 100644 --- a/components/resources/terms/terms_et.html +++ b/components/resources/terms/terms_et.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Värskendame 31. märtsil 2020 Chrome'i teenusetingimusi. Uued tingimused hõlmavad Google’i teenusetingimusi ning Google Chrome'i ja Chrome OS-i lisateenusetingimusi. Seni kehtivad allolevad tingimused. Lisateabe saamiseks vaadake <a href="https://policies.google.com/terms/chromechanges">oluliste muudatuste kokkuvõtet</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Vaadake uute <a href="https://policies.google.com/terms/update">tingimuste</a> (https://policies.google.com/terms/update) ja <a href="https://www.google.com/chrome/terms">lisatingimuste</a> (https://www.google.com/chrome/terms) eelvaadet. </li> </ul> <p>Kui te uute tingimustega ei nõustu, leiate oma võimaluste kohta lisateavet <a href="https://policies.google.com/terms/chromechanges#faq">korduma kippuvatest küsimustest</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chrome'i teenusetingimused</h2> <p>Käesolevad teenusetingimused kehtivad Google Chrome'i täitmiskoodi versiooni kohta. Google Chrome'i lähtekood on tasuta saadaval avatud allikaga tarkvara litsentsilepingutes aadressil chrome://credits.</p> <p><strong>1. Teie suhe Google'iga</strong></p>
diff --git a/components/resources/terms/terms_fa.html b/components/resources/terms/terms_fa.html index 140d846e..5f7b6bb 100644 --- a/components/resources/terms/terms_fa.html +++ b/components/resources/terms/terms_fa.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>شرایط خدمات Chrome را ۳۱ مارس ۲۰۲۰ بهروزرسانی میکنیم. شرایط جدید شامل «شرایط خدمات Google» و «شرایط خدمات تکمیلی» Google Chrome و «سیستمعامل Chrome» خواهد بود. تا آن زمان، شرایط زیر همچنان اعمال خواهد شد. برای جزئیات بیشتر، <a href="https://policies.google.com/terms/chromechanges">خلاصه تغییرات اساسی</a> (https://policies.google.com/terms/chromechanges) را ببینید. </p> <ul> <li>پیشنمایش <a href="https://policies.google.com/terms/update">شرایط</a> (https://policies.google.com/terms/update) و <a href="https://www.google.com/chrome/terms">شرایط تکمیلی</a> (https://www.google.com/chrome/terms) جدید را ببینید. </li> </ul> <p>اگر با «شرایط» جدید ما موافق نیستید، میتوانید اطلاعات بیشتری درباره گزینههای خود در <a href="https://policies.google.com/terms/chromechanges#faq">پرسشگان</a> (https://policies.google.com/terms/chromechanges#faq) ما پیدا کنید. </p></div> <h2>شرایط سرویس Google Chrome</h2> <p>این شرایط سرویس در مورد نسخه Google Chrome که دارای کد قابل اجراست اعمال می شود. بر اساس قراردادهای مجوز در آدرس chrome://credits، کد منبع Google Chrome به طور رایگان و به صورت نرم افزار منبع باز در اختیار شما قرار می گیرد.</p> <p><strong>1. ارتباط شما با Google</strong></p>
diff --git a/components/resources/terms/terms_fi.html b/components/resources/terms/terms_fi.html index c945a98..1f3946a0 100644 --- a/components/resources/terms/terms_fi.html +++ b/components/resources/terms/terms_fi.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Chromen käyttöehdot päivitetään 31.3.2020. Esimerkiksi Googlen käyttöehdot ja Google Chromen sekä Chrome-käyttöjärjestelmän lisäehdot sisältyvät uusiin ehtoihin. Alla olevat ehdot ovat voimassa uusien julkaisuun asti. Jos haluat lisätietoja, katso <a href="https://policies.google.com/terms/chromechanges">yhteenveto tärkeimmistä muutoksista</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Katso uusien <a href="https://policies.google.com/terms/update">käyttöehtojen</a> (https://policies.google.com/terms/update) ja <a href="https://www.google.com/chrome/terms">lisäehtojen</a> (https://www.google.com/chrome/terms) esikatselu. </li> </ul> <p>Jos et hyväksy uusia käyttöehtoja, lue lisää vaihtoehdoistasi <a href="https://policies.google.com/terms/chromechanges#faq">Usein kysyttyä ‑osiosta</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chromen käyttöehdot</h2> <p>Nämä käyttöehdot koskevat Google Chromen suoritettavaa koodiversiota. Google Chromen lähdekoodi on saatavilla maksutta avoimen lähdekoodin ohjelmistojen käyttöoikeussopimusten mukaisesti osoitteesta chrome://credits.</p> <p><strong>1. Käyttäjän suhde Googleen</strong></p>
diff --git a/components/resources/terms/terms_fil.html b/components/resources/terms/terms_fil.html index 847ce1a3..43788a5 100644 --- a/components/resources/terms/terms_fil.html +++ b/components/resources/terms/terms_fil.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Ia-update namin ang mga tuntunin ng serbisyo para sa Chrome sa Marso 31, 2020. Kabilang sa mga bagong tuntunin ang Mga Tuntunin ng Serbisyo ng Google at ang mga karagdagang tuntunin ng serbisyo ng Google Chrome at Chrome OS. Hanggang sa panahong iyon, patuloy na malalapat ang mga tuntunin sa ibaba. Tingnan ang <a href="https://policies.google.com/terms/chromechanges">buod ng mga pangunahing pagbabago</a> (https://policies.google.com/terms/chromechanges) para sa higit pang detalye. </p> <ul> <li>Tingnan ang preview ng bagong <a href="https://policies.google.com/terms/update">Mga Tuntunin</a> (https://policies.google.com/terms/update) at <a href="https://www.google.com/chrome/terms">Mga Karagdagang Tuntunin</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Kung hindi ka sumasang-ayon sa aming bagong Mga Tuntunin, makakahanap ka ng higit pang impormasyon tungkol sa iyong mga opsyon sa aming <a href="https://policies.google.com/terms/chromechanges#faq">Mga Madalas Itanong (FAQ)</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Mga Tuntunin ng Serbisyo ng Google Chrome</h2> <p>Nalalapat ang Mga Tuntunin ng Serbisyong ito sa executable code na bersyon ng Google Chrome. Magagamit nang libre ang source code para sa Google Chrome alinsunod sa open source na mga kasunduan sa paglilisensya ng software chrome://credits.</p> <p><strong>1. Ang iyong kaugnayan sa Google</strong></p>
diff --git a/components/resources/terms/terms_fr.html b/components/resources/terms/terms_fr.html index 8b67f318..db7b097 100644 --- a/components/resources/terms/terms_fr.html +++ b/components/resources/terms/terms_fr.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Nous mettons à jour les conditions d'utilisation de Chrome au 31 mars 2020. La nouvelle version se composera des Conditions d'utilisation de Google et des Conditions d'utilisation supplémentaires de Google Chrome et Chrome OS. En attendant, les conditions ci-dessous restent applicables. Pour en savoir plus, vous pouvez consulter un <a href="https://policies.google.com/terms/chromechanges">résumé des principales modifications</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Consultez un aperçu des nouvelles <a href="https://policies.google.com/terms/update">Conditions d'utilisation</a> (https://policies.google.com/terms/update) et des <a href="https://www.google.com/chrome/terms">Conditions supplémentaires</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Si vous n'acceptez pas nos nouvelles Conditions d'utilisation, consultez les <a href="https://policies.google.com/terms/chromechanges#faq">Questions fréquentes</a> (https://policies.google.com/terms/chromechanges#faq) pour en savoir plus sur les options qui s'offrent à vous. </p></div> <h2>Conditions d'utilisation de Google Chrome</h2> <p>Ces Conditions d'utilisation s'appliquent à la version du code exécutable de Google Chrome. Le code source de Google Chrome est mis à disposition gratuitement dans le cadre des accords de licence des logiciels libres, sur la page chrome://credits.</p> <p><strong>1. Vos relations avec Google</strong></p>
diff --git a/components/resources/terms/terms_gu.html b/components/resources/terms/terms_gu.html index 097ac76..fce0795107 100644 --- a/components/resources/terms/terms_gu.html +++ b/components/resources/terms/terms_gu.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>We’re updating the terms of service for Chrome on March 31, 2020. The new terms will include Google’s Terms of Service and the Google Chrome and Chrome OS additional terms of service. Until then, the terms below continue to apply. See a <a href="https://policies.google.com/terms/chromechanges">summary of the key changes</a> (https://policies.google.com/terms/chromechanges) for more details. </p> <ul> <li>See a preview of the new <a href="https://policies.google.com/terms/update">Terms</a> (https://policies.google.com/terms/update) and <a href="https://www.google.com/chrome/terms">Additional Terms</a> (https://www.google.com/chrome/terms). </li> </ul> <p>If you don’t agree to our new Terms, you can find more information about your options in our <a href="https://policies.google.com/terms/chromechanges#faq">Frequently Asked Questions</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chrome સેવાની શરતો</h2> <p>આ સેવાની શરતો Google Chrome ના એક્ઝિક્યૂટેબલ કોડ વર્ઝન પર લાગુ થાય છે. Google Chrome માટે સ્રોત કોડ chrome://credits પર ઓપન સોર્સ સૉફ્ટવેર લાઇસેંસ હેઠળ નિઃશુલ્ક ઉપલબ્ધ છે.</p> <p><strong>1. Google સાથે આપનો સંબંધ</strong></p>
diff --git a/components/resources/terms/terms_he.html b/components/resources/terms/terms_he.html index 486983f..2f1a2f4 100644 --- a/components/resources/terms/terms_he.html +++ b/components/resources/terms/terms_he.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>אנו מעדכנים את התנאים וההגבלות של Chrome ב-31 במרץ 2020. התנאים החדשים יכללו את התנאים וההגבלות של Google ואת התנאים וההגבלות הנוספים של Google Chrome ו-Chrome OS. עד למועד זה ימשיכו לחול התנאים שלהלן. כדי לקבל פרטים נוספים, ניתן לעיין ב<a href="https://policies.google.com/terms/chromechanges">סיכום של השינויים העיקריים</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>בקישורים הבאים אפשר לעיין מראש בתנאים <a href="https://policies.google.com/terms/update">החדשים</a> (https://policies.google.com/terms/update) ו<a href="https://www.google.com/chrome/terms">בתנאים הנוספים</a> (https://www.google.com/chrome/terms). </li> </ul> <p>אם אינך רוצה להביע הסכמה לתנאים החדשים, האפשרויות העומדות בפניך מפורטות <a href="https://policies.google.com/terms/chromechanges#faq">בשאלות הנפוצות</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>התנאים וההגבלות של Google Chrome</h2> <p>תנאים והגבלות אלו חלים על גרסת הקוד להרצה של Google Chrome. קוד המקור עבור Google Chrome זמין, ללא תשלום, במסגרת הסכמי רישיון של תוכנת קוד פתוח, בכתובת chrome://credits.</p> <p><strong>1. יחסיך עם Google</strong></p>
diff --git a/components/resources/terms/terms_hi.html b/components/resources/terms/terms_hi.html index 631a576c..6cb0e99b 100644 --- a/components/resources/terms/terms_hi.html +++ b/components/resources/terms/terms_hi.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>हम 31 मार्च, 2020 को Chrome की सेवा की शर्तें अपडेट कर रहे हैं. नई शर्तों में Google की सेवा की शर्तों के साथ ही, Google Chrome और Chrome OS की सेवा की अतिरिक्त शर्तें शामिल होंगी. तब तक, नीचे दी गई शर्तें लागू रहेंगी. ज़्यादा जानकारी के लिए, <a href="https://policies.google.com/terms/chromechanges">मुख्य बदलावों की खास जानकारी</a> (https://policies.google.com/terms/chromechanges) देखें. </p> <ul> <li>नई <a href="https://policies.google.com/terms/update">शर्तों</a> (https://policies.google.com/terms/update) और <a href="https://www.google.com/chrome/terms">अतिरिक्त शर्तों</a> (https://www.google.com/chrome/terms) की झलक देखें. </li> </ul> <p>अगर आप हमारी नई शर्तों से सहमत नहीं हैं, तो आप हमारे <a href="https://policies.google.com/terms/chromechanges#faq">अक्सर पूछे जाने वाले सवालों</a> (https://policies.google.com/terms/chromechanges#faq) में जाकर जान सकते हैं कि आप क्या कर सकते हैं. </p></div> <h2>Google Chrome सेवा की शर्तें</h2> <p>सेवा की ये शर्तें Google Chrome के निष्पादन योग्य कोड संस्करण पर लागू होती हैं. Google Chrome के लिए स्रोत कोड chrome://credits पर खुला स्रोत सॉफ़्टवेयर लाइसेंस अनुबंध के अंतर्गत निःशुल्क उपलब्ध है.</p> <p><strong>1. Google के साथ आपका संबंध</strong></p>
diff --git a/components/resources/terms/terms_hr.html b/components/resources/terms/terms_hr.html index f5edf10..14809faa 100644 --- a/components/resources/terms/terms_hr.html +++ b/components/resources/terms/terms_hr.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Uvjete pružanja usluge za Chrome ažurirat ćemo 31. ožujka 2020. Novi uvjeti uključivat će Googleove uvjete pružanja usluge i Dodatne uvjete pružanja usluge za Google Chrome i OS Chrome. U međuvremenu se i dalje primjenjuju uvjeti u nastavku. Više pojedinosti pročitajte u <a href="https://policies.google.com/terms/chromechanges">sažetku ključnih promjena</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Pogledajte pregled novih <a href="https://policies.google.com/terms/update">Uvjeta</a> (https://policies.google.com/terms/update) i <a href="https://www.google.com/chrome/terms">Dodatnih uvjeta</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Ako ne prihvaćate naše nove Uvjete pružanja usluge, više informacija o svojim mogućnostima možete pronaći u našim <a href="https://policies.google.com/terms/chromechanges#faq">Čestim pitanjima</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chrome uvjeti pružanja usluge</h2> <p>Ovi Uvjeti pružanja usluge primjenjuju se na izvršnu verziju koda preglednika Google Chrome. Izvorni kôd za Google Chrome dostupan je besplatno prema ugovorima o softverskoj licenci otvorenog koda na chrome://credits.</p> <p><strong>1. Vaš ugovorni odnos s Googleom</strong></p>
diff --git a/components/resources/terms/terms_hu.html b/components/resources/terms/terms_hu.html index 6223c93..7831976 100644 --- a/components/resources/terms/terms_hu.html +++ b/components/resources/terms/terms_hu.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>2020. március 31-én frissítjük a Chrome Általános Szerződési Feltételeket. Az új feltételek között megtalálhatók a Google Általános Szerződési Feltételek, valamint a Google Chrome és a Chrome OS Kiegészítő Általános Szerződési Feltételei is. Addig az alábbi feltételek maradnak érvényesek. További részletekért lásd a <a href="https://policies.google.com/terms/chromechanges">legfontosabb változások összefoglalását</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Tekintse át az új <a href="https://policies.google.com/terms/update">Általános Szerződési Feltételek</a> (https://policies.google.com/terms/update) és a <a href="https://www.google.com/chrome/terms">Kiegészítő Általános Szerződési Feltételek</a> (https://www.google.com/chrome/terms) előnézetét. </li> </ul> <p>Ha nem fogadja el az új Általános Szerződési Feltételeket, a lehetőségeiről a <a href="https://policies.google.com/terms/chromechanges#faq">Gyakran Ismételt Kérdések</a> (https://policies.google.com/terms/chromechanges#faq) oldalán tájékozódhat. </p></div> <h2>Google Chrome - Általános Szerződési Feltételek</h2> <p>A jelen Általános Szerződési Feltételek szabályozzák a Google Chrome futtatható kódú változatának az Ön által való használatát. A Google Chrome forráskódja a nyílt forráskódú szoftverekre vonatkozó licencszerződések keretében díjmentesen elérhető a következő címen: chrome://credits.</p> <p><strong>1. Az Ön kapcsolata a Google-lal</strong></p>
diff --git a/components/resources/terms/terms_id.html b/components/resources/terms/terms_id.html index 6122b160..5d6118f 100644 --- a/components/resources/terms/terms_id.html +++ b/components/resources/terms/terms_id.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Kami memperbarui persyaratan layanan untuk Chrome pada 31 Maret 2020. Persyaratan baru akan mencakup Persyaratan Layanan Google dan persyaratan layanan tambahan Google Chrome dan Chrome OS. Sebelum tanggal tersebut, persyaratan di bawah ini tetap berlaku. Lihat <a href="https://policies.google.com/terms/chromechanges">ringkasan perubahan utama</a> (https://policies.google.com/terms/chromechanges) untuk mengetahui detail selengkapnya. </p> <ul> <li>Lihat pratinjau <a href="https://policies.google.com/terms/update">Persyaratan</a> (https://policies.google.com/terms/update) baru dan <a href="https://www.google.com/chrome/terms">Persyaratan Tambahan</a> (https://www.google.com/chrome/terms) kami. </li> </ul> <p>Jika Anda tidak menyetujui Persyaratan baru kami, Anda dapat menemukan informasi selengkapnya tentang opsi Anda di <a href="https://policies.google.com/terms/chromechanges#faq">Pertanyaan Umum (FAQ)</a> (https://policies.google.com/terms/chromechanges#faq) kami. </p></div> <h2>Persyaratan Layanan Google Chrome</h2> <p>Persyaratan Layanan ini berlaku untuk versi kode Google Chrome yang dapat dieksekusi. Kode sumber untuk Google Chrome tersedia secara gratis berdasarkan perjanjian lisensi perangkat lunak sumber terbuka di chrome://credits.</p> <p><strong>1. Hubungan Anda dengan Google</strong></p>
diff --git a/components/resources/terms/terms_it.html b/components/resources/terms/terms_it.html index d78debd..d2a2eea 100644 --- a/components/resources/terms/terms_it.html +++ b/components/resources/terms/terms_it.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Il 31 marzo 2020 aggiorneremo i Termini di servizio di Chrome. I nuovi termini includeranno i Termini di servizio di Google, nonché i Termini di servizio aggiuntivi di Google Chrome e Chrome OS. Fino alla data indicata rimangono in vigore i termini che seguono. La pagina del <a href="https://policies.google.com/terms/chromechanges">riepilogo delle modifiche principali</a> (https://policies.google.com/terms/chromechanges) fornisce ulteriori informazioni. </p> <ul> <li>È disponibile un'anteprima dei nuovi <a href="https://policies.google.com/terms/update">Termini</a> (https://policies.google.com/terms/update) e dei <a href="https://www.google.com/chrome/terms">Termini aggiuntivi</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Se l'utente non accetta i nuovi Termini, può trovare ulteriori informazioni sulle opzioni a sua disposizione nelle <a href="https://policies.google.com/terms/chromechanges#faq">Domande frequenti</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Termini di servizio di Google Chrome</h2> <p>I presenti Termini di servizio si applicano alla versione di codice eseguibile di Google Chrome. Il codice sorgente di Google Chrome è disponibile gratuitamente ai sensi dei contratti di licenza del software open source all'indirizzo chrome://credits.</p> <p><strong>1. Il rapporto dell'utente con Google</strong></p>
diff --git a/components/resources/terms/terms_ja.html b/components/resources/terms/terms_ja.html index 99dffbe..cd765327 100644 --- a/components/resources/terms/terms_ja.html +++ b/components/resources/terms/terms_ja.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Chrome 利用規約を 2020 年 3 月 31 日に更新します。新しい利用規約は、Google 利用規約と、Google Chrome および Chrome OS 追加利用規約で構成されます。それまでは以下の利用規約が引き続き適用されます。詳しくは、<a href="https://policies.google.com/terms/chromechanges">主な変更の概要</a> (https://policies.google.com/terms/chromechanges)をご覧ください。 </p> <ul> <li>新しい<a href="https://policies.google.com/terms/update">利用規約</a> (https://policies.google.com/terms/update)と<a href="https://www.google.com/chrome/terms">追加利用規約</a> (https://www.google.com/chrome/terms)をご確認ください。 </li> </ul> <p>新しい利用規約に同意いただけない場合は、<a href="https://policies.google.com/terms/chromechanges#faq">よくある質問</a> (https://policies.google.com/terms/chromechanges#faq)で他の選択肢に関する情報をご覧ください。 </p></div> <h2>Google Chrome 利用規約</h2> <p>本利用規約は、実行コード バージョンの Google Chrome に適用されます。Google Chrome のソース コードは、chrome://credits のオープン ソース ソフトウェア ライセンスに基づき、無料でご利用いただけます。</p> <p><strong>1. ユーザーと Google の関係</strong></p>
diff --git a/components/resources/terms/terms_kn.html b/components/resources/terms/terms_kn.html index 19436f3f..daf2a4d 100644 --- a/components/resources/terms/terms_kn.html +++ b/components/resources/terms/terms_kn.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>We’re updating the terms of service for Chrome on March 31, 2020. The new terms will include Google’s Terms of Service and the Google Chrome and Chrome OS additional terms of service. Until then, the terms below continue to apply. See a <a href="https://policies.google.com/terms/chromechanges">summary of the key changes</a> (https://policies.google.com/terms/chromechanges) for more details. </p> <ul> <li>See a preview of the new <a href="https://policies.google.com/terms/update">Terms</a> (https://policies.google.com/terms/update) and <a href="https://www.google.com/chrome/terms">Additional Terms</a> (https://www.google.com/chrome/terms). </li> </ul> <p>If you don’t agree to our new Terms, you can find more information about your options in our <a href="https://policies.google.com/terms/chromechanges#faq">Frequently Asked Questions</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chrome ಸೇವಾ ನಿಯಮಗಳು</h2> <p>ಈ ಸೇವೆಯ ನಿಯಮಗಳುGoogle Chrome ನ ಕಾರ್ಯಗತಗೊಳಿಸುವ ಕೋಡ್ ಆವೃತ್ತಿಗೆ ಅನ್ವಯಿಸುತ್ತದೆ. Google Chrome ನ ಮೂಲ ಕೋಡ್ chrome://credits ನಲ್ಲಿ ತೆರೆದ ಮೂಲ ಸಾಫ್ಟ್ವೇರ್ ಪರವಾನಗಿ ಒಪ್ಪಂದದ ಅಡಿಯಲ್ಲಿ ಉಚಿತವಾಗಿ ಲಭ್ಯವಿದೆ.</p> <p><strong>1. Google ನೊಂದಿಗೆ ನಿಮ್ಮ ಸಂಬಂಧ</strong></p>
diff --git a/components/resources/terms/terms_ko.html b/components/resources/terms/terms_ko.html index 35cbd34..fb7d2ee 100644 --- a/components/resources/terms/terms_ko.html +++ b/components/resources/terms/terms_ko.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>2020년 3월 31일 Chrome 서비스 약관이 업데이트될 예정입니다. 새로운 약관에는 Google의 서비스 약관과 Chrome 및 Chrome OS 추가 서비스 약관이 포함됩니다. 그때까지는 아래 약관이 계속 적용됩니다. 자세한 내용은 <a href="https://policies.google.com/terms/changes">주요 변경사항 요약</a> (https://policies.google.com/terms/changes)을 참조하세요. </p> <ul> <li>새로운 <a href="https://policies.google.com/terms/update">약관</a> (https://policies.google.com/terms/update)과 <a href="https://www.google.com/chrome/terms">추가 약관</a> (https://www.google.com/chrome/terms) 미리보기를 확인하세요. </li> </ul> <p>새로운 약관에 동의하지 않을 경우 <a href="https://policies.google.com/terms/chromechanges#faq">자주 묻는 질문(FAQ)</a> (https://policies.google.com/terms/chromechanges#faq)에서 어떤 옵션이 있는지 자세히 알아보세요. </p></div> <h2>Google 크롬 서비스 약관</h2> <p>본 서비스 약관은 Google 크롬의 실행 코드 버전에 적용됩니다. Google 크롬의 소스 코드는 오픈 소스 소프트웨어 라이센스 계약에 따라 무료로 제공됩니다. chrome://credits</p> <p><strong>1. 귀하와 Google과의 관계</strong></p>
diff --git a/components/resources/terms/terms_lt.html b/components/resources/terms/terms_lt.html index fd7dc36..0374d29 100644 --- a/components/resources/terms/terms_lt.html +++ b/components/resources/terms/terms_lt.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>2020 m. kovo 31 d. atnaujiname „Chrome“ paslaugų teikimo sąlygas. Į naujas sąlygas bus įtrauktos „Google“ paslaugų teikimo sąlygos bei „Google Chrome“ ir „Chrome“ OS papildomos paslaugų teikimo sąlygos. Iki šios datos toliau bus taikomos nurodytos sąlygos. Jei reikia daugiau išsamios informacijos, žr. <a href="https://policies.google.com/terms/chromechanges">svarbiausių pakeitimų santrauką</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Žr. naujų <a href="https://policies.google.com/terms/update">sąlygų</a> (https://policies.google.com/terms/update) ir <a href="https://www.google.com/chrome/terms">papildomų sąlygų</a> (https://www.google.com/chrome/terms) peržiūrą. </li> </ul> <p>Jei nesutinkate su naujomis sąlygomis, daugiau informacijos apie pasirinkimo galimybes rasite <a href="https://policies.google.com/terms/chromechanges#faq">„Dažniausiai užduodamų klausimų“ skiltyje</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>„Google Chrome“ paslaugų teikimo sąlygos</h2> <p>Šios paslaugų teikimo sąlygos taikomos „Google Chrome“ vykdomajai kodo versijai. „Google Chrome“ šaltinio kodą galima naudoti nemokamai pagal atvirojo šaltinio programinės įrangos licencijos sutartis, pateiktas šiuo adresu: chrome://credits.</p> <p><strong>1. Jūsų santykis su „Google“</strong></p>
diff --git a/components/resources/terms/terms_lv.html b/components/resources/terms/terms_lv.html index e315109..50e4ee1 100644 --- a/components/resources/terms/terms_lv.html +++ b/components/resources/terms/terms_lv.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>2020. gada 31. martā mēs atjaunināsim Chrome pakalpojumu sniegšanas noteikumus. Jaunajos noteikumos būs ietverti Google pakalpojumu sniegšanas noteikumi, kā arī Google Chrome un Chrome OS pakalpojumu sniegšanas papildu noteikumi. Līdz tam laikam joprojām ir spēkā tālāk norādītie noteikumi. Plašāku informāciju skatiet <a href="https://policies.google.com/terms/chromechanges">galveno izmaiņu kopsavilkumā</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Skatiet jauno <a href="https://policies.google.com/terms/update">noteikumu</a> (https://policies.google.com/terms/update) un <a href="https://www.google.com/chrome/terms">papildu noteikumu</a> (https://www.google.com/chrome/terms) priekšskatījumu. </li> </ul> <p>Ja nepiekrītat mūsu jaunajiem noteikumiem, plašāku informāciju par pieejamajām iespējām skatiet sadaļā <a href="https://policies.google.com/terms/chromechanges#faq">Bieži uzdotie jautājumi</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chrome pakalpojumu sniegšanas noteikumi</h2> <p>Šie pakalpojumu sniegšanas noteikumi attiecas uz Google Chrome izpildāmā koda versiju. Google Chrome pirmkods ir pieejams bez maksas saskaņā ar atvērtā koda programmatūras licences līgumu, kas pieejams vietnē chrome://credits.</p> <p><strong>1. Attiecības ar Google</strong></p>
diff --git a/components/resources/terms/terms_ml.html b/components/resources/terms/terms_ml.html index 103041f3..2d5c4c6 100644 --- a/components/resources/terms/terms_ml.html +++ b/components/resources/terms/terms_ml.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>We’re updating the terms of service for Chrome on March 31, 2020. The new terms will include Google’s Terms of Service and the Google Chrome and Chrome OS additional terms of service. Until then, the terms below continue to apply. See a <a href="https://policies.google.com/terms/chromechanges">summary of the key changes</a> (https://policies.google.com/terms/chromechanges) for more details. </p> <ul> <li>See a preview of the new <a href="https://policies.google.com/terms/update">Terms</a> (https://policies.google.com/terms/update) and <a href="https://www.google.com/chrome/terms">Additional Terms</a> (https://www.google.com/chrome/terms). </li> </ul> <p>If you don’t agree to our new Terms, you can find more information about your options in our <a href="https://policies.google.com/terms/chromechanges#faq">Frequently Asked Questions</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chrome സേവനനിബന്ധനകള്</h2> <p>ഈ സേവനനിബന്ധനകള് Google Chrome ന്റെ നടപ്പാക്കാന് കഴിയുന്ന കോഡ് പതിപ്പിന് ബാധകമാണ്. Google Chrome നായുള്ള ഉറവിട കോഡ് chrome://credits ലെ ഓപ്പണ് സോഴ്സ് സോഫ്റ്റ്വെയര് ലൈസന്സ് കരാറുകള്ക്ക് ചുവടെ സൌജന്യമായി ലഭ്യമാണ്.</p> <p><strong>1. Google</strong> മായുള്ള നിങ്ങളുടെ ബന്ധം</p>
diff --git a/components/resources/terms/terms_mr.html b/components/resources/terms/terms_mr.html index 3fc4eb0..c226037 100644 --- a/components/resources/terms/terms_mr.html +++ b/components/resources/terms/terms_mr.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>We’re updating the terms of service for Chrome on March 31, 2020. The new terms will include Google’s Terms of Service and the Google Chrome and Chrome OS additional terms of service. Until then, the terms below continue to apply. See a <a href="https://policies.google.com/terms/chromechanges">summary of the key changes</a> (https://policies.google.com/terms/chromechanges) for more details. </p> <ul> <li>See a preview of the new <a href="https://policies.google.com/terms/update">Terms</a> (https://policies.google.com/terms/update) and <a href="https://www.google.com/chrome/terms">Additional Terms</a> (https://www.google.com/chrome/terms). </li> </ul> <p>If you don’t agree to our new Terms, you can find more information about your options in our <a href="https://policies.google.com/terms/chromechanges#faq">Frequently Asked Questions</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chrome सेवा अटी</h2> <p>Google Chrome च्या कार्यवाहीयोग्य कोड आवृत्तीस या सेवा अटी लागू होतात. मुक्त स्रोत सॉफ्टवेअर परवाना करारा अंतर्गत chrome://credits येथे Google Chrome साठी स्रोत कोड विनामूल्य उपलब्ध आहे .</p> <p><strong>1. आपले Google बरोबरचे संबंध</strong></p>
diff --git a/components/resources/terms/terms_nb.html b/components/resources/terms/terms_nb.html index 5981a39..be8aab93 100644 --- a/components/resources/terms/terms_nb.html +++ b/components/resources/terms/terms_nb.html
@@ -9,10 +9,14 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Vi oppdaterer vilkårene for bruk av Chrome den 31. mars 2020. De nye vilkårene omfatter Googles vilkår for bruk og tilleggsvilkårene for bruk av Google Chrome og Chrome OS. Frem til da fortsetter vilkårene under å gjelde. Se et <a href="https://policies.google.com/terms/chromechanges">sammendrag av de viktigste endringene</a> (https://policies.google.com/terms/chromechanges) for flere detaljer. </p> <ul> <li>Se en forhåndsvisning av de nye <a href="https://policies.google.com/terms/update">vilkårene</a> (https://policies.google.com/terms/update) og <a href="https://www.google.com/chrome/terms">tilleggsvilkårene</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Hvis du ikke godtar de nye vilkårene, finner du mer informasjon om valgmulighetene dine under <a href="https://policies.google.com/terms/chromechanges#faq">Vanlige spørsmål</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> +<div class="notice"> <p>We’re updating the terms of service for Chrome on March 31, 2020. The new terms will include Google’s Terms of Service and the Google Chrome and Chrome OS additional terms of service. Until then, the terms below continue to apply. See a <a href="https://policies.google.com/terms/chromechanges">summary of the key changes</a> (https://policies.google.com/terms/chromechanges) for more details. </p> <ul> <li>See a preview of the new <a href="https://policies.google.com/terms/update">Terms</a> (https://policies.google.com/terms/update) and <a href="https://www.google.com/chrome/terms">Additional Terms</a> (https://www.google.com/chrome/terms). </li> </ul> <p>If you don’t agree to our new Terms, you can find more information about your options in our <a href="https://policies.google.com/terms/chromechanges#faq">Frequently Asked Questions</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Vilkår for bruk av Google Chrome</h2> <p>Disse vilkårene for bruk gjelder versjonen av Google Chrome med kjørbar kode. Kildekoden for Google Chrome er tilgjengelig gratis under lisensavtalene for programvare med åpen kildekode på chrome://credits.</p> <p><strong>1. Ditt forhold til Google</strong></p>
diff --git a/components/resources/terms/terms_nl.html b/components/resources/terms/terms_nl.html index 2ed125b..df79c06d 100644 --- a/components/resources/terms/terms_nl.html +++ b/components/resources/terms/terms_nl.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>We updaten de Servicevoorwaarden van Chrome op 31 maart 2020. De nieuwe voorwaarden omvatten de Servicevoorwaarden van Google en de Aanvullende servicevoorwaarden van Google Chrome en Chrome OS. Tot die datum blijven de onderstaande voorwaarden van toepassing. Raadpleeg een <a href="https://policies.google.com/terms/chromechanges">overzicht van de belangrijkste wijzigingen</a> (https://policies.google.com/terms/chromechanges) voor meer details. </p> <ul> <li>Bekijk een voorbeeld van de nieuwe <a href="https://policies.google.com/terms/update">Voorwaarden</a> (https://policies.google.com/terms/update) en <a href="https://www.google.com/chrome/terms">Aanvullende voorwaarden</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Als u niet akkoord gaat met onze nieuwe Voorwaarden, vindt u in onze <a href="https://policies.google.com/terms/chromechanges#faq">veelgestelde vragen</a> (https://policies.google.com/terms/chromechanges#faq) meer informatie over uw mogelijkheden. </p></div> <h2>Google Chrome - Servicevoorwaarden</h2> <p>Deze Servicevoorwaarden zijn van toepassing op de uitvoerbare code van Google Chrome. De broncode voor Google Chrome is gratis beschikbaar onder 'open source'-softwarelicentieovereenkomsten op chrome://credits.</p> <p><strong>1. Uw relatie met Google</strong></p>
diff --git a/components/resources/terms/terms_pl.html b/components/resources/terms/terms_pl.html index f2f719c..deaa5fe 100644 --- a/components/resources/terms/terms_pl.html +++ b/components/resources/terms/terms_pl.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>31 marca 2020 roku zaktualizujemy Warunki korzystania z Chrome. Do nowych warunków należeć będą Warunki korzystania z usług Google oraz dodatkowe Warunki korzystania z Google Chrome i Chrome OS. Do tego momentu obowiązują Warunki wskazane poniżej. Więcej szczegółów znajdziesz w <a href="https://policies.google.com/terms/chromechanges">podsumowaniu najważniejszych zmian</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Zobacz podgląd nowych <a href="https://policies.google.com/terms/update">Warunków</a> (https://policies.google.com/terms/update) i <a href="https://www.google.com/chrome/terms">Dodatkowych warunków</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Jeśli nie zgadzasz się na nasze nowe Warunki, więcej informacji o dostępnych opcjach możesz znaleźć w <a href="https://policies.google.com/terms/chromechanges#faq">Najczęstszych pytaniach</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chrome – Warunki korzystania z usługi</h2> <p>Niniejsze Warunki korzystania z usługi dotyczą korzystania z kodu wykonywalnego aplikacji Google Chrome. Kod źródłowy aplikacji Google Chrome jest dostępny bezpłatnie na mocy licencji oprogramowania typu open source zamieszczonej pod adresem chrome://credits.</p> <p><strong>1. Relacje Użytkownika z Google</strong></p>
diff --git a/components/resources/terms/terms_pt-BR.html b/components/resources/terms/terms_pt-BR.html index 4a8bf3b..e618b68 100644 --- a/components/resources/terms/terms_pt-BR.html +++ b/components/resources/terms/terms_pt-BR.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Os Termos de Serviço do Chrome serão atualizados em 31 de março de 2020. Os novos termos incluirão os Termos de Serviço do Google e os Termos de Serviço adicionais do Google Chrome e do Chrome OS. Até a atualização, os termos descritos abaixo continuarão em vigor. Veja um <a href="https://policies.google.com/terms/chromechanges">resumo das principais mudanças</a> (https://policies.google.com/terms/chromechanges) para saber mais. </p> <ul> <li>Conheça os novos <a href="https://policies.google.com/terms/update">Termos</a> (https://policies.google.com/terms/update) e os <a href="https://www.google.com/chrome/terms">Termos adicionais</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Caso não concorde com os novos Termos, saiba mais sobre suas opções na seção <a href="https://policies.google.com/terms/chromechanges#faq">Perguntas frequentes</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Termos de Serviço do Google Chrome</h2> <p>Esses Termos de Serviço aplicam-se à versão do código executável do Google Chrome. O código-fonte do Google Chrome está disponível gratuitamente conforme os acordos de licença de software de código aberto em chrome://credits.</p> <p><strong>1. Relação do usuário com o Google</strong></p>
diff --git a/components/resources/terms/terms_pt-PT.html b/components/resources/terms/terms_pt-PT.html index bdde37c0..4cecbfc4 100644 --- a/components/resources/terms/terms_pt-PT.html +++ b/components/resources/terms/terms_pt-PT.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Vamos atualizar os Termos de Utilização para o Chrome a 31 de março de 2020. Os novos termos vão incluir os Termos de Utilização do Google e os Termos de Utilização Adicionais do Google Chrome e do Chrome OS. Até lá, os termos abaixo continuam a aplicar-se. Consulte um <a href="https://policies.google.com/terms/chromechanges">resumo das principais alterações</a> (https://policies.google.com/terms/chromechanges) para obter mais detalhes. </p> <ul> <li>Veja uma pré-visualização dos novos <a href="https://policies.google.com/terms/update">Termos</a> (https://policies.google.com/terms/update) e dos <a href="https://www.google.com/chrome/terms">Termos Adicionais</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Se não aceitar os nossos novos Termos, pode obter mais informações acerca das suas opções nas nossas <a href="https://policies.google.com/terms/chromechanges#faq">Perguntas frequentes</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Termos de utilização do Google Chrome</h2> <p>Estes Termos de utilização são aplicáveis à versão de código executável do Google Chrome. O código fonte do Google Chrome está disponível gratuitamente nos contratos de licença de software de código aberto em chrome://credits.</p> <p><strong>1. Relação do utilizador com a Google</strong></p>
diff --git a/components/resources/terms/terms_ro.html b/components/resources/terms/terms_ro.html index 79df577e..a587b1f 100644 --- a/components/resources/terms/terms_ro.html +++ b/components/resources/terms/terms_ro.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Actualizăm termenii și condițiile pentru Chrome pe 31 martie 2020. Noile condiții vor include Termenii și condițiile Google și termenii și condițiile suplimentare pentru Google Chrome și sistemul de operare Chrome. Până atunci, se vor aplica în continuare condițiile de mai jos. Consultă <a href="https://policies.google.com/terms/chromechanges">rezumatul modificărilor principale</a> (https://policies.google.com/terms/chromechanges) pentru mai multe detalii. </p> <ul> <li>Vezi o previzualizare a noilor <a href="https://policies.google.com/terms/update">Condiții</a> (https://policies.google.com/terms/update) și a <a href="https://www.google.com/chrome/terms">Condițiilor suplimentare</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Dacă nu accepți noile Condiții, poți afla mai multe informații despre opțiunile disponibile, din <a href="https://policies.google.com/terms/chromechanges#faq">Întrebările frecvente</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Termeni şi condiţii Google Chrome</h2> <p>Aceşti Termeni şi condiţii se aplică versiunii de cod executabil a Google Chrome. Codul sursă pentru Google Chrome este disponibil gratuit, în baza acordurilor de licenţiere pentru software open source, la adresa chrome://credits.</p> <p><strong>1. Relaţia dvs. cu Google</strong></p>
diff --git a/components/resources/terms/terms_ru.html b/components/resources/terms/terms_ru.html index a4e1b89..227a7ce 100644 --- a/components/resources/terms/terms_ru.html +++ b/components/resources/terms/terms_ru.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Условия использования Chrome будут обновлены 31 марта 2020 года. Новые условия будут включать в себя Условия использования Google, а также дополнительные условия использования Google Chrome и Chrome OS. До 31 марта 2020 года будут действовать приведенные ниже условия. Прочитайте <a href="https://policies.google.com/terms/changes">краткую сводку основных изменений</a> (https://policies.google.com/terms/changes). </p> <ul> <li>Ознакомьтесь с новыми <a href="https://policies.google.com/terms/update">Условиями</a> (https://policies.google.com/terms/update) и <a href="https://www.google.com/chrome/terms">Дополнительными условиями</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Если Вы не согласны с новыми Условиями, обратитесь к разделу <a href="https://policies.google.com/terms/chromechanges#faq">часто задаваемых вопросов</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Условия предоставления услуг Google Chrome</h2> <p>Настоящие Условия предоставления услуг распространяются на исполняемый код Google Chrome. Исходный код Google Chrome предоставляется бесплатно на условиях лицензионных соглашений на программное обеспечение с открытым исходным кодом по адресу chrome://credits.</p> <p><strong>1. Взаимоотношения с компанией Google</strong></p>
diff --git a/components/resources/terms/terms_sk.html b/components/resources/terms/terms_sk.html index 70f76af8..ec603f0 100644 --- a/components/resources/terms/terms_sk.html +++ b/components/resources/terms/terms_sk.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>31. marca 2020 aktualizujeme zmluvné podmienky pre prehliadač Chrome. Nové zmluvné podmienky budú zahŕňať zmluvné podmienky spoločnosti Google a dodatočné zmluvné podmienky prehliadača Google Chrome a systému Chrome OS. Dovtedy platia zmluvné podmienky uvedené nižšie. Ďalšie podrobnosti nájdete v <a href="https://policies.google.com/terms/chromechanges">súhrne hlavných zmien</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Pozrite si ukážku nových <a href="https://policies.google.com/terms/update">zmluvných podmienok</a> (https://policies.google.com/terms/update) a <a href="https://www.google.com/chrome/terms">dodatočných zmluvných podmienok</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Ak s novými zmluvnými podmienkami nesúhlasíte, viac o svojich možnostiach sa dozviete v <a href="https://policies.google.com/terms/chromechanges#faq">častých otázkach</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chrome – Zmluvné podmienky</h2> <p>Tieto Zmluvné podmienky sa týkajú verzie spustiteľného kódu aplikácie Google Chrome. Zdrojový kód aplikácie Google Chrome je k dispozícii bezplatne na základe dohody o poskytnutí licencie na softvér open source na adrese chrome://credits.</p> <p><strong>1. Váš vzťah so spoločnosťou Google</strong></p>
diff --git a/components/resources/terms/terms_sl.html b/components/resources/terms/terms_sl.html index 1c2ef68f..187ad7a 100644 --- a/components/resources/terms/terms_sl.html +++ b/components/resources/terms/terms_sl.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>31. marca 2020 bomo posodobili pogoje storitve za Chrome. Novi pogoji bodo vključevali Googlove pogoje storitve ter dodatne pogoje storitve za Google Chrome in Chrome OS. Do takrat veljajo pogoji v nadaljevanju. Če želite več informacij, preberite <a href="https://policies.google.com/terms/chromechanges">povzetek najpomembnejših sprememb</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Oglejte si predogled novih <a href="https://policies.google.com/terms/update">pogojev storitve</a> (https://policies.google.com/terms/update) in <a href="https://www.google.com/chrome/terms">dodatnih pogojev</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Če se ne strinjate z našimi novimi pogoji storitve, je več informacij o možnostih, ki so vam na voljo, v naših <a href="https://policies.google.com/terms/chromechanges#faq">pogostih vprašanjih</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Pogoji storitve Google Chrome</h2> <p>Ti pogoji storitve veljajo za različico brskalnika Google Chrome z izvedljivo kodo. Izvorna koda za Google Chrome je na voljo brezplačno v okviru licenčne pogodbe o odprtokodni programski opremi na strani chrome://credits.</p> <p><strong>1. Razmerje z Googlom</strong></p>
diff --git a/components/resources/terms/terms_sr.html b/components/resources/terms/terms_sr.html index a7db88e97..5982caf 100644 --- a/components/resources/terms/terms_sr.html +++ b/components/resources/terms/terms_sr.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Ажурирамо услове коришћења услуге за Chrome 31. марта 2020. Нови услови обухватају Google услове коришћења услуге и Google Chrome и Chrome ОС додатне услове коришћења услуге. До тада важе услови наведени у наставку. Више информација можете да прочитате у <a href="https://policies.google.com/terms/chromechanges">резимеу кључних измена</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Прегледајте нове <a href="https://policies.google.com/terms/update">услове</a> (https://policies.google.com/terms/update) и <a href="https://www.google.com/chrome/terms">додатне услове</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Ако не прихватате нове услове, можете да пронађете додатне информације о опцијама које су вам на располагању у <a href="https://policies.google.com/terms/chromechanges#faq">честим питањима</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chrome услови коришћења услуге</h2> <p>Ови услови коришћења услуге односе се на верзију извршног кода Google Chrome прегледача. Изворни кôд за Google Chrome доступан је бесплатно према уговору о лиценцирању софтвера са отвореним кодом на адреси chrome://credits.</p> <p><strong>1. Однос између вас и Google-а</strong></p>
diff --git a/components/resources/terms/terms_sv.html b/components/resources/terms/terms_sv.html index 0922201..87acdbf 100644 --- a/components/resources/terms/terms_sv.html +++ b/components/resources/terms/terms_sv.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Vi uppdaterar användarvillkoren för Chrome den 31 mars 2020. De nya villkoren omfattar Googles användarvillkor och de ytterligare användarvillkoren för Google Chrome och Chrome OS. Till dess gäller villkoren nedan. Läs mer i <a href="https://policies.google.com/terms/chromechanges">sammanfattningen av de viktigaste ändringarna</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Förhandsgranska våra nya <a href="https://policies.google.com/terms/update">villkor</a> (https://policies.google.com/terms/update) och <a href="https://www.google.com/chrome/terms">ytterligare villkor</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Om du inte godkänner våra nya villkor, kan du hitta mer information om vilka alternativ du har genom att läsa våra <a href="https://policies.google.com/terms/chromechanges#faq">vanliga frågor</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Användarvillkor för Google Chrome</h2> <p>Dessa användarvillkor gäller den körbara versionen av Google Chrome. Källkoden till Google Chrome är tillgänglig kostnadsfritt enligt de programlicensavtal för öppen källkod som finns på chrome://credits.</p> <p><strong>1. Din relation till Google</strong></p>
diff --git a/components/resources/terms/terms_sw.html b/components/resources/terms/terms_sw.html index 99e33ee..c21202de4 100644 --- a/components/resources/terms/terms_sw.html +++ b/components/resources/terms/terms_sw.html
@@ -8,10 +8,12 @@ <style> :root { color-scheme: light dark; } body { font-family:Arial; font-size:13px; } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>We’re updating the terms of service for Chrome on March 31, 2020. The new terms will include Google’s Terms of Service and the Google Chrome and Chrome OS additional terms of service. Until then, the terms below continue to apply. See a <a href="https://policies.google.com/terms/chromechanges">summary of the key changes</a> (https://policies.google.com/terms/chromechanges) for more details. </p> <ul> <li>See a preview of the new <a href="https://policies.google.com/terms/update">Terms</a> (https://policies.google.com/terms/update) and <a href="https://www.google.com/chrome/terms">Additional Terms</a> (https://www.google.com/chrome/terms). </li> </ul> <p>If you don’t agree to our new Terms, you can find more information about your options in our <a href="https://policies.google.com/terms/chromechanges#faq">Frequently Asked Questions</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Sheria na Masharti ya Google Chrome</h2> <p>Sheria na Masharti haya yanatumika kwa toleo la hati fumbo la kutekelezwa la Google Chrome. Hati fumbo asili ya Google </p> <p><strong>1. Uhusiano wako na Google </strong></p>
diff --git a/components/resources/terms/terms_ta.html b/components/resources/terms/terms_ta.html index 94aceeab..5028242 100644 --- a/components/resources/terms/terms_ta.html +++ b/components/resources/terms/terms_ta.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>We’re updating the terms of service for Chrome on March 31, 2020. The new terms will include Google’s Terms of Service and the Google Chrome and Chrome OS additional terms of service. Until then, the terms below continue to apply. See a <a href="https://policies.google.com/terms/chromechanges">summary of the key changes</a> (https://policies.google.com/terms/chromechanges) for more details. </p> <ul> <li>See a preview of the new <a href="https://policies.google.com/terms/update">Terms</a> (https://policies.google.com/terms/update) and <a href="https://www.google.com/chrome/terms">Additional Terms</a> (https://www.google.com/chrome/terms). </li> </ul> <p>If you don’t agree to our new Terms, you can find more information about your options in our <a href="https://policies.google.com/terms/chromechanges#faq">Frequently Asked Questions</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chrome சேவை விதிமுறைகள்</h2> <p>Google Chrome இன் இயங்கும் குறியீட்டு பதிப்பிற்கு இந்த சேவை விதிமுறைகள் பொருந்தும். chrome://credits இல் உள்ள ஓப்பன் சோர்ஸ் மென்பொருள் உரிம ஒப்பந்தங்களின் கீழ் கட்டணம் இன்றி, Google Chrome க்கான மூல குறியீடு கிடைக்கும்.</p> <p><strong>1. Google உடனான உங்கள் உறவு</strong></p>
diff --git a/components/resources/terms/terms_te.html b/components/resources/terms/terms_te.html index bd54510..e6fde75 100644 --- a/components/resources/terms/terms_te.html +++ b/components/resources/terms/terms_te.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>We’re updating the terms of service for Chrome on March 31, 2020. The new terms will include Google’s Terms of Service and the Google Chrome and Chrome OS additional terms of service. Until then, the terms below continue to apply. See a <a href="https://policies.google.com/terms/chromechanges">summary of the key changes</a> (https://policies.google.com/terms/chromechanges) for more details. </p> <ul> <li>See a preview of the new <a href="https://policies.google.com/terms/update">Terms</a> (https://policies.google.com/terms/update) and <a href="https://www.google.com/chrome/terms">Additional Terms</a> (https://www.google.com/chrome/terms). </li> </ul> <p>If you don’t agree to our new Terms, you can find more information about your options in our <a href="https://policies.google.com/terms/chromechanges#faq">Frequently Asked Questions</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Google Chrome సేవా నిబంధనలు</h2> <p>ఈ సేవా నిబంధనలు Google Chrome యొక్క ఆచరించదగ్గ కోడ్ సంస్కరణకు వర్తిస్తాయి. Google Chrome కోసం సోర్స్ కోడ్ chrome://credits వద్ద ఓపెన్ సోర్స్ సాఫ్ట్వేర్ లైసెన్స్ ఒప్పందం క్రింద ఉచితంగా అందుబాటులో ఉంటుంది.</p> <p><strong>1. Googleతో మీ సంబంధం</strong></p>
diff --git a/components/resources/terms/terms_th.html b/components/resources/terms/terms_th.html index 14fc430..f66ac49 100644 --- a/components/resources/terms/terms_th.html +++ b/components/resources/terms/terms_th.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>เราจะปรับปรุงข้อกำหนดในการให้บริการสำหรับ Chrome ในวันที่ 31 มีนาคม 2020 ข้อกำหนดใหม่นี้จะรวมข้อกำหนดในการให้บริการของ Google และข้อกำหนดในการให้บริการเพิ่มเติมของ Google Chrome และ Chrome OS ไว้ด้วย นโยบายด้านล่างยังคงมีผลใช้งานต่อไปจนกว่าจะถึงวันดังกล่าว ดูรายละเอียดเพิ่มเติมได้ใน<a href="https://policies.google.com/terms/chromechanges">สรุปการเปลี่ยนแปลงสำคัญ</a> (https://policies.google.com/terms/chromechanges) </p> <ul> <li>ดูตัวอย่าง<a href="https://policies.google.com/terms/update">ข้อกำหนด</a> (https://policies.google.com/terms/update)ใหม่และ<a href="https://www.google.com/chrome/terms">ข้อกำหนดเพิ่มเติม</a> (https://www.google.com/chrome/terms) </li> </ul> <p>หากไม่ยอมรับข้อกำหนดใหม่ คุณดูข้อมูลเพิ่มเติมเกี่ยวกับทางเลือกที่มีได้ใน<a href="https://policies.google.com/terms/chromechanges#faq">คำถามที่พบบ่อย</a> (https://policies.google.com/terms/chromechanges#faq) </p></div> <h2>ข้อกำหนดในการให้บริการของ Google Chrome</h2> <p>ข้อกำหนดในการให้บริการนี้จะมีผลบังคับกับโค้ดสั่งการของ Google Chrome ซอร์สโค้ดของ Google Chrome มีให้ฟรีภายใต้สัญญาอนุญาตซอฟต์แวร์แบบโอเพนซอร์สที่ chrome://credits</p> <p><strong>1. ความสัมพันธ์ระหว่างคุณกับ Google</strong></p>
diff --git a/components/resources/terms/terms_tr.html b/components/resources/terms/terms_tr.html index c4361bd..0450e4e 100644 --- a/components/resources/terms/terms_tr.html +++ b/components/resources/terms/terms_tr.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>31 Mart 2020'de Chrome hizmet şartlarını güncelliyoruz. Yeni şartlar Google’ın Hizmet Şartları'nı ve Google Chrome ile Chrome OS'un ek hizmet şartlarını içerecek. Söz konusu tarihe kadar aşağıdaki şartlar geçerli olmaya devam edecek. Daha fazla ayrıntı için <a href="https://policies.google.com/terms/chromechanges">önemli değişikliklerin özeti</a> (https://policies.google.com/terms/chromechanges) sayfasına bakın. </p> <ul> <li>Yeni <a href="https://policies.google.com/terms/update">Şartlar</a> (https://policies.google.com/terms/update) ve <a href="https://www.google.com/chrome/terms">Ek Şartlar</a> (https://www.google.com/chrome/terms)'ın önizlemesine bakın. </li> </ul> <p>Yeni Şartlarımızı kabul etmiyorsanız <a href="https://policies.google.com/terms/chromechanges#faq">Sık Sorulan Sorular</a> (https://policies.google.com/terms/chromechanges#faq) bölümümüzde seçenekleriniz hakkında daha fazla bilgi bulabilirsiniz. </p></div> <h2>Google Chrome Hizmet Şartları</h2> <p>Bu Hizmet Şartları, Google Chrome'un çalıştırılabilir kod sürümü için geçerlidir. Google Chrome kaynak kodu, chrome://credits?hl=tr adresindeki açık kaynaklı yazılım lisansı sözleşmeleri altında ücretsiz olarak kullanılabilir.</p> <p><strong>1. Google ile ilişkiniz</strong></p>
diff --git a/components/resources/terms/terms_uk.html b/components/resources/terms/terms_uk.html index a042d27..234e037 100644 --- a/components/resources/terms/terms_uk.html +++ b/components/resources/terms/terms_uk.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>31 березня 2020 року ми оновлюємо Умови використання Chrome. Нові умови міститимуть Загальні положення та умови Google, а також додаткові Умови використання Google Chrome і ОС Chrome. До того часу діятимуть умови, наведені нижче. Перегляньте короткий <a href="https://policies.google.com/terms/chromechanges">підсумок основних змін</a> (https://policies.google.com/terms/chromechanges). </p> <ul> <li>Ознайомтеся з <a href="https://policies.google.com/terms/update">новими Умовами</a> (https://policies.google.com/terms/update) й <a href="https://www.google.com/chrome/terms">Додатковими умовами використання</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Якщо ви не погоджуєтеся з новими Умовами використання, перегляньте розділ <a href="https://policies.google.com/terms/chromechanges#faq">Поширені запитання</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Загальні положення та умови Google Chrome</h2> <p>Ці Загальні положення та умови застосовуються до версії виконуваного коду Google Chrome. Вихідний код для Google Chrome доступний безкоштовно за адресою chrome://credits відповідно до умов ліцензійних угод про використання програмного забезпечення з відкритим кодом.</p> <p><strong>1. Регулювання відносин із Google</strong></p>
diff --git a/components/resources/terms/terms_vi.html b/components/resources/terms/terms_vi.html index 20d70be..283b1ce 100644 --- a/components/resources/terms/terms_vi.html +++ b/components/resources/terms/terms_vi.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>Chúng tôi sẽ cập nhật điều khoản dịch vụ của Chrome vào ngày 31 tháng 3 năm 2020. Các điều khoản mới sẽ bao gồm cả Điều khoản dịch vụ của Google và các điều khoản dịch vụ bổ sung của Google Chrome và Chrome OS. Trước thời điểm đó, các điều khoản bên dưới sẽ tiếp tục có hiệu lực. Hãy xem <a href="https://policies.google.com/terms/chromechanges">nội dung tóm tắt về các thay đổi chính</a> (https://policies.google.com/terms/chromechanges) để biết thêm thông tin chi tiết. </p> <ul> <li>Xem trước các <a href="https://policies.google.com/terms/update">Điều khoản</a> (https://policies.google.com/terms/update) mới và <a href="https://www.google.com/chrome/terms">Điều khoản bổ sung</a> (https://www.google.com/chrome/terms). </li> </ul> <p>Nếu không đồng ý với các Điều khoản mới của chúng tôi, thì bạn có thể tìm thêm thông tin về các lựa chọn dành cho bạn trong phần <a href="https://policies.google.com/terms/chromechanges#faq">Câu hỏi thường gặp</a> (https://policies.google.com/terms/chromechanges#faq). </p></div> <h2>Ðiều khoản Dịch vụ của Google Chrome</h2> <p>Các Điều khoản Dịch vụ này áp dụng cho phiên bản mã thực thi của Google Chrome. Mã nguồn dành cho Google Chrome có sẵn miễn phí theo thoả thuận cấp phép phần mềm nguồn mở tại chrome://credits.</p> <p><strong>1. Mối quan hệ của bạn với Google</strong></p>
diff --git a/components/resources/terms/terms_zh-CN.html b/components/resources/terms/terms_zh-CN.html index b527cb59..ff3ce0d8 100644 --- a/components/resources/terms/terms_zh-CN.html +++ b/components/resources/terms/terms_zh-CN.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>我们将于 2020 年 3 月 31 日更新 Chrome 服务条款。新版条款将包括 Google 的服务条款以及 Google Chrome 和 Chrome 操作系统附加服务条款。在上述日期之前,以下条款继续有效。若想了解详情,请参阅<a href="https://policies.google.com/terms/chromechanges">主要变更摘要</a> (https://policies.google.com/terms/chromechanges)。 </p> <ul> <li>预览新<a href="https://policies.google.com/terms/update">条款</a> (https://policies.google.com/terms/update)和<a href="https://www.google.com/chrome/terms">附加条款</a> (https://www.google.com/chrome/terms)。 </li> </ul> <p>如果您不接受我们的新条款,请在我们的<a href="https://policies.google.com/terms/chromechanges#faq">常见问题解答</a> (https://policies.google.com/terms/chromechanges#faq)页面上详细了解您的其他选项。 </p></div> <h2>谷歌浏览器服务条款</h2> <p>本服务条款适用于谷歌浏览器的可执行代码版本。根据开放源代码软件许可协议 (chrome://credits),我们免费提供谷歌浏览器的源代码。 </p> <p><strong>1. 您与谷歌的关系</strong></p>
diff --git a/components/resources/terms/terms_zh-TW.html b/components/resources/terms/terms_zh-TW.html index 4c633438..2e81c7e 100644 --- a/components/resources/terms/terms_zh-TW.html +++ b/components/resources/terms/terms_zh-TW.html
@@ -9,10 +9,12 @@ :root { color-scheme: light dark } body { font-family:Arial; font-size:13px; } h2 { font-size:1em; margin-top:0 } +.notice { background-color: #f9edbe; box-shadow: 0 2px 4px rgba(0,0,0,0.4); margin: 20px 4px; outline: 1px solid #d7d7d7; padding: 10px } </style> </head> <body> +<div class="notice"> <p>我們將於 2020 年 3 月 31 日更新 Chrome《服務條款》。新版條款將包含《Google 服務條款》以及 Google Chrome 和 Chrome 作業系統的《附加服務條款》。在更新日之前,下列條款仍然適用。詳情請參閱<a href="https://policies.google.com/terms/chromechanges">主要異動摘要</a> (https://policies.google.com/terms/chromechanges)。 </p> <ul> <li>預覽新版「<a href="https://policies.google.com/terms/update">條款</a> (https://policies.google.com/terms/update)」和「<a href="https://www.google.com/chrome/terms">附加條款</a> (https://www.google.com/chrome/terms)」。 </li> </ul> <p>如果您不同意我們的新版「條款」,請參閱<a href="https://policies.google.com/terms/chromechanges#faq">常見問題</a> (https://policies.google.com/terms/chromechanges#faq),進一步瞭解您的選項。 </p></div> <h2>Google 瀏覽器服務條款</h2> <p>這些《服務條款》適用於「Google 瀏覽器」的可執行程式碼版本。依據位於 chrome://credits 的開放原始碼軟體授權合約,您可以免費取得「Google 瀏覽器」的原始碼。</p> <p><strong>1. 您與 Google 的關係</strong></p>
diff --git a/components/safe_browsing/core/db/v4_database.h b/components/safe_browsing/core/db/v4_database.h index d013fc3..77381771 100644 --- a/components/safe_browsing/core/db/v4_database.h +++ b/components/safe_browsing/core/db/v4_database.h
@@ -20,6 +20,7 @@ #include "components/safe_browsing/core/db/v4_store.h" #include "components/safe_browsing/core/proto/webui.pb.h" +class SafeBrowsingServiceTest; class TestSafeBrowsingDatabaseHelper; namespace safe_browsing { @@ -177,6 +178,7 @@ const std::unique_ptr<StoreMap> store_map_; private: + friend class ::SafeBrowsingServiceTest; friend class ::TestSafeBrowsingDatabaseHelper; friend class V4DatabaseFactory; friend class V4EmbeddedTestServerBrowserTest;
diff --git a/components/safe_browsing/core/features.cc b/components/safe_browsing/core/features.cc index 4f0b5c97..dbbd534 100644 --- a/components/safe_browsing/core/features.cc +++ b/components/safe_browsing/core/features.cc
@@ -87,6 +87,9 @@ "SafeBrowsingRealTimeUrlLookupEnabledWithToken", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kSafeBrowsingAvailableOnIOS{ + "SafeBrowsingAvailableOnIOS", base::FEATURE_DISABLED_BY_DEFAULT}; + const base::Feature kSafeBrowsingSeparateNetworkContexts{ "SafeBrowsingSeparateNetworkContexts", base::FEATURE_DISABLED_BY_DEFAULT}; @@ -138,6 +141,7 @@ {&kPromptAppForDeepScanning, true}, {&kRealTimeUrlLookupEnabled, true}, {&kRealTimeUrlLookupEnabledWithToken, true}, + {&kSafeBrowsingAvailableOnIOS, true}, {&kSafeBrowsingSeparateNetworkContexts, true}, {&kSendOnFocusPing, true}, {&kSendPasswordReusePing, true},
diff --git a/components/safe_browsing/core/features.h b/components/safe_browsing/core/features.h index 07996af..6092439 100644 --- a/components/safe_browsing/core/features.h +++ b/components/safe_browsing/core/features.h
@@ -69,6 +69,11 @@ // Controls whether Chrome prompts Advanced Protection users for deep scanning. extern const base::Feature kPromptAppForDeepScanning; +// Controls whether native (instead of WKWebView-provided) Safe Browsing +// is available on iOS. When this flag is enabled, Safe Browsing is still +// subject to an opt-out controlled by prefs::kSafeBrowsingEnabled. +extern const base::Feature kSafeBrowsingAvailableOnIOS; + // Controls whether Safe Browsing uses separate NetworkContexts for each // profile. extern const base::Feature kSafeBrowsingSeparateNetworkContexts;
diff --git a/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_android.cc b/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_android.cc index 9dc96c4..4e8dff2c 100644 --- a/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_android.cc +++ b/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_android.cc
@@ -398,12 +398,6 @@ !signed_in_account_id.has_value()) { account_tracker_service_->SetMigrationDone(); } - - if (!last_update_accounts_time_.is_null()) { - base::TimeDelta sample = base::Time::Now() - last_update_accounts_time_; - UmaHistogramLongTimes("Signin.AndroidTimeBetweenUpdateAccountList", sample); - } - last_update_accounts_time_ = base::Time::Now(); } bool ProfileOAuth2TokenServiceDelegateAndroid::UpdateAccountList(
diff --git a/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_android.h b/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_android.h index f8755a56..63c267a 100644 --- a/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_android.h +++ b/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_android.h
@@ -14,7 +14,6 @@ #include "base/android/scoped_java_ref.h" #include "base/callback.h" #include "base/macros.h" -#include "base/time/time.h" #include "components/signin/internal/identity_manager/account_tracker_service.h" #include "components/signin/internal/identity_manager/profile_oauth2_token_service.h" #include "components/signin/internal/identity_manager/profile_oauth2_token_service_delegate.h" @@ -143,7 +142,6 @@ AccountTrackerService* account_tracker_service_; RefreshTokenLoadStatus fire_refresh_token_loaded_; - base::Time last_update_accounts_time_; // For testing, disables the creation of the java counterpart, see // set_disable_interaction_with_system_accounts().
diff --git a/components/sync/base/invalidation_helper.cc b/components/sync/base/invalidation_helper.cc index 06ce831..43f9756 100644 --- a/components/sync/base/invalidation_helper.cc +++ b/components/sync/base/invalidation_helper.cc
@@ -6,8 +6,6 @@ #include <string> -#include "google/cacheinvalidation/types.pb.h" - namespace syncer { TopicSet ModelTypeSetToTopicSet(ModelTypeSet model_types) {
diff --git a/components/sync/driver/sync_driver_switches.cc b/components/sync/driver/sync_driver_switches.cc index e157878..b474588f 100644 --- a/components/sync/driver/sync_driver_switches.cc +++ b/components/sync/driver/sync_driver_switches.cc
@@ -51,7 +51,7 @@ // If enabled, the sync engine will be shut down in the "paused" state. const base::Feature kStopSyncInPausedState{"StopSyncInPausedState", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; // Enable USS implementation of Passwords datatype. const base::Feature kSyncUSSPasswords{"SyncUSSPasswords",
diff --git a/components/sync_user_events/user_event_model_type_controller.cc b/components/sync_user_events/user_event_model_type_controller.cc index 4574e7b..07eb2bab 100644 --- a/components/sync_user_events/user_event_model_type_controller.cc +++ b/components/sync_user_events/user_event_model_type_controller.cc
@@ -28,12 +28,28 @@ sync_service_->RemoveObserver(this); } +void UserEventModelTypeController::Stop(syncer::ShutdownReason shutdown_reason, + StopCallback callback) { + DCHECK(CalledOnValidThread()); + switch (shutdown_reason) { + case syncer::STOP_SYNC: + // Special case: For USER_EVENT, we want to clear all data even when Sync + // is stopped temporarily. + shutdown_reason = syncer::DISABLE_SYNC; + break; + case syncer::DISABLE_SYNC: + case syncer::BROWSER_SHUTDOWN: + break; + } + ModelTypeController::Stop(shutdown_reason, std::move(callback)); +} + DataTypeController::PreconditionState UserEventModelTypeController::GetPreconditionState() const { if (sync_service_->GetUserSettings()->IsUsingSecondaryPassphrase()) { return PreconditionState::kMustStopAndClearData; } - // TODO(crbug.com/906995): Remove the syncer::IsWebSignout() check once we + // TODO(crbug.com/938819): Remove the syncer::IsWebSignout() check once we // stop sync in this state. Also remove the "+google_apis/gaia" include // dependency and the "//google_apis" build dependency of sync_user_events. if (syncer::IsWebSignout(sync_service_->GetAuthError())) {
diff --git a/components/sync_user_events/user_event_model_type_controller.h b/components/sync_user_events/user_event_model_type_controller.h index b6c8bcf8..8585dd6 100644 --- a/components/sync_user_events/user_event_model_type_controller.h +++ b/components/sync_user_events/user_event_model_type_controller.h
@@ -25,6 +25,7 @@ ~UserEventModelTypeController() override; // syncer::DataTypeController implementation. + void Stop(ShutdownReason shutdown_reason, StopCallback callback) override; PreconditionState GetPreconditionState() const override; // syncer::SyncServiceObserver implementation.
diff --git a/components/test/data/paint_preview/PaintPreviewTestService/wikipedia/150869817BD7A616833436F122EF294C.skp.sha1 b/components/test/data/paint_preview/PaintPreviewTestService/wikipedia/150869817BD7A616833436F122EF294C.skp.sha1 new file mode 100644 index 0000000..02ed1ac --- /dev/null +++ b/components/test/data/paint_preview/PaintPreviewTestService/wikipedia/150869817BD7A616833436F122EF294C.skp.sha1
@@ -0,0 +1 @@ +6d775035c2beca4fb31139e23bacf9ddf0413d53 \ No newline at end of file
diff --git a/components/test/data/paint_preview/PaintPreviewTestService/wikipedia/proto.pb.sha1 b/components/test/data/paint_preview/PaintPreviewTestService/wikipedia/proto.pb.sha1 new file mode 100644 index 0000000..a1e2781 --- /dev/null +++ b/components/test/data/paint_preview/PaintPreviewTestService/wikipedia/proto.pb.sha1
@@ -0,0 +1 @@ +62bdf642706fbded4194323bb00bc684bd7e0395 \ No newline at end of file
diff --git a/components/url_formatter/url_fixer.cc b/components/url_formatter/url_fixer.cc index 1d8688d7..77a9c3c 100644 --- a/components/url_formatter/url_fixer.cc +++ b/components/url_formatter/url_fixer.cc
@@ -37,7 +37,6 @@ // Hardcode these constants to avoid dependences on //chrome and //content. const char kChromeUIScheme[] = "chrome"; const char kDevToolsScheme[] = "devtools"; -const char kDevToolsFallbackScheme[] = "chrome-devtools"; const char kChromeUIDefaultHost[] = "version"; const char kViewSourceScheme[] = "view-source"; @@ -461,7 +460,7 @@ // Proceed with about, chrome, and devtools schemes, // but not file or nonstandard schemes. if ((scheme != url::kAboutScheme) && (scheme != kChromeUIScheme) && - (scheme != kDevToolsScheme) && (scheme != kDevToolsFallbackScheme) && + (scheme != kDevToolsScheme) && !url::IsStandard(scheme.c_str(), url::Component(0, static_cast<int>(scheme.length())))) { return scheme; @@ -479,14 +478,6 @@ return scheme; } - if (scheme == kDevToolsFallbackScheme) { - // Have the GURL parser do the heavy lifting for us. - url::ParseStandardURL(text->data(), text_length, parts); - // Now replace the fallback scheme alias with the real one - parts->scheme.reset(); - return kDevToolsScheme; - } - if (parts->scheme.is_valid()) { // Have the GURL parser do the heavy lifting for us. url::ParseStandardURL(text->data(), text_length, parts); @@ -585,22 +576,15 @@ return about_url; } - // Parse and rebuild about: and chrome: URLs. + // For some schemes whose layouts we understand, we rebuild the URL. bool chrome_url = (scheme == url::kAboutScheme) || (scheme == kChromeUIScheme); - - // Parse and rebuild devtools: and the fallback chrome-devtools: URLs. - bool devtools_url = - (scheme == kDevToolsScheme) || (scheme == kDevToolsFallbackScheme); - - // For some schemes whose layouts we understand, we rebuild it. + bool devtools_url = (scheme == kDevToolsScheme); if (chrome_url || devtools_url || url::IsStandard(scheme.c_str(), url::Component(0, static_cast<int>(scheme.length())))) { - // Replace the about: scheme with the chrome: scheme, or - // chrome-devtoools: scheme with the devtools: scheme. - std::string url(chrome_url ? kChromeUIScheme - : devtools_url ? kDevToolsScheme : scheme); + // Replace the about: scheme with the chrome: scheme. + std::string url(scheme == url::kAboutScheme ? kChromeUIScheme : scheme); url.append(url::kStandardSchemeSeparator); // We need to check whether the |username| is valid because it is our @@ -716,9 +700,7 @@ const std::string& scheme2) { return scheme1 == scheme2 || (scheme1 == url::kAboutScheme && scheme2 == kChromeUIScheme) || - (scheme1 == kChromeUIScheme && scheme2 == url::kAboutScheme) || - (scheme1 == kDevToolsScheme && scheme2 == kDevToolsFallbackScheme) || - (scheme1 == kDevToolsFallbackScheme && scheme2 == kDevToolsScheme); + (scheme1 == kChromeUIScheme && scheme2 == url::kAboutScheme); } } // namespace url_formatter
diff --git a/components/url_formatter/url_fixer_unittest.cc b/components/url_formatter/url_fixer_unittest.cc index 4eb6b05..9c2acd7 100644 --- a/components/url_formatter/url_fixer_unittest.cc +++ b/components/url_formatter/url_fixer_unittest.cc
@@ -260,18 +260,6 @@ url::Component(43, 17), // query url::Component(), // ref }, - { - "chrome-devtools://bundled/devtools/inspector.html?ws=localhost:9221", - "devtools", - url::Component(), // scheme - url::Component(), // username - url::Component(), // password - url::Component(18, 7), // host - url::Component(), // port - url::Component(25, 24), // path - url::Component(50, 17), // query - url::Component(), // ref - }, }; typedef testing::Test URLFixerTest; @@ -282,6 +270,8 @@ for (size_t i = 0; i < base::size(segment_cases); ++i) { SegmentCase value = segment_cases[i]; + SCOPED_TRACE(testing::Message() << "test #" << i << ": " << value.input); + result = url_formatter::SegmentURL(value.input, &parts); EXPECT_EQ(value.result, result); EXPECT_EQ(value.scheme, parts.scheme); @@ -395,16 +385,9 @@ // Devtools scheme. {"devtools://bundled/devtools/node.html", "devtools://bundled/devtools/node.html"}, - // Devtools fallback scheme. - {"chrome-devtools://bundled/devtools/toolbox.html", - "devtools://bundled/devtools/toolbox.html"}, // Devtools scheme with websocket query. {"devtools://bundled/devtools/inspector.html?ws=ws://localhost:9222/guid", "devtools://bundled/devtools/inspector.html?ws=ws://localhost:9222/guid"}, - // Devtools fallback scheme with websocket query. - {"chrome-devtools://bundled/devtools/inspector.html?ws=ws://localhost:9222/" - "guid", - "devtools://bundled/devtools/inspector.html?ws=ws://localhost:9222/guid"}, // host:123 should be rewritten to http://host:123/, but only if the port // number is valid - in particular telephone numbers are not port numbers // (see also SendTabToSelfUtilTest.ShouldNotOfferFeatureForTelephoneLink).
diff --git a/components/viz/service/display/renderer_perftest.cc b/components/viz/service/display/renderer_perftest.cc index d2357dc..f01dd622 100644 --- a/components/viz/service/display/renderer_perftest.cc +++ b/components/viz/service/display/renderer_perftest.cc
@@ -16,10 +16,13 @@ #include "base/bind.h" #include "base/command_line.h" +#include "base/files/file_util.h" +#include "base/json/json_reader.h" #include "base/metrics/histogram.h" #include "base/metrics/histogram_base.h" #include "base/metrics/histogram_samples.h" #include "base/metrics/statistics_recorder.h" +#include "base/path_service.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" @@ -27,6 +30,7 @@ #include "base/timer/lap_timer.h" #include "components/viz/client/client_resource_provider.h" #include "components/viz/common/display/renderer_settings.h" +#include "components/viz/common/quads/render_pass_io.h" #include "components/viz/common/quads/texture_draw_quad.h" #include "components/viz/common/surfaces/parent_local_surface_id_allocator.h" #include "components/viz/service/display/display.h" @@ -44,6 +48,7 @@ #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" #include "components/viz/service/gl/gpu_service_impl.h" #include "components/viz/test/compositor_frame_helpers.h" +#include "components/viz/test/paths.h" #include "components/viz/test/test_gpu_service_holder.h" #include "gpu/command_buffer/client/shared_image_interface.h" #include "gpu/command_buffer/common/shared_image_usage.h" @@ -169,7 +174,7 @@ } TransferableResource CreateTestTexture( - const gfx::Rect& rect, + const gfx::Size& size, SkColor texel_color, bool premultiplied_alpha, ClientResourceProvider* child_resource_provider, @@ -180,19 +185,19 @@ SkColorGetR(texel_color), SkColorGetG(texel_color), SkColorGetB(texel_color)); - size_t num_pixels = static_cast<size_t>(rect.width()) * rect.height(); + size_t num_pixels = static_cast<size_t>(size.width()) * size.height(); std::vector<uint32_t> pixels(num_pixels, pixel_color); gpu::SharedImageInterface* sii = child_context_provider->SharedImageInterface(); DCHECK(sii); gpu::Mailbox mailbox = sii->CreateSharedImage( - RGBA_8888, rect.size(), gfx::ColorSpace(), - gpu::SHARED_IMAGE_USAGE_DISPLAY, MakePixelSpan(pixels)); - gpu::SyncToken sync_token = sii->GenUnverifiedSyncToken(); + RGBA_8888, size, gfx::ColorSpace(), gpu::SHARED_IMAGE_USAGE_DISPLAY, + MakePixelSpan(pixels)); + gpu::SyncToken sync_token = sii->GenVerifiedSyncToken(); TransferableResource gl_resource = TransferableResource::MakeGL( - mailbox, GL_LINEAR, GL_TEXTURE_2D, sync_token, rect.size(), + mailbox, GL_LINEAR, GL_TEXTURE_2D, sync_token, size, false /* is_overlay_candidate */); gl_resource.format = RGBA_8888; gl_resource.color_space = gfx::ColorSpace(); @@ -240,6 +245,34 @@ nearest_neighbor, force_anti_aliasing_off); } +bool RenderPassListFromJSON(const std::string& tag, + const std::string& site, + uint32_t year, + size_t frame_index, + RenderPassList* render_pass_list) { + base::FilePath json_path; + if (!base::PathService::Get(Paths::DIR_TEST_DATA, &json_path)) + return false; + std::string site_year = site + "_" + base::NumberToString(year); + std::string filename = base::NumberToString(frame_index); + while (filename.length() < 4) + filename = "0" + filename; + filename += ".json"; + json_path = json_path.Append(FILE_PATH_LITERAL("render_pass_data")) + .AppendASCII(tag) + .AppendASCII(site_year) + .AppendASCII(filename); + if (!base::PathExists(json_path)) + return false; + std::string json_text; + if (!base::ReadFileToString(json_path, &json_text)) + return false; + base::Optional<base::Value> dict = base::JSONReader::Read(json_text); + if (!dict.has_value()) + return false; + return RenderPassListFromDict(dict.value(), render_pass_list); +} + } // namespace template <typename RendererType> @@ -358,9 +391,85 @@ ASSERT_TRUE(display_->DrawAndSwap(base::TimeTicks::Now())); } + ResourceId MapResourceId(base::flat_map<ResourceId, ResourceId>* resource_map, + ResourceId recorded_id, + const gfx::Size& texture_size, + SkColor texel_color, + bool premultiplied_alpha) { + DCHECK(resource_map); + ResourceId actual_id; + if (resource_map->find(recorded_id) == resource_map->end()) { + resource_list_.push_back(CreateTestTexture( + texture_size, texel_color, premultiplied_alpha, + child_resource_provider_.get(), child_context_provider_)); + actual_id = resource_list_.back().id; + (*resource_map)[recorded_id] = actual_id; + } else { + actual_id = (*resource_map)[recorded_id]; + } + return actual_id; + } + + void SetUpRenderPassListResources(RenderPassList* render_pass_list) { + base::flat_map<ResourceId, ResourceId> resource_map; + for (auto& render_pass : *render_pass_list) { + for (auto* quad : render_pass->quad_list) { + if (quad->resources.count == 0) + continue; + switch (quad->material) { + case DrawQuad::Material::kTiledContent: { + TileDrawQuad* tile_quad = reinterpret_cast<TileDrawQuad*>(quad); + ResourceId recorded_id = tile_quad->resource_id(); + ResourceId actual_id = this->MapResourceId( + &resource_map, recorded_id, tile_quad->texture_size, + SkColorSetARGB(128, 0, 255, 0), tile_quad->is_premultiplied); + tile_quad->resources.ids[TileDrawQuad::kResourceIdIndex] = + actual_id; + } break; + case DrawQuad::Material::kTextureContent: { + TextureDrawQuad* texture_quad = + reinterpret_cast<TextureDrawQuad*>(quad); + ResourceId recorded_id = texture_quad->resource_id(); + ResourceId actual_id = this->MapResourceId( + &resource_map, recorded_id, texture_quad->rect.size(), + SkColorSetARGB(128, 0, 255, 0), + texture_quad->premultiplied_alpha); + texture_quad->resources.ids[TextureDrawQuad::kResourceIdIndex] = + actual_id; + } break; + case DrawQuad::Material::kYuvVideoContent: { + YUVVideoDrawQuad* yuv_quad = + reinterpret_cast<YUVVideoDrawQuad*>(quad); + const size_t kIndex[] = { + YUVVideoDrawQuad::kYPlaneResourceIdIndex, + YUVVideoDrawQuad::kUPlaneResourceIdIndex, + YUVVideoDrawQuad::kVPlaneResourceIdIndex, + YUVVideoDrawQuad::kAPlaneResourceIdIndex, + }; + const gfx::Size kSize[] = { + yuv_quad->ya_tex_size, + yuv_quad->uv_tex_size, + yuv_quad->uv_tex_size, + yuv_quad->ya_tex_size, + }; + for (size_t ii = 0; ii < yuv_quad->resources.count; ++ii) { + ResourceId recorded_id = yuv_quad->resources.ids[kIndex[ii]]; + ResourceId actual_id = + this->MapResourceId(&resource_map, recorded_id, kSize[ii], + SkColorSetARGB(128, 0, 255, 0), false); + yuv_quad->resources.ids[kIndex[ii]] = actual_id; + } + } break; + default: + ASSERT_TRUE(false); + } + } + } + } + void RunSingleTextureQuad() { resource_list_.push_back(CreateTestTexture( - gfx::Rect(kSurfaceSize), + kSurfaceSize, /*texel_color=*/SkColorSetARGB(128, 0, 255, 0), /*premultiplied_alpha=*/false, child_resource_provider_.get(), child_context_provider_)); @@ -379,8 +488,8 @@ RenderPassList pass_list; pass_list.push_back(std::move(pass)); - DrawFrame(std::move(pass_list)); + DrawFrame(std::move(pass_list)); client_.WaitForSwap(); timer_.NextLap(); } while (!timer_.HasTimeLimitExpired()); @@ -393,7 +502,7 @@ for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { resource_list_.push_back(CreateTestTexture( - gfx::Rect(kTextureSize), + kTextureSize, /*texel_color=*/SkColorSetARGB(128, 0, 255, 0), /*premultiplied_alpha=*/false, child_resource_provider_.get(), child_context_provider_)); @@ -432,7 +541,7 @@ ScaleToCeiledSize(kSurfaceSize, /*x_scale=*/0.2, /*y_scale=*/0.2); ResourceId resource_id; resource_list_.push_back(CreateTestTexture( - gfx::Rect(kTextureSize), + kTextureSize, /*texel_color=*/SkColorSetARGB(128, 0, 255, 0), /*premultiplied_alpha=*/false, child_resource_provider_.get(), child_context_provider_)); @@ -477,7 +586,7 @@ if (share_resources) { // A single tiled resource referenced by each TileDrawQuad resource_list_.push_back(CreateTestTexture( - gfx::Rect(kTextureSize), + kTextureSize, /*texel_color=*/SkColorSetARGB(128, 0, 255, 0), /*premultiplied_alpha=*/false, child_resource_provider_.get(), child_context_provider_)); @@ -485,7 +594,7 @@ // Each TileDrawQuad gets its own resource for (int i = 0; i < tile_count; ++i) { resource_list_.push_back(CreateTestTexture( - gfx::Rect(kTextureSize), + kTextureSize, /*texel_color=*/SkColorSetARGB(128, 0, 255, 0), /*premultiplied_alpha=*/false, child_resource_provider_.get(), child_context_provider_)); @@ -536,6 +645,30 @@ this->RunRotatedTileQuads(/*share_resources=*/false); } + void RunSingleRenderPassListFromJSON(const std::string& tag, + const std::string& site, + uint32_t year, + size_t index) { + RenderPassList render_pass_list; + ASSERT_TRUE( + RenderPassListFromJSON(tag, site, year, index, &render_pass_list)); + ASSERT_FALSE(render_pass_list.empty()); + // Root render pass damage needs to match the output surface size. + auto& last_render_pass = *render_pass_list.back(); + last_render_pass.damage_rect = last_render_pass.output_rect; + + this->SetUpRenderPassListResources(&render_pass_list); + + timer_.Reset(); + do { + RenderPassList local_list; + RenderPass::CopyAll(render_pass_list, &local_list); + DrawFrame(std::move(local_list)); + client_.WaitForSwap(); + timer_.NextLap(); + } while (!timer_.HasTimeLimitExpired()); + } + protected: WaitForSwapDisplayClient client_; ParentLocalSurfaceIdAllocator id_allocator_; @@ -602,4 +735,38 @@ this->RunRotatedTileQuads(); } +#define TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(SITE, FRAME) \ + TYPED_TEST(RendererPerfTest, SITE) { \ + this->RunSingleRenderPassListFromJSON(/*tag=*/"top_real_world_desktop", \ + /*site=*/#SITE, /*year=*/2018, \ + /*frame_index=*/FRAME); \ + } + +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(accu_weather, 298) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(amazon, 30) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(blogspot, 56) +// TODO(zmo): Fix the crash and enable cnn test. +// TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(cnn, 479) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(ebay, 44) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(espn, 463) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(facebook, 327) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(gmail, 66) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(google_calendar, 53) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(google_docs, 369) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(google_image_search, 44) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(google_plus, 45) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(google_web_search, 89) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(linkedin, 284) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(pinterest, 120) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(techcrunch, 190) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(twitch, 396) +// TODO(zmo): Fix the crash and enable twitter test. +// TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(twitter, 352) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(wikipedia, 48) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(wordpress, 75) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(yahoo_answers, 74) +TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST(yahoo_sports, 269) + +#undef TOP_REAL_WORLD_DESKTOP_RENDERER_PERF_TEST + } // namespace viz
diff --git a/components/viz/service/display_embedder/skia_output_device_buffer_queue.cc b/components/viz/service/display_embedder/skia_output_device_buffer_queue.cc index a0b15570..6649301 100644 --- a/components/viz/service/display_embedder/skia_output_device_buffer_queue.cc +++ b/components/viz/service/display_embedder/skia_output_device_buffer_queue.cc
@@ -374,8 +374,11 @@ available_images_.push_back(displayed_image_); // Call BeginWriteSkia() for the next frame here to avoid some expensive // operations on the critical code path. + auto shared_context_state = dependency_->GetSharedContextState(); if (!available_images_.front()->sk_surface() && - dependency_->GetSharedContextState()->MakeCurrent(nullptr)) { + shared_context_state->MakeCurrent(nullptr)) { + // BeginWriteSkia() may alter GL's state. + shared_context_state->set_need_context_state_reset(true); available_images_.front()->BeginWriteSkia(); } }
diff --git a/components/viz/service/display_embedder/skia_output_device_vulkan.cc b/components/viz/service/display_embedder/skia_output_device_vulkan.cc index c087940..3e849e80 100644 --- a/components/viz/service/display_embedder/skia_output_device_vulkan.cc +++ b/components/viz/service/display_embedder/skia_output_device_vulkan.cc
@@ -121,13 +121,11 @@ image_modified_ = false; #endif - // TODO(penghuang): pass rect to vulkan swap chain and let swap chain use - // VK_KHR_incremental_present StartSwapBuffers(std::move(feedback)); auto image_size = vulkan_surface_->image_size(); gfx::SwapResult result = gfx::SwapResult::SWAP_ACK; if (!rect.IsEmpty()) - result = vulkan_surface_->SwapBuffers(); + result = vulkan_surface_->PostSubBuffer(rect); FinishSwapBuffers(result, image_size, std::move(latency_info)); }
diff --git a/content/browser/frame_host/frame_navigation_entry.cc b/content/browser/frame_host/frame_navigation_entry.cc index d68ed694..d2f9113 100644 --- a/content/browser/frame_host/frame_navigation_entry.cc +++ b/content/browser/frame_host/frame_navigation_entry.cc
@@ -8,6 +8,7 @@ #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" +#include "content/browser/web_package/web_bundle_navigation_info.h" #include "content/common/page_state_serialization.h" namespace content { @@ -146,4 +147,14 @@ return exploded_state.top.http_body.request_body; } +void FrameNavigationEntry::set_web_bundle_navigation_info( + std::unique_ptr<WebBundleNavigationInfo> web_bundle_navigation_info) { + web_bundle_navigation_info_ = std::move(web_bundle_navigation_info); +} + +WebBundleNavigationInfo* FrameNavigationEntry::web_bundle_navigation_info() + const { + return web_bundle_navigation_info_.get(); +} + } // namespace content
diff --git a/content/browser/frame_host/frame_navigation_entry.h b/content/browser/frame_host/frame_navigation_entry.h index 9951738..f96f1db 100644 --- a/content/browser/frame_host/frame_navigation_entry.h +++ b/content/browser/frame_host/frame_navigation_entry.h
@@ -20,6 +20,8 @@ namespace content { +class WebBundleNavigationInfo; + // Represents a session history item for a particular frame. It is matched with // corresponding FrameTreeNodes using unique name (or by the root position). // @@ -189,6 +191,10 @@ blob_url_loader_factory_ = std::move(factory); } + void set_web_bundle_navigation_info( + std::unique_ptr<WebBundleNavigationInfo> web_bundle_navigation_info); + WebBundleNavigationInfo* web_bundle_navigation_info() const; + private: friend class base::RefCounted<FrameNavigationEntry>; virtual ~FrameNavigationEntry(); @@ -226,6 +232,13 @@ int64_t post_id_; scoped_refptr<network::SharedURLLoaderFactory> blob_url_loader_factory_; + // Keeps the Web Bundles related information when |this| is for a navigation + // within a Web Bundle file. Used when WebBundles feature or + // WebBundlesFromNetwork feature is enabled or TrustableWebBundleFileUrl + // switch is set. + // TODO(995177): Support Session/Tab restore. + std::unique_ptr<WebBundleNavigationInfo> web_bundle_navigation_info_; + DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry); };
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc index 3fdf089abe..f950552a 100644 --- a/content/browser/frame_host/navigation_controller_impl.cc +++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -1481,11 +1481,6 @@ new_entry->SetOriginalRequestURL(params.original_request_url); new_entry->SetIsOverridingUserAgent(params.is_overriding_user_agent); - if (request->web_bundle_navigation_info()) { - new_entry->set_web_bundle_navigation_info( - request->web_bundle_navigation_info()->Clone()); - } - // Update the FrameNavigationEntry for new main frame commits. FrameNavigationEntry* frame_entry = new_entry->GetFrameEntry(rfh->frame_tree_node()); @@ -1498,6 +1493,10 @@ frame_entry->set_post_id(params.post_id); if (!params.url_is_unreachable) frame_entry->set_committed_origin(params.origin); + if (request->web_bundle_navigation_info()) { + frame_entry->set_web_bundle_navigation_info( + request->web_bundle_navigation_info()->Clone()); + } // history.pushState() is classified as a navigation to a new page, but sets // is_same_document to true. In this case, we already have the title and
diff --git a/content/browser/frame_host/navigation_entry_impl.cc b/content/browser/frame_host/navigation_entry_impl.cc index 6ad9257..647ee38 100644 --- a/content/browser/frame_host/navigation_entry_impl.cc +++ b/content/browser/frame_host/navigation_entry_impl.cc
@@ -20,7 +20,6 @@ #include "build/build_config.h" #include "components/url_formatter/url_formatter.h" #include "content/browser/frame_host/navigation_controller_impl.h" -#include "content/browser/web_package/web_bundle_navigation_info.h" #include "content/common/content_constants_internal.h" #include "content/common/navigation_params.h" #include "content/common/page_state_serialization.h" @@ -724,8 +723,6 @@ copy->CloneDataFrom(*this); copy->replaced_entry_data_ = replaced_entry_data_; copy->should_skip_on_back_forward_ui_ = should_skip_on_back_forward_ui_; - if (web_bundle_navigation_info_) - copy->web_bundle_navigation_info_ = web_bundle_navigation_info_->Clone(); return copy; } @@ -994,14 +991,4 @@ return GetBaseURLForDataURL().is_empty() ? GURL() : GetVirtualURL(); } -void NavigationEntryImpl::set_web_bundle_navigation_info( - std::unique_ptr<WebBundleNavigationInfo> web_bundle_navigation_info) { - web_bundle_navigation_info_ = std::move(web_bundle_navigation_info); -} - -WebBundleNavigationInfo* NavigationEntryImpl::web_bundle_navigation_info() - const { - return web_bundle_navigation_info_.get(); -} - } // namespace content
diff --git a/content/browser/frame_host/navigation_entry_impl.h b/content/browser/frame_host/navigation_entry_impl.h index c6a3965..101011ba 100644 --- a/content/browser/frame_host/navigation_entry_impl.h +++ b/content/browser/frame_host/navigation_entry_impl.h
@@ -35,8 +35,6 @@ namespace content { -class WebBundleNavigationInfo; - class CONTENT_EXPORT NavigationEntryImpl : public NavigationEntry { public: // Represents a tree of FrameNavigationEntries that make up this joint session @@ -404,10 +402,6 @@ back_forward_cache_metrics_ = metrics; } - void set_web_bundle_navigation_info( - std::unique_ptr<WebBundleNavigationInfo> web_bundle_navigation_info); - WebBundleNavigationInfo* web_bundle_navigation_info() const; - private: // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING // Session/Tab restore save portions of this class so that it can be recreated @@ -542,14 +536,6 @@ // It is preserved at commit but not persisted. scoped_refptr<BackForwardCacheMetrics> back_forward_cache_metrics_; - // Keeps the Web Bundles related information when |this| is for a navigation - // within a Web Bundle file. Used when WebBundles feature is enabled or - // TrustableWebBundleFileUrl switch is set. - // TODO(995177): Support Session/Tab restore. - // TODO(995177): Consider if this should be here or in FrameNavigationEntry - // for a correct iframe support. - std::unique_ptr<WebBundleNavigationInfo> web_bundle_navigation_info_; - DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); };
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc index bd35bd8a..cae391a 100644 --- a/content/browser/frame_host/navigation_request.cc +++ b/content/browser/frame_host/navigation_request.cc
@@ -948,6 +948,10 @@ frame_entry_item_sequence_number_ = frame_entry->item_sequence_number(); frame_entry_document_sequence_number_ = frame_entry->document_sequence_number(); + if (frame_entry->web_bundle_navigation_info()) { + web_bundle_navigation_info_ = + frame_entry->web_bundle_navigation_info()->Clone(); + } } // Sanitize the referrer. @@ -1031,10 +1035,6 @@ entry->back_forward_cache_metrics() ->MainFrameDidStartNavigationToDocument(); } - if (entry->web_bundle_navigation_info()) { - web_bundle_navigation_info_ = - entry->web_bundle_navigation_info()->Clone(); - } // If this NavigationRequest is for the current pending entry, make sure // that we will discard the pending entry if all of associated its requests
diff --git a/content/browser/frame_host/render_document_host_browsertest.cc b/content/browser/frame_host/render_document_host_browsertest.cc index 41312acb..26c73d8a 100644 --- a/content/browser/frame_host/render_document_host_browsertest.cc +++ b/content/browser/frame_host/render_document_host_browsertest.cc
@@ -23,9 +23,7 @@ class RenderDocumentHostBrowserTest : public ContentBrowserTest { protected: void SetUpCommandLine(base::CommandLine* command_line) override { - feature_list_.InitWithFeatures({features::kRenderDocumentForMainFrame, - features::kRenderDocumentForSubframe}, - {}); + feature_list_.InitWithFeatures({features::kRenderDocument}, {}); } void SetUpOnMainThread() override { @@ -73,8 +71,7 @@ // A new RenderFrameHost must be used after a same process subframe navigation. // This test two cases, when the RenderFrame is not a local root and when it is. -// TODO(arthursonzogni): Implement RenderDocument and enable this test. -IN_PROC_BROWSER_TEST_F(RenderDocumentHostBrowserTest, DISABLED_BasicSubframe) { +IN_PROC_BROWSER_TEST_F(RenderDocumentHostBrowserTest, BasicSubframe) { GURL url(embedded_test_server()->GetURL("a.com", "/page_with_iframe.html")); GURL url_subframe_2(embedded_test_server()->GetURL("a.com", "/title2.html")); GURL url_subframe_3(embedded_test_server()->GetURL("b.com", "/title1.html")); @@ -152,9 +149,8 @@ // Two frames are scriptable with each other. Test it works appropriately after // one of them doing a same-origin navigation. -// TODO(arthursonzogni): Implement RenderDocument and enable this test. IN_PROC_BROWSER_TEST_F(RenderDocumentHostBrowserTest, - DISABLED_SubframeScriptableNavigate) { + SubframeScriptableNavigate) { GURL url_1(embedded_test_server()->GetURL("/page_with_iframe.html")); GURL url_2(embedded_test_server()->GetURL("/title2.html")); GURL url_3(embedded_test_server()->GetURL("/title3.html"));
diff --git a/content/browser/frame_host/render_frame_host_delegate.h b/content/browser/frame_host/render_frame_host_delegate.h index 3cb6ccbc..5b1e90b18 100644 --- a/content/browser/frame_host/render_frame_host_delegate.h +++ b/content/browser/frame_host/render_frame_host_delegate.h
@@ -135,6 +135,10 @@ const GURL& initiator_url, blink::mojom::NavigationBlockedReason reason) {} + // Notifies the browser that a frame finished loading. + virtual void OnDidFinishLoad(RenderFrameHost* render_frame_host, + const GURL& url) {} + // Gets the last committed URL. See WebContents::GetLastCommittedURL for a // description of the semantics. virtual const GURL& GetMainFrameLastCommittedURL();
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 577ab74..fe86265 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -2128,7 +2128,11 @@ GetProcess()->GetID(), previous_routing_id); // We have also created a RenderFrameProxy in CreateFrame above, so // remember that. - proxy->SetRenderFrameProxyCreated(true); + // + // RenderDocument: |proxy| can be null, when |previous_routing_id| refers to + // a RenderFrameHost instead of a RenderFrameProxy. + if (proxy) + proxy->SetRenderFrameProxyCreated(true); } // The renderer now has a RenderFrame for this RenderFrameHost. Note that @@ -2841,32 +2845,31 @@ RenderViewHostImpl::kUnloadTimeoutMS)); } - // There should always be a proxy to replace the old RenderFrameHost. If - // there are no remaining active views in the process, the proxy will be - // short-lived and will be deleted when the unload ACK is received. - CHECK(proxy); - // TODO(nasko): If the frame is not live, the RFH should just be deleted by // simulating the receipt of unload ack. is_waiting_for_unload_ack_ = true; - unload_state_ = UnloadState::InProgress; - if (IsRenderFrameLive()) { - FrameReplicationState replication_state = - proxy->frame_tree_node()->current_replication_state(); - Send(new UnfreezableFrameMsg_Unload(routing_id_, proxy->GetRoutingID(), - is_loading, replication_state)); - // Remember that a RenderFrameProxy was created as part of processing the - // Unload message above. - proxy->SetRenderFrameProxyCreated(true); + if (proxy) { + unload_state_ = UnloadState::InProgress; + if (IsRenderFrameLive()) { + Send(new UnfreezableFrameMsg_Unload( + routing_id_, proxy->GetRoutingID(), is_loading, + proxy->frame_tree_node()->current_replication_state())); + // Remember that a RenderFrameProxy was created as part of processing the + // Unload message above. + proxy->SetRenderFrameProxyCreated(true); + } + } else { + // RenderDocument: After a local<->local swap, this function is called with + // a null |proxy|. + CHECK(IsRenderDocumentEnabled()); - StartPendingDeletionOnSubtree(); + // The unload handlers already ran for this document during the + // local<->local swap. Hence, there is no need to send + // UnfreezableFrameMsg_Unload here. It can be marked at completed. + unload_state_ = UnloadState::Completed; } - // Some children with no unload handler may be eligible for deletion. Cut the - // dead branches now. This is a performance optimization. - PendingDeletionCheckCompletedOnSubtree(); - if (web_ui()) web_ui()->RenderFrameHostUnloading(); @@ -2874,6 +2877,12 @@ #if !defined(OS_ANDROID) serial_service_.reset(); #endif + + StartPendingDeletionOnSubtree(); + // Some children with no unload handler may be eligible for deletion. Cut the + // dead branches now. This is a performance optimization. + PendingDeletionCheckCompletedOnSubtree(); + // |this| is potentially deleted. Do not add code after this. } void RenderFrameHostImpl::DetachFromProxy() { @@ -3826,6 +3835,10 @@ frame_tree_node_->DidChangeLoadProgress(load_progress); } +void RenderFrameHostImpl::DidFinishLoad(const GURL& validated_url) { + delegate_->OnDidFinishLoad(this, validated_url); +} + void RenderFrameHostImpl::DispatchLoad() { TRACE_EVENT1("navigation", "RenderFrameHostImpl::DispatchLoad", "frame_tree_node", frame_tree_node_->frame_tree_node_id());
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h index 1280119..969a3f5 100644 --- a/content/browser/frame_host/render_frame_host_impl.h +++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -618,6 +618,15 @@ // RenderFrameProxy to replace the RenderFrame and set it to |is_loading| // state. The renderer process keeps the RenderFrameProxy object around as a // placeholder while the frame is rendered in a different process. + // + // There should always be a |proxy| to replace the old RenderFrameHost. If + // there are no remaining active views in the process, the proxy will be + // short-lived and will be deleted when the unload ACK is received. + // + // RenderDocument: After a local<->local swap, this function is called with a + // null |proxy|. It executes common cleanup and marks this RenderFrameHost to + // have completed its unload handler. The RenderFrameHost may be immediately + // deleted or deferred depending on its children's unload status. void Unload(RenderFrameProxyHost* proxy, bool is_loading); // Remove this frame and its children. This happens asynchronously, an IPC @@ -1384,6 +1393,7 @@ const GURL& initiator_url, blink::mojom::NavigationBlockedReason reason) override; void DidChangeLoadProgress(double load_progress) override; + void DidFinishLoad(const GURL& validated_url) override; void DispatchLoad() override; void GoToEntryAtOffset(int32_t offset, bool has_user_gesture) override; void RenderFallbackContentInParentProcess() override;
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc index 6ab309ab..1f188a5 100644 --- a/content/browser/frame_host/render_frame_host_manager.cc +++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -642,25 +642,36 @@ old_page_back_forward_cache_metrics->MarkNotRestoredWithReason(can_store); } - // Create a replacement proxy for the old RenderFrameHost. (There should not - // be one yet.) This is done even if there are no active frames besides this - // one to simplify cleanup logic on the renderer side (see - // https://crbug.com/568836 for motivation). - RenderFrameProxyHost* proxy = - CreateRenderFrameProxyHost(old_render_frame_host->GetSiteInstance(), - old_render_frame_host->render_view_host()); - - // Tell the old RenderFrameHost to unload and be replaced by the proxy. - old_render_frame_host->Unload(proxy, true); + // Create a replacement proxy for the old RenderFrameHost when we're switching + // SiteInstance. There should not be one yet. This is done even if there are + // no active frames besides this one to simplify cleanup logic on the renderer + // side. See https://crbug.com/568836 for motivation. + RenderFrameProxyHost* proxy = nullptr; + if (render_frame_host_->GetSiteInstance() != + old_render_frame_host->GetSiteInstance()) { + proxy = + CreateRenderFrameProxyHost(old_render_frame_host->GetSiteInstance(), + old_render_frame_host->render_view_host()); + } // |old_render_frame_host| will be deleted when its unload ACK is received, // or when the timer times out, or when the RFHM itself is deleted (whichever // comes first). pending_delete_hosts_.push_back(std::move(old_render_frame_host)); + + // Tell the old RenderFrameHost to swap out and be replaced by the proxy. + pending_delete_hosts_.back()->Unload(proxy, true); } void RenderFrameHostManager::DiscardUnusedFrame( std::unique_ptr<RenderFrameHostImpl> render_frame_host) { + // RenderDocument: In the case of a local<->local RenderFrameHost Swap, just + // discard the RenderFrameHost. There are no other proxies associated. + if (render_frame_host->GetSiteInstance() == + render_frame_host_->GetSiteInstance()) { + return; // |render_frame_host| is released here. + } + // TODO(carlosk): this code is very similar to what can be found in // UnloadOldFrame and we should see that these are unified at some point. @@ -803,6 +814,14 @@ if (render_frame_host_->must_be_replaced()) use_current_rfh = false; + // Force using a different RenderFrameHost when RenderDocument is enabled. + // TODO(arthursonzogni, fergal): Add support for the main frame. + if (IsRenderDocumentEnabled() && !frame_tree_node_->IsMainFrame() && + !request->IsSameDocument() && + render_frame_host_->has_committed_any_navigation()) { + use_current_rfh = false; + } + bool notify_webui_of_rf_creation = false; if (use_current_rfh) { // GetFrameHostForNavigation will be called more than once during a @@ -2065,12 +2084,17 @@ SiteInstance* new_instance) { CHECK(new_instance); // This DCHECK is going to be fully removed as part of RenderDocument [1]. - // Right now, the only case where a speculative RFH is created for a same-site - // navigation is when the old RenderFramehost has crashed. + // + // With RenderDocument: every cross-document navigation creates a new + // RenderFrameHost. The navigation is potentially same-SiteInstance. + // + // With RenderDocumentForCrashedFrame: navigations from a crashed + // RenderFrameHost creates a new RenderFrameHost. The navigation is + // potentially same-SiteInstance. // // [1] http://crbug.com/936696 DCHECK(old_instance != new_instance || - render_frame_host_->must_be_replaced()); + render_frame_host_->must_be_replaced() || IsRenderDocumentEnabled()); // The process for the new SiteInstance may (if we're sharing a process with // another host that already initialized it) or may not (we have our own @@ -2100,12 +2124,17 @@ SiteInstance* instance) { CHECK(instance); // This DCHECK is going to be fully removed as part of RenderDocument [1]. - // Right now, the only case where a speculative RFH is created for a same-site - // navigation is when the old RenderFramehost has crashed. + // + // With RenderDocument: every cross-document navigation creates a new + // RenderFrameHost. The navigation is potentially same-SiteInstance. + // + // With RenderDocumentForCrashedFrame: navigations from a crashed + // RenderFrameHost creates a new RenderFrameHost. The navigation is + // potentially same-SiteInstance. // // [1] http://crbug.com/936696 DCHECK(render_frame_host_->GetSiteInstance() != instance || - render_frame_host_->must_be_replaced()); + render_frame_host_->must_be_replaced() || IsRenderDocumentEnabled()); // A RenderFrame in a different process from its parent RenderFrame // requires a RenderWidget for input/layout/painting. @@ -2436,9 +2465,9 @@ // SiteInstance as its RenderFrameHost. This is only the case until the // RenderFrameHost commits, at which point it will replace and delete the // RenderFrameProxyHost. - // TODO(arthursonzogni): Implement same-process RenderFrame swap. In this case - // |previous_routing_id| can represent not only a RenderFrameProxyHost, but - // can also represent a RenderFrameHost. + // + // RenderDocument: During a same-process RenderFrame swap, the + // |previous_routing_id| doesn't represent a proxy, but a frame. int previous_routing_id = MSG_ROUTING_NONE; RenderFrameProxyHost* existing_proxy = GetRenderFrameProxyHost(site_instance); if (existing_proxy) { @@ -2446,6 +2475,8 @@ CHECK_NE(previous_routing_id, MSG_ROUTING_NONE); if (!existing_proxy->is_render_frame_proxy_live()) existing_proxy->InitRenderFrameProxy(); + } else if (IsRenderDocumentEnabled()) { + previous_routing_id = current_frame_host()->GetRoutingID(); } return delegate_->CreateRenderFrameForRenderManager(
diff --git a/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc b/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc index 8280339..629355c69 100644 --- a/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc +++ b/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc
@@ -91,7 +91,9 @@ void RenderWidgetHostLatencyTracker::ComputeInputLatencyHistograms( WebInputEvent::Type type, const LatencyInfo& latency, - InputEventAckState ack_result) { + InputEventAckState ack_result, + base::TimeTicks ack_timestamp) { + DCHECK(!ack_timestamp.is_null()); // If this event was coalesced into another event, ignore it, as the event it // was coalesced into will reflect the full latency. if (latency.coalesced()) @@ -144,14 +146,10 @@ } } - base::TimeTicks rwh_ack_timestamp; - if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, - &rwh_ack_timestamp)) { - if (!multi_finger_touch_gesture && !main_thread_timestamp.is_null()) { - UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS( - "Event.Latency.BlockingTime." + event_name + default_action_status, - main_thread_timestamp, rwh_ack_timestamp); - } + if (!multi_finger_touch_gesture && !main_thread_timestamp.is_null()) { + UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS( + "Event.Latency.BlockingTime." + event_name + default_action_status, + main_thread_timestamp, ack_timestamp); } } @@ -252,7 +250,6 @@ } } - latency->AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT); // If this event couldn't have caused a gesture event, and it didn't trigger // rendering, we're done processing it. If the event got coalesced then // terminate it as well. We also exclude cases where we're against the scroll @@ -263,7 +260,8 @@ latency->Terminate(); } - ComputeInputLatencyHistograms(event.GetType(), *latency, ack_result); + ComputeInputLatencyHistograms(event.GetType(), *latency, ack_result, + base::TimeTicks::Now()); } void RenderWidgetHostLatencyTracker::OnEventStart(ui::LatencyInfo* latency) {
diff --git a/content/browser/renderer_host/input/render_widget_host_latency_tracker.h b/content/browser/renderer_host/input/render_widget_host_latency_tracker.h index f011b6b..663673b 100644 --- a/content/browser/renderer_host/input/render_widget_host_latency_tracker.h +++ b/content/browser/renderer_host/input/render_widget_host_latency_tracker.h
@@ -29,7 +29,8 @@ void ComputeInputLatencyHistograms(blink::WebInputEvent::Type type, const ui::LatencyInfo& latency, - InputEventAckState ack_result); + InputEventAckState ack_result, + base::TimeTicks ack_timestamp); // Populates the LatencyInfo with relevant entries for latency tracking. // Called when an event is received by the RenderWidgetHost, prior to
diff --git a/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc b/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc index dd571e2..2b71cdeb 100644 --- a/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc +++ b/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc
@@ -972,18 +972,15 @@ base::TimeTicks() + base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[1])); - fake_latency.AddLatencyNumberWithTimestamp( - ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, + auto ack_timestamp = base::TimeTicks() + - base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[2])); + base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[2]); // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck // overwriting components. tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency, - blocking); - - tracker()->OnInputEventAck(event, &latency, - blocking); + blocking, ack_timestamp); + tracker()->OnInputEventAck(event, &latency, blocking); } { @@ -1013,15 +1010,14 @@ base::TimeTicks() + base::TimeDelta::FromMilliseconds(touchmove_timestamps_ms[1])); - fake_latency.AddLatencyNumberWithTimestamp( - ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, + auto ack_timestamp = base::TimeTicks() + - base::TimeDelta::FromMilliseconds(touchmove_timestamps_ms[2])); + base::TimeDelta::FromMilliseconds(touchmove_timestamps_ms[2]); // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck // overwriting components. tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency, - blocking); + blocking, ack_timestamp); } { @@ -1051,15 +1047,14 @@ base::TimeTicks() + base::TimeDelta::FromMilliseconds(touchend_timestamps_ms[1])); - fake_latency.AddLatencyNumberWithTimestamp( - ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, + auto ack_timestamp = base::TimeTicks() + - base::TimeDelta::FromMilliseconds(touchend_timestamps_ms[2])); + base::TimeDelta::FromMilliseconds(touchend_timestamps_ms[2]); // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck // overwriting components. tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency, - blocking); + blocking, ack_timestamp); } } @@ -1149,15 +1144,14 @@ base::TimeTicks() + base::TimeDelta::FromMilliseconds(event_timestamps_ms[1])); - fake_latency.AddLatencyNumberWithTimestamp( - ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, + auto ack_timestamp = base::TimeTicks() + - base::TimeDelta::FromMilliseconds(event_timestamps_ms[2])); + base::TimeDelta::FromMilliseconds(event_timestamps_ms[2]); // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck // overwriting components. tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency, - blocking); + blocking, ack_timestamp); tracker()->OnInputEventAck(event, &latency_info, blocking); } @@ -1252,15 +1246,13 @@ base::TimeTicks() + base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[1])); - fake_latency.AddLatencyNumberWithTimestamp( - ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, - base::TimeTicks() + - base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[2])); + auto ack_timestamp = base::TimeTicks() + base::TimeDelta::FromMilliseconds( + touchstart_timestamps_ms[2]); // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck // overwriting components. - tracker()->ComputeInputLatencyHistograms(event.GetType(), - fake_latency, ack_state); + tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency, + ack_state, ack_timestamp); tracker()->OnInputEventAck(event, &latency, ack_state); }
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc index a0e2078e..572549f 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -735,6 +735,12 @@ delegate_->Close(this); } +void RenderViewHostImpl::ZoomToFindInPageRect(const gfx::Rect& rect_to_zoom) { + static_cast<RenderFrameHostImpl*>(GetMainFrame()) + ->GetAssociatedLocalMainFrame() + ->ZoomToFindInPageRect(rect_to_zoom); +} + void RenderViewHostImpl::RenderProcessExited( RenderProcessHost* host, const ChildProcessTerminationInfo& info) {
diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h index 17715e62..071d6cf 100644 --- a/content/browser/renderer_host/render_view_host_impl.h +++ b/content/browser/renderer_host/render_view_host_impl.h
@@ -180,6 +180,9 @@ // and the user has agreed to continue with closing the page. void ClosePageIgnoringUnloadEvents(); + // Requests a page-scale animation based on the specified rect. + void ZoomToFindInPageRect(const gfx::Rect& rect_to_zoom); + // Tells the renderer view to focus the first (last if reverse is true) node. void SetInitialFocus(bool reverse);
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 0358c81..3322e5e 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -3142,8 +3142,7 @@ } auto* root_rvhi = RenderViewHostImpl::From(root_view->GetRenderWidgetHost()); - root_rvhi->Send(new ViewMsg_ZoomToFindInPageRect(root_rvhi->GetRoutingID(), - transformed_rect_to_zoom)); + root_rvhi->ZoomToFindInPageRect(transformed_rect_to_zoom); } gfx::Size RenderWidgetHostImpl::GetRootWidgetViewportSize() {
diff --git a/content/browser/site_per_process_unload_browsertest.cc b/content/browser/site_per_process_unload_browsertest.cc index 68f48bc..c0c35df 100644 --- a/content/browser/site_per_process_unload_browsertest.cc +++ b/content/browser/site_per_process_unload_browsertest.cc
@@ -30,6 +30,7 @@ #include "content/browser/frame_host/render_frame_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_child_frame.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/common/content_navigation_policy.h" #include "content/common/frame_messages.h" #include "content/public/browser/back_forward_cache.h" #include "content/public/browser/navigation_handle.h" @@ -51,12 +52,12 @@ namespace { -void UnloadPrint(FrameTreeNode* node, const char* message) { +void UnloadPrint(const ToRenderFrameHost& target, const char* message) { EXPECT_TRUE( - ExecJs(node, JsReplace("window.onunload = function() { " - " window.domAutomationController.send($1);" - "}", - message))); + ExecJs(target, JsReplace("window.onunload = function() { " + " window.domAutomationController.send($1);" + "}", + message))); } } // namespace @@ -1299,6 +1300,53 @@ delete_B1.WaitUntilDeleted(); } +// After a same-origin iframe navigation, check that gradchild iframe are +// properly deleted and their unload handler executed. +IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, + NestedSubframeWithUnloadHandler) { + GURL main_url = embedded_test_server()->GetURL( + "a.com", "/cross_site_iframe_factory.html?a(b(b,c))"); + GURL iframe_new_url = embedded_test_server()->GetURL("b.com", "/title1.html"); + EXPECT_TRUE(NavigateToURL(shell(), main_url)); + + // In the document tree: A1(B2(B3,C4)) navigate B2 to B5. + RenderFrameHostImpl* A1 = web_contents()->GetMainFrame(); + RenderFrameHostImpl* B2 = A1->child_at(0)->current_frame_host(); + RenderFrameHostImpl* B3 = B2->child_at(0)->current_frame_host(); + RenderFrameHostImpl* C4 = B2->child_at(1)->current_frame_host(); + + RenderFrameDeletedObserver delete_B2(B2); + RenderFrameDeletedObserver delete_B3(B3); + RenderFrameDeletedObserver delete_C4(C4); + + UnloadPrint(B2, "B2"); + UnloadPrint(B3, "B3"); + UnloadPrint(C4, "C4"); + + // Navigate the iframe same-process. + ExecuteScriptAsync(B2, JsReplace("location.href = $1", iframe_new_url)); + + DOMMessageQueue dom_message_queue( + WebContents::FromRenderFrameHost(web_contents()->GetMainFrame())); + + // All the documents must be properly deleted: + if (IsRenderDocumentEnabled()) + delete_B2.WaitUntilDeleted(); + delete_B3.WaitUntilDeleted(); + delete_C4.WaitUntilDeleted(); + + // The unload handlers must have run: + std::string message; + std::vector<std::string> messages; + for (int i = 0; i < 3; ++i) { + EXPECT_TRUE(dom_message_queue.WaitForMessage(&message)); + base::TrimString(message, "\"", &message); + messages.push_back(message); + } + EXPECT_FALSE(dom_message_queue.PopMessage(&message)); + EXPECT_THAT(messages, WhenSorted(ElementsAre("B2", "B3", "C4"))); +} + // Some tests need an https server because third-party cookies are used, and // SameSite=None cookies must be Secure. This is a separate fixture due to // kIgnoreCertificateErrors flag.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 84587a7..ef4f7e9 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -903,7 +903,6 @@ IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(WebContentsImpl, message, render_frame_host) IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse, OnDomOperationResponse) - IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishLoad, OnDidFinishLoad) IPC_MESSAGE_HANDLER(FrameHostMsg_DidLoadResourceFromMemoryCache, OnDidLoadResourceFromMemoryCache) IPC_MESSAGE_HANDLER(FrameHostMsg_DidRunInsecureContent, @@ -4959,19 +4958,19 @@ observer.DOMContentLoaded(render_frame_host); } -void WebContentsImpl::OnDidFinishLoad(RenderFrameHostImpl* source, +void WebContentsImpl::OnDidFinishLoad(RenderFrameHost* render_frame_host, const GURL& url) { GURL validated_url(url); - source->GetProcess()->FilterURL(false, &validated_url); + render_frame_host->GetProcess()->FilterURL(false, &validated_url); for (auto& observer : observers_) - observer.DidFinishLoad(source, validated_url); + observer.DidFinishLoad(render_frame_host, validated_url); size_t tree_size = frame_tree_.root()->GetFrameTreeSize(); if (max_loaded_frame_count_ < tree_size) max_loaded_frame_count_ = tree_size; - if (!source->GetParent()) + if (!render_frame_host->GetParent()) UMA_HISTOGRAM_COUNTS_1000("Navigation.MainFrame.FrameCount", tree_size); }
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index a2622d4..a1576606 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -547,6 +547,8 @@ const GURL& blocked_url, const GURL& initiator_url, blink::mojom::NavigationBlockedReason reason) override; + void OnDidFinishLoad(RenderFrameHost* render_frame_host, + const GURL& url) override; const GURL& GetMainFrameLastCommittedURL() override; void RenderFrameCreated(RenderFrameHost* render_frame_host) override; void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; @@ -1379,7 +1381,6 @@ const GURL& target_url); void OnDidDisplayContentWithCertificateErrors(RenderFrameHostImpl* source); void OnDidRunContentWithCertificateErrors(RenderFrameHostImpl* source); - void OnDidFinishLoad(RenderFrameHostImpl* source, const GURL& url); void OnUpdateZoomLimits(RenderViewHostImpl* source, int minimum_percent, int maximum_percent);
diff --git a/content/browser/web_package/web_bundle_browsertest.cc b/content/browser/web_package/web_bundle_browsertest.cc index 744d3163..4fbe55f9 100644 --- a/content/browser/web_package/web_bundle_browsertest.cc +++ b/content/browser/web_package/web_bundle_browsertest.cc
@@ -974,6 +974,47 @@ "fr"); } +IN_PROC_BROWSER_TEST_P(WebBundleFileBrowserTest, IframeNavigationNoCrash) { + // Regression test for crbug.com/1058721. There was a bug that navigation of + // OOPIF's remote iframe in Web Bundle file cause crash. + const GURL test_data_url = + GetTestUrlForFile(GetTestDataPath("web_bundle_browsertest.wbn")); + NavigateToBundleAndWaitForReady( + test_data_url, web_bundle_utils::GetSynthesizedUrlForWebBundle( + test_data_url, GURL(kTestPageUrl))); + + const std::string empty_page_path = "/web_bundle/empty_page.html"; + ASSERT_TRUE(embedded_test_server()->Start()); + const GURL empty_page_url = embedded_test_server()->GetURL(empty_page_path); + + ExecuteScriptAndWaitForTitle( + base::StringPrintf(R"( + (async function() { + const empty_page_url = '%s'; + const iframe = document.createElement('iframe'); + const onload = () => { + iframe.removeEventListener('load', onload); + document.title = 'Iframe loaded'; + } + iframe.addEventListener('load', onload); + iframe.src = empty_page_url; + document.body.appendChild(iframe); + })();)", + empty_page_url.spec().c_str()), + "Iframe loaded"); + + ExecuteScriptAndWaitForTitle(R"( + (async function() { + const iframe = document.querySelector("iframe"); + const onload = () => { + document.title = 'Iframe loaded again'; + } + iframe.addEventListener('load', onload); + iframe.src = iframe.src + '?'; + })();)", + "Iframe loaded again"); +} + INSTANTIATE_TEST_SUITE_P(WebBundleFileBrowserTest, WebBundleFileBrowserTest, testing::Values(TestFilePathMode::kNormalFilePath
diff --git a/content/common/content_navigation_policy.cc b/content/common/content_navigation_policy.cc index a3a9058b..8a9448f8 100644 --- a/content/common/content_navigation_policy.cc +++ b/content/common/content_navigation_policy.cc
@@ -44,4 +44,8 @@ features::kProactivelySwapBrowsingInstance); } +bool IsRenderDocumentEnabled() { + return base::FeatureList::IsEnabled(features::kRenderDocument); +} + } // namespace content
diff --git a/content/common/content_navigation_policy.h b/content/common/content_navigation_policy.h index 2b66224..8836d4d0 100644 --- a/content/common/content_navigation_policy.h +++ b/content/common/content_navigation_policy.h
@@ -12,6 +12,7 @@ CONTENT_EXPORT bool IsBackForwardCacheEnabled(); CONTENT_EXPORT bool DeviceHasEnoughMemoryForBackForwardCache(); CONTENT_EXPORT bool IsProactivelySwapBrowsingInstanceEnabled(); +CONTENT_EXPORT bool IsRenderDocumentEnabled(); } // namespace content
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h index 7d0aa842..6c56ac0 100644 --- a/content/common/frame_messages.h +++ b/content/common/frame_messages.h
@@ -645,10 +645,6 @@ // Requests that the given URL be opened in the specified manner. IPC_MESSAGE_ROUTED1(FrameHostMsg_OpenURL, FrameHostMsg_OpenURL_Params) -// Notifies the browser that a frame finished loading. -IPC_MESSAGE_ROUTED1(FrameHostMsg_DidFinishLoad, - GURL /* validated_url */) - // Sent when the RenderFrame or RenderFrameProxy either updates its opener to // another frame identified by |opener_routing_id|, or, if |opener_routing_id| // is MSG_ROUTING_NONE, the frame disowns its opener for the lifetime of the
diff --git a/content/common/view_messages.h b/content/common/view_messages.h index bf46137..ee01a44 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h
@@ -124,10 +124,6 @@ bool /* result */) #endif -// Sent to the main-frame's view to request performing a zoom-to-find-in-page -// based on the rect provided. -IPC_MESSAGE_ROUTED1(ViewMsg_ZoomToFindInPageRect, gfx::Rect /*rect_to_zoom */) - // ----------------------------------------------------------------------------- // Messages sent from the renderer to the browser.
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index d840d04..bd6b00f 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -484,18 +484,17 @@ // frame in a given process. A new one is created after a different-process // navigation. The goal of RenderDocument is to get a new one for each document // instead. +// +// Design doc: https://bit.ly/renderdocument +// Main bug tracker: https://crbug.com/936696 // Enable using the RenderDocument when recovering from crashes. const base::Feature kRenderDocumentForCrashedFrame{ "RenderDocumentForCrashedFrame", base::FEATURE_DISABLED_BY_DEFAULT}; -// Enable using the RenderDocument on main frame navigations. -const base::Feature kRenderDocumentForMainFrame{ - "RenderDocumentForMainFrame", base::FEATURE_DISABLED_BY_DEFAULT}; - -// Enable using the RenderDocument on subframe navigations. -const base::Feature kRenderDocumentForSubframe{ - "RenderDocumentForSubframe", base::FEATURE_DISABLED_BY_DEFAULT}; +// Enable using the RenderDocument. +const base::Feature kRenderDocument{"RenderDocument", + base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kRequestUnbufferedDispatch{ "RequestUnbufferedDispatch", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index 13f6717..76348ab 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h
@@ -108,8 +108,7 @@ kRelaxIsolatedWorldCorsInFileUrlLoaderFactory; CONTENT_EXPORT extern const base::Feature kReloadHiddenTabsWithCrashedSubframes; CONTENT_EXPORT extern const base::Feature kRenderDocumentForCrashedFrame; -CONTENT_EXPORT extern const base::Feature kRenderDocumentForMainFrame; -CONTENT_EXPORT extern const base::Feature kRenderDocumentForSubframe; +CONTENT_EXPORT extern const base::Feature kRenderDocument; CONTENT_EXPORT extern const base::Feature kRequestUnbufferedDispatch; CONTENT_EXPORT extern const base::Feature kResamplingInputEvents; CONTENT_EXPORT extern const base::Feature
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 7e8d6a29..10b27646 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -52,6 +52,7 @@ #include "content/common/accessibility_messages.h" #include "content/common/associated_interfaces.mojom.h" #include "content/common/content_constants_internal.h" +#include "content/common/content_navigation_policy.h" #include "content/common/edit_command.h" #include "content/common/frame.mojom.h" #include "content/common/frame_messages.h" @@ -1488,46 +1489,52 @@ previous_sibling_web_frame, frame_owner_properties->To<blink::WebFrameOwnerProperties>(), replicated_state.frame_owner_element_type, - ResolveOpener(opener_routing_id)); + ResolveWebFrame(opener_routing_id)); // The RenderFrame is created and inserted into the frame tree in the above // call to createLocalChild. render_frame->in_frame_tree_ = true; } else { - RenderFrameProxy* proxy = + RenderFrameProxy* previous_proxy = RenderFrameProxy::FromRoutingID(previous_routing_id); - // The remote frame could've been detached while the remote-to-local - // navigation was being initiated in the browser process. Drop the - // navigation and don't create the frame in that case. See - // https://crbug.com/526304. - if (!proxy) + RenderFrameImpl* previous_frame = + RenderFrameImpl::FromRoutingID(previous_routing_id); + WebFrame* previous_web_frame = ResolveWebFrame(previous_routing_id); + // Only one can be found. Either the |previous_proxy| for a remote-to-local + // navigation, or the |previous_frame| for a local-to-local navigation. + DCHECK(!(previous_proxy && previous_frame)); + // The previous frame could've been detached while the navigation was being + // initiated in the browser process. Drop the navigation and don't create + // the frame in that case. + // See https://crbug.com/526304. + if (!previous_proxy && !previous_frame) return; + render_view = previous_frame ? previous_frame->render_view() + : previous_proxy->render_view(); // This path is creating a local frame. It may or may not be a local root, // depending if the frame's parent is local or remote. It may also be the // main frame, as in the case where a navigation to the current process' - // origin replaces a remote main frame (the proxy's web_frame()) with a - // local one. - render_view = proxy->render_view(); render_frame = RenderFrameImpl::Create( render_view, routing_id, std::move(interface_provider), std::move(browser_interface_broker), devtools_frame_token); render_frame->InitializeBlameContext(nullptr); render_frame->previous_routing_id_ = previous_routing_id; - proxy->set_provisional_frame_routing_id(routing_id); + if (previous_proxy) + previous_proxy->set_provisional_frame_routing_id(routing_id); web_frame = blink::WebLocalFrame::CreateProvisional( render_frame, render_frame->blink_interface_registry_.get(), - proxy->web_frame(), replicated_state.frame_policy, + previous_web_frame, replicated_state.frame_policy, WebString::FromUTF8(replicated_state.name)); // The new |web_frame| is a main frame iff the proxy's frame was. - DCHECK_EQ(!proxy->web_frame()->Parent(), !web_frame->Parent()); + DCHECK_EQ(!previous_web_frame->Parent(), !web_frame->Parent()); } CHECK(render_view); CHECK(render_frame); CHECK(web_frame); - const bool is_main_frame = !web_frame->Parent(); + bool is_main_frame = !web_frame->Parent(); // Child frames require there to be a |parent_routing_id| present, for the // remote parent frame. Though it is only used if the |previous_routing_id| @@ -1670,19 +1677,19 @@ } // static -blink::WebFrame* RenderFrameImpl::ResolveOpener(int opener_frame_routing_id) { - if (opener_frame_routing_id == MSG_ROUTING_NONE) +blink::WebFrame* RenderFrameImpl::ResolveWebFrame(int frame_routing_id) { + if (frame_routing_id == MSG_ROUTING_NONE) return nullptr; // Opener routing ID could refer to either a RenderFrameProxy or a // RenderFrame, so need to check both. RenderFrameProxy* opener_proxy = - RenderFrameProxy::FromRoutingID(opener_frame_routing_id); + RenderFrameProxy::FromRoutingID(frame_routing_id); if (opener_proxy) return opener_proxy->web_frame(); RenderFrameImpl* opener_frame = - RenderFrameImpl::FromRoutingID(opener_frame_routing_id); + RenderFrameImpl::FromRoutingID(frame_routing_id); if (opener_frame) return opener_frame->GetWebFrame(); @@ -2670,7 +2677,7 @@ #endif // defined(OS_ANDROID) void RenderFrameImpl::OnUpdateOpener(int opener_routing_id) { - WebFrame* opener = ResolveOpener(opener_routing_id); + WebFrame* opener = ResolveWebFrame(opener_routing_id); frame_->SetOpener(opener); } @@ -4090,19 +4097,24 @@ frame_->Close(); frame_ = nullptr; - // If this was a provisional frame with an associated proxy, tell the proxy - // that it's no longer associated with this frame. + // If this was a provisional frame with an associated frame to replace, tell + // the previous_proxy it is no longer associated with this frame. if (previous_routing_id_ != MSG_ROUTING_NONE) { RenderFrameProxy* proxy = RenderFrameProxy::FromRoutingID(previous_routing_id_); - // |proxy| should always exist. Detaching the proxy would've also detached - // this provisional frame. The proxy should also not be associated with - // another provisional frame at this point. - CHECK(proxy); - CHECK_EQ(routing_id_, proxy->provisional_frame_routing_id()); - - proxy->set_provisional_frame_routing_id(MSG_ROUTING_NONE); + // |proxy| should always exist. Detaching the proxy would've also + // detached this provisional frame. The proxy should also not be + // associated with another provisional frame at this point. + // + // RenderDocument: The |previous_routing_id_| represents a RenderFrame + // instead of a RenderFrameProxy when a local<->local RenderFrame + // navigation happens. In this case |proxy| is null. + if (proxy) { + CHECK_EQ(routing_id_, proxy->provisional_frame_routing_id()); + proxy->set_provisional_frame_routing_id(MSG_ROUTING_NONE); + } else + CHECK(IsRenderDocumentEnabled()); } delete this; @@ -4526,9 +4538,6 @@ for (auto& observer : observers_) observer.DidFinishLoad(); - WebDocumentLoader* document_loader = frame_->GetDocumentLoader(); - Send(new FrameHostMsg_DidFinishLoad(routing_id_, document_loader->GetUrl())); - if (!RenderThreadImpl::current()) return; RenderThreadImpl::RendererMemoryMetrics memory_metrics; @@ -5477,19 +5486,27 @@ CHECK_NE(previous_routing_id_, MSG_ROUTING_NONE); CHECK(!in_frame_tree_); - // The proxy should always exist. If it was detached while the provisional - // LocalFrame was being navigated, the provisional frame would've been - // cleaned up by RenderFrameProxy::FrameDetached. See - // https://crbug.com/526304 and https://crbug.com/568676 for context. - RenderFrameProxy* proxy = + RenderFrameProxy* previous_proxy = RenderFrameProxy::FromRoutingID(previous_routing_id_); - CHECK(proxy); + RenderFrameImpl* previous_frame = + RenderFrameImpl::FromRoutingID(previous_routing_id_); - unique_name_helper_.set_propagated_name(proxy->unique_name()); + // The |previous_proxy| or the |previous_frame| should always exist. + // If it was detached while the provisional LocalFrame was being navigated, + // the provisional frame would've been cleaned up by + // RenderFrameProxy::FrameDetached. + // See https://crbug.com/526304 and https://crbug.com/568676 for context. + CHECK(previous_proxy || previous_frame); + CHECK(!(previous_proxy && previous_frame)); - // Note: Calling swap() will detach and delete |proxy|, so do not reference it - // after this. - if (!proxy->web_frame()->Swap(frame_)) { + unique_name_helper_.set_propagated_name(previous_proxy + ? previous_proxy->unique_name() + : previous_frame->unique_name()); + + // Note: Calling swap() will detach and delete |previous_frame|, so do not + // reference it after this. + WebFrame* previous_web_frame = ResolveWebFrame(previous_routing_id_); + if (!previous_web_frame->Swap(frame_)) { // Main frames should always swap successfully because there is no parent // frame to cause them to become detached. DCHECK(!is_main_frame_); @@ -5502,6 +5519,7 @@ // If this is the main frame going from a remote frame to a local frame, // it needs to set RenderViewImpl's pointer for the main frame to itself. if (is_main_frame_) { + // TODO(https://crubg.com/936696): Implement RenderDocument on main frames. CHECK(!render_view_->main_render_frame_); render_view_->main_render_frame_ = this;
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index 36fc6b7b..e2bbe3bc 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h
@@ -267,9 +267,9 @@ // partial testing fake. static void InstallCreateHook(CreateRenderFrameImplFunction create_frame); - // Looks up and returns the WebFrame corresponding to a given opener frame - // routing ID. - static blink::WebFrame* ResolveOpener(int opener_frame_routing_id); + // Looks up and returns the WebFrame corresponding to a given frame routing + // ID. + static blink::WebFrame* ResolveWebFrame(int opener_frame_routing_id); // Possibly set the kOpenerCrossOrigin and kSandboxNoGesture policy in // |download_policy|.
diff --git a/content/renderer/render_frame_proxy.cc b/content/renderer/render_frame_proxy.cc index 4106ff43..cb2f95f 100644 --- a/content/renderer/render_frame_proxy.cc +++ b/content/renderer/render_frame_proxy.cc
@@ -413,7 +413,7 @@ } void RenderFrameProxy::OnUpdateOpener(int opener_routing_id) { - blink::WebFrame* opener = RenderFrameImpl::ResolveOpener(opener_routing_id); + blink::WebFrame* opener = RenderFrameImpl::ResolveWebFrame(opener_routing_id); web_frame_->SetOpener(opener); }
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 8c0fe45..1ba5936 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -1906,7 +1906,7 @@ const base::UnguessableToken& devtools_frame_token) { RenderFrameProxy::CreateFrameProxy( routing_id, render_view_routing_id, - RenderFrameImpl::ResolveOpener(opener_routing_id), parent_routing_id, + RenderFrameImpl::ResolveWebFrame(opener_routing_id), parent_routing_id, replicated_state, devtools_frame_token); }
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 8d9e277..85271cf 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc
@@ -441,7 +441,7 @@ #endif WebFrame* opener_frame = - RenderFrameImpl::ResolveOpener(params->opener_frame_route_id); + RenderFrameImpl::ResolveWebFrame(params->opener_frame_route_id); // The newly created webview_ is owned by this instance. webview_ = WebView::Create(this, params->hidden, @@ -1174,7 +1174,6 @@ IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) - IPC_MESSAGE_HANDLER(ViewMsg_ZoomToFindInPageRect, OnZoomToFindInPageRect) IPC_MESSAGE_HANDLER(ViewMsg_SetBackgroundOpaque, OnSetBackgroundOpaque) // Page messages. @@ -1872,11 +1871,6 @@ } } -void RenderViewImpl::OnZoomToFindInPageRect( - const blink::WebRect& rect_to_zoom) { - GetWebView()->ZoomToFindInPageRect(rect_to_zoom); -} - void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { if (!GetWebView()) return;
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index 3ede6c7..ce65c24 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h
@@ -404,7 +404,6 @@ void OnDeterminePageLanguage(); void OnDisableScrollbarsForSmallWindows( const gfx::Size& disable_scrollbars_size_limit); - void OnZoomToFindInPageRect(const blink::WebRect& rect_to_zoom); void OnMoveOrResizeStarted(); void OnExitFullscreen(); void OnSetHistoryOffsetAndLength(int history_offset, int history_length);
diff --git a/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt index 03c9947..e841edb 100644 --- a/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt
@@ -213,3 +213,11 @@ # VP9 appears to not recover correctly after GPU process crashes on Windows. crbug.com/1033982 [ win nvidia ] Pixel_Video_Context_Loss_VP9 [ RetryOnFailure ] + +# Vulkan Video broken on Android +crbug.com/1059724 [ android skia-renderer use-vulkan ] Pixel_Video_MP4 [ Skip ] +crbug.com/1059724 [ android skia-renderer use-vulkan ] Pixel_Video_MP4_FourColors_Aspect_4x3 [ Skip ] +crbug.com/1059724 [ android skia-renderer use-vulkan ] Pixel_Video_MP4_FourColors_Rot_180 [ Skip ] +crbug.com/1059724 [ android skia-renderer use-vulkan ] Pixel_Video_MP4_FourColors_Rot_270 [ Skip ] +crbug.com/1059724 [ android skia-renderer use-vulkan ] Pixel_Video_MP4_FourColors_Rot_90 [ Skip ] +crbug.com/1059724 [ android skia-renderer use-vulkan ] Pixel_Video_VP9 [ Skip ]
diff --git a/content/test/navigation_simulator_impl.cc b/content/test/navigation_simulator_impl.cc index 2410a6d..d404f30 100644 --- a/content/test/navigation_simulator_impl.cc +++ b/content/test/navigation_simulator_impl.cc
@@ -591,6 +591,12 @@ RenderFrameHostImpl* previous_rfh = render_frame_host_->frame_tree_node()->current_frame_host(); + // RenderDocument: Do not dispatch UnloadACK if the navigation was committed + // in the same SiteInstance. This has already been dispatched during the + // navigation in the renderer process. + if (previous_rfh->GetSiteInstance() == render_frame_host_->GetSiteInstance()) + drop_unload_ack_ = true; + if (same_document_) { interface_provider_receiver_.reset(); browser_interface_broker_receiver_.reset(); @@ -739,9 +745,17 @@ // Keep a pointer to the current RenderFrameHost that may be pending deletion // after commit. + // RenderDocument: The |previous_rfh| might also be immediately deleted after + // commit, because it has already run its unload handler. RenderFrameHostImpl* previous_rfh = render_frame_host_->frame_tree_node()->current_frame_host(); + // RenderDocument: Do not dispatch UnloadACK if the navigation was committed + // in the same SiteInstance. This has already been dispatched during the + // navigation in the renderer process. + if (previous_rfh->GetSiteInstance() == render_frame_host_->GetSiteInstance()) + drop_unload_ack_ = true; + auto params = BuildDidCommitProvisionalLoadParams( false /* same_document */, true /* failed_navigation */); render_frame_host_->SimulateCommitProcessed(
diff --git a/content/test/test_render_frame_host.cc b/content/test/test_render_frame_host.cc index 0730342..0219fd4 100644 --- a/content/test/test_render_frame_host.cc +++ b/content/test/test_render_frame_host.cc
@@ -652,8 +652,7 @@ DocumentOnLoadCompleted(); - OnMessageReceived( - FrameHostMsg_DidFinishLoad(GetRoutingID(), GetLastCommittedURL())); + DidFinishLoad(GetLastCommittedURL()); } OnDidStopLoading();
diff --git a/content/test/test_web_contents.cc b/content/test/test_web_contents.cc index a3185c6..3d65ebf 100644 --- a/content/test/test_web_contents.cc +++ b/content/test/test_web_contents.cc
@@ -249,8 +249,7 @@ } void TestWebContents::TestDidFinishLoad(const GURL& url) { - FrameHostMsg_DidFinishLoad msg(0, url); - frame_tree_.root()->current_frame_host()->OnMessageReceived(msg); + OnDidFinishLoad(frame_tree_.root()->current_frame_host(), url); } void TestWebContents::TestDidFailLoadWithError(const GURL& url,
diff --git a/device/bluetooth/bluetooth_adapter.cc b/device/bluetooth/bluetooth_adapter.cc index ec801ea..02118514 100644 --- a/device/bluetooth/bluetooth_adapter.cc +++ b/device/bluetooth/bluetooth_adapter.cc
@@ -283,6 +283,11 @@ observer.DeviceChanged(this, device); } +void BluetoothAdapter::NotifyAdapterDiscoveryChangeCompletedForTesting() { + for (auto& observer : observers_) + observer.DiscoveryChangeCompletedForTesting(); +} + #if defined(OS_CHROMEOS) || defined(OS_LINUX) void BluetoothAdapter::NotifyDevicePairedChanged(BluetoothDevice* device, bool new_paired_status) { @@ -468,7 +473,9 @@ return; discovery_request_pending_ = false; + NotifyAdapterDiscoveryChangeCompletedForTesting(); ProcessDiscoveryQueue(); + return; } @@ -494,6 +501,7 @@ return; discovery_request_pending_ = false; + NotifyAdapterDiscoveryChangeCompletedForTesting(); ProcessDiscoveryQueue(); }
diff --git a/device/bluetooth/bluetooth_adapter.h b/device/bluetooth/bluetooth_adapter.h index ef8a6aa..ee25bcf0 100644 --- a/device/bluetooth/bluetooth_adapter.h +++ b/device/bluetooth/bluetooth_adapter.h
@@ -87,6 +87,9 @@ virtual void DeviceAdded(BluetoothAdapter* adapter, BluetoothDevice* device) {} + // Called when the adapter |DiscoveryChangeComplete| is finished + virtual void DiscoveryChangeCompletedForTesting() {} + // Called when the result of one of the following methods of the device // |device| changes: // * GetAddress() @@ -592,6 +595,7 @@ void NotifyAdapterPresentChanged(bool present); void NotifyAdapterPoweredChanged(bool powered); void NotifyDeviceChanged(BluetoothDevice* device); + void NotifyAdapterDiscoveryChangeCompletedForTesting(); #if defined(OS_CHROMEOS) || defined(OS_LINUX) void NotifyDevicePairedChanged(BluetoothDevice* device,
diff --git a/device/bluetooth/bluez/bluetooth_bluez_unittest.cc b/device/bluetooth/bluez/bluetooth_bluez_unittest.cc index f970bc5..bdca9c5 100644 --- a/device/bluetooth/bluez/bluetooth_bluez_unittest.cc +++ b/device/bluetooth/bluez/bluetooth_bluez_unittest.cc
@@ -1137,16 +1137,11 @@ ASSERT_EQ((size_t)1, discovery_sessions_.size()); EXPECT_TRUE(discovery_sessions_[0]->IsActive()); - discovery_sessions_[0]->Stop(GetCallback(), GetErrorCallback()); - // Run the loop, as there should have been a D-Bus call. - base::RunLoop().Run(); + discovery_sessions_.clear(); EXPECT_EQ(5, observer.discovering_changed_count()); - EXPECT_EQ(8, callback_count_); - EXPECT_EQ(0, error_callback_count_); EXPECT_TRUE(observer.last_discovering()); EXPECT_TRUE(IsAdapterDiscovering()); - EXPECT_FALSE(discovery_sessions_[0]->IsActive()); - discovery_sessions_.clear(); + EXPECT_TRUE(discovery_sessions_.empty()); // Start discovery again. adapter_->StartDiscoverySession( @@ -1156,7 +1151,7 @@ // Run the loop, as there should have been a D-Bus call. base::RunLoop().Run(); EXPECT_EQ(5, observer.discovering_changed_count()); - EXPECT_EQ(9, callback_count_); + EXPECT_EQ(8, callback_count_); EXPECT_EQ(0, error_callback_count_); EXPECT_TRUE(observer.last_discovering()); EXPECT_TRUE(IsAdapterDiscovering()); @@ -1173,21 +1168,21 @@ base::Unretained(this))); base::RunLoop().Run(); EXPECT_EQ(5, observer.discovering_changed_count()); - EXPECT_EQ(10, callback_count_); + EXPECT_EQ(9, callback_count_); EXPECT_EQ(0, error_callback_count_); EXPECT_TRUE(observer.last_discovering()); EXPECT_TRUE(IsAdapterDiscovering()); // Now end the discovery session. This should change the adapter's discovery // state. - discovery_sessions_[0]->Stop(GetCallback(), GetErrorCallback()); - base::RunLoop().Run(); + base::RunLoop stop_loop; + observer.RegisterDiscoveringChangedWatcher(stop_loop.QuitClosure()); + discovery_sessions_.clear(); + stop_loop.Run(); EXPECT_EQ(6, observer.discovering_changed_count()); - EXPECT_EQ(11, callback_count_); - EXPECT_EQ(0, error_callback_count_); EXPECT_FALSE(observer.last_discovering()); EXPECT_FALSE(IsAdapterDiscovering()); - EXPECT_FALSE(discovery_sessions_[0]->IsActive()); + EXPECT_TRUE(discovery_sessions_.empty()); } TEST_F(BluetoothBlueZTest, InvalidatedDiscoverySessions) { @@ -1316,30 +1311,27 @@ EXPECT_EQ(0, error_callback_count_); EXPECT_TRUE(observer.last_discovering()); EXPECT_TRUE(IsAdapterDiscovering()); - ASSERT_EQ((size_t)3, discovery_sessions_.size()); + ASSERT_EQ(3u, discovery_sessions_.size()); EXPECT_TRUE(discovery_sessions_[1]->IsActive()); EXPECT_NE(discovery_sessions_[0], discovery_sessions_[1]); // Stop the previous discovery session. The session should end but discovery // should continue. - discovery_sessions_[0]->Stop(GetCallback(), GetErrorCallback()); - base::RunLoop().Run(); + discovery_sessions_.erase(discovery_sessions_.begin()); EXPECT_EQ(1, observer.discovering_changed_count()); - EXPECT_EQ(4, callback_count_); - EXPECT_EQ(0, error_callback_count_); EXPECT_TRUE(observer.last_discovering()); EXPECT_TRUE(IsAdapterDiscovering()); - ASSERT_EQ((size_t)3, discovery_sessions_.size()); - EXPECT_FALSE(discovery_sessions_[0]->IsActive()); - EXPECT_TRUE(discovery_sessions_[1]->IsActive()); + ASSERT_EQ(2u, discovery_sessions_.size()); + EXPECT_TRUE(discovery_sessions_[0]->IsActive()); - // Delete the current active session. Discovery should eventually stop. + // Delete the current active session. + base::RunLoop stop_loop; + observer.RegisterDiscoveringChangedWatcher(stop_loop.QuitClosure()); discovery_sessions_.clear(); - while (observer.last_discovering()) - base::RunLoop().RunUntilIdle(); + stop_loop.Run(); EXPECT_EQ(2, observer.discovering_changed_count()); - EXPECT_EQ(4, callback_count_); + EXPECT_EQ(3, callback_count_); EXPECT_EQ(0, error_callback_count_); EXPECT_FALSE(observer.last_discovering()); EXPECT_FALSE(IsAdapterDiscovering()); @@ -1389,21 +1381,14 @@ std::vector<std::string> uuids = *filter->uuids; EXPECT_TRUE(base::Contains(uuids, "1000")); - discovery_sessions_[0]->Stop( - base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); - - base::RunLoop().Run(); - - EXPECT_EQ(1, callback_count_); - EXPECT_EQ(0, error_callback_count_); + base::RunLoop stop_loop; + observer.RegisterDiscoveringChangedWatcher(stop_loop.QuitClosure()); + discovery_sessions_.clear(); + stop_loop.Run(); ASSERT_TRUE(adapter_->IsPowered()); ASSERT_FALSE(IsAdapterDiscovering()); - ASSERT_EQ((size_t)1, discovery_sessions_.size()); - ASSERT_FALSE(discovery_sessions_[0]->IsActive()); - ASSERT_EQ(discovery_sessions_[0]->GetDiscoveryFilter(), - (BluetoothDiscoveryFilter*)nullptr); + ASSERT_TRUE(discovery_sessions_.empty()); filter = fake_bluetooth_adapter_client_->GetDiscoveryFilter(); EXPECT_EQ(nullptr, filter); @@ -1544,11 +1529,10 @@ callback_count_ = 0; // Request to stop discovery twice. for (int i = 0; i < 2; i++) { - discovery_sessions_[i]->Stop( - base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); - base::RunLoop().Run(); - + base::RunLoop change_loop; + observer.RegisterDiscoveryChangeCompletedWatcher(change_loop.QuitClosure()); + discovery_sessions_.erase(discovery_sessions_.begin()); + change_loop.Run(); if (i == 0) { auto* filter = fake_bluetooth_adapter_client_->GetDiscoveryFilter(); EXPECT_EQ("le", *filter->transport); @@ -1583,12 +1567,9 @@ // The success callback should have been called 2 times and the adapter should // still be discovering. - EXPECT_EQ(2, callback_count_); - EXPECT_EQ(0, error_callback_count_); EXPECT_TRUE(IsAdapterDiscovering()); - EXPECT_FALSE(discovery_sessions_[0]->IsActive()); - EXPECT_FALSE(discovery_sessions_[1]->IsActive()); - EXPECT_TRUE(discovery_sessions_[2]->IsActive()); + EXPECT_TRUE(discovery_sessions_[0]->IsActive()); + ASSERT_EQ(1u, discovery_sessions_.size()); callback_count_ = 0; @@ -1658,34 +1639,26 @@ EXPECT_EQ(3, callback_count_); EXPECT_EQ(0, error_callback_count_); EXPECT_TRUE(IsAdapterDiscovering()); - ASSERT_EQ((size_t)6, discovery_sessions_.size()); + ASSERT_EQ(4u, discovery_sessions_.size()); callback_count_ = 0; // Request to stop discovery 4 times. + base::RunLoop adapter_stop_loop; + observer.RegisterDiscoveringChangedWatcher(adapter_stop_loop.QuitClosure()); for (int i = 2; i < 6; i++) { - discovery_sessions_[i]->Stop( - base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); - - // filter no 2 is same as filter no 5, so removing it shouldn't cause any - // filter update - if (i != 2 && i != 5) - base::RunLoop().Run(); + base::RunLoop change_loop; + observer.RegisterDiscoveryChangeCompletedWatcher(change_loop.QuitClosure()); + discovery_sessions_.erase(discovery_sessions_.begin()); + change_loop.Run(); } - // Run only once, as there should have been one D-Bus call. - base::RunLoop().Run(); + adapter_stop_loop.Run(); - // The success callback should have been called 4 times and the adapter should - // no longer be discovering. - EXPECT_EQ(4, callback_count_); - EXPECT_EQ(0, error_callback_count_); + // The adapter should no longer be discovering. EXPECT_FALSE(IsAdapterDiscovering()); EXPECT_EQ(1, observer.discovering_changed_count()); // All discovery sessions should be inactive. - for (int i = 0; i < 6; i++) - EXPECT_FALSE(discovery_sessions_[i]->IsActive()); - + ASSERT_TRUE(discovery_sessions_.empty()); auto* filter = fake_bluetooth_adapter_client_->GetDiscoveryFilter(); EXPECT_EQ(nullptr, filter); } @@ -1788,16 +1761,7 @@ EXPECT_EQ(nullptr, filter->rssi.get()); EXPECT_EQ(nullptr, filter->pathloss.get()); EXPECT_EQ(nullptr, filter->uuids.get()); - - // Request to stop discovery 4 times. - for (int i = 3; i >= 0; i--) { - discovery_sessions_[i]->Stop( - base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)), - base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); - - // Every session stopping would trigger filter update - base::RunLoop().Run(); - } + discovery_sessions_.clear(); } TEST_F(BluetoothBlueZTest, DeviceProperties) { @@ -4252,8 +4216,6 @@ // OnStartDiscovery tested in Shutdown_OnStartDiscovery // OnStartDiscoveryError tested in Shutdown_OnStartDiscoveryError - // OnStopDiscovery tested in Shutdown_OnStopDiscovery - // OnStopDiscoveryError tested in Shutdown_OnStopDiscoveryError adapter_profile_ = nullptr; @@ -4374,73 +4336,6 @@ EXPECT_EQ(kNumberOfDiscoverySessions, error_callback_count_); } -// Verifies post-Shutdown of discovery sessions and OnStartDiscovery. -TEST_F(BluetoothBlueZTest, Shutdown_OnStopDiscovery) { - const int kNumberOfDiscoverySessions = 10; - GetAdapter(); - BluetoothAdapterBlueZ* adapter_bluez = - static_cast<BluetoothAdapterBlueZ*>(adapter_.get()); - - // In order to queue up discovery sessions before an OnStopDiscovery call - // RemoveDiscoverySession must be called, so Add, Start, and Remove: - adapter_bluez->StartDiscoverySession( - base::BindRepeating(&BluetoothBlueZTest::DiscoverySessionCallback, - base::Unretained(this)), - GetErrorCallback()); - base::RunLoop().Run(); - discovery_sessions_[0]->Stop(GetCallback(), GetErrorCallback()); - callback_count_ = 0; - error_callback_count_ = 0; - // Can now queue discovery sessions while waiting for OnStopDiscovery. - for (int i = 0; i < kNumberOfDiscoverySessions; i++) { - adapter_bluez->StartDiscoverySession( - base::BindRepeating(&BluetoothBlueZTest::DiscoverySessionCallback, - base::Unretained(this)), - GetErrorCallback()); - } - adapter_->Shutdown(); - base::RunLoop().Run(); - - // 1 successful stopped discovery from RemoveDiscoverySession, and - // kNumberOfDiscoverySessions errors from AddDiscoverySession/OnStopDiscovery. - EXPECT_EQ(1, callback_count_); - EXPECT_EQ(kNumberOfDiscoverySessions, error_callback_count_); -} - -// Verifies post-Shutdown of discovery sessions and OnStopDiscoveryError. -TEST_F(BluetoothBlueZTest, Shutdown_OnStopDiscoveryError) { - const int kNumberOfDiscoverySessions = 10; - GetAdapter(); - BluetoothAdapterBlueZ* adapter_bluez = - static_cast<BluetoothAdapterBlueZ*>(adapter_.get()); - - // In order to queue up discovery sessions before an OnStopDiscoveryError call - // RemoveDiscoverySession must be called, so Add, Start, and Remove: - adapter_bluez->StartDiscoverySession( - base::BindRepeating(&BluetoothBlueZTest::DiscoverySessionCallback, - base::Unretained(this)), - GetErrorCallback()); - base::RunLoop().Run(); - discovery_sessions_[0]->Stop(GetCallback(), GetErrorCallback()); - callback_count_ = 0; - error_callback_count_ = 0; - // Can now queue discovery sessions while waiting for OnStopDiscoveryError. - for (int i = 0; i < kNumberOfDiscoverySessions; i++) { - adapter_bluez->StartDiscoverySession( - base::BindRepeating(&BluetoothBlueZTest::DiscoverySessionCallback, - base::Unretained(this)), - GetErrorCallback()); - } - adapter_->Shutdown(); - base::RunLoop().Run(); - - // kNumberOfDiscoverySessions reported errors because of the shutdown while - // starting. However, the stop call succeeded because the adapter shutdown - // and is therefore not discovering(also stop always returns success). - EXPECT_EQ(1, callback_count_); - EXPECT_EQ(kNumberOfDiscoverySessions, error_callback_count_); -} - TEST_F(BluetoothBlueZTest, StartDiscoveryError_ThenStartAgain) { GetAdapter(); fake_bluetooth_adapter_client_->MakeStartDiscoveryFail();
diff --git a/device/bluetooth/test/test_bluetooth_adapter_observer.cc b/device/bluetooth/test/test_bluetooth_adapter_observer.cc index 4399e08..6113826 100644 --- a/device/bluetooth/test/test_bluetooth_adapter_observer.cc +++ b/device/bluetooth/test/test_bluetooth_adapter_observer.cc
@@ -119,6 +119,11 @@ discovering_changed_callback_ = callback; } +void TestBluetoothAdapterObserver::RegisterDiscoveryChangeCompletedWatcher( + base::RepeatingClosure callback) { + discovery_change_completed_callback_ = callback; +} + void TestBluetoothAdapterObserver::DeviceAdded(BluetoothAdapter* adapter, BluetoothDevice* device) { EXPECT_EQ(adapter_.get(), adapter); @@ -130,6 +135,11 @@ QuitMessageLoop(); } +void TestBluetoothAdapterObserver::DiscoveryChangeCompletedForTesting() { + if (discovery_change_completed_callback_) + discovery_change_completed_callback_.Run(); +} + void TestBluetoothAdapterObserver::DeviceChanged(BluetoothAdapter* adapter, BluetoothDevice* device) { EXPECT_EQ(adapter_.get(), adapter);
diff --git a/device/bluetooth/test/test_bluetooth_adapter_observer.h b/device/bluetooth/test/test_bluetooth_adapter_observer.h index 7a523e3..06eaaf0 100644 --- a/device/bluetooth/test/test_bluetooth_adapter_observer.h +++ b/device/bluetooth/test/test_bluetooth_adapter_observer.h
@@ -33,7 +33,9 @@ void AdapterDiscoveringChanged(BluetoothAdapter* adapter, bool discovering) override; void RegisterDiscoveringChangedWatcher(base::RepeatingClosure callback); + void RegisterDiscoveryChangeCompletedWatcher(base::RepeatingClosure callback); void DeviceAdded(BluetoothAdapter* adapter, BluetoothDevice* device) override; + void DiscoveryChangeCompletedForTesting() override; void DeviceChanged(BluetoothAdapter* adapter, BluetoothDevice* device) override; void DeviceAddressChanged(device::BluetoothAdapter* adapter, @@ -235,6 +237,7 @@ base::Optional<uint16_t> last_appearance_; base::Closure discovering_changed_callback_; + base::Closure discovery_change_completed_callback_; #if defined(OS_CHROMEOS) || defined(OS_LINUX) int device_paired_changed_count_;
diff --git a/docs/enterprise/add_new_policy.md b/docs/enterprise/add_new_policy.md index 52fca4f1..bd6ad7a 100644 --- a/docs/enterprise/add_new_policy.md +++ b/docs/enterprise/add_new_policy.md
@@ -5,7 +5,7 @@ Chrome exposes a different set of configurations to administrators. These configurations are called policy and they give administrators more advanced controls than the normal users. With different device management tools, -administrator can deliver these polices to many users. Here is the +an administrator can deliver these polices to many users. Here is the [help center article](https://support.google.com/chrome/a/answer/9037717?hl=en) that talks about Chrome policy and its deployment. @@ -16,13 +16,13 @@ - Launching a new feature. Create a policy so that the admin can disable or enable the feature for all users. -- Deprecate an old feature. Create a policy to give enterprise users more time - to migrate away from the feature. +- Deprecating an old feature. Create a policy to give enterprise users more + time to migrate away from the feature. ## Adding a new policy 1. Think carefully about the name and the desired semantics of the new policy: - - Chose a name that is consistent with the existing naming scheme. Prefer + - Choose a name that is consistent with the existing naming scheme. Prefer "XXXEnabled" over "EnableXXX" because the former is more glanceable and sorts better. - Consider the foreseeable future and try to avoid conflicts with possible @@ -32,21 +32,21 @@ 2. Declare the policy in the [policy_templates.json](https://cs.chromium.org/chromium/src/components/policy/resources/policy_templates.json) - This file contains meta-level descriptions of all policies and is used - to generated code, policy templates (ADM/ADMX for windows and the - application manifest for Mac), as well as documentation.Please make sure - you get the version and features flags (such as dynamic_refresh and + to generate code, policy templates (ADM/ADMX for Windows and the + application manifest for Mac), as well as documentation. Please make + sure you get the version and feature flags (such as dynamic_refresh and supported_on) right. - Here are the most used attributes. Please note that, all attributes below other than `supported_on` do not change the code behavior. - `supported_on`: It controls the platform and Chrome milestone the policy supports. - - `dynamic_refresh`: It tells admin if the policy value can be changed - and taken affected without re-launch Chrome. - - `per_profile`: It tells the admin if different policy value can be - assigned to different profile. - - `can_be_recommended`: It tells the admin if they can set the policy - in the recommended level and allow user override it with UI, command - line switch or extension. + - `dynamic_refresh`: It tells the admin whether the policy value can + be changed and take effect without re-launching Chrome. + - `per_profile`: It tells the admin whether different policy values + can be assigned to different profiles. + - `can_be_recommended`: It tells the admin whether they can mark the + policy as recommended and allow the user to override it in the UI, + using a command line switch or an extension. - `future`: It hides the policy from auto-generated templates and documentation. It's used when your policy needs multiple milestone development. @@ -70,9 +70,9 @@ **Profile Prefs**. Please note that, this must match the `per_profile` attribute in the `policy_templates.json`. We also strongly encourage developers to register the prefs with **Profile - Prefs** if possible, because this gives admin more flexiability of + Prefs** if possible, because this gives admin more flexibility of policy setup. - 2. Most of policies can be mapped to prefs with `kSimplePolicyMap` in + 2. Most policies can be mapped to prefs with `kSimplePolicyMap` in [configuration_policy_handler_list_factory.cc](https://cs.chromium.org/chromium/src/chrome/browser/policy/configuration_policy_handler_list_factory.cc?type=cs&q=kSimplePolicyMap&g=0&l=150). If the policy needs additional verification or processing, please implement a `ConfigurationPolicyHandler` to do so. @@ -89,19 +89,19 @@ to tell users that the setting is enforced by the administrator. 5. Support `dynamic_refresh` if possible. - We strongly encourage developers to make their policies support this - attribute. It means admin can change the policy value and Chrome will - honor the change at run-time wihtout requiring a restart of the browser. - - Chrome OS does not always support non-dynamic profile policies. Please - verify with Chrome OS policy owner if your profile policy does not - support dynamic refresh on Chrome OS. - - Most of time, this requires a + attribute. It means the admin can change the policy value and Chrome + will honor the change at run-time without requiring a restart of the + browser. Chrome OS does not always support non-dynamic profile policies. + Please verify with a Chrome OS policy owner if your profile policy does + not support dynamic refresh on Chrome OS. + - Most of the time, this requires a [PrefChangeRegistrar](https://cs.chromium.org/chromium/src/components/prefs/pref_change_registrar.h) - to listen to the preference change notification. And update UI or - browser behavior right a way. + to listen to the preference change notification and update UI or + browser behavior right away. 6. Adding a device policy for Chrome OS. - - Most of policies that are used by browser can be shared by desktop and - Chrome OS. However, you need few additional steps for device policy on - Chrome OS. + - Most policies that are used by the browser can be shared between desktop + and Chrome OS. However, you need a few additional steps for a device + policy on Chrome OS. - Add a message for your policy in `components/policy/proto/chrome_device_policy.proto`. Please note that all proto fields are optional. @@ -130,7 +130,7 @@ (section "Set Up Policies") - Chrome OS and Android are more complex to test, as a full end-to-end test requires network transactions to the policy test server. - Instructions for how to set up the policy test server and have the + Instructions on how to set up the policy test server and have the browser talk to it are here: [Running the cloud policy test server](https://www.chromium.org/developers/how-tos/enterprise/running-the-cloud-policy-test-server). If you'd just like to do a quick test for Chrome OS, the Linux code is @@ -145,7 +145,7 @@ ## Examples -Here is an example based on the instruction above. It's a good, simple place to +Here is an example based on the instructions above. It's a good, simple place to get started: [https://chromium-review.googlesource.com/c/chromium/src/+/1742209](https://chromium-review.googlesource.com/c/chromium/src/+/1742209) @@ -156,9 +156,9 @@ client- and server-side stakeholders explaining the planned change. There are a few noteworthy pitfalls that you should be aware of when updating -code that handles existing policy settings, in particular: +the code that handles existing policy settings, in particular: -- Make sure the policy meta data is up-to-date, in particular `supported_on`, and +- Make sure the policy metadata is up-to-date, in particular `supported_on`, and the feature flags. - In general, don't change policy semantics in a way that is incompatible (as determined by user/admin-visible behavior) with previous semantics. **In @@ -168,7 +168,7 @@ - **An important pitfall is that adding an additional allowed value to an enum policy may cause compatibility issues.** Specifically, an administrator may use the new policy value, which makes older Chrome versions -that may still be deployed (which don't understand the new value) fall back to +that may still be deployed (and don't understand the new value) fall back to the default behavior. Carefully consider if this is OK in your case. Usually, it is preferred to create a new policy with the additional value and deprecate the old one. @@ -188,34 +188,34 @@ ### Presubmit Checks when Modifying Existing Policies To enforce the above rules concerning policy modification and ensure no -backwards incompatible changes are introduced, there will be presubmit checks -performed on every change to +backwards incompatible changes are introduced, presubmit checks +will be performed on every change to [policy_templates.json](https://cs.chromium.org/chromium/src/components/policy/resources/policy_templates.json). The presubmit checks perform the following verifications: -1. It verifies if a policy is considered **un-released** before allowing a - change. A policy is considered un-released if **any** of the following +1. It verifies whether a policy is considered **unreleased** before allowing a + change. A policy is considered unreleased if **any** of the following conditions are true: - 1. Is the unchanged policy marked as `future: true`. + 1. It is an unchanged policy marked as `future: true`. 2. All the `supported_versions` of the policy satisfy **any** of the following conditions 1. The unchanged supported major version is >= the current major version stored in the VERSION file at tip of tree. This covers the - case of a policy that was just recently been added but has not yet + case of a policy that has just recently been added, but has not yet been released to a stable branch. 2. The changed supported version == unchanged supported version + 1 and the changed supported version is equal to the version stored in the VERSION file at tip of tree. This check covers the case of - "un-releasing" a policy after a new stable branch has been cut but + "unreleasing" a policy after a new stable branch has been cut, but before a new stable release has rolled out. Normally such a change should eventually be merged into the stable branch before the release. -2. If the policy is considered **un-released**, all changes to it are allowed. +2. If the policy is considered **unreleased**, all changes to it are allowed. -3. However if the policy is not un-released then the following verifications +3. However if the policy is released then the following verifications are performed on the delta between the original policy and the changed policy. @@ -247,23 +247,23 @@ restriction will cover the list of valid enum values as well). 5. These same restrictions will apply recursively to all property schema definitions listed in a dictionary type policy. - 8. Released dict policies cannot remove and modify any existing key in + 8. Released dict policies cannot remove or modify any existing keys in their schema. They can only add new keys to the schema. 1. Dictionary policies can have some of their "required" fields removed in order to be less restrictive. ## Cloud Policy -**For googlers only**: Cloud Policy will be maintained by the Admin console -team, -[see instruction here](https://docs.google.com/document/d/1QgDTWISgOE8DVwQSSz8x5oKrI3O_qAvOmPryE5DQPcw/edit?usp=sharing) -about updating the cloud policy. +**For Googlers only**: The Cloud Policy will be maintained by the Admin console +team. +[See instructions here](https://docs.google.com/document/d/1QgDTWISgOE8DVwQSSz8x5oKrI3O_qAvOmPryE5DQPcw/edit?usp=sharing) +on how to update the Cloud Policy. ## Post policy update -Once the policy is added or modified, there is nothing else needs to be taken -care of by the Chromium developers. However, there are few things will be -updated based on the json file. Please note that, there is to ETA for +Once the policy is added or modified, nothing else needs to be taken +care of by the Chromium developers. However, there are a few things that will be +updated based on the json file. Please note that there is no ETA for everything listed below. * [Policy templates](https://dl.google.com/dl/edgedl/chrome/policy/policy_templates.zip) @@ -275,4 +275,4 @@ ### Additional Notes -1. policy_templates.json is actually a python dictionary even the file name contains *json*. +1. policy_templates.json is actually a Python dictionary even though the file name contains *json*.
diff --git a/docs/ui/ui_devtools/index.md b/docs/ui/ui_devtools/index.md index 79bf4d5..e56dde4 100644 --- a/docs/ui/ui_devtools/index.md +++ b/docs/ui/ui_devtools/index.md
@@ -15,7 +15,7 @@ * If you want to use different port, add port in the flag `--enable-ui-devtools=<port>`. 2. In the Chrome Omnibox, go to chrome://inspect#other and click `inspect` under UIDevToolsClient. - * Direct link is chrome-devtools://devtools/bundled/inspector.html?ws=localhost:9223/0. + * Direct link is devtools://devtools/bundled/inspector.html?ws=localhost:9223/0. ## How to Use
diff --git a/fuchsia/engine/BUILD.gn b/fuchsia/engine/BUILD.gn index b94224f2..421df73 100644 --- a/fuchsia/engine/BUILD.gn +++ b/fuchsia/engine/BUILD.gn
@@ -209,9 +209,6 @@ excluded_files = [ "lib/libswiftshader_libEGL.so", "lib/libswiftshader_libGLESv2.so", - "lib/libEGL.so", - "lib/libGLESv2.so", - "lib/libfuchsia_egl.so", ] }
diff --git a/fuchsia/engine/context_provider_impl.cc b/fuchsia/engine/context_provider_impl.cc index 373ece5..beb11e1 100644 --- a/fuchsia/engine/context_provider_impl.cc +++ b/fuchsia/engine/context_provider_impl.cc
@@ -415,36 +415,6 @@ return; } - if (enable_vulkan) { - if (is_headless) { - LOG(ERROR) << "VULKAN and HEADLESS features cannot be used together."; - context_request.Close(ZX_ERR_INVALID_ARGS); - return; - } - - DLOG(ERROR) << "Enabling Vulkan GPU acceleration."; - // Vulkan requires use of SkiaRenderer, configured to a use Vulkan context. - launch_command.AppendSwitch(switches::kUseVulkan); - const std::vector<base::StringPiece> enabled_features = { - features::kUseSkiaRenderer.name, features::kVulkan.name}; - AppendFeature(switches::kEnableFeatures, - base::JoinString(enabled_features, ","), &launch_command); - - // SkiaRenderer requires out-of-process rasterization be enabled. - launch_command.AppendSwitch(switches::kEnableOopRasterization); - - // TODO(https://crbug.com/766360): Provide a no-op GL implementation until - // vANGLE is available. - launch_command.AppendSwitchASCII(switches::kUseGL, - gl::kGLImplementationStubName); - } else { - DLOG(ERROR) << "Disabling GPU acceleration."; - // Disable use of Vulkan GPU, and use of the software-GL rasterizer. The - // Context will still run a GPU process, but will not support WebGL. - launch_command.AppendSwitch(switches::kDisableGpu); - launch_command.AppendSwitch(switches::kDisableSoftwareRasterizer); - } - bool allow_protected_graphics = web_engine_config.FindBoolPath("allow-protected-graphics") .value_or(false); @@ -465,6 +435,44 @@ } } + if (enable_vulkan) { + if (is_headless) { + LOG(ERROR) << "VULKAN and HEADLESS features cannot be used together."; + context_request.Close(ZX_ERR_INVALID_ARGS); + return; + } + + DLOG(ERROR) << "Enabling Vulkan GPU acceleration."; + // Vulkan requires use of SkiaRenderer, configured to a use Vulkan context. + launch_command.AppendSwitch(switches::kUseVulkan); + const std::vector<base::StringPiece> enabled_features = { + features::kUseSkiaRenderer.name, features::kVulkan.name}; + AppendFeature(switches::kEnableFeatures, + base::JoinString(enabled_features, ","), &launch_command); + + // SkiaRenderer requires out-of-process rasterization be enabled. + launch_command.AppendSwitch(switches::kEnableOopRasterization); + + if (!enable_protected_graphics) { + launch_command.AppendSwitchASCII(switches::kUseGL, + gl::kGLImplementationANGLEName); + } else { + DLOG(WARNING) << "ANGLE is not compatible with " + << switches::kEnforceVulkanProtectedMemory + << ", disabling GL"; + // TODO(crbug.com/1059010): Fix this; probably don't protect canvas + // resources. + launch_command.AppendSwitchASCII(switches::kUseGL, + gl::kGLImplementationDisabledName); + } + } else { + DLOG(ERROR) << "Disabling GPU acceleration."; + // Disable use of Vulkan GPU, and use of the software-GL rasterizer. The + // Context will still run a GPU process, but will not support WebGL. + launch_command.AppendSwitch(switches::kDisableGpu); + launch_command.AppendSwitch(switches::kDisableSoftwareRasterizer); + } + if (enable_widevine) { launch_command.AppendSwitch(switches::kEnableWidevine); }
diff --git a/fuchsia/runners/cast/cast_component.cc b/fuchsia/runners/cast/cast_component.cc index f3d2b68..18e8fb0 100644 --- a/fuchsia/runners/cast/cast_component.cc +++ b/fuchsia/runners/cast/cast_component.cc
@@ -97,15 +97,6 @@ frame()->SetPermissionState(std::move(permission_clone), origin, fuchsia::web::PermissionState::GRANTED); } - } else { - // Grant PROTECTED_MEDIA_IDENTIFIER permission if permissions are not - // specified in the config. This is necessary for compatibility with older - // ApplicationConfigManager implementations that do not set permissions. - fuchsia::web::PermissionDescriptor eme_id_permission; - eme_id_permission.set_type( - fuchsia::web::PermissionType::PROTECTED_MEDIA_IDENTIFIER); - frame()->SetPermissionState(std::move(eme_id_permission), origin, - fuchsia::web::PermissionState::GRANTED); } }
diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc index 2cd89c63..1322c24 100644 --- a/gpu/command_buffer/service/feature_info.cc +++ b/gpu/command_buffer/service/feature_info.cc
@@ -817,7 +817,7 @@ if (gl_version_info_->is_es3) has_srgb_framebuffer_support = true; - if (has_srgb_framebuffer_support && !IsWebGLContext()) { + if (has_srgb_framebuffer_support) { // GL_FRAMEBUFFER_SRGB_EXT is exposed by the GLES extension // GL_EXT_sRGB_write_control (which is not part of the core, even in GLES3), // and the desktop extension GL_ARB_framebuffer_sRGB (part of the core in @@ -825,8 +825,12 @@ if (feature_flags_.desktop_srgb_support || gfx::HasExtension(extensions, "GL_EXT_sRGB_write_control")) { feature_flags_.ext_srgb_write_control = true; - AddExtensionString("GL_EXT_sRGB_write_control"); - validators_.capability.AddValue(GL_FRAMEBUFFER_SRGB_EXT); + + // Do not expose this extension to WebGL. + if (!IsWebGLContext()) { + AddExtensionString("GL_EXT_sRGB_write_control"); + validators_.capability.AddValue(GL_FRAMEBUFFER_SRGB_EXT); + } } }
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 15bbc88..61f7d798 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -9280,7 +9280,7 @@ !feature_info_->feature_flags().desktop_srgb_support || gl_version_info().IsAtLeastGL(4, 4) || (gl_version_info().IsAtLeastGL(4, 2) && encode_srgb_only)) { - if (enable_srgb && gl_version_info().IsAtLeastGL(4, 2)) { + if (enable_srgb && feature_info_->feature_flags().ext_srgb_write_control) { state_.EnableDisableFramebufferSRGB(enable_srgb); }
diff --git a/gpu/vulkan/android/vulkan_implementation_android.cc b/gpu/vulkan/android/vulkan_implementation_android.cc index f349013..7581e5c 100644 --- a/gpu/vulkan/android/vulkan_implementation_android.cc +++ b/gpu/vulkan/android/vulkan_implementation_android.cc
@@ -128,15 +128,18 @@ VulkanImplementationAndroid::GetOptionalDeviceExtensions() { // VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME also requires // VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME as per spec. - return {VK_KHR_SWAPCHAIN_EXTENSION_NAME, - VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME, - VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME, - VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME, - VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME, - VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME, - VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME, - VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME, - VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME}; + return { + VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME, + VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME, + VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME, + VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME, + VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME, + VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME, + VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME, + VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME, + VK_KHR_SWAPCHAIN_EXTENSION_NAME, + VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME, + }; } VkFence VulkanImplementationAndroid::CreateVkFenceForGpuFence(
diff --git a/gpu/vulkan/vulkan_surface.cc b/gpu/vulkan/vulkan_surface.cc index 9dbe35a4..00c2020 100644 --- a/gpu/vulkan/vulkan_surface.cc +++ b/gpu/vulkan/vulkan_surface.cc
@@ -178,7 +178,11 @@ } gfx::SwapResult VulkanSurface::SwapBuffers() { - return swap_chain_->PresentBuffer(); + return PostSubBuffer(gfx::Rect(image_size_)); +} + +gfx::SwapResult VulkanSurface::PostSubBuffer(const gfx::Rect& rect) { + return swap_chain_->PresentBuffer(rect); } void VulkanSurface::Finish() {
diff --git a/gpu/vulkan/vulkan_surface.h b/gpu/vulkan/vulkan_surface.h index cf17834a..66a2f754 100644 --- a/gpu/vulkan/vulkan_surface.h +++ b/gpu/vulkan/vulkan_surface.h
@@ -43,6 +43,7 @@ void Destroy(); gfx::SwapResult SwapBuffers(); + gfx::SwapResult PostSubBuffer(const gfx::Rect& rect); void Finish();
diff --git a/gpu/vulkan/vulkan_swap_chain.cc b/gpu/vulkan/vulkan_swap_chain.cc index d5918a94..af33a32 100644 --- a/gpu/vulkan/vulkan_swap_chain.cc +++ b/gpu/vulkan/vulkan_swap_chain.cc
@@ -49,6 +49,9 @@ DCHECK(!use_protected_memory || device_queue->allow_protected_memory()); use_protected_memory_ = use_protected_memory; device_queue_ = device_queue; + is_incremental_present_supported_ = + gfx::HasExtension(device_queue_->enabled_extensions(), + VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME); device_queue_->GetFenceHelper()->ProcessCleanupTasks(); return InitializeSwapChain(surface, surface_format, image_size, min_image_count, pre_transform, @@ -62,7 +65,7 @@ DestroySwapChain(); } -gfx::SwapResult VulkanSwapChain::PresentBuffer() { +gfx::SwapResult VulkanSwapChain::PresentBuffer(const gfx::Rect& rect) { DCHECK(acquired_image_); DCHECK(end_write_semaphore_ != VK_NULL_HANDLE); @@ -96,15 +99,31 @@ end_write_semaphore_ = vk_semaphore; } - // Queue the present. - VkPresentInfoKHR present_info = {}; - present_info.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR; + VkPresentInfoKHR present_info = {VK_STRUCTURE_TYPE_PRESENT_INFO_KHR}; present_info.waitSemaphoreCount = 1; present_info.pWaitSemaphores = &end_write_semaphore_; present_info.swapchainCount = 1; present_info.pSwapchains = &swap_chain_; present_info.pImageIndices = &acquired_image_.value(); + VkRectLayerKHR rect_layer; + VkPresentRegionKHR present_region; + VkPresentRegionsKHR present_regions; + if (is_incremental_present_supported_) { + rect_layer.offset = {rect.x(), rect.y()}; + rect_layer.extent = {rect.width(), rect.height()}; + rect_layer.layer = 0; + + present_region.rectangleCount = 1; + present_region.pRectangles = &rect_layer; + + present_regions.sType = VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR; + present_regions.swapchainCount = 1; + present_regions.pRegions = &present_region; + + present_info.pNext = &present_regions; + } + result = vkQueuePresentKHR(queue, &present_info); if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR) { DLOG(ERROR) << "vkQueuePresentKHR() failed: " << result;
diff --git a/gpu/vulkan/vulkan_swap_chain.h b/gpu/vulkan/vulkan_swap_chain.h index 68a38c5..4ef4c6ea 100644 --- a/gpu/vulkan/vulkan_swap_chain.h +++ b/gpu/vulkan/vulkan_swap_chain.h
@@ -14,6 +14,7 @@ #include "base/logging.h" #include "base/optional.h" #include "gpu/vulkan/vulkan_export.h" +#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/swap_result.h" @@ -73,7 +74,7 @@ void Destroy(); // Present the current buffer. - gfx::SwapResult PresentBuffer(); + gfx::SwapResult PresentBuffer(const gfx::Rect& rect); uint32_t num_images() const { return static_cast<uint32_t>(images_.size()); } const gfx::Size& size() const { return size_; } @@ -100,7 +101,8 @@ bool AcquireNextImage(); bool use_protected_memory_ = false; - VulkanDeviceQueue* device_queue_; + VulkanDeviceQueue* device_queue_ = nullptr; + bool is_incremental_present_supported_ = false; VkSwapchainKHR swap_chain_ = VK_NULL_HANDLE; std::unique_ptr<VulkanCommandPool> command_pool_;
diff --git a/gpu/vulkan/x/vulkan_implementation_x11.cc b/gpu/vulkan/x/vulkan_implementation_x11.cc index 31cb990..757a4e1 100644 --- a/gpu/vulkan/x/vulkan_implementation_x11.cc +++ b/gpu/vulkan/x/vulkan_implementation_x11.cc
@@ -131,7 +131,7 @@ std::vector<const char*> VulkanImplementationX11::GetOptionalDeviceExtensions() { - return {}; + return {VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME}; } VkFence VulkanImplementationX11::CreateVkFenceForGpuFence(VkDevice vk_device) {
diff --git a/ios/chrome/app/main_controller.mm b/ios/chrome/app/main_controller.mm index cac7cb3..1d6c756 100644 --- a/ios/chrome/app/main_controller.mm +++ b/ios/chrome/app/main_controller.mm
@@ -385,7 +385,6 @@ @implementation MainController // Defined by MainControllerGuts. -@synthesize dismissingTabSwitcher = _dismissingTabSwitcher; @synthesize restoreHelper = _restoreHelper; // Defined by public protocols. @@ -396,7 +395,6 @@ @synthesize isColdStart = _isColdStart; @synthesize startupParameters = _startupParameters; @synthesize appLaunchTime = _appLaunchTime; -@synthesize tabSwitcherIsActive; #pragma mark - Application lifecycle @@ -1164,7 +1162,10 @@ } - (ChromeBrowserState*)currentBrowserState { - return self.currentBVC.browserState; + if (!self.interfaceProvider.currentInterface.browser) { + return nullptr; + } + return self.interfaceProvider.currentInterface.browser->GetBrowserState(); } - (bool)mustShowRestoreInfobar { @@ -1206,12 +1207,6 @@ -#pragma mark - SceneController plumbing - -- (BOOL)currentPageIsIncognito { - return [self currentBrowserState] -> IsOffTheRecord(); -} - #pragma mark - BrowsingDataCommands - (void)removeBrowsingDataForBrowserState:(ChromeBrowserState*)browserState @@ -1280,6 +1275,10 @@ @implementation MainController (TestingOnly) +- (BOOL)tabSwitcherActive { + return self.sceneController.isTabSwitcherActive; +} + - (void)dismissModalDialogsWithCompletion:(ProceduralBlock)completion dismissOmnibox:(BOOL)dismissOmnibox { [self.sceneController dismissModalDialogsWithCompletion:completion @@ -1298,10 +1297,6 @@ return self.sceneController.tabSwitcher; } -- (void)setTabSwitcherActive:(BOOL)active { - self.tabSwitcherIsActive = active; -} - - (void)setStartupParametersWithURL:(const GURL&)launchURL { NSString* sourceApplication = @"Fake App"; self.startupParameters = [ChromeAppStartupParameters
diff --git a/ios/chrome/app/main_controller_guts.h b/ios/chrome/app/main_controller_guts.h index 2eab0711..bd9115b8 100644 --- a/ios/chrome/app/main_controller_guts.h +++ b/ios/chrome/app/main_controller_guts.h
@@ -16,23 +16,13 @@ #import "ios/chrome/browser/ui/commands/browsing_data_commands.h" @class AppState; -@class BrowserViewController; class ChromeBrowserState; -@class TabGridCoordinator; -@protocol BrowserInterfaceProvider; // TODO(crbug.com/1012697): Remove this protocol when SceneController is // operational. Move the private internals back into MainController, and pass // ownership of Scene-related objects to SceneController. @protocol MainControllerGuts <StartupInformation, BrowsingDataCommands> -// If YES, the tab switcher is currently active. -@property(nonatomic, assign, getter=isTabSwitcherActive) - BOOL tabSwitcherIsActive; - -// YES while animating the dismissal of tab switcher. -@property(nonatomic, assign) BOOL dismissingTabSwitcher; - // Parameters received at startup time when the app is launched from another // app. @property(nonatomic, strong) AppStartupParameters* startupParameters; @@ -40,13 +30,7 @@ // Keeps track of the restore state during startup. @property(nonatomic, strong) CrashRestoreHelper* restoreHelper; -- (TabModel*)currentTabModel; - (ChromeBrowserState*)mainBrowserState; -- (ChromeBrowserState*)currentBrowserState; -- (BrowserViewController*)currentBVC; -- (BrowserViewController*)mainBVC; -- (BrowserViewController*)otrBVC; -- (id<BrowserInterfaceProvider>)interfaceProvider; - (UIWindow*)window; - (NSDictionary*)launchOptions; - (AppState*)appState;
diff --git a/ios/chrome/app/main_controller_private.h b/ios/chrome/app/main_controller_private.h index 6c12608..322f339 100644 --- a/ios/chrome/app/main_controller_private.h +++ b/ios/chrome/app/main_controller_private.h
@@ -29,7 +29,7 @@ @property(nonatomic, readonly) DeviceSharingManager* deviceSharingManager; // Tab switcher state. -@property(nonatomic, getter=isTabSwitcherActive) BOOL tabSwitcherActive; +- (BOOL)tabSwitcherActive; @property(nonatomic, strong) id<TabSwitcher> tabSwitcher;
diff --git a/ios/chrome/browser/BUILD.gn b/ios/chrome/browser/BUILD.gn index 3274c4d..b7e2883 100644 --- a/ios/chrome/browser/BUILD.gn +++ b/ios/chrome/browser/BUILD.gn
@@ -205,6 +205,7 @@ "//components/open_from_clipboard", "//components/prefs", "//components/rappor", + "//components/safe_browsing/core:features", "//components/sessions", "//components/translate/core/browser", "//components/ukm", @@ -231,6 +232,7 @@ "//ios/chrome/browser/policy", "//ios/chrome/browser/prefs", "//ios/chrome/browser/prefs:browser_prefs", + "//ios/chrome/browser/safe_browsing", "//ios/chrome/browser/send_tab_to_self", "//ios/chrome/browser/translate", "//ios/chrome/browser/update_client",
diff --git a/ios/chrome/browser/DEPS b/ios/chrome/browser/DEPS index ead6ec2..80c4d47 100644 --- a/ios/chrome/browser/DEPS +++ b/ios/chrome/browser/DEPS
@@ -66,6 +66,7 @@ "+components/rappor", "+components/reading_list", "+components/rlz", + "+components/safe_browsing", "+components/search", "+components/search_engines", "+components/search_provider_logos", @@ -117,6 +118,7 @@ "+services/metrics/public", "+services/metrics/public/cpp", "+services/network/network_change_manager.h", + "+services/network/network_context.h", "+services/network/public/mojom", "+services/network/public/cpp", "+third_party/breakpad/breakpad/src/client/ios",
diff --git a/ios/chrome/browser/application_context.h b/ios/chrome/browser/application_context.h index fcbb243..000d44d 100644 --- a/ios/chrome/browser/application_context.h +++ b/ios/chrome/browser/application_context.h
@@ -67,6 +67,7 @@ class BrowserPolicyConnectorIOS; class IOSChromeIOThread; class PrefService; +class SafeBrowsingService; // Gets the global application context. Cannot return null. ApplicationContext* GetApplicationContext(); @@ -144,6 +145,9 @@ virtual component_updater::ComponentUpdateService* GetComponentUpdateService() = 0; + // Gets the SafeBrowsingService. + virtual SafeBrowsingService* GetSafeBrowsingService() = 0; + // Returns the NetworkConnectionTracker instance for this ApplicationContext. virtual network::NetworkConnectionTracker* GetNetworkConnectionTracker() = 0;
diff --git a/ios/chrome/browser/application_context_impl.cc b/ios/chrome/browser/application_context_impl.cc index a9e6266..02b33e7 100644 --- a/ios/chrome/browser/application_context_impl.cc +++ b/ios/chrome/browser/application_context_impl.cc
@@ -33,6 +33,7 @@ #include "components/network_time/network_time_tracker.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" +#include "components/safe_browsing/core/features.h" #include "components/sessions/core/session_id_generator.h" #include "components/translate/core/browser/translate_download_manager.h" #include "components/ukm/ukm_service.h" @@ -57,6 +58,7 @@ #include "ios/chrome/browser/pref_names.h" #include "ios/chrome/browser/prefs/browser_prefs.h" #include "ios/chrome/browser/prefs/ios_chrome_pref_service_factory.h" +#include "ios/chrome/browser/safe_browsing/safe_browsing_service.h" #include "ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.h" #include "ios/chrome/common/channel_info.h" #include "ios/web/public/thread/web_task_traits.h" @@ -160,6 +162,9 @@ net_export_file_writer_.reset(); + if (safe_browsing_service_) + safe_browsing_service_->ShutDown(); + // Need to clear browser states before the IO thread. chrome_browser_state_manager_.reset(); @@ -382,6 +387,16 @@ return component_updater_.get(); } +SafeBrowsingService* ApplicationContextImpl::GetSafeBrowsingService() { + DCHECK(thread_checker_.CalledOnValidThread()); + if (base::FeatureList::IsEnabled( + safe_browsing::kSafeBrowsingAvailableOnIOS) && + !safe_browsing_service_) { + safe_browsing_service_ = base::MakeRefCounted<SafeBrowsingService>(); + } + return safe_browsing_service_.get(); +} + network::NetworkConnectionTracker* ApplicationContextImpl::GetNetworkConnectionTracker() { if (!network_connection_tracker_) {
diff --git a/ios/chrome/browser/application_context_impl.h b/ios/chrome/browser/application_context_impl.h index da0b548a..5cd6926 100644 --- a/ios/chrome/browser/application_context_impl.h +++ b/ios/chrome/browser/application_context_impl.h
@@ -70,6 +70,7 @@ gcm::GCMDriver* GetGCMDriver() override; component_updater::ComponentUpdateService* GetComponentUpdateService() override; + SafeBrowsingService* GetSafeBrowsingService() override; network::NetworkConnectionTracker* GetNetworkConnectionTracker() override; BrowserPolicyConnectorIOS* GetBrowserPolicyConnector() override; @@ -113,6 +114,8 @@ std::unique_ptr<network::NetworkConnectionTracker> network_connection_tracker_; + scoped_refptr<SafeBrowsingService> safe_browsing_service_; + bool was_last_shutdown_clean_; DISALLOW_COPY_AND_ASSIGN(ApplicationContextImpl);
diff --git a/ios/chrome/browser/ios_chrome_main_parts.mm b/ios/chrome/browser/ios_chrome_main_parts.mm index 74aa943f..ff960e9 100644 --- a/ios/chrome/browser/ios_chrome_main_parts.mm +++ b/ios/chrome/browser/ios_chrome_main_parts.mm
@@ -27,6 +27,7 @@ #include "components/prefs/json_pref_store.h" #include "components/prefs/pref_service.h" #include "components/rappor/rappor_service_impl.h" +#include "components/safe_browsing/core/features.h" #include "components/translate/core/browser/translate_download_manager.h" #include "components/ukm/ios/features.h" #include "components/variations/field_trial_config/field_trial_util.h" @@ -45,6 +46,7 @@ #include "ios/chrome/browser/metrics/ios_expired_histograms_array.h" #include "ios/chrome/browser/open_from_clipboard/create_clipboard_recent_content.h" #include "ios/chrome/browser/pref_names.h" +#include "ios/chrome/browser/safe_browsing/safe_browsing_service.h" #include "ios/chrome/browser/translate/translate_service_ios.h" #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" #include "ios/web/public/thread/web_task_traits.h" @@ -199,6 +201,17 @@ last_used_browser_state->GetPrefs()); variations_service->PerformPreMainMessageLoopStartup(); } + + if (base::FeatureList::IsEnabled( + safe_browsing::kSafeBrowsingAvailableOnIOS)) { + // Ensure that Safe Browsing is initialized. + SafeBrowsingService* safe_browsing_service = + application_context_->GetSafeBrowsingService(); + base::FilePath user_data_path; + CHECK(base::PathService::Get(ios::DIR_USER_DATA, &user_data_path)); + safe_browsing_service->Initialize(last_used_browser_state->GetPrefs(), + user_data_path); + } } void IOSChromeMainParts::PostMainMessageLoopRun() {
diff --git a/ios/chrome/browser/passwords/BUILD.gn b/ios/chrome/browser/passwords/BUILD.gn index 1b1abb94..22915a1 100644 --- a/ios/chrome/browser/passwords/BUILD.gn +++ b/ios/chrome/browser/passwords/BUILD.gn
@@ -167,6 +167,7 @@ "//base/test:test_support", "//components/autofill/core/common", "//components/autofill/ios/browser", + "//components/autofill/ios/form_util", "//components/password_manager/core/browser", "//components/password_manager/core/browser:test_support", "//components/password_manager/core/browser/leak_detection:leak_detection_interface_headers",
diff --git a/ios/chrome/browser/passwords/password_controller.mm b/ios/chrome/browser/passwords/password_controller.mm index d033fdc..f53230cf 100644 --- a/ios/chrome/browser/passwords/password_controller.mm +++ b/ios/chrome/browser/passwords/password_controller.mm
@@ -29,6 +29,7 @@ #include "components/autofill/core/common/password_form_generation_data.h" #include "components/autofill/ios/browser/autofill_util.h" #import "components/autofill/ios/form_util/form_activity_observer_bridge.h" +#include "components/autofill/ios/form_util/form_activity_params.h" #include "components/infobars/core/infobar_manager.h" #include "components/password_manager/core/browser/password_bubble_experiment.h" #include "components/password_manager/core/browser/password_generation_frame_helper.h" @@ -75,6 +76,7 @@ #error "This file requires ARC support." #endif +using autofill::FormActivityObserverBridge; using autofill::FormData; using autofill::PasswordFormGenerationData; using autofill::PasswordForm; @@ -136,7 +138,9 @@ @end -@interface PasswordController ()<FormSuggestionProvider, PasswordFormFiller> +@interface PasswordController () <FormSuggestionProvider, + PasswordFormFiller, + FormActivityObserver> // Informs the |_passwordManager| of the password forms (if any were present) // that have been found on the page. @@ -179,6 +183,9 @@ // Bridge to observe WebState from Objective-C. std::unique_ptr<web::WebStateObserverBridge> _webStateObserverBridge; + // Bridge to observe form activity in |_webState|. + std::unique_ptr<FormActivityObserverBridge> _formActivityObserverBridge; + // Timer for hiding "Signing in as ..." notification. base::OneShotTimer _notifyAutoSigninTimer; @@ -208,6 +215,8 @@ _webStateObserverBridge = std::make_unique<web::WebStateObserverBridge>(self); _webState->AddObserver(_webStateObserverBridge.get()); + _formActivityObserverBridge = + std::make_unique<FormActivityObserverBridge>(_webState, self); _formHelper = [[PasswordFormHelper alloc] initWithWebState:webState delegate:self]; _suggestionHelper = @@ -330,6 +339,7 @@ if (_webState) { _webState->RemoveObserver(_webStateObserverBridge.get()); _webStateObserverBridge.reset(); + _formActivityObserverBridge.reset(); _webState = nullptr; } _passwordManagerDriver.reset(); @@ -969,4 +979,26 @@ completionHandler:generatedPasswordInjected]; } +#pragma mark - FormActivityObserver + +- (void)webState:(web::WebState*)webState + didRegisterFormActivity:(const autofill::FormActivityParams&)params + inFrame:(web::WebFrame*)frame { + DCHECK_EQ(_webState, webState); + + if (!GetPageURLAndCheckTrustLevel(webState, nullptr)) + return; + + if (!frame || !frame->CanCallJavaScriptFunction()) + return; + + // Return early if |params| is not complete or if forms are not changed. + if (params.input_missing || params.type != "form_changed") + return; + + // If there's a change in password forms on a page, they should be parsed + // again. + [self findPasswordFormsAndSendThemToPasswordStore]; +} + @end
diff --git a/ios/chrome/browser/passwords/password_controller_unittest.mm b/ios/chrome/browser/passwords/password_controller_unittest.mm index 2c80db03..4c3a1cf5 100644 --- a/ios/chrome/browser/passwords/password_controller_unittest.mm +++ b/ios/chrome/browser/passwords/password_controller_unittest.mm
@@ -21,8 +21,10 @@ #include "components/autofill/core/browser/logging/log_buffer_submitter.h" #include "components/autofill/core/browser/logging/log_manager.h" #include "components/autofill/core/common/password_form_fill_data.h" +#include "components/autofill/ios/form_util/form_activity_params.h" #include "components/password_manager/core/browser/mock_password_store.h" #include "components/password_manager/core/browser/password_form_manager.h" +#include "components/password_manager/core/browser/password_manager.h" #include "components/password_manager/core/browser/password_store_consumer.h" #include "components/password_manager/core/browser/stub_password_manager_client.h" #include "components/password_manager/core/common/password_manager_pref_names.h" @@ -188,8 +190,9 @@ } // namespace -@interface PasswordController ( - Testing)<CRWWebStateObserver, FormSuggestionProvider> +@interface PasswordController (Testing) <CRWWebStateObserver, + FormSuggestionProvider, + FormActivityObserver> // Provides access to common form helper logic for testing with mocks. @property(readonly) PasswordFormHelper* formHelper; @@ -1780,3 +1783,29 @@ // Simulate a failed submission by loading the same form again. LoadHtml(SysUTF8ToNSString(kHtml)); } + +// Tests that a form that is dynamically added to the page is found and +// that a form manager is created for it. +TEST_F(PasswordControllerTest, FindDynamicallyAddedForm2) { + LoadHtml(kHtmlWithoutPasswordForm); + ExecuteJavaScript(kAddFormDynamicallyScript); + + std::string mainFrameID = web::GetMainWebFrameId(web_state()); + web::WebFrame* frame = web::GetWebFrameWithId(web_state(), mainFrameID); + autofill::FormActivityParams params; + params.type = "form_changed"; + params.frame_id = mainFrameID; + + [passwordController_ webState:web_state() + didRegisterFormActivity:params + inFrame:frame]; + + auto& form_managers = passwordController_.passwordManager->form_managers(); + EXPECT_TRUE(WaitUntilConditionOrTimeout(kWaitForActionTimeout, ^bool() { + return !form_managers.empty(); + })); + + ASSERT_EQ(1u, form_managers.size()); + auto& password_form = form_managers[0]->observed_form(); + EXPECT_EQ(ASCIIToUTF16("dynamic_form"), password_form.name); +}
diff --git a/ios/chrome/browser/prefs/BUILD.gn b/ios/chrome/browser/prefs/BUILD.gn index e0749ee..c56318a 100644 --- a/ios/chrome/browser/prefs/BUILD.gn +++ b/ios/chrome/browser/prefs/BUILD.gn
@@ -55,6 +55,7 @@ "//components/prefs", "//components/proxy_config", "//components/rappor", + "//components/safe_browsing/core/common:safe_browsing_prefs", "//components/search_engines", "//components/sessions", "//components/signin/public/identity_manager",
diff --git a/ios/chrome/browser/prefs/browser_prefs.mm b/ios/chrome/browser/prefs/browser_prefs.mm index 054cdac..5807c99 100644 --- a/ios/chrome/browser/prefs/browser_prefs.mm +++ b/ios/chrome/browser/prefs/browser_prefs.mm
@@ -35,6 +35,7 @@ #include "components/prefs/pref_service.h" #include "components/proxy_config/pref_proxy_config_tracker_impl.h" #include "components/rappor/rappor_service_impl.h" +#include "components/safe_browsing/core/common/safe_browsing_prefs.h" #include "components/search_engines/template_url_prepopulate_data.h" #include "components/sessions/core/session_id_generator.h" #include "components/signin/public/base/signin_pref_names.h" @@ -157,6 +158,7 @@ payments::RegisterProfilePrefs(registry); PrefProxyConfigTrackerImpl::RegisterProfilePrefs(registry); RegisterVoiceSearchBrowserStatePrefs(registry); + safe_browsing::RegisterProfilePrefs(registry); sync_sessions::SessionSyncPrefs::RegisterProfilePrefs(registry); syncer::DeviceInfoPrefs::RegisterProfilePrefs(registry); syncer::InvalidatorRegistrarWithMemory::RegisterProfilePrefs(registry);
diff --git a/ios/chrome/browser/safe_browsing/BUILD.gn b/ios/chrome/browser/safe_browsing/BUILD.gn new file mode 100644 index 0000000..6a9d142 --- /dev/null +++ b/ios/chrome/browser/safe_browsing/BUILD.gn
@@ -0,0 +1,56 @@ +# 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/build/config.gni") +import("//ios/features.gni") + +source_set("safe_browsing") { + sources = [ + "safe_browsing_service.h", + "safe_browsing_service.mm", + ] + + deps = [ + "//base", + "//build:branding_buildflags", + "//components/prefs", + "//components/safe_browsing/core/browser", + "//components/safe_browsing/core/common", + "//components/safe_browsing/core/db", + "//components/safe_browsing/core/db:v4_local_database_manager", + "//ios/net", + "//ios/web/public", + "//ios/web/public/init", + "//mojo/public/cpp/bindings", + "//services/network:network_service", + "//services/network/public/cpp", + "//services/network/public/mojom", + ] + + configs += [ "//build/config/compiler:enable_arc" ] +} + +source_set("unit_tests") { + testonly = true + sources = [ "safe_browsing_service_unittest.mm" ] + + deps = [ + ":safe_browsing", + "//components/prefs:test_support", + "//components/safe_browsing/core/db", + "//components/safe_browsing/core/db:database_manager", + "//components/safe_browsing/core/db:metadata_proto", + "//components/safe_browsing/core/db:util", + "//components/safe_browsing/core/db:v4_database", + "//components/safe_browsing/core/db:v4_get_hash_protocol_manager", + "//components/safe_browsing/core/db:v4_protocol_manager_util", + "//components/safe_browsing/core/db:v4_test_util", + "//ios/web/public", + "//ios/web/public/test", + "//services/network/public/cpp", + "//testing/gtest", + ] + + configs += [ "//build/config/compiler:enable_arc" ] +}
diff --git a/ios/chrome/browser/safe_browsing/safe_browsing_service.h b/ios/chrome/browser/safe_browsing/safe_browsing_service.h new file mode 100644 index 0000000..3ecb74e --- /dev/null +++ b/ios/chrome/browser/safe_browsing/safe_browsing_service.h
@@ -0,0 +1,150 @@ +// 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_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ +#define IOS_CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ + +#include "base/memory/ref_counted.h" +#include "ios/web/public/thread/web_thread.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/remote.h" +#include "services/network/network_context.h" +#include "services/network/public/mojom/url_loader_factory.mojom.h" + +class PrefChangeRegistrar; +class PrefService; + +namespace base { +class FilePath; +} + +namespace net { +class URLRequestContext; +} // namespace net + +namespace network { +class SharedURLLoaderFactory; +class WeakWrapperSharedURLLoaderFactory; +} // namespace network + +namespace safe_browsing { +class SafeBrowsingDatabaseManager; +} // namespace safe_browsing + +// Manages Safe Browsing related functionality. This class owns and provides +// support for constructing and initializing the Safe Browsing database. This +// class must be created and destroyed on the main thread. This class is +// RefCounted so that PostTask'd calls into this class can retain a reference +// to an instance. +class SafeBrowsingService + : public base::RefCountedThreadSafe<SafeBrowsingService, + web::WebThread::DeleteOnUIThread> { + public: + SafeBrowsingService(); + + // Called on the UI thread to initialize the service. + void Initialize(PrefService* prefs, const base::FilePath& user_data_path); + + // Called on the UI thread to terminate the service. This must be called + // before the IO thread is torn down. + void ShutDown(); + + // Returns the SafeBrowsingDatabaseManager owned by this service. + safe_browsing::SafeBrowsingDatabaseManager* GetDatabaseManager(); + + private: + friend struct web::WebThread::DeleteOnThread<web::WebThread::UI>; + friend class base::DeleteHelper<SafeBrowsingService>; + + // A helper class for enabling/disabling Safe Browsing and maintaining state + // on the IO thread. This class may be constructed and destroyed on the UI + // thread, but all of its other methods should only be called on the IO + // thread. + class IOThreadEnabler : public base::RefCountedThreadSafe<IOThreadEnabler> { + public: + IOThreadEnabler(scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> + database_manager); + + // Creates the network context and URL loader factory used by the + // SafeBrowsingDatabaseManager. + void Initialize(scoped_refptr<SafeBrowsingService> safe_browsing_service, + mojo::PendingReceiver<network::mojom::NetworkContext> + network_context_receiver); + + // Disables Safe Browsing, and destroys the network context and URL loader + // factory used by the SafeBrowsingDatabaseManager. + void ShutDown(); + + // Enables or disables Safe Browsing database updates and lookups. + void SetSafeBrowsingEnabled(bool enabled); + + private: + friend base::RefCountedThreadSafe<IOThreadEnabler>; + ~IOThreadEnabler(); + + // Starts the SafeBrowsingDatabaseManager, making it ready to accept + // queries. + void StartSafeBrowsingDBManager(); + + // Constructs a URLRequestContext. + void SetUpURLRequestContext(); + + // Constructs a SharedURLLoaderFactory. + void SetUpURLLoaderFactory( + scoped_refptr<SafeBrowsingService> safe_browsing_service); + + // This tracks whether the service is running. + bool enabled_ = false; + + // This tracks whether ShutDown() has been called. + bool shutting_down_ = false; + + // This is wrapped by |network_context|. + std::unique_ptr<net::URLRequestContext> url_request_context_; + + // The network context used for Safe Browsing related network requests. + std::unique_ptr<network::NetworkContext> network_context_; + + // An IO thread remote for a URLLoaderFactory created on the UI thread. + mojo::Remote<network::mojom::URLLoaderFactory> url_loader_factory_; + + // A SharedURLLoaderFactory that wraps |url_loader_factory_|. + scoped_refptr<network::WeakWrapperSharedURLLoaderFactory> + shared_url_loader_factory_; + + // The database manager used for Safe Browsing queries. + scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> + safe_browsing_db_manager_; + + DISALLOW_COPY_AND_ASSIGN(IOThreadEnabler); + }; + + ~SafeBrowsingService(); + + // Called on the UI thread to construct a URLLoaderFactory that is used on + // the IO thread. + void SetUpURLLoaderFactory( + mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver); + + // Enables or disables Safe Browsing, depending on the current state of + // preferences. + void UpdateSafeBrowsingEnabledState(); + // This is the UI thread remote for IOThreadState's network context. + mojo::Remote<network::mojom::NetworkContext> network_context_client_; + + // Constructed on the UI thread, but otherwise its methods are only called on + // the IO thread. + scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> + safe_browsing_db_manager_; + + // This watches for changes to the Safe Browsing opt-out preference. + std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; + + // Encapsulates methods and objects that are used on the IO thread. + scoped_refptr<IOThreadEnabler> io_thread_enabler_; + + DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService); +}; + +#endif // IOS_CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
diff --git a/ios/chrome/browser/safe_browsing/safe_browsing_service.mm b/ios/chrome/browser/safe_browsing/safe_browsing_service.mm new file mode 100644 index 0000000..f31366b --- /dev/null +++ b/ios/chrome/browser/safe_browsing/safe_browsing_service.mm
@@ -0,0 +1,182 @@ +// 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 "ios/chrome/browser/safe_browsing/safe_browsing_service.h" + +#include "base/bind.h" +#include "base/files/file_path.h" +#include "base/path_service.h" +#include "base/task/post_task.h" +#include "build/branding_buildflags.h" +#include "components/prefs/pref_change_registrar.h" +#include "components/prefs/pref_service.h" +#include "components/safe_browsing/core/browser/url_checker_delegate.h" +#include "components/safe_browsing/core/common/safebrowsing_constants.h" +#include "components/safe_browsing/core/db/v4_local_database_manager.h" +#include "ios/web/public/thread/web_task_traits.h" +#include "net/url_request/url_request_context.h" +#include "net/url_request/url_request_context_builder.h" +#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +#pragma mark - SafeBrowsingService + +SafeBrowsingService::SafeBrowsingService() = default; + +SafeBrowsingService::~SafeBrowsingService() = default; + +void SafeBrowsingService::Initialize(PrefService* prefs, + const base::FilePath& user_data_path) { + DCHECK_CURRENTLY_ON(web::WebThread::UI); + + if (io_thread_enabler_) { + // Already initialized. + return; + } + + base::FilePath safe_browsing_data_path = + user_data_path.Append(safe_browsing::kSafeBrowsingBaseFilename); + safe_browsing_db_manager_ = safe_browsing::V4LocalDatabaseManager::Create( + safe_browsing_data_path, safe_browsing::ExtendedReportingLevelCallback()); + + io_thread_enabler_ = + base::MakeRefCounted<SafeBrowsingService::IOThreadEnabler>( + safe_browsing_db_manager_); + + base::PostTask( + FROM_HERE, {web::WebThread::IO}, + base::BindOnce(&SafeBrowsingService::IOThreadEnabler::Initialize, + io_thread_enabler_, base::WrapRefCounted(this), + network_context_client_.BindNewPipeAndPassReceiver())); + + // Watch for changes to the Safe Browsing opt-out preference. + pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>(); + pref_change_registrar_->Init(prefs); + pref_change_registrar_->Add( + prefs::kSafeBrowsingEnabled, + base::Bind(&SafeBrowsingService::UpdateSafeBrowsingEnabledState, + base::Unretained(this))); + UpdateSafeBrowsingEnabledState(); +} + +void SafeBrowsingService::ShutDown() { + DCHECK_CURRENTLY_ON(web::WebThread::UI); + + pref_change_registrar_.reset(); + base::PostTask(FROM_HERE, {web::WebThread::IO}, + base::BindOnce(&SafeBrowsingService::IOThreadEnabler::ShutDown, + io_thread_enabler_)); + network_context_client_.reset(); +} + +safe_browsing::SafeBrowsingDatabaseManager* +SafeBrowsingService::GetDatabaseManager() { + return safe_browsing_db_manager_.get(); +} + +void SafeBrowsingService::SetUpURLLoaderFactory( + mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver) { + DCHECK_CURRENTLY_ON(web::WebThread::UI); + auto url_loader_factory_params = + network::mojom::URLLoaderFactoryParams::New(); + url_loader_factory_params->process_id = network::mojom::kBrowserProcessId; + url_loader_factory_params->is_corb_enabled = false; + network_context_client_->CreateURLLoaderFactory( + std::move(receiver), std::move(url_loader_factory_params)); +} + +void SafeBrowsingService::UpdateSafeBrowsingEnabledState() { + bool enabled = + pref_change_registrar_->prefs()->GetBoolean(prefs::kSafeBrowsingEnabled); + base::PostTask( + FROM_HERE, {web::WebThread::IO}, + base::BindOnce( + &SafeBrowsingService::IOThreadEnabler::SetSafeBrowsingEnabled, + io_thread_enabler_, enabled)); +} + +#pragma mark - SafeBrowsingService::IOThreadEnabler + +SafeBrowsingService::IOThreadEnabler::IOThreadEnabler( + scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager) + : safe_browsing_db_manager_(database_manager) {} + +SafeBrowsingService::IOThreadEnabler::~IOThreadEnabler() = default; + +void SafeBrowsingService::IOThreadEnabler::Initialize( + scoped_refptr<SafeBrowsingService> safe_browsing_service, + mojo::PendingReceiver<network::mojom::NetworkContext> + network_context_receiver) { + SetUpURLRequestContext(); + std::vector<std::string> cors_exempt_header_list; + network_context_ = std::make_unique<network::NetworkContext>( + /*network_service=*/nullptr, std::move(network_context_receiver), + url_request_context_.get(), cors_exempt_header_list); + SetUpURLLoaderFactory(safe_browsing_service); +} + +void SafeBrowsingService::IOThreadEnabler::ShutDown() { + DCHECK_CURRENTLY_ON(web::WebThread::IO); + shutting_down_ = true; + SetSafeBrowsingEnabled(false); + url_loader_factory_.reset(); + network_context_.reset(); + shared_url_loader_factory_.reset(); + url_request_context_.reset(); +} + +void SafeBrowsingService::IOThreadEnabler::SetSafeBrowsingEnabled( + bool enabled) { + DCHECK_CURRENTLY_ON(web::WebThread::IO); + if (enabled_ == enabled) + return; + + enabled_ = enabled; + if (enabled_) + StartSafeBrowsingDBManager(); + else + safe_browsing_db_manager_->StopOnIOThread(shutting_down_); +} + +void SafeBrowsingService::IOThreadEnabler::StartSafeBrowsingDBManager() { + DCHECK_CURRENTLY_ON(web::WebThread::IO); + + std::string client_name; +#if BUILDFLAG(GOOGLE_CHROME_BRANDING) + client_name = "googlechrome"; +#else + client_name = "chromium"; +#endif + + safe_browsing::V4ProtocolConfig config = safe_browsing::GetV4ProtocolConfig( + client_name, /*disable_auto_update=*/false); + + safe_browsing_db_manager_->StartOnIOThread(shared_url_loader_factory_, + config); +} + +void SafeBrowsingService::IOThreadEnabler::SetUpURLRequestContext() { + DCHECK_CURRENTLY_ON(web::WebThread::IO); + + // This uses an in-memory non-persistent cookie store. The Safe Browsing V4 + // Update API does not depend on cookies. + net::URLRequestContextBuilder builder; + url_request_context_ = builder.Build(); +} + +void SafeBrowsingService::IOThreadEnabler::SetUpURLLoaderFactory( + scoped_refptr<SafeBrowsingService> safe_browsing_service) { + DCHECK_CURRENTLY_ON(web::WebThread::IO); + base::PostTask( + FROM_HERE, {web::WebThread::UI}, + base::BindOnce(&SafeBrowsingService::SetUpURLLoaderFactory, + safe_browsing_service, + url_loader_factory_.BindNewPipeAndPassReceiver())); + shared_url_loader_factory_ = + base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( + url_loader_factory_.get()); +}
diff --git a/ios/chrome/browser/safe_browsing/safe_browsing_service_unittest.mm b/ios/chrome/browser/safe_browsing/safe_browsing_service_unittest.mm new file mode 100644 index 0000000..ee801fee --- /dev/null +++ b/ios/chrome/browser/safe_browsing/safe_browsing_service_unittest.mm
@@ -0,0 +1,204 @@ +// Copyright (c) 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 "ios/chrome/browser/safe_browsing/safe_browsing_service.h" + +#include "base/files/scoped_temp_dir.h" +#include "base/path_service.h" +#include "base/run_loop.h" +#include "base/task/post_task.h" +#include "components/prefs/testing_pref_service.h" +#include "components/safe_browsing/core/common/safe_browsing_prefs.h" +#include "components/safe_browsing/core/db/database_manager.h" +#include "components/safe_browsing/core/db/metadata.pb.h" +#include "components/safe_browsing/core/db/util.h" +#include "components/safe_browsing/core/db/v4_database.h" +#include "components/safe_browsing/core/db/v4_get_hash_protocol_manager.h" +#include "components/safe_browsing/core/db/v4_protocol_manager_util.h" +#include "components/safe_browsing/core/db/v4_test_util.h" +#include "ios/web/public/test/web_task_environment.h" +#include "ios/web/public/thread/web_task_traits.h" +#include "ios/web/public/thread/web_thread.h" +#include "testing/platform_test.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { + +const char kSafePage[] = "http://example.test/safe.html"; +const char kMalwarePage[] = "http://example.test/malware.html"; + +class TestSBClient : public base::RefCountedThreadSafe<TestSBClient>, + public safe_browsing::SafeBrowsingDatabaseManager::Client { + public: + TestSBClient(SafeBrowsingService* safe_browsing_service) + : result_pending_(false), + threat_type_(safe_browsing::SB_THREAT_TYPE_SAFE), + safe_browsing_service_(safe_browsing_service) {} + + safe_browsing::SBThreatType threat_type() const { return threat_type_; } + + std::string threat_hash() const { return threat_hash_; } + + void CheckUrl(const GURL& url) { + result_pending_ = true; + base::PostTask( + FROM_HERE, {web::WebThread::IO}, + base::BindOnce(&TestSBClient::CheckBrowseUrlOnIOThread, this, url)); + } + + bool result_pending() const { return result_pending_; } + + void WaitForResult() { + while (result_pending()) { + base::RunLoop().RunUntilIdle(); + } + } + + private: + friend class base::RefCountedThreadSafe<TestSBClient>; + ~TestSBClient() override {} + + void CheckBrowseUrlOnIOThread(const GURL& url) { + safe_browsing::SBThreatTypeSet threat_types = + safe_browsing::CreateSBThreatTypeSet( + {safe_browsing::SB_THREAT_TYPE_URL_PHISHING, + safe_browsing::SB_THREAT_TYPE_URL_MALWARE, + safe_browsing::SB_THREAT_TYPE_URL_UNWANTED, + safe_browsing::SB_THREAT_TYPE_BILLING}); + + // The async CheckDone() hook will not be called when we have a synchronous + // safe signal, so call it right away. + bool synchronous_safe_signal = + safe_browsing_service_->GetDatabaseManager()->CheckBrowseUrl( + url, threat_types, this); + if (synchronous_safe_signal) { + threat_type_ = safe_browsing::SB_THREAT_TYPE_SAFE; + base::PostTask(FROM_HERE, {web::WebThread::UI}, + base::BindOnce(&TestSBClient::CheckDone, this)); + } + } + + void OnCheckBrowseUrlResult( + const GURL& url, + safe_browsing::SBThreatType threat_type, + const safe_browsing::ThreatMetadata& metadata) override { + threat_type_ = threat_type; + base::PostTask(FROM_HERE, {web::WebThread::UI}, + base::BindOnce(&TestSBClient::CheckDone, this)); + } + + void CheckDone() { result_pending_ = false; } + + bool result_pending_; + safe_browsing::SBThreatType threat_type_; + std::string threat_hash_; + SafeBrowsingService* safe_browsing_service_; + + DISALLOW_COPY_AND_ASSIGN(TestSBClient); +}; + +} // namespace + +class SafeBrowsingServiceTest : public PlatformTest { + public: + SafeBrowsingServiceTest() { + safe_browsing::RegisterProfilePrefs(local_state_.registry()); + + store_factory_ = new safe_browsing::TestV4StoreFactory(); + safe_browsing::V4Database::RegisterStoreFactoryForTest( + base::WrapUnique(store_factory_)); + + v4_db_factory_ = new safe_browsing::TestV4DatabaseFactory(); + safe_browsing::V4Database::RegisterDatabaseFactoryForTest( + base::WrapUnique(v4_db_factory_)); + + v4_get_hash_factory_ = + new safe_browsing::TestV4GetHashProtocolManagerFactory(); + safe_browsing::V4GetHashProtocolManager::RegisterFactory( + base::WrapUnique(v4_get_hash_factory_)); + + safe_browsing_service_ = base::MakeRefCounted<SafeBrowsingService>(); + + CHECK(temp_dir_.CreateUniqueTempDir()); + safe_browsing_service_->Initialize(&local_state_, temp_dir_.GetPath()); + base::RunLoop().RunUntilIdle(); + } + + ~SafeBrowsingServiceTest() override { + safe_browsing_service_->ShutDown(); + + safe_browsing::V4GetHashProtocolManager::RegisterFactory(nullptr); + safe_browsing::V4Database::RegisterDatabaseFactoryForTest(nullptr); + safe_browsing::V4Database::RegisterStoreFactoryForTest(nullptr); + } + + void MarkUrlAsMalware(const GURL& bad_url) { + base::PostTask( + FROM_HERE, {web::WebThread::IO}, + base::BindOnce(&SafeBrowsingServiceTest::MarkUrlAsMalwareOnIOThread, + base::Unretained(this), bad_url)); + } + + protected: + web::WebTaskEnvironment task_environment_; + TestingPrefServiceSimple local_state_; + scoped_refptr<SafeBrowsingService> safe_browsing_service_; + + private: + void MarkUrlAsMalwareOnIOThread(const GURL& bad_url) { + safe_browsing::FullHashInfo full_hash_info = + safe_browsing::GetFullHashInfoWithMetadata( + bad_url, safe_browsing::GetUrlMalwareId(), + safe_browsing::ThreatMetadata()); + v4_db_factory_->MarkPrefixAsBad(safe_browsing::GetUrlMalwareId(), + full_hash_info.full_hash); + v4_get_hash_factory_->AddToFullHashCache(full_hash_info); + } + + base::ScopedTempDir temp_dir_; + + // Owned by V4Database. + safe_browsing::TestV4DatabaseFactory* v4_db_factory_; + // Owned by V4GetHashProtocolManager. + safe_browsing::TestV4GetHashProtocolManagerFactory* v4_get_hash_factory_; + // Owned by V4Database. + safe_browsing::TestV4StoreFactory* store_factory_; + + DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceTest); +}; + +TEST_F(SafeBrowsingServiceTest, SafeAndUnsafePages) { + // Verify that queries to the Safe Browsing database owned by + // SafeBrowsignServiceIOSImpl receive respones. + scoped_refptr<TestSBClient> client = + base::MakeRefCounted<TestSBClient>(safe_browsing_service_.get()); + + GURL safe_url = GURL(kSafePage); + client->CheckUrl(safe_url); + EXPECT_TRUE(client->result_pending()); + client->WaitForResult(); + EXPECT_FALSE(client->result_pending()); + EXPECT_EQ(client->threat_type(), safe_browsing::SB_THREAT_TYPE_SAFE); + + GURL unsafe_url = GURL(kMalwarePage); + MarkUrlAsMalware(unsafe_url); + + client->CheckUrl(unsafe_url); + EXPECT_TRUE(client->result_pending()); + client->WaitForResult(); + EXPECT_FALSE(client->result_pending()); + EXPECT_EQ(client->threat_type(), safe_browsing::SB_THREAT_TYPE_URL_MALWARE); + + // Disable Safe Browsing, and ensure that unsafe URLs are no longer flagged. + local_state_.SetUserPref(prefs::kSafeBrowsingEnabled, + std::make_unique<base::Value>(false)); + client->CheckUrl(unsafe_url); + EXPECT_TRUE(client->result_pending()); + client->WaitForResult(); + EXPECT_FALSE(client->result_pending()); + EXPECT_EQ(client->threat_type(), safe_browsing::SB_THREAT_TYPE_SAFE); +}
diff --git a/ios/chrome/browser/ui/authentication/signin/signin_coordinator.h b/ios/chrome/browser/ui/authentication/signin/signin_coordinator.h index 93c931d..65af37d 100644 --- a/ios/chrome/browser/ui/authentication/signin/signin_coordinator.h +++ b/ios/chrome/browser/ui/authentication/signin/signin_coordinator.h
@@ -15,8 +15,6 @@ class Browser; @class ChromeIdentity; -@protocol SyncPresenter; - // Called when the sign-in dialog is closed. // |result| is the sign-in result state. // |identity| is the identity chosen by the user during the sign-in.
diff --git a/ios/chrome/browser/ui/authentication/signin/user_signin/user_signin_view_controller.mm b/ios/chrome/browser/ui/authentication/signin/user_signin/user_signin_view_controller.mm index 93eeb2b1..952f7936 100644 --- a/ios/chrome/browser/ui/authentication/signin/user_signin/user_signin_view_controller.mm +++ b/ios/chrome/browser/ui/authentication/signin/user_signin/user_signin_view_controller.mm
@@ -115,7 +115,7 @@ #pragma mark - MDCActivityIndicator - (void)startAnimatingActivityIndicator { - [self addActivityIndicatorToView]; + [self addActivityIndicator]; [self.activityIndicator startAnimating]; } @@ -131,9 +131,9 @@ [super viewDidLoad]; self.view.backgroundColor = self.systemBackgroundColor; - [self addConfirmationButtonToView]; + [self addConfirmationButton]; [self embedUserConsentView]; - [self addSkipSigninButtonToView]; + [self addSkipSigninButton]; [self.view addSubview:self.gradientView]; @@ -229,8 +229,8 @@ #pragma mark - Subviews -// Sets up activity indicator properties and adds it to the view. -- (void)addActivityIndicatorToView { +// Sets up activity indicator properties and adds it to the user sign-in view. +- (void)addActivityIndicator { DCHECK(!self.activityIndicator); self.activityIndicator = [[MDCActivityIndicator alloc] initWithFrame:CGRectZero]; @@ -256,8 +256,8 @@ [self.unifiedConsentViewController didMoveToParentViewController:self]; } -// Sets up confirmation button properties and adds it to the view. -- (void)addConfirmationButtonToView { +// Sets up confirmation button properties and adds it to the user sign-in view. +- (void)addConfirmationButton { DCHECK(self.unifiedConsentViewController); self.confirmationButton = [[UIButton alloc] init]; self.confirmationButton.accessibilityIdentifier = @"ic_close"; @@ -270,8 +270,8 @@ kButtonTitleContentInset, kButtonTitleContentInset); } -// Sets up skip sign-in button properties and adds it to the view. -- (void)addSkipSigninButtonToView { +// Sets up skip sign-in button properties and adds it to the user sign-in view. +- (void)addSkipSigninButton { DCHECK(!self.skipSigninButton); DCHECK(self.unifiedConsentViewController); self.skipSigninButton = [[UIButton alloc] init];
diff --git a/ios/chrome/browser/ui/main/scene_controller.mm b/ios/chrome/browser/ui/main/scene_controller.mm index 59bf473..ec5b14f 100644 --- a/ios/chrome/browser/ui/main/scene_controller.mm +++ b/ios/chrome/browser/ui/main/scene_controller.mm
@@ -118,6 +118,10 @@ SettingsNavigationControllerDelegate, WebStateListObserving> +// The scene level component for url loading. Is passed down to +// browser state level UrlLoadingService instances. +@property(nonatomic, assign) AppUrlLoadingService* appURLLoadingService; + // A flag that keeps track of the UI initialization for the controlled scene. @property(nonatomic, assign) BOOL hasInitializedUI; @@ -169,6 +173,11 @@ // the main view controller. This property should not be accessed before the // browser has started up to the FOREGROUND stage. @property(nonatomic, strong) TabGridCoordinator* mainCoordinator; +// If YES, the tab switcher is currently active. +@property(nonatomic, assign, getter=isTabSwitcherActive) + BOOL tabSwitcherIsActive; +// YES while animating the dismissal of tab switcher. +@property(nonatomic, assign) BOOL dismissingTabSwitcher; @end @@ -216,19 +225,19 @@ } - (id<BrowserInterface>)mainInterface { - return self.mainController.interfaceProvider.mainInterface; + return self.browserViewWrangler.mainInterface; } - (id<BrowserInterface>)currentInterface { - return self.mainController.interfaceProvider.currentInterface; + return self.browserViewWrangler.currentInterface; } - (id<BrowserInterface>)incognitoInterface { - return self.mainController.interfaceProvider.incognitoInterface; + return self.browserViewWrangler.incognitoInterface; } - (id<BrowserInterfaceProvider>)interfaceProvider { - return self.mainController.interfaceProvider; + return self.browserViewWrangler; } - (BOOL)isSettingsViewPresented { @@ -355,8 +364,8 @@ tabModel = mainTabModel; [self setCurrentInterfaceForMode:ApplicationMode::NORMAL]; } - if (self.mainController.tabSwitcherIsActive) { - DCHECK(!self.mainController.dismissingTabSwitcher); + if (self.tabSwitcherIsActive) { + DCHECK(!self.dismissingTabSwitcher); [self beginDismissingTabSwitcherWithCurrentModel:self.mainInterface.tabModel focusOmnibox:NO]; [self finishDismissingTabSwitcher]; @@ -507,11 +516,11 @@ - (void)showHistory { self.historyCoordinator = [[HistoryCoordinator alloc] - initWithBaseViewController:self.mainController.currentBVC + initWithBaseViewController:self.currentInterface.bvc browser:self.mainInterface.browser]; self.historyCoordinator.loadStrategy = - [self currentPageIsIncognito] ? UrlLoadStrategy::ALWAYS_IN_INCOGNITO - : UrlLoadStrategy::NORMAL; + self.currentInterface.incognito ? UrlLoadStrategy::ALWAYS_IN_INCOGNITO + : UrlLoadStrategy::NORMAL; [self.historyCoordinator start]; } @@ -526,7 +535,7 @@ - (void)prepareTabSwitcher { web::WebState* currentWebState = - self.mainController.currentBVC.tabModel.webStateList->GetActiveWebState(); + self.currentInterface.browser->GetWebStateList()->GetActiveWebState(); if (currentWebState) { BOOL loading = currentWebState->IsLoading(); SnapshotTabHelper::FromWebState(currentWebState) @@ -554,9 +563,9 @@ } - (void)displayTabSwitcher { - DCHECK(!self.mainController.isTabSwitcherActive); + DCHECK(!self.tabSwitcherIsActive); if (!self.isProcessingVoiceSearchCommand) { - [self.mainController.currentBVC userEnteredTabSwitcher]; + [self.currentInterface.bvc userEnteredTabSwitcher]; [self showTabSwitcher]; self.isProcessingTabSwitcherCommand = YES; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, @@ -712,12 +721,12 @@ (UIViewController*)baseViewController { DCHECK(!self.signinInteractionCoordinator.isSettingsViewPresented); if (!baseViewController) { - DCHECK_EQ(self.mainController.currentBVC, + DCHECK_EQ(self.currentInterface.bvc, self.mainCoordinator.activeViewController); - baseViewController = self.mainController.currentBVC; + baseViewController = self.currentInterface.bvc; } - if ([self.mainController currentBrowserState] -> IsOffTheRecord()) { + if (self.currentInterface.incognito) { NOTREACHED(); return; } @@ -741,9 +750,9 @@ (UIViewController*)baseViewController { DCHECK(!self.signinInteractionCoordinator.isSettingsViewPresented); if (!baseViewController) { - DCHECK_EQ(self.mainController.currentBVC, + DCHECK_EQ(self.currentInterface.bvc, self.mainCoordinator.activeViewController); - baseViewController = self.mainController.currentBVC; + baseViewController = self.currentInterface.bvc; } if (self.settingsNavigationController) { @@ -789,7 +798,7 @@ if (!baseViewController) { // TODO(crbug.com/779791): Don't pass base view controller through // dispatched command. - baseViewController = [self.mainController currentBVC]; + baseViewController = self.currentInterface.bvc; } DCHECK(!self.signinInteractionCoordinator.isSettingsViewPresented); if (self.settingsNavigationController) { @@ -862,11 +871,15 @@ #pragma mark - UserFeedbackDataSource +- (BOOL)currentPageIsIncognito { + return self.currentInterface.incognito; +} + - (NSString*)currentPageDisplayURL { - if (self.mainController.tabSwitcherIsActive) + if (self.tabSwitcherIsActive) return nil; web::WebState* webState = - self.mainController.currentTabModel.webStateList->GetActiveWebState(); + self.currentInterface.browser->GetWebStateList()->GetActiveWebState(); if (!webState) return nil; // Returns URL of browser tab that is currently showing. @@ -881,13 +894,13 @@ CGFloat scale = 0.0; // For screenshots of the tab switcher we need to use a scale of 1.0 to avoid // spending too much time since the tab switcher can have lots of subviews. - if (self.mainController.tabSwitcherIsActive) + if (self.tabSwitcherIsActive) scale = 1.0; return CaptureView(lastView, scale); } - (NSString*)currentPageSyncedUserName { - ChromeBrowserState* browserState = self.mainController.currentBrowserState; + ChromeBrowserState* browserState = self.currentBrowserState; if (browserState->IsOffTheRecord()) return nil; signin::IdentityManager* identity_manager = @@ -896,10 +909,6 @@ return username.empty() ? nil : base::SysUTF8ToNSString(username); } -- (BOOL)currentPageIsIncognito { - return self.mainController.currentBrowserState->IsOffTheRecord(); -} - #pragma mark - SettingsNavigationControllerDelegate - (void)closeSettings { @@ -913,7 +922,7 @@ - (id<ApplicationCommands, BrowserCommands>)dispatcherForSettings { // Assume that settings always wants the dispatcher from the main BVC. - return self.mainController.mainBVC.dispatcher; + return self.mainInterface.bvc.dispatcher; } #pragma mark - TabSwitcherDelegate @@ -929,12 +938,16 @@ [self finishDismissingTabSwitcher]; } +// Begins the process of dismissing the tab switcher with the given current +// model, switching which BVC is suspended if necessary, but not updating the +// UI. The omnibox will be focused after the tab switcher dismissal is +// completed if |focusOmnibox| is YES. - (void)beginDismissingTabSwitcherWithCurrentModel:(TabModel*)tabModel focusOmnibox:(BOOL)focusOmnibox { DCHECK(tabModel == self.mainInterface.tabModel || tabModel == self.incognitoInterface.tabModel); - self.mainController.dismissingTabSwitcher = YES; + self.dismissingTabSwitcher = YES; ApplicationMode mode = (tabModel == self.mainInterface.tabModel) ? ApplicationMode::NORMAL : ApplicationMode::INCOGNITO; @@ -945,6 +958,8 @@ [self displayCurrentBVCAndFocusOmnibox:focusOmnibox]; } +// Completes the process of dismissing the tab switcher, removing it from the +// screen and showing the appropriate BVC. - (void)finishDismissingTabSwitcher { // In real world devices, it is possible to have an empty tab model at the // finishing block of a BVC presentation animation. This can happen when the @@ -957,8 +972,8 @@ if (self.currentInterface.browser && self.currentInterface.browser->GetWebStateList() && self.currentInterface.browser->GetWebStateList()->count() == 0U) { - self.mainController.tabSwitcherIsActive = NO; - self.mainController.dismissingTabSwitcher = NO; + self.tabSwitcherIsActive = NO; + self.dismissingTabSwitcher = NO; self.modeToDisplayOnTabSwitcherDismissal = TabSwitcherDismissalMode::NONE; self.NTPActionAfterTabSwitcherDismissal = NO_ACTION; [self showTabSwitcher]; @@ -969,7 +984,7 @@ // as part of the BVC presentation process. The BVC is presented before the // animations begin, so it should be the current active VC at this point. DCHECK_EQ(self.mainCoordinator.activeViewController, - self.mainController.currentBVC); + self.currentInterface.bvc); if (self.modeToDisplayOnTabSwitcherDismissal == TabSwitcherDismissalMode::NORMAL) { @@ -988,8 +1003,8 @@ action(); } - self.mainController.tabSwitcherIsActive = NO; - self.mainController.dismissingTabSwitcher = NO; + self.tabSwitcherIsActive = NO; + self.dismissingTabSwitcher = NO; } #pragma mark Tab opening utility methods. @@ -1003,11 +1018,17 @@ }; case START_QR_CODE_SCANNER: return ^{ - [self.mainController.currentBVC.dispatcher showQRScanner]; + id<QRScannerCommands> QRHandler = HandlerForProtocol( + self.currentInterface.browser->GetCommandDispatcher(), + QRScannerCommands); + [QRHandler showQRScanner]; }; case FOCUS_OMNIBOX: return ^{ - [self.mainController.currentBVC.dispatcher focusOmnibox]; + id<OmniboxFocuser> focusHandler = HandlerForProtocol( + self.currentInterface.browser->GetCommandDispatcher(), + OmniboxFocuser); + [focusHandler focusOmnibox]; }; default: return nil; @@ -1024,7 +1045,7 @@ if (backgroundBVC.playingTTS) [backgroundBVC startVoiceSearch]; else - [self.mainController.currentBVC startVoiceSearch]; + [self.currentInterface.bvc startVoiceSearch]; } #pragma mark - TabSwitching @@ -1080,18 +1101,16 @@ } - (BOOL)URLIsOpenedInRegularMode:(const GURL&)URL { - WebStateList* webStateList = - self.mainController.interfaceProvider.mainInterface.tabModel.webStateList; + WebStateList* webStateList = self.mainInterface.browser->GetWebStateList(); return webStateList && webStateList->GetIndexOfWebStateWithURL(URL) != WebStateList::kInvalidIndex; } - (BOOL)shouldOpenNTPTabOnActivationOfTabModel:(TabModel*)tabModel { - if (self.mainController.tabSwitcherIsActive) { - TabModel* mainTabModel = - self.mainController.interfaceProvider.mainInterface.tabModel; + if (self.tabSwitcherIsActive) { + TabModel* mainTabModel = self.browserViewWrangler.mainInterface.tabModel; TabModel* otrTabModel = - self.mainController.interfaceProvider.incognitoInterface.tabModel; + self.browserViewWrangler.incognitoInterface.tabModel; // Only attempt to dismiss the tab switcher and open a new tab if: // - there are no tabs open in either tab model, and // - the tab switcher controller is not directly or indirectly presenting @@ -1141,7 +1160,7 @@ self.interfaceProvider.currentInterface = newInterface; - if (!self.mainController.dismissingTabSwitcher) + if (!self.dismissingTabSwitcher) [self displayCurrentBVCAndFocusOmnibox:NO]; // Tell the BVC that was made current that it can use the web. @@ -1168,8 +1187,8 @@ // Then, depending on what the SSO view controller is presented on, dismiss // it. ProceduralBlock completionWithBVC = ^{ - DCHECK(self.mainController.currentBVC); - DCHECK(!self.mainController.tabSwitcherIsActive); + DCHECK(self.currentInterface.bvc); + DCHECK(!self.tabSwitcherIsActive); DCHECK(!self.signinInteractionCoordinator.isActive); // This will dismiss the SSO view controller. [self.interfaceProvider.currentInterface @@ -1177,9 +1196,9 @@ dismissOmnibox:dismissOmnibox]; }; ProceduralBlock completionWithoutBVC = ^{ - // |self.mainController.currentBVC| may exist but tab switcher should be + // |self.currentInterface.bvc| may exist but tab switcher should be // active. - DCHECK(self.mainController.tabSwitcherIsActive); + DCHECK(self.tabSwitcherIsActive); // This will dismiss the SSO view controller. [self.signinInteractionCoordinator cancelAndDismiss]; // History coordinator can be started on top of the tab grid. This is not @@ -1191,8 +1210,7 @@ // As a top level rule, if the settings are showing, they need to be // dismissed. Then, based on whether the BVC is present or not, a different // completion callback is called. - if (!self.mainController.tabSwitcherIsActive && - self.isSettingsViewPresented) { + if (!self.tabSwitcherIsActive && self.isSettingsViewPresented) { // In this case, the settings are up and the BVC is showing. Close the // settings then call the BVC completion. [self closeSettingsAnimated:NO completion:completionWithBVC]; @@ -1200,7 +1218,7 @@ // In this case, the settings are up but the BVC is not showing. Close the // settings then call the no-BVC completion. [self closeSettingsAnimated:NO completion:completionWithoutBVC]; - } else if (![self.mainController isTabSwitcherActive]) { + } else if (!self.tabSwitcherIsActive) { // In this case, the settings are not shown but the BVC is showing. Call the // BVC completion. [self.signinInteractionCoordinator cancel]; @@ -1270,11 +1288,11 @@ tabOpenedCompletion = completion; } - if (self.mainController.tabSwitcherIsActive) { + if (self.tabSwitcherIsActive) { // If the tab switcher is already being dismissed, simply add the tab and // note that when the tab switcher finishes dismissing, the current BVC // should be switched to be the main BVC if necessary. - if (self.mainController.dismissingTabSwitcher) { + if (self.dismissingTabSwitcher) { self.modeToDisplayOnTabSwitcherDismissal = targetMode == ApplicationMode::NORMAL ? TabSwitcherDismissalMode::NORMAL @@ -1297,7 +1315,7 @@ atIndex:tabIndex]; } } else { - if (!self.mainController.currentBVC.presentedViewController) { + if (!self.currentInterface.bvc.presentedViewController) { [targetInterface.bvc expectNewForegroundTab]; } [self setCurrentInterfaceForMode:targetMode]; @@ -1331,23 +1349,22 @@ - (void)openNewTabFromOriginPoint:(CGPoint)originPoint focusOmnibox:(BOOL)focusOmnibox { - [self.mainController.currentBVC openNewTabFromOriginPoint:originPoint - focusOmnibox:focusOmnibox]; + [self.currentInterface.bvc openNewTabFromOriginPoint:originPoint + focusOmnibox:focusOmnibox]; } - (ChromeBrowserState*)currentBrowserState { - return self.mainController.interfaceProvider.currentInterface.browserState; + return self.browserViewWrangler.currentInterface.browserState; } - (TabModel*)currentTabModel { - return self.mainController.interfaceProvider.currentInterface.bvc.tabModel; + return self.browserViewWrangler.currentInterface.bvc.tabModel; } // Asks the respective Snapshot helper to update the snapshot for the active // WebState. - (void)updateActiveWebStateSnapshot { - WebStateList* webStateList = - self.mainController.currentBVC.tabModel.webStateList; + WebStateList* webStateList = self.currentInterface.bvc.tabModel.webStateList; if (webStateList) { web::WebState* webState = webStateList->GetActiveWebState(); if (webState) { @@ -1367,8 +1384,8 @@ tabOpenedCompletion:(ProceduralBlock)tabOpenedCompletion { BrowserViewController* targetBVC = targetMode == ApplicationMode::NORMAL - ? self.mainController.interfaceProvider.mainInterface.bvc - : self.mainController.interfaceProvider.incognitoInterface.bvc; + ? self.browserViewWrangler.mainInterface.bvc + : self.browserViewWrangler.incognitoInterface.bvc; web::WebState* currentWebState = targetBVC.tabModel.webStateList->GetActiveWebState(); @@ -1416,8 +1433,7 @@ - (void)displayCurrentBVCAndFocusOmnibox:(BOOL)focusOmnibox { ProceduralBlock completion = nil; if (focusOmnibox) { - __weak BrowserViewController* weakCurrentBVC = - self.mainController.currentBVC; + __weak BrowserViewController* weakCurrentBVC = self.currentInterface.bvc; completion = ^{ [weakCurrentBVC.dispatcher focusOmnibox]; }; @@ -1436,7 +1452,7 @@ UIViewController* accountsViewController = [[SignedInAccountsViewController alloc] initWithBrowserState:browserState - dispatcher:self.mainController.mainBVC.dispatcher]; + dispatcher:self.mainInterface.bvc.dispatcher]; [[self topPresentedViewController] presentViewController:accountsViewController animated:YES @@ -1524,12 +1540,11 @@ // Nothing to do here. The next user action (like clicking on an existing // regular tab or creating a new incognito tab from the settings menu) will // take care of the logic to mode switch. - if (self.mainController.tabSwitcherIsActive || - ![self.mainController.currentTabModel isOffTheRecord]) { + if (self.tabSwitcherIsActive || ![self.currentTabModel isOffTheRecord]) { return; } - if ([self.mainController.currentTabModel count] == 0U) { + if ([self.currentTabModel count] == 0U) { [self showTabSwitcher]; } else { [self setCurrentInterfaceForMode:ApplicationMode::NORMAL]; @@ -1544,14 +1559,15 @@ // closure of tabs from the main tab model when the main tab model is not // current. // Nothing to do here. - if (self.mainController.tabSwitcherIsActive || - [self.mainController.currentTabModel isOffTheRecord]) { + if (self.tabSwitcherIsActive || [self.currentTabModel isOffTheRecord]) { return; } [self showTabSwitcher]; } +// Clears incognito data that is specific to iOS and won't be cleared by +// deleting the browser state. - (void)clearIOSSpecificIncognitoData { DCHECK(self.mainController.mainBrowserState ->HasOffTheRecordChromeBrowserState()); @@ -1577,7 +1593,7 @@ self.interfaceProvider.mainInterface.userInteractionEnabled = YES; self.interfaceProvider.incognitoInterface.userInteractionEnabled = YES; - [self.mainController.currentBVC setPrimary:YES]; + [self.currentInterface.bvc setPrimary:YES]; } - (void)showTabSwitcher { @@ -1588,7 +1604,7 @@ restoreInternalStateWithMainBrowser:self.mainInterface.browser otrBrowser:self.incognitoInterface.browser activeBrowser:self.currentInterface.browser]; - self.mainController.tabSwitcherIsActive = YES; + self.tabSwitcherIsActive = YES; [self.tabSwitcher setDelegate:self]; [self.mainCoordinator showTabSwitcher:self.tabSwitcher];
diff --git a/ios/chrome/browser/ui/main/scene_controller_guts.h b/ios/chrome/browser/ui/main/scene_controller_guts.h index d343bcd..2bce899 100644 --- a/ios/chrome/browser/ui/main/scene_controller_guts.h +++ b/ios/chrome/browser/ui/main/scene_controller_guts.h
@@ -17,7 +17,6 @@ class ChromeBrowserState; @class BrowserViewWrangler; -@class TabModel; @protocol SceneControllerGuts <WebStateListObserving> @@ -26,24 +25,9 @@ // BrowserViewInformation protocol. @property(nonatomic, strong) BrowserViewWrangler* browserViewWrangler; -// The scene level component for url loading. Is passed down to -// browser state level UrlLoadingService instances. -@property(nonatomic, assign) AppUrlLoadingService* appURLLoadingService; - - (void)startUpChromeUIPostCrash:(BOOL)isPostCrashLaunch needRestoration:(BOOL)needsRestoration; -- (void)dismissModalDialogsWithCompletion:(ProceduralBlock)completion - dismissOmnibox:(BOOL)dismissOmnibox; - -- (void)openSelectedTabInMode:(ApplicationModeForTabOpening)tabOpeningTargetMode - withUrlLoadParams:(const UrlLoadParams&)urlLoadParams - completion:(ProceduralBlock)completion; - -- (void)openTabFromLaunchOptions:(NSDictionary*)launchOptions - startupInformation:(id<StartupInformation>)startupInformation - appState:(AppState*)appState; - - (void)dismissModalsAndOpenSelectedTabInMode: (ApplicationModeForTabOpening)targetMode withUrlLoadParams: @@ -51,26 +35,15 @@ dismissOmnibox:(BOOL)dismissOmnibox completion:(ProceduralBlock)completion; -- (BOOL)shouldOpenNTPTabOnActivationOfTabModel:(TabModel*)tabModel; - -// TabSwitcherDelegate helpers - -// Begins the process of dismissing the tab switcher with the given current -// model, switching which BVC is suspended if necessary, but not updating the -// UI. The omnibox will be focused after the tab switcher dismissal is -// completed if |focusOmnibox| is YES. -- (void)beginDismissingTabSwitcherWithCurrentModel:(TabModel*)tabModel - focusOmnibox:(BOOL)focusOmnibox; -// Completes the process of dismissing the tab switcher, removing it from the -// screen and showing the appropriate BVC. -- (void)finishDismissingTabSwitcher; - -- (BOOL)presentingFirstRunUI; - // Testing only. +- (BOOL)presentingFirstRunUI; - (void)showFirstRunUI; - (void)setTabSwitcher:(id<TabSwitcher>)switcher; - (id<TabSwitcher>)tabSwitcher; +- (BOOL)isTabSwitcherActive; + +- (void)dismissModalDialogsWithCompletion:(ProceduralBlock)completion + dismissOmnibox:(BOOL)dismissOmnibox; #pragma mark - AppNavigation helpers @@ -79,12 +52,6 @@ - (void)presentSignedInAccountsViewControllerForBrowserState: (ChromeBrowserState*)browserState; -// Clears incognito data that is specific to iOS and won't be cleared by -// deleting the browser state. -- (void)clearIOSSpecificIncognitoData; - -- (void)activateBVCAndMakeCurrentBVCPrimary; - #pragma mark - iOS 12 compat // Method called on SceneController when the scene disconnects. Exposed here for
diff --git a/ios/chrome/browser/ui/page_info/page_info_coordinator.mm b/ios/chrome/browser/ui/page_info/page_info_coordinator.mm index 64609b6..c6a98f1 100644 --- a/ios/chrome/browser/ui/page_info/page_info_coordinator.mm +++ b/ios/chrome/browser/ui/page_info/page_info_coordinator.mm
@@ -6,12 +6,18 @@ #include "base/logging.h" #include "ios/chrome/browser/main/browser.h" +#import "ios/chrome/browser/reading_list/offline_page_tab_helper.h" #import "ios/chrome/browser/ui/commands/command_dispatcher.h" #import "ios/chrome/browser/ui/page_info/page_info_mediator.h" #import "ios/chrome/browser/ui/page_info/page_info_navigation_commands.h" +#import "ios/chrome/browser/ui/page_info/page_info_site_security_description.h" +#import "ios/chrome/browser/ui/page_info/page_info_site_security_mediator.h" #import "ios/chrome/browser/ui/page_info/page_info_site_security_view_controller.h" #import "ios/chrome/browser/ui/page_info/page_info_view_controller.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" +#include "ios/web/public/navigation/navigation_item.h" +#include "ios/web/public/navigation/navigation_manager.h" +#import "ios/web/public/web_state.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -72,8 +78,23 @@ #pragma mark - PageInfoNavigationCommands - (void)showSiteSecurityInfo { + web::WebState* webState = + self.browser->GetWebStateList()->GetActiveWebState(); + web::NavigationItem* navItem = + webState->GetNavigationManager()->GetVisibleItem(); + + bool offlinePage = + OfflinePageTabHelper::FromWebState(webState)->presenting_offline_page(); + + PageInfoSiteSecurityDescription* description = + [PageInfoSiteSecurityMediator configurationForURL:navItem->GetURL() + SSLStatus:navItem->GetSSL() + offlinePage:offlinePage]; + PageInfoSiteSecurityViewController* viewController = - [[PageInfoSiteSecurityViewController alloc] init]; + [[PageInfoSiteSecurityViewController alloc] + initWitDescription:description]; + [self.navigationController pushViewController:viewController animated:YES]; }
diff --git a/ios/chrome/browser/ui/page_info/page_info_site_security_view_controller.h b/ios/chrome/browser/ui/page_info/page_info_site_security_view_controller.h index 8db6accd..9859f657e 100644 --- a/ios/chrome/browser/ui/page_info/page_info_site_security_view_controller.h +++ b/ios/chrome/browser/ui/page_info/page_info_site_security_view_controller.h
@@ -7,8 +7,19 @@ #import <UIKit/UIKit.h> +#import "ios/chrome/browser/ui/page_info/page_info_site_security_description.h" + // View Controller for displaying the site security. @interface PageInfoSiteSecurityViewController : UIViewController + +- (instancetype)initWitDescription:(PageInfoSiteSecurityDescription*)description + NS_DESIGNATED_INITIALIZER; + +- (instancetype)initWithNibName:(NSString*)nibNameOrNil + bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE; +- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + @end #endif // IOS_CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_SITE_SECURITY_VIEW_CONTROLLER_H_
diff --git a/ios/chrome/browser/ui/page_info/page_info_site_security_view_controller.mm b/ios/chrome/browser/ui/page_info/page_info_site_security_view_controller.mm index 748e2b7..4c7c3ef8 100644 --- a/ios/chrome/browser/ui/page_info/page_info_site_security_view_controller.mm +++ b/ios/chrome/browser/ui/page_info/page_info_site_security_view_controller.mm
@@ -4,19 +4,38 @@ #import "ios/chrome/browser/ui/page_info/page_info_site_security_view_controller.h" +#include "ios/chrome/grit/ios_strings.h" +#include "ui/base/l10n/l10n_util.h" + #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +@interface PageInfoSiteSecurityViewController () + +@property(nonatomic, strong) + PageInfoSiteSecurityDescription* pageInfoSecurityDescription; + +@end + @implementation PageInfoSiteSecurityViewController +- (instancetype)initWitDescription: + (PageInfoSiteSecurityDescription*)description { + self = [super initWithNibName:nil bundle:nil]; + if (self) { + _pageInfoSecurityDescription = description; + } + return self; +} + #pragma mark - UIViewController - (void)viewDidLoad { // TODO(crbug.com/1038919): Implement this. [super viewDidLoad]; - self.view.backgroundColor = [UIColor redColor]; + self.title = l10n_util::GetNSString(IDS_IOS_PAGE_INFO_SITE_SECURITY); } @end
diff --git a/ios/chrome/browser/ui/settings/BUILD.gn b/ios/chrome/browser/ui/settings/BUILD.gn index 26d1e2da..c774202 100644 --- a/ios/chrome/browser/ui/settings/BUILD.gn +++ b/ios/chrome/browser/ui/settings/BUILD.gn
@@ -189,7 +189,6 @@ allow_circular_includes_from = [ "//ios/chrome/browser/ui/authentication" ] libs = [ "CoreLocation.framework", - "LocalAuthentication.framework", "UIKit.framework", ] }
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_profile_settings_egtest.mm b/ios/chrome/browser/ui/settings/autofill/autofill_profile_settings_egtest.mm index 9a227b8..d0c5cd2e4 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_profile_settings_egtest.mm +++ b/ios/chrome/browser/ui/settings/autofill/autofill_profile_settings_egtest.mm
@@ -114,7 +114,8 @@ ButtonWithAccessibilityLabelId(IDS_AUTOFILL_ADDRESSES_SETTINGS_TITLE); [[[EarlGrey selectElementWithMatcher:addressesButton] usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, 200) - onElementWithMatcher:grey_kindOfClassName(@"UITableView")] + onElementWithMatcher:grey_allOf(grey_kindOfClassName(@"UITableView"), + grey_sufficientlyVisible(), nil)] performAction:grey_tap()]; }
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm index 277a046..c68f02a3 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm
@@ -180,6 +180,7 @@ } - (void)dismiss { + base::RecordAction(base::UserMetricsAction("MobileClearBrowsingDataClose")); [self prepareForDismissal]; [self.delegate dismissClearBrowsingData]; } @@ -376,6 +377,8 @@ - (void)presentationControllerDidDismiss: (UIPresentationController*)presentationController { + base::RecordAction( + base::UserMetricsAction("IOSClearBrowsingDataCloseWithSwipe")); // Call prepareForDismissal to clean up state and stop the Coordinator. [self prepareForDismissal]; }
diff --git a/ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.mm b/ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.mm index 06ce5d44..cece369 100644 --- a/ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.mm
@@ -143,6 +143,10 @@ #pragma mark - SettingsControllerProtocol +- (void)reportDismissalUserAction { + base::RecordAction(base::UserMetricsAction("MobileAccountsSettingsClose")); +} + - (void)settingsWillBeDismissed { [self.signinInteractionCoordinator cancel]; [_alertCoordinator stop]; @@ -494,4 +498,12 @@ _identityServiceObserver.reset(); } +#pragma mark - UIAdaptivePresentationControllerDelegate + +- (void)presentationControllerDidDismiss: + (UIPresentationController*)presentationController { + base::RecordAction( + base::UserMetricsAction("IOSAccountsSettingsCloseWithSwipe")); +} + @end
diff --git a/ios/chrome/browser/ui/settings/google_services/google_services_settings_view_controller.mm b/ios/chrome/browser/ui/settings/google_services/google_services_settings_view_controller.mm index f534e29..c2de8d75 100644 --- a/ios/chrome/browser/ui/settings/google_services/google_services_settings_view_controller.mm +++ b/ios/chrome/browser/ui/settings/google_services/google_services_settings_view_controller.mm
@@ -5,6 +5,8 @@ #import "ios/chrome/browser/ui/settings/google_services/google_services_settings_view_controller.h" #include "base/mac/foundation_util.h" +#include "base/metrics/user_metrics.h" +#include "base/metrics/user_metrics_action.h" #import "ios/chrome/browser/ui/settings/cells/settings_switch_cell.h" #import "ios/chrome/browser/ui/settings/cells/sync_switch_item.h" #import "ios/chrome/browser/ui/settings/google_services/google_services_settings_constants.h" @@ -54,6 +56,13 @@ return cell; } +#pragma mark - SettingsControllerProtocol + +- (void)reportDismissalUserAction { + base::RecordAction( + base::UserMetricsAction("MobileGoogleServicesSettingsClose")); +} + #pragma mark - GoogleServicesSettingsConsumer - (void)insertSections:(NSIndexSet*)sections { @@ -125,4 +134,12 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; } +#pragma mark - UIAdaptivePresentationControllerDelegate + +- (void)presentationControllerDidDismiss: + (UIPresentationController*)presentationController { + base::RecordAction( + base::UserMetricsAction("IOSGoogleServicesSettingsCloseWithSwipe")); +} + @end
diff --git a/ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.mm b/ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.mm index 14f7229a..497f408c 100644 --- a/ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.mm
@@ -7,6 +7,8 @@ #include "base/logging.h" #include "base/mac/foundation_util.h" #include "base/metrics/histogram_macros.h" +#include "base/metrics/user_metrics.h" +#include "base/metrics/user_metrics_action.h" #import "ios/chrome/browser/ui/list_model/list_item+Controller.h" #import "ios/chrome/browser/ui/settings/cells/settings_cells_constants.h" #import "ios/chrome/browser/ui/settings/cells/settings_switch_cell.h" @@ -157,6 +159,11 @@ #pragma mark - SettingsControllerProtocol +- (void)reportDismissalUserAction { + // Language Settings screen does not have Done button. + NOTREACHED(); +} + - (void)settingsWillBeDismissed { [self.dataSource stopObservingModel]; } @@ -514,4 +521,12 @@ [self translateEnabled:switchView.isOn]; } +#pragma mark - UIAdaptivePresentationControllerDelegate + +- (void)presentationControllerDidDismiss: + (UIPresentationController*)presentationController { + base::RecordAction( + base::UserMetricsAction("IOSLanguagesSettingsCloseWithSwipe")); +} + @end
diff --git a/ios/chrome/browser/ui/settings/password/BUILD.gn b/ios/chrome/browser/ui/settings/password/BUILD.gn index 3244087c..fc5883e 100644 --- a/ios/chrome/browser/ui/settings/password/BUILD.gn +++ b/ios/chrome/browser/ui/settings/password/BUILD.gn
@@ -12,9 +12,6 @@ "password_exporter.mm", "passwords_table_view_controller.h", "passwords_table_view_controller.mm", - "reauthentication_module.h", - "reauthentication_module.mm", - "reauthentication_protocol.h", ] deps = [ ":password_constants", @@ -44,6 +41,7 @@ "//ios/chrome/browser/ui/table_view/cells:cells_constants", "//ios/chrome/browser/ui/util", "//ios/chrome/common/ui/colors", + "//ios/chrome/common/ui/reauthentication", "//ios/chrome/common/ui/util", "//ios/third_party/material_components_ios", "//ui/base", @@ -66,7 +64,6 @@ sources = [ "password_details_table_view_controller+testing.h", "password_exporter_for_testing.h", - "reauthentication_module_for_testing.h", ] deps = [ ":password" ] } @@ -78,7 +75,6 @@ "password_details_table_view_controller_unittest.mm", "password_exporter_unittest.mm", "passwords_table_view_controller_unittest.mm", - "reauthentication_module_unittest.mm", ] deps = [ ":password", @@ -100,6 +96,7 @@ "//ios/chrome/browser/ui/util", "//ios/chrome/browser/web:test_support", "//ios/chrome/common/ui/colors", + "//ios/chrome/common/ui/reauthentication", "//ios/chrome/test/app:test_support", "//ios/web/public/test", "//ios/web/public/test", @@ -131,6 +128,7 @@ "//components/prefs", "//ios/chrome/browser/browser_state", "//ios/chrome/browser/passwords", + "//ios/chrome/common/ui/reauthentication", "//ios/chrome/test/app:test_support", "//ios/third_party/material_components_ios", "//url", @@ -156,6 +154,7 @@ "//ios/chrome/browser/ui/table_view/cells", "//ios/chrome/browser/ui/table_view/cells:cells_constants", "//ios/chrome/browser/ui/util", + "//ios/chrome/common/ui/reauthentication", "//ios/chrome/test/earl_grey:test_support", "//ios/testing/earl_grey:earl_grey_support", "//ios/third_party/material_components_ios", @@ -192,6 +191,7 @@ "//ios/chrome/app/strings:ios_strings_grit", "//ios/chrome/browser/browser_state", "//ios/chrome/browser/passwords", + "//ios/chrome/common/ui/reauthentication", "//ios/chrome/test/app:test_support", "//ios/testing/earl_grey:eg_app_support+eg2", "//ios/third_party/material_components_ios", @@ -208,6 +208,8 @@ testonly = true sources = [ "passwords_settings_app_interface.h" ] + + deps = [ "//ios/chrome/common/ui/reauthentication" ] } source_set("eg2_tests") { @@ -228,6 +230,7 @@ "//ios/chrome/browser/ui/settings:settings_root_constants", "//ios/chrome/browser/ui/table_view/cells:cells_constants", "//ios/chrome/browser/ui/util", + "//ios/chrome/common/ui/reauthentication", "//ios/chrome/test/earl_grey:eg_test_support+eg2", "//ios/testing/earl_grey:eg_test_support+eg2", "//ios/third_party/earl_grey2:test_lib",
diff --git a/ios/chrome/browser/ui/settings/password/password_details_table_view_controller.mm b/ios/chrome/browser/ui/settings/password/password_details_table_view_controller.mm index 8a618d4b..84c7c9c 100644 --- a/ios/chrome/browser/ui/settings/password/password_details_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/password/password_details_table_view_controller.mm
@@ -19,7 +19,6 @@ #import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/settings/password/passwords_table_view_constants.h" #import "ios/chrome/browser/ui/settings/password/passwords_table_view_controller.h" -#import "ios/chrome/browser/ui/settings/password/reauthentication_module.h" #import "ios/chrome/browser/ui/settings/utils/settings_utils.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_cells_constants.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_detail_text_item.h" @@ -28,6 +27,7 @@ #include "ios/chrome/browser/ui/ui_feature_flags.h" #include "ios/chrome/browser/ui/util/uikit_ui_util.h" #import "ios/chrome/common/ui/colors/semantic_color_names.h" +#import "ios/chrome/common/ui/reauthentication/reauthentication_module.h" #include "ios/chrome/grit/ios_strings.h" #import "ios/third_party/material_components_ios/src/components/Snackbar/src/MaterialSnackbar.h" #include "ui/base/l10n/l10n_util_mac.h" @@ -36,6 +36,9 @@ #error "This file requires ARC support." #endif +using password_manager::metrics_util::LogPasswordSettingsReauthResult; +using password_manager::metrics_util::ReauthResult; + namespace { typedef NS_ENUM(NSInteger, SectionIdentifier) { @@ -345,9 +348,13 @@ if ([_weakReauthenticationModule canAttemptReauth]) { __weak PasswordDetailsTableViewController* weakSelf = self; - void (^showPasswordHandler)(BOOL) = ^(BOOL success) { + void (^showPasswordHandler)(ReauthenticationResult) = ^( + ReauthenticationResult result) { PasswordDetailsTableViewController* strongSelf = weakSelf; - if (!strongSelf || !success) + if (!strongSelf) + return; + [strongSelf logPasswordSettingsReauthResult:result]; + if (result == ReauthenticationResult::kFailure) return; TableViewTextItem* passwordItem = strongSelf->_passwordItem; passwordItem.masked = NO; @@ -401,11 +408,13 @@ password_manager::metrics_util::ReauthResult::kSkipped); } else if ([_weakReauthenticationModule canAttemptReauth]) { __weak PasswordDetailsTableViewController* weakSelf = self; - void (^copyPasswordHandler)(BOOL) = ^(BOOL success) { + void (^copyPasswordHandler)(ReauthenticationResult) = ^( + ReauthenticationResult result) { PasswordDetailsTableViewController* strongSelf = weakSelf; if (!strongSelf) return; - if (success) { + [strongSelf logPasswordSettingsReauthResult:result]; + if (result != ReauthenticationResult::kFailure) { UIPasteboard* generalPasteboard = [UIPasteboard generalPasteboard]; generalPasteboard.string = strongSelf->_password; [strongSelf showToast:l10n_util::GetNSString( @@ -619,6 +628,24 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; } +#pragma mark - Metrics + +// Logs metrics for the given reauthentication result (success, failure or +// skipped). +- (void)logPasswordSettingsReauthResult:(ReauthenticationResult)result { + switch (result) { + case ReauthenticationResult::kSuccess: + LogPasswordSettingsReauthResult(ReauthResult::kSuccess); + break; + case ReauthenticationResult::kFailure: + LogPasswordSettingsReauthResult(ReauthResult::kFailure); + break; + case ReauthenticationResult::kSkipped: + LogPasswordSettingsReauthResult(ReauthResult::kSkipped); + break; + } +} + #pragma mark - ForTesting - (void)setReauthenticationModule:
diff --git a/ios/chrome/browser/ui/settings/password/password_details_table_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/password/password_details_table_view_controller_unittest.mm index ee78dc00..f938be94 100644 --- a/ios/chrome/browser/ui/settings/password/password_details_table_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/password/password_details_table_view_controller_unittest.mm
@@ -7,10 +7,10 @@ #include "base/mac/foundation_util.h" #include "base/strings/sys_string_conversions.h" #include "components/autofill/core/common/password_form.h" -#import "ios/chrome/browser/ui/settings/password/reauthentication_module.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_text_item.h" #import "ios/chrome/browser/ui/table_view/chrome_table_view_controller_test.h" #import "ios/chrome/browser/web/chrome_web_test.h" +#import "ios/chrome/common/ui/reauthentication/reauthentication_module.h" #include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/test/app/password_test_util.h" #include "ios/web/public/test/web_task_environment.h" @@ -61,7 +61,7 @@ void SetUp() override { ChromeTableViewControllerTest::SetUp(); reauthentication_module_ = [[MockReauthenticationModule alloc] init]; - reauthentication_module_.shouldSucceed = YES; + reauthentication_module_.expectedResult = ReauthenticationResult::kSuccess; } ChromeTableViewController* InstantiateController() override {
diff --git a/ios/chrome/browser/ui/settings/password/password_exporter.mm b/ios/chrome/browser/ui/settings/password/password_exporter.mm index e06c81b..4759988c 100644 --- a/ios/chrome/browser/ui/settings/password/password_exporter.mm +++ b/ios/chrome/browser/ui/settings/password/password_exporter.mm
@@ -18,7 +18,7 @@ #include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/password_manager/core/common/passwords_directory_util_ios.h" #include "components/strings/grit/components_strings.h" -#import "ios/chrome/browser/ui/settings/password/reauthentication_module.h" +#import "ios/chrome/common/ui/reauthentication/reauthentication_module.h" #include "ios/chrome/grit/ios_strings.h" #include "ui/base/l10n/l10n_util_mac.h" @@ -26,6 +26,9 @@ #error "This file requires ARC support." #endif +using password_manager::metrics_util::LogPasswordSettingsReauthResult; +using password_manager::metrics_util::ReauthResult; + namespace { enum class ReauthenticationStatus { @@ -206,18 +209,23 @@ - (void)startReauthentication { __weak PasswordExporter* weakSelf = self; - void (^onReauthenticationFinished)(BOOL) = ^(BOOL success) { - PasswordExporter* strongSelf = weakSelf; - if (!strongSelf) - return; - if (success) { - strongSelf.reauthenticationStatus = ReauthenticationStatus::SUCCESSFUL; - [strongSelf showPreparingPasswordsAlert]; - } else { - strongSelf.reauthenticationStatus = ReauthenticationStatus::FAILED; - } - [strongSelf tryExporting]; - }; + void (^onReauthenticationFinished)(ReauthenticationResult) = + ^(ReauthenticationResult result) { + DCHECK(result != ReauthenticationResult::kSkipped); + PasswordExporter* strongSelf = weakSelf; + if (!strongSelf) + return; + if (result == ReauthenticationResult::kSuccess) { + LogPasswordSettingsReauthResult(ReauthResult::kSuccess); + strongSelf.reauthenticationStatus = + ReauthenticationStatus::SUCCESSFUL; + [strongSelf showPreparingPasswordsAlert]; + } else { + LogPasswordSettingsReauthResult(ReauthResult::kFailure); + strongSelf.reauthenticationStatus = ReauthenticationStatus::FAILED; + } + [strongSelf tryExporting]; + }; [_weakReauthenticationModule attemptReauthWithLocalizedReason:l10n_util::GetNSString(
diff --git a/ios/chrome/browser/ui/settings/password/password_exporter_unittest.mm b/ios/chrome/browser/ui/settings/password/password_exporter_unittest.mm index f993dfef..d63612c 100644 --- a/ios/chrome/browser/ui/settings/password/password_exporter_unittest.mm +++ b/ios/chrome/browser/ui/settings/password/password_exporter_unittest.mm
@@ -127,7 +127,8 @@ // Tests that when reauthentication is successful, writing the passwords file // is attempted and a call to show the activity view is made. TEST_F(PasswordExporterTest, PasswordFileWriteReauthSucceeded) { - mock_reauthentication_module_.shouldSucceed = YES; + mock_reauthentication_module_.expectedResult = + ReauthenticationResult::kSuccess; FakePasswordFileWriter* fake_password_file_writer = [[FakePasswordFileWriter alloc] init]; fake_password_file_writer.writingStatus = WriteToURLStatus::SUCCESS; @@ -154,7 +155,8 @@ // the appropriate error is displayed and the export operation // is interrupted. TEST_F(PasswordExporterTest, WritingFailedOutOfDiskSpace) { - mock_reauthentication_module_.shouldSucceed = YES; + mock_reauthentication_module_.expectedResult = + ReauthenticationResult::kSuccess; FakePasswordFileWriter* fake_password_file_writer = [[FakePasswordFileWriter alloc] init]; fake_password_file_writer.writingStatus = @@ -192,7 +194,8 @@ // enough disk space, the appropriate error is displayed and the export // operation is interrupted. TEST_F(PasswordExporterTest, WritingFailedUnknownError) { - mock_reauthentication_module_.shouldSucceed = YES; + mock_reauthentication_module_.expectedResult = + ReauthenticationResult::kSuccess; FakePasswordFileWriter* fake_password_file_writer = [[FakePasswordFileWriter alloc] init]; fake_password_file_writer.writingStatus = WriteToURLStatus::UNKNOWN_ERROR; @@ -227,7 +230,8 @@ // Tests that when reauthentication fails the export flow is interrupted. TEST_F(PasswordExporterTest, ExportInterruptedWhenReauthFails) { - mock_reauthentication_module_.shouldSucceed = NO; + mock_reauthentication_module_.expectedResult = + ReauthenticationResult::kFailure; FakePasswordSerialzerBridge* fake_password_serializer_bridge = [[FakePasswordSerialzerBridge alloc] init]; [password_exporter_ @@ -272,7 +276,8 @@ // Tests that cancelling the export while serialization is still ongoing // waits for it to finish before cleaning up. TEST_F(PasswordExporterTest, CancelWaitsForSerializationFinished) { - mock_reauthentication_module_.shouldSucceed = YES; + mock_reauthentication_module_.expectedResult = + ReauthenticationResult::kSuccess; FakePasswordSerialzerBridge* fake_password_serializer_bridge = [[FakePasswordSerialzerBridge alloc] init]; [password_exporter_ @@ -309,7 +314,8 @@ // Tests that if the export is cancelled before writing to file finishes // successfully the request to show the activity controller isn't made. TEST_F(PasswordExporterTest, CancelledBeforeWriteToFileFinishesSuccessfully) { - mock_reauthentication_module_.shouldSucceed = YES; + mock_reauthentication_module_.expectedResult = + ReauthenticationResult::kSuccess; FakePasswordFileWriter* fake_password_file_writer = [[FakePasswordFileWriter alloc] init]; fake_password_file_writer.writingStatus = WriteToURLStatus::SUCCESS; @@ -341,7 +347,8 @@ // Tests that if the export is cancelled before writing to file fails // with an error, the request to show the error alert isn't made. TEST_F(PasswordExporterTest, CancelledBeforeWriteToFileFails) { - mock_reauthentication_module_.shouldSucceed = YES; + mock_reauthentication_module_.expectedResult = + ReauthenticationResult::kSuccess; FakePasswordFileWriter* fake_password_file_writer = [[FakePasswordFileWriter alloc] init]; fake_password_file_writer.writingStatus = WriteToURLStatus::UNKNOWN_ERROR;
diff --git a/ios/chrome/browser/ui/settings/password/passwords_settings_app_interface.h b/ios/chrome/browser/ui/settings/password/passwords_settings_app_interface.h index f452674..cf721c7 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_settings_app_interface.h +++ b/ios/chrome/browser/ui/settings/password/passwords_settings_app_interface.h
@@ -7,6 +7,8 @@ #import <UIKit/UIKit.h> +#import "ios/chrome/common/ui/reauthentication/reauthentication_protocol.h" + // EarlGreyScopedBlockSwizzlerAppInterface contains the app-side // implementation for helpers. These helpers are compiled into // the app binary and can be called from either app or test code. @@ -16,7 +18,8 @@ // view password) and its options for next test. + (void)setUpMockReauthenticationModule; + (void)setUpMockReauthenticationModuleForExport; -+ (void)mockReauthenticationModuleShouldSucceed:(BOOL)shouldSucceed; ++ (void)mockReauthenticationModuleExpectedResult: + (ReauthenticationResult)expectedResult; + (void)mockReauthenticationModuleCanAttempt:(BOOL)canAttempt; // Dismisses snack bar. Used before next test.
diff --git a/ios/chrome/browser/ui/settings/password/passwords_settings_app_interface.mm b/ios/chrome/browser/ui/settings/password/passwords_settings_app_interface.mm index 7c209271..3c1f63e 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_settings_app_interface.mm +++ b/ios/chrome/browser/ui/settings/password/passwords_settings_app_interface.mm
@@ -151,8 +151,9 @@ SetUpAndReturnMockReauthenticationModuleForExport(); } -+ (void)mockReauthenticationModuleShouldSucceed:(BOOL)shouldSucceed { - _mockReauthenticationModule.shouldSucceed = shouldSucceed; ++ (void)mockReauthenticationModuleExpectedResult: + (ReauthenticationResult)expectedResult { + _mockReauthenticationModule.expectedResult = expectedResult; } + (void)mockReauthenticationModuleCanAttempt:(BOOL)canAttempt {
diff --git a/ios/chrome/browser/ui/settings/password/passwords_settings_egtest.mm b/ios/chrome/browser/ui/settings/password/passwords_settings_egtest.mm index 034e971a..a5304bd5 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_settings_egtest.mm +++ b/ios/chrome/browser/ui/settings/password/passwords_settings_egtest.mm
@@ -14,6 +14,7 @@ #import "ios/chrome/browser/ui/settings/password/passwords_table_view_constants.h" #import "ios/chrome/browser/ui/settings/settings_root_table_constants.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_cells_constants.h" +#import "ios/chrome/common/ui/reauthentication/reauthentication_protocol.h" #include "ios/chrome/grit/ios_strings.h" #import "ios/chrome/test/earl_grey/chrome_actions.h" #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" @@ -406,7 +407,8 @@ performAction:grey_tap()]; [PasswordSettingsAppInterface setUpMockReauthenticationModule]; - [PasswordSettingsAppInterface mockReauthenticationModuleShouldSucceed:YES]; + [PasswordSettingsAppInterface mockReauthenticationModuleExpectedResult: + ReauthenticationResult::kSuccess]; // Check the snackbar in case of successful reauthentication. [GetInteractionForPasswordDetailItem(CopyPasswordButton()) @@ -419,7 +421,8 @@ performAction:grey_tap()]; // Check the snackbar in case of failed reauthentication. - [PasswordSettingsAppInterface mockReauthenticationModuleShouldSucceed:NO]; + [PasswordSettingsAppInterface mockReauthenticationModuleExpectedResult: + ReauthenticationResult::kFailure]; [GetInteractionForPasswordDetailItem(CopyPasswordButton()) performAction:grey_tap()]; @@ -449,7 +452,8 @@ performAction:grey_tap()]; [PasswordSettingsAppInterface setUpMockReauthenticationModule]; - [PasswordSettingsAppInterface mockReauthenticationModuleShouldSucceed:YES]; + [PasswordSettingsAppInterface mockReauthenticationModuleExpectedResult: + ReauthenticationResult::kSuccess]; // Check the snackbar in case of successful reauthentication. [GetInteractionForPasswordDetailItem(ShowPasswordButton()) @@ -480,7 +484,8 @@ performAction:grey_tap()]; [PasswordSettingsAppInterface setUpMockReauthenticationModule]; - [PasswordSettingsAppInterface mockReauthenticationModuleShouldSucceed:NO]; + [PasswordSettingsAppInterface mockReauthenticationModuleExpectedResult: + ReauthenticationResult::kFailure]; // Check the snackbar in case of failed reauthentication. [GetInteractionForPasswordDetailItem(ShowPasswordButton()) @@ -882,7 +887,8 @@ // end of the test, otherwise it might get deleted too soon and break the // functionality of copying and viewing passwords. [PasswordSettingsAppInterface setUpMockReauthenticationModule]; - [PasswordSettingsAppInterface mockReauthenticationModuleShouldSucceed:YES]; + [PasswordSettingsAppInterface mockReauthenticationModuleExpectedResult: + ReauthenticationResult::kSuccess]; // Tap the context menu item for copying. [[EarlGrey @@ -924,7 +930,8 @@ // end of the test, otherwise it might get deleted too soon and break the // functionality of copying and viewing passwords. [PasswordSettingsAppInterface setUpMockReauthenticationModule]; - [PasswordSettingsAppInterface mockReauthenticationModuleShouldSucceed:YES]; + [PasswordSettingsAppInterface mockReauthenticationModuleExpectedResult: + ReauthenticationResult::kSuccess]; // Tap the context menu item for showing. [[EarlGrey @@ -1400,7 +1407,8 @@ OpenPasswordSettings(); [PasswordSettingsAppInterface setUpMockReauthenticationModuleForExport]; - [PasswordSettingsAppInterface mockReauthenticationModuleShouldSucceed:YES]; + [PasswordSettingsAppInterface mockReauthenticationModuleExpectedResult: + ReauthenticationResult::kSuccess]; [[EarlGrey selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabelId(
diff --git a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.mm b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.mm index 0ecbf4c..37200f6d 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.mm
@@ -10,6 +10,8 @@ #include "base/logging.h" #include "base/mac/foundation_util.h" #include "base/metrics/histogram_macros.h" +#include "base/metrics/user_metrics.h" +#include "base/metrics/user_metrics_action.h" #include "base/numerics/safe_conversions.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" @@ -41,7 +43,6 @@ #import "ios/chrome/browser/ui/settings/password/password_details_table_view_controller_delegate.h" #import "ios/chrome/browser/ui/settings/password/password_exporter.h" #import "ios/chrome/browser/ui/settings/password/passwords_table_view_constants.h" -#import "ios/chrome/browser/ui/settings/password/reauthentication_module.h" #import "ios/chrome/browser/ui/settings/utils/pref_backed_boolean.h" #import "ios/chrome/browser/ui/settings/utils/settings_utils.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_cells_constants.h" @@ -55,6 +56,7 @@ #import "ios/chrome/browser/ui/util/uikit_ui_util.h" #import "ios/chrome/common/ui/colors/UIColor+cr_semantic_colors.h" #import "ios/chrome/common/ui/colors/semantic_color_names.h" +#import "ios/chrome/common/ui/reauthentication/reauthentication_module.h" #import "ios/chrome/common/ui/util/constraints_ui_util.h" #include "ios/chrome/grit/ios_strings.h" #include "ui/base/l10n/l10n_util_mac.h" @@ -406,6 +408,10 @@ #pragma mark - SettingsControllerProtocol +- (void)reportDismissalUserAction { + base::RecordAction(base::UserMetricsAction("MobilePasswordsSettingsClose")); +} + - (void)settingsWillBeDismissed { // Dismiss the search bar if presented, otherwise the VC will be retained by // UIKit thus cause a memory leak. @@ -1217,4 +1223,12 @@ _identityServiceObserver.reset(); } +#pragma mark - UIAdaptivePresentationControllerDelegate + +- (void)presentationControllerDidDismiss: + (UIPresentationController*)presentationController { + base::RecordAction( + base::UserMetricsAction("IOSPasswordsSettingsCloseWithSwipe")); +} + @end
diff --git a/ios/chrome/browser/ui/settings/password/reauthentication_module_for_testing.h b/ios/chrome/browser/ui/settings/password/reauthentication_module_for_testing.h deleted file mode 100644 index 8ba4170c..0000000 --- a/ios/chrome/browser/ui/settings/password/reauthentication_module_for_testing.h +++ /dev/null
@@ -1,20 +0,0 @@ -// Copyright 2018 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_SETTINGS_PASSWORD_REAUTHENTICATION_MODULE_FOR_TESTING_H_ -#define IOS_CHROME_BROWSER_UI_SETTINGS_PASSWORD_REAUTHENTICATION_MODULE_FOR_TESTING_H_ - -#import "ios/chrome/browser/ui/settings/password/reauthentication_module.h" - -#import <LocalAuthentication/LocalAuthentication.h> - -@interface ReauthenticationModule (ForTesting) - -// Allows the replacement of the |LAContext| objects used by -// |ReauthenticationModule| with a mock to facilitate testing. -- (void)setCreateLAContext:(LAContext* (^)(void))createLAContext; - -@end - -#endif // IOS_CHROME_BROWSER_UI_SETTINGS_PASSWORD_REAUTHENTICATION_MODULE_FOR_TESTING_H
diff --git a/ios/chrome/browser/ui/settings/password/reauthentication_protocol.h b/ios/chrome/browser/ui/settings/password/reauthentication_protocol.h deleted file mode 100644 index 230819d6..0000000 --- a/ios/chrome/browser/ui/settings/password/reauthentication_protocol.h +++ /dev/null
@@ -1,26 +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. - -#ifndef IOS_CHROME_BROWSER_UI_SETTINGS_PASSWORD_REAUTHENTICATION_PROTOCOL_H_ -#define IOS_CHROME_BROWSER_UI_SETTINGS_PASSWORD_REAUTHENTICATION_PROTOCOL_H_ - -#import <Foundation/Foundation.h> - -@protocol ReauthenticationProtocol <NSObject> - -// Checks whether Touch ID and/or passcode is enabled for the device. -- (BOOL)canAttemptReauth; - -// Attempts to reauthenticate the user with Touch ID or passcode if Touch ID is -// not available. If |canReusePreviousAuth| is YES, a previous successful -// reauthentication can be taken into consideration, otherwise a new -// reauth attempt must be made. |handler| will take action depending on the -// result of the reauth attempt. -- (void)attemptReauthWithLocalizedReason:(NSString*)localizedReason - canReusePreviousAuth:(BOOL)canReusePreviousAuth - handler:(void (^)(BOOL success))handler; - -@end - -#endif // IOS_CHROME_BROWSER_UI_SETTINGS_PASSWORD_REAUTHENTICATION_PROTOCOL_H_
diff --git a/ios/chrome/browser/ui/settings/settings_controller_protocol.h b/ios/chrome/browser/ui/settings/settings_controller_protocol.h index 6dfc3f5..dd75ddc 100644 --- a/ios/chrome/browser/ui/settings/settings_controller_protocol.h +++ b/ios/chrome/browser/ui/settings/settings_controller_protocol.h
@@ -10,6 +10,12 @@ // Protocol for settings view controllers. @protocol SettingsControllerProtocol <NSObject> +@required + +// Called when user dismissed settings. View controllers must implement this +// method and report dismissal User Action. +- (void)reportDismissalUserAction; + @optional // Notifies the controller that the settings screen is being dismissed.
diff --git a/ios/chrome/browser/ui/settings/settings_navigation_controller.mm b/ios/chrome/browser/ui/settings/settings_navigation_controller.mm index a984b1f..a018a8e 100644 --- a/ios/chrome/browser/ui/settings/settings_navigation_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_navigation_controller.mm
@@ -322,6 +322,12 @@ } - (void)closeSettings { + for (UIViewController* controller in [self viewControllers]) { + if ([controller conformsToProtocol:@protocol(SettingsControllerProtocol)]) { + [controller performSelector:@selector(reportDismissalUserAction)]; + } + } + [self.settingsNavigationDelegate closeSettings]; }
diff --git a/ios/chrome/browser/ui/settings/settings_navigation_controller_unittest.mm b/ios/chrome/browser/ui/settings/settings_navigation_controller_unittest.mm index a4beb22..83121be 100644 --- a/ios/chrome/browser/ui/settings/settings_navigation_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/settings_navigation_controller_unittest.mm
@@ -9,6 +9,7 @@ #include <memory> #include "base/bind.h" +#include "base/test/metrics/user_action_tester.h" #include "components/search_engines/template_url_service.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h" @@ -152,6 +153,7 @@ // delegate. TEST_F(SettingsNavigationControllerTest, CloseSettingsWhenNavigationStackSizeIsOne) { + base::UserActionTester user_action_tester; @autoreleasepool { SettingsNavigationController* settingsController = [SettingsNavigationController @@ -159,7 +161,9 @@ delegate:mockDelegate_]; EXPECT_EQ(1U, [[settingsController viewControllers] count]); [[mockDelegate_ expect] closeSettings]; + ASSERT_EQ(0, user_action_tester.GetActionCount("MobileSettingsClose")); [settingsController popViewControllerOrCloseSettingsAnimated:NO]; + EXPECT_EQ(1, user_action_tester.GetActionCount("MobileSettingsClose")); EXPECT_OCMOCK_VERIFY(mockDelegate_); [settingsController cleanUpSettings]; }
diff --git a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm index f6b04df..fa980b6 100644 --- a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm
@@ -8,6 +8,8 @@ #include "base/feature_list.h" #import "base/mac/foundation_util.h" +#include "base/metrics/user_metrics.h" +#include "base/metrics/user_metrics_action.h" #include "base/strings/sys_string_conversions.h" #include "build/branding_buildflags.h" #include "components/autofill/core/common/autofill_prefs.h" @@ -1081,6 +1083,10 @@ #pragma mark SettingsControllerProtocol +- (void)reportDismissalUserAction { + base::RecordAction(base::UserMetricsAction("MobileSettingsClose")); +} + - (void)settingsWillBeDismissed { DCHECK(!_settingsHasBeenDismissed); [_googleServicesSettingsCoordinator stop]; @@ -1289,4 +1295,11 @@ [self signinStateDidChange]; } +#pragma mark - UIAdaptivePresentationControllerDelegate + +- (void)presentationControllerDidDismiss: + (UIPresentationController*)presentationController { + base::RecordAction(base::UserMetricsAction("IOSSettingsCloseWithSwipe")); +} + @end
diff --git a/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.mm b/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.mm index 738d516..ef4cce9 100644 --- a/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.mm
@@ -8,6 +8,8 @@ #include "base/i18n/time_formatting.h" #include "base/mac/foundation_util.h" +#include "base/metrics/user_metrics.h" +#include "base/metrics/user_metrics_action.h" #include "base/strings/sys_string_conversions.h" #include "components/google/core/common/google_util.h" #import "components/signin/public/identity_manager/objc/identity_manager_observer_bridge.h" @@ -506,8 +508,21 @@ #pragma mark - SettingsControllerProtocol callbacks +- (void)reportDismissalUserAction { + // Sync Passphrase Settings screen does not have Done button. + NOTREACHED(); +} + - (void)settingsWillBeDismissed { [self stopObserving]; } +#pragma mark - UIAdaptivePresentationControllerDelegate + +- (void)presentationControllerDidDismiss: + (UIPresentationController*)presentationController { + base::RecordAction(base::UserMetricsAction( + "IOSSyncEncryptionPassphraseSettingsCloseWithSwipe")); +} + @end
diff --git a/ios/chrome/common/ui/reauthentication/BUILD.gn b/ios/chrome/common/ui/reauthentication/BUILD.gn new file mode 100644 index 0000000..f87ff97f --- /dev/null +++ b/ios/chrome/common/ui/reauthentication/BUILD.gn
@@ -0,0 +1,37 @@ +# 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("reauthentication") { + configs += [ "//build/config/compiler:enable_arc" ] + sources = [ + "reauthentication_module.h", + "reauthentication_module.mm", + "reauthentication_protocol.h", + ] + deps = [ "//base" ] + frameworks = [ "LocalAuthentication.framework" ] +} + +source_set("test_support") { + configs += [ "//build/config/compiler:enable_arc" ] + testonly = true + sources = [ "reauthentication_module_for_testing.h" ] + deps = [ ":reauthentication" ] +} + +source_set("unit_tests") { + configs += [ "//build/config/compiler:enable_arc" ] + testonly = true + sources = [ "reauthentication_module_unittest.mm" ] + deps = [ + ":reauthentication", + ":test_support", + "//base", + "//base/test:test_support", + "//testing/gmock", + "//testing/gtest", + "//testing/gtest", + "//third_party/ocmock", + ] +}
diff --git a/ios/chrome/browser/ui/settings/password/reauthentication_module.h b/ios/chrome/common/ui/reauthentication/reauthentication_module.h similarity index 79% rename from ios/chrome/browser/ui/settings/password/reauthentication_module.h rename to ios/chrome/common/ui/reauthentication/reauthentication_module.h index deffd55..1f1a5fd8 100644 --- a/ios/chrome/browser/ui/settings/password/reauthentication_module.h +++ b/ios/chrome/common/ui/reauthentication/reauthentication_module.h
@@ -2,12 +2,12 @@ // 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_SETTINGS_PASSWORD_REAUTHENTICATION_MODULE_H_ -#define IOS_CHROME_BROWSER_UI_SETTINGS_PASSWORD_REAUTHENTICATION_MODULE_H_ +#ifndef IOS_CHROME_COMMON_UI_REAUTHENTICATION_REAUTHENTICATION_MODULE_H_ +#define IOS_CHROME_COMMON_UI_REAUTHENTICATION_REAUTHENTICATION_MODULE_H_ #import <Foundation/Foundation.h> -#import "ios/chrome/browser/ui/settings/password/reauthentication_protocol.h" +#import "ios/chrome/common/ui/reauthentication/reauthentication_protocol.h" // A help article on how to set up a passcode. extern const char kPasscodeArticleURL[]; @@ -39,4 +39,4 @@ @end -#endif // IOS_CHROME_BROWSER_UI_SETTINGS_PASSWORD_REAUTHENTICATION_MODULE_H_ +#endif // IOS_CHROME_COMMON_UI_REAUTHENTICATION_REAUTHENTICATION_MODULE_H_
diff --git a/ios/chrome/browser/ui/settings/password/reauthentication_module.mm b/ios/chrome/common/ui/reauthentication/reauthentication_module.mm similarity index 81% rename from ios/chrome/browser/ui/settings/password/reauthentication_module.mm rename to ios/chrome/common/ui/reauthentication/reauthentication_module.mm index 190bc13..74e675dc 100644 --- a/ios/chrome/browser/ui/settings/password/reauthentication_module.mm +++ b/ios/chrome/common/ui/reauthentication/reauthentication_module.mm
@@ -1,13 +1,11 @@ // 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. -#import "ios/chrome/browser/ui/settings/password/reauthentication_module.h" +#import "ios/chrome/common/ui/reauthentication/reauthentication_module.h" #import <LocalAuthentication/LocalAuthentication.h> -#include "base/logging.h" -#include "base/metrics/histogram_macros.h" -#include "components/password_manager/core/browser/password_manager_metrics_util.h" +#import "base/logging.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -15,9 +13,6 @@ constexpr char kPasscodeArticleURL[] = "https://support.apple.com/HT204060"; -using password_manager::metrics_util::LogPasswordSettingsReauthResult; -using password_manager::metrics_util::ReauthResult; - @implementation ReauthenticationModule { // Block that creates a new |LAContext| object everytime one is required, // meant to make testing with a mock object possible. @@ -51,10 +46,11 @@ - (void)attemptReauthWithLocalizedReason:(NSString*)localizedReason canReusePreviousAuth:(BOOL)canReusePreviousAuth - handler:(void (^)(BOOL success))handler { + handler: + (void (^)(ReauthenticationResult success)) + handler { if (canReusePreviousAuth && [self isPreviousAuthValid]) { - handler(YES); - LogPasswordSettingsReauthResult(ReauthResult::kSkipped); + handler(ReauthenticationResult::kSkipped); return; } @@ -69,10 +65,8 @@ if (success) { [strongSelf->_successfulReauthTimeAccessor updateSuccessfulReauthTime]; } - handler(success); - - LogPasswordSettingsReauthResult(success ? ReauthResult::kSuccess - : ReauthResult::kFailure); + handler(success ? ReauthenticationResult::kSuccess + : ReauthenticationResult::kFailure); }); };
diff --git a/ios/chrome/common/ui/reauthentication/reauthentication_module_for_testing.h b/ios/chrome/common/ui/reauthentication/reauthentication_module_for_testing.h new file mode 100644 index 0000000..87b9178 --- /dev/null +++ b/ios/chrome/common/ui/reauthentication/reauthentication_module_for_testing.h
@@ -0,0 +1,20 @@ +// Copyright 2018 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_COMMON_UI_REAUTHENTICATION_REAUTHENTICATION_MODULE_FOR_TESTING_H_ +#define IOS_CHROME_COMMON_UI_REAUTHENTICATION_REAUTHENTICATION_MODULE_FOR_TESTING_H_ + +#import "ios/chrome/common/ui/reauthentication/reauthentication_module.h" + +#import <LocalAuthentication/LocalAuthentication.h> + +@interface ReauthenticationModule (ForTesting) + +// Allows the replacement of the |LAContext| objects used by +// |ReauthenticationModule| with a mock to facilitate testing. +- (void)setCreateLAContext:(LAContext* (^)(void))createLAContext; + +@end + +#endif // IOS_CHROME_COMMON_UI_REAUTHENTICATION_REAUTHENTICATION_MODULE_FOR_TESTING_H_
diff --git a/ios/chrome/browser/ui/settings/password/reauthentication_module_unittest.mm b/ios/chrome/common/ui/reauthentication/reauthentication_module_unittest.mm similarity index 83% rename from ios/chrome/browser/ui/settings/password/reauthentication_module_unittest.mm rename to ios/chrome/common/ui/reauthentication/reauthentication_module_unittest.mm index 23d1fbc..7255676 100644 --- a/ios/chrome/browser/ui/settings/password/reauthentication_module_unittest.mm +++ b/ios/chrome/common/ui/reauthentication/reauthentication_module_unittest.mm
@@ -2,7 +2,7 @@ // 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/settings/password/reauthentication_module_for_testing.h" +#import "ios/chrome/common/ui/reauthentication/reauthentication_module_for_testing.h" #import <LocalAuthentication/LocalAuthentication.h> @@ -79,10 +79,11 @@ OCMExpect([auth_context_ evaluatePolicy:LAPolicyDeviceOwnerAuthentication localizedReason:[OCMArg any] reply:[OCMArg any]]); - [reauthentication_module_ attemptReauthWithLocalizedReason:@"Test" - canReusePreviousAuth:NO - handler:^(BOOL success){ - }]; + [reauthentication_module_ + attemptReauthWithLocalizedReason:@"Test" + canReusePreviousAuth:NO + handler:^(ReauthenticationResult success){ + }]; EXPECT_OCMOCK_VERIFY(auth_context_); } @@ -106,10 +107,11 @@ // Use @try/@catch as -reject raises an exception. @try { - [reauthentication_module_ attemptReauthWithLocalizedReason:@"Test" - canReusePreviousAuth:YES - handler:^(BOOL success){ - }]; + [reauthentication_module_ + attemptReauthWithLocalizedReason:@"Test" + canReusePreviousAuth:YES + handler:^(ReauthenticationResult success){ + }]; EXPECT_OCMOCK_VERIFY(auth_context_); } @catch (NSException* exception) { // The exception is raised when @@ -136,10 +138,11 @@ OCMExpect([auth_context_ evaluatePolicy:LAPolicyDeviceOwnerAuthentication localizedReason:[OCMArg any] reply:[OCMArg any]]); - [reauthentication_module_ attemptReauthWithLocalizedReason:@"Test" - canReusePreviousAuth:YES - handler:^(BOOL success){ - }]; + [reauthentication_module_ + attemptReauthWithLocalizedReason:@"Test" + canReusePreviousAuth:YES + handler:^(ReauthenticationResult success){ + }]; EXPECT_OCMOCK_VERIFY(auth_context_); }
diff --git a/ios/chrome/common/ui/reauthentication/reauthentication_protocol.h b/ios/chrome/common/ui/reauthentication/reauthentication_protocol.h new file mode 100644 index 0000000..2cbceb0 --- /dev/null +++ b/ios/chrome/common/ui/reauthentication/reauthentication_protocol.h
@@ -0,0 +1,37 @@ +// 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_COMMON_UI_REAUTHENTICATION_REAUTHENTICATION_PROTOCOL_H_ +#define IOS_CHROME_COMMON_UI_REAUTHENTICATION_REAUTHENTICATION_PROTOCOL_H_ + +#import <Foundation/Foundation.h> + +// Indicates the result of the Reauthentication attempt. +enum class ReauthenticationResult { + kSuccess = 0, + kFailure = 1, + kSkipped = 2, + kMaxValue = kSkipped, +}; + +// Protocol for implementor of hardware reauthentication check. +@protocol ReauthenticationProtocol <NSObject> + +// Checks whether Touch ID and/or passcode is enabled for the device. +- (BOOL)canAttemptReauth; + +// Attempts to reauthenticate the user with Touch ID or Face ID, or passcode if +// such hardware is not available. If |canReusePreviousAuth| is YES, a previous +// successful reauthentication can be taken into consideration, otherwise a new +// reauth attempt must be made. |handler| will take action depending on the +// result of the reauth attempt. +- (void)attemptReauthWithLocalizedReason:(NSString*)localizedReason + canReusePreviousAuth:(BOOL)canReusePreviousAuth + handler: + (void (^)(ReauthenticationResult success)) + handler; + +@end + +#endif // IOS_CHROME_COMMON_UI_REAUTHENTICATION_REAUTHENTICATION_PROTOCOL_H_
diff --git a/ios/chrome/test/BUILD.gn b/ios/chrome/test/BUILD.gn index e40a55f7..3a779dc 100644 --- a/ios/chrome/test/BUILD.gn +++ b/ios/chrome/test/BUILD.gn
@@ -207,6 +207,7 @@ "//ios/chrome/browser/passwords:unit_tests", "//ios/chrome/browser/prerender:unit_tests", "//ios/chrome/browser/reading_list:unit_tests", + "//ios/chrome/browser/safe_browsing:unit_tests", "//ios/chrome/browser/safe_mode:unit_tests", "//ios/chrome/browser/search_engines:unit_tests", "//ios/chrome/browser/send_tab_to_self:unit_tests", @@ -312,6 +313,7 @@ "//ios/chrome/browser/web_state_list/web_usage_enabler:unit_tests", "//ios/chrome/browser/webui:unit_tests", "//ios/chrome/common:unit_tests", + "//ios/chrome/common/ui/reauthentication:unit_tests", "//ios/chrome/common/ui/util:unit_tests", "//ios/chrome/content_widget_extension:unit_tests", "//ios/chrome/search_widget_extension:unit_tests",
diff --git a/ios/chrome/test/app/BUILD.gn b/ios/chrome/test/app/BUILD.gn index ace079d..10a7b08 100644 --- a/ios/chrome/test/app/BUILD.gn +++ b/ios/chrome/test/app/BUILD.gn
@@ -82,6 +82,7 @@ "//ios/chrome/browser/url_loading", "//ios/chrome/browser/web_state_list", "//ios/chrome/browser/web_state_list/web_usage_enabler", + "//ios/chrome/common/ui/reauthentication", "//ios/public/provider/chrome/browser", "//ios/public/provider/chrome/browser/signin:fake_chrome_identity", "//ios/public/provider/chrome/browser/signin:test_support",
diff --git a/ios/chrome/test/app/password_test_util.h b/ios/chrome/test/app/password_test_util.h index ab65c268..04c4577 100644 --- a/ios/chrome/test/app/password_test_util.h +++ b/ios/chrome/test/app/password_test_util.h
@@ -5,7 +5,7 @@ #ifndef IOS_CHROME_TEST_APP_PASSWORD_TEST_UTIL_H_ #define IOS_CHROME_TEST_APP_PASSWORD_TEST_UTIL_H_ -#import "ios/chrome/browser/ui/settings/password/reauthentication_module.h" +#import "ios/chrome/common/ui/reauthentication/reauthentication_module.h" @interface MockReauthenticationModule : NSObject<ReauthenticationProtocol> @@ -17,7 +17,7 @@ // Indicates whether (mock) authentication should succeed or not. Setting // |shouldSucceed| to any value sets |canAttempt| to YES. -@property(nonatomic, assign) BOOL shouldSucceed; +@property(nonatomic, assign) ReauthenticationResult expectedResult; @end
diff --git a/ios/chrome/test/app/password_test_util.mm b/ios/chrome/test/app/password_test_util.mm index 740e094..187a0c0 100644 --- a/ios/chrome/test/app/password_test_util.mm +++ b/ios/chrome/test/app/password_test_util.mm
@@ -18,12 +18,12 @@ @synthesize localizedReasonForAuthentication = _localizedReasonForAuthentication; -@synthesize shouldSucceed = _shouldSucceed; +@synthesize expectedResult = _expectedResult; @synthesize canAttempt = _canAttempt; -- (void)setShouldSucceed:(BOOL)shouldSucceed { +- (void)setExpectedResult:(ReauthenticationResult)expectedResult { _canAttempt = YES; - _shouldSucceed = shouldSucceed; + _expectedResult = expectedResult; } - (BOOL)canAttemptReauth { @@ -32,10 +32,11 @@ - (void)attemptReauthWithLocalizedReason:(NSString*)localizedReason canReusePreviousAuth:(BOOL)canReusePreviousAuth - handler:(void (^)(BOOL success)) - showCopyPasswordsHandler { + handler: + (void (^)(ReauthenticationResult success)) + showCopyPasswordsHandler { self.localizedReasonForAuthentication = localizedReason; - showCopyPasswordsHandler(_shouldSucceed); + showCopyPasswordsHandler(_expectedResult); } @end
diff --git a/ios/chrome/test/testing_application_context.h b/ios/chrome/test/testing_application_context.h index b027458e..6ac87b8 100644 --- a/ios/chrome/test/testing_application_context.h +++ b/ios/chrome/test/testing_application_context.h
@@ -60,6 +60,7 @@ gcm::GCMDriver* GetGCMDriver() override; component_updater::ComponentUpdateService* GetComponentUpdateService() override; + SafeBrowsingService* GetSafeBrowsingService() override; network::NetworkConnectionTracker* GetNetworkConnectionTracker() override; BrowserPolicyConnectorIOS* GetBrowserPolicyConnector() override;
diff --git a/ios/chrome/test/testing_application_context.mm b/ios/chrome/test/testing_application_context.mm index ad7cf52..b72871b 100644 --- a/ios/chrome/test/testing_application_context.mm +++ b/ios/chrome/test/testing_application_context.mm
@@ -184,6 +184,11 @@ return nullptr; } +SafeBrowsingService* TestingApplicationContext::GetSafeBrowsingService() { + DCHECK(thread_checker_.CalledOnValidThread()); + return nullptr; +} + network::NetworkConnectionTracker* TestingApplicationContext::GetNetworkConnectionTracker() { DCHECK(thread_checker_.CalledOnValidThread());
diff --git a/ios/web/common/features.h b/ios/web/common/features.h index 5f4f9bc8..67a64ef 100644 --- a/ios/web/common/features.h +++ b/ios/web/common/features.h
@@ -52,11 +52,6 @@ // of properties using hard coded logic. extern const base::Feature kPreserveScrollViewProperties; -// Feature flag for making native (instead of WKWebView-provided) Safe -// Browsing available. When this flag is enabled, Safe Browsing is still -// subject to an opt-out controlled by prefs::kSafeBrowsingEnabled. -extern const base::Feature kSafeBrowsingAvailable; - // Level at which battery power is considered low, and some cosmetic features // can be turned off. const float kLowBatteryLevelThreshold = 0.2;
diff --git a/ios/web/common/features.mm b/ios/web/common/features.mm index eb0aee7..f5f43616 100644 --- a/ios/web/common/features.mm +++ b/ios/web/common/features.mm
@@ -44,8 +44,5 @@ const base::Feature kPreserveScrollViewProperties{ "PreserveScrollViewProperties", base::FEATURE_DISABLED_BY_DEFAULT}; -const base::Feature kSafeBrowsingAvailable{"SafeBrowsingAvailable", - base::FEATURE_DISABLED_BY_DEFAULT}; - } // namespace features } // namespace web
diff --git a/ios/web/web_state/ui/BUILD.gn b/ios/web/web_state/ui/BUILD.gn index 1a073e7..5d89e84 100644 --- a/ios/web/web_state/ui/BUILD.gn +++ b/ios/web/web_state/ui/BUILD.gn
@@ -115,6 +115,7 @@ source_set("wk_web_view_configuration_provider") { deps = [ "//base", + "//components/safe_browsing/core:features", "//ios/third_party/webkit", "//ios/web/common", "//ios/web/js_messaging",
diff --git a/ios/web/web_state/ui/DEPS b/ios/web/web_state/ui/DEPS new file mode 100644 index 0000000..79e20283 --- /dev/null +++ b/ios/web/web_state/ui/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+components/safe_browsing/core/features.h" +]
diff --git a/ios/web/web_state/ui/wk_web_view_configuration_provider.mm b/ios/web/web_state/ui/wk_web_view_configuration_provider.mm index b957e27..e8436c1 100644 --- a/ios/web/web_state/ui/wk_web_view_configuration_provider.mm +++ b/ios/web/web_state/ui/wk_web_view_configuration_provider.mm
@@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/strings/sys_string_conversions.h" +#include "components/safe_browsing/core/features.h" #include "ios/web/common/features.h" #import "ios/web/js_messaging/crw_wk_script_message_router.h" #import "ios/web/js_messaging/page_script_util.h" @@ -135,7 +136,8 @@ // conceptually similar to Safe Browsing but uses a non-Google provider and // only works for devices in certain locales. Disable this feature when // Safe Browsing is available. - if (base::FeatureList::IsEnabled(web::features::kSafeBrowsingAvailable)) { + if (base::FeatureList::IsEnabled( + safe_browsing::kSafeBrowsingAvailableOnIOS)) { [[configuration_ preferences] setFraudulentWebsiteWarningEnabled:NO]; } }
diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn index 92038689..fd7489b 100644 --- a/media/gpu/BUILD.gn +++ b/media/gpu/BUILD.gn
@@ -557,4 +557,17 @@ "//testing/gtest", ] } + + test("video_encode_accelerator_perf_tests") { + sources = [ "video_encode_accelerator_perf_tests.cc" ] + data = [ "//media/test/data/" ] + deps = [ + ":buildflags", + "test:helpers", + "test:video_encoder", + "test:video_encoder_test_environment", + "//media:test_support", + "//testing/gtest", + ] + } }
diff --git a/media/gpu/v4l2/v4l2_device_poller.cc b/media/gpu/v4l2/v4l2_device_poller.cc index a02025a..4981bbc2 100644 --- a/media/gpu/v4l2/v4l2_device_poller.cc +++ b/media/gpu/v4l2/v4l2_device_poller.cc
@@ -25,9 +25,12 @@ } V4L2DevicePoller::~V4L2DevicePoller() { - DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_); - - StopPolling(); + // It's possible the V4L2 device poller gets destroyed on a different thread + // than expected if e.g. destroying a decoder immediately after creation. The + // check here is not thread-safe, but using a lock or atomic state doesn't + // make sense as destruction is never thread-safe. + if (poll_thread_.IsRunning()) + StopPolling(); } bool V4L2DevicePoller::StartPolling(EventCallback event_callback,
diff --git a/media/gpu/video_encode_accelerator_perf_tests.cc b/media/gpu/video_encode_accelerator_perf_tests.cc new file mode 100644 index 0000000..cc38d9e --- /dev/null +++ b/media/gpu/video_encode_accelerator_perf_tests.cc
@@ -0,0 +1,372 @@ +// 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 <algorithm> +#include <numeric> +#include <vector> + +#include "base/command_line.h" +#include "base/files/file_util.h" +#include "base/json/json_writer.h" +#include "base/strings/stringprintf.h" +#include "media/base/bitstream_buffer.h" +#include "media/base/test_data_util.h" +#include "media/gpu/test/video.h" +#include "media/gpu/test/video_encoder/video_encoder.h" +#include "media/gpu/test/video_encoder/video_encoder_client.h" +#include "media/gpu/test/video_encoder/video_encoder_test_environment.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace media { +namespace test { + +namespace { + +// Video encoder perf tests usage message. Make sure to also update the +// documentation under docs/media/gpu/video_encoder_perf_test_usage.md when +// making changes here. +// TODO(dstaessens): Add video_encoder_perf_test_usage.md +constexpr const char* usage_msg = + "usage: video_encode_accelerator_perf_tests\n" + " [-v=<level>] [--vmodule=<config>] [--output_folder]\n" + " [--gtest_help] [--help]\n" + " [<video path>] [<video metadata path>]\n"; + +// Video encoder performance tests help message. +constexpr const char* help_msg = + "Run the video encode accelerator performance tests on the video\n" + "specified by <video path>. If no <video path> is given the default\n" + "\"puppets-320x180.nv12.yuv\" video will be used.\n" + "\nThe <video metadata path> should specify the location of a json file\n" + "containing the video's metadata. By default <video path>.json will be\n" + "used.\n" + "\nThe following arguments are supported:\n" + " -v enable verbose mode, e.g. -v=2.\n" + " --vmodule enable verbose mode for the specified module,\n" + " --output_folder overwrite the output folder used to store\n" + " performance metrics, if not specified results\n" + " will be stored in the current working directory.\n" + " --gtest_help display the gtest help and exit.\n" + " --help display this help and exit.\n"; + +// Default video to be used if no test video was specified. +constexpr base::FilePath::CharType kDefaultTestVideoPath[] = + FILE_PATH_LITERAL("puppets-320x180.nv12.yuv"); + +media::test::VideoEncoderTestEnvironment* g_env; + +// Default output folder used to store performance metrics. +constexpr const base::FilePath::CharType* kDefaultOutputFolder = + FILE_PATH_LITERAL("perf_metrics"); + +// Struct storing various time-related statistics. +struct PerformanceTimeStats { + PerformanceTimeStats() {} + explicit PerformanceTimeStats(const std::vector<double>& times); + double avg_ms_ = 0.0; + double percentile_25_ms_ = 0.0; + double percentile_50_ms_ = 0.0; + double percentile_75_ms_ = 0.0; +}; + +PerformanceTimeStats::PerformanceTimeStats(const std::vector<double>& times) { + if (times.empty()) + return; + + avg_ms_ = std::accumulate(times.begin(), times.end(), 0.0) / times.size(); + std::vector<double> sorted_times = times; + std::sort(sorted_times.begin(), sorted_times.end()); + percentile_25_ms_ = sorted_times[sorted_times.size() / 4]; + percentile_50_ms_ = sorted_times[sorted_times.size() / 2]; + percentile_75_ms_ = sorted_times[(sorted_times.size() * 3) / 4]; +} + +// TODO(dstaessens): Investigate using more appropriate metrics for encoding. +struct PerformanceMetrics { + // Write the collected performance metrics to the console. + void WriteToConsole() const; + // Write the collected performance metrics to file. + void WriteToFile() const; + + // Total measurement duration. + base::TimeDelta total_duration_; + // The number of bitstreams encoded. + size_t bitstreams_encoded_ = 0; + // The overall number of bitstreams encoded per second. + double bitstreams_per_second_ = 0.0; + // List of times between subsequent bitstream buffer deliveries. This is + // important in real-time encoding scenarios, where the delivery time should + // be less than the frame rate used. + std::vector<double> bitstream_delivery_times_; + // Statistics related to the time between bitstream buffer deliveries. + PerformanceTimeStats bitstream_delivery_stats_; + // List of times between queuing an encode operation and getting back the + // encoded bitstream buffer. + std::vector<double> bitstream_encode_times_; + // Statistics related to the encode times. + PerformanceTimeStats bitstream_encode_stats_; +}; + +// The performance evaluator can be plugged into the video encoder to collect +// various performance metrics. +class PerformanceEvaluator : public BitstreamProcessor { + public: + // Create a new performance evaluator. + PerformanceEvaluator() {} + + // Interface BitstreamProcessor + void ProcessBitstreamBuffer( + int32_t bitstream_buffer_id, + const BitstreamBufferMetadata& metadata, + const base::UnsafeSharedMemoryRegion* shm) override; + bool WaitUntilDone() override { return true; } + + // Start/Stop collecting performance metrics. + void StartMeasuring(); + void StopMeasuring(); + + // Get the collected performance metrics. + const PerformanceMetrics& Metrics() const { return perf_metrics_; } + + private: + // Start/end time of the measurement period. + base::TimeTicks start_time_; + base::TimeTicks end_time_; + + // Time at which the previous bitstream was delivered. + base::TimeTicks prev_bitstream_delivery_time_; + + // Collection of various performance metrics. + PerformanceMetrics perf_metrics_; +}; + +void PerformanceEvaluator::ProcessBitstreamBuffer( + int32_t bitstream_buffer_id, + const BitstreamBufferMetadata& metadata, + const base::UnsafeSharedMemoryRegion* shm) { + base::TimeTicks now = base::TimeTicks::Now(); + + base::TimeDelta delivery_time = (now - prev_bitstream_delivery_time_); + perf_metrics_.bitstream_delivery_times_.push_back( + delivery_time.InMillisecondsF()); + prev_bitstream_delivery_time_ = now; + + base::TimeDelta encode_time = now.since_origin() - metadata.timestamp; + perf_metrics_.bitstream_encode_times_.push_back( + encode_time.InMillisecondsF()); +} + +void PerformanceEvaluator::StartMeasuring() { + start_time_ = base::TimeTicks::Now(); + prev_bitstream_delivery_time_ = start_time_; +} + +void PerformanceEvaluator::StopMeasuring() { + DCHECK_EQ(perf_metrics_.bitstream_delivery_times_.size(), + perf_metrics_.bitstream_encode_times_.size()); + + end_time_ = base::TimeTicks::Now(); + perf_metrics_.total_duration_ = end_time_ - start_time_; + perf_metrics_.bitstreams_encoded_ = + perf_metrics_.bitstream_encode_times_.size(); + perf_metrics_.bitstreams_per_second_ = + perf_metrics_.bitstreams_encoded_ / + perf_metrics_.total_duration_.InSecondsF(); + + // Calculate delivery and encode time metrics. + perf_metrics_.bitstream_delivery_stats_ = + PerformanceTimeStats(perf_metrics_.bitstream_delivery_times_); + perf_metrics_.bitstream_encode_stats_ = + PerformanceTimeStats(perf_metrics_.bitstream_encode_times_); +} + +void PerformanceMetrics::WriteToConsole() const { + std::cout << "Bitstreams encoded: " << bitstreams_encoded_ << std::endl; + std::cout << "Total duration: " << total_duration_.InMillisecondsF() + << "ms" << std::endl; + std::cout << "FPS: " << bitstreams_per_second_ + << std::endl; + std::cout << "Bitstream delivery time - average: " + << bitstream_delivery_stats_.avg_ms_ << "ms" << std::endl; + std::cout << "Bitstream delivery time - percentile 25: " + << bitstream_delivery_stats_.percentile_25_ms_ << "ms" << std::endl; + std::cout << "Bitstream delivery time - percentile 50: " + << bitstream_delivery_stats_.percentile_50_ms_ << "ms" << std::endl; + std::cout << "Bitstream delivery time - percentile 75: " + << bitstream_delivery_stats_.percentile_75_ms_ << "ms" << std::endl; + std::cout << "Bitstream encode time - average: " + << bitstream_encode_stats_.avg_ms_ << "ms" << std::endl; + std::cout << "Bitstream encode time - percentile 25: " + << bitstream_encode_stats_.percentile_25_ms_ << "ms" << std::endl; + std::cout << "Bitstream encode time - percentile 50: " + << bitstream_encode_stats_.percentile_50_ms_ << "ms" << std::endl; + std::cout << "Bitstream encode time - percentile 75: " + << bitstream_encode_stats_.percentile_75_ms_ << "ms" << std::endl; +} + +void PerformanceMetrics::WriteToFile() const { + base::FilePath output_folder_path = base::FilePath(g_env->OutputFolder()); + if (!DirectoryExists(output_folder_path)) + base::CreateDirectory(output_folder_path); + output_folder_path = base::MakeAbsoluteFilePath(output_folder_path); + + // Write performance metrics to json. + base::Value metrics(base::Value::Type::DICTIONARY); + metrics.SetKey("BitstreamsEncoded", + base::Value(base::checked_cast<int>(bitstreams_encoded_))); + metrics.SetKey("TotalDurationMs", + base::Value(total_duration_.InMillisecondsF())); + metrics.SetKey("FPS", base::Value(bitstreams_per_second_)); + metrics.SetKey("BitstreamDeliveryTimeAverage", + base::Value(bitstream_delivery_stats_.avg_ms_)); + metrics.SetKey("BitstreamDeliveryTimePercentile25", + base::Value(bitstream_delivery_stats_.percentile_25_ms_)); + metrics.SetKey("BitstreamDeliveryTimePercentile50", + base::Value(bitstream_delivery_stats_.percentile_50_ms_)); + metrics.SetKey("BitstreamDeliveryTimePercentile75", + base::Value(bitstream_delivery_stats_.percentile_75_ms_)); + metrics.SetKey("BitstreamEncodeTimeAverage", + base::Value(bitstream_encode_stats_.avg_ms_)); + metrics.SetKey("BitstreamEncodeTimePercentile25", + base::Value(bitstream_encode_stats_.percentile_25_ms_)); + metrics.SetKey("BitstreamEncodeTimePercentile50", + base::Value(bitstream_encode_stats_.percentile_50_ms_)); + metrics.SetKey("BitstreamEncodeTimePercentile75", + base::Value(bitstream_encode_stats_.percentile_75_ms_)); + + // Write bitstream delivery times to json. + base::Value delivery_times(base::Value::Type::LIST); + for (double bitstream_delivery_time : bitstream_delivery_times_) { + delivery_times.Append(bitstream_delivery_time); + } + metrics.SetKey("BitstreamDeliveryTimes", std::move(delivery_times)); + + // Write bitstream encodes times to json. + base::Value encode_times(base::Value::Type::LIST); + for (double bitstream_encode_time : bitstream_encode_times_) { + encode_times.Append(bitstream_encode_time); + } + metrics.SetKey("BitstreamEncodeTimes", std::move(encode_times)); + + // Write json to file. + std::string metrics_str; + ASSERT_TRUE(base::JSONWriter::WriteWithOptions( + metrics, base::JSONWriter::OPTIONS_PRETTY_PRINT, &metrics_str)); + base::FilePath metrics_file_path = output_folder_path.Append( + g_env->GetTestOutputFilePath().AddExtension(FILE_PATH_LITERAL(".json"))); + // Make sure that the directory into which json is saved is created. + LOG_ASSERT(base::CreateDirectory(metrics_file_path.DirName())); + base::File metrics_output_file( + base::FilePath(metrics_file_path), + base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); + int bytes_written = metrics_output_file.WriteAtCurrentPos( + metrics_str.data(), metrics_str.length()); + ASSERT_EQ(bytes_written, static_cast<int>(metrics_str.length())); + VLOG(0) << "Wrote performance metrics to: " << metrics_file_path; +} + +// Video encode test class. Performs setup and teardown for each single test. +class VideoEncoderTest : public ::testing::Test { + public: + // Create a new video encoder instance. + std::unique_ptr<VideoEncoder> CreateVideoEncoder(const Video* video) { + LOG_ASSERT(video); + + std::vector<std::unique_ptr<BitstreamProcessor>> bitstream_processors; + auto performance_evaluator = std::make_unique<PerformanceEvaluator>(); + performance_evaluator_ = performance_evaluator.get(); + bitstream_processors.push_back(std::move(performance_evaluator)); + + VideoEncoderClientConfig config; + config.framerate = video->FrameRate(); + auto video_encoder = + VideoEncoder::Create(config, std::move(bitstream_processors)); + LOG_ASSERT(video_encoder); + LOG_ASSERT(video_encoder->Initialize(video)); + + return video_encoder; + } + + PerformanceEvaluator* performance_evaluator_; +}; + +} // namespace + +// Encode video from start to end while measuring uncapped performance. This +// test will encode a video as fast as possible, and gives an idea about the +// maximum output of the encoder. +TEST_F(VideoEncoderTest, MeasureUncappedPerformance) { + auto encoder = CreateVideoEncoder(g_env->Video()); + + performance_evaluator_->StartMeasuring(); + encoder->Encode(); + EXPECT_TRUE(encoder->WaitForFlushDone()); + performance_evaluator_->StopMeasuring(); + + auto metrics = performance_evaluator_->Metrics(); + metrics.WriteToConsole(); + metrics.WriteToFile(); + + EXPECT_EQ(encoder->GetFlushDoneCount(), 1u); + EXPECT_EQ(encoder->GetFrameReleasedCount(), g_env->Video()->NumFrames()); +} + +} // namespace test +} // namespace media + +int main(int argc, char** argv) { + // Set the default test data path. + media::test::Video::SetTestDataPath(media::GetTestDataPath()); + + // Print the help message if requested. This needs to be done before + // initializing gtest, to overwrite the default gtest help message. + base::CommandLine::Init(argc, argv); + const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); + LOG_ASSERT(cmd_line); + if (cmd_line->HasSwitch("help")) { + std::cout << media::test::usage_msg << "\n" << media::test::help_msg; + return 0; + } + + // Check if a video was specified on the command line. + base::CommandLine::StringVector args = cmd_line->GetArgs(); + base::FilePath video_path = + (args.size() >= 1) ? base::FilePath(args[0]) + : base::FilePath(media::test::kDefaultTestVideoPath); + base::FilePath video_metadata_path = + (args.size() >= 2) ? base::FilePath(args[1]) : base::FilePath(); + + // Parse command line arguments. + base::FilePath::StringType output_folder = media::test::kDefaultOutputFolder; + base::CommandLine::SwitchMap switches = cmd_line->GetSwitches(); + for (base::CommandLine::SwitchMap::const_iterator it = switches.begin(); + it != switches.end(); ++it) { + if (it->first.find("gtest_") == 0 || // Handled by GoogleTest + it->first == "v" || it->first == "vmodule") { // Handled by Chrome + continue; + } + + if (it->first == "output_folder") { + output_folder = it->second; + } else { + std::cout << "unknown option: --" << it->first << "\n" + << media::test::usage_msg; + return EXIT_FAILURE; + } + } + + testing::InitGoogleTest(&argc, argv); + + // Set up our test environment. + media::test::VideoEncoderTestEnvironment* test_environment = + media::test::VideoEncoderTestEnvironment::Create( + video_path, video_metadata_path, base::FilePath(output_folder)); + if (!test_environment) + return EXIT_FAILURE; + + media::test::g_env = static_cast<media::test::VideoEncoderTestEnvironment*>( + testing::AddGlobalTestEnvironment(test_environment)); + + return RUN_ALL_TESTS(); +}
diff --git a/mojo/public/cpp/base/BUILD.gn b/mojo/public/cpp/base/BUILD.gn index c435640..5341d72 100644 --- a/mojo/public/cpp/base/BUILD.gn +++ b/mojo/public/cpp/base/BUILD.gn
@@ -23,23 +23,6 @@ ] } -component("typemap_traits") { - output_name = "mojo_base_typemap_traits" - - sources = [ - "big_string_mojom_traits.cc", - "big_string_mojom_traits.h", - ] - - defines = [ "IS_MOJO_BASE_TRAITS_IMPL" ] - - public_deps = [ - ":shared_typemap_traits", - "//base", - "//mojo/public/cpp/base", - ] -} - # Normally typemap traits sources should be build directly into mojom targets # via the typemap file. This target is for typemapped mojo_base types whose # traits are shared between chromium and blink variants.
diff --git a/mojo/public/cpp/base/big_buffer.typemap b/mojo/public/cpp/base/big_buffer.typemap new file mode 100644 index 0000000..7a8af041 --- /dev/null +++ b/mojo/public/cpp/base/big_buffer.typemap
@@ -0,0 +1,13 @@ +# 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. + +mojom = "//mojo/public/mojom/base/big_buffer.mojom" +public_headers = [ "//mojo/public/cpp/base/big_buffer.h" ] +traits_headers = [ "//mojo/public/cpp/base/big_buffer_mojom_traits.h" ] +public_deps = [ + "//mojo/public/cpp/base", + "//mojo/public/cpp/base:shared_typemap_traits", +] +type_mappings = + [ "mojo_base.mojom.BigBuffer=::mojo_base::BigBuffer[move_only]" ]
diff --git a/mojo/public/cpp/base/big_string.typemap b/mojo/public/cpp/base/big_string.typemap new file mode 100644 index 0000000..db30996 --- /dev/null +++ b/mojo/public/cpp/base/big_string.typemap
@@ -0,0 +1,17 @@ +# Copyright 2018 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. + +mojom = "//mojo/public/mojom/base/big_string.mojom" +public_headers = [] +traits_headers = [ "//mojo/public/cpp/base/big_string_mojom_traits.h" ] +sources = [ + "//mojo/public/cpp/base/big_string_mojom_traits.cc", + "//mojo/public/cpp/base/big_string_mojom_traits.h", +] +public_deps = [ + "//mojo/public/cpp/base", + "//mojo/public/cpp/base:shared_typemap_traits", +] + +type_mappings = [ "mojo_base.mojom.BigString=::std::string" ]
diff --git a/mojo/public/cpp/base/big_string_mojom_traits.h b/mojo/public/cpp/base/big_string_mojom_traits.h index dc513f9..8f490e25 100644 --- a/mojo/public/cpp/base/big_string_mojom_traits.h +++ b/mojo/public/cpp/base/big_string_mojom_traits.h
@@ -15,7 +15,7 @@ namespace mojo { template <> -struct COMPONENT_EXPORT(MOJO_BASE_TRAITS) +struct COMPONENT_EXPORT(MOJO_BASE_MOJOM) StructTraits<mojo_base::mojom::BigStringDataView, std::string> { static mojo_base::BigBuffer data(const std::string& str);
diff --git a/mojo/public/cpp/base/generic_pending_receiver.typemap b/mojo/public/cpp/base/generic_pending_receiver.typemap new file mode 100644 index 0000000..f2c2d44d --- /dev/null +++ b/mojo/public/cpp/base/generic_pending_receiver.typemap
@@ -0,0 +1,15 @@ +# Copyright 2019 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. + +mojom = "//mojo/public/mojom/base/generic_pending_receiver.mojom" +public_headers = [ "//mojo/public/cpp/bindings/generic_pending_receiver.h" ] +traits_headers = + [ "//mojo/public/cpp/base/generic_pending_receiver_mojom_traits.h" ] +public_deps = [ + "//mojo/public/cpp/bindings", +] +deps = [ + "//mojo/public/cpp/base:shared_typemap_traits", +] +type_mappings = [ "mojo_base.mojom.GenericPendingReceiver=::mojo::GenericPendingReceiver[move_only,nullable_is_same_type]" ]
diff --git a/mojo/public/cpp/base/time.typemap b/mojo/public/cpp/base/time.typemap new file mode 100644 index 0000000..898091a9 --- /dev/null +++ b/mojo/public/cpp/base/time.typemap
@@ -0,0 +1,17 @@ +# 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. + +mojom = "//mojo/public/mojom/base/time.mojom" +public_headers = [ "//base/time/time.h" ] +traits_headers = [ "//mojo/public/cpp/base/time_mojom_traits.h" ] +public_deps = [ + "//base", + "//mojo/public/cpp/base:shared_typemap_traits", +] + +type_mappings = [ + "mojo_base.mojom.Time=::base::Time[copyable_pass_by_value]", + "mojo_base.mojom.TimeDelta=::base::TimeDelta[copyable_pass_by_value]", + "mojo_base.mojom.TimeTicks=::base::TimeTicks[copyable_pass_by_value]", +]
diff --git a/mojo/public/cpp/base/typemaps.gni b/mojo/public/cpp/base/typemaps.gni index 4191d54..97ff2d7b 100644 --- a/mojo/public/cpp/base/typemaps.gni +++ b/mojo/public/cpp/base/typemaps.gni
@@ -4,10 +4,13 @@ typemaps = [ "//mojo/public/cpp/base/application_state.typemap", + "//mojo/public/cpp/base/big_buffer.typemap", + "//mojo/public/cpp/base/big_string.typemap", "//mojo/public/cpp/base/file_error.typemap", "//mojo/public/cpp/base/file_info.typemap", "//mojo/public/cpp/base/file_path.typemap", "//mojo/public/cpp/base/file.typemap", + "//mojo/public/cpp/base/generic_pending_receiver.typemap", "//mojo/public/cpp/base/read_only_buffer.typemap", "//mojo/public/cpp/base/memory_allocator_dump_cross_process_uid.typemap", "//mojo/public/cpp/base/memory_pressure_level.typemap", @@ -19,5 +22,8 @@ "//mojo/public/cpp/base/logfont_win.typemap", "//mojo/public/cpp/base/text_direction.typemap", "//mojo/public/cpp/base/thread_priority.typemap", + "//mojo/public/cpp/base/time.typemap", "//mojo/public/cpp/base/token.typemap", + "//mojo/public/cpp/base/unguessable_token.typemap", + "//mojo/public/cpp/base/values.typemap", ]
diff --git a/mojo/public/cpp/base/unguessable_token.typemap b/mojo/public/cpp/base/unguessable_token.typemap new file mode 100644 index 0000000..65600ade --- /dev/null +++ b/mojo/public/cpp/base/unguessable_token.typemap
@@ -0,0 +1,12 @@ +# 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. + +mojom = "//mojo/public/mojom/base/unguessable_token.mojom" +public_headers = [ "//base/unguessable_token.h" ] +traits_headers = [ "//mojo/public/cpp/base/unguessable_token_mojom_traits.h" ] +public_deps = [ + "//mojo/public/cpp/base:shared_typemap_traits", +] + +type_mappings = [ "mojo_base.mojom.UnguessableToken=::base::UnguessableToken" ]
diff --git a/mojo/public/cpp/base/values.typemap b/mojo/public/cpp/base/values.typemap new file mode 100644 index 0000000..f72ab46d --- /dev/null +++ b/mojo/public/cpp/base/values.typemap
@@ -0,0 +1,16 @@ +# Copyright 2018 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. + +mojom = "//mojo/public/mojom/base/values.mojom" +public_headers = [ "//base/values.h" ] +traits_headers = [ "//mojo/public/cpp/base/values_mojom_traits.h" ] +public_deps = [ + "//base", + "//mojo/public/cpp/base:shared_typemap_traits", +] +type_mappings = [ + "mojo_base.mojom.Value=::base::Value[move_only]", + "mojo_base.mojom.DictionaryValue=::base::Value[move_only]", + "mojo_base.mojom.ListValue=::base::Value[move_only]", +]
diff --git a/mojo/public/cpp/bindings/README.md b/mojo/public/cpp/bindings/README.md index 3b40fa8e..19cbf66 100644 --- a/mojo/public/cpp/bindings/README.md +++ b/mojo/public/cpp/bindings/README.md
@@ -1307,6 +1307,22 @@ The correct answer is, "Yes! That would be nice!" And fortunately, it can! +### Global Configuration + +While this feature is quite powerful, it introduces some unavoidable complexity +into build system. This stems from the fact that type-mapping is an inherently +viral concept: if `gfx::mojom::Rect` is mapped to `gfx::Rect` anywhere, the +mapping needs to apply *everywhere*. + +For this reason we have a few global typemap configurations defined in +[chromium_bindings_configuration.gni](https://cs.chromium.org/chromium/src/mojo/public/tools/bindings/chromium_bindings_configuration.gni) +and +[blink_bindings_configuration.gni](https://cs.chromium.org/chromium/src/mojo/public/tools/bindings/blink_bindings_configuration.gni). These configure the two supported [variants](#Variants) of Mojom generated +bindings in the repository. Read more on this in the sections that follow. + +For now, let's take a look at how to express the mapping from `gfx::mojom::Rect` +to `gfx::Rect`. + ### Defining `StructTraits` In order to teach generated bindings code how to serialize an arbitrary native @@ -1319,11 +1335,11 @@ methods: * A single static accessor for every field of the Mojom struct, with the exact - same name as the struct field. These accessors must all take a (preferably - const) ref to an object of the native type, and must return a value compatible - with the Mojom struct field's type. This is used to safely and consistently - extract data from the native type during message serialization without - incurring extra copying costs. + same name as the struct field. These accessors must all take a const ref to + an object of the native type, and must return a value compatible with the + Mojom struct field's type. This is used to safely and consistently extract + data from the native type during message serialization without incurring extra + copying costs. * A single static `Read` method which initializes an instance of the the native type given a serialized representation of the Mojom struct. The `Read` method @@ -1420,96 +1436,89 @@ We've defined the `StructTraits` necessary, but we still need to teach the bindings generator (and hence the build system) about the mapping. To do this we -must create a new `mojom_cpp_typemap` target in GN. We can define this -anywhere, but conventionally we will put it in the same BUILD.gn that defines -the `mojom` target which will use it. +must create a **typemap** file, which uses familiar GN syntax to describe the +new type mapping. + +Let's place this `geometry.typemap` file alongside our Mojom file: ``` -mojom_cpp_typemap("geometry_typemap") { - types = [ - { - mojom = "gfx.mojom.Rect" - cpp = "::gfx::Rect" - } - ] - - public_headers = [ - "//ui/gfx/geometry/mojo/geometry_mojom_traits.h", - "//ui/gfx/geometry/rect.h", - ] - - # NOTE: We use |traits_sources| for simplicity in this example, but see the - # section below for a more robust alternative. - traits_sources = [ - "//ui/gfx/geometry/mojo/geometry_mojom_traits.cc", - "//ui/gfx/geometry/mojo/geometry_mojom_traits.h", - ] - - public_deps = [ "//ui/gfx/geometry" ] -} +mojom = "//ui/gfx/geometry/mojo/geometry.mojom" +os_whitelist = [ "android" ] +public_headers = [ "//ui/gfx/geometry/rect.h" ] +traits_headers = [ "//ui/gfx/geometry/mojo/geometry_mojom_traits.h" ] +sources = [ + "//ui/gfx/geometry/mojo/geometry_mojom_traits.cc", + "//ui/gfx/geometry/mojo/geometry_mojom_traits.h", +] +public_deps = [ "//ui/gfx/geometry" ] +type_mappings = [ + "gfx.mojom.Rect=::gfx::Rect", +] ``` -See the `mojom_cpp_typemap` documentation in -[mojom.gni](https://cs.chromium.org/chromium/src/mojo/public/tools/bindings/mojom.gni) -for details on the above definition and other supported parameters. +Let's look at each of the variables above: -Now that we have the typemap target defined we need to reference it in the -`mojom` GN target which defines gfx.mojom.Rect. We can do that trivially by -adding to the `cpp_typemaps` list: +* `mojom`: Specifies the `mojom` file to which the typemap applies. Many + typemaps may apply to the same `mojom` file, but any given typemap may only + apply to a single `mojom` file. +* `os_whitelist`: Optional list of specific platforms this typemap + should be constrained to. +* `public_headers`: Additional headers required by any code which would depend + on the Mojom definition of `gfx.mojom.Rect` now that the typemap is applied. + Any headers required for the native target type definition should be listed + here. +* `traits_headers`: Headers which contain the relevant `StructTraits` + specialization(s) for any type mappings described by this file. +* `sources`: Any implementation sources needed for the `StructTraits` + definition. These sources are compiled directly into the generated C++ + bindings target for a `mojom` file applying this typemap. +* `public_deps`: Target dependencies exposed by the `public_headers` and + `traits_headers`. +* `deps`: Target dependencies exposed by `sources` but not already covered by + `public_deps`. +* `type_mappings`: A list of type mappings to be applied for this typemap. The + strings in this list are of the format `"MojomType=CppType"`, where + `MojomType` must be a fully qualified Mojom typename and `CppType` must be a + fully qualified C++ typename. Additional attributes may be specified in square + brackets following the `CppType`: + * `move_only`: The `CppType` is move-only and should be passed by value + in any generated method signatures. Note that `move_only` is transitive, + so containers of `MojomType` will translate to containers of `CppType` + also passed by value. + * `copyable_pass_by_value`: Forces values of type `CppType` to be passed by + value without moving them. Unlike `move_only`, this is not transitive. + * `nullable_is_same_type`: By default a non-nullable `MojomType` will be + mapped to `CppType` while a nullable `MojomType?` will be mapped to + `base::Optional<CppType>`. If this attribute is set, the `base::Optional` + wrapper is omitted for nullable `MojomType?` values, but the + `StructTraits` definition for this type mapping must define additional + `IsNull` and `SetToNull` methods. + * `force_serialize`: The typemap is incompatible with lazy serialization + (e.g. consider a typemap to a `base::StringPiece`, where retaining a + copy is unsafe). Any messages carrying the type will be forced down the + eager serailization path. + + +Now that we have the typemap file we need to add it to a local list of typemaps +that can be added to the global configuration. We create a new +`//ui/gfx/typemaps.gni` file with the following contents: ``` -mojom("mojom") { - sources = [ - "rect.mojom", - ... - ] - - cpp_typemaps = [ ":geometry_typemap" ] - - ... -} +typemaps = [ + "//ui/gfx/geometry/mojo/geometry.typemap", +] ``` -For the Blink variant of bindings, add to the `blink_cpp_typemaps` list instead. - -### Type Mapping Without `traits_sources` - -Inlining the traits sources into the typemap definition means that the sources -get baked directly into the corresponding `mojom` target's sources. This can -be problematic in a few scenarios: - -* You want to use the same typemap for both Blink and non-Blink bindings -* Your `mojom` target is actually a `mojom_component` target - -For these cases, it is recommended that you define a separate `component` target -for your typemap traits, and reference this in the `public_deps` of the typemap: +And finally we can reference this file in the global default (Chromium) bindings +configuration by adding it to `_typemap_imports` in +[chromium_bindings_configuration.gni](https://cs.chromium.org/chromium/src/mojo/public/tools/bindings/chromium_bindings_configuration.gni): ``` -component("geometry_mojom_traits") { - sources = [ - "//ui/gfx/geometry/mojo/geometry_mojom_traits.cc", - "//ui/gfx/geometry/mojo/geometry_mojom_traits.h", - ] - - # The header of course needs corresponding COMPONENT_EXPORT() tags. - defines = [ "IS_GEOMETRY_MOJOM_TRAITS_IMPL" ] - - ... -} -``` - -mojom_cpp_typemap("geometry_typemap") { - # Same as the example above. - types = [ ... ] - public_headers = [ ... ] - - # NOTE: No |traits_sources|. - - public_deps = [ - ":geometry_mojom_traits", - "//ui/gfx/geometry", - ] -} +_typemap_imports = [ + ..., + "//ui/gfx/typemaps.gni", + ..., +] ``` ### StructTraits Reference @@ -1675,31 +1684,13 @@ ``` In addition to using different C++ types for builtin strings, arrays, and maps, -the custom typemaps applied to Blink bindings are managed separately from -regular bindings. +the global typemap configuration for default and "blink" variants are completely +separate. To add a typemap for the Blink configuration, you can modify +[blink_bindings_configuration.gni](https://cs.chromium.org/chromium/src/mojo/public/tools/bindings/blink_bindings_configuration.gni). -`mojom` targets support a `blink_cpp_typemaps` parameter in addition to the -regular `cpp_typemaps`. This lists the typemaps to apply to Blink bindings. - -To depend specifically on generated Blink bindings, reference -`${target_name}_blink`. So for example, with the definition: - -``` -# In //foo/mojom -mojom("mojom") { - sources = [ - "db.mojom", - ] -} -``` - -C++ sources can depend on the Blink bindings by depending on -`"//foo/mojom:mojom_blink"`. - -Finally note that both bindings variants share some common definitions which are -unaffected by differences in the type-mapping configuration (like enums, and -structures describing serialized object formats). These definitions are -generated in *shared* sources: +All variants share some definitions which are unaffected by differences in the +type mapping configuration (enums, for example). These definitions are generated +in *shared* sources: ``` out/gen/sample/db.mojom-shared.cc @@ -1711,9 +1702,22 @@ implicitly includes the shared header, but may wish to include *only* the shared header in some instances. -C++ sources can depend on shared sources only, by referencing the -`"${target_name}_shared"` target, e.g. `"//foo/mojom:mojom_shared"` in the -example above. +Finally, note that for `mojom` GN targets, there is implicitly a corresponding +`mojom_{variant}` target defined for any supported bindings configuration. So +for example if you've defined in `//sample/BUILD.gn`: + +``` +import("mojo/public/tools/bindings/mojom.gni") + +mojom("mojom") { + sources = [ + "db.mojom", + ] +} +``` + +Code in Blink which wishes to use the generated Blink-variant definitions must +depend on `"//sample:mojom_blink"`. ## Versioning Considerations
diff --git a/mojo/public/mojom/base/BUILD.gn b/mojo/public/mojom/base/BUILD.gn index 4aa90a9c..a99ad79 100644 --- a/mojo/public/mojom/base/BUILD.gn +++ b/mojo/public/mojom/base/BUILD.gn
@@ -43,138 +43,4 @@ output_prefix = "mojo_base_mojom" macro_prefix = "MOJO_BASE_MOJOM" - - common_typemaps = [ - ":big_buffer_typemap", - ":generic_pending_receiver_typemap", - ":time_typemap", - ":unguessable_token_typemap", - ":value_typemap", - ] - - cpp_typemaps = common_typemaps + [ ":big_string_typemap" ] - - blink_cpp_typemaps = - common_typemaps + - [ "//third_party/blink/renderer/platform/mojo:big_string_typemap" ] -} - -mojom_cpp_typemap("big_buffer_typemap") { - types = [ - { - mojom = "mojo_base.mojom.BigBuffer" - cpp = "::mojo_base::BigBuffer" - move_only = true - }, - ] - public_headers = [ - "//mojo/public/cpp/base/big_buffer.h", - "//mojo/public/cpp/base/big_buffer_mojom_traits.h", - ] - public_deps = [ - "//mojo/public/cpp/base", - "//mojo/public/cpp/base:shared_typemap_traits", - ] -} - -mojom_cpp_typemap("big_string_typemap") { - types = [ - { - mojom = "mojo_base.mojom.BigString" - cpp = "::std::string" - }, - ] - public_headers = [ "//mojo/public/cpp/base/big_string_mojom_traits.h" ] - public_deps = [ - "//mojo/public/cpp/base", - "//mojo/public/cpp/base:typemap_traits", - ] -} - -mojom_cpp_typemap("generic_pending_receiver_typemap") { - types = [ - { - mojom = "mojo_base.mojom.GenericPendingReceiver" - cpp = "::mojo::GenericPendingReceiver" - move_only = true - nullable_is_same_type = true - }, - ] - public_headers = [ - "//mojo/public/cpp/base/generic_pending_receiver_mojom_traits.h", - "//mojo/public/cpp/bindings/generic_pending_receiver.h", - ] - public_deps = [ - "//mojo/public/cpp/base:shared_typemap_traits", - "//mojo/public/cpp/bindings", - ] -} - -mojom_cpp_typemap("time_typemap") { - types = [ - { - mojom = "mojo_base.mojom.Time" - cpp = "::base::Time" - copyable_pass_by_value = true - }, - { - mojom = "mojo_base.mojom.TimeDelta" - cpp = "::base::TimeDelta" - copyable_pass_by_value = true - }, - { - mojom = "mojo_base.mojom.TimeTicks" - cpp = "::base::TimeTicks" - copyable_pass_by_value = true - }, - ] - - public_headers = [ - "//base/time/time.h", - "//mojo/public/cpp/base/time_mojom_traits.h", - ] - public_deps = [ - "//base", - "//mojo/public/cpp/base:shared_typemap_traits", - ] -} - -mojom_cpp_typemap("unguessable_token_typemap") { - types = [ - { - mojom = "mojo_base.mojom.UnguessableToken" - cpp = "::base::UnguessableToken" - }, - ] - public_headers = [ "//mojo/public/cpp/base/unguessable_token_mojom_traits.h" ] - public_deps = [ - "//base", - "//mojo/public/cpp/base:shared_typemap_traits", - ] -} - -mojom_cpp_typemap("value_typemap") { - types = [ - { - mojom = "mojo_base.mojom.Value" - cpp = "::base::Value" - move_only = true - }, - { - mojom = "mojo_base.mojom.ListValue" - cpp = "::base::Value" - move_only = true - }, - { - mojom = "mojo_base.mojom.DictionaryValue" - cpp = "::base::Value" - move_only = true - }, - ] - - public_headers = [ "//mojo/public/cpp/base/values_mojom_traits.h" ] - public_deps = [ - "//base", - "//mojo/public/cpp/base:shared_typemap_traits", - ] }
diff --git a/mojo/public/tools/bindings/chromium_bindings_configuration.gni b/mojo/public/tools/bindings/chromium_bindings_configuration.gni index 968f9f1..3f4e071b 100644 --- a/mojo/public/tools/bindings/chromium_bindings_configuration.gni +++ b/mojo/public/tools/bindings/chromium_bindings_configuration.gni
@@ -61,6 +61,7 @@ "//ui/gfx/typemaps.gni", "//ui/gl/typemaps.gni", "//ui/latency/mojom/typemaps.gni", + "//url/mojom/typemaps.gni", ] _typemaps = []
diff --git a/mojo/public/tools/bindings/generate_type_mappings.py b/mojo/public/tools/bindings/generate_type_mappings.py index de4b190a..ee55e99 100755 --- a/mojo/public/tools/bindings/generate_type_mappings.py +++ b/mojo/public/tools/bindings/generate_type_mappings.py
@@ -81,36 +81,6 @@ return result -def LoadCppTypemapConfigs(paths): - _SUPPORTED_KEYS = set([ - 'mojom', 'cpp', 'public_headers', 'copyable_pass_by_value', - 'force_serialize', 'hashable', 'move_only', 'nullable_is_same_type' - ]) - - configs = {} - for path in paths: - with open(path) as f: - config = json.load(f) - for entry in config['types']: - for key in entry.iterkeys(): - if key not in _SUPPORTED_KEYS: - raise IOError('Invalid typemap property "%s" when processing %s' % - (key, path)) - - configs[entry['mojom']] = { - 'typename': entry['cpp'], - 'public_headers': config.get('public_headers', []), - 'copyable_pass_by_value': entry.get('copyable_pass_by_value', - False), - 'force_serialize': entry.get('force_serialize', False), - 'hashable': entry.get('hashable', False), - 'move_only': entry.get('move_only', False), - 'nullable_is_same_type': entry.get('nullable_is_same_type', False), - 'non_copyable_non_movable': False, - } - return configs - - def ParseTypemap(typemap): values = {'type_mappings': [], 'public_headers': [], 'traits_headers': []} for line in typemap.split('\n'): @@ -167,21 +137,12 @@ default=[], help=('A path to another JSON typemap to merge into the output. ' 'This may be repeated to merge multiple typemaps.')) - parser.add_argument( - '--cpp-typemap-config', - type=str, - action='append', - default=[], - dest='cpp_config_paths', - help=('A path to a single JSON-formatted typemap config as emitted by' - 'GN when processing a mojom_cpp_typemap build rule.')) parser.add_argument('--output', type=str, required=True, help='The path to which to write the generated JSON.') params, typemap_params = parser.parse_known_args() typemaps = ParseTypemapArgs(typemap_params) - typemaps.update(LoadCppTypemapConfigs(params.cpp_config_paths)) missing = [path for path in params.dependency if not os.path.exists(path)] if missing: raise IOError('Missing dependencies: %s' % ', '.join(missing))
diff --git a/mojo/public/tools/bindings/mojom.gni b/mojo/public/tools/bindings/mojom.gni index e99a968..4e22eb0 100644 --- a/mojo/public/tools/bindings/mojom.gni +++ b/mojo/public/tools/bindings/mojom.gni
@@ -220,14 +220,6 @@ # will still be generated even when |cpp_only| is set to |true|, unless # you also set |enable_fuzzing| to |false| in your mojom target. # -# cpp_typemaps (optional) -# A list of mojom_cpp_typemap targets to be applied to the generated -# C++ bindings for this mojom target. Note that this only applies to the -# non-Blink variant of generated C++ bindings. -# -# blink_cpp_typemaps (optional) -# Same as above, but for the Blink variant of generated C++ bindings. -# # generate_java (optional) # If set to true, Java bindings are generated for Android builds. If # |cpp_only| is set to true, it overrides this to prevent generation of @@ -386,13 +378,6 @@ assert(defined(invoker.component_deps_blink)) } - # Type-mapping may be disabled or we may not generate C++ bindings. - not_needed(invoker, - [ - "cpp_typemaps", - "blink_cpp_typemaps", - ]) - require_full_cpp_deps = !defined(invoker.disallow_native_types) || !invoker.disallow_native_types || !defined(invoker.disallow_interfaces) || @@ -859,57 +844,22 @@ cpp_only = true } - cpp_typemap_targets = [] export_defines = [] export_defines_overridden = false force_source_set = false if (defined(bindings_configuration.for_blink) && bindings_configuration.for_blink) { - if (defined(invoker.blink_cpp_typemaps)) { - cpp_typemap_targets = invoker.blink_cpp_typemaps - } if (defined(invoker.export_define_blink)) { export_defines_overridden = true export_defines = [ invoker.export_define_blink ] force_source_set = true } - } else { - if (defined(invoker.cpp_typemaps)) { - cpp_typemap_targets = invoker.cpp_typemaps - } - - if (defined(invoker.export_define)) { - export_defines_overridden = true - export_defines = [ invoker.export_define ] - force_source_set = true - } + } else if (defined(invoker.export_define)) { + export_defines_overridden = true + export_defines = [ invoker.export_define ] + force_source_set = true } - cpp_typemap_configs = [] - foreach(typemap_target, cpp_typemap_targets) { - typemap_config_dir = get_label_info(typemap_target, "target_gen_dir") - typemap_config_name = get_label_info(typemap_target, "name") - - _config = { - } - - # Targets generated by the typemap target's template. These consolidate - # the typemap's specified deps so that our generated sources can inherit - # them. - _config.deps = [ "${typemap_target}__source_deps" ] - _config.public_deps = [ "${typemap_target}__source_public_deps" ] - _config.configs = [ "${typemap_target}__source_configs" ] - _config.public_configs = [ "${typemap_target}__source_public_configs" ] - - # This is the file written out by GN when processing the typemap target's - # definition (during build generation, NOT during build). We feed this - # into the bindings generator. - _config.config_filename = - "$typemap_config_dir/${typemap_config_name}.typemap_config" - cpp_typemap_configs += [ _config ] - } - not_needed([ "cpp_typemap_configs" ]) - if (!export_defines_overridden && defined(invoker.component_macro_prefix)) { output_name_override = "${invoker.component_output_prefix}${variant_suffix}" @@ -1011,13 +961,6 @@ } } - foreach(config, cpp_typemap_configs) { - _typemap = { - } - _typemap.config = config - active_typemaps += [ _typemap ] - } - generator_target_name = "${target_name}${variant_suffix}__generator" action(generator_target_name) { visibility = [ ":*" ] @@ -1135,9 +1078,6 @@ dependency_path, ] } - foreach(typemap_target, cpp_typemap_targets) { - deps += [ "${typemap_target}__json_config" ] - } if (sources_list != []) { # TODO(sammc): Pass the typemap description in a file to avoid command @@ -1147,38 +1087,25 @@ _typemap_config = { } _typemap_config = typemap.config - - # Old style typemaps are passed inline on the command line - if (defined(_typemap_config.type_mappings)) { - typemap_description += [ "--start-typemap" ] - if (defined(_typemap_config.public_headers)) { - foreach(value, _typemap_config.public_headers) { - typemap_description += [ "public_headers=$value" ] - } + typemap_description += [ "--start-typemap" ] + if (defined(_typemap_config.public_headers)) { + foreach(value, _typemap_config.public_headers) { + typemap_description += [ "public_headers=$value" ] } - if (defined(_typemap_config.traits_headers)) { - foreach(value, _typemap_config.traits_headers) { - typemap_description += [ "traits_headers=$value" ] - } - } - foreach(value, _typemap_config.type_mappings) { - typemap_description += [ "type_mappings=$value" ] - } - - # The typemap configuration files are not actually used as inputs here - # but this establishes a necessary build dependency to ensure that - # typemap changes force a rebuild of affected targets. - if (defined(typemap.filename)) { - inputs += [ typemap.filename ] - } - } else { - assert(defined(_typemap_config.config_filename)) - inputs += [ _typemap_config.config_filename ] - typemap_description += [ - "--cpp-typemap-config", - rebase_path(_typemap_config.config_filename, root_build_dir), - ] } + if (defined(_typemap_config.traits_headers)) { + foreach(value, _typemap_config.traits_headers) { + typemap_description += [ "traits_headers=$value" ] + } + } + foreach(value, _typemap_config.type_mappings) { + typemap_description += [ "type_mappings=$value" ] + } + + # The typemap configuration files are not actually used as inputs here + # but this establishes a necessary build dependency to ensure that + # typemap changes force a rebuild of affected targets. + inputs += [ typemap.filename ] } args += typemap_description } @@ -1656,172 +1583,3 @@ component_macro_prefix = invoker.macro_prefix } } - -# Specifies a type-mapping configuration for one or more mojom types to native -# C++ types. The mojom() target which defines the named mojom type map reference -# this typemap target in either (or both) its |cpp_typemaps| or -# |blink_cpp_typemaps| lists in order to apply the typemap to generated C++ -# bindings. -# -# NOTE: If no mojom() target references a typemap target in its definition, the -# typemap has no interesting effect on the build. -# -# Required parameters for mojom_cpp_typemap(): -# -# types -# A list of type specifications for this typemap. Each type specification -# is a GN scope, which can be expressed with the following syntax: -# -# { -# mojom = "foo.mojom.Bar" -# cpp = "::foo::LegitBar" -# move_only = true -# # etc... -# } -# -# Each type specification supports the following values: -# -# mojom (required) -# The fully qualified name of a mojom type to be mapped. This is a -# string like "foo.mojom.Bar". -# -# cpp (required) -# The fully qualified name of the C++ type to which the mojom type -# should be mapped in generated bindings. This is a string like -# "::base::Value" or "std::vector<::base::Value>". -# -# move_only (optional) -# A boolean value (default false) which indicates whether the C++ -# type is move-only. If true, generated bindings will pass the type -# by value and use std::move() at call sites. -# -# copyable_pass_by_value (optional) -# A boolean value (default false) which effectively indicates -# whether the C++ type is very cheap to copy. If so, generated -# bindings will pass by value but not use std::move() at call sites. -# -# nullable_is_same_type (optional) -# A boolean value (default false) which indicates that the C++ type -# has some baked-in semantic notion of a "null" state. If true, the -# traits for the type must define IsNull and SetToNull methods. -# -# When false, nullable fields are represented by wrapping the C++ -# type with base::Optional, and null values are simply -# base::nullopt. -# -# hashable (optional) -# A boolean value (default false) indicating whether the C++ type is -# hashable. Set to true if true AND needed (i.e. you need to use the -# type as the key of a mojom map). -# -# force_serialize (optional) -# A boolean value (default false) which disables lazy serialization -# of the typemapped type if lazy serialization is enabled for the -# mojom target applying this typemap. -# -# -# Optional parameters for mojom_cpp_typemap(): -# -# public_headers (optional) -# Headers which must be included in the generated mojom in order for -# serialization to be possible. This generally means including at least -# the header for the corresponding mojom traits definitions. -# -# Note that even when the traits header is listed in |traits_sources| or -# within a target referenced by |public_deps|, it must still be listed -# here to be included properly by generated code. -# -# traits_sources (optional) -# The references to the source files (typically a single .cc and .h file) -# defining an appropriate set of EnumTraits or StructTraits, etc for the -# the type-mapping. Using this will cause the listed sources to be -# integrated directly into the dependent mojom's generated type-mapping -# targets. -# -# Prefer using |public_deps| over inlined |traits_sources|, as this will -# generally lead to easier build maintenance over time. -# -# NOTE: If a typemap is shared by Blink and non-Blink bindings, you cannot -# use this and MUST use |public_deps| to reference traits built within -# a separate target. -# -# traits_deps / traits_public_deps (optional) -# If any sources are listed in |traits_sources|, their dependences must be -# listed here. -# -# public_deps (optional) -# This work just like its equivalent for source_set or component targets -# and is incorporated into any C++ source targets generated by the -# dependent mojom target. -# -# NOTE: If relevant traits are defined in a separate target (as opposed to -# using inlined |traits_sources|), that target MUST be listed in -# |public_deps|. -# -template("mojom_cpp_typemap") { - assert(defined(invoker.types), "Missing 'types' value") - - typemap_target_name = target_name - not_needed([ "typemap_target_name" ]) - - public_headers = [] - if (defined(invoker.public_headers)) { - public_headers = invoker.public_headers - } - - traits_sources = [] - if (defined(invoker.traits_sources)) { - traits_sources = invoker.traits_sources - } - - source_deps = [] - if (defined(invoker.deps)) { - source_deps = invoker.deps - } - - source_public_deps = [] - if (defined(invoker.public_deps)) { - source_public_deps = invoker.public_deps - } - - # Write out a JSON file that can be loaded by the generator. - typemap_types = invoker.types - generated_file("${target_name}__json_config") { - outputs = [ "$target_gen_dir/${typemap_target_name}.typemap_config" ] - contents = { - } - contents.types = typemap_types - contents.public_headers = rebase_path(public_headers, "//") - output_conversion = "json" - } - - if (traits_sources != []) { - traits_deps = [] - if (defined(invoker.traits_deps)) { - traits_deps = invoker.traits_deps - } - - traits_public_deps = [] - if (defined(invoker.traits_public_deps)) { - traits_public_deps = invoker.traits_public_deps - } - - source_set("${typemap_target_name}__traits") { - sources = traits_sources - public_deps = traits_public_deps - deps = traits_deps - } - } - - # These group targets are used to forward C++ sources deps and configs to the - # dependent mojom's generated source targets. - group("${target_name}__source_deps") { - public_deps = source_deps - } - group("${target_name}__source_public_deps") { - public_deps = source_public_deps - if (traits_sources != []) { - public_deps += [ ":${typemap_target_name}__traits" ] - } - } -}
diff --git a/net/cert_net/nss_ocsp_session_url_request.cc b/net/cert_net/nss_ocsp_session_url_request.cc index fe03425..f158374 100644 --- a/net/cert_net/nss_ocsp_session_url_request.cc +++ b/net/cert_net/nss_ocsp_session_url_request.cc
@@ -116,8 +116,9 @@ std::unique_ptr<OCSPRequestSessionResult> StartAndWait( const OCSPRequestSessionParams* params) override { GetOCSPIOLoop()->PostTaskToIOLoop( - FROM_HERE, base::Bind(&OCSPRequestSessionDelegateURLRequest::StartLoad, - this, params)); + FROM_HERE, + base::BindOnce(&OCSPRequestSessionDelegateURLRequest::StartLoad, this, + params)); // Wait with a timeout. base::TimeDelta timeout = params->timeout;
diff --git a/net/http/structured_headers.cc b/net/http/structured_headers.cc index 2635829e..141c665 100644 --- a/net/http/structured_headers.cc +++ b/net/http/structured_headers.cc
@@ -278,7 +278,7 @@ return base::nullopt; } - Item value; + Item value{true}; if (ConsumeChar('=')) { auto item = ReadBareItem(); if (!item) @@ -710,6 +710,8 @@ if (!WriteKey(param_name)) return false; if (!param_value.is_null()) { + if (param_value.is_boolean() && param_value.GetBoolean()) + continue; output_ << "="; if (!WriteBareItem(param_value)) return false;
diff --git a/net/http/structured_headers_unittest.cc b/net/http/structured_headers_unittest.cc index afb77ab..f11da3d 100644 --- a/net/http/structured_headers_unittest.cc +++ b/net/http/structured_headers_unittest.cc
@@ -25,10 +25,15 @@ return Item(value); } -std::pair<std::string, Item> Param(std::string key) { +// Parameter with null value, only used in Structured Headers Draft 09 +std::pair<std::string, Item> NullParam(std::string key) { return std::make_pair(key, Item()); } +std::pair<std::string, Item> BooleanParam(std::string key, bool value) { + return std::make_pair(key, Item(value)); +} + std::pair<std::string, Item> DoubleParam(std::string key, double value) { return std::make_pair(key, Item(value)); } @@ -445,10 +450,10 @@ {{Token("text/html"), {DoubleParam("q", 1)}}}}, {"missing parameter value item", "text/html;a;q=1.0", - {{Token("text/html"), {Param("a"), DoubleParam("q", 1)}}}}, + {{Token("text/html"), {BooleanParam("a", true), DoubleParam("q", 1)}}}}, {"missing terminal parameter value item", "text/html;q=1.0;a", - {{Token("text/html"), {DoubleParam("q", 1), Param("a")}}}}, + {{Token("text/html"), {DoubleParam("q", 1), BooleanParam("a", true)}}}}, {"whitespace before = parameterised item", "text/html, text/plain;q =0.5", base::nullopt}, {"whitespace after = parameterised item", "text/html, text/plain;q= 0.5", @@ -511,7 +516,8 @@ // Parameterized Lists {"basic parameterised list", "abc_123;a=1;b=2; cdef_456, ghi;q=\"9\";r=\"+w\"", - {{{Token("abc_123"), {Param("a", 1), Param("b", 2), Param("cdef_456")}}, + {{{Token("abc_123"), + {Param("a", 1), Param("b", 2), BooleanParam("cdef_456", true)}}, {Token("ghi"), {Param("q", "9"), Param("r", "+w")}}}}, "abc_123;a=1;b=2;cdef_456, ghi;q=\"9\";r=\"+w\""}, {"single item parameterised list", @@ -519,10 +525,10 @@ {{{Token("text/html"), {DoubleParam("q", 1)}}}}}, {"missing parameter value parameterised list", "text/html;a;q=1.0", - {{{Token("text/html"), {Param("a"), DoubleParam("q", 1)}}}}}, + {{{Token("text/html"), {BooleanParam("a", true), DoubleParam("q", 1)}}}}}, {"missing terminal parameter value parameterised list", "text/html;q=1.0;a", - {{{Token("text/html"), {DoubleParam("q", 1), Param("a")}}}}}, + {{{Token("text/html"), {DoubleParam("q", 1), BooleanParam("a", true)}}}}}, {"no whitespace parameterised list", "text/html,text/plain;q=0.5", {{{Token("text/html"), {}}, @@ -640,10 +646,12 @@ "a=(1 2);q=1.0"}, {"missing parameter value parameterised dict", "a=3;c;d=5", - {Dictionary{{{"a", {Integer(3), {Param("c"), Param("d", 5)}}}}}}}, + {Dictionary{ + {{"a", {Integer(3), {BooleanParam("c", true), Param("d", 5)}}}}}}}, {"terminal missing parameter value parameterised dict", "a=3;c=5;d", - {Dictionary{{{"a", {Integer(3), {Param("c", 5), Param("d")}}}}}}}, + {Dictionary{ + {{"a", {Integer(3), {Param("c", 5), BooleanParam("d", true)}}}}}}}, {"no whitespace parameterised dict", "a=b;c=1,d=e;f=2", {Dictionary{{{"a", {Token("b"), {Param("c", 1)}}}, @@ -774,7 +782,7 @@ "abc_123;a=1;b=2; cdef_456, ghi;q=\"9\";r=\"w\"", { {Token("abc_123"), - {Param("a", 1), Param("b", 2), Param("cdef_456")}}, + {Param("a", 1), Param("b", 2), NullParam("cdef_456")}}, {Token("ghi"), {Param("q", "9"), Param("r", "w")}}, }}, {"empty param-list", "", {}},
diff --git a/net/proxy_resolution/proxy_config_service_linux.cc b/net/proxy_resolution/proxy_config_service_linux.cc index ffcf019..c11685f 100644 --- a/net/proxy_resolution/proxy_config_service_linux.cc +++ b/net/proxy_resolution/proxy_config_service_linux.cc
@@ -651,8 +651,9 @@ } notify_delegate_ = delegate; inotify_watcher_ = base::FileDescriptorWatcher::WatchReadable( - inotify_fd_, base::Bind(&SettingGetterImplKDE::OnChangeNotification, - base::Unretained(this))); + inotify_fd_, + base::BindRepeating(&SettingGetterImplKDE::OnChangeNotification, + base::Unretained(this))); // Simulate a change to avoid possibly losing updates before this point. OnChangeNotification(); return true;
diff --git a/services/tracing/perfetto/consumer_host.cc b/services/tracing/perfetto/consumer_host.cc index 4d7317f..f6cb275c 100644 --- a/services/tracing/perfetto/consumer_host.cc +++ b/services/tracing/perfetto/consumer_host.cc
@@ -589,8 +589,7 @@ consumer_endpoint_ = service_->GetService()->ConnectConsumer(this, 0 /*uid_t*/); consumer_endpoint_->ObserveEvents( - perfetto::TracingService::ConsumerEndpoint::ObservableEventType:: - kDataSourceInstances); + perfetto::ObservableEvents::TYPE_DATA_SOURCES_INSTANCES); } ConsumerHost::~ConsumerHost() {
diff --git a/services/tracing/perfetto/test_utils.cc b/services/tracing/perfetto/test_utils.cc index de63052..10a952c 100644 --- a/services/tracing/perfetto/test_utils.cc +++ b/services/tracing/perfetto/test_utils.cc
@@ -220,7 +220,7 @@ void MockConsumer::OnConnect() { consumer_endpoint_->ObserveEvents( - perfetto::ConsumerEndpoint::kDataSourceInstances); + perfetto::ObservableEvents::TYPE_DATA_SOURCES_INSTANCES); StartTracing(); } void MockConsumer::OnDisconnect() {}
diff --git a/testing/buildbot/filters/android.emulator.content_browsertests.filter b/testing/buildbot/filters/android.emulator.content_browsertests.filter index 90207a3d..b8785a3 100644 --- a/testing/buildbot/filters/android.emulator.content_browsertests.filter +++ b/testing/buildbot/filters/android.emulator.content_browsertests.filter
@@ -1,6 +1,6 @@ # crbug.com/1054829 --All/TouchActionBrowserTest.PanXAtYAreaWithTimeout/0 --All/TouchActionBrowserTest.TouchActionNone/1 +-All/TouchActionBrowserTest.PanXAtYAreaWithTimeout/* +-All/TouchActionBrowserTest.TouchActionNone/* # crbug.com/1056878 -BackForwardCacheBrowserTest.VideoSuspendAndResume
diff --git a/testing/buildbot/filters/gpu.skiarenderer_vulkan_content_browsertests.filter b/testing/buildbot/filters/gpu.skiarenderer_vulkan_content_browsertests.filter index 9791d6f..d60467e9 100644 --- a/testing/buildbot/filters/gpu.skiarenderer_vulkan_content_browsertests.filter +++ b/testing/buildbot/filters/gpu.skiarenderer_vulkan_content_browsertests.filter
@@ -2,3 +2,11 @@ -NavigationBrowserTest.HistoryBackCancelPendingNavigationUserGesture/1 -SitePerProcessBrowserTest.* -TextFragmentAnchorBrowserTest.DisabledOnScriptNavigation/0 + +# Vulkan Video Broken. https://crbug.com/1059724 +-File/MediaTest.Video* +-Http/MediaTest.Video* +-MediaSourceTest.* +-MediaTest.Video* +-MSE_*ClearKey/EncryptedMediaTest.Playback_Encryption* +-P/CompositorImplBrowserTestRefreshRate.VideoPreference/0
diff --git a/third_party/blink/public/blink_typemaps.gni b/third_party/blink/public/blink_typemaps.gni index ea1302e..d6d6128 100644 --- a/third_party/blink/public/blink_typemaps.gni +++ b/third_party/blink/public/blink_typemaps.gni
@@ -5,12 +5,16 @@ typemaps = [ "//gpu/ipc/common/mailbox_holder_for_blink.typemap", "//gpu/ipc/common/sync_token.typemap", + "//mojo/public/cpp/base/big_buffer.typemap", "//mojo/public/cpp/base/file.typemap", "//mojo/public/cpp/base/file_info.typemap", "//mojo/public/cpp/base/file_path.typemap", "//mojo/public/cpp/base/file_error.typemap", + "//mojo/public/cpp/base/generic_pending_receiver.typemap", "//mojo/public/cpp/base/shared_memory.typemap", + "//mojo/public/cpp/base/time.typemap", "//mojo/public/cpp/base/read_only_buffer.typemap", + "//mojo/public/cpp/base/unguessable_token.typemap", "//services/network/public/cpp/cross_origin_embedder_policy.typemap", "//services/network/public/cpp/url_request.typemap", "//services/viz/public/cpp/compositing/begin_frame_args_for_blink.typemap",
diff --git a/third_party/blink/public/mojom/frame/frame.mojom b/third_party/blink/public/mojom/frame/frame.mojom index ae0acc3..7baf2b8d 100644 --- a/third_party/blink/public/mojom/frame/frame.mojom +++ b/third_party/blink/public/mojom/frame/frame.mojom
@@ -228,6 +228,9 @@ // Sent when the renderer changed the progress of a load. DidChangeLoadProgress(double load_progress); + // Notifies the browser that a frame finished loading. + DidFinishLoad(url.mojom.Url validated_url); + // Dispatch a load event for this frame in the iframe element of an // out-of-process parent frame. Once handled, the browser process should // call RemoteFrame::DispatchLoadEventForFrameOwner() in the renderer. @@ -632,6 +635,10 @@ // Instructs the renderer to send back updates to the preferred size. EnablePreferredSizeChangedMode(); + + // Sent to the main-frame to request performing a zoom-to-find-in-page + // based on the rect provided. + ZoomToFindInPageRect(gfx.mojom.Rect rect_in_root_frame); }; // Implemented in Browser, this interface defines main-frame-specific methods
diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h index 3b5dea5..8f319c1 100644 --- a/third_party/blink/public/web/web_view.h +++ b/third_party/blink/public/web/web_view.h
@@ -286,9 +286,6 @@ // Indicates that view's preferred size changes will be sent to the browser. virtual void EnablePreferredSizeChangedMode() = 0; - // Requests a page-scale animation based on the specified rect. - virtual void ZoomToFindInPageRect(const WebRect&) = 0; - // Sets the display mode of the web app. virtual void SetDisplayMode(blink::mojom::DisplayMode) = 0;
diff --git a/third_party/blink/renderer/bindings/bindings.gni b/third_party/blink/renderer/bindings/bindings.gni index f765b40..02709cb 100644 --- a/third_party/blink/renderer/bindings/bindings.gni +++ b/third_party/blink/renderer/bindings/bindings.gni
@@ -26,12 +26,10 @@ "core/v8/custom/v8_custom_xpath_ns_resolver.cc", "core/v8/custom/v8_custom_xpath_ns_resolver.h", "core/v8/custom/v8_dev_tools_host_custom.cc", - "core/v8/custom/v8_element_custom.cc", "core/v8/custom/v8_html_all_collection_custom.cc", "core/v8/custom/v8_html_plugin_element_custom.cc", "core/v8/custom/v8_pop_state_event_custom.cc", "core/v8/custom/v8_promise_rejection_event_custom.cc", - "core/v8/custom/v8_shadow_root_custom.cc", "core/v8/custom/v8_window_custom.cc", "core/v8/custom/v8_xml_http_request_custom.cc", "core/v8/custom_wrappable_adapter.cc",
diff --git a/third_party/blink/renderer/bindings/core/v8/custom/v8_element_custom.cc b/third_party/blink/renderer/bindings/core/v8/custom/v8_element_custom.cc deleted file mode 100644 index f98e1653..0000000 --- a/third_party/blink/renderer/bindings/core/v8/custom/v8_element_custom.cc +++ /dev/null
@@ -1,84 +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. - -#include "third_party/blink/renderer/bindings/core/v8/v8_element.h" - -#include "third_party/blink/renderer/bindings/core/v8/idl_types.h" -#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_html.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_trusted_html.h" -#include "third_party/blink/renderer/core/html/custom/ce_reactions_scope.h" -#include "third_party/blink/renderer/core/html/custom/v0_custom_element_processing_stack.h" -#include "third_party/blink/renderer/platform/bindings/exception_state.h" - -namespace blink { - -// HTMLElement ----------------------------------------------------------------- - -void V8Element::InnerHTMLAttributeSetterCustom( - v8::Local<v8::Value> value, - const v8::FunctionCallbackInfo<v8::Value>& info) { - v8::Isolate* isolate = info.GetIsolate(); - - v8::Local<v8::Object> holder = info.Holder(); - - Element* impl = V8Element::ToImpl(holder); - - V0CustomElementProcessingStack::CallbackDeliveryScope delivery_scope; - - ExceptionState exception_state(isolate, ExceptionState::kSetterContext, - "Element", "innerHTML"); - CEReactionsScope ce_reactions_scope; - - // Prepare the value to be set. - StringOrTrustedHTML cpp_value; - // This if statement is the only difference to the generated code and ensures - // that only null but not undefined is treated as the empty string. - // https://crbug.com/783916 - if (value->IsNull()) { - cpp_value.SetString(String()); - } else { - V8StringOrTrustedHTML::ToImpl(isolate, value, cpp_value, - UnionTypeConversionMode::kNotNullable, - exception_state); - } - if (exception_state.HadException()) - return; - - impl->setInnerHTML(cpp_value, exception_state); -} - -void V8Element::OuterHTMLAttributeSetterCustom( - v8::Local<v8::Value> value, - const v8::FunctionCallbackInfo<v8::Value>& info) { - v8::Isolate* isolate = info.GetIsolate(); - - v8::Local<v8::Object> holder = info.Holder(); - - Element* impl = V8Element::ToImpl(holder); - - V0CustomElementProcessingStack::CallbackDeliveryScope delivery_scope; - - ExceptionState exception_state(isolate, ExceptionState::kSetterContext, - "Element", "outerHTML"); - CEReactionsScope ce_reactions_scope; - - // Prepare the value to be set. - StringOrTrustedHTML cpp_value; - // This if statement is the only difference to the generated code and ensures - // that only null but not undefined is treated as the empty string. - // https://crbug.com/783916 - if (value->IsNull()) { - cpp_value.SetString(String()); - } else { - V8StringOrTrustedHTML::ToImpl(isolate, value, cpp_value, - UnionTypeConversionMode::kNotNullable, - exception_state); - } - if (exception_state.HadException()) - return; - - impl->setOuterHTML(cpp_value, exception_state); -} - -} // namespace blink
diff --git a/third_party/blink/renderer/bindings/core/v8/custom/v8_shadow_root_custom.cc b/third_party/blink/renderer/bindings/core/v8/custom/v8_shadow_root_custom.cc deleted file mode 100644 index 1395585..0000000 --- a/third_party/blink/renderer/bindings/core/v8/custom/v8_shadow_root_custom.cc +++ /dev/null
@@ -1,51 +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. - -#include "third_party/blink/renderer/bindings/core/v8/v8_shadow_root.h" - -#include "third_party/blink/renderer/bindings/core/v8/idl_types.h" -#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_html.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_trusted_html.h" -#include "third_party/blink/renderer/core/html/custom/ce_reactions_scope.h" -#include "third_party/blink/renderer/core/html/custom/v0_custom_element_processing_stack.h" -#include "third_party/blink/renderer/platform/bindings/exception_state.h" - -namespace blink { - -// HTMLShadowRoot -------------------------------------------------------------- - -void V8ShadowRoot::InnerHTMLAttributeSetterCustom( - v8::Local<v8::Value> value, - const v8::FunctionCallbackInfo<v8::Value>& info) { - v8::Isolate* isolate = info.GetIsolate(); - - v8::Local<v8::Object> holder = info.Holder(); - - ShadowRoot* impl = V8ShadowRoot::ToImpl(holder); - - V0CustomElementProcessingStack::CallbackDeliveryScope delivery_scope; - - ExceptionState exception_state(isolate, ExceptionState::kSetterContext, - "ShadowRoot", "innerHTML"); - CEReactionsScope ce_reactions_scope; - - // Prepare the value to be set. - StringOrTrustedHTML cpp_value; - // This if statement is the only difference to the generated code and ensures - // that only null but not undefined is treated as the empty string. - // https://crbug.com/783916 - if (value->IsNull()) { - cpp_value.SetString(String()); - } else { - V8StringOrTrustedHTML::ToImpl(isolate, value, cpp_value, - UnionTypeConversionMode::kNotNullable, - exception_state); - } - if (exception_state.HadException()) - return; - - impl->setInnerHTML(cpp_value, exception_state); -} - -} // namespace blink
diff --git a/third_party/blink/renderer/bindings/core/v8/generated.gni b/third_party/blink/renderer/bindings/core/v8/generated.gni index e5a1bbb..009405192 100644 --- a/third_party/blink/renderer/bindings/core/v8/generated.gni +++ b/third_party/blink/renderer/bindings/core/v8/generated.gni
@@ -88,14 +88,10 @@ "$bindings_core_v8_output_dir/string_or_performance_measure_options.h", "$bindings_core_v8_output_dir/string_or_string_sequence.cc", "$bindings_core_v8_output_dir/string_or_string_sequence.h", - "$bindings_core_v8_output_dir/string_or_trusted_html.cc", - "$bindings_core_v8_output_dir/string_or_trusted_html.h", "$bindings_core_v8_output_dir/string_or_trusted_html_or_trusted_script_or_trusted_script_url.cc", "$bindings_core_v8_output_dir/string_or_trusted_html_or_trusted_script_or_trusted_script_url.h", "$bindings_core_v8_output_dir/string_or_trusted_script.cc", "$bindings_core_v8_output_dir/string_or_trusted_script.h", - "$bindings_core_v8_output_dir/string_or_trusted_script_url.cc", - "$bindings_core_v8_output_dir/string_or_trusted_script_url.h", "$bindings_core_v8_output_dir/string_or_unrestricted_double_sequence.cc", "$bindings_core_v8_output_dir/string_or_unrestricted_double_sequence.h", "$bindings_core_v8_output_dir/string_or_worker_options.cc",
diff --git a/third_party/blink/renderer/build/scripts/core/css/css_properties.py b/third_party/blink/renderer/build/scripts/core/css/css_properties.py index f59f5760..0e30bf71 100755 --- a/third_party/blink/renderer/build/scripts/core/css/css_properties.py +++ b/third_party/blink/renderer/build/scripts/core/css/css_properties.py
@@ -132,7 +132,7 @@ property_['in_origin_trial'] = False self.expand_origin_trials(property_, origin_trial_features) self.expand_ua(property_) - self.expand_slots(property_) + self.expand_surrogate(property_) self._aliases = [ property_ for property_ in properties if property_['alias_for']] @@ -201,19 +201,14 @@ 'A property may not have multiple visited properties' unvisited_property['visited_property'] = property_ - def expand_slots(self, property_): - if not property_['slots']: + def expand_surrogate(self, property_): + if not property_['surrogate_for']: return - assert not property_['is_slot'], \ - 'A slot (is_slot:true) may not reference slots' - # Verify that referenced slots have is_slot==True. - for slot in property_['slots']: - assert slot in self._properties_by_name, \ - 'Slots must name a property' - assert self._properties_by_name[slot]['is_slot'], \ - 'Referenced slot is not marked as a slot' - # Upgrade 'slots' to property references. - property_['slots'] = [self._properties_by_name[s] for s in property_['slots']] + assert property_['surrogate_for'] in self._properties_by_name, \ + 'surrogate_for must name a property' + # Upgrade 'surrogate_for' to property reference. + property_['surrogate_for'] = self._properties_by_name[ + property_['surrogate_for']] def expand_ua(self, ua_property_): if not ua_property_['ua_property_for']:
diff --git a/third_party/blink/renderer/build/scripts/core/css/make_style_cascade_slots.py b/third_party/blink/renderer/build/scripts/core/css/make_style_cascade_slots.py deleted file mode 100755 index a8077c6..0000000 --- a/third_party/blink/renderer/build/scripts/core/css/make_style_cascade_slots.py +++ /dev/null
@@ -1,33 +0,0 @@ -#!/usr/bin/env python -# Copyright 2019 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 json5_generator -import template_expander - -from core.css import css_properties - - -class StyleCascadeSlotsWriter(json5_generator.Writer): - def __init__(self, json5_file_paths, output_dir): - super(StyleCascadeSlotsWriter, self).__init__([], output_dir) - - json_properties = css_properties.CSSProperties(json5_file_paths) - - self._properties = json_properties.longhands - self._outputs = { - 'style_cascade_slots.h': self.generate_header, - 'style_cascade_slots.cc': self.generate_impl, - } - - @template_expander.use_jinja('core/css/templates/style_cascade_slots.h.tmpl') - def generate_header(self): - return {'properties': self._properties} - - @template_expander.use_jinja('core/css/templates/style_cascade_slots.cc.tmpl') - def generate_impl(self): - return {'properties': self._properties} - -if __name__ == '__main__': - json5_generator.Maker(StyleCascadeSlotsWriter).main()
diff --git a/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.cc.tmpl b/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.cc.tmpl index 04f8ea03..c8e9106 100644 --- a/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.cc.tmpl +++ b/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.cc.tmpl
@@ -87,10 +87,21 @@ } {% endif %} + {% if property.surrogate_for %} +const CSSProperty* {{class_name}}::SurrogateFor(TextDirection direction, + blink::WritingMode writing_mode) const { + return &GetCSSProperty{{property.surrogate_for.name.to_upper_camel_case()}}(); +} + {% endif %} {% if property.direction_aware_options %} {% set options = property.direction_aware_options %} {% set resolver_name = options.resolver_name.to_upper_camel_case() %} {% set physical_group_name = options.physical_group_name.to_upper_camel_case() %} +const CSSProperty* {{class_name}}::SurrogateFor(TextDirection direction, + blink::WritingMode writing_mode) const { + return &ResolveDirectionAwareProperty(direction, writing_mode); +} + const CSSProperty& {{class_name}}::ResolveDirectionAwareProperty( TextDirection direction, blink::WritingMode writing_mode) const {
diff --git a/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.h.tmpl b/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.h.tmpl index 3d46184..86682e5 100644 --- a/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.h.tmpl +++ b/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.h.tmpl
@@ -29,6 +29,7 @@ {% for property in properties %} {% set class_name = property.name.to_upper_camel_case() %} {% set is_alias = property.alias_for %} +{% set is_surrogate = property.surrogate_for or property.direction_aware_options %} {% set property_id = 'CSSPropertyID::' + property.enum_key %} {% set separator = '\'' + (property.separator or '\\0') + '\'' %} {% set flags = [ @@ -45,6 +46,7 @@ (property.valid_for_first_letter and 'kValidForFirstLetter' or ''), (property.valid_for_cue and 'kValidForCue' or ''), (property.valid_for_marker and 'kValidForMarker' or ''), + (is_surrogate and 'kSurrogate' or ''), ] | reject('==', '') | join(' | ') %} {% set ctor_args = (not is_alias and [property_id, flags, separator] or []) %} // {{property.name}} @@ -77,6 +79,9 @@ {% if property.ua_property %} const CSSProperty* GetUAProperty() const override; {% endif %} + {% if property.surrogate_for or property.direction_aware_options %} + const CSSProperty* SurrogateFor(TextDirection, blink::WritingMode) const override; + {% endif %} {% for property_method in property.property_methods %} {{property_method.return_type}} {{property_method.name}}{{property_method.parameters}} const override; {% endfor %}
diff --git a/third_party/blink/renderer/build/scripts/core/css/templates/style_cascade_slots.cc.tmpl b/third_party/blink/renderer/build/scripts/core/css/templates/style_cascade_slots.cc.tmpl deleted file mode 100644 index bfa3a51..0000000 --- a/third_party/blink/renderer/build/scripts/core/css/templates/style_cascade_slots.cc.tmpl +++ /dev/null
@@ -1,69 +0,0 @@ -{% from 'templates/macros.tmpl' import license %} -{{license()}} - -#include "third_party/blink/renderer/core/css/style_cascade_slots.h" - -#include "third_party/blink/renderer/core/css/resolver/style_resolver_state.h" -#include "third_party/blink/renderer/core/style/computed_style.h" - -namespace blink { - -namespace { - -const CSSProperty& ResolveDirectionAware( - const CSSProperty& property, - const StyleResolverState& state) { - const CSSProperty& resolved = property.ResolveDirectionAwareProperty( - state.Style()->Direction(), state.Style()->GetWritingMode()); - DCHECK_NE(&property, &resolved); - return resolved; -} - -} // anonymous namespace - -bool StyleCascadeSlots::Set(const CSSProperty& property, - CascadePriority priority, - const StyleResolverState& state, - AllowDefault allow_default) { - switch (property.PropertyID()) { - // Slots: -{% for property in properties %} - {% if property.is_slot %} - case CSSPropertyID::{{property.enum_key}}: - if (priority < {{property.name.to_class_data_member()}}) - return false; - {{property.name.to_class_data_member()}} = priority; - return true; - {% endif %} -{% endfor %} - // Properties which use slots: -{% for property in properties %} - {% if property.slots %} - case CSSPropertyID::{{property.enum_key}}: - {% for slot in property.slots %} - if (priority < {{slot.name.to_class_data_member()}}) - return false; - {% endfor %} - {% for slot in property.slots %} - {{slot.name.to_class_data_member()}} = priority; - {% endfor %} - return true; - {% endif %} -{% endfor %} - // Direction-aware properties: -{% for property in properties %} - {% if property.direction_aware_options %} - case CSSPropertyID::{{property.enum_key}}: - {% endif %} -{% endfor %} - return Set(ResolveDirectionAware(property, state), - priority, state, AllowDefault::kNo); - default: - // If you hit this DCHECK, you may need to mark the properties resolved - // to by css-logical properties as 'is_slot:true' in css_properties.json5. - DCHECK_EQ(allow_default, AllowDefault::kYes); - return true; - } -} - -} // namespace blink
diff --git a/third_party/blink/renderer/build/scripts/core/css/templates/style_cascade_slots.h.tmpl b/third_party/blink/renderer/build/scripts/core/css/templates/style_cascade_slots.h.tmpl deleted file mode 100644 index 04e816a..0000000 --- a/third_party/blink/renderer/build/scripts/core/css/templates/style_cascade_slots.h.tmpl +++ /dev/null
@@ -1,44 +0,0 @@ -{% from 'templates/macros.tmpl' import license %} -{{license()}} - -#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_STYLE_CASCADE_SLOTS_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_STYLE_CASCADE_SLOTS_H_ - -#include "third_party/blink/renderer/core/css/resolver/cascade_priority.h" -#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" - -namespace blink { - -class CSSProperty; -class StyleResolverState; - -class CORE_EXPORT StyleCascadeSlots { - STACK_ALLOCATED(); - public: - // The default behavior for Set is to do nothing and return 'true'. - // By using AllowDefault::kNo, we'll instead hit a DCHECK if the default - // behavior is used, which is useful for direction-aware properties. - enum class AllowDefault { kNo, kYes }; - - // Attempt to set the slots associated with the given property to the given - // priority. If the incoming priority is higher or equal to the priority - // in each associated slot, the Set will succeed. Otheriwse, it will fail. - // - // If there are no slots for the given property, Set will succeed. - bool Set(const CSSProperty&, - CascadePriority, - const StyleResolverState&, - AllowDefault allow_default = AllowDefault::kYes); - - private: -{% for property in properties %} - {% if property.is_slot %} - CascadePriority {{property.name.to_class_data_member()}}; - {% endif %} -{% endfor %} - -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_STYLE_CASCADE_SLOTS_H_
diff --git a/third_party/blink/renderer/controller/oom_intervention_impl_test.cc b/third_party/blink/renderer/controller/oom_intervention_impl_test.cc index 7927b172..7fc38dd 100644 --- a/third_party/blink/renderer/controller/oom_intervention_impl_test.cc +++ b/third_party/blink/renderer/controller/oom_intervention_impl_test.cc
@@ -263,13 +263,9 @@ WebViewImpl* web_view = web_view_helper_.InitializeAndLoad("about:blank"); Page* page = web_view->MainFrameImpl()->GetFrame()->GetPage(); - web_view->MainFrameImpl() - ->GetFrame() - ->GetDocument() - ->body() - ->SetInnerHTMLFromString( - "<iframe name='ad' src='data:text/html,'></iframe><iframe " - "name='non-ad' src='data:text/html,'>"); + web_view->MainFrameImpl()->GetFrame()->GetDocument()->body()->setInnerHTML( + "<iframe name='ad' src='data:text/html,'></iframe><iframe " + "name='non-ad' src='data:text/html,'>"); WebFrame* ad_iframe = web_view_helper_.LocalMainFrame()->FindFrameByName( WebString::FromUTF8("ad"));
diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn index 58549df..0813172a 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn
@@ -526,19 +526,6 @@ ] } -css_properties("make_core_generated_style_cascade_slots") { - script = "../build/scripts/core/css/make_style_cascade_slots.py" - in_files = [] - other_inputs = [ - "../build/scripts/core/css/templates/style_cascade_slots.h.tmpl", - "../build/scripts/core/css/templates/style_cascade_slots.cc.tmpl", - ] - outputs = [ - "$blink_core_output_dir/css/style_cascade_slots.h", - "$blink_core_output_dir/css/style_cascade_slots.cc", - ] -} - code_generator("make_core_generated_atrule_names") { script = "../build/scripts/core/css/parser/make_atrule_names.py" json_inputs = [ "css/parser/at_rule_names.json5" ] @@ -949,7 +936,6 @@ ":make_core_generated_media_type_names", ":make_core_generated_origin_trials", ":make_core_generated_performance_entry_names", - ":make_core_generated_style_cascade_slots", ":make_core_generated_style_property_shorthand", ":make_core_generated_svg_element_type_helpers", ":make_core_generated_svg_names",
diff --git a/third_party/blink/renderer/core/accessibility/apply_dark_mode_test.cc b/third_party/blink/renderer/core/accessibility/apply_dark_mode_test.cc index d8073d5..544b31b 100644 --- a/third_party/blink/renderer/core/accessibility/apply_dark_mode_test.cc +++ b/third_party/blink/renderer/core/accessibility/apply_dark_mode_test.cc
@@ -67,7 +67,7 @@ GetDocument().GetSettings()->SetForceDarkModeEnabled(true); ColorSchemeHelper color_scheme_helper(GetDocument()); color_scheme_helper.SetPreferredColorScheme(PreferredColorScheme::kDark); - GetDocument().head()->SetInnerHTMLFromString(R"HTML( + GetDocument().head()->setInnerHTML(R"HTML( <meta name="color-scheme" content="dark"> )HTML"); UpdateAllLifecyclePhasesForTest();
diff --git a/third_party/blink/renderer/core/animation/animation.cc b/third_party/blink/renderer/core/animation/animation.cc index 03d3ee7..b6f3f34 100644 --- a/third_party/blink/renderer/core/animation/animation.cc +++ b/third_party/blink/renderer/core/animation/animation.cc
@@ -732,7 +732,7 @@ // 7. If animation has a pending play task or a pending pause task, cancel // that task and resolve animation’s current ready promise with animation. - if (pending()) { + if (PendingInternal()) { pending_pause_ = false; pending_play_ = false; if (ready_promise_ && @@ -830,7 +830,7 @@ // * animation does not have either a pending play task or a pending pause // task, // then idle. - if (!CurrentTimeInternal() && !pending()) + if (!CurrentTimeInternal() && !PendingInternal()) return kIdle; // 2. Either of the following conditions are true: @@ -854,15 +854,19 @@ return kRunning; } -bool Animation::pending() const { +bool Animation::PendingInternal() const { return pending_pause_ || pending_play_; } +bool Animation::pending() const { + return PendingInternal(); +} + // https://drafts.csswg.org/web-animations-1/#reset-an-animations-pending-tasks. void Animation::ResetPendingTasks() { // 1. If animation does not have a pending play task or a pending pause task, // abort this procedure. - if (!pending()) + if (!PendingInternal()) return; // 2. If animation has a pending play task, cancel that task. @@ -1244,7 +1248,7 @@ // transition was only temporary. if (pending_finish_notification_) { // A pending play or pause must resolve before the finish promise. - if (pending() && timeline_) + if (PendingInternal() && timeline_) NotifyReady(timeline_->CurrentTimeSeconds().value_or(0)); CommitFinishNotification(); } @@ -1295,7 +1299,7 @@ // // 3a If animation has a pending play task or a pending pause task, // Abort these steps. - if (pending()) + if (PendingInternal()) return; switch (play_state) { @@ -1377,7 +1381,7 @@ if (!ready_promise_) { ready_promise_ = MakeGarbageCollected<AnimationPromise>( ExecutionContext::From(script_state)); - if (!pending()) + if (!PendingInternal()) ready_promise_->Resolve(this); } return ready_promise_->Promise(script_state->World()); @@ -1569,7 +1573,7 @@ // the playback rate preserve current time even if the start time is set. // Asynchronous updates have an associated pending play or pending pause // task associated with them. - if (start_time_ && !pending()) { + if (start_time_ && !PendingInternal()) { start_time = To<DocumentTimeline>(*timeline_) .ZeroTime() .since_origin() @@ -1624,7 +1628,8 @@ // sync them. This can happen if the blink side animation was started, the // compositor side hadn't started on its side yet, and then the blink side // start time was cleared (e.g. by setting current time). - if (pending() || !compositor_state_ || compositor_state_->effect_changed || + if (PendingInternal() || !compositor_state_ || + compositor_state_->effect_changed || compositor_state_->playback_rate != EffectivePlaybackRate() || compositor_state_->start_time != start_time_ || !compositor_state_->start_time || !start_time_) { @@ -1977,10 +1982,10 @@ void Animation::NotifyProbe() { AnimationPlayState old_play_state = reported_play_state_; AnimationPlayState new_play_state = - pending() ? kPending : CalculateAnimationPlayState(); + PendingInternal() ? kPending : CalculateAnimationPlayState(); if (old_play_state != new_play_state) { - if (!pending()) { + if (!PendingInternal()) { probe::AnimationPlayStateChanged(document_, this, old_play_state, new_play_state); }
diff --git a/third_party/blink/renderer/core/animation/animation.h b/third_party/blink/renderer/core/animation/animation.h index 99db170..2560ea3 100644 --- a/third_party/blink/renderer/core/animation/animation.h +++ b/third_party/blink/renderer/core/animation/animation.h
@@ -151,13 +151,17 @@ static const char* PlayStateString(AnimationPlayState); AnimationPlayState CalculateAnimationPlayState() const; - // Do not call this method directly except via the v8 bindings. Depending on - // the type of animation a style flush is required to ensure that pending - // style changes that affect play state are resolved. Instead call - // PlayStateString directly. + // As a web exposed API, playState must update style and layout if the play + // state may be affected by it (see CSSAnimation::playState), whereas + // PlayStateString can be used to query the current play state. virtual String playState() const; - bool pending() const; + bool PendingInternal() const; + + // As a web exposed API, pending must update style and layout if the pending + // status may be affected by it (see CSSAnimation::pending), whereas + // PendingInternal can be used to query the current pending status. + virtual bool pending() const; virtual void pause(ExceptionState& = ASSERT_NO_EXCEPTION); virtual void play(ExceptionState& = ASSERT_NO_EXCEPTION);
diff --git a/third_party/blink/renderer/core/animation/compositor_animations.cc b/third_party/blink/renderer/core/animation/compositor_animations.cc index da04840..a664e79b0 100644 --- a/third_party/blink/renderer/core/animation/compositor_animations.cc +++ b/third_party/blink/renderer/core/animation/compositor_animations.cc
@@ -74,7 +74,7 @@ if (&animation == &animation_to_add) return false; - if (animation.pending()) + if (animation.PendingInternal()) return true; switch (animation.CalculateAnimationPlayState()) {
diff --git a/third_party/blink/renderer/core/animation/css/css_animation.cc b/third_party/blink/renderer/core/animation/css/css_animation.cc index 7e888e16..b55401f6 100644 --- a/third_party/blink/renderer/core/animation/css/css_animation.cc +++ b/third_party/blink/renderer/core/animation/css/css_animation.cc
@@ -18,11 +18,15 @@ sticky_play_state_(Animation::kUnset) {} String CSSAnimation::playState() const { - if (GetDocument()) - GetDocument()->UpdateStyleAndLayoutTree(); + FlushStyles(); return Animation::playState(); } +bool CSSAnimation::pending() const { + FlushStyles(); + return Animation::pending(); +} + void CSSAnimation::pause(ExceptionState& exception_state) { sticky_play_state_ = kPaused; Animation::pause(exception_state); @@ -33,4 +37,11 @@ Animation::play(exception_state); } +void CSSAnimation::FlushStyles() const { + // TODO(1043778): Flush is likely not required once the CSSAnimation is + // disassociated from its owning element. + if (GetDocument()) + GetDocument()->UpdateStyleAndLayoutTree(); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/animation/css/css_animation.h b/third_party/blink/renderer/core/animation/css/css_animation.h index e7a1c73..396237d 100644 --- a/third_party/blink/renderer/core/animation/css/css_animation.h +++ b/third_party/blink/renderer/core/animation/css/css_animation.h
@@ -34,6 +34,7 @@ // to animation-play-state and display:none must update the play state. // https://drafts.csswg.org/css-animations-2/#requirements-on-pending-style-changes String playState() const override; + bool pending() const override; // Explicit calls to the web-animation API that update the play state are // conditionally sticky and override the animation-play-state style. @@ -48,6 +49,8 @@ void ResetWebAnimationOverriddenPlayState() { sticky_play_state_ = kUnset; } private: + void FlushStyles() const; + String animation_name_; // When set, the web-animation API is overruling the animation-play-state
diff --git a/third_party/blink/renderer/core/animation/css/css_transition.cc b/third_party/blink/renderer/core/animation/css/css_transition.cc index d516953..8deb597 100644 --- a/third_party/blink/renderer/core/animation/css/css_transition.cc +++ b/third_party/blink/renderer/core/animation/css/css_transition.cc
@@ -4,6 +4,8 @@ #include "third_party/blink/renderer/core/animation/css/css_transition.h" +#include "third_party/blink/renderer/core/dom/document.h" + namespace blink { CSSTransition::CSSTransition(ExecutionContext* execution_context, @@ -17,4 +19,12 @@ return transition_property_.GetCSSPropertyName().ToAtomicString(); } +String CSSTransition::playState() const { + // TODO(1043778): Flush is likely not required once the CSSTransition is + // disassociated from its owning element. + if (GetDocument()) + GetDocument()->UpdateStyleAndLayoutTree(); + return Animation::playState(); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/animation/css/css_transition.h b/third_party/blink/renderer/core/animation/css/css_transition.h index 7672fdbb..f9a97bd 100644 --- a/third_party/blink/renderer/core/animation/css/css_transition.h +++ b/third_party/blink/renderer/core/animation/css/css_transition.h
@@ -26,6 +26,17 @@ return transition_property_.GetCSSProperty(); } + // Animation overrides. + // Various operations may affect the computed values of properties on + // elements. User agents may, as an optimization, defer recomputing these + // values until it becomes necessary; however, all operations included in the + // programming interfaces defined in the web-animations and css-transitions + // specifications, must produce a result consistent with having fully + // processed any such pending changes to computed values. Notably, setting + // display:none must update the play state. + // https://drafts.csswg.org/css-transitions-2/#requirements-on-pending-style-changes + String playState() const override; + private: PropertyHandle transition_property_; };
diff --git a/third_party/blink/renderer/core/animation/pending_animations.cc b/third_party/blink/renderer/core/animation/pending_animations.cc index e6be5d2..d26e04d 100644 --- a/third_party/blink/renderer/core/animation/pending_animations.cc +++ b/third_party/blink/renderer/core/animation/pending_animations.cc
@@ -82,7 +82,7 @@ if (animation->Playing() && !animation->startTime()) { waiting_for_start_time.push_back(animation.Get()); - } else if (animation->pending()) { + } else if (animation->PendingInternal()) { // A pending animation that is not waiting on a start time does not need // to be synchronized with animations that are starting up. Nonetheless, // it needs to notify the animation to resolve the ready promise and @@ -153,7 +153,7 @@ animations.swap(waiting_for_compositor_animation_start_); for (auto animation : animations) { - if (animation->startTime() || !animation->pending() || + if (animation->startTime() || !animation->PendingInternal() || !animation->timeline() || !animation->timeline()->IsActive()) { // Already started or no longer relevant. continue;
diff --git a/third_party/blink/renderer/core/css/active_style_sheets_test.cc b/third_party/blink/renderer/core/css/active_style_sheets_test.cc index 602a849..4f38ad0a 100644 --- a/third_party/blink/renderer/core/css/active_style_sheets_test.cc +++ b/third_party/blink/renderer/core/css/active_style_sheets_test.cc
@@ -436,7 +436,7 @@ } TEST_F(ApplyRulesetsTest, AddUniversalRuleToShadowTree) { - GetDocument().body()->SetInnerHTMLFromString("<div id=host></div>"); + GetDocument().body()->setInnerHTML("<div id=host></div>"); Element* host = GetElementById("host"); ASSERT_TRUE(host); @@ -475,7 +475,7 @@ } TEST_F(ApplyRulesetsTest, AddFontFaceRuleToShadowTree) { - GetDocument().body()->SetInnerHTMLFromString("<div id=host></div>"); + GetDocument().body()->setInnerHTML("<div id=host></div>"); Element* host = GetElementById("host"); ASSERT_TRUE(host); @@ -500,14 +500,13 @@ } TEST_F(ApplyRulesetsTest, RemoveSheetFromShadowTree) { - GetDocument().body()->SetInnerHTMLFromString("<div id=host></div>"); + GetDocument().body()->setInnerHTML("<div id=host></div>"); Element* host = GetElementById("host"); ASSERT_TRUE(host); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString( - "<style>::slotted(#dummy){color:pink}</style>"); + shadow_root.setInnerHTML("<style>::slotted(#dummy){color:pink}</style>"); UpdateAllLifecyclePhasesForTest(); EXPECT_TRUE(GetStyleEngine().TreeBoundaryCrossingScopes().IsEmpty());
diff --git a/third_party/blink/renderer/core/css/affected_by_pseudo_test.cc b/third_party/blink/renderer/core/css/affected_by_pseudo_test.cc index 13e1257..60f1e2bc2 100644 --- a/third_party/blink/renderer/core/css/affected_by_pseudo_test.cc +++ b/third_party/blink/renderer/core/css/affected_by_pseudo_test.cc
@@ -29,8 +29,7 @@ }; void AffectedByPseudoTest::SetHtmlInnerHTML(const char* html_content) { - GetDocument().documentElement()->SetInnerHTMLFromString( - String::FromUTF8(html_content)); + GetDocument().documentElement()->setInnerHTML(String::FromUTF8(html_content)); UpdateAllLifecyclePhasesForTest(); }
diff --git a/third_party/blink/renderer/core/css/css_computed_style_declaration_test.cc b/third_party/blink/renderer/core/css/css_computed_style_declaration_test.cc index 31e4f24b32..88479844 100644 --- a/third_party/blink/renderer/core/css/css_computed_style_declaration_test.cc +++ b/third_party/blink/renderer/core/css/css_computed_style_declaration_test.cc
@@ -13,7 +13,7 @@ class CSSComputedStyleDeclarationTest : public PageTestBase {}; TEST_F(CSSComputedStyleDeclarationTest, CleanAncestorsNoRecalc) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id=dirty></div> <div> <div id=target style='color:green'></div> @@ -34,7 +34,7 @@ } TEST_F(CSSComputedStyleDeclarationTest, CleanShadowAncestorsNoRecalc) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id=dirty></div> <div id=host></div> )HTML"); @@ -43,7 +43,7 @@ ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString(R"HTML( + shadow_root.setInnerHTML(R"HTML( <div id=target style='color:green'></div> )HTML"); @@ -62,7 +62,7 @@ } TEST_F(CSSComputedStyleDeclarationTest, NeedsAdjacentStyleRecalc) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> #a + #b { color: green } </style>
diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 index 77ef964..95ea0f9 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5
@@ -360,31 +360,24 @@ } }, - // - is_slot: true + // - surrogate_for: "other-property" // - // "Slots" are used to resolve properties which cascade separately, but - // use the same storage on ComputedStyle. In other words, properties that - // are slots, have some other property (or properties) that map to them. - // For example, -webkit-writing-mode maps to writing-mode, and inline-size - // maps to either width or height. + // A surrogate is a property which acts like another property. Unlike an + // alias (which is resolved as parse-time), a surrogate exists alongside + // the original in the parsed rule, and in the cascade. // - // See StyleCascade::Resolver::SetSlot - is_slot: { - default: false, - valid_type: "bool", - }, - - // - slots: ["other-property1", "other-property2", ...] + // However, surrogates modify the same fields on ComputedStyle. Examples of + // surrogates are: // - // Lists the properties mapped to during StyleCascade::Apply. Note that - // for properties that use direction_aware_options, 'slots' should not be - // listed, as the mapping is determined at run-time (depending og e.g. - // 'direction'). + // * -webkit-writing-mode (surrogate of writing-mode) + // * inline-size (surrogate for width, or height) + // * All css-logical propeties in general // - // See also 'is_slot' flag, and StyleCascade::Resolver::SetSlot - slots: { - default: [], - valid_type: "list", + // Note that for properties that use direction_aware_options, + // 'surrogate_for' should not be set, as the mapping is determined at + // run-time (depending og e.g. 'direction'). + surrogate_for: { + valid_type: "str", }, // - priority: "High" @@ -949,7 +942,6 @@ name: "writing-mode", property_methods: ["CSSValueFromComputedStyleInternal"], inherited: true, - is_slot: true, field_template: "keyword", include_paths: ["third_party/blink/renderer/platform/text/writing_mode.h"], keywords: ["horizontal-tb", "vertical-rl", "vertical-lr"], @@ -966,7 +958,7 @@ type_name: "WritingMode", style_builder_custom_functions: ["value"], priority: "High", - slots: ["writing-mode"], + surrogate_for: "writing-mode", }, { name: "text-rendering", @@ -982,7 +974,6 @@ name: "zoom", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], is_descriptor: true, - is_slot: true, field_group: "visual", field_template: "primitive", default_value: "1.0", @@ -1210,7 +1201,6 @@ { name: "border-bottom-color", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal", "ColorIncludingFallback"], - is_slot: true, interpolable: true, field_group: "surround", field_template: "external", @@ -1254,7 +1244,6 @@ { name: "border-bottom-style", property_methods: ["CSSValueFromComputedStyleInternal"], - is_slot: true, field_group: "surround", field_template: "keyword", keywords: [ @@ -1269,7 +1258,6 @@ { name: "border-bottom-width", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, field_group: "surround", field_template: "external", @@ -1295,7 +1283,6 @@ { name: "border-image-outset", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal", "InitialValue"], - is_slot: true, interpolable: true, typedom_types: ["Length", "Number"], style_builder_template: "border_image", @@ -1307,7 +1294,6 @@ { name: "border-image-repeat", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal", "InitialValue"], - is_slot: true, keywords: ["stretch", "repeat", "round", "space"], typedom_types: ["Keyword"], style_builder_template: "border_image", @@ -1319,7 +1305,6 @@ { name: "border-image-slice", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal", "InitialValue"], - is_slot: true, interpolable: true, typedom_types: ["Number", "Percentage"], style_builder_template: "border_image", @@ -1331,7 +1316,6 @@ { name: "border-image-source", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal", "InitialValue"], - is_slot: true, interpolable: true, keywords: ["none"], typedom_types: ["Keyword", "Image"], @@ -1341,7 +1325,6 @@ { name: "border-image-width", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal", "InitialValue"], - is_slot: true, interpolable: true, keywords: ["auto"], typedom_types: ["Keyword", "Length", "Percentage", "Number"], @@ -1354,7 +1337,6 @@ { name: "border-left-color", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal", "ColorIncludingFallback"], - is_slot: true, interpolable: true, field_group: "surround", field_template: "external", @@ -1372,7 +1354,6 @@ { name: "border-left-style", property_methods: ["CSSValueFromComputedStyleInternal"], - is_slot: true, field_group: "surround", field_template: "keyword", keywords: [ @@ -1387,7 +1368,6 @@ { name: "border-left-width", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, field_group: "surround", field_template: "external", @@ -1403,7 +1383,6 @@ { name: "border-right-color", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal", "ColorIncludingFallback"], - is_slot: true, interpolable: true, field_group: "surround", field_template: "external", @@ -1421,7 +1400,6 @@ { name: "border-right-style", property_methods: ["CSSValueFromComputedStyleInternal"], - is_slot: true, field_group: "surround", field_template: "keyword", keywords: [ @@ -1436,7 +1414,6 @@ { name: "border-right-width", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, field_group: "surround", field_template: "external", @@ -1452,7 +1429,6 @@ { name: "border-top-color", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal", "ColorIncludingFallback"], - is_slot: true, interpolable: true, field_group: "surround", field_template: "external", @@ -1496,7 +1472,6 @@ { name: "border-top-style", property_methods: ["CSSValueFromComputedStyleInternal"], - is_slot: true, field_group: "surround", field_template: "keyword", keywords: [ @@ -1511,7 +1486,6 @@ { name: "border-top-width", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, field_group: "surround", field_template: "external", @@ -1527,7 +1501,6 @@ { name: "bottom", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, layout_dependent: true, field_group: "surround", @@ -1739,7 +1712,6 @@ { name: "contain-intrinsic-size", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, field_group: "box", field_template: "external", @@ -2116,7 +2088,6 @@ name: "height", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], is_descriptor: true, - is_slot: true, interpolable: true, layout_dependent: true, field_group: "box", @@ -2204,7 +2175,6 @@ { name: "left", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, layout_dependent: true, field_group: "surround", @@ -2311,7 +2281,6 @@ { name: "margin-bottom", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, layout_dependent: true, field_group: "surround", @@ -2326,7 +2295,6 @@ { name: "margin-left", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, layout_dependent: true, field_group: "surround", @@ -2341,7 +2309,6 @@ { name: "margin-right", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, layout_dependent: true, field_group: "surround", @@ -2356,7 +2323,6 @@ { name: "margin-top", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, layout_dependent: true, field_group: "surround", @@ -2424,7 +2390,6 @@ { name: "max-height", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, is_descriptor: true, interpolable: true, field_group: "box", @@ -2437,7 +2402,6 @@ { name: "max-width", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, is_descriptor: true, interpolable: true, field_group: "box", @@ -2450,7 +2414,6 @@ { name: "min-height", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, is_descriptor: true, interpolable: true, field_group: "box", @@ -2462,7 +2425,6 @@ { name: "min-width", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, is_descriptor: true, interpolable: true, field_group: "box", @@ -2722,7 +2684,6 @@ { name: "overflow-x", property_methods: ["CSSValueFromComputedStyleInternal"], - is_slot: true, field_template: "keyword", keywords: [ "visible", "hidden", "scroll", "auto", "overlay" @@ -2734,7 +2695,6 @@ { name: "overflow-y", property_methods: ["CSSValueFromComputedStyleInternal"], - is_slot: true, field_template: "keyword", keywords: [ "visible", "hidden", "scroll", "auto", "overlay", @@ -2760,7 +2720,6 @@ { name: "overscroll-behavior-x", property_methods: ["CSSValueFromComputedStyleInternal"], - is_slot: true, field_template: "keyword", keywords: ["auto", "contain", "none"], default_value: "auto", @@ -2770,7 +2729,6 @@ { name: "overscroll-behavior-y", property_methods: ["CSSValueFromComputedStyleInternal"], - is_slot: true, field_template: "keyword", keywords: ["auto", "contain", "none"], default_value: "auto", @@ -2780,7 +2738,6 @@ { name: "padding-bottom", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, layout_dependent: true, field_group: "surround", @@ -2794,7 +2751,6 @@ { name: "padding-left", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, layout_dependent: true, field_group: "surround", @@ -2808,7 +2764,6 @@ { name: "padding-right", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, layout_dependent: true, field_group: "surround", @@ -2822,7 +2777,6 @@ { name: "padding-top", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, layout_dependent: true, field_group: "surround", @@ -2929,7 +2883,6 @@ { name: "right", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, layout_dependent: true, field_group: "surround", @@ -3009,7 +2962,6 @@ { name: "scroll-margin-bottom", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, field_group: "*", field_template: "primitive", default_value: "0.0f", @@ -3038,7 +2990,6 @@ { name: "scroll-margin-left", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, field_group: "*", field_template: "primitive", default_value: "0.0f", @@ -3049,7 +3000,6 @@ { name: "scroll-margin-right", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, field_group: "*", field_template: "primitive", default_value: "0.0f", @@ -3060,7 +3010,6 @@ { name: "scroll-margin-top", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, field_group: "*", field_template: "primitive", default_value: "0.0f", @@ -3097,7 +3046,6 @@ { name: "scroll-padding-bottom", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, field_group: "*", field_template: "<length>", default_value: "Length()", @@ -3134,7 +3082,6 @@ { name: "scroll-padding-left", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, field_group: "*", field_template: "<length>", default_value: "Length()", @@ -3145,7 +3092,6 @@ { name: "scroll-padding-right", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, field_group: "*", field_template: "<length>", default_value: "Length()", @@ -3156,7 +3102,6 @@ { name: "scroll-padding-top", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, field_group: "*", field_template: "<length>", default_value: "Length()", @@ -3578,7 +3523,6 @@ { name: "top", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - is_slot: true, interpolable: true, layout_dependent: true, field_group: "surround", @@ -3787,8 +3731,6 @@ name: "-webkit-border-image", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], style_builder_custom_functions: ["value"], - slots: ["border-image-outset", "border-image-repeat", "border-image-slice", - "border-image-source", "border-image-width"], valid_for_first_letter: true, }, { @@ -4359,7 +4301,6 @@ name: "width", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], is_descriptor: true, - is_slot: true, interpolable: true, layout_dependent: true, field_group: "box", @@ -5521,7 +5462,6 @@ name: "-internal-visited-border-left-color", visited_property_for: "border-left-color", property_methods: ["ParseSingleValue", "ColorIncludingFallback"], - is_slot: true, field_group: "*", field_template: "external", include_paths: ["third_party/blink/renderer/core/css/style_color.h"], @@ -5537,7 +5477,6 @@ name: "-internal-visited-border-right-color", visited_property_for: "border-right-color", property_methods: ["ParseSingleValue", "ColorIncludingFallback"], - is_slot: true, field_group: "*", field_template: "external", include_paths: ["third_party/blink/renderer/core/css/style_color.h"], @@ -5553,7 +5492,6 @@ name: "-internal-visited-border-top-color", visited_property_for: "border-top-color", property_methods: ["ParseSingleValue", "ColorIncludingFallback"], - is_slot: true, field_group: "*", field_template: "external", include_paths: ["third_party/blink/renderer/core/css/style_color.h"], @@ -5569,7 +5507,6 @@ name: "-internal-visited-border-bottom-color", visited_property_for: "border-bottom-color", property_methods: ["ParseSingleValue", "ColorIncludingFallback"], - is_slot: true, field_group: "*", field_template: "external", include_paths: ["third_party/blink/renderer/core/css/style_color.h"], @@ -5738,7 +5675,7 @@ field_group: "*", priority: "High", style_builder_custom_functions: ["initial", "inherit", "value"], - slots: ["zoom"], + surrogate_for: "zoom", }, // Name: -internal-empty-line-height:
diff --git a/third_party/blink/renderer/core/css/css_selector_watch_test.cc b/third_party/blink/renderer/core/css/css_selector_watch_test.cc index 55351d77..46e58f5f 100644 --- a/third_party/blink/renderer/core/css/css_selector_watch_test.cc +++ b/third_party/blink/renderer/core/css/css_selector_watch_test.cc
@@ -33,7 +33,7 @@ } TEST_F(CSSSelectorWatchTest, RecalcOnDocumentChange) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div> <span id='x' class='a'></span> <span id='y' class='b'><span></span></span>
diff --git a/third_party/blink/renderer/core/css/cssom/paint_worklet_style_property_map_test.cc b/third_party/blink/renderer/core/css/cssom/paint_worklet_style_property_map_test.cc index 5c84570..d8e1fda 100644 --- a/third_party/blink/renderer/core/css/cssom/paint_worklet_style_property_map_test.cc +++ b/third_party/blink/renderer/core/css/cssom/paint_worklet_style_property_map_test.cc
@@ -115,7 +115,7 @@ Vector<CSSPropertyID> native_properties; Vector<AtomicString> custom_properties({"--x"}); - GetDocument().documentElement()->SetInnerHTMLFromString( + GetDocument().documentElement()->setInnerHTML( "<div id='target' style='--x:50'></div>"); UpdateAllLifecyclePhasesForTest(); @@ -162,7 +162,7 @@ css_test_helpers::RegisterProperty(GetDocument(), "--gar", "<color>", "rgb(0, 255, 0)", false); - GetDocument().documentElement()->SetInnerHTMLFromString( + GetDocument().documentElement()->setInnerHTML( "<div id='target' style='--foo:10px; --bar:15; --gar:rgb(255, 0, " "0)'></div>"); UpdateAllLifecyclePhasesForTest(); @@ -208,7 +208,7 @@ css_test_helpers::RegisterProperty(GetDocument(), "--loo", "test", "test", false); - GetDocument().documentElement()->SetInnerHTMLFromString( + GetDocument().documentElement()->setInnerHTML( "<div id='target' style='--foo:url(https://crbug.com/); " "--bar:15;'></div>"); UpdateAllLifecyclePhasesForTest();
diff --git a/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map_test.cc b/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map_test.cc index 97bdc95..7302779 100644 --- a/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map_test.cc +++ b/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map_test.cc
@@ -19,8 +19,8 @@ PrepopulatedComputedStylePropertyMapTest() = default; void SetElementWithStyle(const String& value) { - GetDocument().body()->SetInnerHTMLFromString("<div id='target' style='" + - value + "'></div>"); + GetDocument().body()->setInnerHTML("<div id='target' style='" + value + + "'></div>"); UpdateAllLifecyclePhasesForTest(); }
diff --git a/third_party/blink/renderer/core/css/drag_update_test.cc b/third_party/blink/renderer/core/css/drag_update_test.cc index 5bbdf14..99bee95 100644 --- a/third_party/blink/renderer/core/css/drag_update_test.cc +++ b/third_party/blink/renderer/core/css/drag_update_test.cc
@@ -18,7 +18,7 @@ auto dummy_page_holder = std::make_unique<DummyPageHolder>(IntSize(800, 600)); Document& document = dummy_page_holder->GetDocument(); - document.documentElement()->SetInnerHTMLFromString(R"HTML( + document.documentElement()->setInnerHTML(R"HTML( <style>div {width:100px;height:100px} div:-webkit-drag { background-color: green }</style> <div id='div'> @@ -47,7 +47,7 @@ auto dummy_page_holder = std::make_unique<DummyPageHolder>(IntSize(800, 600)); Document& document = dummy_page_holder->GetDocument(); - document.documentElement()->SetInnerHTMLFromString(R"HTML( + document.documentElement()->setInnerHTML(R"HTML( <style>div {width:100px;height:100px} div:-webkit-drag .drag { background-color: green }</style> <div id='div'> @@ -76,7 +76,7 @@ auto dummy_page_holder = std::make_unique<DummyPageHolder>(IntSize(800, 600)); Document& document = dummy_page_holder->GetDocument(); - document.documentElement()->SetInnerHTMLFromString(R"HTML( + document.documentElement()->setInnerHTML(R"HTML( <style>div {width:100px;height:100px} div:-webkit-drag + .drag { background-color: green }</style> <div id='div'>
diff --git a/third_party/blink/renderer/core/css/invalidation/invalidation_set_test.cc b/third_party/blink/renderer/core/css/invalidation/invalidation_set_test.cc index b7c6ab6..b17fc85 100644 --- a/third_party/blink/renderer/core/css/invalidation/invalidation_set_test.cc +++ b/third_party/blink/renderer/core/css/invalidation/invalidation_set_test.cc
@@ -264,7 +264,7 @@ TEST(InvalidationSetTest, ClassInvalidatesElement) { auto dummy_page_holder = std::make_unique<DummyPageHolder>(IntSize(800, 600)); auto& document = dummy_page_holder->GetDocument(); - document.body()->SetInnerHTMLFromString("<div id=test class='a b'>"); + document.body()->setInnerHTML("<div id=test class='a b'>"); document.View()->UpdateAllLifecyclePhases(DocumentUpdateReason::kTest); Element* element = document.getElementById("test"); ASSERT_TRUE(element); @@ -289,7 +289,7 @@ TEST(InvalidationSetTest, AttributeInvalidatesElement) { auto dummy_page_holder = std::make_unique<DummyPageHolder>(IntSize(800, 600)); auto& document = dummy_page_holder->GetDocument(); - document.body()->SetInnerHTMLFromString("<div id=test a b>"); + document.body()->setInnerHTML("<div id=test a b>"); document.View()->UpdateAllLifecyclePhases(DocumentUpdateReason::kTest); Element* element = document.getElementById("test"); ASSERT_TRUE(element);
diff --git a/third_party/blink/renderer/core/css/invalidation/pending_invalidations_test.cc b/third_party/blink/renderer/core/css/invalidation/pending_invalidations_test.cc index 6e032301c..6529bfd 100644 --- a/third_party/blink/renderer/core/css/invalidation/pending_invalidations_test.cc +++ b/third_party/blink/renderer/core/css/invalidation/pending_invalidations_test.cc
@@ -31,7 +31,7 @@ } TEST_F(PendingInvalidationsTest, ScheduleOnDocumentNode) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<div id='d'></div><i id='i'></i><span></span>"); GetDocument().View()->UpdateAllLifecyclePhases(DocumentUpdateReason::kTest); @@ -63,7 +63,7 @@ } TEST_F(PendingInvalidationsTest, DescendantInvalidationOnDisplayNone) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> #a { display: none } .a .b { color: green }
diff --git a/third_party/blink/renderer/core/css/invalidation/style_invalidator_test.cc b/third_party/blink/renderer/core/css/invalidation/style_invalidator_test.cc index 2a32fa9..e1daed98 100644 --- a/third_party/blink/renderer/core/css/invalidation/style_invalidator_test.cc +++ b/third_party/blink/renderer/core/css/invalidation/style_invalidator_test.cc
@@ -25,7 +25,7 @@ }; TEST_F(StyleInvalidatorTest, SkipDisplayNone) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id="root"> <div style="display:none"> <div class="a"></div> @@ -53,7 +53,7 @@ } TEST_F(StyleInvalidatorTest, SkipDisplayNoneClearPendingNth) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id="none" style="display:none"> <div class="a"></div> <div class="a"></div>
diff --git a/third_party/blink/renderer/core/css/parser/css_property_parser_test.cc b/third_party/blink/renderer/core/css/parser/css_property_parser_test.cc index 5fb1576..edd37e2 100644 --- a/third_party/blink/renderer/core/css/parser/css_property_parser_test.cc +++ b/third_party/blink/renderer/core/css/parser/css_property_parser_test.cc
@@ -378,7 +378,7 @@ Page::InsertOrdinaryPageForTesting(&dummy_page_holder->GetPage()); WebFeature feature = WebFeature::kCSSGradient; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<style>* { background-image: linear-gradient(red, blue); }</style>"); EXPECT_TRUE(document.IsUseCounted(feature)); } @@ -390,7 +390,7 @@ document.SetSecureContextModeForTesting(SecureContextMode::kSecureContext); WebFeature feature = WebFeature::kCSSPaintFunction; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<style>span { background-image: paint(geometry); }</style>"); EXPECT_TRUE(document.IsUseCounted(feature)); } @@ -401,7 +401,7 @@ Page::InsertOrdinaryPageForTesting(&dummy_page_holder->GetPage()); WebFeature feature = WebFeature::kWebkitCrossFade; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<style>div { background-image: -webkit-cross-fade(url('from.png'), " "url('to.png'), 0.2); }</style>"); EXPECT_TRUE(document.IsUseCounted(feature)); @@ -415,7 +415,7 @@ WebFeature feature2 = WebFeature::kTwoValuedOverflow; EXPECT_FALSE(document.IsUseCounted(feature)); EXPECT_FALSE(document.IsUseCounted(feature2)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<div style=\"height: 10px; width: 10px; overflow: overlay overlay;\">" "<div style=\"height: 50px; width: 50px;\"></div></div>"); EXPECT_TRUE(document.IsUseCounted(feature)); @@ -430,7 +430,7 @@ WebFeature feature2 = WebFeature::kTwoValuedOverflow; EXPECT_FALSE(document.IsUseCounted(feature)); EXPECT_FALSE(document.IsUseCounted(feature2)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<div style=\"height: 10px; width: 10px; overflow: overlay;\">" "<div style=\"height: 50px; width: 50px;\"></div></div>"); EXPECT_TRUE(document.IsUseCounted(feature)); @@ -445,7 +445,7 @@ WebFeature feature2 = WebFeature::kTwoValuedOverflow; EXPECT_FALSE(document.IsUseCounted(feature)); EXPECT_FALSE(document.IsUseCounted(feature2)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<div style=\"height: 10px; width: 10px; overflow-x: overlay;\">" "<div style=\"height: 50px; width: 50px;\"></div></div>"); EXPECT_TRUE(document.IsUseCounted(feature)); @@ -460,7 +460,7 @@ WebFeature feature2 = WebFeature::kTwoValuedOverflow; EXPECT_FALSE(document.IsUseCounted(feature)); EXPECT_FALSE(document.IsUseCounted(feature2)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<div style=\"height: 10px; width: 10px; overflow-y: overlay;\">" "<div style=\"height: 50px; width: 50px;\"></div></div>"); EXPECT_TRUE(document.IsUseCounted(feature)); @@ -475,7 +475,7 @@ WebFeature feature2 = WebFeature::kTwoValuedOverflow; EXPECT_FALSE(document.IsUseCounted(feature)); EXPECT_FALSE(document.IsUseCounted(feature2)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<div style=\"height: 10px; width: 10px; overflow: overlay scroll;\">" "<div style=\"height: 50px; width: 50px;\"></div></div>"); EXPECT_TRUE(document.IsUseCounted(feature)); @@ -490,7 +490,7 @@ WebFeature feature2 = WebFeature::kTwoValuedOverflow; EXPECT_FALSE(document.IsUseCounted(feature)); EXPECT_FALSE(document.IsUseCounted(feature2)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<div style=\"height: 10px; width: 10px; overflow: scroll overlay;\">" "<div style=\"height: 50px; width: 50px;\"></div></div>"); EXPECT_TRUE(document.IsUseCounted(feature)); @@ -615,7 +615,7 @@ TEST_F(CSSPropertyUseCounterTest, UnitlessPresentationAttributesNotCounted) { WebFeature feature = WebFeature::kSVGGeometryPropertyHasNonZeroUnitlessValue; EXPECT_FALSE(IsCounted(feature)); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <svg> <rect x="42" y="42" rx="42" ry="42"/> <circle cx="42" cy="42" r="42"/>
diff --git a/third_party/blink/renderer/core/css/properties/css_parsing_utils_test.cc b/third_party/blink/renderer/core/css/properties/css_parsing_utils_test.cc index 7b9aad4..8ac05ca 100644 --- a/third_party/blink/renderer/core/css/properties/css_parsing_utils_test.cc +++ b/third_party/blink/renderer/core/css/properties/css_parsing_utils_test.cc
@@ -16,7 +16,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kCSSBasicShape; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<style>span { shape-outside: circle(); }</style>"); EXPECT_TRUE(document.IsUseCounted(feature)); }
diff --git a/third_party/blink/renderer/core/css/properties/css_property.h b/third_party/blink/renderer/core/css/properties/css_property.h index e626fe8..72269895 100644 --- a/third_party/blink/renderer/core/css/properties/css_property.h +++ b/third_party/blink/renderer/core/css/properties/css_property.h
@@ -56,6 +56,7 @@ bool IsValidForFirstLetter() const { return flags_ & kValidForFirstLetter; } bool IsValidForCue() const { return flags_ & kValidForCue; } bool IsValidForMarker() const { return flags_ & kValidForMarker; } + bool IsSurrogate() const { return flags_ & kSurrogate; } bool IsRepeated() const { return repetition_separator_ != '\0'; } char RepetitionSeparator() const { return repetition_separator_; } @@ -91,6 +92,9 @@ virtual const CSSProperty* GetUnvisitedProperty() const { return nullptr; } virtual const CSSProperty* GetUAProperty() const { return nullptr; } + virtual const CSSProperty* SurrogateFor(TextDirection, WritingMode) const { + return nullptr; + } static void FilterWebExposedCSSPropertiesIntoVector( const ExecutionContext*, @@ -127,6 +131,10 @@ kValidForCue = 1 << 13, // https://drafts.csswg.org/css-pseudo-4/#marker-pseudo kValidForMarker = 1 << 14, + // A surrogate is a (non-alias) property which acts like another property, + // for example -webkit-writing-mode is a surrogate for writing-mode, and + // inline-size is a surrogate for either width or height. + kSurrogate = 1 << 15, }; constexpr CSSProperty(CSSPropertyID property_id,
diff --git a/third_party/blink/renderer/core/css/properties/css_property_test.cc b/third_party/blink/renderer/core/css/properties/css_property_test.cc index 0ab547c8..e1ffcbc7 100644 --- a/third_party/blink/renderer/core/css/properties/css_property_test.cc +++ b/third_party/blink/renderer/core/css/properties/css_property_test.cc
@@ -88,4 +88,18 @@ EXPECT_GT(num_visited, 0u); } +TEST_F(CSSPropertyTest, Surrogates) { + EXPECT_EQ(&GetCSSPropertyWidth(), + GetCSSPropertyInlineSize().SurrogateFor( + TextDirection::kLtr, WritingMode::kHorizontalTb)); + EXPECT_EQ(&GetCSSPropertyHeight(), + GetCSSPropertyInlineSize().SurrogateFor(TextDirection::kLtr, + WritingMode::kVerticalRl)); + EXPECT_EQ(&GetCSSPropertyWritingMode(), + GetCSSPropertyWebkitWritingMode().SurrogateFor( + TextDirection::kLtr, WritingMode::kHorizontalTb)); + EXPECT_FALSE(GetCSSPropertyWidth().SurrogateFor(TextDirection::kLtr, + WritingMode::kHorizontalTb)); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/css/properties/longhands/custom_property_test.cc b/third_party/blink/renderer/core/css/properties/longhands/custom_property_test.cc index c8f3a61d..9819322 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/custom_property_test.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/custom_property_test.cc
@@ -24,8 +24,8 @@ class CustomPropertyTest : public PageTestBase { public: void SetElementWithStyle(const String& value) { - GetDocument().body()->SetInnerHTMLFromString("<div id='target' style='" + - value + "'></div>"); + GetDocument().body()->setInnerHTML("<div id='target' style='" + value + + "'></div>"); UpdateAllLifecyclePhasesForTest(); }
diff --git a/third_party/blink/renderer/core/css/resolver/css_variable_resolver_test.cc b/third_party/blink/renderer/core/css/resolver/css_variable_resolver_test.cc index e230447..a5095306 100644 --- a/third_party/blink/renderer/core/css/resolver/css_variable_resolver_test.cc +++ b/third_party/blink/renderer/core/css/resolver/css_variable_resolver_test.cc
@@ -52,7 +52,7 @@ } void SetTestHTML(const String& value) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<style>" " #target {" " --main-bg-color: black;" @@ -129,7 +129,7 @@ builder.Append("</style>\n"); builder.Append("<div id=target></div>\n"); - GetDocument().body()->SetInnerHTMLFromString(builder.ToString()); + GetDocument().body()->setInnerHTML(builder.ToString()); UpdateAllLifecyclePhasesForTest(); } }; @@ -426,7 +426,7 @@ builder.Append("</style>\n"); builder.Append("<div id=target></div>\n"); - GetDocument().body()->SetInnerHTMLFromString(builder.ToString()); + GetDocument().body()->setInnerHTML(builder.ToString()); UpdateAllLifecyclePhasesForTest(); Element* target = GetDocument().getElementById("target");
diff --git a/third_party/blink/renderer/core/css/resolver/selector_filter_parent_scope_test.cc b/third_party/blink/renderer/core/css/resolver/selector_filter_parent_scope_test.cc index e1c19e8..550f0163 100644 --- a/third_party/blink/renderer/core/css/resolver/selector_filter_parent_scope_test.cc +++ b/third_party/blink/renderer/core/css/resolver/selector_filter_parent_scope_test.cc
@@ -56,7 +56,7 @@ } TEST_F(SelectorFilterParentScopeTest, RootScope) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div class=x> <span id=y></span> </div> @@ -84,7 +84,7 @@ } TEST_F(SelectorFilterParentScopeTest, ReentrantSVGImageLoading) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> div::before { content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"></svg>');
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 ed90e6fd..9cee9a4b 100644 --- a/third_party/blink/renderer/core/css/resolver/style_cascade.cc +++ b/third_party/blink/renderer/core/css/resolver/style_cascade.cc
@@ -31,6 +31,7 @@ #include "third_party/blink/renderer/core/css/style_engine.h" #include "third_party/blink/renderer/core/dom/shadow_root.h" #include "third_party/blink/renderer/core/style/computed_style.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" @@ -129,11 +130,7 @@ // high-priority properties. LookupAndApply(GetCSSPropertyColorScheme(), resolver); - // -webkit-border-image is a longhand that maps to the same slots used by - // border-image (shorthand). By applying -webkit-border-image first, we - // avoid having to "partially" apply -webkit-border-image depending on the - // border-image-* longhands that have already been applied. - LookupAndApply(GetCSSPropertyWebkitBorderImage(), resolver); + ApplyWebkitBorderImage(resolver); // -webkit-mask-image needs to be applied before -webkit-mask-composite, // otherwise -webkit-mask-composite has no effect. @@ -148,6 +145,20 @@ ApplyInterpolations(*interpolations, resolver); } +StyleCascade::Surrogate StyleCascade::ResolveSurrogate( + const CSSProperty& surrogate, + CascadePriority priority, + Resolver& resolver) { + DCHECK(surrogate.IsSurrogate()); + const CSSProperty* original = surrogate.SurrogateFor( + state_.Style()->Direction(), state_.Style()->GetWritingMode()); + DCHECK(original && original->IsLonghand()); + LookupAndApply(*original, resolver); + if (map_.At(original->GetCSSPropertyName()) < priority) + return Surrogate::kApply; + return Surrogate::kSkip; +} + const CSSValue* StyleCascade::Resolve(const CSSPropertyName& name, const CSSValue& value, Resolver& resolver) { @@ -201,6 +212,32 @@ resolver.filter_ = resolver.filter_.Set(CSSProperty::kUA, true); } +void StyleCascade::ApplyWebkitBorderImage(Resolver& resolver) { + const CascadePriority* priority = + map_.Find(CSSPropertyName(CSSPropertyID::kWebkitBorderImage)); + if (!priority) + return; + + // -webkit-border-image is a surrogate for the border-image (shorthand). + // By applying -webkit-border-image first, we avoid having to "partially" + // apply -webkit-border-image depending on the border-image-* longhands that + // have already been applied. + // See also crbug.com/1056600 + LookupAndApply(GetCSSPropertyWebkitBorderImage(), resolver); + + const auto& shorthand = borderImageShorthand(); + const CSSProperty** longhands = shorthand.properties(); + for (unsigned i = 0; i < shorthand.length(); ++i) { + const CSSProperty& longhand = *longhands[i]; + if (CascadePriority* p = map_.Find(longhand.GetCSSPropertyName())) { + // If -webkit-border-image has higher priority than a border-image + // longhand, we skip applying that longhand. + if (*p < *priority) + *p = CascadePriority(*p, resolver.generation_); + } + } +} + void StyleCascade::ApplyMatchResult(const MatchResult& match_result, Resolver& resolver) { for (auto e : match_result.Expansions(GetDocument(), resolver.filter_)) { @@ -211,7 +248,7 @@ continue; *p = priority; const CSSProperty& property = e.Property(); - if (!resolver.SetSlot(property, priority, state_)) + if (ResolveIfSurrogate(property, priority, resolver) == Surrogate::kSkip) continue; const CSSValue* value = Resolve(property, e.Value(), resolver); StyleBuilder::ApplyProperty(property, state_, *value); @@ -250,7 +287,7 @@ continue; *p = priority; - if (!resolver.SetSlot(property, priority, state_)) + if (ResolveIfSurrogate(property, priority, resolver) == Surrogate::kSkip) continue; ApplyInterpolation(property, entry.value, resolver); @@ -294,7 +331,7 @@ if (resolver.filter_.Rejects(property)) return; - if (!resolver.SetSlot(property, priority, state_)) + if (ResolveIfSurrogate(property, priority, resolver) == Surrogate::kSkip) return; const MatchResult* match_result = resolver.match_result_; @@ -709,12 +746,6 @@ return true; } -bool StyleCascade::Resolver::SetSlot(const CSSProperty& property, - CascadePriority priority, - StyleResolverState& state) { - return slots_.Set(property, priority, state); -} - bool StyleCascade::Resolver::DetectCycle(const CSSProperty& property) { wtf_size_t index = stack_.Find(property.GetCSSPropertyName()); if (index == kNotFound)
diff --git a/third_party/blink/renderer/core/css/resolver/style_cascade.h b/third_party/blink/renderer/core/css/resolver/style_cascade.h index fd01bfb..927968fc 100644 --- a/third_party/blink/renderer/core/css/resolver/style_cascade.h +++ b/third_party/blink/renderer/core/css/resolver/style_cascade.h
@@ -16,7 +16,6 @@ #include "third_party/blink/renderer/core/css/resolver/cascade_map.h" #include "third_party/blink/renderer/core/css/resolver/cascade_origin.h" #include "third_party/blink/renderer/core/css/resolver/cascade_priority.h" -#include "third_party/blink/renderer/core/css/style_cascade_slots.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/text/text_encoding.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -121,35 +120,6 @@ // https://drafts.csswg.org/css-variables/#animation-tainted bool AllowSubstitution(CSSVariableData*) const; - // SetSlot/StyleCascadeSlots is responsible for resolving situations where - // we have multiple (non-alias) properties in the cascade that mutates the - // same fields on ComputedStyle. - // - // An example of this is writing-mode and -webkit-writing-mode, which - // both result in ComputedStyle::SetWritingMode calls. - // - // When applying the cascade (applying each property/value pair to the - // ComputedStyle), the order of the application is in the general case - // not defined. (It is determined by the iteration order of the HashMap). - // This means that if both writing-mode and -webkit-writing-mode exist in - // the cascade, we would get non-deterministic behavior: the application - // order would not be defined. SetSlot/StyleCascadeSlots fixes this. - // - // StyleCascadeSlots stores the Priority of the value that was previously - // applied for a certain 'group' of properties (e.g. writing-mode and - // -webkit-writing-mode is one such group). When we're about to apply a - // value, we only actually do so if the call to SetSlot succeeds. If the - // call to SetSlot does not succeed, it means that we have previously added - // a value with higher priority, and that the current value must be ignored. - // - // A key difference between discarding Values as a result of SetSlot, vs. - // discarding them cascade-time (StyleCascade::Add), is that we are taking - // the cascade order into account. This means that, if everything else is - // equal (origin, tree order), the value that entered the cascade last wins. - // This is crucial to resolve situations like writing-mode and - // -webkit-writing-mode. - bool SetSlot(const CSSProperty&, CascadePriority, StyleResolverState&); - private: friend class AutoLock; friend class StyleCascade; @@ -182,7 +152,6 @@ NameStack stack_; wtf_size_t cycle_depth_ = kNotFound; CascadeFilter filter_; - StyleCascadeSlots slots_; const MatchResult* match_result_; const CascadeInterpolations* interpolations_; const uint8_t generation_ = 0; @@ -246,6 +215,14 @@ // we don't have an appearance. void ApplyAppearance(Resolver&); + // Applies -webkit-border-image (if present), and skips any border-image + // longhands found with lower priority than -webkit-border-image. + // + // The -webkit-border-image property is unique (in a bad way), since it's + // a surrogate of a shorthand. Therefore it needs special treatment to + // behave correctly. + void ApplyWebkitBorderImage(Resolver&); + void ApplyMatchResult(const MatchResult&, Resolver&); void ApplyInterpolations(const CascadeInterpolations&, Resolver&); void ApplyInterpolationMap(const ActiveInterpolationsMap&, @@ -319,6 +296,51 @@ WTF::TextEncoding charset_; }; + enum class Surrogate { kSkip, kApply, kNoSurrogate }; + + // A property can be skipped apply-time if it's a surrogate property. + // + // A surrogate property is an alias-like property that shares a storage + // location on ComputedStyle with the property it's a surrogate for. Unlike + // aliases, they are not resolved parse-time, but exist alongside the original + // property in the parsed rule. + // + // For example, consider a rule: + // + // div { + // inline-size: 20px; + // width: 10px; + // } + // + // The inline-size property is a surrogate of width in this case. When we + // encounter inline-size during Apply, we check the CascadePriority of the + // the original property (width). Since width has a higher priority (it + // appears later), we skip applying inline-size. + // + // Had the order been reversed: + // + // div { + // width: 10px; + // inline-size: 20px; + // } + // + // we would first apply width (it's unaware that it has surrogates pointing to + // it), and then later also apply inline-size (we check the CascadePriority + // of width and find that it's lower than inline-size's). + // + // Surrogate properties should be skipped (i.e. not applied after all) if + // the corresponding original property has a higher priority. + // + Surrogate ResolveSurrogate(const CSSProperty&, CascadePriority, Resolver&); + + inline Surrogate ResolveIfSurrogate(const CSSProperty& property, + CascadePriority priority, + Resolver& resolver) { + if (!property.IsSurrogate()) + return Surrogate::kNoSurrogate; + return ResolveSurrogate(property, priority, resolver); + } + // Resolving Values // // *Resolving* a value, means looking at the dependencies for a given
diff --git a/third_party/blink/renderer/core/css/resolver/style_cascade_test.cc b/third_party/blink/renderer/core/css/resolver/style_cascade_test.cc index 7863411..da8326c 100644 --- a/third_party/blink/renderer/core/css/resolver/style_cascade_test.cc +++ b/third_party/blink/renderer/core/css/resolver/style_cascade_test.cc
@@ -32,7 +32,6 @@ #include "third_party/blink/renderer/core/css/resolver/cascade_priority.h" #include "third_party/blink/renderer/core/css/resolver/scoped_style_resolver.h" #include "third_party/blink/renderer/core/css/resolver/style_resolver.h" -#include "third_party/blink/renderer/core/css/style_cascade_slots.h" #include "third_party/blink/renderer/core/css/style_engine.h" #include "third_party/blink/renderer/core/css/style_sheet_contents.h" #include "third_party/blink/renderer/core/html/html_element.h" @@ -1743,7 +1742,7 @@ } TEST_F(StyleCascadeTest, ForeignObjectZoomVsEffectiveZoom) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <svg> <foreignObject id='foreign'></foreignObject> </svg> @@ -1900,65 +1899,6 @@ EXPECT_EQ("space", cascade.ComputedValue("border-image-repeat")); } -TEST_F(StyleCascadeTest, AllLogicalPropertiesSlot) { - TestCascade cascade(GetDocument()); - - static const TextDirection directions[] = {TextDirection::kLtr, - TextDirection::kRtl}; - - static const WritingMode modes[] = {WritingMode::kHorizontalTb, - WritingMode::kVerticalRl, - WritingMode::kVerticalLr}; - - for (CSSPropertyID id : CSSPropertyIDList()) { - const CSSProperty& property = CSSProperty::Get(id); - - if (!property.IsLonghand()) - continue; - - for (TextDirection direction : directions) { - for (WritingMode mode : modes) { - const CSSProperty& physical = - property.ResolveDirectionAwareProperty(direction, mode); - if (&property == &physical) - continue; - - auto& state = cascade.State(); - state.Style()->SetDirection(direction); - state.Style()->SetWritingMode(mode); - - // Set logical first. - { - StyleCascadeSlots slots; - EXPECT_TRUE(slots.Set(property, Origin::kAuthor, state)); - EXPECT_FALSE(slots.Set(physical, Origin::kUserAgent, state)); - } - - // Set physical first. - { - StyleCascadeSlots slots; - EXPECT_TRUE(slots.Set(physical, Origin::kAuthor, state)); - EXPECT_FALSE(slots.Set(property, Origin::kUserAgent, state)); - } - - // Set logical twice. - { - StyleCascadeSlots slots; - EXPECT_TRUE(slots.Set(property, Origin::kAuthor, state)); - EXPECT_FALSE(slots.Set(property, Origin::kUserAgent, state)); - } - - // Set physical twice. - { - StyleCascadeSlots slots; - EXPECT_TRUE(slots.Set(physical, Origin::kAuthor, state)); - EXPECT_FALSE(slots.Set(physical, Origin::kUserAgent, state)); - } - } - } - } -} - TEST_F(StyleCascadeTest, MarkReferenced) { RegisterProperty(GetDocument(), "--x", "<length>", "0px", false); RegisterProperty(GetDocument(), "--y", "<length>", "0px", false);
diff --git a/third_party/blink/renderer/core/css/resolver/style_resolver_test.cc b/third_party/blink/renderer/core/css/resolver/style_resolver_test.cc index dd4e8b5..b1a5b546 100644 --- a/third_party/blink/renderer/core/css/resolver/style_resolver_test.cc +++ b/third_party/blink/renderer/core/css/resolver/style_resolver_test.cc
@@ -20,7 +20,7 @@ }; TEST_F(StyleResolverTest, StyleForTextInDisplayNone) { - GetDocument().documentElement()->SetInnerHTMLFromString(R"HTML( + GetDocument().documentElement()->setInnerHTML(R"HTML( <body style="display:none">Text</body> )HTML"); @@ -36,7 +36,7 @@ } TEST_F(StyleResolverTest, AnimationBaseComputedStyle) { - GetDocument().documentElement()->SetInnerHTMLFromString(R"HTML( + GetDocument().documentElement()->setInnerHTML(R"HTML( <style> html { font-size: 10px; } body { font-size: 20px; } @@ -69,7 +69,7 @@ } TEST_F(StyleResolverTest, ShadowDOMV0Crash) { - GetDocument().documentElement()->SetInnerHTMLFromString(R"HTML( + GetDocument().documentElement()->setInnerHTML(R"HTML( <style> span { display: contents; } </style> @@ -80,8 +80,8 @@ Element* inner = GetDocument().getElementById("inner"); ShadowRoot& outer_root = outer->CreateV0ShadowRootForTesting(); ShadowRoot& inner_root = inner->CreateV0ShadowRootForTesting(); - outer_root.SetInnerHTMLFromString("<content>"); - inner_root.SetInnerHTMLFromString("<span>"); + outer_root.setInnerHTML("<content>"); + inner_root.setInnerHTML("<span>"); // Test passes if it doesn't crash. UpdateAllLifecyclePhasesForTest();
diff --git a/third_party/blink/renderer/core/css/rule_feature_set_test.cc b/third_party/blink/renderer/core/css/rule_feature_set_test.cc index 903c783..02ce7c9 100644 --- a/third_party/blink/renderer/core/css/rule_feature_set_test.cc +++ b/third_party/blink/renderer/core/css/rule_feature_set_test.cc
@@ -31,7 +31,7 @@ html->AppendChild(MakeGarbageCollected<HTMLBodyElement>(*document_)); document_->AppendChild(html); - document_->body()->SetInnerHTMLFromString("<b><i></i></b>"); + document_->body()->setInnerHTML("<b><i></i></b>"); } RuleFeatureSet::SelectorPreMatch CollectFeatures(
diff --git a/third_party/blink/renderer/core/css/selector_query_test.cc b/third_party/blink/renderer/core/css/selector_query_test.cc index c5cf613..84cffc1 100644 --- a/third_party/blink/renderer/core/css/selector_query_test.cc +++ b/third_party/blink/renderer/core/css/selector_query_test.cc
@@ -67,7 +67,7 @@ auto* document = MakeGarbageCollected<Document>(); auto* html = MakeGarbageCollected<HTMLHtmlElement>(*document); document->AppendChild(html); - document->documentElement()->SetInnerHTMLFromString( + document->documentElement()->setInnerHTML( "<body><style>span::before { content: 'X' }</style><span></span></body>"); CSSSelectorList selector_list = CSSParser::ParseSelector( @@ -96,7 +96,7 @@ auto* document = MakeGarbageCollected<HTMLDocument>(); auto* html = MakeGarbageCollected<HTMLHtmlElement>(*document); document->AppendChild(html); - document->documentElement()->SetInnerHTMLFromString( + document->documentElement()->setInnerHTML( "<body><p></p><p id=last></p></body>", ASSERT_NO_EXCEPTION); document->body()->BeginParsingChildren(); @@ -331,7 +331,7 @@ TEST(SelectorQueryTest, DisconnectedSubtree) { auto* document = MakeGarbageCollected<HTMLDocument>(); Element* scope = document->CreateRawElement(html_names::kDivTag); - scope->SetInnerHTMLFromString(R"HTML( + scope->setInnerHTML(R"HTML( <section> <span id=first> <span id=A class=A></span> @@ -360,7 +360,7 @@ Element* host = document->CreateRawElement(html_names::kDivTag); ShadowRoot& shadowRoot = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadowRoot.SetInnerHTMLFromString(R"HTML( + shadowRoot.setInnerHTML(R"HTML( <section> <span id=first> <span id=A class=A></span>
diff --git a/third_party/blink/renderer/core/css/style_element_test.cc b/third_party/blink/renderer/core/css/style_element_test.cc index 13a2d7e9..5b37ef7 100644 --- a/third_party/blink/renderer/core/css/style_element_test.cc +++ b/third_party/blink/renderer/core/css/style_element_test.cc
@@ -17,7 +17,7 @@ auto dummy_page_holder = std::make_unique<DummyPageHolder>(IntSize(800, 600)); Document& document = dummy_page_holder->GetDocument(); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<style id=style>a { top: 0; }</style>"); auto& style_element = To<HTMLStyleElement>(*document.getElementById("style"));
diff --git a/third_party/blink/renderer/core/css/style_engine_test.cc b/third_party/blink/renderer/core/css/style_engine_test.cc index 637302e..5db06329 100644 --- a/third_party/blink/renderer/core/css/style_engine_test.cc +++ b/third_party/blink/renderer/core/css/style_engine_test.cc
@@ -109,7 +109,7 @@ } TEST_F(StyleEngineTest, AnalyzedInject) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> @font-face { font-family: 'Cool Font'; @@ -296,7 +296,7 @@ auto* style_element = MakeGarbageCollected<HTMLStyleElement>( GetDocument(), CreateElementFlags()); - style_element->SetInnerHTMLFromString( + style_element->setInnerHTML( "@font-face {" " font-family: 'Cool Font';" " src: url(dummy);" @@ -365,8 +365,7 @@ style_element = MakeGarbageCollected<HTMLStyleElement>(GetDocument(), CreateElementFlags()); - style_element->SetInnerHTMLFromString( - "@keyframes dummy-animation { from {} to {} }"); + style_element->setInnerHTML("@keyframes dummy-animation { from {} to {} }"); GetDocument().body()->AppendChild(style_element); UpdateAllLifecyclePhases(); @@ -620,7 +619,7 @@ } TEST_F(StyleEngineTest, InjectedFontFace) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> @font-face { font-family: 'Author'; @@ -653,7 +652,7 @@ } TEST_F(StyleEngineTest, IgnoreInvalidPropertyValue) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<section><div id='t1'>Red</div></section>" "<style id='s1'>div { color: red; } section div#t1 { color:rgb(0"); UpdateAllLifecyclePhases(); @@ -705,7 +704,7 @@ } TEST_F(StyleEngineTest, RuleSetInvalidationTypeSelectors) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div> <span></span> <div></div> @@ -751,7 +750,7 @@ } TEST_F(StyleEngineTest, RuleSetInvalidationCustomPseudo) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style>progress { -webkit-appearance:none }</style> <progress></progress> <div></div><div></div><div></div><div></div><div></div><div></div> @@ -769,7 +768,7 @@ } TEST_F(StyleEngineTest, RuleSetInvalidationHost) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<div id=nohost></div><div id=host></div>"); Element* host = GetDocument().getElementById("host"); ASSERT_TRUE(host); @@ -777,7 +776,7 @@ ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString("<div></div><div></div><div></div>"); + shadow_root.setInnerHTML("<div></div><div></div><div></div>"); UpdateAllLifecyclePhases(); unsigned before_count = GetStyleEngine().StyleForElementCount(); @@ -808,7 +807,7 @@ } TEST_F(StyleEngineTest, RuleSetInvalidationSlotted) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id=host> <span slot=other class=s1></span> <span class=s2></span> @@ -823,7 +822,7 @@ ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString("<slot name=other></slot><slot></slot>"); + shadow_root.setInnerHTML("<slot name=other></slot><slot></slot>"); UpdateAllLifecyclePhases(); unsigned before_count = GetStyleEngine().StyleForElementCount(); @@ -844,15 +843,14 @@ } TEST_F(StyleEngineTest, RuleSetInvalidationHostContext) { - GetDocument().body()->SetInnerHTMLFromString("<div id=host></div>"); + GetDocument().body()->setInnerHTML("<div id=host></div>"); Element* host = GetDocument().getElementById("host"); ASSERT_TRUE(host); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString( - "<div></div><div class=a></div><div></div>"); + shadow_root.setInnerHTML("<div></div><div class=a></div><div></div>"); UpdateAllLifecyclePhases(); unsigned before_count = GetStyleEngine().StyleForElementCount(); @@ -872,15 +870,14 @@ } TEST_F(StyleEngineTest, RuleSetInvalidationV0BoundaryCrossing) { - GetDocument().body()->SetInnerHTMLFromString("<div id=host></div>"); + GetDocument().body()->setInnerHTML("<div id=host></div>"); Element* host = GetDocument().getElementById("host"); ASSERT_TRUE(host); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString( - "<div></div><div class=a></div><div></div>"); + shadow_root.setInnerHTML("<div></div><div class=a></div><div></div>"); UpdateAllLifecyclePhases(); EXPECT_EQ(ScheduleInvalidationsForRules( @@ -889,7 +886,7 @@ } TEST_F(StyleEngineTest, HasViewportDependentMediaQueries) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style>div {}</style> <style id='sheet' media='(min-width: 200px)'> div {} @@ -914,7 +911,7 @@ } TEST_F(StyleEngineTest, StyleMediaAttributeStyleChange) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<style id='s1' media='(max-width: 1px)'>#t1 { color: green }</style>" "<div id='t1'>Green</div><div></div>"); UpdateAllLifecyclePhases(); @@ -940,7 +937,7 @@ } TEST_F(StyleEngineTest, StyleMediaAttributeNoStyleChange) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<style id='s1' media='(max-width: 1000px)'>#t1 { color: green }</style>" "<div id='t1'>Green</div><div></div>"); UpdateAllLifecyclePhases(); @@ -971,7 +968,7 @@ // CSSPropertyValueSet pointers. When a mutable CSSPropertyValueSet is // modified, the pointer doesn't change, yet the declarations do. - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<style id='s1'>#t1 { color: blue }</style>" "<div id='t1'>Green</div>"); UpdateAllLifecyclePhases(); @@ -1013,7 +1010,7 @@ } TEST_F(StyleEngineTest, VisitedExplicitInheritanceMatchedPropertiesCache) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> :visited { overflow: inherit } </style> @@ -1035,7 +1032,7 @@ } TEST_F(StyleEngineTest, ScheduleInvalidationAfterSubtreeRecalc) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style id='s1'> .t1 span { color: green } .t2 span { color: green } @@ -1108,7 +1105,7 @@ } TEST_F(StyleEngineTest, ScheduleRuleSetInvalidationsOnNewShadow) { - GetDocument().body()->SetInnerHTMLFromString("<div id='host'></div>"); + GetDocument().body()->setInnerHTML("<div id='host'></div>"); Element* host = GetDocument().getElementById("host"); ASSERT_TRUE(host); @@ -1116,7 +1113,7 @@ ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString(R"HTML( + shadow_root.setInnerHTML(R"HTML( <style> span { color: green } t1 { color: green } @@ -1132,7 +1129,7 @@ } TEST_F(StyleEngineTest, EmptyHttpEquivDefaultStyle) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<style>div { color:pink }</style><div id=container></div>"); UpdateAllLifecyclePhases(); @@ -1140,18 +1137,16 @@ Element* container = GetDocument().getElementById("container"); ASSERT_TRUE(container); - container->SetInnerHTMLFromString( - "<meta http-equiv='default-style' content=''>"); + container->setInnerHTML("<meta http-equiv='default-style' content=''>"); EXPECT_FALSE(GetStyleEngine().NeedsActiveStyleUpdate()); - container->SetInnerHTMLFromString( + container->setInnerHTML( "<meta http-equiv='default-style' content='preferred'>"); EXPECT_TRUE(GetStyleEngine().NeedsActiveStyleUpdate()); } TEST_F(StyleEngineTest, StyleSheetsForStyleSheetList_Document) { - GetDocument().body()->SetInnerHTMLFromString( - "<style>span { color: green }</style>"); + GetDocument().body()->setInnerHTML("<style>span { color: green }</style>"); EXPECT_TRUE(GetStyleEngine().NeedsActiveStyleUpdate()); const auto& sheet_list = @@ -1159,7 +1154,7 @@ EXPECT_EQ(1u, sheet_list.size()); EXPECT_TRUE(GetStyleEngine().NeedsActiveStyleUpdate()); - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<style>span { color: green }</style><style>div { color: pink }</style>"); EXPECT_TRUE(GetStyleEngine().NeedsActiveStyleUpdate()); @@ -1174,7 +1169,7 @@ } TEST_F(StyleEngineTest, StyleSheetsForStyleSheetList_ShadowRoot) { - GetDocument().body()->SetInnerHTMLFromString("<div id='host'></div>"); + GetDocument().body()->setInnerHTML("<div id='host'></div>"); Element* host = GetDocument().getElementById("host"); ASSERT_TRUE(host); @@ -1182,7 +1177,7 @@ ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString("<style>span { color: green }</style>"); + shadow_root.setInnerHTML("<style>span { color: green }</style>"); EXPECT_TRUE(GetStyleEngine().NeedsActiveStyleUpdate()); const auto& sheet_list = @@ -1190,7 +1185,7 @@ EXPECT_EQ(1u, sheet_list.size()); EXPECT_TRUE(GetStyleEngine().NeedsActiveStyleUpdate()); - shadow_root.SetInnerHTMLFromString( + shadow_root.setInnerHTML( "<style>span { color: green }</style><style>div { color: pink }</style>"); EXPECT_TRUE(GetStyleEngine().NeedsActiveStyleUpdate()); @@ -1254,8 +1249,7 @@ } TEST_F(StyleEngineTest, MediaQueryAffectingValueChanged_StyleElementNoMedia) { - GetDocument().body()->SetInnerHTMLFromString( - "<style>div{color:pink}</style>"); + GetDocument().body()->setInnerHTML("<style>div{color:pink}</style>"); UpdateAllLifecyclePhases(); GetStyleEngine().MediaQueryAffectingValueChanged(); EXPECT_FALSE(GetStyleEngine().NeedsActiveStyleUpdate()); @@ -1263,8 +1257,7 @@ TEST_F(StyleEngineTest, MediaQueryAffectingValueChanged_StyleElementMediaNoValue) { - GetDocument().body()->SetInnerHTMLFromString( - "<style media>div{color:pink}</style>"); + GetDocument().body()->setInnerHTML("<style media>div{color:pink}</style>"); UpdateAllLifecyclePhases(); GetStyleEngine().MediaQueryAffectingValueChanged(); EXPECT_FALSE(GetStyleEngine().NeedsActiveStyleUpdate()); @@ -1272,8 +1265,7 @@ TEST_F(StyleEngineTest, MediaQueryAffectingValueChanged_StyleElementMediaEmpty) { - GetDocument().body()->SetInnerHTMLFromString( - "<style media=''>div{color:pink}</style>"); + GetDocument().body()->setInnerHTML("<style media=''>div{color:pink}</style>"); UpdateAllLifecyclePhases(); GetStyleEngine().MediaQueryAffectingValueChanged(); EXPECT_FALSE(GetStyleEngine().NeedsActiveStyleUpdate()); @@ -1285,7 +1277,7 @@ TEST_F(StyleEngineTest, MediaQueryAffectingValueChanged_StyleElementMediaNoValid) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<style media=',,'>div{color:pink}</style>"); UpdateAllLifecyclePhases(); GetStyleEngine().MediaQueryAffectingValueChanged(); @@ -1293,7 +1285,7 @@ } TEST_F(StyleEngineTest, MediaQueryAffectingValueChanged_StyleElementMediaAll) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<style media='all'>div{color:pink}</style>"); UpdateAllLifecyclePhases(); GetStyleEngine().MediaQueryAffectingValueChanged(); @@ -1302,7 +1294,7 @@ TEST_F(StyleEngineTest, MediaQueryAffectingValueChanged_StyleElementMediaNotAll) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<style media='not all'>div{color:pink}</style>"); UpdateAllLifecyclePhases(); GetStyleEngine().MediaQueryAffectingValueChanged(); @@ -1310,7 +1302,7 @@ } TEST_F(StyleEngineTest, MediaQueryAffectingValueChanged_StyleElementMediaType) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<style media='print'>div{color:pink}</style>"); UpdateAllLifecyclePhases(); GetStyleEngine().MediaQueryAffectingValueChanged(); @@ -1318,7 +1310,7 @@ } TEST_F(StyleEngineTest, EmptyPseudo_RemoveLast) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> .empty:empty + span { color: purple } </style> @@ -1340,7 +1332,7 @@ } TEST_F(StyleEngineTest, EmptyPseudo_RemoveNotLast) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> .empty:empty + span { color: purple } </style> @@ -1362,7 +1354,7 @@ } TEST_F(StyleEngineTest, EmptyPseudo_InsertFirst) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> .empty:empty + span { color: purple } </style> @@ -1384,7 +1376,7 @@ } TEST_F(StyleEngineTest, EmptyPseudo_InsertNotFirst) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> .empty:empty + span { color: purple } </style> @@ -1406,7 +1398,7 @@ } TEST_F(StyleEngineTest, EmptyPseudo_ModifyTextData_SingleNode) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> .empty:empty + span { color: purple } </style> @@ -1439,7 +1431,7 @@ } TEST_F(StyleEngineTest, EmptyPseudo_ModifyTextData_HasSiblings) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> .empty:empty + span { color: purple } </style> @@ -1470,7 +1462,7 @@ } TEST_F(StyleEngineTest, MediaQueriesChangeDefaultFontSize) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> body { color: red } @media (max-width: 40em) { @@ -1496,7 +1488,7 @@ ColorSchemeHelper color_scheme_helper(GetDocument()); color_scheme_helper.SetPreferredColorScheme(PreferredColorScheme::kLight); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> body { color: red } @media (prefers-color-scheme: dark) { @@ -1523,7 +1515,7 @@ ColorSchemeHelper color_scheme_helper(GetDocument()); color_scheme_helper.SetPreferredColorScheme(PreferredColorScheme::kDark); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> @media (prefers-color-scheme: no-preference) { body { color: green } @@ -1542,7 +1534,7 @@ } TEST_F(StyleEngineTest, MediaQueriesChangePrefersReducedMotion) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> body { color: red } @media (prefers-reduced-motion: reduce) { @@ -1566,7 +1558,7 @@ TEST_F(StyleEngineTest, MediaQueriesChangeForcedColors) { ScopedForcedColorsForTest scoped_feature(true); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> body { forced-color-adjust: none; @@ -1596,7 +1588,7 @@ TEST_F(StyleEngineTest, MediaQueriesChangeForcedColorsAndPreferredColorScheme) { ScopedForcedColorsForTest scoped_feature(true); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> body { forced-color-adjust: none; @@ -1665,7 +1657,7 @@ EXPECT_EQ(PreferredColorScheme::kLight, GetDocument().GetSettings()->GetPreferredColorScheme()); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> body { color: red } @media (prefers-color-scheme: dark) { @@ -1697,7 +1689,7 @@ TEST_F(StyleEngineTest, MediaQueriesReducedMotionOverride) { EXPECT_FALSE(GetDocument().GetSettings()->GetPrefersReducedMotion()); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> body { color: red } @media (prefers-reduced-motion: reduce) { @@ -1728,7 +1720,7 @@ TEST_F(StyleEngineTest, MediaQueriesChangeNavigationControls) { ScopedMediaQueryNavigationControlsForTest scoped_feature(true); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> @media (navigation-controls: none) { body { color: red } @@ -1754,14 +1746,14 @@ } TEST_F(StyleEngineTest, ShadowRootStyleRecalcCrash) { - GetDocument().body()->SetInnerHTMLFromString("<div id=host></div>"); + GetDocument().body()->setInnerHTML("<div id=host></div>"); auto* host = To<HTMLElement>(GetDocument().getElementById("host")); ASSERT_TRUE(host); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString(R"HTML( + shadow_root.setInnerHTML(R"HTML( <span id=span></span> <style> :nth-child(odd) { color: green } @@ -1776,7 +1768,7 @@ } TEST_F(StyleEngineTest, GetComputedStyleOutsideFlatTreeCrash) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> body, div { display: contents } div::before { display: contents; content: "" } @@ -1793,7 +1785,7 @@ } TEST_F(StyleEngineTest, RejectSelectorForPseudoElement) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> div::before { content: "" } .not-in-filter div::before { color: red } @@ -1824,7 +1816,7 @@ } TEST_F(StyleEngineTest, MarkForWhitespaceReattachment) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id=d1><span></span></div> <div id=d2><span></span><span></span></div> <div id=d3><span></span><span></span></div> @@ -1870,7 +1862,7 @@ } TEST_F(StyleEngineTest, FirstLetterRemoved) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style>.fl::first-letter { color: pink }</style> <div class=fl id=d1><div><span id=f1>A</span></div></div> <div class=fl id=d2><div><span id=f2>BB</span></div></div> @@ -1948,8 +1940,7 @@ EXPECT_TRUE(data1); // After a full recalc, we should have the same initial data. - GetDocument().body()->SetInnerHTMLFromString( - "<style>* { font-size: 1px; } </style>"); + GetDocument().body()->setInnerHTML("<style>* { font-size: 1px; } </style>"); EXPECT_TRUE(GetDocument().documentElement()->NeedsStyleRecalc()); EXPECT_TRUE(GetDocument().documentElement()->ChildNeedsStyleRecalc()); UpdateAllLifecyclePhases(); @@ -1965,7 +1956,7 @@ } TEST_F(StyleEngineTest, CSSSelectorEmptyWhitespaceOnlyFail) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style>.match:empty { background-color: red }</style> <div></div> <div> <span></span></div> @@ -1998,7 +1989,7 @@ } TEST_F(StyleEngineTest, EnsuredComputedStyleRecalc) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div style="display:none"> <div> <div id="computed"> @@ -2049,8 +2040,8 @@ } TEST_F(StyleEngineTest, EnsureCustomComputedStyle) { - GetDocument().body()->SetInnerHTMLFromString(""); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(""); + GetDocument().body()->setInnerHTML(R"HTML( <div id=div> <progress id=progress> </div> @@ -2093,7 +2084,7 @@ // InvalidateDefaultButtonStyle while the subtree disconnection // is taking place. TEST_F(StyleEngineTest, NoCrashWhenMarkingPartiallyRemovedSubtree) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> #foo:default {} /* Needed to enter Element::PseudoStateChanged */ </style> @@ -2115,7 +2106,7 @@ // Add some more buttons, to give InvalidateDefaultButtonStyle // something to do when the original <button> is removed. - inner->SetInnerHTMLFromString("<button><button>"); + inner->setInnerHTML("<button><button>"); UpdateAllLifecyclePhases(); form->removeChild(outer); @@ -2161,7 +2152,7 @@ } TEST_F(StyleEngineTest, PseudoElementBaseComputedStyle) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> @keyframes anim { from { background-color: white } @@ -2219,7 +2210,7 @@ } TEST_F(StyleEngineTest, ForceReattachLayoutTreeStyleRecalcRoot) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id="outer"> <div id="inner"></div> </div> @@ -2258,7 +2249,7 @@ TEST_F(StyleEngineTest, GetComputedStyleOutsideFlatTree) { ScopedFlatTreeStyleRecalcForTest feature_scope(true); - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( R"HTML(<div id="host"><div id="outer"><div id="inner"><div id="innermost"></div></div></div></div>)HTML"); auto* host = GetDocument().getElementById("host"); @@ -2325,7 +2316,7 @@ TEST_F(StyleEngineTest, MoveSlottedOutsideFlatTree) { ScopedFlatTreeStyleRecalcForTest feature_scope(true); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id="host1"><span></span></div> <div id="host2"></div> )HTML"); @@ -2336,7 +2327,7 @@ ShadowRoot& shadow_root = host1->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString("<slot></slot>"); + shadow_root.setInnerHTML("<slot></slot>"); host2->AttachShadowRootInternal(ShadowRootType::kOpen); UpdateAllLifecyclePhases(); @@ -2351,13 +2342,13 @@ TEST_F(StyleEngineTest, StyleRecalcRootInShadowTree) { ScopedFlatTreeStyleRecalcForTest feature_scope(true); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id="host"></div> )HTML"); Element* host = GetDocument().getElementById("host"); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString("<div><span></span></div>"); + shadow_root.setInnerHTML("<div><span></span></div>"); UpdateAllLifecyclePhases(); Element* span = To<Element>(shadow_root.firstChild()->firstChild()); @@ -2370,7 +2361,7 @@ TEST_F(StyleEngineTest, StyleRecalcRootOutsideFlatTree) { ScopedFlatTreeStyleRecalcForTest feature_scope(true); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id="host"><div id="ensured"><span></span></div></div> <div id="dirty"></div> )HTML"); @@ -2403,7 +2394,7 @@ TEST_F(StyleEngineTest, RemoveStyleRecalcRootFromFlatTree) { ScopedFlatTreeStyleRecalcForTest scope(true); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id=host><span></span></div> )HTML"); @@ -2412,7 +2403,7 @@ ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString("<div><slot></slot></div>"); + shadow_root.setInnerHTML("<div><slot></slot></div>"); UpdateAllLifecyclePhases(); @@ -2439,7 +2430,7 @@ TEST_F(StyleEngineTest, SlottedWithEnsuredStyleOutsideFlatTree) { ScopedFlatTreeStyleRecalcForTest scope(true); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id="host"><span></span></div> )HTML"); @@ -2448,7 +2439,7 @@ ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString(R"HTML( + shadow_root.setInnerHTML(R"HTML( <div><slot name="default"></slot></div> )HTML"); @@ -2468,7 +2459,7 @@ TEST_F(StyleEngineTest, RecalcEnsuredStyleOutsideFlatTreeV0) { ScopedFlatTreeStyleRecalcForTest scope(true); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id="host"><span></span></div> )HTML"); @@ -2494,7 +2485,7 @@ TEST_F(StyleEngineTest, ForceReattachRecalcRootAttachShadow) { ScopedFlatTreeStyleRecalcForTest scope(true); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id="reattach"></div><div id="host"><span></span></div> )HTML"); @@ -2518,7 +2509,7 @@ ColorSchemeHelper color_scheme_helper(GetDocument()); color_scheme_helper.SetPreferredColorScheme(PreferredColorScheme::kLight); - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> :root { color-scheme: light dark } #initial { color: initial } @@ -2570,7 +2561,7 @@ // https://crbug.com/1050564 TEST_P(ParameterizedStyleEngineTest, MediaAttributeChangeUpdatesFontCacheVersion) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> @font-face { font-family: custom-font; src: url(fake-font.woff); } </style>
diff --git a/third_party/blink/renderer/core/css/style_environment_variables_test.cc b/third_party/blink/renderer/core/css/style_environment_variables_test.cc index 7e1a546..bc8fa67 100644 --- a/third_party/blink/renderer/core/css/style_environment_variables_test.cc +++ b/third_party/blink/renderer/core/css/style_environment_variables_test.cc
@@ -48,7 +48,7 @@ void InitializeWithHTML(LocalFrame& frame, const String& html_content) { // Sets the inner html and runs the document lifecycle. - frame.GetDocument()->body()->SetInnerHTMLFromString(html_content); + frame.GetDocument()->body()->setInnerHTML(html_content); frame.GetDocument()->View()->UpdateAllLifecyclePhases( DocumentUpdateReason::kTest); }
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_budget_test.cc b/third_party/blink/renderer/core/display_lock/display_lock_budget_test.cc index 094c7ef..bc87d4ef 100644 --- a/third_party/blink/renderer/core/display_lock/display_lock_budget_test.cc +++ b/third_party/blink/renderer/core/display_lock/display_lock_budget_test.cc
@@ -485,7 +485,7 @@ EXPECT_TRUE(budget->NeedsLifecycleUpdates()); // Dirtying the element will cause us to do updates. - GetDocument().getElementById("child")->SetInnerHTMLFromString("a"); + GetDocument().getElementById("child")->setInnerHTML("a"); auto* parent = GetDocument().getElementById("parent"); EXPECT_TRUE(budget->NeedsLifecycleUpdates());
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_context_test.cc b/third_party/blink/renderer/core/display_lock/display_lock_context_test.cc index bb6f3e1..d211278 100644 --- a/third_party/blink/renderer/core/display_lock/display_lock_context_test.cc +++ b/third_party/blink/renderer/core/display_lock/display_lock_context_test.cc
@@ -117,8 +117,7 @@ } void SetHtmlInnerHTML(const char* content) { - GetDocument().documentElement()->SetInnerHTMLFromString( - String::FromUTF8(content)); + GetDocument().documentElement()->setInnerHTML(String::FromUTF8(content)); UpdateAllLifecyclePhasesForTest(); } @@ -443,7 +442,7 @@ EXPECT_TRUE(container->GetDisplayLockContext()->IsLocked()); // Change the inner text, this should not DCHECK. - container->SetInnerHTMLFromString("please don't DCHECK"); + container->setInnerHTML("please don't DCHECK"); UpdateAllLifecyclePhasesForTest(); } @@ -466,7 +465,7 @@ auto* container = GetDocument().getElementById("container"); LockElement(*container, true /* activatable */); EXPECT_TRUE(container->GetDisplayLockContext()->IsLocked()); - container->SetInnerHTMLFromString( + container->setInnerHTML( "testing" "<div>testing</div>" "tes<div style='display:none;'>x</div>ting"); @@ -702,7 +701,7 @@ EXPECT_FALSE(element->ChildNeedsReattachLayoutTree()); // Testing whitespace reattachment + dirty style. - element->SetInnerHTMLFromString("<div>something</div>"); + element->setInnerHTML("<div>something</div>"); EXPECT_FALSE(element->NeedsStyleRecalc()); EXPECT_TRUE(element->ChildNeedsStyleRecalc()); @@ -884,7 +883,7 @@ ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString( + shadow_root.setInnerHTML( "<div id='container' style='contain:style layout " "paint;'><slot></slot></div>"); UpdateAllLifecyclePhasesForTest(); @@ -968,7 +967,7 @@ auto* text_field = GetDocument().getElementById("textfield"); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString( + shadow_root.setInnerHTML( "<div id='container' style='contain:style layout " "paint;'><slot></slot></div>");
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_utilities_test.cc b/third_party/blink/renderer/core/display_lock/display_lock_utilities_test.cc index a622a88..f055499b 100644 --- a/third_party/blink/renderer/core/display_lock/display_lock_utilities_test.cc +++ b/third_party/blink/renderer/core/display_lock/display_lock_utilities_test.cc
@@ -56,7 +56,7 @@ Element& innermost = *GetDocument().getElementById("innermost"); ShadowRoot& shadow_root = inner_b.AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString("<div id='shadowDiv'>shadow!</div>"); + shadow_root.setInnerHTML("<div id='shadowDiv'>shadow!</div>"); Element& shadow_div = *shadow_root.getElementById("shadowDiv"); LockElement(outer, true);
diff --git a/third_party/blink/renderer/core/dom/character_data.cc b/third_party/blink/renderer/core/dom/character_data.cc index 7dae903..945ae86 100644 --- a/third_party/blink/renderer/core/dom/character_data.cc +++ b/third_party/blink/renderer/core/dom/character_data.cc
@@ -38,19 +38,13 @@ namespace blink { -void CharacterData::MakeParkableOrAtomize() { +void CharacterData::MakeParkable() { if (is_parkable_) return; - // ParkableStrings have some overhead, don't pay it if we're not going to - // park a string at all. - if (ParkableStringManager::ShouldPark(*data_.Impl())) { - parkable_data_ = ParkableString(data_.ReleaseImpl()); - data_ = String(); - is_parkable_ = true; - } else { - data_ = AtomicString(data_); - } + parkable_data_ = ParkableString(data_.ReleaseImpl()); + data_ = String(); + is_parkable_ = true; } void CharacterData::setData(const String& data) {
diff --git a/third_party/blink/renderer/core/dom/character_data.h b/third_party/blink/renderer/core/dom/character_data.h index b3acf28..cfd038d 100644 --- a/third_party/blink/renderer/core/dom/character_data.h +++ b/third_party/blink/renderer/core/dom/character_data.h
@@ -38,9 +38,8 @@ DEFINE_WRAPPERTYPEINFO(); public: - // Makes the data either Parkable or Atomic. This enables de-duplication in - // both cases, the first one allowing compression as well. - void MakeParkableOrAtomize(); + // Makes the data Parkable. This enables de-duplication and compression. + void MakeParkable(); const String& data() const { return is_parkable_ ? parkable_data_.ToString() : data_; }
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index 327c677..88fb6ee 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc
@@ -3994,6 +3994,7 @@ GetViewportData().GetViewportDescription().ReportMobilePageStats(frame_); Loader()->SetSentDidFinishLoad(); frame_->Client()->DispatchDidFinishLoad(); + frame_->GetLocalFrameHostRemote().DidFinishLoad(Loader()->Url()); if (!frame_) return false;
diff --git a/third_party/blink/renderer/core/dom/document_statistics_collector_test.cc b/third_party/blink/renderer/core/dom/document_statistics_collector_test.cc index 1e4245e..cd88138 100644 --- a/third_party/blink/renderer/core/dom/document_statistics_collector_test.cc +++ b/third_party/blink/renderer/core/dom/document_statistics_collector_test.cc
@@ -35,7 +35,7 @@ void DocumentStatisticsCollectorTest::SetHtmlInnerHTML( const String& html_content) { - GetDocument().documentElement()->SetInnerHTMLFromString((html_content)); + GetDocument().documentElement()->setInnerHTML((html_content)); } // This test checks open graph articles can be recognized.
diff --git a/third_party/blink/renderer/core/dom/document_test.cc b/third_party/blink/renderer/core/dom/document_test.cc index ff1bfdc..8a4c4061 100644 --- a/third_party/blink/renderer/core/dom/document_test.cc +++ b/third_party/blink/renderer/core/dom/document_test.cc
@@ -92,8 +92,7 @@ }; void DocumentTest::SetHtmlInnerHTML(const char* html_content) { - GetDocument().documentElement()->SetInnerHTMLFromString( - String::FromUTF8(html_content)); + GetDocument().documentElement()->setInnerHTML(String::FromUTF8(html_content)); UpdateAllLifecyclePhasesForTest(); } @@ -333,8 +332,7 @@ } // anonymous namespace TEST_F(DocumentTest, CreateRangeAdjustedToTreeScopeWithPositionInShadowTree) { - GetDocument().body()->SetInnerHTMLFromString( - "<div><select><option>012</option></div>"); + GetDocument().body()->setInnerHTML("<div><select><option>012</option></div>"); Element* const select_element = GetDocument().QuerySelector("select"); const Position& position = Position(*select_element->UserAgentShadowRoot(), @@ -845,7 +843,7 @@ "document.querySelector('input').reportValidity(); };"); GetDocument().body()->AppendChild(script); auto* input = To<HTMLInputElement>(GetDocument().body()->firstChild()); - DVLOG(0) << GetDocument().body()->OuterHTMLAsString(); + DVLOG(0) << GetDocument().body()->outerHTML(); // Sanity check. input->reportValidity(); @@ -880,7 +878,7 @@ // as it is more expensive than just doing layout. TEST_F(DocumentTest, EnsurePaintLocationDataValidForNodeCompositingInputsOnlyWhenNecessary) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id='ancestor'> <div id='sticky' style='position:sticky;'> <div id='stickyChild'></div> @@ -1287,7 +1285,7 @@ html.Append("'>"); } - GetDocument().documentElement()->SetInnerHTMLFromString(html.ToString()); + GetDocument().documentElement()->setInnerHTML(html.ToString()); UpdateAllLifecyclePhasesForTest(); } };
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc index 99e7f8f..de004b8 100644 --- a/third_party/blink/renderer/core/dom/element.cc +++ b/third_party/blink/renderer/core/dom/element.cc
@@ -26,18 +26,18 @@ #include "third_party/blink/renderer/core/dom/element.h" +#include <algorithm> #include <bitset> +#include <limits> #include <memory> +#include <utility> #include "cc/input/snap_selection_strategy.h" #include "third_party/blink/public/mojom/scroll/scroll_into_view_params.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/dictionary.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" #include "third_party/blink/renderer/bindings/core/v8/scroll_into_view_options_or_boolean.h" -#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_html.h" #include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_html_or_trusted_script_or_trusted_script_url.h" -#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_script.h" -#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_script_url.h" #include "third_party/blink/renderer/bindings/core/v8/v8_pointer_lock_options.h" #include "third_party/blink/renderer/bindings/core/v8/v8_scroll_into_view_options.h" #include "third_party/blink/renderer/bindings/core/v8/v8_scroll_to_options.h" @@ -174,7 +174,7 @@ class DisplayLockStyleScope { public: - DisplayLockStyleScope(Element* element) : element_(element) { + explicit DisplayLockStyleScope(Element* element) : element_(element) { // Note that we don't store context as a member of this scope, since it may // get created as part of element self style recalc. auto* context = element->GetDisplayLockContext(); @@ -2257,11 +2257,6 @@ kNotInSynchronizationOfLazyAttribute); } -void Element::setAttribute(const AtomicString& name, - const AtomicString& value) { - setAttribute(name, value, ASSERT_NO_EXCEPTION); -} - void Element::setAttribute(const QualifiedName& name, const AtomicString& value) { SynchronizeAttribute(name); @@ -2358,33 +2353,10 @@ } void Element::setAttribute(const QualifiedName& name, - const StringOrTrustedHTML& stringOrHTML, + const String& string, ExceptionState& exception_state) { - String valueString = - TrustedTypesCheckForHTML(stringOrHTML, &GetDocument(), exception_state); - if (!exception_state.HadException()) { - setAttribute(name, AtomicString(valueString)); - } -} - -void Element::setAttribute(const QualifiedName& name, - const StringOrTrustedScript& stringOrScript, - ExceptionState& exception_state) { - String valueString = TrustedTypesCheckForScript( - stringOrScript, GetDocument().ToExecutionContext(), exception_state); - if (!exception_state.HadException()) { - setAttribute(name, AtomicString(valueString)); - } -} - -void Element::setAttribute(const QualifiedName& name, - const StringOrTrustedScriptURL& stringOrURL, - ExceptionState& exception_state) { - String valueString = TrustedTypesCheckForScriptURL( - stringOrURL, GetDocument().ToExecutionContext(), exception_state); - if (!exception_state.HadException()) { - setAttribute(name, AtomicString(valueString)); - } + // TODO(lyf): Removes |exception_state| because this function never throws. + setAttribute(name, AtomicString(string)); } ALWAYS_INLINE void Element::SetAttributeInternal( @@ -4654,24 +4626,16 @@ new_focused_element, source_capabilities)); } -String Element::InnerHTMLAsString() const { +String Element::innerHTML() const { return CreateMarkup(this, kChildrenOnly); } -String Element::OuterHTMLAsString() const { +String Element::outerHTML() const { return CreateMarkup(this); } -void Element::innerHTML(StringOrTrustedHTML& result) const { - result.SetString(InnerHTMLAsString()); -} - -void Element::outerHTML(StringOrTrustedHTML& result) const { - result.SetString(OuterHTMLAsString()); -} - -void Element::SetInnerHTMLFromString(const String& html, - ExceptionState& exception_state) { +void Element::setInnerHTML(const String& html, + ExceptionState& exception_state) { probe::BreakableLocation(GetDocument().ToExecutionContext(), "Element.setInnerHTML"); if (html.IsEmpty() && !HasNonInBodyInsertionMode()) { @@ -4687,32 +4651,14 @@ } } -void Element::SetInnerHTMLFromString(const String& html) { - SetInnerHTMLFromString(html, ASSERT_NO_EXCEPTION); -} - -void Element::setInnerHTML(const StringOrTrustedHTML& string_or_html, - ExceptionState& exception_state) { - String html = - TrustedTypesCheckForHTML(string_or_html, &GetDocument(), exception_state); - if (!exception_state.HadException()) { - SetInnerHTMLFromString(html, exception_state); - } -} - -void Element::setInnerHTML(const StringOrTrustedHTML& string_or_html) { - setInnerHTML(string_or_html, ASSERT_NO_EXCEPTION); -} - -void Element::getInnerHTML(bool include_shadow_roots, - StringOrTrustedHTML& result) { - result.SetString(CreateMarkup( +String Element::getInnerHTML(bool include_shadow_roots) const { + return CreateMarkup( this, kChildrenOnly, kDoNotResolveURLs, - include_shadow_roots ? kIncludeShadowRoots : kNoShadowRoots)); + include_shadow_roots ? kIncludeShadowRoots : kNoShadowRoots); } -void Element::SetOuterHTMLFromString(const String& html, - ExceptionState& exception_state) { +void Element::setOuterHTML(const String& html, + ExceptionState& exception_state) { Node* p = parentNode(); if (!p) { exception_state.ThrowDOMException( @@ -4756,15 +4702,6 @@ } } -void Element::setOuterHTML(const StringOrTrustedHTML& string_or_html, - ExceptionState& exception_state) { - String html = - TrustedTypesCheckForHTML(string_or_html, &GetDocument(), exception_state); - if (!exception_state.HadException()) { - SetOuterHTMLFromString(html, exception_state); - } -} - // Step 4 of http://domparsing.spec.whatwg.org/#insertadjacenthtml() Node* Element::InsertAdjacent(const String& where, Node* new_child, @@ -4915,16 +4852,6 @@ InsertAdjacent(where, fragment, exception_state); } -void Element::insertAdjacentHTML(const String& where, - const StringOrTrustedHTML& string_or_html, - ExceptionState& exception_state) { - String markup = - TrustedTypesCheckForHTML(string_or_html, &GetDocument(), exception_state); - if (!exception_state.HadException()) { - insertAdjacentHTML(where, markup, exception_state); - } -} - void Element::setPointerCapture(PointerId pointer_id, ExceptionState& exception_state) { if (GetDocument().GetFrame()) { @@ -5000,7 +4927,7 @@ return g_empty_string; if (first_text_node && !found_multiple_text_nodes) { - first_text_node->MakeParkableOrAtomize(); + first_text_node->MakeParkable(); return first_text_node->data(); } @@ -5539,18 +5466,6 @@ StripLeadingAndTrailingHTMLSpaces(getAttribute(name))); } -void Element::GetURLAttribute(const QualifiedName& name, - StringOrTrustedScriptURL& result) const { - KURL url = GetURLAttribute(name); - result.SetString(url.GetString()); -} - -void Element::FastGetAttribute(const QualifiedName& name, - StringOrTrustedHTML& result) const { - String html = FastGetAttribute(name); - result.SetString(html); -} - KURL Element::GetNonEmptyURLAttribute(const QualifiedName& name) const { #if DCHECK_IS_ON() if (GetElementData()) {
diff --git a/third_party/blink/renderer/core/dom/element.h b/third_party/blink/renderer/core/dom/element.h index 580d51a..3db1102 100644 --- a/third_party/blink/renderer/core/dom/element.h +++ b/third_party/blink/renderer/core/dom/element.h
@@ -83,10 +83,7 @@ class ShadowRoot; class ShadowRootInit; class SpaceSplitString; -class StringOrTrustedHTML; class StringOrTrustedHTMLOrTrustedScriptOrTrustedScriptURL; -class StringOrTrustedScript; -class StringOrTrustedScriptURL; class StylePropertyMap; class StylePropertyMapReadOnly; class V0CustomElementDefinition; @@ -251,8 +248,7 @@ void setAttribute(const AtomicString& name, const AtomicString& value, - ExceptionState&); - void setAttribute(const AtomicString& name, const AtomicString& value); + ExceptionState& = ASSERT_NO_EXCEPTION); // Trusted Types variant for explicit setAttribute() use. void setAttribute(const AtomicString&, @@ -262,20 +258,7 @@ // Returns attributes that should be checked against Trusted Types virtual const AttrNameToTrustedType& GetCheckedAttributeTypes() const; - // Trusted Type HTML variant - void setAttribute(const QualifiedName&, - const StringOrTrustedHTML&, - ExceptionState&); - - // Trusted Type Script variant - void setAttribute(const QualifiedName&, - const StringOrTrustedScript&, - ExceptionState&); - - // Trusted Type ScriptURL variant - void setAttribute(const QualifiedName&, - const StringOrTrustedScriptURL&, - ExceptionState&); + void setAttribute(const QualifiedName&, const String&, ExceptionState&); static bool ParseAttributeName(QualifiedName&, const AtomicString& namespace_uri, @@ -657,8 +640,6 @@ KURL HrefURL() const; KURL GetURLAttribute(const QualifiedName&) const; - void GetURLAttribute(const QualifiedName&, StringOrTrustedScriptURL&) const; - void FastGetAttribute(const QualifiedName&, StringOrTrustedHTML&) const; KURL GetNonEmptyURLAttribute(const QualifiedName&) const; @@ -714,11 +695,6 @@ // The implementation of |innerText()| is found in "element_inner_text.cc". String innerText(); String outerText(); - String InnerHTMLAsString() const; - String OuterHTMLAsString() const; - void SetInnerHTMLFromString(const String& html, ExceptionState&); - void SetInnerHTMLFromString(const String& html); - void SetOuterHTMLFromString(const String& html, ExceptionState&); Element* insertAdjacentElement(const String& where, Element* new_child, @@ -730,17 +706,11 @@ const String& html, ExceptionState&); - // TrustedTypes variants of the above. - // TODO(mkwst): Write a spec for these bits. https://crbug.com/739170 - void innerHTML(StringOrTrustedHTML&) const; - void outerHTML(StringOrTrustedHTML&) const; - void setInnerHTML(const StringOrTrustedHTML&, ExceptionState&); - void setInnerHTML(const StringOrTrustedHTML&); - void getInnerHTML(bool include_shadow_roots, StringOrTrustedHTML& result); - void setOuterHTML(const StringOrTrustedHTML&, ExceptionState&); - void insertAdjacentHTML(const String& where, - const StringOrTrustedHTML&, - ExceptionState&); + String innerHTML() const; + String outerHTML() const; + void setInnerHTML(const String&, ExceptionState& = ASSERT_NO_EXCEPTION); + String getInnerHTML(bool include_shadow_roots) const; + void setOuterHTML(const String&, ExceptionState& = ASSERT_NO_EXCEPTION); void setPointerCapture(PointerId poinetr_id, ExceptionState&); void releasePointerCapture(PointerId pointer_id, ExceptionState&);
diff --git a/third_party/blink/renderer/core/dom/element.idl b/third_party/blink/renderer/core/dom/element.idl index 8805330..1f7e3af7 100644 --- a/third_party/blink/renderer/core/dom/element.idl +++ b/third_party/blink/renderer/core/dom/element.idl
@@ -90,8 +90,10 @@ // https://w3c.github.io/DOM-Parsing/#extensions-to-the-element-interface // // TODO(mkwst): Write a spec for the `TrustedHTML` variants. - [Affects=Nothing, CEReactions, CustomElementCallbacks, Custom=Setter, RuntimeCallStatsCounter=ElementInnerHTML] attribute HTMLString innerHTML; - [Affects=Nothing, CEReactions, CustomElementCallbacks, Custom=Setter] attribute HTMLString outerHTML; + // TODO(lyf): Change the type to `[TreatNullAs=xxx] HTMLString` after + // https://crbug.com/1058762 has been fixed. + [Affects=Nothing, CEReactions, CustomElementCallbacks, RuntimeCallStatsCounter=ElementInnerHTML, RaisesException=Setter] attribute [TreatNullAs=EmptyString, StringContext=TrustedHTML] DOMString innerHTML; + [Affects=Nothing, CEReactions, CustomElementCallbacks, RaisesException=Setter] attribute [TreatNullAs=EmptyString, StringContext=TrustedHTML] DOMString outerHTML; [CEReactions, CustomElementCallbacks, RaisesException] void insertAdjacentHTML(DOMString position, HTMLString text); // Declarative Shadow DOM getInnerHTML() function.
diff --git a/third_party/blink/renderer/core/dom/element_test.cc b/third_party/blink/renderer/core/dom/element_test.cc index 286f5b79..83346d2 100644 --- a/third_party/blink/renderer/core/dom/element_test.cc +++ b/third_party/blink/renderer/core/dom/element_test.cc
@@ -65,8 +65,7 @@ // Insert a new <div> above the sticky. This will dirty layout and invalidate // the sticky constraints. - writer->SetInnerHTMLFromString( - "<div style='height: 100px; width: 700px;'></div>"); + writer->setInnerHTML("<div style='height: 100px; width: 700px;'></div>"); EXPECT_EQ(DocumentLifecycle::kVisualUpdatePending, document.Lifecycle().GetState()); @@ -110,8 +109,7 @@ // Insert a new <div> above the sticky. This will dirty layout and invalidate // the sticky constraints. - writer->SetInnerHTMLFromString( - "<div style='height: 100px; width: 700px;'></div>"); + writer->setInnerHTML("<div style='height: 100px; width: 700px;'></div>"); EXPECT_EQ(DocumentLifecycle::kVisualUpdatePending, document.Lifecycle().GetState()); @@ -125,8 +123,7 @@ ->NeedsCompositingInputsUpdate()); // Dirty layout again, since |OffsetTop| will have cleaned it. - writer->SetInnerHTMLFromString( - "<div style='height: 100px; width: 700px;'></div>"); + writer->setInnerHTML("<div style='height: 100px; width: 700px;'></div>"); EXPECT_EQ(DocumentLifecycle::kVisualUpdatePending, document.Lifecycle().GetState()); @@ -168,8 +165,7 @@ // Insert a new <div> above the sticky. This will dirty layout and invalidate // the sticky constraints. - writer->SetInnerHTMLFromString( - "<div style='height: 100px; width: 700px;'></div>"); + writer->setInnerHTML("<div style='height: 100px; width: 700px;'></div>"); EXPECT_EQ(DocumentLifecycle::kVisualUpdatePending, document.Lifecycle().GetState());
diff --git a/third_party/blink/renderer/core/dom/flat_tree_traversal_test.cc b/third_party/blink/renderer/core/dom/flat_tree_traversal_test.cc index 718f6121..e880c282 100644 --- a/third_party/blink/renderer/core/dom/flat_tree_traversal_test.cc +++ b/third_party/blink/renderer/core/dom/flat_tree_traversal_test.cc
@@ -48,22 +48,22 @@ const char* shadow_html, unsigned index) { Element* body = GetDocument().body(); - body->SetInnerHTMLFromString(String::FromUTF8(main_html)); + body->setInnerHTML(String::FromUTF8(main_html)); auto* shadow_host = To<Element>(NodeTraversal::ChildAt(*body, index)); ShadowRoot& shadow_root = shadow_host->CreateV0ShadowRootForTesting(); - shadow_root.SetInnerHTMLFromString(String::FromUTF8(shadow_html)); + shadow_root.setInnerHTML(String::FromUTF8(shadow_html)); body->UpdateDistributionForFlatTreeTraversal(); } void FlatTreeTraversalTest::SetupDocumentTree(const char* main_html) { Element* body = GetDocument().body(); - body->SetInnerHTMLFromString(String::FromUTF8(main_html)); + body->setInnerHTML(String::FromUTF8(main_html)); } void FlatTreeTraversalTest::AttachV0ShadowRoot(Element& shadow_host, const char* shadow_inner_html) { ShadowRoot& shadow_root = shadow_host.CreateV0ShadowRootForTesting(); - shadow_root.SetInnerHTMLFromString(String::FromUTF8(shadow_inner_html)); + shadow_root.setInnerHTML(String::FromUTF8(shadow_inner_html)); GetDocument().body()->UpdateDistributionForFlatTreeTraversal(); } @@ -72,7 +72,7 @@ const char* shadow_inner_html) { ShadowRoot& shadow_root = shadow_host.AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString(String::FromUTF8(shadow_inner_html)); + shadow_root.setInnerHTML(String::FromUTF8(shadow_inner_html)); GetDocument().body()->UpdateDistributionForFlatTreeTraversal(); }
diff --git a/third_party/blink/renderer/core/dom/mutation_observer_test.cc b/third_party/blink/renderer/core/dom/mutation_observer_test.cc index ed6a2a2..f0220ca 100644 --- a/third_party/blink/renderer/core/dom/mutation_observer_test.cc +++ b/third_party/blink/renderer/core/dom/mutation_observer_test.cc
@@ -41,7 +41,7 @@ auto* root = To<HTMLElement>(document->CreateRawElement(html_names::kHTMLTag)); document->AppendChild(root); - root->SetInnerHTMLFromString("<head><title>\n</title></head><body></body>"); + root->setInnerHTML("<head><title>\n</title></head><body></body>"); Node* head = root->firstChild()->firstChild(); DCHECK(head); Persistent<MutationObserver> observer = MutationObserver::Create(
diff --git a/third_party/blink/renderer/core/dom/node.h b/third_party/blink/renderer/core/dom/node.h index 1cb6f6a..767e551e 100644 --- a/third_party/blink/renderer/core/dom/node.h +++ b/third_party/blink/renderer/core/dom/node.h
@@ -260,7 +260,7 @@ const AtomicString& lookupNamespaceURI(const String& prefix) const; String textContent(bool convert_brs_to_newlines = false) const; - void setTextContent(const String&); + virtual void setTextContent(const String&); void textContent(StringOrTrustedScript& result); virtual void setTextContent(const StringOrTrustedScript&, ExceptionState&);
diff --git a/third_party/blink/renderer/core/dom/node.idl b/third_party/blink/renderer/core/dom/node.idl index c7e0eb37..f3e793fd 100644 --- a/third_party/blink/renderer/core/dom/node.idl +++ b/third_party/blink/renderer/core/dom/node.idl
@@ -58,7 +58,7 @@ [Affects=Nothing, CEReactions, CustomElementCallbacks] attribute DOMString? nodeValue; - [Affects=Nothing, CEReactions, CustomElementCallbacks, RaisesException=Setter] attribute ScriptString? textContent; + [Affects=Nothing, CEReactions, CustomElementCallbacks, RaisesException=Setter] attribute (DOMString or TrustedScript)? textContent; [CEReactions, CustomElementCallbacks] void normalize(); [NewObject, DoNotTestNewObject, CEReactions, CustomElementCallbacks, RaisesException] Node cloneNode(optional boolean deep = false);
diff --git a/third_party/blink/renderer/core/dom/node_test.cc b/third_party/blink/renderer/core/dom/node_test.cc index 3ca23c5..96d805be 100644 --- a/third_party/blink/renderer/core/dom/node_test.cc +++ b/third_party/blink/renderer/core/dom/node_test.cc
@@ -269,7 +269,7 @@ ShadowRoot& shadow_root = GetDocument().getElementById("host")->AttachShadowRootInternal( ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString( + shadow_root.setInnerHTML( "<div id=root style='display:contents'><span></span><slot></slot></div>"); UpdateAllLifecyclePhasesForTest(); @@ -352,8 +352,7 @@ Element* host = GetDocument().getElementById("host"); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString( - "<div style='display:none'><slot></slot></div>"); + shadow_root.setInnerHTML("<div style='display:none'><slot></slot></div>"); UpdateAllLifecyclePhasesForTest(); EXPECT_FALSE(GetDocument().NeedsLayoutTreeUpdate()); @@ -392,7 +391,7 @@ Element* host = GetDocument().getElementById("host"); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString("<slot name='target'></slot>"); + shadow_root.setInnerHTML("<slot name='target'></slot>"); UpdateAllLifecyclePhasesForTest(); Element* span = To<Element>(host->firstChild()); @@ -413,7 +412,7 @@ Element* host = GetDocument().getElementById("host"); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString( + shadow_root.setInnerHTML( "<div><slot></slot></div><div id='child-dirty'><slot " "name='target'></slot></div>"); UpdateAllLifecyclePhasesForTest(); @@ -439,7 +438,7 @@ Element* host = GetDocument().getElementById("host"); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString("<slot></slot>"); + shadow_root.setInnerHTML("<slot></slot>"); UpdateAllLifecyclePhasesForTest(); auto* span = To<Element>(host->firstChild()); @@ -471,7 +470,7 @@ Element* host = GetDocument().getElementById("host"); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString("<div><slot></slot></div>"); + shadow_root.setInnerHTML("<div><slot></slot></div>"); UpdateAllLifecyclePhasesForTest(); auto* span = To<Element>(host->firstChild()); @@ -513,7 +512,7 @@ ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString("<div><slot name=x></slot></div>"); + shadow_root.setInnerHTML("<div><slot name=x></slot></div>"); UpdateAllLifecyclePhasesForTest(); // Make sure the span is style dirty.
diff --git a/third_party/blink/renderer/core/dom/nth_index_cache_test.cc b/third_party/blink/renderer/core/dom/nth_index_cache_test.cc index 128459b..942d9b4 100644 --- a/third_party/blink/renderer/core/dom/nth_index_cache_test.cc +++ b/third_party/blink/renderer/core/dom/nth_index_cache_test.cc
@@ -15,7 +15,7 @@ class NthIndexCacheTest : public PageTestBase {}; TEST_F(NthIndexCacheTest, NthIndex) { - GetDocument().documentElement()->SetInnerHTMLFromString(R"HTML( + GetDocument().documentElement()->setInnerHTML(R"HTML( <body> <span id=first></span><span></span><span></span><span></span><span></span>
diff --git a/third_party/blink/renderer/core/dom/range.cc b/third_party/blink/renderer/core/dom/range.cc index ce2ec76..71bad3d8 100644 --- a/third_party/blink/renderer/core/dom/range.cc +++ b/third_party/blink/renderer/core/dom/range.cc
@@ -25,7 +25,6 @@ #include "third_party/blink/renderer/core/dom/range.h" -#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_html.h" #include "third_party/blink/renderer/core/dom/character_data.h" #include "third_party/blink/renderer/core/dom/container_node.h" #include "third_party/blink/renderer/core/dom/document_fragment.h" @@ -963,29 +962,13 @@ } DocumentFragment* Range::createContextualFragment( - const StringOrTrustedHTML& string_or_html, - ExceptionState& exception_state) { - // Algorithm: - // http://domparsing.spec.whatwg.org/#extensions-to-the-range-interface - - DCHECK(!string_or_html.IsNull()); - - Document& document = start_.Container().GetDocument(); - - String markup = - TrustedTypesCheckForHTML(string_or_html, &document, exception_state); - if (!exception_state.HadException()) { - return createContextualFragmentFromString(markup, exception_state); - } - return nullptr; -} - -DocumentFragment* Range::createContextualFragmentFromString( const String& markup, ExceptionState& exception_state) { // Algorithm: // http://domparsing.spec.whatwg.org/#extensions-to-the-range-interface + DCHECK(!markup.IsNull()); + Node* node = &start_.Container(); // Step 1.
diff --git a/third_party/blink/renderer/core/dom/range.h b/third_party/blink/renderer/core/dom/range.h index 98d7083..e3d643b5 100644 --- a/third_party/blink/renderer/core/dom/range.h +++ b/third_party/blink/renderer/core/dom/range.h
@@ -46,7 +46,6 @@ class FloatQuad; class Node; class NodeWithIndex; -class StringOrTrustedHTML; class Text; class CORE_EXPORT Range final : public ScriptWrappable { @@ -117,7 +116,7 @@ String GetText() const; - DocumentFragment* createContextualFragment(const StringOrTrustedHTML& html, + DocumentFragment* createContextualFragment(const String& html, ExceptionState&); void detach(); @@ -206,9 +205,6 @@ void UpdateSelectionIfAddedToSelection(); void RemoveFromSelectionIfInDifferentRoot(Document& old_document); - DocumentFragment* createContextualFragmentFromString(const String& html, - ExceptionState&); - Member<Document> owner_document_; // Cannot be null. RangeBoundaryPoint start_; RangeBoundaryPoint end_;
diff --git a/third_party/blink/renderer/core/dom/range_test.cc b/third_party/blink/renderer/core/dom/range_test.cc index ed3b9c1..173d2e2 100644 --- a/third_party/blink/renderer/core/dom/range_test.cc +++ b/third_party/blink/renderer/core/dom/range_test.cc
@@ -37,7 +37,7 @@ class RangeTest : public EditingTestBase {}; TEST_F(RangeTest, extractContentsWithDOMMutationEvent) { - GetDocument().body()->SetInnerHTMLFromString("<span><b>abc</b>def</span>"); + GetDocument().body()->setInnerHTML("<span><b>abc</b>def</span>"); GetDocument().GetSettings()->SetScriptEnabled(true); Element* const script_element = GetDocument().CreateRawElement(html_names::kScriptTag); @@ -57,9 +57,9 @@ Element* const result = GetDocument().CreateRawElement(html_names::kDivTag); result->AppendChild(range->extractContents(ASSERT_NO_EXCEPTION)); - EXPECT_EQ("<b>abc</b>", result->InnerHTMLAsString()) + EXPECT_EQ("<b>abc</b>", result->innerHTML()) << "DOM mutation event handler should not affect result."; - EXPECT_EQ("<span>DEF</span>", span_element->OuterHTMLAsString()) + EXPECT_EQ("<span>DEF</span>", span_element->outerHTML()) << "DOM mutation event handler should be executed."; } @@ -102,7 +102,7 @@ TEST_F(RangeTest, SplitTextNodeRangeWithinText) { V8TestingScope scope; - GetDocument().body()->SetInnerHTMLFromString("1234"); + GetDocument().body()->setInnerHTML("1234"); auto* old_text = To<Text>(GetDocument().body()->firstChild()); auto* range04 = @@ -147,7 +147,7 @@ TEST_F(RangeTest, SplitTextNodeRangeOutsideText) { V8TestingScope scope; - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<span id=\"outer\">0<span id=\"inner-left\">1</span>SPLITME<span " "id=\"inner-right\">2</span>3</span>"); @@ -233,7 +233,7 @@ // Regression test for crbug.com/639184 TEST_F(RangeTest, NotMarkedValidByIrrelevantTextInsert) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<div><span id=span1>foo</span>bar<span id=span2>baz</span></div>"); Element* div = GetDocument().QuerySelector("div"); @@ -255,7 +255,7 @@ // Regression test for crbug.com/639184 TEST_F(RangeTest, NotMarkedValidByIrrelevantTextRemove) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<div><span id=span1>foofoo</span>bar<span id=span2>baz</span></div>"); Element* div = GetDocument().QuerySelector("div"); @@ -294,7 +294,7 @@ TEST_F(RangeTest, BoundingRectMustIndependentFromSelection) { LoadAhem(); - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<div style='font: Ahem; width: 2em;letter-spacing: 5px;'>xx xx </div>"); Node* const div = GetDocument().QuerySelector("div"); // "x^x @@ -316,8 +316,7 @@ // Regression test for crbug.com/681536 TEST_F(RangeTest, BorderAndTextQuadsWithInputInBetween) { - GetDocument().body()->SetInnerHTMLFromString( - "<div>foo <u><input> bar</u></div>"); + GetDocument().body()->setInnerHTML("<div>foo <u><input> bar</u></div>"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); Node* foo = GetDocument().QuerySelector("div")->firstChild(); @@ -349,7 +348,7 @@ } TEST_F(RangeTest, GetBorderAndTextQuadsWithFirstLetterOne) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> body { font-size: 20px; } #sample::first-letter { font-size: 500%; } @@ -394,7 +393,7 @@ } TEST_F(RangeTest, GetBorderAndTextQuadsWithFirstLetterThree) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> body { font-size: 20px; } #sample::first-letter { font-size: 500%; } @@ -455,7 +454,7 @@ } TEST_F(RangeTest, CollapsedRangeGetBorderAndTextQuadsWithFirstLetter) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> body { font-size: 20px; } #sample::first-letter { font-size: 500%; }
diff --git a/third_party/blink/renderer/core/dom/shadow_dom_v0_test.cc b/third_party/blink/renderer/core/dom/shadow_dom_v0_test.cc index 4aa094c3..c20d7e70 100644 --- a/third_party/blink/renderer/core/dom/shadow_dom_v0_test.cc +++ b/third_party/blink/renderer/core/dom/shadow_dom_v0_test.cc
@@ -111,7 +111,7 @@ TEST_F(ShadowDOMV0Test, FeatureSetSubtree) { LoadURL("about:blank"); auto* host = GetDocument().CreateRawElement(html_names::kDivTag); - host->CreateV0ShadowRootForTesting().SetInnerHTMLFromString(R"HTML( + host->CreateV0ShadowRootForTesting().setInnerHTML(R"HTML( <div> <div></div> <content select='*'></content> @@ -130,7 +130,7 @@ LoadURL("about:blank"); auto* host = GetDocument().CreateRawElement(html_names::kDivTag); auto& host_shadow = host->CreateV0ShadowRootForTesting(); - host_shadow.SetInnerHTMLFromString("<content select='#foo'></content>"); + host_shadow.setInnerHTML("<content select='#foo'></content>"); auto* child = GetDocument().CreateRawElement(html_names::kDivTag); auto& child_root = child->CreateV0ShadowRootForTesting(); auto* child_content = GetDocument().CreateRawElement(html_names::kContentTag);
diff --git a/third_party/blink/renderer/core/dom/shadow_root.cc b/third_party/blink/renderer/core/dom/shadow_root.cc index afd186608..a21966fa 100644 --- a/third_party/blink/renderer/core/dom/shadow_root.cc +++ b/third_party/blink/renderer/core/dom/shadow_root.cc
@@ -27,7 +27,6 @@ #include "third_party/blink/renderer/core/dom/shadow_root.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_html.h" #include "third_party/blink/renderer/core/css/resolver/style_resolver.h" #include "third_party/blink/renderer/core/css/style_change_reason.h" #include "third_party/blink/renderer/core/css/style_engine.h" @@ -113,31 +112,18 @@ slotting_ = static_cast<unsigned>(slotting); } -String ShadowRoot::InnerHTMLAsString() const { +String ShadowRoot::innerHTML() const { return CreateMarkup(this, kChildrenOnly); } -void ShadowRoot::innerHTML(StringOrTrustedHTML& result) const { - result.SetString(InnerHTMLAsString()); -} - -void ShadowRoot::SetInnerHTMLFromString(const String& markup, - ExceptionState& exception_state) { +void ShadowRoot::setInnerHTML(const String& markup, + ExceptionState& exception_state) { if (DocumentFragment* fragment = CreateFragmentForInnerOuterHTML( markup, &host(), kAllowScriptingContent, "innerHTML", exception_state)) ReplaceChildrenWithFragment(this, fragment, exception_state); } -void ShadowRoot::setInnerHTML(const StringOrTrustedHTML& stringOrHtml, - ExceptionState& exception_state) { - String html = - TrustedTypesCheckForHTML(stringOrHtml, &GetDocument(), exception_state); - if (!exception_state.HadException()) { - SetInnerHTMLFromString(html, exception_state); - } -} - void ShadowRoot::RecalcStyle(const StyleRecalcChange change) { // ShadowRoot doesn't support custom callbacks. DCHECK(!HasCustomStyleCallbacks());
diff --git a/third_party/blink/renderer/core/dom/shadow_root.h b/third_party/blink/renderer/core/dom/shadow_root.h index 5cce67184..6cdb76d1 100644 --- a/third_party/blink/renderer/core/dom/shadow_root.h +++ b/third_party/blink/renderer/core/dom/shadow_root.h
@@ -42,7 +42,6 @@ class ExceptionState; class ShadowRootV0; class SlotAssignment; -class StringOrTrustedHTML; class WhitespaceAttacher; enum class ShadowRootType { V0, kOpen, kClosed, kUserAgent }; @@ -139,14 +138,8 @@ Element* ActiveElement() const; - String InnerHTMLAsString() const; - void SetInnerHTMLFromString(const String&, - ExceptionState& = ASSERT_NO_EXCEPTION); - - // TrustedTypes variants of the above. - // TODO(mkwst): Write a spec for these bits. https://crbug.com/739170 - void innerHTML(StringOrTrustedHTML&) const; - void setInnerHTML(const StringOrTrustedHTML&, ExceptionState&); + String innerHTML() const; + void setInnerHTML(const String&, ExceptionState& = ASSERT_NO_EXCEPTION); Node* Clone(Document&, CloneChildrenFlag) const override;
diff --git a/third_party/blink/renderer/core/dom/shadow_root.idl b/third_party/blink/renderer/core/dom/shadow_root.idl index ec004df..d8d12cd 100644 --- a/third_party/blink/renderer/core/dom/shadow_root.idl +++ b/third_party/blink/renderer/core/dom/shadow_root.idl
@@ -30,7 +30,9 @@ interface ShadowRoot : DocumentFragment { readonly attribute ShadowRootMode mode; readonly attribute Element host; - [CEReactions, CustomElementCallbacks, Custom=Setter] attribute HTMLString innerHTML; + // TODO(lyf): Change the type to `[TreatNullAs=xxx] HTMLString` after + // https://crbug.com/1058762 has been fixed. + [CEReactions, CustomElementCallbacks, RaisesException=Setter] attribute [TreatNullAs=EmptyString, StringContext=TrustedHTML] DOMString innerHTML; readonly attribute boolean delegatesFocus; };
diff --git a/third_party/blink/renderer/core/dom/slot_assignment_test.cc b/third_party/blink/renderer/core/dom/slot_assignment_test.cc index db21a59..ec0505a 100644 --- a/third_party/blink/renderer/core/dom/slot_assignment_test.cc +++ b/third_party/blink/renderer/core/dom/slot_assignment_test.cc
@@ -103,7 +103,7 @@ void SlotAssignmentTest::SetBody(const char* html) { Element* body = GetDocument().body(); - body->SetInnerHTMLFromString(String::FromUTF8(html)); + body->setInnerHTML(String::FromUTF8(html)); ConvertDeclarativeShadowDOMToShadowRoot(*body); RemoveWhiteSpaceOnlyTextNode(*body); }
diff --git a/third_party/blink/renderer/core/dom/static_range_test.cc b/third_party/blink/renderer/core/dom/static_range_test.cc index bbab5fd..c46da51 100644 --- a/third_party/blink/renderer/core/dom/static_range_test.cc +++ b/third_party/blink/renderer/core/dom/static_range_test.cc
@@ -45,7 +45,7 @@ TEST_F(StaticRangeTest, SplitTextNodeRangeWithinText) { V8TestingScope scope; - GetDocument().body()->SetInnerHTMLFromString("1234"); + GetDocument().body()->setInnerHTML("1234"); auto* old_text = To<Text>(GetDocument().body()->firstChild()); auto* static_range04 = MakeGarbageCollected<StaticRange>( @@ -116,7 +116,7 @@ TEST_F(StaticRangeTest, SplitTextNodeRangeOutsideText) { V8TestingScope scope; - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<span id=\"outer\">0<span id=\"inner-left\">1</span>SPLITME<span " "id=\"inner-right\">2</span>3</span>"); @@ -231,7 +231,7 @@ TEST_F(StaticRangeTest, InvalidToRange) { V8TestingScope scope; - GetDocument().body()->SetInnerHTMLFromString("1234"); + GetDocument().body()->setInnerHTML("1234"); auto* old_text = To<Text>(GetDocument().body()->firstChild()); auto* static_range04 = MakeGarbageCollected<StaticRange>(
diff --git a/third_party/blink/renderer/core/dom/whitespace_attacher_test.cc b/third_party/blink/renderer/core/dom/whitespace_attacher_test.cc index b1eb7fb..f4ffb1b 100644 --- a/third_party/blink/renderer/core/dom/whitespace_attacher_test.cc +++ b/third_party/blink/renderer/core/dom/whitespace_attacher_test.cc
@@ -24,7 +24,7 @@ }; TEST_F(WhitespaceAttacherTest, WhitespaceAfterReattachedBlock) { - GetDocument().body()->SetInnerHTMLFromString("<div id=block></div> "); + GetDocument().body()->setInnerHTML("<div id=block></div> "); UpdateAllLifecyclePhasesForTest(); Element* div = GetDocument().getElementById("block"); @@ -44,7 +44,7 @@ } TEST_F(WhitespaceAttacherTest, WhitespaceAfterReattachedInline) { - GetDocument().body()->SetInnerHTMLFromString("<span id=inline></span> "); + GetDocument().body()->setInnerHTML("<span id=inline></span> "); UpdateAllLifecyclePhasesForTest(); Element* span = GetDocument().getElementById("inline"); @@ -63,8 +63,7 @@ } TEST_F(WhitespaceAttacherTest, WhitespaceAfterReattachedWhitespace) { - GetDocument().body()->SetInnerHTMLFromString( - "<span id=inline></span> <!-- --> "); + GetDocument().body()->setInnerHTML("<span id=inline></span> <!-- --> "); UpdateAllLifecyclePhasesForTest(); Element* span = GetDocument().getElementById("inline"); @@ -90,7 +89,7 @@ } TEST_F(WhitespaceAttacherTest, VisitBlockAfterReattachedWhitespace) { - GetDocument().body()->SetInnerHTMLFromString("<div id=block></div> "); + GetDocument().body()->setInnerHTML("<div id=block></div> "); UpdateAllLifecyclePhasesForTest(); Element* div = GetDocument().getElementById("block"); @@ -108,7 +107,7 @@ } TEST_F(WhitespaceAttacherTest, VisitInlineAfterReattachedWhitespace) { - GetDocument().body()->SetInnerHTMLFromString("<span id=inline></span> "); + GetDocument().body()->setInnerHTML("<span id=inline></span> "); UpdateAllLifecyclePhasesForTest(); Element* span = GetDocument().getElementById("inline"); @@ -129,7 +128,7 @@ } TEST_F(WhitespaceAttacherTest, VisitTextAfterReattachedWhitespace) { - GetDocument().body()->SetInnerHTMLFromString("Text<!-- --> "); + GetDocument().body()->setInnerHTML("Text<!-- --> "); UpdateAllLifecyclePhasesForTest(); auto* text = To<Text>(GetDocument().body()->firstChild()); @@ -152,7 +151,7 @@ } TEST_F(WhitespaceAttacherTest, ReattachWhitespaceInsideBlockExitingScope) { - GetDocument().body()->SetInnerHTMLFromString("<div id=block> </div>"); + GetDocument().body()->setInnerHTML("<div id=block> </div>"); UpdateAllLifecyclePhasesForTest(); Element* div = GetDocument().getElementById("block"); @@ -174,7 +173,7 @@ } TEST_F(WhitespaceAttacherTest, ReattachWhitespaceInsideInlineExitingScope) { - GetDocument().body()->SetInnerHTMLFromString("<span id=inline> </span>"); + GetDocument().body()->setInnerHTML("<span id=inline> </span>"); UpdateAllLifecyclePhasesForTest(); Element* span = GetDocument().getElementById("inline"); @@ -195,13 +194,13 @@ } TEST_F(WhitespaceAttacherTest, SlottedWhitespaceAfterReattachedBlock) { - GetDocument().body()->SetInnerHTMLFromString("<div id=host> </div>"); + GetDocument().body()->setInnerHTML("<div id=host> </div>"); Element* host = GetDocument().getElementById("host"); ASSERT_TRUE(host); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString("<div id=block></div><slot></slot>"); + shadow_root.setInnerHTML("<div id=block></div><slot></slot>"); UpdateAllLifecyclePhasesForTest(); Element* div = shadow_root.getElementById("block"); @@ -223,13 +222,13 @@ } TEST_F(WhitespaceAttacherTest, SlottedWhitespaceAfterReattachedInline) { - GetDocument().body()->SetInnerHTMLFromString("<div id=host> </div>"); + GetDocument().body()->setInnerHTML("<div id=host> </div>"); Element* host = GetDocument().getElementById("host"); ASSERT_TRUE(host); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString("<span id=inline></span><slot></slot>"); + shadow_root.setInnerHTML("<span id=inline></span><slot></slot>"); UpdateAllLifecyclePhasesForTest(); Element* span = shadow_root.getElementById("inline"); @@ -251,7 +250,7 @@ TEST_F(WhitespaceAttacherTest, WhitespaceInDisplayContentsAfterReattachedBlock) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<div id=block></div><span style='display:contents'> </span>"); UpdateAllLifecyclePhasesForTest(); @@ -277,7 +276,7 @@ TEST_F(WhitespaceAttacherTest, WhitespaceInDisplayContentsAfterReattachedInline) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<span id=inline></span><span style='display:contents'> </span>"); UpdateAllLifecyclePhasesForTest(); @@ -302,7 +301,7 @@ TEST_F(WhitespaceAttacherTest, WhitespaceAfterEmptyDisplayContentsAfterReattachedBlock) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<div id=block></div><span style='display:contents'></span> "); UpdateAllLifecyclePhasesForTest(); @@ -329,7 +328,7 @@ TEST_F(WhitespaceAttacherTest, WhitespaceAfterDisplayContentsWithDisplayNoneChildAfterReattachedBlock) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<div id=block></div><span style='display:contents'>" "<span style='display:none'></span></span> "); UpdateAllLifecyclePhasesForTest(); @@ -356,7 +355,7 @@ } TEST_F(WhitespaceAttacherTest, WhitespaceDeepInsideDisplayContents) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<span id=inline></span><span style='display:contents'>" "<span style='display:none'></span>" "<span id=inner style='display:contents'> </span></span>"); @@ -381,7 +380,7 @@ } TEST_F(WhitespaceAttacherTest, MultipleDisplayContents) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<span id=inline></span>" "<span style='display:contents'></span>" "<span style='display:contents'></span>" @@ -411,13 +410,13 @@ } TEST_F(WhitespaceAttacherTest, SlottedWhitespaceInsideDisplayContents) { - GetDocument().body()->SetInnerHTMLFromString("<div id=host> </div>"); + GetDocument().body()->setInnerHTML("<div id=host> </div>"); Element* host = GetDocument().getElementById("host"); ASSERT_TRUE(host); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString( + shadow_root.setInnerHTML( "<span id=inline></span>" "<div style='display:contents'><slot></slot></div>"); UpdateAllLifecyclePhasesForTest(); @@ -441,7 +440,7 @@ } TEST_F(WhitespaceAttacherTest, RemoveInlineBeforeSpace) { - GetDocument().body()->SetInnerHTMLFromString("<span id=inline></span> "); + GetDocument().body()->setInnerHTML("<span id=inline></span> "); UpdateAllLifecyclePhasesForTest(); Element* span = GetDocument().getElementById("inline"); @@ -463,7 +462,7 @@ } TEST_F(WhitespaceAttacherTest, RemoveInlineBeforeOutOfFlowBeforeSpace) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<span id=inline></span><div id=float style='float:right'></div> "); UpdateAllLifecyclePhasesForTest(); @@ -489,7 +488,7 @@ } TEST_F(WhitespaceAttacherTest, RemoveSpaceBeforeSpace) { - GetDocument().body()->SetInnerHTMLFromString("<span> <!-- --> </span>"); + GetDocument().body()->setInnerHTML("<span> <!-- --> </span>"); UpdateAllLifecyclePhasesForTest(); Node* span = GetDocument().body()->firstChild(); @@ -512,7 +511,7 @@ } TEST_F(WhitespaceAttacherTest, RemoveInlineBeforeDisplayContentsWithSpace) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<style>div { display: contents }</style>" "<div><span id=inline></span></div>" "<div><div><div id=innerdiv> </div></div></div>text"); @@ -533,8 +532,7 @@ } TEST_F(WhitespaceAttacherTest, RemoveBlockBeforeSpace) { - GetDocument().body()->SetInnerHTMLFromString( - "A<div id=block></div> <span>B</span>"); + GetDocument().body()->setInnerHTML("A<div id=block></div> <span>B</span>"); UpdateAllLifecyclePhasesForTest(); Node* div = GetDocument().getElementById("block");
diff --git a/third_party/blink/renderer/core/editing/commands/apply_block_element_command_test.cc b/third_party/blink/renderer/core/editing/commands/apply_block_element_command_test.cc index 1160013..0e5736d 100644 --- a/third_party/blink/renderer/core/editing/commands/apply_block_element_command_test.cc +++ b/third_party/blink/renderer/core/editing/commands/apply_block_element_command_test.cc
@@ -52,7 +52,7 @@ EXPECT_EQ( "<body contenteditable=\"false\">\n" "<pre><var id=\"va\" class=\"CLASS13\">\nC\n</var></pre><input></body>", - GetDocument().documentElement()->InnerHTMLAsString()); + GetDocument().documentElement()->innerHTML()); } // This is a regression test for https://crbug.com/660801 @@ -77,7 +77,7 @@ EXPECT_EQ( "<head><style>li:first-child { visibility:visible; }</style></head>" "<body><ul style=\"visibility:hidden\"><ul></ul><li>xyz</li></ul></body>", - GetDocument().documentElement()->InnerHTMLAsString()); + GetDocument().documentElement()->innerHTML()); } // This is a regression test for https://crbug.com/712510 @@ -109,7 +109,7 @@ "<h6><button></button></h6><br>" "<object></object>" "</div>", - GetDocument().body()->InnerHTMLAsString()); + GetDocument().body()->innerHTML()); } // This is a regression test for https://crbug.com/806525
diff --git a/third_party/blink/renderer/core/editing/commands/composite_edit_command_test.cc b/third_party/blink/renderer/core/editing/commands/composite_edit_command_test.cc index 04d209f..760a475e 100644 --- a/third_party/blink/renderer/core/editing/commands/composite_edit_command_test.cc +++ b/third_party/blink/renderer/core/editing/commands/composite_edit_command_test.cc
@@ -77,7 +77,7 @@ EditingState editing_state; sample.InsertNodeBefore(insert_child, ref_child, &editing_state); EXPECT_FALSE(editing_state.IsAborted()); - EXPECT_EQ("foo<b></b>", div->InnerHTMLAsString()); + EXPECT_EQ("foo<b></b>", div->innerHTML()); } TEST_F(CompositeEditCommandTest, insertNodeBeforeInUneditable) { @@ -102,7 +102,7 @@ EditingState editing_state; sample.InsertNodeBefore(insert_child, ref_child, &editing_state); EXPECT_FALSE(editing_state.IsAborted()); - EXPECT_EQ("<b></b>", div->InnerHTMLAsString()) + EXPECT_EQ("<b></b>", div->innerHTML()) << "InsertNodeBeforeCommand does nothing for disconnected node"; } @@ -117,7 +117,7 @@ EditingState editing_state; sample.InsertNodeBefore(insert_child, ref_child, &editing_state); EXPECT_FALSE(editing_state.IsAborted()); - EXPECT_EQ("foo<b></b>", div->InnerHTMLAsString()); + EXPECT_EQ("foo<b></b>", div->innerHTML()); } TEST_F(CompositeEditCommandTest, @@ -139,7 +139,7 @@ "<div><br></div>" "<style>div{-webkit-user-modify:read-only;user-select:none;}</style>" "foo", - body->InnerHTMLAsString()); + body->innerHTML()); } TEST_F(CompositeEditCommandTest, InsertNodeOnDisconnectedParent) {
diff --git a/third_party/blink/renderer/core/editing/commands/delete_selection_command_test.cc b/third_party/blink/renderer/core/editing/commands/delete_selection_command_test.cc index 2ee3a40..d5ad9c4c 100644 --- a/third_party/blink/renderer/core/editing/commands/delete_selection_command_test.cc +++ b/third_party/blink/renderer/core/editing/commands/delete_selection_command_test.cc
@@ -56,7 +56,7 @@ EXPECT_TRUE(command->Apply()) << "the delete command should have succeeded"; EXPECT_EQ("<div contenteditable=\"true\"><br></div>", - GetDocument().body()->InnerHTMLAsString()); + GetDocument().body()->innerHTML()); EXPECT_TRUE(frame->Selection().GetSelectionInDOMTree().IsCaret()); EXPECT_EQ(Position(div, 0), frame->Selection() .ComputeVisibleSelectionInDOMTree()
diff --git a/third_party/blink/renderer/core/editing/commands/insert_list_command_test.cc b/third_party/blink/renderer/core/editing/commands/insert_list_command_test.cc index 727520d..97a9ca42 100644 --- a/third_party/blink/renderer/core/editing/commands/insert_list_command_test.cc +++ b/third_party/blink/renderer/core/editing/commands/insert_list_command_test.cc
@@ -48,8 +48,7 @@ // This should not DCHECK. EXPECT_TRUE(command->Apply()) << "The insert ordered list command should have succeeded"; - EXPECT_EQ("<ol><li>\nd\n</li></ol>", - GetDocument().body()->InnerHTMLAsString()); + EXPECT_EQ("<ol><li>\nd\n</li></ol>", GetDocument().body()->innerHTML()); } // Refer https://crbug.com/794356
diff --git a/third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command_test.cc b/third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command_test.cc index f93883a..c4f9bc8 100644 --- a/third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command_test.cc +++ b/third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command_test.cc
@@ -69,7 +69,7 @@ // Insert <caption> between head and body Element* caption = GetDocument().CreateElementForBinding("caption"); - caption->SetInnerHTMLFromString("AxBxC"); + caption->setInnerHTML("AxBxC"); GetDocument().documentElement()->insertBefore(caption, GetDocument().body()); Selection().SetSelection(
diff --git a/third_party/blink/renderer/core/editing/commands/insert_text_command_test.cc b/third_party/blink/renderer/core/editing/commands/insert_text_command_test.cc index 72d7153..14d4cff 100644 --- a/third_party/blink/renderer/core/editing/commands/insert_text_command_test.cc +++ b/third_party/blink/renderer/core/editing/commands/insert_text_command_test.cc
@@ -29,7 +29,7 @@ EXPECT_EQ( "<div contenteditable=\"true\"><option id=\"sample\">x</option></div>", - GetDocument().body()->InnerHTMLAsString()) + GetDocument().body()->innerHTML()) << "Content of OPTION is distributed into shadow node as text" "without applying typing style."; } @@ -282,7 +282,7 @@ Element* iElement = GetDocument().CreateRawElement(html_names::kITag); nested_anchor->setAttribute("href", "www"); - iElement->SetInnerHTMLFromString("home"); + iElement->setInnerHTML("home"); anchor->AppendChild(nested_anchor); nested_anchor->AppendChild(iElement);
diff --git a/third_party/blink/renderer/core/editing/commands/replace_selection_command_test.cc b/third_party/blink/renderer/core/editing/commands/replace_selection_command_test.cc index 0f6244a..aaf00dd 100644 --- a/third_party/blink/renderer/core/editing/commands/replace_selection_command_test.cc +++ b/third_party/blink/renderer/core/editing/commands/replace_selection_command_test.cc
@@ -53,8 +53,7 @@ GetDocument(), fragment, options); EXPECT_TRUE(command->Apply()) << "the replace command should have succeeded"; - EXPECT_EQ("foo", GetDocument().body()->InnerHTMLAsString()) - << "no DOM tree mutation"; + EXPECT_EQ("foo", GetDocument().body()->innerHTML()) << "no DOM tree mutation"; } // This is a regression test for https://crbug.com/668808 @@ -79,7 +78,7 @@ GetDocument(), fragment, options); EXPECT_TRUE(command->Apply()) << "the replace command should have succeeded"; - EXPECT_EQ("<b>t</b>bar<b>ext</b>", GetDocument().body()->InnerHTMLAsString()) + EXPECT_EQ("<b>t</b>bar<b>ext</b>", GetDocument().body()->innerHTML()) << "'bar' should have been inserted"; }
diff --git a/third_party/blink/renderer/core/editing/editing_utilities_test.cc b/third_party/blink/renderer/core/editing/editing_utilities_test.cc index de55c5b..3c3a5ea 100644 --- a/third_party/blink/renderer/core/editing/editing_utilities_test.cc +++ b/third_party/blink/renderer/core/editing/editing_utilities_test.cc
@@ -127,7 +127,7 @@ // element. So, we build DOM tree manually. // Note: This is unusual HTML taken from http://crbug.com/574230 Element* table = GetDocument().CreateRawElement(html_names::kTableTag); - table->SetInnerHTMLFromString("<caption>foo</caption>"); + table->setInnerHTML("<caption>foo</caption>"); while (GetDocument().firstChild()) GetDocument().firstChild()->remove(); GetDocument().AppendChild(table);
diff --git a/third_party/blink/renderer/core/editing/finder/text_finder_test.cc b/third_party/blink/renderer/core/editing/finder/text_finder_test.cc index dea7959..2e0035d 100644 --- a/third_party/blink/renderer/core/editing/finder/text_finder_test.cc +++ b/third_party/blink/renderer/core/editing/finder/text_finder_test.cc
@@ -75,7 +75,7 @@ } TEST_F(TextFinderTest, FindTextSimple) { - GetDocument().body()->SetInnerHTMLFromString("XXXXFindMeYYYYfindmeZZZZ"); + GetDocument().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); Node* text_node = GetDocument().body()->firstChild(); @@ -150,7 +150,7 @@ } TEST_F(TextFinderTest, FindTextAutosizing) { - GetDocument().body()->SetInnerHTMLFromString("XXXXFindMeYYYYfindmeZZZZ"); + GetDocument().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); int identifier = 0; @@ -191,7 +191,7 @@ } TEST_F(TextFinderTest, FindTextNotFound) { - GetDocument().body()->SetInnerHTMLFromString("XXXXFindMeYYYYfindmeZZZZ"); + GetDocument().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); int identifier = 0; @@ -206,10 +206,10 @@ } TEST_F(TextFinderTest, FindTextInShadowDOM) { - GetDocument().body()->SetInnerHTMLFromString("<b>FOO</b><i>foo</i>"); + GetDocument().body()->setInnerHTML("<b>FOO</b><i>foo</i>"); ShadowRoot& shadow_root = GetDocument().body()->CreateV0ShadowRootForTesting(); - shadow_root.SetInnerHTMLFromString( + shadow_root.setInnerHTML( "<content select=\"i\"></content><u>Foo</u><content></content>"); Node* text_in_b_element = GetDocument().body()->firstChild()->firstChild(); Node* text_in_i_element = GetDocument().body()->lastChild()->firstChild(); @@ -308,7 +308,7 @@ } TEST_F(TextFinderTest, ScopeTextMatchesSimple) { - GetDocument().body()->SetInnerHTMLFromString("XXXXFindMeYYYYfindmeZZZZ"); + GetDocument().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); Node* text_node = GetDocument().body()->firstChild(); @@ -341,7 +341,7 @@ } TEST_F(TextFinderTest, ScopeTextMatchesRepeated) { - GetDocument().body()->SetInnerHTMLFromString("XXXXFindMeYYYYfindmeZZZZ"); + GetDocument().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); Node* text_node = GetDocument().body()->firstChild(); @@ -368,10 +368,10 @@ } TEST_F(TextFinderTest, ScopeTextMatchesWithShadowDOM) { - GetDocument().body()->SetInnerHTMLFromString("<b>FOO</b><i>foo</i>"); + GetDocument().body()->setInnerHTML("<b>FOO</b><i>foo</i>"); ShadowRoot& shadow_root = GetDocument().body()->CreateV0ShadowRootForTesting(); - shadow_root.SetInnerHTMLFromString( + shadow_root.setInnerHTML( "<content select=\"i\"></content><u>Foo</u><content></content>"); Node* text_in_b_element = GetDocument().body()->firstChild()->firstChild(); Node* text_in_i_element = GetDocument().body()->lastChild()->firstChild(); @@ -403,7 +403,7 @@ } TEST_F(TextFinderTest, ScopeRepeatPatternTextMatches) { - GetDocument().body()->SetInnerHTMLFromString("ab ab ab ab ab"); + GetDocument().body()->setInnerHTML("ab ab ab ab ab"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); Node* text_node = GetDocument().body()->firstChild(); @@ -426,7 +426,7 @@ } TEST_F(TextFinderTest, OverlappingMatches) { - GetDocument().body()->SetInnerHTMLFromString("aababaa"); + GetDocument().body()->setInnerHTML("aababaa"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); Node* text_node = GetDocument().body()->firstChild(); @@ -449,7 +449,7 @@ } TEST_F(TextFinderTest, SequentialMatches) { - GetDocument().body()->SetInnerHTMLFromString("ababab"); + GetDocument().body()->setInnerHTML("ababab"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); Node* text_node = GetDocument().body()->firstChild(); @@ -473,7 +473,7 @@ } TEST_F(TextFinderTest, FindTextJavaScriptUpdatesDOM) { - GetDocument().body()->SetInnerHTMLFromString("<b>XXXXFindMeYYYY</b><i></i>"); + GetDocument().body()->setInnerHTML("<b>XXXXFindMeYYYY</b><i></i>"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); int identifier = 0; @@ -499,7 +499,7 @@ // Add new text to DOM and try FindNext. auto* i_element = To<Element>(GetDocument().body()->lastChild()); ASSERT_TRUE(i_element); - i_element->SetInnerHTMLFromString("ZZFindMe"); + i_element->setInnerHTML("ZZFindMe"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, @@ -530,7 +530,7 @@ } TEST_F(TextFinderTest, FindTextJavaScriptUpdatesDOMAfterNoMatches) { - GetDocument().body()->SetInnerHTMLFromString("<b>XXXXYYYY</b><i></i>"); + GetDocument().body()->setInnerHTML("<b>XXXXYYYY</b><i></i>"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); int identifier = 0; @@ -553,7 +553,7 @@ // Add new text to DOM and try FindNext. auto* i_element = To<Element>(GetDocument().body()->lastChild()); ASSERT_TRUE(i_element); - i_element->SetInnerHTMLFromString("ZZFindMe"); + i_element->setInnerHTML("ZZFindMe"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, @@ -593,7 +593,7 @@ } } - GetDocument().body()->SetInnerHTMLFromString(text.ToString()); + GetDocument().body()->setInnerHTML(text.ToString()); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); int identifier = 0;
diff --git a/third_party/blink/renderer/core/editing/frame_caret_test.cc b/third_party/blink/renderer/core/editing/frame_caret_test.cc index 1081d4c..7f721727 100644 --- a/third_party/blink/renderer/core/editing/frame_caret_test.cc +++ b/third_party/blink/renderer/core/editing/frame_caret_test.cc
@@ -47,7 +47,7 @@ base::TimeDelta::FromSecondsD(kInterval)); GetDocument().GetPage()->GetFocusController().SetActive(true); GetDocument().GetPage()->GetFocusController().SetFocused(true); - GetDocument().body()->SetInnerHTMLFromString("<textarea>"); + GetDocument().body()->setInnerHTML("<textarea>"); auto* editor = To<Element>(GetDocument().body()->firstChild()); editor->focus(); UpdateAllLifecyclePhasesForTest(); @@ -81,7 +81,7 @@ FrameCaret& caret = Selection().FrameCaretForTesting(); GetDocument().GetPage()->GetFocusController().SetActive(true); GetDocument().GetPage()->GetFocusController().SetFocused(true); - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<div id='outer' tabindex='-1'>" "<div id='input' contenteditable>foo</div>" "</div>");
diff --git a/third_party/blink/renderer/core/editing/granularity_strategy_test.cc b/third_party/blink/renderer/core/editing/granularity_strategy_test.cc index 6a639e1..659e29b 100644 --- a/third_party/blink/renderer/core/editing/granularity_strategy_test.cc +++ b/third_party/blink/renderer/core/editing/granularity_strategy_test.cc
@@ -91,8 +91,7 @@ } void GranularityStrategyTest::SetInnerHTML(const char* html_content) { - GetDocument().documentElement()->SetInnerHTMLFromString( - String::FromUTF8(html_content)); + GetDocument().documentElement()->setInnerHTML(String::FromUTF8(html_content)); UpdateAllLifecyclePhasesForTest(); } @@ -699,13 +698,13 @@ TEST_F(GranularityStrategyTest, UpdateExtentWithNullPositionForCharacter) { GetDummyPageHolder().GetFrame().GetSettings()->SetSelectionStrategy( SelectionStrategy::kCharacter); - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<div id=host></div><div id=sample>ab</div>"); // Simulate VIDEO element which has a RANGE as slider of video time. Element* const host = GetDocument().getElementById("host"); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString("<input type=range>"); + shadow_root.setInnerHTML("<input type=range>"); Element* const sample = GetDocument().getElementById("sample"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); const SelectionInDOMTree& selection_in_dom_tree = @@ -737,13 +736,13 @@ // For http://crbug.com/704529 TEST_F(GranularityStrategyTest, UpdateExtentWithNullPositionForDirectional) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<div id=host></div><div id=sample>ab</div>"); // Simulate VIDEO element which has a RANGE as slider of video time. Element* const host = GetDocument().getElementById("host"); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString("<input type=range>"); + shadow_root.setInnerHTML("<input type=range>"); Element* const sample = GetDocument().getElementById("sample"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); const SelectionInDOMTree& selection_in_dom_tree =
diff --git a/third_party/blink/renderer/core/editing/ime/input_method_controller_test.cc b/third_party/blink/renderer/core/editing/ime/input_method_controller_test.cc index 9acf1c3..d7f61e65 100644 --- a/third_party/blink/renderer/core/editing/ime/input_method_controller_test.cc +++ b/third_party/blink/renderer/core/editing/ime/input_method_controller_test.cc
@@ -58,7 +58,7 @@ Element* editable = InsertHTMLElement("<div id='sample' contenteditable></div>", "sample"); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('beforeinput', " " event => document.title = `beforeinput.data:${event.data};`);" "document.getElementById('sample').addEventListener('input', " @@ -79,14 +79,14 @@ switch (type) { case kNoSelection: - script->SetInnerHTMLFromString( + script->setInnerHTML( // If the caret position is set before firing 'compositonend' event // (and it should), the final caret position will be reset to null. "document.getElementById('sample').addEventListener('compositionend'," " event => getSelection().removeAllRanges());"); break; case kCaretSelection: - script->SetInnerHTMLFromString( + script->setInnerHTML( // If the caret position is set before firing 'compositonend' event // (and it should), the final caret position will be reset to [3,3]. "document.getElementById('sample').addEventListener('compositionend'," @@ -96,7 +96,7 @@ "});"); break; case kRangeSelection: - script->SetInnerHTMLFromString( + script->setInnerHTML( // If the caret position is set before firing 'compositonend' event // (and it should), the final caret position will be reset to [2,4]. "document.getElementById('sample').addEventListener('compositionend'," @@ -289,22 +289,19 @@ // Subtract a character. Controller().SetComposition(String("12345789"), ime_text_spans, 8, 8); - EXPECT_EQ("abc1<b>2</b>3457<b>8</b>9d<b>e</b>f", - div->InnerHTMLAsString().Utf8()); + EXPECT_EQ("abc1<b>2</b>3457<b>8</b>9d<b>e</b>f", div->innerHTML().Utf8()); EXPECT_EQ(11u, Controller().GetSelectionOffsets().Start()); EXPECT_EQ(11u, Controller().GetSelectionOffsets().End()); // Append a character. Controller().SetComposition(String("123456789"), ime_text_spans, 9, 9); - EXPECT_EQ("abc1<b>2</b>34567<b>8</b>9d<b>e</b>f", - div->InnerHTMLAsString().Utf8()); + EXPECT_EQ("abc1<b>2</b>34567<b>8</b>9d<b>e</b>f", div->innerHTML().Utf8()); EXPECT_EQ(12u, Controller().GetSelectionOffsets().Start()); EXPECT_EQ(12u, Controller().GetSelectionOffsets().End()); // Subtract and append characters. Controller().SetComposition(String("123hello789"), ime_text_spans, 11, 11); - EXPECT_EQ("abc1<b>2</b>3hello7<b>8</b>9d<b>e</b>f", - div->InnerHTMLAsString().Utf8()); + EXPECT_EQ("abc1<b>2</b>3hello7<b>8</b>9d<b>e</b>f", div->innerHTML().Utf8()); } TEST_F(InputMethodControllerTest, SetCompositionWithEmojiKeepingStyle) { @@ -323,11 +320,11 @@ // surrogate pair to the previous one. Controller().SetComposition(String::FromUTF8("\xF0\x9F\x8F\xAB"), ime_text_spans, 2, 2); - EXPECT_EQ("<b>\xF0\x9F\x8F\xAB</b>", div->InnerHTMLAsString().Utf8()); + EXPECT_EQ("<b>\xF0\x9F\x8F\xAB</b>", div->innerHTML().Utf8()); Controller().SetComposition(String::FromUTF8("\xF0\x9F\x8F\xA0"), ime_text_spans, 2, 2); - EXPECT_EQ("<b>\xF0\x9F\x8F\xA0</b>", div->InnerHTMLAsString().Utf8()); + EXPECT_EQ("<b>\xF0\x9F\x8F\xA0</b>", div->innerHTML().Utf8()); } TEST_F(InputMethodControllerTest, @@ -348,11 +345,11 @@ // 1 grapheme cluster. Controller().SetComposition(String::FromUTF8("\xE0\xB0\x83\xE0\xB0\x83"), ime_text_spans, 2, 2); - EXPECT_EQ("<b>\xE0\xB0\x83\xE0\xB0\x83</b>", div->InnerHTMLAsString().Utf8()); + EXPECT_EQ("<b>\xE0\xB0\x83\xE0\xB0\x83</b>", div->innerHTML().Utf8()); Controller().SetComposition(String::FromUTF8("\xE0\xB0\x83"), ime_text_spans, 1, 1); - EXPECT_EQ("<b>\xE0\xB0\x83</b>", div->InnerHTMLAsString().Utf8()); + EXPECT_EQ("<b>\xE0\xB0\x83</b>", div->innerHTML().Utf8()); } TEST_F(InputMethodControllerTest, FinishComposingTextKeepingStyle) { @@ -368,10 +365,10 @@ Controller().SetCompositionFromExistingText(ime_text_spans, 3, 12); Controller().SetComposition(String("123hello789"), ime_text_spans, 11, 11); - EXPECT_EQ("abc1<b>2</b>3hello7<b>8</b>9", div->InnerHTMLAsString()); + EXPECT_EQ("abc1<b>2</b>3hello7<b>8</b>9", div->innerHTML()); Controller().FinishComposingText(InputMethodController::kKeepSelection); - EXPECT_EQ("abc1<b>2</b>3hello7<b>8</b>9", div->InnerHTMLAsString()); + EXPECT_EQ("abc1<b>2</b>3hello7<b>8</b>9", div->innerHTML()); } TEST_F(InputMethodControllerTest, CommitTextKeepingStyle) { @@ -387,7 +384,7 @@ Controller().SetCompositionFromExistingText(ime_text_spans, 3, 12); Controller().CommitText(String("123789"), ime_text_spans, 0); - EXPECT_EQ("abc1<b>2</b>37<b>8</b>9", div->InnerHTMLAsString()); + EXPECT_EQ("abc1<b>2</b>37<b>8</b>9", div->innerHTML()); } TEST_F(InputMethodControllerTest, InsertTextWithNewLine) { @@ -399,7 +396,7 @@ ImeTextSpanThickness::kThin, ImeTextSpanUnderlineStyle::kSolid, 0, 0)); Controller().CommitText(String("hello\nworld"), ime_text_spans, 0); - EXPECT_EQ("hello<div>world</div>", div->InnerHTMLAsString()); + EXPECT_EQ("hello<div>world</div>", div->innerHTML()); } TEST_F(InputMethodControllerTest, InsertTextWithNewLineIncrementally) { @@ -409,10 +406,10 @@ Vector<ImeTextSpan> ime_text_spans; Controller().CommitText("a", ime_text_spans, 0); Controller().SetComposition("bcd", ime_text_spans, 0, 2); - EXPECT_EQ("abcd", div->InnerHTMLAsString()); + EXPECT_EQ("abcd", div->innerHTML()); Controller().CommitText(String("bcd\nefgh\nijkl"), ime_text_spans, 0); - EXPECT_EQ("abcd<div>efgh</div><div>ijkl</div>", div->InnerHTMLAsString()); + EXPECT_EQ("abcd<div>efgh</div><div>ijkl</div>", div->innerHTML()); } TEST_F(InputMethodControllerTest, SelectionOnConfirmExistingText) { @@ -1190,7 +1187,7 @@ Element* editable = InsertHTMLElement("<div id='sample' contenteditable></div>", "sample"); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('beforeinput', " " event => document.title = " " `beforeinput.isComposing:${event.isComposing};`);" @@ -1364,7 +1361,7 @@ EXPECT_EQ(kWebTextInputTypeText, Controller().TextInputType()); // Remove element 'a'. - input_a->SetOuterHTMLFromString("", ASSERT_NO_EXCEPTION); + input_a->setOuterHTML("", ASSERT_NO_EXCEPTION); EXPECT_EQ(kWebTextInputTypeNone, Controller().TextInputType()); GetDocument().getElementById("b")->focus(); @@ -1559,14 +1556,14 @@ // The space at the beginning of the string should have been converted to an // nbsp - EXPECT_EQ(" text blah", div->InnerHTMLAsString()); + EXPECT_EQ(" text blah", div->innerHTML()); // Delete "blah" Controller().SetCompositionFromExistingText(empty_ime_text_spans, 6, 10); Controller().CommitText(String(""), empty_ime_text_spans, 0); // The space at the end of the string should have been converted to an nbsp - EXPECT_EQ(" text ", div->InnerHTMLAsString()); + EXPECT_EQ(" text ", div->innerHTML()); } TEST_F(InputMethodControllerTest, CommitEmptyTextDeletesSelection) { @@ -1849,7 +1846,7 @@ Controller().SetCompositionFromExistingText(empty_ime_text_spans, 13, 25); Controller().CommitText(String("content"), empty_ime_text_spans, 0); - EXPECT_EQ("This is some content", div->InnerHTMLAsString()); + EXPECT_EQ("This is some content", div->innerHTML()); // Verify marker was removed EXPECT_EQ(0u, GetDocument().Markers().Markers().size()); @@ -1872,7 +1869,7 @@ Controller().SetCompositionFromExistingText(empty_ime_text_spans, 13, 25); Controller().CommitText(String("content"), empty_ime_text_spans, 0); - EXPECT_EQ("This is some content", div->InnerHTMLAsString()); + EXPECT_EQ("This is some content", div->innerHTML()); // Verify marker is under "some " EXPECT_EQ(1u, GetDocument().Markers().Markers().size()); @@ -2590,7 +2587,7 @@ GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('input', " " event => {" " const node = event.currentTarget;" @@ -2625,7 +2622,7 @@ GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('input', " " event => {" " const node = event.currentTarget;" @@ -2663,7 +2660,7 @@ GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('input', " " event => {" " const node = event.currentTarget;" @@ -2696,7 +2693,7 @@ GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('input', " " event => {" " const node = event.currentTarget;" @@ -2730,7 +2727,7 @@ GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('input', " " event => {" " const node = event.currentTarget;" @@ -2764,7 +2761,7 @@ GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('input', " " event => {" " const node = event.currentTarget;" @@ -2797,7 +2794,7 @@ GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('input', " " event => {" " const node = event.currentTarget;" @@ -2834,7 +2831,7 @@ GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('compositionend', " " event => {" " const node = event.currentTarget;" @@ -2870,7 +2867,7 @@ GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('compositionend', " " event => {" " const node = event.currentTarget;" @@ -2904,7 +2901,7 @@ GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('compositionend', " " event => {" " const node = event.currentTarget;" @@ -2937,7 +2934,7 @@ GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('compositionend', " " event => {" " const node = event.currentTarget;" @@ -2969,7 +2966,7 @@ GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('compositionend', " " event => {" " const node = event.currentTarget;" @@ -3001,7 +2998,7 @@ GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('input', " " event => {" " const node = event.currentTarget;" @@ -3031,7 +3028,7 @@ GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('input', " " event => {" " const node = event.currentTarget;" @@ -3061,7 +3058,7 @@ GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('compositionend', " " event => {" " const node = event.currentTarget;" @@ -3093,7 +3090,7 @@ GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.getElementById('sample').addEventListener('compositionend', " " event => {" " const node = event.currentTarget;" @@ -3231,7 +3228,7 @@ Vector<ImeTextSpan>(), 10, 10); // "world" should be bold. - EXPECT_EQ("hello<b>world</b>", div->InnerHTMLAsString()); + EXPECT_EQ("hello<b>world</b>", div->innerHTML()); } TEST_F(InputMethodControllerTest, SetCompositionAfterNonEditableElement) { @@ -3289,16 +3286,14 @@ Vector<ImeTextSpan>(), 0, 0); EXPECT_EQ(1u, div->CountChildren()); - EXPECT_EQ(String::FromUTF8("\xE2\x80\x8C\xE1\x80\xB1"), - div->InnerHTMLAsString()); + EXPECT_EQ(String::FromUTF8("\xE2\x80\x8C\xE1\x80\xB1"), div->innerHTML()); Range* range = GetCompositionRange(); EXPECT_EQ(0u, range->startOffset()); EXPECT_EQ(2u, range->endOffset()); Controller().CommitText(String::FromUTF8("\xE2\x80\x8C\xE1\x80\xB1"), Vector<ImeTextSpan>(), 1); - EXPECT_EQ(String::FromUTF8("\xE2\x80\x8C\xE1\x80\xB1"), - div->InnerHTMLAsString()); + EXPECT_EQ(String::FromUTF8("\xE2\x80\x8C\xE1\x80\xB1"), div->innerHTML()); // Add character U+200C: 'kZeroWidthNonJoinerCharacter' and Myanmar vowel Controller().SetComposition(String::FromUTF8("\xE2\x80\x8C\xE1\x80\xB1"), @@ -3307,7 +3302,7 @@ Vector<ImeTextSpan>(), 1); EXPECT_EQ( String::FromUTF8("\xE2\x80\x8C\xE1\x80\xB1\xE2\x80\x8C\xE1\x80\xB1"), - div->InnerHTMLAsString()); + div->innerHTML()); } } // namespace blink
diff --git a/third_party/blink/renderer/core/editing/iterators/text_iterator_test.cc b/third_party/blink/renderer/core/editing/iterators/text_iterator_test.cc index 192bd77..681b21c 100644 --- a/third_party/blink/renderer/core/editing/iterators/text_iterator_test.cc +++ b/third_party/blink/renderer/core/editing/iterators/text_iterator_test.cc
@@ -978,7 +978,7 @@ Element& host = *GetDocument().getElementById("host"); ShadowRoot& shadow_root = host.AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString("A<slot name=c></slot>"); + shadow_root.setInnerHTML("A<slot name=c></slot>"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); Element& body = *GetDocument().body(); Node& text_a = *shadow_root.firstChild();
diff --git a/third_party/blink/renderer/core/editing/selection_adjuster_test.cc b/third_party/blink/renderer/core/editing/selection_adjuster_test.cc index 34765590..447cc6a8 100644 --- a/third_party/blink/renderer/core/editing/selection_adjuster_test.cc +++ b/third_party/blink/renderer/core/editing/selection_adjuster_test.cc
@@ -246,7 +246,7 @@ Element* host = GetDocument().getElementById("host"); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString(shadow_content); + shadow_root.setInnerHTML(shadow_content); Element* foo = GetDocument().getElementById("foo"); Element* s1 = shadow_root.QuerySelector("#s1"); @@ -312,7 +312,7 @@ Element* host = GetDocument().getElementById("host"); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString(shadow_content); + shadow_root.setInnerHTML(shadow_content); Element* foo = GetDocument().getElementById("foo"); Element* bar = GetDocument().getElementById("bar");
diff --git a/third_party/blink/renderer/core/editing/selection_controller_test.cc b/third_party/blink/renderer/core/editing/selection_controller_test.cc index 8ad90dc4..39db548a 100644 --- a/third_party/blink/renderer/core/editing/selection_controller_test.cc +++ b/third_party/blink/renderer/core/editing/selection_controller_test.cc
@@ -161,7 +161,7 @@ SetBodyContent(body_content); GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "var sample = document.getElementById('sample');" "sample.addEventListener('onselectstart', " " event => elem.parentNode.removeChild(elem));"); @@ -195,7 +195,7 @@ SetCaretAtHitTestResultWithDisconnectedPosition) { GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.designMode = 'on';" "const selection = window.getSelection();" "const html = document.getElementsByTagName('html')[0];"
diff --git a/third_party/blink/renderer/core/editing/surrounding_text_test.cc b/third_party/blink/renderer/core/editing/surrounding_text_test.cc index 0012ae1a..56d0ad7 100644 --- a/third_party/blink/renderer/core/editing/surrounding_text_test.cc +++ b/third_party/blink/renderer/core/editing/surrounding_text_test.cc
@@ -36,7 +36,7 @@ } void SurroundingTextTest::SetHTML(const String& content) { - GetDocument().body()->SetInnerHTMLFromString(content); + GetDocument().body()->setInnerHTML(content); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); }
diff --git a/third_party/blink/renderer/core/editing/testing/editing_test_base.cc b/third_party/blink/renderer/core/editing/testing/editing_test_base.cc index cb869e84..945ddbac 100644 --- a/third_party/blink/renderer/core/editing/testing/editing_test_base.cc +++ b/third_party/blink/renderer/core/editing/testing/editing_test_base.cc
@@ -73,8 +73,8 @@ ShadowRoot& shadow_root = scope.getElementById(AtomicString::FromUTF8(host_element_id)) ->CreateV0ShadowRootForTesting(); - shadow_root.SetInnerHTMLFromString(String::FromUTF8(shadow_root_content), - ASSERT_NO_EXCEPTION); + shadow_root.setInnerHTML(String::FromUTF8(shadow_root_content), + ASSERT_NO_EXCEPTION); scope.GetDocument().View()->UpdateAllLifecyclePhases( DocumentUpdateReason::kTest); return &shadow_root;
diff --git a/third_party/blink/renderer/core/editing/testing/selection_sample.cc b/third_party/blink/renderer/core/editing/testing/selection_sample.cc index c101b4c2..4d9fbc36 100644 --- a/third_party/blink/renderer/core/editing/testing/selection_sample.cc +++ b/third_party/blink/renderer/core/editing/testing/selection_sample.cc
@@ -60,7 +60,7 @@ // |SelectionInDOMTree| marked up within |selection_text|. SelectionInDOMTree SetSelectionText(HTMLElement* element, const std::string& selection_text) { - element->SetInnerHTMLFromString(String::FromUTF8(selection_text.c_str())); + element->setInnerHTML(String::FromUTF8(selection_text.c_str())); ConvertTemplatesToShadowRoots(*element); Traverse(element); if (anchor_node_ && focus_node_) {
diff --git a/third_party/blink/renderer/core/editing/testing/selection_sample_test.cc b/third_party/blink/renderer/core/editing/testing/selection_sample_test.cc index f266eb7..85a0d2d 100644 --- a/third_party/blink/renderer/core/editing/testing/selection_sample_test.cc +++ b/third_party/blink/renderer/core/editing/testing/selection_sample_test.cc
@@ -42,7 +42,7 @@ TEST_F(SelectionSampleTest, SetCommentInBody) { const SelectionInDOMTree& selection = SelectionSample::SetSelectionText( GetDocument().body(), "<!--^-->foo<!--|-->"); - EXPECT_EQ("foo", GetDocument().body()->InnerHTMLAsString()); + EXPECT_EQ("foo", GetDocument().body()->innerHTML()); EXPECT_EQ(SelectionInDOMTree::Builder() .Collapse(Position(GetDocument().body(), 0)) .Extend(Position(GetDocument().body(), 1)) @@ -55,7 +55,7 @@ GetDocument().body(), "<span id=sample><!--^-->foo<!--|--></span>"); const Element* const sample = GetDocument().body()->getElementById("sample"); EXPECT_EQ("<span id=\"sample\">foo</span>", - GetDocument().body()->InnerHTMLAsString()); + GetDocument().body()->innerHTML()); EXPECT_EQ(SelectionInDOMTree::Builder() .Collapse(Position(sample, 0)) .Extend(Position(sample, 1)) @@ -66,7 +66,7 @@ TEST_F(SelectionSampleTest, SetEmpty1) { const SelectionInDOMTree& selection = SelectionSample::SetSelectionText(GetDocument().body(), "|"); - EXPECT_EQ("", GetDocument().body()->InnerHTMLAsString()); + EXPECT_EQ("", GetDocument().body()->innerHTML()); EXPECT_EQ(0u, GetDocument().body()->CountChildren()); EXPECT_EQ(SelectionInDOMTree::Builder() .Collapse(Position(GetDocument().body(), 0)) @@ -77,7 +77,7 @@ TEST_F(SelectionSampleTest, SetEmpty2) { const SelectionInDOMTree& selection = SelectionSample::SetSelectionText(GetDocument().body(), "^|"); - EXPECT_EQ("", GetDocument().body()->InnerHTMLAsString()); + EXPECT_EQ("", GetDocument().body()->innerHTML()); EXPECT_EQ(0u, GetDocument().body()->CountChildren()); EXPECT_EQ(SelectionInDOMTree::Builder() .Collapse(Position(GetDocument().body(), 0)) @@ -102,7 +102,7 @@ { const auto& selection = SelectionSample::SetSelectionText(GetDocument().body(), "^ab|c"); - EXPECT_EQ("abc", GetDocument().body()->InnerHTMLAsString()); + EXPECT_EQ("abc", GetDocument().body()->innerHTML()); EXPECT_EQ(SelectionInDOMTree::Builder() .Collapse(Position(GetDocument().body()->firstChild(), 0)) .Extend(Position(GetDocument().body()->firstChild(), 2)) @@ -112,7 +112,7 @@ { const auto& selection = SelectionSample::SetSelectionText(GetDocument().body(), "a^b|c"); - EXPECT_EQ("abc", GetDocument().body()->InnerHTMLAsString()); + EXPECT_EQ("abc", GetDocument().body()->innerHTML()); EXPECT_EQ(SelectionInDOMTree::Builder() .Collapse(Position(GetDocument().body()->firstChild(), 1)) .Extend(Position(GetDocument().body()->firstChild(), 2)) @@ -122,7 +122,7 @@ { const auto& selection = SelectionSample::SetSelectionText(GetDocument().body(), "ab^|c"); - EXPECT_EQ("abc", GetDocument().body()->InnerHTMLAsString()); + EXPECT_EQ("abc", GetDocument().body()->innerHTML()); EXPECT_EQ(SelectionInDOMTree::Builder() .Collapse(Position(GetDocument().body()->firstChild(), 2)) .Build(), @@ -131,7 +131,7 @@ { const auto& selection = SelectionSample::SetSelectionText(GetDocument().body(), "ab|c^"); - EXPECT_EQ("abc", GetDocument().body()->InnerHTMLAsString()); + EXPECT_EQ("abc", GetDocument().body()->innerHTML()); EXPECT_EQ(SelectionInDOMTree::Builder() .Collapse(Position(GetDocument().body()->firstChild(), 3)) .Extend(Position(GetDocument().body()->firstChild(), 2)) @@ -267,7 +267,7 @@ ShadowRoot* shadow_root = host->ShadowRootIfV1(); ASSERT_TRUE(shadow_root->IsShadowRoot()); EXPECT_EQ("<div>shadow_first</div><div>shadow_second</div>", - shadow_root->InnerHTMLAsString()); + shadow_root->innerHTML()); } TEST_F(SelectionSampleTest, ConvertTemplatesToShadowRootsNoTemplates) { @@ -281,7 +281,7 @@ SelectionSample::ConvertTemplatesToShadowRootsForTesring( *(To<HTMLElement>(host))); EXPECT_FALSE(host->ShadowRootIfV1()); - EXPECT_EQ("<div>first</div><div>second</div>", host->InnerHTMLAsString()); + EXPECT_EQ("<div>first</div><div>second</div>", host->innerHTML()); } TEST_F(SelectionSampleTest, ConvertTemplatesToShadowRootsMultipleTemplates) { @@ -308,10 +308,10 @@ EXPECT_TRUE(shadow_root_1->IsShadowRoot()); EXPECT_EQ("<div>shadow_first</div><div>shadow_second</div>", - shadow_root_1->InnerHTMLAsString()); + shadow_root_1->innerHTML()); EXPECT_TRUE(shadow_root_2->IsShadowRoot()); EXPECT_EQ("<div>shadow_third</div><div>shadow_forth</div>", - shadow_root_2->InnerHTMLAsString()); + shadow_root_2->innerHTML()); } TEST_F(SelectionSampleTest, TraverseShadowContent) { @@ -324,7 +324,7 @@ "</div>"; const SelectionInDOMTree& selection = SelectionSample::SetSelectionText(body, content); - EXPECT_EQ("<div id=\"host\"></div>", body->InnerHTMLAsString()); + EXPECT_EQ("<div id=\"host\"></div>", body->innerHTML()); Element* host = body->getElementById("host"); ShadowRoot* shadow_root = host->ShadowRootIfV1(); @@ -332,7 +332,7 @@ EXPECT_EQ( "<div id=\"shadow1\">shadow_first</div>" "<div id=\"shadow2\">shadow_second</div>", - shadow_root->InnerHTMLAsString()); + shadow_root->innerHTML()); EXPECT_EQ(Position(shadow_root->getElementById("shadow1")->firstChild(), 0), selection.Base()); @@ -353,7 +353,7 @@ const SelectionInDOMTree& selection = SelectionSample::SetSelectionText(body, content); EXPECT_EQ("<div id=\"host\">foo<span slot=\"slot1\">bar</span></div>", - body->InnerHTMLAsString()); + body->innerHTML()); Element* host = body->getElementById("host"); ShadowRoot* shadow_root = host->ShadowRootIfV1(); @@ -362,7 +362,7 @@ "<div id=\"shadow1\">shadow_first</div>" "<slot name=\"slot1\">slot</slot>" "<div id=\"shadow2\">shadow_second</div>", - shadow_root->InnerHTMLAsString()); + shadow_root->innerHTML()); EXPECT_EQ(Position(GetDocument().getElementById("host")->firstChild(), 0), selection.Base()); @@ -388,7 +388,7 @@ const SelectionInDOMTree& selection = SelectionSample::SetSelectionText(body, content); EXPECT_EQ("<div id=\"host1\"></div><div id=\"host2\"></div>", - body->InnerHTMLAsString()); + body->innerHTML()); Element* host1 = body->getElementById("host1"); ShadowRoot* shadow_root1 = host1->ShadowRootIfV1(); @@ -399,11 +399,11 @@ EXPECT_EQ( "<div id=\"shadow1\">shadow_first</div>" "<div id=\"shadow2\">shadow_second</div>", - shadow_root1->InnerHTMLAsString()); + shadow_root1->innerHTML()); EXPECT_EQ( "<div id=\"shadow3\">shadow_third</div>" "<div id=\"shadow4\">shadow_forth</div>", - shadow_root2->InnerHTMLAsString()); + shadow_root2->innerHTML()); EXPECT_EQ(Position(shadow_root1->getElementById("shadow1")->firstChild(), 0), selection.Base());
diff --git a/third_party/blink/renderer/core/exported/web_element.cc b/third_party/blink/renderer/core/exported/web_element.cc index 7f553330..89dde07 100644 --- a/third_party/blink/renderer/core/exported/web_element.cc +++ b/third_party/blink/renderer/core/exported/web_element.cc
@@ -125,7 +125,7 @@ } WebString WebElement::InnerHTML() const { - return ConstUnwrap<Element>()->InnerHTMLAsString(); + return ConstUnwrap<Element>()->innerHTML(); } bool WebElement::IsAutonomousCustomElement() const {
diff --git a/third_party/blink/renderer/core/exported/web_element_test.cc b/third_party/blink/renderer/core/exported/web_element_test.cc index 1a24794..afb7af9 100644 --- a/third_party/blink/renderer/core/exported/web_element_test.cc +++ b/third_party/blink/renderer/core/exported/web_element_test.cc
@@ -24,7 +24,7 @@ }; void WebElementTest::InsertHTML(String html) { - GetDocument().documentElement()->SetInnerHTMLFromString(html); + GetDocument().documentElement()->setInnerHTML(html); } WebElement WebElementTest::TestElement() {
diff --git a/third_party/blink/renderer/core/exported/web_frame_serializer_sanitization_test.cc b/third_party/blink/renderer/core/exported/web_frame_serializer_sanitization_test.cc index 8d1f8b2..7417837 100644 --- a/third_party/blink/renderer/core/exported/web_frame_serializer_sanitization_test.cc +++ b/third_party/blink/renderer/core/exported/web_frame_serializer_sanitization_test.cc
@@ -109,8 +109,8 @@ &host_element->AttachShadowRootInternal(shadow_type, delegates_focus); } shadow_root->SetDelegatesFocus(delegates_focus); - shadow_root->SetInnerHTMLFromString(String::FromUTF8(shadow_content), - ASSERT_NO_EXCEPTION); + shadow_root->setInnerHTML(String::FromUTF8(shadow_content), + ASSERT_NO_EXCEPTION); scope.GetDocument().View()->UpdateAllLifecyclePhases( DocumentUpdateReason::kTest); return shadow_root;
diff --git a/third_party/blink/renderer/core/exported/web_frame_test.cc b/third_party/blink/renderer/core/exported/web_frame_test.cc index cbd98e0c..fabf89a 100644 --- a/third_party/blink/renderer/core/exported/web_frame_test.cc +++ b/third_party/blink/renderer/core/exported/web_frame_test.cc
@@ -346,7 +346,7 @@ // Both sets the inner html and runs the document lifecycle. void InitializeWithHTML(LocalFrame& frame, const String& html_content) { - frame.GetDocument()->body()->SetInnerHTMLFromString(html_content); + frame.GetDocument()->body()->setInnerHTML(html_content); frame.GetDocument()->View()->UpdateAllLifecyclePhases( DocumentUpdateReason::kTest); } @@ -13146,7 +13146,7 @@ LocalFrame* frame = web_view->MainFrameImpl()->GetFrame(); // An event should be sent when a favicon url exists. - frame->GetDocument()->documentElement()->SetInnerHTMLFromString( + frame->GetDocument()->documentElement()->setInnerHTML( "<html>" "<head>" "<link rel='icon' href='http://www.google.com/favicon.ico'>" @@ -13160,7 +13160,7 @@ // An event should not be sent if no favicon url exists. This is an assumption // made by some of Chrome's favicon handling. - frame->GetDocument()->documentElement()->SetInnerHTMLFromString( + frame->GetDocument()->documentElement()->setInnerHTML( "<html>" "<head>" "</head>"
diff --git a/third_party/blink/renderer/core/exported/web_node_test.cc b/third_party/blink/renderer/core/exported/web_node_test.cc index a839796..b3e2b4c 100644 --- a/third_party/blink/renderer/core/exported/web_node_test.cc +++ b/third_party/blink/renderer/core/exported/web_node_test.cc
@@ -21,7 +21,7 @@ class WebNodeTest : public PageTestBase { protected: void SetInnerHTML(const String& html) { - GetDocument().documentElement()->SetInnerHTMLFromString(html); + GetDocument().documentElement()->setInnerHTML(html); } WebNode Root() { return WebNode(GetDocument().documentElement()); }
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h index ee8c32e..1798e6bc 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h
@@ -180,7 +180,6 @@ void UpdatePreferredSize() override; void EnablePreferredSizeChangedMode() override; void SetDisplayMode(blink::mojom::DisplayMode) override; - void ZoomToFindInPageRect(const WebRect&) override; void SetDeviceScaleFactor(float) override; void SetZoomFactorForDeviceScaleFactor(float) override; float ZoomFactorForDeviceScaleFactor() override { @@ -330,6 +329,9 @@ // a plugin can update its own zoom, say because of its own UI. void FullFramePluginZoomLevelChanged(double zoom_level); + // Requests a page-scale animation based on the specified rect. + void ZoomToFindInPageRect(const WebRect&); + void ComputeScaleAndScrollForBlockRect( const gfx::Point& hit_point, const WebRect& block_rect,
diff --git a/third_party/blink/renderer/core/frame/find_in_page_test.cc b/third_party/blink/renderer/core/frame/find_in_page_test.cc index 4aa2cad..0529e32f 100644 --- a/third_party/blink/renderer/core/frame/find_in_page_test.cc +++ b/third_party/blink/renderer/core/frame/find_in_page_test.cc
@@ -76,7 +76,7 @@ }; TEST_F(FindInPageTest, FindMatchRectsReturnsCorrectRects) { - GetDocument().body()->SetInnerHTMLFromString("aAaAbBaBbAaAaA"); + GetDocument().body()->setInnerHTML("aAaAbBaBbAaAaA"); GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest); int identifier = 0;
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc index f275e897..8bba7e3 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -2104,6 +2104,11 @@ GetPage()->GetChromeClient().EnablePreferredSizeChangedMode(); } +void LocalFrame::ZoomToFindInPageRect(const gfx::Rect& rect_in_root_frame) { + GetPage()->GetChromeClient().ZoomToFindInPageRect( + WebRect(rect_in_root_frame)); +} + HitTestResult LocalFrame::HitTestResultForVisualViewportPos( const IntPoint& pos_in_viewport) { IntPoint root_frame_point(
diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h index 4a896f0f..f20bd9e 100644 --- a/third_party/blink/renderer/core/frame/local_frame.h +++ b/third_party/blink/renderer/core/frame/local_frame.h
@@ -538,6 +538,7 @@ mojom::blink::PluginActionType action) override; void SetInitialFocus(bool reverse) override; void EnablePreferredSizeChangedMode() override; + void ZoomToFindInPageRect(const gfx::Rect& rect_in_root_frame) override; SystemClipboard* GetSystemClipboard(); RawSystemClipboard* GetRawSystemClipboard();
diff --git a/third_party/blink/renderer/core/frame/use_counter_helper_test.cc b/third_party/blink/renderer/core/frame/use_counter_helper_test.cc index 08c1040..b7e1b3ff 100644 --- a/third_party/blink/renderer/core/frame/use_counter_helper_test.cc +++ b/third_party/blink/renderer/core/frame/use_counter_helper_test.cc
@@ -119,7 +119,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kCSSSelectorPseudoWhere; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<style>.a+:where(.b, .c+.d) { color: red; }</style>"); EXPECT_TRUE(document.IsUseCounted(feature)); EXPECT_FALSE(document.IsUseCounted(WebFeature::kCSSSelectorPseudoIs)); @@ -142,7 +142,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kCSSSelectorPseudoAnyLink; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<style>:any-link { color: red; }</style>"); EXPECT_TRUE(document.IsUseCounted(feature)); } @@ -153,7 +153,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kCSSSelectorPseudoWebkitAnyLink; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<style>:-webkit-any-link { color: red; }</style>"); EXPECT_TRUE(document.IsUseCounted(feature)); } @@ -172,7 +172,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kCSSSelectorPseudoIs; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<style>.a+:is(.b, .c+.d) { color: red; }</style>"); EXPECT_TRUE(document.IsUseCounted(feature)); EXPECT_FALSE(document.IsUseCounted(WebFeature::kCSSSelectorPseudoWhere)); @@ -184,7 +184,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kCSSContainLayoutPositionedDescendants; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<div style='contain: layout;'>" "</div>"); UpdateAllLifecyclePhases(document); @@ -197,7 +197,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kCSSContainLayoutPositionedDescendants; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<div style='contain: layout;'>" " <div style='position: absolute;'></div>" "</div>"); @@ -212,7 +212,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kCSSContainLayoutPositionedDescendants; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<div style='position: relative; contain: layout;'>" " <div style='position: absolute;'></div>" "</div>"); @@ -226,7 +226,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kCSSContainLayoutPositionedDescendants; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<div style='contain: layout;'>" " <div style='position: fixed;'></div>" "</div>"); @@ -241,7 +241,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kCSSContainLayoutPositionedDescendants; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<div style='transform: translateX(100px); contain: layout;'>" " <div style='position: fixed;'></div>" "</div>"); @@ -255,7 +255,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kGridRowTrackPercentIndefiniteHeight; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<div style='display: inline-grid; grid-template-columns: 50%;'>" "</div>"); UpdateAllLifecyclePhases(document); @@ -268,7 +268,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kGridRowTrackPercentIndefiniteHeight; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<div style='display: inline-grid; grid-template-rows: 50%;'>" "</div>"); UpdateAllLifecyclePhases(document); @@ -281,7 +281,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kCSSFlexibleBox; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<div style='display: flex;'>flexbox</div>"); UpdateAllLifecyclePhases(document); EXPECT_TRUE(document.IsUseCounted(feature)); @@ -293,7 +293,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kCSSFlexibleBox; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString( + document.documentElement()->setInnerHTML( "<div style='display: inline-flex;'>flexbox</div>"); UpdateAllLifecyclePhases(document); EXPECT_TRUE(document.IsUseCounted(feature)); @@ -307,7 +307,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kCSSFlexibleBox; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString("<button>button</button>"); + document.documentElement()->setInnerHTML("<button>button</button>"); UpdateAllLifecyclePhases(document); EXPECT_FALSE(document.IsUseCounted(feature)); } @@ -369,7 +369,7 @@ WebFeature feature = WebFeature::kCSSUnknownNamespacePrefixInSelector; EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString(R"HTML( + document.documentElement()->setInnerHTML(R"HTML( <style> @namespace svg url(http://www.w3.org/2000/svg); svg|a {} @@ -379,7 +379,7 @@ UpdateAllLifecyclePhases(document); EXPECT_FALSE(document.IsUseCounted(feature)); - document.documentElement()->SetInnerHTMLFromString("<style>foo|a {}</style>"); + document.documentElement()->setInnerHTML("<style>foo|a {}</style>"); UpdateAllLifecyclePhases(document); EXPECT_TRUE(document.IsUseCounted(feature)); } @@ -390,7 +390,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kCSSSelectorHostContextInLiveProfile; - document.body()->SetInnerHTMLFromString(R"HTML( + document.body()->setInnerHTML(R"HTML( <div id="parent"> <div id="host"></div> </div> @@ -403,7 +403,7 @@ UpdateAllLifecyclePhases(document); EXPECT_FALSE(document.IsUseCounted(feature)); - shadow_root.SetInnerHTMLFromString(R"HTML( + shadow_root.setInnerHTML(R"HTML( <style> :host-context(#parent) span { color: green @@ -422,7 +422,7 @@ Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kCSSSelectorHostContextInSnapshotProfile; - document.body()->SetInnerHTMLFromString(R"HTML( + document.body()->setInnerHTML(R"HTML( <div id="parent"> <div id="host"></div> </div> @@ -435,7 +435,7 @@ UpdateAllLifecyclePhases(document); EXPECT_FALSE(document.IsUseCounted(feature)); - shadow_root.SetInnerHTMLFromString("<span></span>"); + shadow_root.setInnerHTML("<span></span>"); UpdateAllLifecyclePhases(document); EXPECT_FALSE(document.IsUseCounted(feature));
diff --git a/third_party/blink/renderer/core/frame/visual_viewport_test.cc b/third_party/blink/renderer/core/frame/visual_viewport_test.cc index c4a2319..5b75657 100644 --- a/third_party/blink/renderer/core/frame/visual_viewport_test.cc +++ b/third_party/blink/renderer/core/frame/visual_viewport_test.cc
@@ -1998,7 +1998,7 @@ Element* output = GetFrame()->GetDocument()->getElementById("output"); DCHECK(output); - EXPECT_EQ("1600x1200", output->InnerHTMLAsString()); + EXPECT_EQ("1600x1200", output->innerHTML()); } // Similar to above but make sure the initial scale is updated with the content @@ -2013,7 +2013,7 @@ Element* output = GetFrame()->GetDocument()->getElementById("output"); DCHECK(output); - EXPECT_EQ("2000x1500", output->InnerHTMLAsString()); + EXPECT_EQ("2000x1500", output->innerHTML()); } TEST_P(VisualViewportTest, ResizeWithScrollAnchoring) {
diff --git a/third_party/blink/renderer/core/frame/window_or_worker_global_scope.cc b/third_party/blink/renderer/core/frame/window_or_worker_global_scope.cc index dcb8551..13d6a539 100644 --- a/third_party/blink/renderer/core/frame/window_or_worker_global_scope.cc +++ b/third_party/blink/renderer/core/frame/window_or_worker_global_scope.cc
@@ -34,7 +34,6 @@ #include "base/containers/span.h" #include "third_party/blink/renderer/bindings/core/v8/scheduled_action.h" -#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_script.h" #include "third_party/blink/renderer/bindings/core/v8/v8_gc_for_context_dispose.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/events/event_target.h" @@ -148,28 +147,11 @@ base::TimeDelta::FromMilliseconds(timeout), true); } -int WindowOrWorkerGlobalScope::setTimeout( - ScriptState* script_state, - EventTarget& event_target, - const StringOrTrustedScript& string_or_trusted_script, - int timeout, - const HeapVector<ScriptValue>& arguments, - ExceptionState& exception_state) { - ExecutionContext* execution_context = event_target.GetExecutionContext(); - String handler = TrustedTypesCheckForScript( - string_or_trusted_script, execution_context, exception_state); - if (exception_state.HadException()) - return 0; - return setTimeoutFromString(script_state, event_target, handler, timeout, - arguments); -} - -int WindowOrWorkerGlobalScope::setTimeoutFromString( - ScriptState* script_state, - EventTarget& event_target, - const String& handler, - int timeout, - const HeapVector<ScriptValue>&) { +int WindowOrWorkerGlobalScope::setTimeout(ScriptState* script_state, + EventTarget& event_target, + const String& handler, + int timeout, + const HeapVector<ScriptValue>&) { ExecutionContext* execution_context = event_target.GetExecutionContext(); if (!IsAllowed(execution_context, true, handler)) return 0; @@ -203,28 +185,11 @@ base::TimeDelta::FromMilliseconds(timeout), false); } -int WindowOrWorkerGlobalScope::setInterval( - ScriptState* script_state, - EventTarget& event_target, - const StringOrTrustedScript& string_or_trusted_script, - int timeout, - const HeapVector<ScriptValue>& arguments, - ExceptionState& exception_state) { - ExecutionContext* execution_context = event_target.GetExecutionContext(); - String handler = TrustedTypesCheckForScript( - string_or_trusted_script, execution_context, exception_state); - if (exception_state.HadException()) - return 0; - return setIntervalFromString(script_state, event_target, handler, timeout, - arguments); -} - -int WindowOrWorkerGlobalScope::setIntervalFromString( - ScriptState* script_state, - EventTarget& event_target, - const String& handler, - int timeout, - const HeapVector<ScriptValue>&) { +int WindowOrWorkerGlobalScope::setInterval(ScriptState* script_state, + EventTarget& event_target, + const String& handler, + int timeout, + const HeapVector<ScriptValue>&) { ExecutionContext* execution_context = event_target.GetExecutionContext(); if (!IsAllowed(execution_context, true, handler)) return 0;
diff --git a/third_party/blink/renderer/core/frame/window_or_worker_global_scope.h b/third_party/blink/renderer/core/frame/window_or_worker_global_scope.h index 571b9cd6..25dc9d9 100644 --- a/third_party/blink/renderer/core/frame/window_or_worker_global_scope.h +++ b/third_party/blink/renderer/core/frame/window_or_worker_global_scope.h
@@ -46,7 +46,6 @@ class ScriptPromise; class ScriptState; class ScriptValue; -class StringOrTrustedScript; class V8Function; typedef HTMLImageElementOrSVGImageElementOrHTMLVideoElementOrHTMLCanvasElementOrBlobOrImageDataOrImageBitmapOrOffscreenCanvas @@ -70,15 +69,9 @@ const HeapVector<ScriptValue>& arguments); static int setTimeout(ScriptState*, EventTarget&, - const StringOrTrustedScript&, + const String& handler, int timeout, - const HeapVector<ScriptValue>&, - ExceptionState&); - static int setTimeoutFromString(ScriptState*, - EventTarget&, - const String& handler, - int timeout, - const HeapVector<ScriptValue>&); + const HeapVector<ScriptValue>&); static int setInterval(ScriptState*, EventTarget&, V8Function* handler, @@ -86,15 +79,9 @@ const HeapVector<ScriptValue>&); static int setInterval(ScriptState*, EventTarget&, - const StringOrTrustedScript&, + const String& handler, int timeout, - const HeapVector<ScriptValue>&, - ExceptionState&); - static int setIntervalFromString(ScriptState*, - EventTarget&, - const String& handler, - int timeout, - const HeapVector<ScriptValue>&); + const HeapVector<ScriptValue>&); static void clearTimeout(EventTarget&, int timeout_id); static void clearInterval(EventTarget&, int timeout_id);
diff --git a/third_party/blink/renderer/core/frame/window_or_worker_global_scope.idl b/third_party/blink/renderer/core/frame/window_or_worker_global_scope.idl index a2bed30b..b2326056 100644 --- a/third_party/blink/renderer/core/frame/window_or_worker_global_scope.idl +++ b/third_party/blink/renderer/core/frame/window_or_worker_global_scope.idl
@@ -47,10 +47,10 @@ // https://html.spec.whatwg.org/C/webappapis.html#windoworworkerglobalscope-mixin [CallWith=ScriptState, RuntimeCallStatsCounter=WindowSetTimeout] long setTimeout(Function handler, optional long timeout = 0, any... arguments); - [CallWith=ScriptState, RaisesException] long setTimeout(ScriptString handler, optional long timeout = 0, any... arguments); + [CallWith=ScriptState] long setTimeout(ScriptString handler, optional long timeout = 0, any... arguments); void clearTimeout(optional long handle = 0); [CallWith=ScriptState] long setInterval(Function handler, optional long timeout = 0, any... arguments); - [CallWith=ScriptState, RaisesException] long setInterval(ScriptString handler, optional long timeout = 0, any... arguments); + [CallWith=ScriptState] long setInterval(ScriptString handler, optional long timeout = 0, any... arguments); void clearInterval(optional long handle = 0); // ImageBitmap
diff --git a/third_party/blink/renderer/core/html/canvas/canvas_font_cache_test.cc b/third_party/blink/renderer/core/html/canvas/canvas_font_cache_test.cc index 09e5055..1204701 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_font_cache_test.cc +++ b/third_party/blink/renderer/core/html/canvas/canvas_font_cache_test.cc
@@ -42,7 +42,7 @@ void CanvasFontCacheTest::SetUp() { PageTestBase::SetUp(); - GetDocument().documentElement()->SetInnerHTMLFromString( + GetDocument().documentElement()->setInnerHTML( "<body><canvas id='c'></canvas></body>"); UpdateAllLifecyclePhasesForTest(); canvas_element_ = To<HTMLCanvasElement>(GetDocument().getElementById("c"));
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_test.cc b/third_party/blink/renderer/core/html/custom/custom_element_test.cc index 6045f35..d28b73f 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_test.cc +++ b/third_party/blink/renderer/core/html/custom/custom_element_test.cc
@@ -160,7 +160,7 @@ "<font-face id=v0></font-face>"; auto page_holder = std::make_unique<DummyPageHolder>(); Document& document = page_holder->GetDocument(); - document.body()->SetInnerHTMLFromString(String::FromUTF8(body_content)); + document.body()->setInnerHTML(String::FromUTF8(body_content)); struct { const char* id;
diff --git a/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_resolution_step.cc b/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_resolution_step.cc index 5460369..22b212d 100644 --- a/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_resolution_step.cc +++ b/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_resolution_step.cc
@@ -59,7 +59,7 @@ #if !defined(NDEBUG) void V0CustomElementMicrotaskResolutionStep::Show(unsigned indent) { fprintf(stderr, "%*sResolution: ", indent, ""); - element_->OuterHTMLAsString().Show(); + element_->outerHTML().Show(); } #endif
diff --git a/third_party/blink/renderer/core/html/forms/external_date_time_chooser_test.cc b/third_party/blink/renderer/core/html/forms/external_date_time_chooser_test.cc index 6e99e81..4f70549 100644 --- a/third_party/blink/renderer/core/html/forms/external_date_time_chooser_test.cc +++ b/third_party/blink/renderer/core/html/forms/external_date_time_chooser_test.cc
@@ -79,7 +79,7 @@ TEST_F(ExternalDateTimeChooserTest, OpenDateTimeChooserShouldNotCrashWhenLabelAndValueIsTheSame) { ScopedInputMultipleFieldsUIForTest input_multiple_fields_ui(false); - GetDocument().documentElement()->SetInnerHTMLFromString(R"HTML( + GetDocument().documentElement()->setInnerHTML(R"HTML( <input id=test type="date" list="src" /> <datalist id="src"> <option value='2019-12-31'>Hint</option>
diff --git a/third_party/blink/renderer/core/html/forms/external_popup_menu_test.cc b/third_party/blink/renderer/core/html/forms/external_popup_menu_test.cc index 7fc9c1ce..a493fa8b 100644 --- a/third_party/blink/renderer/core/html/forms/external_popup_menu_test.cc +++ b/third_party/blink/renderer/core/html/forms/external_popup_menu_test.cc
@@ -35,7 +35,7 @@ PageTestBase::SetUp(); auto* element = MakeGarbageCollected<HTMLSelectElement>(GetDocument()); // Set the 4th an 5th items to have "display: none" property - element->SetInnerHTMLFromString( + element->setInnerHTML( "<option><option><option><option style='display:none;'><option " "style='display:none;'><option><option>"); GetDocument().body()->AppendChild(element, ASSERT_NO_EXCEPTION);
diff --git a/third_party/blink/renderer/core/html/forms/file_input_type_test.cc b/third_party/blink/renderer/core/html/forms/file_input_type_test.cc index 3d30730..ebbb62c 100644 --- a/third_party/blink/renderer/core/html/forms/file_input_type_test.cc +++ b/third_party/blink/renderer/core/html/forms/file_input_type_test.cc
@@ -138,7 +138,7 @@ std::make_unique<DummyPageHolder>(IntSize(), &page_clients); Document& doc = page_holder->GetDocument(); - doc.body()->SetInnerHTMLFromString("<input type=file webkitdirectory>"); + doc.body()->setInnerHTML("<input type=file webkitdirectory>"); auto& input = *To<HTMLInputElement>(doc.body()->firstChild()); base::RunLoop run_loop;
diff --git a/third_party/blink/renderer/core/html/forms/form_controller_test.cc b/third_party/blink/renderer/core/html/forms/form_controller_test.cc index b278e95..e54eefa6 100644 --- a/third_party/blink/renderer/core/html/forms/form_controller_test.cc +++ b/third_party/blink/renderer/core/html/forms/form_controller_test.cc
@@ -20,7 +20,7 @@ Element* html = doc.CreateRawElement(html_names::kHTMLTag); doc.appendChild(html); Node* body = html->appendChild(doc.CreateRawElement(html_names::kBodyTag)); - To<Element>(body)->SetInnerHTMLFromString("<select form='ff'></select>"); + To<Element>(body)->setInnerHTML("<select form='ff'></select>"); DocumentState* document_state = doc.GetFormController().ControlStates(); Vector<String> state1 = document_state->ToStateVector(); // <signature>, <control-size>, <form-key>, <name>, <type>, <data-size(0)>
diff --git a/third_party/blink/renderer/core/html/forms/html_form_control_element_test.cc b/third_party/blink/renderer/core/html/forms/html_form_control_element_test.cc index da02126..db9caa6 100644 --- a/third_party/blink/renderer/core/html/forms/html_form_control_element_test.cc +++ b/third_party/blink/renderer/core/html/forms/html_form_control_element_test.cc
@@ -133,7 +133,7 @@ // ShowValidationMessage(). So calling it during DOM mutation is // dangerous. This test ensures ShowValidationMessage() is NOT called in // appendChild(). crbug.com/756408 - GetDocument().documentElement()->SetInnerHTMLFromString("<select></select>"); + GetDocument().documentElement()->setInnerHTML("<select></select>"); auto* const select = To<HTMLFormControlElement>(GetDocument().QuerySelector("select")); auto* const optgroup =
diff --git a/third_party/blink/renderer/core/html/forms/html_input_element_test.cc b/third_party/blink/renderer/core/html/forms/html_input_element_test.cc index c86c343..baa2c17 100644 --- a/third_party/blink/renderer/core/html/forms/html_input_element_test.cc +++ b/third_party/blink/renderer/core/html/forms/html_input_element_test.cc
@@ -35,16 +35,16 @@ }; TEST_F(HTMLInputElementTest, FilteredDataListOptionsNoList) { - GetDocument().documentElement()->SetInnerHTMLFromString("<input id=test>"); + GetDocument().documentElement()->setInnerHTML("<input id=test>"); EXPECT_TRUE(TestElement().FilteredDataListOptions().IsEmpty()); - GetDocument().documentElement()->SetInnerHTMLFromString( + GetDocument().documentElement()->setInnerHTML( "<input id=test list=dl1><datalist id=dl1></datalist>"); EXPECT_TRUE(TestElement().FilteredDataListOptions().IsEmpty()); } TEST_F(HTMLInputElementTest, FilteredDataListOptionsContain) { - GetDocument().documentElement()->SetInnerHTMLFromString( + GetDocument().documentElement()->setInnerHTML( "<input id=test value=BC list=dl2>" "<datalist id=dl2>" "<option>AbC DEF</option>" @@ -56,7 +56,7 @@ EXPECT_EQ("AbC DEF", options[0]->value().Utf8()); EXPECT_EQ("ghi", options[1]->value().Utf8()); - GetDocument().documentElement()->SetInnerHTMLFromString( + GetDocument().documentElement()->setInnerHTML( "<input id=test value=i list=dl2>" "<datalist id=dl2>" "<option>I</option>" @@ -70,7 +70,7 @@ } TEST_F(HTMLInputElementTest, FilteredDataListOptionsForMultipleEmail) { - GetDocument().documentElement()->SetInnerHTMLFromString(R"HTML( + GetDocument().documentElement()->setInnerHTML(R"HTML( <input id=test value='foo@example.com, tkent' list=dl3 type=email multiple> <datalist id=dl3> @@ -104,7 +104,7 @@ // Create an input element with type "range" inside a document without frame. To<HTMLBodyElement>(html->firstChild()) - ->SetInnerHTMLFromString("<input type='range' />"); + ->setInnerHTML("<input type='range' />"); document_without_frame->AppendChild(html); auto page_holder = std::make_unique<DummyPageHolder>(); @@ -154,7 +154,7 @@ TEST_F(HTMLInputElementTest, RadioKeyDownDCHECKFailure) { // crbug.com/697286 - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<input type=radio name=g><input type=radio name=g>"); auto& radio1 = To<HTMLInputElement>(*GetDocument().body()->firstChild()); auto& radio2 = To<HTMLInputElement>(*radio1.nextSibling()); @@ -171,7 +171,7 @@ TEST_F(HTMLInputElementTest, DateTimeChooserSizeParamRespectsScale) { GetDocument().SetCompatibilityMode(Document::kQuirksMode); GetDocument().View()->GetFrame().GetPage()->GetVisualViewport().SetScale(2.f); - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<input type='date' style='width:200px;height:50px' />"); UpdateAllLifecyclePhasesForTest(); auto* input = To<HTMLInputElement>(GetDocument().body()->firstChild()); @@ -195,13 +195,13 @@ } TEST_F(HTMLInputElementTest, CheckboxHasNoShadowRoot) { - GetDocument().body()->SetInnerHTMLFromString("<input type='checkbox' />"); + GetDocument().body()->setInnerHTML("<input type='checkbox' />"); auto* input = To<HTMLInputElement>(GetDocument().body()->firstChild()); EXPECT_EQ(nullptr, input->UserAgentShadowRoot()); } TEST_F(HTMLInputElementTest, ChangingInputTypeCausesShadowRootToBeCreated) { - GetDocument().body()->SetInnerHTMLFromString("<input type='checkbox' />"); + GetDocument().body()->setInnerHTML("<input type='checkbox' />"); auto* input = To<HTMLInputElement>(GetDocument().body()->firstChild()); EXPECT_EQ(nullptr, input->UserAgentShadowRoot()); input->setAttribute(html_names::kTypeAttr, "text"); @@ -209,7 +209,7 @@ } TEST_F(HTMLInputElementTest, RepaintAfterClearingFile) { - GetDocument().body()->SetInnerHTMLFromString("<input type='file' />"); + GetDocument().body()->setInnerHTML("<input type='file' />"); auto* input = To<HTMLInputElement>(GetDocument().body()->firstChild()); FileChooserFileInfoList files;
diff --git a/third_party/blink/renderer/core/html/forms/html_select_element_test.cc b/third_party/blink/renderer/core/html/forms/html_select_element_test.cc index 020795ca..4579eee 100644 --- a/third_party/blink/renderer/core/html/forms/html_select_element_test.cc +++ b/third_party/blink/renderer/core/html/forms/html_select_element_test.cc
@@ -426,7 +426,7 @@ "<select><optgroup><option>sub1</option><option>sub2</option></" "optgroup></select>"); auto* select = To<HTMLSelectElement>(GetDocument().body()->firstChild()); - select->SetInnerHTMLFromString(""); + select->setInnerHTML(""); // PASS if setInnerHTML didn't have a check failure. }
diff --git a/third_party/blink/renderer/core/html/forms/internal_popup_menu_test.cc b/third_party/blink/renderer/core/html/forms/internal_popup_menu_test.cc index 103a1d7..e74aa17 100644 --- a/third_party/blink/renderer/core/html/forms/internal_popup_menu_test.cc +++ b/third_party/blink/renderer/core/html/forms/internal_popup_menu_test.cc
@@ -25,7 +25,7 @@ auto dummy_page_holder_ = std::make_unique<DummyPageHolder>(IntSize(800, 600)); Document& document = dummy_page_holder_->GetDocument(); - document.body()->SetInnerHTMLFromString(R"HTML( + document.body()->setInnerHTML(R"HTML( <select id="select"> <option value="foo">Foo</option> <option value="bar" style="display:none">Bar</option> @@ -49,7 +49,7 @@ auto dummy_page_holder_ = std::make_unique<DummyPageHolder>(IntSize(800, 600)); Document& document = dummy_page_holder_->GetDocument(); - document.body()->SetInnerHTMLFromString(R"HTML( + document.body()->setInnerHTML(R"HTML( <div id="container"> <select id="select"> <option>1</option>
diff --git a/third_party/blink/renderer/core/html/forms/option_list_test.cc b/third_party/blink/renderer/core/html/forms/option_list_test.cc index 863b8eb..71941a4 100644 --- a/third_party/blink/renderer/core/html/forms/option_list_test.cc +++ b/third_party/blink/renderer/core/html/forms/option_list_test.cc
@@ -41,12 +41,12 @@ } TEST_F(OptionListTest, OptionOnly) { - Select().SetInnerHTMLFromString( + Select().setInnerHTML( "text<input><option id=o1></option><input><option " "id=o2></option><input>"); auto* div = To<HTMLElement>( Select().GetDocument().CreateRawElement(html_names::kDivTag)); - div->SetInnerHTMLFromString("<option id=o3></option>"); + div->setInnerHTML("<option id=o3></option>"); Select().AppendChild(div); OptionList list = Select().GetOptionList(); OptionList::Iterator iter = list.begin(); @@ -59,7 +59,7 @@ } TEST_F(OptionListTest, Optgroup) { - Select().SetInnerHTMLFromString( + Select().setInnerHTML( "<optgroup><option id=g11></option><option id=g12></option></optgroup>" "<optgroup><option id=g21></option></optgroup>" "<optgroup></optgroup>" @@ -80,7 +80,7 @@ EXPECT_EQ(list.end(), iter); To<HTMLElement>(Select().firstChild()) - ->SetInnerHTMLFromString( + ->setInnerHTML( "<optgroup><option id=gg11></option></optgroup>" "<option id=g11></option>"); list = Select().GetOptionList();
diff --git a/third_party/blink/renderer/core/html/forms/password_input_type_test.cc b/third_party/blink/renderer/core/html/forms/password_input_type_test.cc index 2719e1a..9dc42a7 100644 --- a/third_party/blink/renderer/core/html/forms/password_input_type_test.cc +++ b/third_party/blink/renderer/core/html/forms/password_input_type_test.cc
@@ -51,8 +51,7 @@ TEST(PasswordInputTypeTest, DidEditFieldEvent) { auto page_holder = std::make_unique<DummyPageHolder>(IntSize(2000, 2000)); MockInsecureInputService mock_service(page_holder->GetFrame()); - page_holder->GetDocument().body()->SetInnerHTMLFromString( - "<input type='password'>"); + page_holder->GetDocument().body()->setInnerHTML("<input type='password'>"); page_holder->GetDocument().View()->UpdateAllLifecyclePhases( DocumentUpdateReason::kTest); blink::test::RunPendingTasks(); @@ -79,8 +78,7 @@ MockInsecureInputService mock_service(page_holder->GetFrame()); page_holder->GetDocument().SetSecureContextModeForTesting( SecureContextMode::kSecureContext); - page_holder->GetDocument().body()->SetInnerHTMLFromString( - "<input type='password'>"); + page_holder->GetDocument().body()->setInnerHTML("<input type='password'>"); page_holder->GetDocument().View()->UpdateAllLifecyclePhases( DocumentUpdateReason::kTest); // Simulate a text field edit.
diff --git a/third_party/blink/renderer/core/html/forms/text_control_element_test.cc b/third_party/blink/renderer/core/html/forms/text_control_element_test.cc index d62c552..e5f9003 100644 --- a/third_party/blink/renderer/core/html/forms/text_control_element_test.cc +++ b/third_party/blink/renderer/core/html/forms/text_control_element_test.cc
@@ -48,7 +48,7 @@ std::make_unique<DummyPageHolder>(IntSize(800, 600), &page_clients); document_ = &dummy_page_holder_->GetDocument(); - document_->documentElement()->SetInnerHTMLFromString( + document_->documentElement()->setInnerHTML( "<body><textarea id=textarea></textarea><input id=input /></body>"); UpdateAllLifecyclePhases(); text_control_ = ToTextControl(document_->getElementById("textarea"));
diff --git a/third_party/blink/renderer/core/html/html_content_element_test.cc b/third_party/blink/renderer/core/html/html_content_element_test.cc index 9cf978f..817bf59b8 100644 --- a/third_party/blink/renderer/core/html/html_content_element_test.cc +++ b/third_party/blink/renderer/core/html/html_content_element_test.cc
@@ -25,7 +25,7 @@ }; TEST_F(HTMLContentElementTest, FallbackRecalcForReattach) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id='host'></div> )HTML");
diff --git a/third_party/blink/renderer/core/html/html_element.cc b/third_party/blink/renderer/core/html/html_element.cc index eb953393..f031577 100644 --- a/third_party/blink/renderer/core/html/html_element.cc +++ b/third_party/blink/renderer/core/html/html_element.cc
@@ -1661,6 +1661,6 @@ void dumpInnerHTML(blink::HTMLElement*); void dumpInnerHTML(blink::HTMLElement* element) { - printf("%s\n", element->InnerHTMLAsString().Ascii().c_str()); + printf("%s\n", element->innerHTML().Ascii().c_str()); } #endif
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 5b06845..8a2c983 100644 --- a/third_party/blink/renderer/core/html/html_iframe_element.cc +++ b/third_party/blink/renderer/core/html/html_iframe_element.cc
@@ -25,7 +25,6 @@ #include "third_party/blink/renderer/core/html/html_iframe_element.h" #include "third_party/blink/public/mojom/feature_policy/feature_policy.mojom-blink.h" -#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_html.h" #include "third_party/blink/renderer/bindings/core/v8/v8_html_iframe_element.h" #include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/style_change_reason.h"
diff --git a/third_party/blink/renderer/core/html/html_link_element_test.cc b/third_party/blink/renderer/core/html/html_link_element_test.cc index 9ff536ea..057f141 100644 --- a/third_party/blink/renderer/core/html/html_link_element_test.cc +++ b/third_party/blink/renderer/core/html/html_link_element_test.cc
@@ -23,7 +23,7 @@ // This tests that we should ignore empty string value // in href attribute value of the link element. TEST_F(HTMLLinkElementTest, EmptyHrefAttribute) { - GetDocument().documentElement()->SetInnerHTMLFromString( + GetDocument().documentElement()->setInnerHTML( "<head>" "<link rel=\"icon\" type=\"image/ico\" href=\"\" />" "</head>"); @@ -34,14 +34,14 @@ // This tests whether Web Monetization counter is properly triggered. TEST_F(HTMLLinkElementTest, WebMonetizationCounter) { // A <link rel="icon"> is not counted. - GetDocument().head()->SetInnerHTMLFromString(R"HTML( + GetDocument().head()->setInnerHTML(R"HTML( <link rel="icon" type="image/ico" href=""> )HTML"); EXPECT_FALSE( GetDocument().IsUseCounted(WebFeature::kHTMLLinkElementMonetization)); // A <link rel="monetization"> is counted. - GetDocument().head()->SetInnerHTMLFromString(R"HTML( + GetDocument().head()->setInnerHTML(R"HTML( <link rel="monetization"> )HTML"); EXPECT_TRUE(
diff --git a/third_party/blink/renderer/core/html/html_meta_element_test.cc b/third_party/blink/renderer/core/html/html_meta_element_test.cc index 3b7298f..2351b8db 100644 --- a/third_party/blink/renderer/core/html/html_meta_element_test.cc +++ b/third_party/blink/renderer/core/html/html_meta_element_test.cc
@@ -72,7 +72,7 @@ private: void LoadTestPageWithViewportFitValue(const String& value) { - GetDocument().documentElement()->SetInnerHTMLFromString( + GetDocument().documentElement()->setInnerHTML( "<head>" "<meta name='viewport' content='viewport-fit=" + value + @@ -103,7 +103,7 @@ } TEST_F(HTMLMetaElementTest, ColorSchemeProcessing_FirstWins) { - GetDocument().head()->SetInnerHTMLFromString(R"HTML( + GetDocument().head()->setInnerHTML(R"HTML( <meta name="color-scheme" content="dark"> <meta name="color-scheme" content="light"> )HTML"); @@ -112,7 +112,7 @@ } TEST_F(HTMLMetaElementTest, ColorSchemeProcessing_Remove) { - GetDocument().head()->SetInnerHTMLFromString(R"HTML( + GetDocument().head()->setInnerHTML(R"HTML( <meta id="first-meta" name="color-scheme" content="dark"> <meta name="color-scheme" content="light"> )HTML"); @@ -125,7 +125,7 @@ } TEST_F(HTMLMetaElementTest, ColorSchemeProcessing_InsertBefore) { - GetDocument().head()->SetInnerHTMLFromString(R"HTML( + GetDocument().head()->setInnerHTML(R"HTML( <meta name="color-scheme" content="dark"> )HTML"); @@ -138,7 +138,7 @@ } TEST_F(HTMLMetaElementTest, ColorSchemeProcessing_AppendChild) { - GetDocument().head()->SetInnerHTMLFromString(R"HTML( + GetDocument().head()->setInnerHTML(R"HTML( <meta name="color-scheme" content="dark"> )HTML"); @@ -150,7 +150,7 @@ } TEST_F(HTMLMetaElementTest, ColorSchemeProcessing_SetAttribute) { - GetDocument().head()->SetInnerHTMLFromString(R"HTML( + GetDocument().head()->setInnerHTML(R"HTML( <meta id="meta" name="color-scheme" content="dark"> )HTML"); @@ -163,7 +163,7 @@ } TEST_F(HTMLMetaElementTest, ColorSchemeProcessing_RemoveContentAttribute) { - GetDocument().head()->SetInnerHTMLFromString(R"HTML( + GetDocument().head()->setInnerHTML(R"HTML( <meta id="meta" name="color-scheme" content="dark"> )HTML"); @@ -176,7 +176,7 @@ } TEST_F(HTMLMetaElementTest, ColorSchemeProcessing_RemoveNameAttribute) { - GetDocument().head()->SetInnerHTMLFromString(R"HTML( + GetDocument().head()->setInnerHTML(R"HTML( <meta id="meta" name="color-scheme" content="dark"> )HTML"); @@ -245,7 +245,7 @@ } TEST_F(HTMLMetaElementTest, ReferrerPolicyWithoutContent) { - GetDocument().head()->SetInnerHTMLFromString(R"HTML( + GetDocument().head()->setInnerHTML(R"HTML( <meta name="referrer" content="strict-origin"> <meta name="referrer" > )HTML"); @@ -257,7 +257,7 @@ TEST_F(HTMLMetaElementTest, WebMonetizationCounter) { // <meta> elements that don't have name equal to "monetization" or that lack // a content attribute are not counted. - GetDocument().head()->SetInnerHTMLFromString(R"HTML( + GetDocument().head()->setInnerHTML(R"HTML( <meta name="color-scheme" content="dark"> <meta name="monetization"> )HTML"); @@ -265,7 +265,7 @@ GetDocument().IsUseCounted(WebFeature::kHTMLMetaElementMonetization)); // A <link rel="monetization"> with a content attribute is counted. - GetDocument().head()->SetInnerHTMLFromString(R"HTML( + GetDocument().head()->setInnerHTML(R"HTML( <meta name="monetization" content="$payment.pointer.url"> )HTML"); EXPECT_TRUE(
diff --git a/third_party/blink/renderer/core/html/html_object_element_test.cc b/third_party/blink/renderer/core/html/html_object_element_test.cc index 2b6f309..def6ca8 100644 --- a/third_party/blink/renderer/core/html/html_object_element_test.cc +++ b/third_party/blink/renderer/core/html/html_object_element_test.cc
@@ -25,7 +25,7 @@ }; TEST_F(HTMLObjectElementTest, FallbackRecalcForReattach) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <object id='obj' data='dummy'></object> )HTML");
diff --git a/third_party/blink/renderer/core/html/html_plugin_element_test.cc b/third_party/blink/renderer/core/html/html_plugin_element_test.cc index 6cbaa3e..985076f4 100644 --- a/third_party/blink/renderer/core/html/html_plugin_element_test.cc +++ b/third_party/blink/renderer/core/html/html_plugin_element_test.cc
@@ -108,7 +108,7 @@ )HTML"; const char* container_type = GetParam(); - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( String::Format(kDivWithPlugin, container_type, container_type)); auto* plugin =
diff --git a/third_party/blink/renderer/core/html/html_script_element.cc b/third_party/blink/renderer/core/html/html_script_element.cc index cdf74725..cca567cd 100644 --- a/third_party/blink/renderer/core/html/html_script_element.cc +++ b/third_party/blink/renderer/core/html/html_script_element.cc
@@ -123,10 +123,8 @@ loader_->DidNotifySubtreeInsertionsToDocument(); } -void HTMLScriptElement::setText( - const StringOrTrustedScript& string_or_trusted_script, - ExceptionState& exception_state) { - setTextContent(string_or_trusted_script, exception_state); +void HTMLScriptElement::setText(const String& string) { + setTextContent(string); } void HTMLScriptElement::text(StringOrTrustedScript& result) { @@ -148,6 +146,14 @@ } } +void HTMLScriptElement::setTextContent(const String& string) { + // https://w3c.github.io/webappsec-trusted-types/dist/spec/#setting-slot-values + // On setting, [..] textContent [..] perform the regular steps, and then set + // content object's [[ScriptText]] internal slot value [...]. + Node::setTextContent(string); + script_text_internal_slot_ = ParkableString(string.Impl()); +} + void HTMLScriptElement::setTextContent( const StringOrTrustedScript& string_or_trusted_script, ExceptionState& exception_state) {
diff --git a/third_party/blink/renderer/core/html/html_script_element.h b/third_party/blink/renderer/core/html/html_script_element.h index 56437d82..d70f5e3cf 100644 --- a/third_party/blink/renderer/core/html/html_script_element.h +++ b/third_party/blink/renderer/core/html/html_script_element.h
@@ -49,9 +49,11 @@ const AttrNameToTrustedType& GetCheckedAttributeTypes() const override; void text(StringOrTrustedScript& result); - void setText(const StringOrTrustedScript&, ExceptionState&); + String text() { return TextFromChildren(); } + void setText(const String&); void setInnerText(const StringOrTrustedScript&, ExceptionState&) override; void setTextContent(const StringOrTrustedScript&, ExceptionState&) override; + void setTextContent(const String&) override; void setAsync(bool); bool async() const;
diff --git a/third_party/blink/renderer/core/html/html_script_element.idl b/third_party/blink/renderer/core/html/html_script_element.idl index 2d6feee4..f92832a 100644 --- a/third_party/blink/renderer/core/html/html_script_element.idl +++ b/third_party/blink/renderer/core/html/html_script_element.idl
@@ -29,7 +29,7 @@ [CEReactions] attribute boolean async; [CEReactions, Reflect] attribute boolean defer; [CEReactions, Reflect, ReflectOnly=("anonymous","use-credentials"), ReflectEmpty="anonymous", ReflectInvalid="anonymous"] attribute DOMString? crossOrigin; - [CEReactions, RaisesException=Setter] attribute ScriptString text; + [CEReactions] attribute ScriptString text; [CEReactions, Reflect, ReflectOnly=("", "no-referrer", "no-referrer-when-downgrade", "same-origin", "origin", "strict-origin", "origin-when-cross-origin", "strict-origin-when-cross-origin", "unsafe-url"), ReflectEmpty="", ReflectInvalid=""] attribute DOMString? referrerPolicy; [CEReactions, MeasureAs=PriorityHints, RuntimeEnabled=PriorityHints, Reflect, ReflectOnly=("low", "auto", "high"), ReflectMissing="auto", ReflectInvalid="auto"] attribute DOMString importance;
diff --git a/third_party/blink/renderer/core/html/html_slot_element_test.cc b/third_party/blink/renderer/core/html/html_slot_element_test.cc index 7fb93a7..72c065d 100644 --- a/third_party/blink/renderer/core/html/html_slot_element_test.cc +++ b/third_party/blink/renderer/core/html/html_slot_element_test.cc
@@ -147,7 +147,7 @@ }; TEST_F(HTMLSlotElementInDocumentTest, RecalcAssignedNodeStyleForReattach) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id='host'><span id='span'></span></div> )HTML"); @@ -157,8 +157,7 @@ ShadowRoot& shadow_root = host.AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString( - R"HTML(<span><slot /></span>)HTML"); + shadow_root.setInnerHTML(R"HTML(<span><slot /></span>)HTML"); auto* shadow_span = To<Element>(shadow_root.firstChild()); GetDocument().View()->UpdateAllLifecyclePhases(DocumentUpdateReason::kTest); @@ -173,7 +172,7 @@ } TEST_F(HTMLSlotElementInDocumentTest, SlotableFallback) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <div id='host'></div> )HTML"); @@ -181,8 +180,7 @@ ShadowRoot& shadow_root = host.AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString( - R"HTML(<slot><span></span><!-- -->text</slot>)HTML"); + shadow_root.setInnerHTML(R"HTML(<slot><span></span><!-- -->text</slot>)HTML"); auto* slot = To<HTMLSlotElement>(shadow_root.firstChild());
diff --git a/third_party/blink/renderer/core/html/media/autoplay_uma_helper_test.cc b/third_party/blink/renderer/core/html/media/autoplay_uma_helper_test.cc index 1d9043a..df3c7ef2 100644 --- a/third_party/blink/renderer/core/html/media/autoplay_uma_helper_test.cc +++ b/third_party/blink/renderer/core/html/media/autoplay_uma_helper_test.cc
@@ -47,8 +47,8 @@ private: void SetUp() override { PageTestBase::SetUp(); - GetDocument().documentElement()->SetInnerHTMLFromString( - "<video id=video></video>", ASSERT_NO_EXCEPTION); + GetDocument().documentElement()->setInnerHTML("<video id=video></video>", + ASSERT_NO_EXCEPTION); HTMLMediaElement& element = MediaElement(); uma_helper_ = MakeGarbageCollected<MockAutoplayUmaHelper>(&element); element.autoplay_policy_->autoplay_uma_helper_ = uma_helper_;
diff --git a/third_party/blink/renderer/core/html/media/html_media_element_event_listeners_test.cc b/third_party/blink/renderer/core/html/media/html_media_element_event_listeners_test.cc index 17a746a..faeb17ce 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element_event_listeners_test.cc +++ b/third_party/blink/renderer/core/html/media/html_media_element_event_listeners_test.cc
@@ -160,8 +160,7 @@ TEST_F(HTMLMediaElementEventListenersTest, RemovingFromDocumentCollectsAll) { EXPECT_EQ(Video(), nullptr); - GetDocument().body()->SetInnerHTMLFromString( - "<body><video controls></video></body>"); + GetDocument().body()->setInnerHTML("<body><video controls></video></body>"); EXPECT_NE(Video(), nullptr); EXPECT_TRUE(Video()->HasEventListeners()); EXPECT_NE(Controls(), nullptr); @@ -171,7 +170,7 @@ WeakPersistent<MediaControls> weak_persistent_controls = Controls(); { Persistent<HTMLVideoElement> persistent_video = Video(); - GetDocument().body()->SetInnerHTMLFromString(""); + GetDocument().body()->setInnerHTML(""); // When removed from the document, the event listeners should have been // dropped. @@ -192,8 +191,7 @@ TEST_F(HTMLMediaElementEventListenersTest, ReInsertingInDocumentCollectsControls) { EXPECT_EQ(Video(), nullptr); - GetDocument().body()->SetInnerHTMLFromString( - "<body><video controls></video></body>"); + GetDocument().body()->setInnerHTML("<body><video controls></video></body>"); EXPECT_NE(Video(), nullptr); EXPECT_TRUE(Video()->HasEventListeners()); EXPECT_NE(Controls(), nullptr); @@ -222,7 +220,7 @@ TEST_F(HTMLMediaElementEventListenersTest, FullscreenDetectorTimerCancelledOnContextDestroy) { EXPECT_EQ(Video(), nullptr); - GetDocument().body()->SetInnerHTMLFromString("<body><video></video></body>"); + GetDocument().body()->setInnerHTML("<body><video></video></body>"); Video()->SetSrc("http://example.com"); test::RunPendingTasks(); @@ -288,7 +286,7 @@ TEST_F(HTMLMediaElementWithMockSchedulerTest, OneTimeupdatePerSeek) { testing::InSequence dummy; - GetDocument().body()->SetInnerHTMLFromString("<body><video></video></body>"); + GetDocument().body()->setInnerHTML("<body><video></video></body>"); // Set a src to trigger WebMediaPlayer creation. Video()->SetSrc("http://example.com"); @@ -341,7 +339,7 @@ TEST_F(HTMLMediaElementWithMockSchedulerTest, PeriodicTimeupdateAfterSeek) { testing::InSequence dummy; - GetDocument().body()->SetInnerHTMLFromString("<body><video></video></body>"); + GetDocument().body()->setInnerHTML("<body><video></video></body>"); // Set a src to trigger WebMediaPlayer creation. Video()->SetSrc("http://example.com");
diff --git a/third_party/blink/renderer/core/html/media/html_video_element_persistent_test.cc b/third_party/blink/renderer/core/html/media/html_video_element_persistent_test.cc index bb92168..5fa7e5a 100644 --- a/third_party/blink/renderer/core/html/media/html_video_element_persistent_test.cc +++ b/third_party/blink/renderer/core/html/media/html_video_element_persistent_test.cc
@@ -43,7 +43,7 @@ clients.chrome_client = chrome_client_.Get(); PageTestBase::SetupPageWithClients(&clients); - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<body><div><video></video></div></body>"); }
diff --git a/third_party/blink/renderer/core/html/media/media_custom_controls_fullscreen_detector_test.cc b/third_party/blink/renderer/core/html/media/media_custom_controls_fullscreen_detector_test.cc index 99473c60..b8523b8 100644 --- a/third_party/blink/renderer/core/html/media/media_custom_controls_fullscreen_detector_test.cc +++ b/third_party/blink/renderer/core/html/media/media_custom_controls_fullscreen_detector_test.cc
@@ -123,7 +123,7 @@ TEST_F(MediaCustomControlsFullscreenDetectorTest, hasListenersAfterAddToDocumentByParser) { - GetDocument().body()->SetInnerHTMLFromString("<body><video></video></body>"); + GetDocument().body()->setInnerHTML("<body><video></video></body>"); EXPECT_TRUE(CheckEventListenerRegistered(GetDocument(), event_type_names::kFullscreenchange,
diff --git a/third_party/blink/renderer/core/html/portal/html_portal_element_test.cc b/third_party/blink/renderer/core/html/portal/html_portal_element_test.cc index a695215f8..7cbf44b 100644 --- a/third_party/blink/renderer/core/html/portal/html_portal_element_test.cc +++ b/third_party/blink/renderer/core/html/portal/html_portal_element_test.cc
@@ -59,7 +59,7 @@ .Contains("was moved to a document")); next_console_message = console_messages.size(); - portal->setAttribute(html_names::kSrcAttr, "http://example.com/", + portal->setAttribute(html_names::kSrcAttr, String("http://example.com/"), ASSERT_NO_EXCEPTION); EXPECT_EQ(next_console_message + 1, console_messages.size()); EXPECT_TRUE(console_messages.at(next_console_message)
diff --git a/third_party/blink/renderer/core/html/shadow/progress_shadow_element_test.cc b/third_party/blink/renderer/core/html/shadow/progress_shadow_element_test.cc index ca78f30..fd8b95b 100644 --- a/third_party/blink/renderer/core/html/shadow/progress_shadow_element_test.cc +++ b/third_party/blink/renderer/core/html/shadow/progress_shadow_element_test.cc
@@ -26,7 +26,7 @@ }; TEST_F(ProgressShadowElementTest, LayoutObjectIsNeeded) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <progress id='prog' style='-webkit-appearance:none' /> )HTML");
diff --git a/third_party/blink/renderer/core/input/event_handler_test.cc b/third_party/blink/renderer/core/input/event_handler_test.cc index c6ef6ed..02bd77a 100644 --- a/third_party/blink/renderer/core/input/event_handler_test.cc +++ b/third_party/blink/renderer/core/input/event_handler_test.cc
@@ -189,8 +189,7 @@ } void EventHandlerTest::SetHtmlInnerHTML(const char* html_content) { - GetDocument().documentElement()->SetInnerHTMLFromString( - String::FromUTF8(html_content)); + GetDocument().documentElement()->setInnerHTML(String::FromUTF8(html_content)); UpdateAllLifecyclePhasesForTest(); } @@ -806,7 +805,7 @@ "<div>foo</div>"); GetDocument().GetSettings()->SetScriptEnabled(true); Element* script = GetDocument().CreateRawElement(html_names::kScriptTag); - script->SetInnerHTMLFromString( + script->setInnerHTML( "document.addEventListener('contextmenu', event => " "event.preventDefault());"); GetDocument().body()->AppendChild(script); @@ -1135,7 +1134,7 @@ } void SetHtmlInnerHTML(const char* html_content) { - GetDocument().documentElement()->SetInnerHTMLFromString( + GetDocument().documentElement()->setInnerHTML( String::FromUTF8(html_content)); UpdateAllLifecyclePhasesForTest(); }
diff --git a/third_party/blink/renderer/core/input/touch_action_test.cc b/third_party/blink/renderer/core/input/touch_action_test.cc index 26073d64..38be891 100644 --- a/third_party/blink/renderer/core/input/touch_action_test.cc +++ b/third_party/blink/renderer/core/input/touch_action_test.cc
@@ -325,7 +325,7 @@ << "Unexpected hit test result " << failure_context_pos << " Got element: \"" << result.InnerElement() - ->OuterHTMLAsString() + ->outerHTML() .StripWhiteSpace() .Left(80) .Ascii()
diff --git a/third_party/blink/renderer/core/layout/layout_object_test.cc b/third_party/blink/renderer/core/layout/layout_object_test.cc index 96540bd..d1d4547 100644 --- a/third_party/blink/renderer/core/layout/layout_object_test.cc +++ b/third_party/blink/renderer/core/layout/layout_object_test.cc
@@ -1084,7 +1084,7 @@ EXPECT_FALSE(other->NeedsLayoutOverflowRecalc()); auto* target_element = GetDocument().getElementById("target"); - target_element->SetInnerHTMLFromString("baz"); + target_element->setInnerHTML("baz"); UpdateAllLifecyclePhasesForTest(); EXPECT_FALSE(wrapper->NeedsLayoutOverflowRecalc());
diff --git a/third_party/blink/renderer/core/layout/layout_shift_tracker.cc b/third_party/blink/renderer/core/layout/layout_shift_tracker.cc index 8dd908e..234de55 100644 --- a/third_party/blink/renderer/core/layout/layout_shift_tracker.cc +++ b/third_party/blink/renderer/core/layout/layout_shift_tracker.cc
@@ -105,7 +105,7 @@ #if DCHECK_IS_ON() bool ShouldLog(const LocalFrame& frame) { const String& url = frame.GetDocument()->Url().GetString(); - return !url.StartsWith("chrome-devtools:") && !url.StartsWith("devtools:"); + return !url.StartsWith("devtools:"); } #endif
diff --git a/third_party/blink/renderer/core/layout/layout_text_fragment_test.cc b/third_party/blink/renderer/core/layout/layout_text_fragment_test.cc index e8bacc96..ee1d8b43 100644 --- a/third_party/blink/renderer/core/layout/layout_text_fragment_test.cc +++ b/third_party/blink/renderer/core/layout/layout_text_fragment_test.cc
@@ -17,7 +17,7 @@ protected: void SetUp() override { RenderingTest::SetUp(); - GetDocument().head()->SetInnerHTMLFromString( + GetDocument().head()->setInnerHTML( "<style>#target::first-letter{color:red}</style>"); }
diff --git a/third_party/blink/renderer/core/layout/layout_theme_test.cc b/third_party/blink/renderer/core/layout/layout_theme_test.cc index f4c315b..ea37c45 100644 --- a/third_party/blink/renderer/core/layout/layout_theme_test.cc +++ b/third_party/blink/renderer/core/layout/layout_theme_test.cc
@@ -34,8 +34,7 @@ }; void LayoutThemeTest::SetHtmlInnerHTML(const char* html_content) { - GetDocument().documentElement()->SetInnerHTMLFromString( - String::FromUTF8(html_content)); + GetDocument().documentElement()->setInnerHTML(String::FromUTF8(html_content)); UpdateAllLifecyclePhasesForTest(); }
diff --git a/third_party/blink/renderer/core/layout/layout_view_test.cc b/third_party/blink/renderer/core/layout/layout_view_test.cc index 1f69fd44..c291310a 100644 --- a/third_party/blink/renderer/core/layout/layout_view_test.cc +++ b/third_party/blink/renderer/core/layout/layout_view_test.cc
@@ -57,7 +57,7 @@ EXPECT_FALSE(view->CanHaveChildren()); EXPECT_FALSE(frame_doc->documentElement()->GetComputedStyle()); - frame_doc->body()->SetInnerHTMLFromString(R"HTML( + frame_doc->body()->setInnerHTML(R"HTML( <div id="div"></div> )HTML");
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node_test.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node_test.cc index 0b369c3..18a90c1 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node_test.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node_test.cc
@@ -1394,7 +1394,7 @@ SetupHtml("container", "<div id=container><b><i>foo</i></b></div>"); ASSERT_TRUE(layout_block_flow_->HasNGInlineNodeData()); - GetElementById("container")->SetInnerHTMLFromString(""); + GetElementById("container")->setInnerHTML(""); UpdateAllLifecyclePhasesForTest(); EXPECT_FALSE(layout_block_flow_->HasNGInlineNodeData());
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_inline.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_inline.cc index 13d5b39..04b832c 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_inline.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_inline.cc
@@ -60,27 +60,27 @@ } FloatRect LayoutSVGInline::ObjectBoundingBox() const { - if (const LayoutSVGText* text_root = - LayoutSVGText::LocateLayoutSVGTextAncestor(this)) - return text_root->ObjectBoundingBox(); - - return FloatRect(); + FloatRect bounds; + for (InlineFlowBox* box : *LineBoxes()) + bounds.Unite(FloatRect(box->FrameRect())); + return bounds; } FloatRect LayoutSVGInline::StrokeBoundingBox() const { - if (const LayoutSVGText* text_root = - LayoutSVGText::LocateLayoutSVGTextAncestor(this)) - return text_root->StrokeBoundingBox(); - - return FloatRect(); + if (!FirstLineBox()) + return FloatRect(); + return SVGLayoutSupport::ExtendTextBBoxWithStroke(*this, ObjectBoundingBox()); } FloatRect LayoutSVGInline::VisualRectInLocalSVGCoordinates() const { - if (const LayoutSVGText* text_root = - LayoutSVGText::LocateLayoutSVGTextAncestor(this)) - return text_root->VisualRectInLocalSVGCoordinates(); - - return FloatRect(); + if (!FirstLineBox()) + return FloatRect(); + const LayoutSVGText* text_root = + LayoutSVGText::LocateLayoutSVGTextAncestor(this); + if (!text_root) + return FloatRect(); + return SVGLayoutSupport::ComputeVisualRectForText( + *this, ObjectBoundingBox(), text_root->ObjectBoundingBox()); } PhysicalRect LayoutSVGInline::VisualRectInDocument( @@ -103,18 +103,10 @@ void LayoutSVGInline::AbsoluteQuads(Vector<FloatQuad>& quads, MapCoordinatesFlags mode) const { - const LayoutSVGText* text_root = - LayoutSVGText::LocateLayoutSVGTextAncestor(this); - if (!text_root) - return; - - FloatRect text_bounding_box = text_root->StrokeBoundingBox(); for (InlineFlowBox* box : *LineBoxes()) { + FloatRect box_rect(box->FrameRect()); quads.push_back(LocalToAbsoluteQuad( - FloatRect(text_bounding_box.X() + box->X().ToFloat(), - text_bounding_box.Y() + box->Y().ToFloat(), - box->Width().ToFloat(), box->Height().ToFloat()), - mode)); + SVGLayoutSupport::ExtendTextBBoxWithStroke(*this, box_rect), mode)); } }
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_inline.h b/third_party/blink/renderer/core/layout/svg/layout_svg_inline.h index 6322b62..19b362d2 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_inline.h +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_inline.h
@@ -38,11 +38,6 @@ bool IsChildAllowed(LayoutObject*, const ComputedStyle&) const override; - // Chapter 10.4 of the SVG Specification say that we should use the - // object bounding box of the parent text element. - // We search for the root text element and take its bounding box. - // It is also necessary to take the stroke and visual rect of this element, - // since we need it for filters. FloatRect ObjectBoundingBox() const final; FloatRect StrokeBoundingBox() const final; FloatRect VisualRectInLocalSVGCoordinates() const final;
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_paint_server.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_paint_server.cc index fdc8bc0..58231ff8 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_paint_server.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_paint_server.cc
@@ -147,7 +147,7 @@ return SVGPaintServer(paint_description.color); SVGPaintServer paint_server = paint_description.resource->PreparePaintServer( *SVGResources::GetClient(layout_object), - layout_object.ObjectBoundingBox()); + SVGResources::ReferenceBoxForEffects(layout_object)); if (paint_server.IsValid()) return paint_server; if (paint_description.has_fallback)
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_text.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_text.cc index adb9ac9..373e99f 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_text.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_text.cc
@@ -367,27 +367,17 @@ } FloatRect LayoutSVGText::StrokeBoundingBox() const { - FloatRect stroke_boundaries = ObjectBoundingBox(); - const SVGComputedStyle& svg_style = StyleRef().SvgStyle(); - if (!svg_style.HasStroke()) - return stroke_boundaries; - - DCHECK(GetElement()); - SVGLengthContext length_context(GetElement()); - stroke_boundaries.Inflate( - length_context.ValueForLength(svg_style.StrokeWidth())); - return stroke_boundaries; + if (!FirstRootBox()) + return FloatRect(); + return SVGLayoutSupport::ExtendTextBBoxWithStroke(*this, ObjectBoundingBox()); } FloatRect LayoutSVGText::VisualRectInLocalSVGCoordinates() const { - FloatRect visual_rect = StrokeBoundingBox(); - SVGLayoutSupport::AdjustVisualRectWithResources(*this, ObjectBoundingBox(), - visual_rect); - - if (const ShadowList* text_shadow = StyleRef().TextShadow()) - text_shadow->AdjustRectForShadow(visual_rect); - - return visual_rect; + if (!FirstRootBox()) + return FloatRect(); + const FloatRect object_bounds = ObjectBoundingBox(); + return SVGLayoutSupport::ComputeVisualRectForText(*this, object_bounds, + object_bounds); } void LayoutSVGText::AddOutlineRects(Vector<PhysicalRect>& rects,
diff --git a/third_party/blink/renderer/core/layout/svg/svg_layout_support.cc b/third_party/blink/renderer/core/layout/svg/svg_layout_support.cc index 40000a9c..8b262852 100644 --- a/third_party/blink/renderer/core/layout/svg/svg_layout_support.cc +++ b/third_party/blink/renderer/core/layout/svg/svg_layout_support.cc
@@ -409,6 +409,34 @@ visual_rect.Intersect(masker->ResourceBoundingBox(object_bounding_box)); } +FloatRect SVGLayoutSupport::ExtendTextBBoxWithStroke( + const LayoutObject& layout_object, + const FloatRect& text_bounds) { + DCHECK(layout_object.IsSVGText() || layout_object.IsSVGInline()); + FloatRect bounds = text_bounds; + const SVGComputedStyle& svg_style = layout_object.StyleRef().SvgStyle(); + if (svg_style.HasStroke()) { + SVGLengthContext length_context(To<SVGElement>(layout_object.GetNode())); + // TODO(fs): This approximation doesn't appear to be conservative enough + // since while text (usually?) won't have caps it could have joins and thus + // miters. + bounds.Inflate(length_context.ValueForLength(svg_style.StrokeWidth())); + } + return bounds; +} + +FloatRect SVGLayoutSupport::ComputeVisualRectForText( + const LayoutObject& layout_object, + const FloatRect& text_bounds, + const FloatRect& reference_box) { + DCHECK(layout_object.IsSVGText() || layout_object.IsSVGInline()); + FloatRect visual_rect = ExtendTextBBoxWithStroke(layout_object, text_bounds); + if (const ShadowList* text_shadow = layout_object.StyleRef().TextShadow()) + text_shadow->AdjustRectForShadow(visual_rect); + AdjustVisualRectWithResources(layout_object, reference_box, visual_rect); + return visual_rect; +} + bool SVGLayoutSupport::HasFilterResource(const LayoutObject& object) { SVGResources* resources = SVGResourcesCache::CachedResourcesForLayoutObject(object);
diff --git a/third_party/blink/renderer/core/layout/svg/svg_layout_support.h b/third_party/blink/renderer/core/layout/svg/svg_layout_support.h index 92b33e4..214bf35 100644 --- a/third_party/blink/renderer/core/layout/svg/svg_layout_support.h +++ b/third_party/blink/renderer/core/layout/svg/svg_layout_support.h
@@ -68,6 +68,15 @@ const FloatRect& object_bounding_box, FloatRect&); + // Add any contribution from 'stroke' to a text content bounding rect. + static FloatRect ExtendTextBBoxWithStroke(const LayoutObject&, + const FloatRect& text_bounds); + + // Compute the visual rect for the a text content LayoutObject. + static FloatRect ComputeVisualRectForText(const LayoutObject&, + const FloatRect& text_bounds, + const FloatRect& reference_box); + // Determine if the LayoutObject references a filter resource object. static bool HasFilterResource(const LayoutObject&);
diff --git a/third_party/blink/renderer/core/layout/svg/svg_resources.cc b/third_party/blink/renderer/core/layout/svg/svg_resources.cc index 703d828..1613b92a 100644 --- a/third_party/blink/renderer/core/layout/svg/svg_resources.cc +++ b/third_party/blink/renderer/core/layout/svg/svg_resources.cc
@@ -27,6 +27,7 @@ #include "third_party/blink/renderer/core/layout/svg/layout_svg_resource_marker.h" #include "third_party/blink/renderer/core/layout/svg/layout_svg_resource_masker.h" #include "third_party/blink/renderer/core/layout/svg/layout_svg_resource_paint_server.h" +#include "third_party/blink/renderer/core/layout/svg/layout_svg_text.h" #include "third_party/blink/renderer/core/layout/svg/svg_resources_cache.h" #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/style/reference_clip_path_operation.h" @@ -51,6 +52,20 @@ return To<SVGElement>(object.GetNode())->GetSVGResourceClient(); } +FloatRect SVGResources::ReferenceBoxForEffects( + const LayoutObject& layout_object) { + // Text "sub-elements" (<tspan>, <textpath>, <a>) should use the entire + // <text>s object bounding box rather then their own. + // https://svgwg.org/svg2-draft/text.html#ObjectBoundingBoxUnitsTextObjects + const LayoutObject* obb_layout_object = &layout_object; + if (layout_object.IsSVGInline()) { + obb_layout_object = + LayoutSVGText::LocateLayoutSVGTextAncestor(&layout_object); + } + DCHECK(obb_layout_object); + return obb_layout_object->ObjectBoundingBox(); +} + static HashSet<AtomicString>& ClipperFilterMaskerTags() { DEFINE_STATIC_LOCAL( HashSet<AtomicString>, tag_list,
diff --git a/third_party/blink/renderer/core/layout/svg/svg_resources.h b/third_party/blink/renderer/core/layout/svg/svg_resources.h index a27e7f8..a408479d 100644 --- a/third_party/blink/renderer/core/layout/svg/svg_resources.h +++ b/third_party/blink/renderer/core/layout/svg/svg_resources.h
@@ -50,6 +50,7 @@ SVGResources(); static SVGElementResourceClient* GetClient(const LayoutObject&); + static FloatRect ReferenceBoxForEffects(const LayoutObject&); static std::unique_ptr<SVGResources> BuildResources(const LayoutObject&, const ComputedStyle&);
diff --git a/third_party/blink/renderer/core/layout/text_autosizer_test.cc b/third_party/blink/renderer/core/layout/text_autosizer_test.cc index fcf01c4c..dd9ad6e 100644 --- a/third_party/blink/renderer/core/layout/text_autosizer_test.cc +++ b/third_party/blink/renderer/core/layout/text_autosizer_test.cc
@@ -579,7 +579,7 @@ UpdateAllLifecyclePhasesForTest(); Element* long_text_element = GetDocument().getElementById("longText"); - long_text_element->SetInnerHTMLFromString( + long_text_element->setInnerHTML( " Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed " "do eiusmod tempor" " incididunt ut labore et dolore magna aliqua. Ut enim ad minim " @@ -624,7 +624,7 @@ UpdateAllLifecyclePhasesForTest(); Element* long_text_element = GetDocument().getElementById("longText"); - long_text_element->SetInnerHTMLFromString( + long_text_element->setInnerHTML( " Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed " "do eiusmod tempor" " incididunt ut labore et dolore magna aliqua. Ut enim ad minim " @@ -669,7 +669,7 @@ UpdateAllLifecyclePhasesForTest(); Element* container = GetDocument().getElementById("container"); - container->SetInnerHTMLFromString( + container->setInnerHTML( "<div class='supercluster' id='longText'>" " Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed " "do eiusmod tempor" @@ -717,7 +717,7 @@ UpdateAllLifecyclePhasesForTest(); Element* long_text_element = GetDocument().getElementById("longText"); - long_text_element->SetInnerHTMLFromString( + long_text_element->setInnerHTML( " Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed " "do eiusmod tempor" " incididunt ut labore et dolore magna aliqua. Ut enim ad minim " @@ -803,7 +803,7 @@ GetDocument().GetSettings()->SetTextAutosizingWindowSizeOverride( IntSize(360, 640)); Element* html = GetDocument().body()->parentElement(); - html->SetInnerHTMLFromString( + html->setInnerHTML( "<head>" " <meta name='viewport' content='width=800'>" " <style>" @@ -843,7 +843,7 @@ TEST_F(TextAutosizerTest, narrowContentInsideNestedWideBlock) { Element* html = GetDocument().body()->parentElement(); - html->SetInnerHTMLFromString( + html->setInnerHTML( "<head>" " <meta name='viewport' content='width=800'>" " <style>" @@ -879,7 +879,7 @@ TEST_F(TextAutosizerTest, LayoutViewWidthProvider) { Element* html = GetDocument().body()->parentElement(); - html->SetInnerHTMLFromString( + html->setInnerHTML( "<head>" " <meta name='viewport' content='width=800'>" " <style>" @@ -908,8 +908,8 @@ EXPECT_FLOAT_EQ(40.f, content->GetLayoutObject()->StyleRef().ComputedFontSize()); - GetDocument().getElementById("panel")->SetInnerHTMLFromString("insert text"); - content->SetInnerHTMLFromString(content->InnerHTMLAsString()); + GetDocument().getElementById("panel")->setInnerHTML("insert text"); + content->setInnerHTML(content->innerHTML()); UpdateAllLifecyclePhasesForTest(); // (specified font-size = 16px) * (viewport width = 800px) / @@ -920,7 +920,7 @@ TEST_F(TextAutosizerTest, MultiColumns) { Element* html = GetDocument().body()->parentElement(); - html->SetInnerHTMLFromString( + html->setInnerHTML( "<head>" " <meta name='viewport' content='width=800'>" " <style>"
diff --git a/third_party/blink/renderer/core/page/chrome_client.h b/third_party/blink/renderer/core/page/chrome_client.h index f369a2f..393b7ad 100644 --- a/third_party/blink/renderer/core/page/chrome_client.h +++ b/third_party/blink/renderer/core/page/chrome_client.h
@@ -105,6 +105,7 @@ struct ViewportDescription; struct WebScreenInfo; struct WebWindowFeatures; +struct WebRect; using CompositorElementId = cc::ElementId; @@ -295,6 +296,8 @@ virtual void EnablePreferredSizeChangedMode() {} + virtual void ZoomToFindInPageRect(const WebRect&) {} + virtual void ContentsSizeChanged(LocalFrame*, const IntSize&) const = 0; // Call during pinch gestures, or when page-scale changes on main-frame load. virtual void PageScaleFactorChanged() const {}
diff --git a/third_party/blink/renderer/core/page/chrome_client_impl.cc b/third_party/blink/renderer/core/page/chrome_client_impl.cc index 2dccec4..2d25cdf 100644 --- a/third_party/blink/renderer/core/page/chrome_client_impl.cc +++ b/third_party/blink/renderer/core/page/chrome_client_impl.cc
@@ -528,6 +528,10 @@ web_view_->EnablePreferredSizeChangedMode(); } +void ChromeClientImpl::ZoomToFindInPageRect(const WebRect& rect_in_root_frame) { + web_view_->ZoomToFindInPageRect(rect_in_root_frame); +} + void ChromeClientImpl::PageScaleFactorChanged() const { web_view_->PageScaleFactorChanged(); }
diff --git a/third_party/blink/renderer/core/page/chrome_client_impl.h b/third_party/blink/renderer/core/page/chrome_client_impl.h index 65d3d87..76735878b 100644 --- a/third_party/blink/renderer/core/page/chrome_client_impl.h +++ b/third_party/blink/renderer/core/page/chrome_client_impl.h
@@ -52,6 +52,7 @@ class PagePopupClient; class WebAutofillClient; class WebViewImpl; +struct WebRect; // Handles window-level notifications from core on behalf of a WebView. class CORE_EXPORT ChromeClientImpl final : public ChromeClient { @@ -136,6 +137,7 @@ void ContentsSizeChanged(LocalFrame*, const IntSize&) const override; bool DoubleTapToZoomEnabled() const override; void EnablePreferredSizeChangedMode() override; + void ZoomToFindInPageRect(const WebRect& rect_in_root_frame) override; void PageScaleFactorChanged() const override; float ClampPageScaleFactorToLimits(float scale) const override; void MainFrameScrollOffsetChanged(LocalFrame& main_frame) const override;
diff --git a/third_party/blink/renderer/core/page/context_menu_controller_test.cc b/third_party/blink/renderer/core/page/context_menu_controller_test.cc index c6f5ec5e..31f1dfa 100644 --- a/third_party/blink/renderer/core/page/context_menu_controller_test.cc +++ b/third_party/blink/renderer/core/page/context_menu_controller_test.cc
@@ -553,7 +553,7 @@ } TEST_F(ContextMenuControllerTest, ShowNonLocatedContextMenuEvent) { - GetDocument()->documentElement()->SetInnerHTMLFromString( + GetDocument()->documentElement()->setInnerHTML( "<input id='sample' type='text' size='5' value='Sample Input Text'>"); Document* document = GetDocument(); @@ -597,7 +597,7 @@ } TEST_F(ContextMenuControllerTest, SelectionRectClipped) { - GetDocument()->documentElement()->SetInnerHTMLFromString( + GetDocument()->documentElement()->setInnerHTML( "<textarea id='text-area' cols=6 rows=2>Sample editable text</textarea>"); Document* document = GetDocument();
diff --git a/third_party/blink/renderer/core/page/focus_controller_test.cc b/third_party/blink/renderer/core/page/focus_controller_test.cc index 041786f..be6f4890 100644 --- a/third_party/blink/renderer/core/page/focus_controller_test.cc +++ b/third_party/blink/renderer/core/page/focus_controller_test.cc
@@ -20,7 +20,7 @@ }; TEST_F(FocusControllerTest, SetInitialFocus) { - GetDocument().body()->SetInnerHTMLFromString("<input><textarea>"); + GetDocument().body()->setInnerHTML("<input><textarea>"); auto* input = To<Element>(GetDocument().body()->firstChild()); // Set sequential focus navigation point before the initial focus. input->focus(); @@ -32,7 +32,7 @@ } TEST_F(FocusControllerTest, DoNotCrash1) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<div id='host'></div>This test is for crbug.com/609012<p id='target' " "tabindex='0'></p>"); // <div> with shadow root @@ -52,7 +52,7 @@ } TEST_F(FocusControllerTest, DoNotCrash2) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<p id='target' tabindex='0'></p>This test is for crbug.com/609012<div " "id='host'></div>"); // <p> @@ -82,7 +82,7 @@ // This test is for crbug.com/733218 TEST_F(FocusControllerTest, SVGFocusableElementInForm) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<form>" "<input id='first'>" "<svg width='100px' height='100px' tabindex='0'>" @@ -107,7 +107,7 @@ } TEST_F(FocusControllerTest, FindFocusableAfterElement) { - GetDocument().body()->SetInnerHTMLFromString( + GetDocument().body()->setInnerHTML( "<input id='first'><div id='second'></div><input id='third'><div " "id='fourth' tabindex='0'></div>"); Element* first = GetElementById("first");
diff --git a/third_party/blink/renderer/core/page/print_context_test.cc b/third_party/blink/renderer/core/page/print_context_test.cc index 7c9e9d9..94644e6 100644 --- a/third_party/blink/renderer/core/page/print_context_test.cc +++ b/third_party/blink/renderer/core/page/print_context_test.cc
@@ -105,7 +105,7 @@ void SetBodyInnerHTML(String body_content) { GetDocument().body()->setAttribute(html_names::kStyleAttr, "margin: 0"); - GetDocument().body()->SetInnerHTMLFromString(body_content); + GetDocument().body()->setInnerHTML(body_content); } void PrintSinglePage(SkCanvas& canvas) {
diff --git a/third_party/blink/renderer/core/page/scrolling/root_scroller_test.cc b/third_party/blink/renderer/core/page/scrolling/root_scroller_test.cc index 6292c79d..4f8f3b4 100644 --- a/third_party/blink/renderer/core/page/scrolling/root_scroller_test.cc +++ b/third_party/blink/renderer/core/page/scrolling/root_scroller_test.cc
@@ -906,7 +906,7 @@ ASSERT_EQ(inner_container, EffectiveRootScroller(iframe->contentDocument())); - iframe->contentDocument()->body()->SetInnerHTMLFromString(""); + iframe->contentDocument()->body()->setInnerHTML(""); // If the root scroller wasn't updated by the DOM removal above, this // will touch the disposed root scroller's ScrollableArea.
diff --git a/third_party/blink/renderer/core/page/scrolling/scrolling_test.cc b/third_party/blink/renderer/core/page/scrolling/scrolling_test.cc index c27fd34..b14fbbf 100644 --- a/third_party/blink/renderer/core/page/scrolling/scrolling_test.cc +++ b/third_party/blink/renderer/core/page/scrolling/scrolling_test.cc
@@ -1474,7 +1474,7 @@ // Note that this frame is still considered pre-FCP. auto* background = GetFrame()->GetDocument()->getElementById("bg"); background->removeAttribute(html_names::kStyleAttr); - background->SetInnerHTMLFromString("Some Text"); + background->setInnerHTML("Some Text"); GetWebView()->MainFrameWidget()->RecordStartOfFrameMetrics(); ForceFullCompositingUpdate(); GetWebView()->MainFrameWidget()->RecordEndOfFrameMetrics(base::TimeTicks(),
diff --git a/third_party/blink/renderer/core/page/scrolling/snap_coordinator_test.cc b/third_party/blink/renderer/core/page/scrolling/snap_coordinator_test.cc index 3e99aa6..b69b4af6 100644 --- a/third_party/blink/renderer/core/page/scrolling/snap_coordinator_test.cc +++ b/third_party/blink/renderer/core/page/scrolling/snap_coordinator_test.cc
@@ -68,7 +68,7 @@ Document& GetDocument() { return page_holder_->GetDocument(); } void SetHTML(const char* html_content) { - GetDocument().documentElement()->SetInnerHTMLFromString(html_content); + GetDocument().documentElement()->setInnerHTML(html_content); } Element& SnapContainer() { @@ -208,7 +208,7 @@ // Add a new snap element Element& container = *GetDocument().getElementById("snap-container"); - container.SetInnerHTMLFromString(R"HTML( + container.setInnerHTML(R"HTML( <div style='scroll-snap-align: start;'> <div style='width:2000px; height:2000px;'></div> </div>
diff --git a/third_party/blink/renderer/core/page/slot_scoped_traversal_test.cc b/third_party/blink/renderer/core/page/slot_scoped_traversal_test.cc index e711cfd..465990a 100644 --- a/third_party/blink/renderer/core/page/slot_scoped_traversal_test.cc +++ b/third_party/blink/renderer/core/page/slot_scoped_traversal_test.cc
@@ -52,7 +52,7 @@ const char* shadow_html, unsigned index) { Element* body = GetDocument().body(); - body->SetInnerHTMLFromString(String::FromUTF8(main_html)); + body->setInnerHTML(String::FromUTF8(main_html)); if (shadow_html) { auto* shadow_host = To<Element>(NodeTraversal::ChildAt(*body, index)); AttachOpenShadowRoot(*shadow_host, shadow_html); @@ -64,7 +64,7 @@ const char* shadow_inner_html) { ShadowRoot& shadow_root = shadow_host.AttachShadowRootInternal(ShadowRootType::kOpen); - shadow_root.SetInnerHTMLFromString(String::FromUTF8(shadow_inner_html)); + shadow_root.setInnerHTML(String::FromUTF8(shadow_inner_html)); GetDocument().body()->UpdateDistributionForFlatTreeTraversal(); }
diff --git a/third_party/blink/renderer/core/paint/clip_path_clipper.cc b/third_party/blink/renderer/core/paint/clip_path_clipper.cc index 2ec7f84..947b6203 100644 --- a/third_party/blink/renderer/core/paint/clip_path_clipper.cc +++ b/third_party/blink/renderer/core/paint/clip_path_clipper.cc
@@ -65,7 +65,7 @@ FloatRect ClipPathClipper::LocalReferenceBox(const LayoutObject& object) { if (object.IsSVGChild()) - return object.ObjectBoundingBox(); + return SVGResources::ReferenceBoxForEffects(object); if (object.IsBox()) return FloatRect(ToLayoutBox(object).BorderBoxRect());
diff --git a/third_party/blink/renderer/core/paint/compositing/compositing_test.cc b/third_party/blink/renderer/core/paint/compositing/compositing_test.cc index 9b80fcd..2396925 100644 --- a/third_party/blink/renderer/core/paint/compositing/compositing_test.cc +++ b/third_party/blink/renderer/core/paint/compositing/compositing_test.cc
@@ -52,7 +52,7 @@ // Both sets the inner html and runs the document lifecycle. void InitializeWithHTML(LocalFrame& frame, const String& html_content) { - frame.GetDocument()->body()->SetInnerHTMLFromString(html_content); + frame.GetDocument()->body()->setInnerHTML(html_content); frame.GetDocument()->View()->UpdateAllLifecyclePhases( DocumentUpdateReason::kTest); }
diff --git a/third_party/blink/renderer/core/paint/css_mask_painter.cc b/third_party/blink/renderer/core/paint/css_mask_painter.cc index 25432d2..269bc6bc 100644 --- a/third_party/blink/renderer/core/paint/css_mask_painter.cc +++ b/third_party/blink/renderer/core/paint/css_mask_painter.cc
@@ -23,8 +23,9 @@ SVGResourcesCache::CachedResourcesForLayoutObject(object); LayoutSVGResourceMasker* masker = resources ? resources->Masker() : nullptr; if (masker) { - return EnclosingIntRect( - masker->ResourceBoundingBox(object.ObjectBoundingBox())); + const FloatRect reference_box = + SVGResources::ReferenceBoxForEffects(object); + return EnclosingIntRect(masker->ResourceBoundingBox(reference_box)); } }
diff --git a/third_party/blink/renderer/core/paint/html_canvas_painter_test.cc b/third_party/blink/renderer/core/paint/html_canvas_painter_test.cc index dc2531b..c3b20fb9 100644 --- a/third_party/blink/renderer/core/paint/html_canvas_painter_test.cc +++ b/third_party/blink/renderer/core/paint/html_canvas_painter_test.cc
@@ -71,7 +71,7 @@ // Insert a <canvas> and force it into accelerated mode. // Not using SetBodyInnerHTML() because we need to test before document // lifecyle update. - GetDocument().body()->SetInnerHTMLFromString("<canvas width=300 height=200>"); + GetDocument().body()->setInnerHTML("<canvas width=300 height=200>"); auto* element = To<HTMLCanvasElement>(GetDocument().body()->firstChild()); CanvasContextCreationAttributesCore attributes; attributes.alpha = true;
diff --git a/third_party/blink/renderer/core/paint/image_paint_timing_detector_test.cc b/third_party/blink/renderer/core/paint/image_paint_timing_detector_test.cc index fc53fe1..83f3a70 100644 --- a/third_party/blink/renderer/core/paint/image_paint_timing_detector_test.cc +++ b/third_party/blink/renderer/core/paint/image_paint_timing_detector_test.cc
@@ -176,8 +176,7 @@ void SetChildBodyInnerHTML(const String& content) { GetChildDocument()->SetBaseURLOverride(KURL("http://test.com")); - GetChildDocument()->body()->SetInnerHTMLFromString(content, - ASSERT_NO_EXCEPTION); + GetChildDocument()->body()->setInnerHTML(content, ASSERT_NO_EXCEPTION); child_mock_callback_manager_ = MakeGarbageCollected<MockPaintTimingCallbackManager>(); GetChildPaintTimingDetector()
diff --git a/third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.cc b/third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.cc index c1b1227d..f11fc87a 100644 --- a/third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.cc +++ b/third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.cc
@@ -300,7 +300,7 @@ Element* target = GetDocument().getElementById("target"); target->setAttribute(html_names::kStyleAttr, "transform: rotate(45deg); width: 200px"); - target->SetInnerHTMLFromString( + target->setInnerHTML( "<div id=child style='width: 50px; height: 50px; background: " "red'></div>"); UpdateAllLifecyclePhasesForTest(); @@ -538,7 +538,7 @@ Element* target = GetDocument().getElementById("target"); target->setAttribute(html_names::kClassAttr, "solid composited scroll local-attachment border"); - target->SetInnerHTMLFromString( + target->setInnerHTML( "<div id=child style='width: 500px; height: 500px'></div>", ASSERT_NO_EXCEPTION); Element* child = GetDocument().getElementById("child"); @@ -605,7 +605,7 @@ Element* target = GetDocument().getElementById("target"); target->setAttribute(html_names::kClassAttr, "gradient composited scroll local-attachment border"); - target->SetInnerHTMLFromString( + target->setInnerHTML( "<div id='child' style='width: 500px; height: 500px'></div>", ASSERT_NO_EXCEPTION); Element* child = GetDocument().getElementById("child"); @@ -674,7 +674,7 @@ Element* target = GetDocument().getElementById("target"); auto* object = target->GetLayoutObject(); target->setAttribute(html_names::kClassAttr, "solid local-attachment scroll"); - target->SetInnerHTMLFromString( + target->setInnerHTML( "<div id=child style='width: 500px; height: 500px'></div>", ASSERT_NO_EXCEPTION); Element* child = GetDocument().getElementById("child"); @@ -710,8 +710,8 @@ SetUpHTML(*this); Element* target = GetDocument().getElementById("target"); target->setAttribute(html_names::kClassAttr, "solid composited scroll"); - target->SetInnerHTMLFromString("<div style='height: 500px'></div>", - ASSERT_NO_EXCEPTION); + target->setInnerHTML("<div style='height: 500px'></div>", + ASSERT_NO_EXCEPTION); UpdateAllLifecyclePhasesForTest(); // Resize the scroller.
diff --git a/third_party/blink/renderer/core/paint/svg_filter_painter.cc b/third_party/blink/renderer/core/paint/svg_filter_painter.cc index 0917fbf..0f3b3b4 100644 --- a/third_party/blink/renderer/core/paint/svg_filter_painter.cc +++ b/third_party/blink/renderer/core/paint/svg_filter_painter.cc
@@ -101,7 +101,7 @@ } auto* node_map = MakeGarbageCollected<SVGFilterGraphNodeMap>(); - FilterEffectBuilder builder(object.ObjectBoundingBox(), 1); + FilterEffectBuilder builder(SVGResources::ReferenceBoxForEffects(object), 1); Filter* filter = builder.BuildReferenceFilter( To<SVGFilterElement>(*filter_.GetElement()), nullptr, node_map); if (!filter || !filter->LastEffect())
diff --git a/third_party/blink/renderer/core/paint/svg_mask_painter.cc b/third_party/blink/renderer/core/paint/svg_mask_painter.cc index a25f195..b2dbbb2 100644 --- a/third_party/blink/renderer/core/paint/svg_mask_painter.cc +++ b/third_party/blink/renderer/core/paint/svg_mask_painter.cc
@@ -5,6 +5,7 @@ #include "third_party/blink/renderer/core/paint/svg_mask_painter.h" #include "third_party/blink/renderer/core/layout/svg/layout_svg_resource_masker.h" +#include "third_party/blink/renderer/core/layout/svg/svg_resources.h" #include "third_party/blink/renderer/core/paint/object_paint_properties.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/platform/graphics/paint/drawing_display_item.h" @@ -41,7 +42,8 @@ AffineTransform content_transformation; sk_sp<const PaintRecord> record = mask_.CreatePaintRecord( - content_transformation, object.ObjectBoundingBox(), context); + content_transformation, SVGResources::ReferenceBoxForEffects(object), + context); if (DrawingRecorder::UseCachedDrawingIfPossible(context, display_item_client, DisplayItem::kSVGMask))
diff --git a/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc b/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc index 22947c0..f00c5d5 100644 --- a/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc +++ b/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc
@@ -149,8 +149,7 @@ void SetChildBodyInnerHTML(const String& content) { GetChildDocument()->SetBaseURLOverride(KURL("http://test.com")); - GetChildDocument()->body()->SetInnerHTMLFromString(content, - ASSERT_NO_EXCEPTION); + GetChildDocument()->body()->setInnerHTML(content, ASSERT_NO_EXCEPTION); child_frame_mock_callback_manager_ = MakeGarbageCollected<MockPaintTimingCallbackManager>(); GetChildFrameTextPaintTimingDetector()->ResetCallbackManager(
diff --git a/third_party/blink/renderer/core/svg/animation/svg_smil_element.cc b/third_party/blink/renderer/core/svg/animation/svg_smil_element.cc index 5ab1445..1e500568 100644 --- a/third_party/blink/renderer/core/svg/animation/svg_smil_element.cc +++ b/third_party/blink/renderer/core/svg/animation/svg_smil_element.cc
@@ -244,10 +244,12 @@ static inline void RemoveInstanceTimesWithOrigin( Vector<SMILTimeWithOrigin>& time_list, SMILTimeOrigin origin) { - for (int i = time_list.size() - 1; i >= 0; --i) { - if (time_list[i].Origin() == origin) - time_list.EraseAt(i); - } + auto* tail = + std::remove_if(time_list.begin(), time_list.end(), + [origin](const SMILTimeWithOrigin& instance_time) { + return instance_time.Origin() == origin; + }); + time_list.Shrink(tail - time_list.begin()); } void SVGSMILElement::Reset() {
diff --git a/third_party/blink/renderer/core/svg/svg_foreign_object_element_test.cc b/third_party/blink/renderer/core/svg/svg_foreign_object_element_test.cc index 42d0805..d3b9306 100644 --- a/third_party/blink/renderer/core/svg/svg_foreign_object_element_test.cc +++ b/third_party/blink/renderer/core/svg/svg_foreign_object_element_test.cc
@@ -14,7 +14,7 @@ class SVGForeignObjectElementTest : public PageTestBase {}; TEST_F(SVGForeignObjectElementTest, NoLayoutObjectInNonRendered) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <svg> <pattern> <foreignObject id="fo"></foreignObject> @@ -34,7 +34,7 @@ } TEST_F(SVGForeignObjectElementTest, ReferenceForeignObjectInNonRenderedCrash) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style> div { writing-mode: vertical-rl; } div > svg { float: right; }
diff --git a/third_party/blink/renderer/core/svg/svg_use_element_test.cc b/third_party/blink/renderer/core/svg/svg_use_element_test.cc index 5dd3b38..e26665f 100644 --- a/third_party/blink/renderer/core/svg/svg_use_element_test.cc +++ b/third_party/blink/renderer/core/svg/svg_use_element_test.cc
@@ -17,7 +17,7 @@ class SVGUseElementTest : public PageTestBase {}; TEST_F(SVGUseElementTest, InstanceInvalidatedWhenNonAttachedTargetRemoved) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <style></style> <svg> <unknown> @@ -47,7 +47,7 @@ TEST_F(SVGUseElementTest, InstanceInvalidatedWhenNonAttachedTargetMovedInDocument) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <svg> <use id="use" href="#path"/> <textPath id="path"> @@ -76,7 +76,7 @@ } TEST_F(SVGUseElementTest, NullInstanceRootWhenNotConnectedToDocument) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <svg> <defs> <rect id="r" width="100" height="100" fill="blue"/> @@ -96,7 +96,7 @@ } TEST_F(SVGUseElementTest, NullInstanceRootWhenConnectedToInactiveDocument) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <svg> <defs> <rect id="r" width="100" height="100" fill="blue"/> @@ -118,7 +118,7 @@ } TEST_F(SVGUseElementTest, NullInstanceRootWhenShadowTreePendingRebuild) { - GetDocument().body()->SetInnerHTMLFromString(R"HTML( + GetDocument().body()->setInnerHTML(R"HTML( <svg> <defs> <rect id="r" width="100" height="100" fill="blue"/>
diff --git a/third_party/blink/renderer/core/svg/unsafe_svg_attribute_sanitization_test.cc b/third_party/blink/renderer/core/svg/unsafe_svg_attribute_sanitization_test.cc index 0feb4c4..f34d9870 100644 --- a/third_party/blink/renderer/core/svg/unsafe_svg_attribute_sanitization_test.cc +++ b/third_party/blink/renderer/core/svg/unsafe_svg_attribute_sanitization_test.cc
@@ -84,7 +84,7 @@ test::RunPendingTasks(); EXPECT_TRUE(frame.GetEditor().ExecuteCommand("Paste")); - return body->InnerHTMLAsString(); + return body->innerHTML(); } // Integration tests.
diff --git a/third_party/blink/renderer/core/testing/core_unit_test_helper.cc b/third_party/blink/renderer/core/testing/core_unit_test_helper.cc index 4d1c5f4..6a4181e 100644 --- a/third_party/blink/renderer/core/testing/core_unit_test_helper.cc +++ b/third_party/blink/renderer/core/testing/core_unit_test_helper.cc
@@ -122,7 +122,7 @@ void RenderingTest::SetChildFrameHTML(const String& html) { ChildDocument().SetBaseURLOverride(KURL("http://test.com")); - ChildDocument().body()->SetInnerHTMLFromString(html, ASSERT_NO_EXCEPTION); + ChildDocument().body()->setInnerHTML(html, ASSERT_NO_EXCEPTION); // Setting HTML implies the frame loads contents, so we need to advance the // state machine to leave the initial empty document state.
diff --git a/third_party/blink/renderer/core/testing/fake_local_frame_host.cc b/third_party/blink/renderer/core/testing/fake_local_frame_host.cc index 202634d..3171be5 100644 --- a/third_party/blink/renderer/core/testing/fake_local_frame_host.cc +++ b/third_party/blink/renderer/core/testing/fake_local_frame_host.cc
@@ -96,6 +96,8 @@ void FakeLocalFrameHost::DidChangeLoadProgress(double load_progress) {} +void FakeLocalFrameHost::DidFinishLoad(const KURL& validated_url) {} + void FakeLocalFrameHost::DispatchLoad() {} void FakeLocalFrameHost::GoToEntryAtOffset(int32_t offset,
diff --git a/third_party/blink/renderer/core/testing/fake_local_frame_host.h b/third_party/blink/renderer/core/testing/fake_local_frame_host.h index 486c7c74..f73d577 100644 --- a/third_party/blink/renderer/core/testing/fake_local_frame_host.h +++ b/third_party/blink/renderer/core/testing/fake_local_frame_host.h
@@ -67,6 +67,7 @@ const KURL& initiator_url, mojom::NavigationBlockedReason reason) override; void DidChangeLoadProgress(double load_progress) override; + void DidFinishLoad(const KURL& validated_url) override; void DispatchLoad() override; void GoToEntryAtOffset(int32_t offset, bool has_user_gesture) override; void RenderFallbackContentInParentProcess() override;
diff --git a/third_party/blink/renderer/core/testing/page_test_base.cc b/third_party/blink/renderer/core/testing/page_test_base.cc index db02f83..e8f886ec 100644 --- a/third_party/blink/renderer/core/testing/page_test_base.cc +++ b/third_party/blink/renderer/core/testing/page_test_base.cc
@@ -176,8 +176,7 @@ // Both sets the inner html and runs the document lifecycle. void PageTestBase::SetBodyInnerHTML(const String& body_content) { - GetDocument().body()->SetInnerHTMLFromString(body_content, - ASSERT_NO_EXCEPTION); + GetDocument().body()->setInnerHTML(body_content, ASSERT_NO_EXCEPTION); UpdateAllLifecyclePhasesForTest(); } @@ -186,8 +185,7 @@ } void PageTestBase::SetHtmlInnerHTML(const std::string& html_content) { - GetDocument().documentElement()->SetInnerHTMLFromString( - String::FromUTF8(html_content)); + GetDocument().documentElement()->setInnerHTML(String::FromUTF8(html_content)); UpdateAllLifecyclePhasesForTest(); }
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_html.idl b/third_party/blink/renderer/core/trustedtypes/trusted_html.idl index b966780..6db167e 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_html.idl +++ b/third_party/blink/renderer/core/trustedtypes/trusted_html.idl
@@ -4,7 +4,7 @@ // https://github.com/wicg/trusted-types -typedef (DOMString or TrustedHTML) HTMLString; +typedef [StringContext=TrustedHTML] DOMString HTMLString; [ Exposed=Window,
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_script.idl b/third_party/blink/renderer/core/trustedtypes/trusted_script.idl index 0f0d66e..34f29af 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_script.idl +++ b/third_party/blink/renderer/core/trustedtypes/trusted_script.idl
@@ -4,7 +4,7 @@ // https://github.com/wicg/trusted-types -typedef (DOMString or TrustedScript) ScriptString; +typedef [StringContext=TrustedScript] DOMString ScriptString; [ Exposed=Window,
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_script_url.idl b/third_party/blink/renderer/core/trustedtypes/trusted_script_url.idl index 566adc2..84695e2 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_script_url.idl +++ b/third_party/blink/renderer/core/trustedtypes/trusted_script_url.idl
@@ -4,7 +4,7 @@ // https://github.com/wicg/trusted-types -typedef (DOMString or TrustedScriptURL) ScriptURLString; +typedef [StringContext=TrustedScriptURL] USVString ScriptURLString; [ Exposed=Window,
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 43c6a563..00b6c91b 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_types_util.cc +++ b/third_party/blink/renderer/core/trustedtypes/trusted_types_util.cc
@@ -6,10 +6,8 @@ #include "third_party/blink/public/mojom/reporting/reporting.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_html.h" #include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_html_or_trusted_script_or_trusted_script_url.h" #include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_script.h" -#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_script_url.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/window_proxy_manager.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" @@ -271,14 +269,6 @@ return result->toString(); } -String TrustedTypesCheckForHTML(StringOrTrustedHTML string_or_trusted_html, - const Document* document, - ExceptionState& exception_state) { - return TrustedTypesCheckForHTML( - string_or_trusted_html, - document ? document->ToExecutionContext() : nullptr, exception_state); -} - String TrustedTypesCheckForHTML(const String& html, const Document* document, ExceptionState& exception_state) { @@ -409,17 +399,6 @@ return TrustedTypesCheckFor(type, value, execution_context, exception_state); } -String TrustedTypesCheckForHTML(StringOrTrustedHTML trusted, - const ExecutionContext* execution_context, - ExceptionState& exception_state) { - DCHECK(!trusted.IsNull()); - if (trusted.IsTrustedHTML()) { - return trusted.GetAsTrustedHTML()->toString(); - } - return TrustedTypesCheckForHTML(trusted.GetAsString(), execution_context, - exception_state); -} - String TrustedTypesCheckForScript(StringOrTrustedScript trusted, const ExecutionContext* execution_context, ExceptionState& exception_state) { @@ -437,16 +416,6 @@ return TrustedTypesCheckForScript(trusted.GetAsString(), execution_context, exception_state); } -String TrustedTypesCheckForScriptURL(StringOrTrustedScriptURL trusted, - const ExecutionContext* execution_context, - ExceptionState& exception_state) { - DCHECK(!trusted.IsNull()); - if (trusted.IsTrustedScriptURL()) { - return trusted.GetAsTrustedScriptURL()->toString(); - } - return TrustedTypesCheckForScriptURL(trusted.GetAsString(), execution_context, - exception_state); -} String TrustedTypesCheckFor(SpecificTrustedType type, const String& trusted,
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_types_util.h b/third_party/blink/renderer/core/trustedtypes/trusted_types_util.h index 152a10b..45df571 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_types_util.h +++ b/third_party/blink/renderer/core/trustedtypes/trusted_types_util.h
@@ -13,10 +13,8 @@ class Document; class ExecutionContext; class ExceptionState; -class StringOrTrustedHTML; class StringOrTrustedHTMLOrTrustedScriptOrTrustedScriptURL; class StringOrTrustedScript; -class StringOrTrustedScriptURL; enum class SpecificTrustedType { kNone, @@ -27,12 +25,9 @@ // TODO(crbug.com/1029822): Temporary helpers to ease migrating ExecutionContext // to LocalDOMWindow. -CORE_EXPORT String TrustedTypesCheckForHTML(StringOrTrustedHTML, +CORE_EXPORT String TrustedTypesCheckForHTML(const String&, const Document*, ExceptionState&); -String TrustedTypesCheckForHTML(const String&, - const Document*, - ExceptionState&); // Perform Trusted Type checks, with the IDL union types as input. All of these // will call String& versions below to do the heavy lifting. @@ -41,17 +36,10 @@ const StringOrTrustedHTMLOrTrustedScriptOrTrustedScriptURL&, const ExecutionContext*, ExceptionState&) WARN_UNUSED_RESULT; -String TrustedTypesCheckForHTML(StringOrTrustedHTML, - const ExecutionContext*, - ExceptionState&) WARN_UNUSED_RESULT; CORE_EXPORT String TrustedTypesCheckForScript(StringOrTrustedScript, const ExecutionContext*, ExceptionState&) WARN_UNUSED_RESULT; -CORE_EXPORT String TrustedTypesCheckForScriptURL(StringOrTrustedScriptURL, - const ExecutionContext*, - ExceptionState&) - WARN_UNUSED_RESULT; // Perform Trusted Type checks, for a dynamically or statically determined // type. @@ -61,15 +49,17 @@ const String&, const ExecutionContext*, ExceptionState&) WARN_UNUSED_RESULT; -String TrustedTypesCheckForHTML(const String&, - const ExecutionContext*, - ExceptionState&) WARN_UNUSED_RESULT; -String TrustedTypesCheckForScript(const String&, - const ExecutionContext*, - ExceptionState&) WARN_UNUSED_RESULT; -String TrustedTypesCheckForScriptURL(const String&, - const ExecutionContext*, - ExceptionState&) WARN_UNUSED_RESULT; +CORE_EXPORT String TrustedTypesCheckForHTML(const String&, + const ExecutionContext*, + ExceptionState&) WARN_UNUSED_RESULT; +CORE_EXPORT String TrustedTypesCheckForScript(const String&, + const ExecutionContext*, + ExceptionState&) + WARN_UNUSED_RESULT; +CORE_EXPORT String TrustedTypesCheckForScriptURL(const String&, + const ExecutionContext*, + ExceptionState&) + WARN_UNUSED_RESULT; // Functionally equivalent to TrustedTypesCheckForScript(const String&, ...), // but with setup & error handling suitable for the asynchronous execution
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_types_util_test.cc b/third_party/blink/renderer/core/trustedtypes/trusted_types_util_test.cc index 36f4c9a..e29bb484 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_types_util_test.cc +++ b/third_party/blink/renderer/core/trustedtypes/trusted_types_util_test.cc
@@ -6,10 +6,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_html.h" #include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_html_or_trusted_script_or_trusted_script_url.h" #include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_script.h" -#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_script_url.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" @@ -22,8 +20,7 @@ namespace blink { -void TrustedTypesCheckForHTMLThrows( - const StringOrTrustedHTML& string_or_trusted_html) { +void TrustedTypesCheckForHTMLThrows(const String& string) { auto dummy_page_holder = std::make_unique<DummyPageHolder>(IntSize(800, 600)); Document& document = dummy_page_holder->GetDocument(); document.GetContentSecurityPolicy()->DidReceiveHeader( @@ -32,8 +29,7 @@ V8TestingScope scope; DummyExceptionStateForTesting exception_state; ASSERT_FALSE(exception_state.HadException()); - String s = TrustedTypesCheckForHTML(string_or_trusted_html, &document, - exception_state); + String s = TrustedTypesCheckForHTML(string, &document, exception_state); EXPECT_FALSE(exception_state.HadException()); document.GetContentSecurityPolicy()->DidReceiveHeader( @@ -41,15 +37,13 @@ network::mojom::ContentSecurityPolicyType::kEnforce, network::mojom::ContentSecurityPolicySource::kMeta); ASSERT_FALSE(exception_state.HadException()); - String s1 = TrustedTypesCheckForHTML(string_or_trusted_html, &document, - exception_state); + String s1 = TrustedTypesCheckForHTML(string, &document, exception_state); EXPECT_TRUE(exception_state.HadException()); EXPECT_EQ(ESErrorType::kTypeError, exception_state.CodeAs<ESErrorType>()); exception_state.ClearException(); } -void TrustedTypesCheckForScriptThrows( - const StringOrTrustedScript& string_or_trusted_script) { +void TrustedTypesCheckForScriptThrows(const String& string) { auto dummy_page_holder = std::make_unique<DummyPageHolder>(IntSize(800, 600)); Document& document = dummy_page_holder->GetDocument(); document.GetContentSecurityPolicy()->DidReceiveHeader( @@ -58,8 +52,8 @@ V8TestingScope scope; DummyExceptionStateForTesting exception_state; ASSERT_FALSE(exception_state.HadException()); - String s = TrustedTypesCheckForScript( - string_or_trusted_script, document.ToExecutionContext(), exception_state); + String s = TrustedTypesCheckForScript(string, document.ToExecutionContext(), + exception_state); EXPECT_FALSE(exception_state.HadException()); document.GetContentSecurityPolicy()->DidReceiveHeader( @@ -67,15 +61,14 @@ network::mojom::ContentSecurityPolicyType::kEnforce, network::mojom::ContentSecurityPolicySource::kMeta); ASSERT_FALSE(exception_state.HadException()); - String s1 = TrustedTypesCheckForScript( - string_or_trusted_script, document.ToExecutionContext(), exception_state); + String s1 = TrustedTypesCheckForScript(string, document.ToExecutionContext(), + exception_state); EXPECT_TRUE(exception_state.HadException()); EXPECT_EQ(ESErrorType::kTypeError, exception_state.CodeAs<ESErrorType>()); exception_state.ClearException(); } -void TrustedTypesCheckForScriptURLThrows( - const StringOrTrustedScriptURL& string_or_trusted_script_url) { +void TrustedTypesCheckForScriptURLThrows(const String& string) { auto dummy_page_holder = std::make_unique<DummyPageHolder>(IntSize(800, 600)); Document& document = dummy_page_holder->GetDocument(); document.GetContentSecurityPolicy()->DidReceiveHeader( @@ -84,9 +77,8 @@ V8TestingScope scope; DummyExceptionStateForTesting exception_state; ASSERT_FALSE(exception_state.HadException()); - String s = TrustedTypesCheckForScriptURL(string_or_trusted_script_url, - document.ToExecutionContext(), - exception_state); + String s = TrustedTypesCheckForScriptURL( + string, document.ToExecutionContext(), exception_state); EXPECT_FALSE(exception_state.HadException()); document.GetContentSecurityPolicy()->DidReceiveHeader( @@ -94,29 +86,13 @@ network::mojom::ContentSecurityPolicyType::kEnforce, network::mojom::ContentSecurityPolicySource::kMeta); ASSERT_FALSE(exception_state.HadException()); - String s1 = TrustedTypesCheckForScriptURL(string_or_trusted_script_url, - document.ToExecutionContext(), - exception_state); + String s1 = TrustedTypesCheckForScriptURL( + string, document.ToExecutionContext(), exception_state); EXPECT_TRUE(exception_state.HadException()); EXPECT_EQ(ESErrorType::kTypeError, exception_state.CodeAs<ESErrorType>()); exception_state.ClearException(); } -void TrustedTypesCheckForHTMLWorks( - const StringOrTrustedHTML& string_or_trusted_html, - String expected) { - auto dummy_page_holder = std::make_unique<DummyPageHolder>(IntSize(800, 600)); - Document& document = dummy_page_holder->GetDocument(); - document.GetContentSecurityPolicy()->DidReceiveHeader( - "trusted-types *", network::mojom::ContentSecurityPolicyType::kEnforce, - network::mojom::ContentSecurityPolicySource::kMeta); - V8TestingScope scope; - DummyExceptionStateForTesting exception_state; - String s = TrustedTypesCheckForHTML(string_or_trusted_html, &document, - exception_state); - ASSERT_EQ(s, expected); -} - void TrustedTypesCheckForScriptWorks( const StringOrTrustedScript& string_or_trusted_script, String expected) { @@ -132,34 +108,9 @@ ASSERT_EQ(s, expected); } -void TrustedTypesCheckForScriptURLWorks( - const StringOrTrustedScriptURL& string_or_trusted_script_url, - String expected) { - auto dummy_page_holder = std::make_unique<DummyPageHolder>(IntSize(800, 600)); - Document& document = dummy_page_holder->GetDocument(); - document.GetContentSecurityPolicy()->DidReceiveHeader( - "trusted-types *", network::mojom::ContentSecurityPolicyType::kEnforce, - network::mojom::ContentSecurityPolicySource::kMeta); - V8TestingScope scope; - DummyExceptionStateForTesting exception_state; - String s = TrustedTypesCheckForScriptURL(string_or_trusted_script_url, - document.ToExecutionContext(), - exception_state); - ASSERT_EQ(s, expected); -} - // TrustedTypesCheckForHTML tests -TEST(TrustedTypesUtilTest, TrustedTypesCheckForHTML_TrustedHTML) { - auto* html = MakeGarbageCollected<TrustedHTML>("A string"); - StringOrTrustedHTML trusted_value = - StringOrTrustedHTML::FromTrustedHTML(html); - TrustedTypesCheckForHTMLWorks(trusted_value, "A string"); -} - TEST(TrustedTypesUtilTest, TrustedTypesCheckForHTML_String) { - StringOrTrustedHTML string_value = - StringOrTrustedHTML::FromString("A string"); - TrustedTypesCheckForHTMLThrows(string_value); + TrustedTypesCheckForHTMLThrows("A string"); } // TrustedTypesCheckForScript tests @@ -171,23 +122,11 @@ } TEST(TrustedTypesUtilTest, TrustedTypesCheckForScript_String) { - StringOrTrustedScript string_value = - StringOrTrustedScript::FromString("A string"); - TrustedTypesCheckForScriptThrows(string_value); + TrustedTypesCheckForScriptThrows("A string"); } // TrustedTypesCheckForScriptURL tests -TEST(TrustedTypesUtilTest, TrustedTypesCheckForScriptURL_TrustedScriptURL) { - String url_address = "http://www.example.com/"; - auto* script_url = MakeGarbageCollected<TrustedScriptURL>(url_address); - StringOrTrustedScriptURL trusted_value = - StringOrTrustedScriptURL::FromTrustedScriptURL(script_url); - TrustedTypesCheckForScriptURLWorks(trusted_value, "http://www.example.com/"); -} - TEST(TrustedTypesUtilTest, TrustedTypesCheckForScriptURL_String) { - StringOrTrustedScriptURL string_value = - StringOrTrustedScriptURL::FromString("A string"); - TrustedTypesCheckForScriptURLThrows(string_value); + TrustedTypesCheckForScriptURLThrows("A string"); } } // namespace blink
diff --git a/third_party/blink/renderer/core/workers/worker_global_scope.cc b/third_party/blink/renderer/core/workers/worker_global_scope.cc index bb08f9e..72c7dce 100644 --- a/third_party/blink/renderer/core/workers/worker_global_scope.cc +++ b/third_party/blink/renderer/core/workers/worker_global_scope.cc
@@ -33,7 +33,6 @@ #include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/source_location.h" -#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_script_url.h" #include "third_party/blink/renderer/bindings/core/v8/v8_void_function.h" #include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h" #include "third_party/blink/renderer/core/css/font_face_set_worker.h" @@ -169,18 +168,9 @@ return GetSecurityOrigin()->ToString(); } -void WorkerGlobalScope::importScripts( - const HeapVector<StringOrTrustedScriptURL>& urls, - ExceptionState& exception_state) { - Vector<String> string_urls; - for (const StringOrTrustedScriptURL& stringOrUrl : urls) { - String string_url = TrustedTypesCheckForScriptURL( - stringOrUrl, GetExecutionContext(), exception_state); - if (exception_state.HadException()) - return; - string_urls.push_back(string_url); - } - ImportScriptsInternal(string_urls, exception_state); +void WorkerGlobalScope::importScripts(const Vector<String>& urls, + ExceptionState& exception_state) { + ImportScriptsInternal(urls, exception_state); } // Implementation of the "import scripts into worker global scope" algorithm:
diff --git a/third_party/blink/renderer/core/workers/worker_global_scope.h b/third_party/blink/renderer/core/workers/worker_global_scope.h index ede83740..b712790 100644 --- a/third_party/blink/renderer/core/workers/worker_global_scope.h +++ b/third_party/blink/renderer/core/workers/worker_global_scope.h
@@ -55,7 +55,6 @@ class InstalledScriptsManager; class OffscreenFontSelector; class WorkerResourceTimingNotifier; -class StringOrTrustedScriptURL; class TrustedTypePolicyFactory; class V8VoidFunction; class WorkerLocation; @@ -104,8 +103,7 @@ DEFINE_ATTRIBUTE_EVENT_LISTENER(unhandledrejection, kUnhandledrejection) // WorkerUtils - virtual void importScripts(const HeapVector<StringOrTrustedScriptURL>& urls, - ExceptionState&); + virtual void importScripts(const Vector<String>& urls, ExceptionState&); // ExecutionContext const KURL& Url() const final;
diff --git a/third_party/blink/renderer/core/xml/dom_parser.cc b/third_party/blink/renderer/core/xml/dom_parser.cc index a60e49c8..c03568e6 100644 --- a/third_party/blink/renderer/core/xml/dom_parser.cc +++ b/third_party/blink/renderer/core/xml/dom_parser.cc
@@ -18,30 +18,16 @@ */ #include "third_party/blink/renderer/core/xml/dom_parser.h" -#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_html.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/document_init.h" #include "third_party/blink/renderer/core/dom/dom_implementation.h" -#include "third_party/blink/renderer/core/trustedtypes/trusted_types_util.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink { -Document* DOMParser::parseFromString(const StringOrTrustedHTML& stringOrHTML, - const String& type, - ExceptionState& exception_state) { - String value = TrustedTypesCheckForHTML(stringOrHTML, context_document_, - exception_state); - if (!exception_state.HadException()) { - return parseFromStringInternal(value, type); - } - return nullptr; -} - -Document* DOMParser::parseFromStringInternal(const String& str, - const String& type) { +Document* DOMParser::parseFromString(const String& str, const String& type) { Document* doc = DOMImplementation::createDocument( DocumentInit::Create() .WithTypeFrom(type)
diff --git a/third_party/blink/renderer/core/xml/dom_parser.h b/third_party/blink/renderer/core/xml/dom_parser.h index 60aabaa..058ee51 100644 --- a/third_party/blink/renderer/core/xml/dom_parser.h +++ b/third_party/blink/renderer/core/xml/dom_parser.h
@@ -27,8 +27,6 @@ namespace blink { class Document; -class StringOrTrustedHTML; -class ExceptionState; class DOMParser final : public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -40,18 +38,13 @@ explicit DOMParser(Document&); - Document* parseFromString(const StringOrTrustedHTML&, - const String& type, - ExceptionState& exception_state); - Document* parseFromString(const StringOrTrustedHTML&, const String& type); + Document* parseFromString(const String&, const String& type); void Trace(Visitor*) override; Document* GetDocument() const; private: - Document* parseFromStringInternal(const String&, const String& type); - WeakMember<Document> context_document_; };
diff --git a/third_party/blink/renderer/core/xml/dom_parser.idl b/third_party/blink/renderer/core/xml/dom_parser.idl index 5780226..26dbfd8 100644 --- a/third_party/blink/renderer/core/xml/dom_parser.idl +++ b/third_party/blink/renderer/core/xml/dom_parser.idl
@@ -31,5 +31,5 @@ Exposed=Window ] interface DOMParser { [CallWith=Document] constructor(); - [NewObject, RaisesException] Document parseFromString(HTMLString str, SupportedType type); + [NewObject] Document parseFromString(HTMLString str, SupportedType type); };
diff --git a/third_party/blink/renderer/modules/accessibility/testing/accessibility_selection_test.cc b/third_party/blink/renderer/modules/accessibility/testing/accessibility_selection_test.cc index 13c38b5..9056487 100644 --- a/third_party/blink/renderer/modules/accessibility/testing/accessibility_selection_test.cc +++ b/third_party/blink/renderer/modules/accessibility/testing/accessibility_selection_test.cc
@@ -207,7 +207,7 @@ // parts of the tree indicated by the selection markers in the snippet. const Vector<AXSelection> Deserialize(const std::string& html_snippet, HTMLElement& element) { - element.SetInnerHTMLFromString(String::FromUTF8(html_snippet)); + element.setInnerHTML(String::FromUTF8(html_snippet)); element.GetDocument().View()->UpdateAllLifecyclePhases( DocumentUpdateReason::kTest); AXObject* root = ax_object_cache_->GetOrCreate(&element);
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_api_test.cc b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_api_test.cc index cf96fb7d..79a5ddca 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_api_test.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_api_test.cc
@@ -61,7 +61,7 @@ void CanvasRenderingContext2DAPITest::SetUp() { PageTestBase::SetUp(); - GetDocument().documentElement()->SetInnerHTMLFromString( + GetDocument().documentElement()->setInnerHTML( "<body><canvas id='c'></canvas></body>"); UpdateAllLifecyclePhasesForTest(); canvas_element_ = To<HTMLCanvasElement>(GetDocument().getElementById("c")); @@ -305,7 +305,7 @@ } void ResetCanvasForAccessibilityRectTest(Document& document) { - document.documentElement()->SetInnerHTMLFromString(R"HTML( + document.documentElement()->setInnerHTML(R"HTML( <canvas id='canvas' style='position:absolute; top:0px; left:0px; padding:10px; margin:5px;'> <button id='button'></button></canvas>
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_test.cc b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_test.cc index bf6055d5..e65aa50 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_test.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_test.cc
@@ -219,7 +219,7 @@ web_view_helper_ = std::make_unique<frame_test_helpers::WebViewHelper>(); web_view_helper_->Initialize(); - GetDocument().documentElement()->SetInnerHTMLFromString(String::FromUTF8( + GetDocument().documentElement()->setInnerHTML(String::FromUTF8( "<body><canvas id='c'></canvas><canvas id='d'></canvas></body>")); UpdateAllLifecyclePhasesForTest();
diff --git a/third_party/blink/renderer/modules/canvas/canvas_fuzzer.cc b/third_party/blink/renderer/modules/canvas/canvas_fuzzer.cc index 3e25343..0ac85236 100644 --- a/third_party/blink/renderer/modules/canvas/canvas_fuzzer.cc +++ b/third_party/blink/renderer/modules/canvas/canvas_fuzzer.cc
@@ -44,7 +44,7 @@ void SetBodyContentFromFuzzer(const uint8_t* data, size_t size) { FuzzedDataProvider provider(data, size); std::string body_content = provider.ConsumeBytesAsString(size); - GetDocument().documentElement()->SetInnerHTMLFromString( + GetDocument().documentElement()->setInnerHTML( String::FromUTF8(body_content)); UpdateAllLifecyclePhasesForTest(); }
diff --git a/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module_test.cc b/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module_test.cc index cf5f4e65..557a5eb0 100644 --- a/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module_test.cc +++ b/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module_test.cc
@@ -60,7 +60,7 @@ protected: void SetUp() override { web_view_helper_.Initialize(); - GetDocument().documentElement()->SetInnerHTMLFromString( + GetDocument().documentElement()->setInnerHTML( String::FromUTF8("<body><canvas id='c'></canvas></body>")); canvas_element_ = To<HTMLCanvasElement>(GetDocument().getElementById("c")); }
diff --git a/third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_test.cc b/third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_test.cc index 72ba740a..3c987435 100644 --- a/third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_test.cc +++ b/third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_test.cc
@@ -84,7 +84,7 @@ web_view_helper_.Initialize(); - GetDocument().documentElement()->SetInnerHTMLFromString( + GetDocument().documentElement()->setInnerHTML( String::FromUTF8("<body><canvas id='c'></canvas></body>")); auto* canvas_element =
diff --git a/third_party/blink/renderer/modules/document_metadata/document_metadata_extractor_test.cc b/third_party/blink/renderer/modules/document_metadata/document_metadata_extractor_test.cc index ad98dea..d0962fa 100644 --- a/third_party/blink/renderer/modules/document_metadata/document_metadata_extractor_test.cc +++ b/third_party/blink/renderer/modules/document_metadata/document_metadata_extractor_test.cc
@@ -60,7 +60,7 @@ void DocumentMetadataExtractorTest::SetHTMLInnerHTML( const String& html_content) { - GetDocument().documentElement()->SetInnerHTMLFromString((html_content)); + GetDocument().documentElement()->setInnerHTML((html_content)); } void DocumentMetadataExtractorTest::SetURL(const String& url) {
diff --git a/third_party/blink/renderer/modules/media_controls/elements/media_control_animated_arrow_container_element.cc b/third_party/blink/renderer/modules/media_controls/elements/media_control_animated_arrow_container_element.cc index 63298638..69e49fa 100644 --- a/third_party/blink/renderer/modules/media_controls/elements/media_control_animated_arrow_container_element.cc +++ b/third_party/blink/renderer/modules/media_controls/elements/media_control_animated_arrow_container_element.cc
@@ -36,7 +36,7 @@ return; } - SetInnerHTMLFromString(MediaControlsResourceLoader::GetJumpSVGImage()); + setInnerHTML(MediaControlsResourceLoader::GetJumpSVGImage()); last_arrow_ = getElementById("arrow-3"); svg_container_ = getElementById("jump");
diff --git a/third_party/blink/renderer/modules/media_controls/elements/media_control_scrubbing_message_element.cc b/third_party/blink/renderer/modules/media_controls/elements/media_control_scrubbing_message_element.cc index d9e9c8f..84d56ac 100644 --- a/third_party/blink/renderer/modules/media_controls/elements/media_control_scrubbing_message_element.cc +++ b/third_party/blink/renderer/modules/media_controls/elements/media_control_scrubbing_message_element.cc
@@ -47,16 +47,16 @@ HTMLDivElement* arrow_right_div2 = MediaControlElementsHelper::CreateDivWithId("arrow-right2", shadow_root); - arrow_left_div1->SetInnerHTMLFromString( + arrow_left_div1->setInnerHTML( MediaControlsResourceLoader::GetArrowLeftSVGImage()); - arrow_left_div2->SetInnerHTMLFromString( + arrow_left_div2->setInnerHTML( MediaControlsResourceLoader::GetArrowLeftSVGImage()); message_div->setInnerText( MediaElement().GetLocale().QueryString(IDS_MEDIA_SCRUBBING_MESSAGE_TEXT), ASSERT_NO_EXCEPTION); - arrow_right_div1->SetInnerHTMLFromString( + arrow_right_div1->setInnerHTML( MediaControlsResourceLoader::GetArrowRightSVGImage()); - arrow_right_div2->SetInnerHTMLFromString( + arrow_right_div2->setInnerHTML( MediaControlsResourceLoader::GetArrowRightSVGImage()); }
diff --git a/third_party/blink/renderer/modules/media_controls/media_controls_impl.cc b/third_party/blink/renderer/modules/media_controls/media_controls_impl.cc index 02e0864..83de0f7 100644 --- a/third_party/blink/renderer/modules/media_controls/media_controls_impl.cc +++ b/third_party/blink/renderer/modules/media_controls/media_controls_impl.cc
@@ -603,9 +603,9 @@ void MediaControlsImpl::PopulatePanel() { // Clear the panels. - panel_->SetInnerHTMLFromString(""); + panel_->setInnerHTML(""); if (media_button_panel_) - media_button_panel_->SetInnerHTMLFromString(""); + media_button_panel_->setInnerHTML(""); Element* button_panel = panel_; if (ShouldShowVideoControls()) {
diff --git a/third_party/blink/renderer/modules/media_controls/media_controls_impl_test.cc b/third_party/blink/renderer/modules/media_controls/media_controls_impl_test.cc index 94b62eb..8306068 100644 --- a/third_party/blink/renderer/modules/media_controls/media_controls_impl_test.cc +++ b/third_party/blink/renderer/modules/media_controls/media_controls_impl_test.cc
@@ -1088,7 +1088,7 @@ WeakPersistent<HTMLMediaElement> weak_persistent_video = element; { Persistent<HTMLMediaElement> persistent_video = element; - page_holder->GetDocument().body()->SetInnerHTMLFromString(""); + page_holder->GetDocument().body()->setInnerHTML(""); // When removed from the document, the event listeners should have been // dropped.
diff --git a/third_party/blink/renderer/modules/peerconnection/peer_connection_tracker.cc b/third_party/blink/renderer/modules/peerconnection/peer_connection_tracker.cc index 29ffe3a..da8d1e0c 100644 --- a/third_party/blink/renderer/modules/peerconnection/peer_connection_tracker.cc +++ b/third_party/blink/renderer/modules/peerconnection/peer_connection_tracker.cc
@@ -144,6 +144,9 @@ return "'recvonly'"; case webrtc::RtpTransceiverDirection::kInactive: return "'inactive'"; + default: + NOTREACHED(); + return String(); } }
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver.cc b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver.cc index ce9377a..0dae6df 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver.cc
@@ -28,6 +28,9 @@ return "recvonly"; case webrtc::RtpTransceiverDirection::kInactive: return "inactive"; + default: + NOTREACHED(); + return String(); } }
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver.idl b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver.idl index 7b7ef2c2..5fdb827 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver.idl +++ b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver.idl
@@ -7,7 +7,8 @@ "sendrecv", "sendonly", "recvonly", - "inactive" + "inactive", + "stopped" }; // https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc index 62c62c4..b4c529f9 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
@@ -52,7 +52,6 @@ #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" #include "third_party/blink/renderer/bindings/core/v8/source_location.h" -#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_script_url.h" #include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_background_fetch_event_init.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_content_index_event_init.h" @@ -786,14 +785,9 @@ return it != unresponded_fetch_event_counts_.end(); } -void ServiceWorkerGlobalScope::importScripts( - const HeapVector<StringOrTrustedScriptURL>& urls, - ExceptionState& exception_state) { - for (const StringOrTrustedScriptURL& stringOrUrl : urls) { - String string_url = stringOrUrl.IsString() - ? stringOrUrl.GetAsString() - : stringOrUrl.GetAsTrustedScriptURL()->toString(); - +void ServiceWorkerGlobalScope::importScripts(const Vector<String>& urls, + ExceptionState& exception_state) { + for (const String& string_url : urls) { KURL completed_url = CompleteURL(string_url); if (installed_scripts_manager_ && !installed_scripts_manager_->IsScriptInstalled(completed_url)) {
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h index 5e8f843..e5d3313 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h +++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h
@@ -70,7 +70,6 @@ class ServiceWorkerInstalledScriptsManager; class ServiceWorkerRegistration; class ServiceWorkerThread; -class StringOrTrustedScriptURL; class WaitUntilObserver; class WebURLResponse; class WorkerClassicScriptLoader; @@ -315,8 +314,7 @@ std::unique_ptr<Vector<uint8_t>>* out_cached_meta_data) override; private: - void importScripts(const HeapVector<StringOrTrustedScriptURL>& urls, - ExceptionState&) override; + void importScripts(const Vector<String>& urls, ExceptionState&) override; SingleCachedMetadataHandler* CreateWorkerScriptCachedMetadataHandler( const KURL& script_url, std::unique_ptr<Vector<uint8_t>> meta_data) override;
diff --git a/third_party/blink/renderer/platform/bindings/parkable_string.cc b/third_party/blink/renderer/platform/bindings/parkable_string.cc index ded025f..e2f8e56 100644 --- a/third_party/blink/renderer/platform/bindings/parkable_string.cc +++ b/third_party/blink/renderer/platform/bindings/parkable_string.cc
@@ -186,6 +186,18 @@ kLocked }; +ParkableStringImpl::ParkableMetadata::ParkableMetadata( + String string, + std::unique_ptr<SecureDigest> digest) + : mutex_(), + lock_depth_(0), + state_(State::kUnparked), + compressed_(nullptr), + digest_(*digest), + is_young_(true), + is_8bit_(string.Is8Bit()), + length_(string.length()) {} + // static std::unique_ptr<ParkableStringImpl::SecureDigest> ParkableStringImpl::HashString(StringImpl* string) { @@ -224,15 +236,10 @@ ParkableStringImpl::ParkableStringImpl(scoped_refptr<StringImpl>&& impl, std::unique_ptr<SecureDigest> digest) - : mutex_(), - lock_depth_(0), - state_(State::kUnparked), - string_(std::move(impl)), - compressed_(nullptr), - digest_(std::move(digest)), - is_young_(true), - is_8bit_(string_.Is8Bit()), - length_(string_.length()) + : string_(std::move(impl)), + metadata_(digest ? std::make_unique<ParkableMetadata>(string_, + std::move(digest)) + : nullptr) #if DCHECK_IS_ON() , owning_thread_(CurrentThread()) @@ -248,7 +255,8 @@ DCHECK_EQ(0, lock_depth_for_testing()); AsanUnpoisonString(string_); - DCHECK(state_ == State::kParked || state_ == State::kUnparked); + DCHECK(metadata_->state_ == State::kParked || + metadata_->state_ == State::kUnparked); ParkableStringManager::Instance().Remove(this); } @@ -257,8 +265,8 @@ if (!may_be_parked()) return; - MutexLocker locker(mutex_); - lock_depth_ += 1; + MutexLocker locker(metadata_->mutex_); + metadata_->lock_depth_ += 1; // Make young as this is a strong (but not certain) indication that the string // will be accessed soon. MakeYoung(); @@ -268,8 +276,8 @@ void ParkableStringImpl::LockWithoutMakingYoung() { DCHECK(may_be_parked()); - MutexLocker locker(mutex_); - lock_depth_ += 1; + MutexLocker locker(metadata_->mutex_); + metadata_->lock_depth_ += 1; } #endif // defined(ADDRESS_SANITIZER) @@ -278,9 +286,9 @@ if (!may_be_parked()) return; - MutexLocker locker(mutex_); - DCHECK_GT(lock_depth_, 0); - lock_depth_ -= 1; + MutexLocker locker(metadata_->mutex_); + DCHECK_GT(metadata_->lock_depth_, 0); + metadata_->lock_depth_ -= 1; #if defined(ADDRESS_SANITIZER) && DCHECK_IS_ON() // There are no external references to the data, nobody should touch the data. @@ -302,13 +310,8 @@ void ParkableStringImpl::PurgeMemory() { AssertOnValidThread(); - if (state_ == State::kUnparked) - compressed_ = nullptr; -} - -void ParkableStringImpl::MakeYoung() { - mutex_.AssertAcquired(); - is_young_ = true; + if (metadata_->state_ == State::kUnparked) + metadata_->compressed_ = nullptr; } const String& ParkableStringImpl::ToString() { @@ -316,7 +319,7 @@ if (!may_be_parked()) return string_; - MutexLocker locker(mutex_); + MutexLocker locker(metadata_->mutex_); MakeYoung(); AsanUnpoisonString(string_); Unpark(); @@ -325,21 +328,42 @@ unsigned ParkableStringImpl::CharactersSizeInBytes() const { AssertOnValidThread(); - return length_ * (is_8bit() ? sizeof(LChar) : sizeof(UChar)); + if (!may_be_parked()) + return string_.CharactersSizeInBytes(); + + return metadata_->length_ * (is_8bit() ? sizeof(LChar) : sizeof(UChar)); +} + +size_t ParkableStringImpl::MemoryFootprintForDump() const { + AssertOnValidThread(); + size_t size = sizeof(ParkableStringImpl); + + if (!may_be_parked()) + return size + string_.CharactersSizeInBytes(); + + size += sizeof(ParkableMetadata); + + if (!is_parked()) + size += string_.CharactersSizeInBytes(); + + if (metadata_->compressed_) + size += metadata_->compressed_->size(); + + return size; } ParkableStringImpl::AgeOrParkResult ParkableStringImpl::MaybeAgeOrParkString() { - MutexLocker locker(mutex_); + MutexLocker locker(metadata_->mutex_); AssertOnValidThread(); DCHECK(may_be_parked()); DCHECK(!is_parked()); Status status = CurrentStatus(); - if (is_young_) { + if (metadata_->is_young_) { if (status == Status::kUnreferencedExternally) - is_young_ = false; + metadata_->is_young_ = false; } else { - if (state_ == State::kParkingInProgress) + if (metadata_->state_ == State::kParkingInProgress) return AgeOrParkResult::kSuccessOrTransientFailure; if (CanParkNow()) { @@ -356,16 +380,17 @@ } bool ParkableStringImpl::Park(ParkingMode mode) { - MutexLocker locker(mutex_); + MutexLocker locker(metadata_->mutex_); AssertOnValidThread(); DCHECK(may_be_parked()); - if (state_ == State::kParkingInProgress || state_ == State::kParked) + if (metadata_->state_ == State::kParkingInProgress || + metadata_->state_ == State::kParked) return true; // Making the string old to cancel parking if it is accessed/locked before // parking is complete. - is_young_ = false; + metadata_->is_young_ = false; if (!CanParkNow()) return false; @@ -373,15 +398,42 @@ return true; } +bool ParkableStringImpl::is_parked() const { + DCHECK(may_be_parked()); + return metadata_->state_ == State::kParked; +} + +void ParkableStringImpl::MakeYoung() { + metadata_->is_young_ = true; +} + +ParkableStringImpl::Status ParkableStringImpl::CurrentStatus() const { + AssertOnValidThread(); + DCHECK(may_be_parked()); + // Can park iff: + // - |this| is not locked. + // - There are no external reference to |string_|. Since |this| holds a + // reference to |string_|, it must the only one. + if (metadata_->lock_depth_ != 0) + return Status::kLocked; + if (!string_.Impl()->HasOneRef()) + return Status::kTooManyReferences; + return Status::kUnreferencedExternally; +} + +bool ParkableStringImpl::CanParkNow() const { + return CurrentStatus() == Status::kUnreferencedExternally && + !metadata_->is_young_; +} + void ParkableStringImpl::ParkInternal(ParkingMode mode) { - mutex_.AssertAcquired(); - DCHECK_EQ(State::kUnparked, state_); - DCHECK(!is_young_); + DCHECK_EQ(State::kUnparked, metadata_->state_); + DCHECK(!metadata_->is_young_); DCHECK(CanParkNow()); // Parking can proceed synchronously. if (has_compressed_data()) { - state_ = State::kParked; + metadata_->state_ = State::kParked; ParkableStringManager::Instance().OnParked(this); // Must unpoison the memory before releasing it. @@ -398,45 +450,21 @@ FROM_HERE, CrossThreadBindOnce(&ParkableStringImpl::CompressInBackground, WTF::Passed(std::move(params)))); - state_ = State::kParkingInProgress; + metadata_->state_ = State::kParkingInProgress; } } -bool ParkableStringImpl::is_parked() const { - return state_ == State::kParked; -} - -ParkableStringImpl::Status ParkableStringImpl::CurrentStatus() const { - AssertOnValidThread(); - mutex_.AssertAcquired(); - DCHECK(may_be_parked()); - // Can park iff: - // - |this| is not locked. - // - There are no external reference to |string_|. Since |this| holds a - // reference to |string_|, it must the only one. - if (lock_depth_ != 0) - return Status::kLocked; - if (!string_.Impl()->HasOneRef()) - return Status::kTooManyReferences; - return Status::kUnreferencedExternally; -} - -bool ParkableStringImpl::CanParkNow() const { - return CurrentStatus() == Status::kUnreferencedExternally && !is_young_; -} - void ParkableStringImpl::Unpark() { AssertOnValidThread(); DCHECK(may_be_parked()); - mutex_.AssertAcquired(); - if (state_ != State::kParked) + if (metadata_->state_ != State::kParked) return; TRACE_EVENT1("blink", "ParkableStringImpl::Unpark", "size", CharactersSizeInBytes()); - DCHECK(compressed_); + DCHECK(metadata_->compressed_); string_ = UnparkInternal(); - state_ = State::kUnparked; + metadata_->state_ = State::kUnparked; ParkableStringManager::Instance().OnUnparked(this); } @@ -448,8 +476,8 @@ base::ElapsedTimer timer; base::StringPiece compressed_string_piece( - reinterpret_cast<const char*>(compressed_->data()), - compressed_->size() * sizeof(uint8_t)); + reinterpret_cast<const char*>(metadata_->compressed_->data()), + metadata_->compressed_->size() * sizeof(uint8_t)); String uncompressed; base::StringPiece uncompressed_string_piece; size_t size = CharactersSizeInBytes(); @@ -491,15 +519,15 @@ std::unique_ptr<CompressionTaskParams> params, std::unique_ptr<Vector<uint8_t>> compressed, base::TimeDelta parking_thread_time) { - MutexLocker locker(mutex_); - DCHECK_EQ(State::kParkingInProgress, state_); + MutexLocker locker(metadata_->mutex_); + DCHECK_EQ(State::kParkingInProgress, metadata_->state_); // Always keep the compressed data. Compression is expensive, so even if the // uncompressed representation cannot be discarded now, avoid compressing // multiple times. This will allow synchronous parking next time. - DCHECK(!compressed_); + DCHECK(!metadata_->compressed_); if (compressed) - compressed_ = std::move(compressed); + metadata_->compressed_ = std::move(compressed); // Between |Park()| and now, things may have happened: // 1. |ToString()| or @@ -507,15 +535,15 @@ // // Both of these will make the string young again, and if so we don't // discard the compressed representation yet. - if (CanParkNow() && compressed_) { - state_ = State::kParked; + if (CanParkNow() && metadata_->compressed_) { + metadata_->state_ = State::kParked; ParkableStringManager::Instance().OnParked(this); // Must unpoison the memory before releasing it. AsanUnpoisonString(string_); string_ = String(); } else { - state_ = State::kUnparked; + metadata_->state_ = State::kUnparked; } // Record the time no matter whether the string was parked or not, as the // parking cost was paid. @@ -606,21 +634,6 @@ RecordStatistics(size, timer.Elapsed(), ParkingAction::kParked); } -size_t ParkableStringImpl::MemoryFootprintForDump() const { - AssertOnValidThread(); - size_t size = sizeof(ParkableStringImpl); - - if (!is_parked()) - size += string_.CharactersSizeInBytes(); - - if (compressed_) - size += compressed_->size(); - - if (digest_) - size += sizeof(SecureDigest); - - return size; -} ParkableString::ParkableString(scoped_refptr<StringImpl>&& impl) { if (!impl) {
diff --git a/third_party/blink/renderer/platform/bindings/parkable_string.h b/third_party/blink/renderer/platform/bindings/parkable_string.h index 5f90b77..b9d2bd8 100644 --- a/third_party/blink/renderer/platform/bindings/parkable_string.h +++ b/third_party/blink/renderer/platform/bindings/parkable_string.h
@@ -72,9 +72,29 @@ const String& ToString(); // See the matching String methods. - bool is_8bit() const { return is_8bit_; } - unsigned length() const { return length_; } + bool is_8bit() const { + if (!may_be_parked()) + return string_.Is8Bit(); + + return metadata_->is_8bit_; + } + unsigned length() const { + if (!may_be_parked()) + return string_.length(); + + return metadata_->length_; + } unsigned CharactersSizeInBytes() const; + size_t MemoryFootprintForDump() const; + + // Returns true iff the string can be parked. This does not mean that the + // string can be parked now, merely that it is eligible to be parked at some + // point. + bool may_be_parked() const { return !!metadata_; } + + // Note: Public member functions below must only be called on strings for + // which |may_be_parked()| returns true. Otherwise, these will either trigger + // a DCHECK() or crash. // Tries to either age or park a string: // @@ -98,36 +118,32 @@ // // Returns true if the string is being parked or has been parked. bool Park(ParkingMode mode); - // Returns true iff the string can be parked. This does not mean that the - // string can be parked now, merely that it is eligible to be parked at some - // point. - bool may_be_parked() const { return !!digest_; } + // Returns true if the string is parked. bool is_parked() const; + // Returns whether synchronous parking is possible, that is the string was // parked in the past. - bool has_compressed_data() const { return !!compressed_; } + bool has_compressed_data() const { return !!metadata_->compressed_; } + // Returns the compressed size, must not be called unless the string has a // compressed representation. size_t compressed_size() const { DCHECK(has_compressed_data()); - return compressed_->size(); + return metadata_->compressed_->size(); } bool is_young_for_testing() { - MutexLocker locker(mutex_); - return is_young_; + MutexLocker locker(metadata_->mutex_); + return metadata_->is_young_; } - // Must only be called on parkable ParkableStringImpls. - SecureDigest* digest() const { + const SecureDigest* digest() const { AssertOnValidThread(); - DCHECK(digest_); - return digest_.get(); + DCHECK(metadata_); + return &metadata_->digest_; } - size_t MemoryFootprintForDump() const; - private: enum class State : uint8_t; enum class Status : uint8_t; @@ -138,20 +154,25 @@ ParkableStringImpl(scoped_refptr<StringImpl>&& impl, std::unique_ptr<SecureDigest> digest); + // Note: Private member functions below must only be called on strings for + // which |may_be_parked()| returns true. Otherwise, these will either trigger + // a DCHECK() or crash. + #if defined(ADDRESS_SANITIZER) // See |CompressInBackground()|. Doesn't make the string young. // May be called from any thread. void LockWithoutMakingYoung(); #endif // defined(ADDRESS_SANITIZER) // May be called from any thread. - void MakeYoung() EXCLUSIVE_LOCKS_REQUIRED(mutex_); + void MakeYoung() EXCLUSIVE_LOCKS_REQUIRED(metadata_->mutex_); // Whether the string is referenced or locked. The return value is valid as // long as |mutex_| is held. - Status CurrentStatus() const EXCLUSIVE_LOCKS_REQUIRED(mutex_); - bool CanParkNow() const EXCLUSIVE_LOCKS_REQUIRED(mutex_); - void ParkInternal(ParkingMode mode); - void Unpark(); - String UnparkInternal() const; + Status CurrentStatus() const EXCLUSIVE_LOCKS_REQUIRED(metadata_->mutex_); + bool CanParkNow() const EXCLUSIVE_LOCKS_REQUIRED(metadata_->mutex_); + void ParkInternal(ParkingMode mode) + EXCLUSIVE_LOCKS_REQUIRED(metadata_->mutex_); + void Unpark() EXCLUSIVE_LOCKS_REQUIRED(metadata_->mutex_); + String UnparkInternal() const EXCLUSIVE_LOCKS_REQUIRED(metadata_->mutex_); // Called on the main thread after compression is done. // |params| is the same as the one passed to |CompressInBackground()|, // |compressed| is the compressed data, nullptr if compression failed. @@ -166,31 +187,40 @@ static void CompressInBackground(std::unique_ptr<CompressionTaskParams>); int lock_depth_for_testing() { - MutexLocker locker_(mutex_); - return lock_depth_; + MutexLocker locker_(metadata_->mutex_); + return metadata_->lock_depth_; } - Mutex mutex_; - int lock_depth_ GUARDED_BY(mutex_); + // Metadata only used for parkable ParkableStrings. + struct ParkableMetadata { + ParkableMetadata(String string, std::unique_ptr<SecureDigest> digest); - // Main thread only. - State state_; + Mutex mutex_; + int lock_depth_ GUARDED_BY(mutex_); + + // Main thread only. + State state_; + std::unique_ptr<Vector<uint8_t>> compressed_; + const SecureDigest digest_; + + // A string can either be "young" or "old". It starts young, and transitions + // are: + // Young -> Old: By calling |MaybeAgeOrParkString()|. + // Old -> Young: When the string is accessed, either by |Lock()|-ing it or + // calling |ToString()|. + // + // Thread safety: it is typically not safe to guard only one part of a + // bitfield with a mutex, but this is correct here, as the other members are + // const (and never change). + bool is_young_ : 1 GUARDED_BY(mutex_); + const bool is_8bit_ : 1; + const unsigned length_; + + DISALLOW_COPY_AND_ASSIGN(ParkableMetadata); + }; + String string_; - std::unique_ptr<Vector<uint8_t>> compressed_; - const std::unique_ptr<SecureDigest> digest_; - - // A string can either be "young" or "old". It starts young, and transitions - // are: - // Young -> Old: By calling |MaybeAgeOrParkString()|. - // Old -> Young: When the string is accessed, either by |Lock()|-ing it or - // calling |ToString()|. - // - // Thread safety: it is typically not safe to guard only one part of a - // bitfield with a mutex, but this is correct here, as the other members are - // const (and never change). - bool is_young_ : 1 GUARDED_BY(mutex_); - const bool is_8bit_ : 1; - const unsigned length_; + const std::unique_ptr<ParkableMetadata> metadata_; #if DCHECK_IS_ON() const base::PlatformThreadId owning_thread_; @@ -202,13 +232,26 @@ #endif } - FRIEND_TEST_ALL_PREFIXES(ParkableStringTest, LockUnlock); - FRIEND_TEST_ALL_PREFIXES(ParkableStringTest, LockParkedString); + public: FRIEND_TEST_ALL_PREFIXES(ParkableStringTest, Equality); FRIEND_TEST_ALL_PREFIXES(ParkableStringTest, EqualityNoUnparking); + FRIEND_TEST_ALL_PREFIXES(ParkableStringTest, LockUnlock); + FRIEND_TEST_ALL_PREFIXES(ParkableStringTest, LockParkedString); + FRIEND_TEST_ALL_PREFIXES(ParkableStringTest, ReportMemoryDump); + FRIEND_TEST_ALL_PREFIXES(ParkableStringTest, MemoryFootprintForDump); + DISALLOW_COPY_AND_ASSIGN(ParkableStringImpl); }; +#if !DCHECK_IS_ON() +// 3 pointers: +// - vtable (from RefCounted) +// - string_.Impl() +// - metadata_ +static_assert(sizeof(ParkableStringImpl) == 3 * sizeof(void*), + "ParkableStringImpl should not be too large"); +#endif + class PLATFORM_EXPORT ParkableString final { DISALLOW_NEW(); @@ -251,6 +294,9 @@ scoped_refptr<ParkableStringImpl> impl_; }; +static_assert(sizeof(ParkableString) == sizeof(void*), + "ParkableString should be small"); + } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_PARKABLE_STRING_H_
diff --git a/third_party/blink/renderer/platform/bindings/parkable_string_manager.cc b/third_party/blink/renderer/platform/bindings/parkable_string_manager.cc index fe1b926..dd987fac 100644 --- a/third_party/blink/renderer/platform/bindings/parkable_string_manager.cc +++ b/third_party/blink/renderer/platform/bindings/parkable_string_manager.cc
@@ -68,13 +68,14 @@ struct ParkableStringManager::SecureDigestHash { STATIC_ONLY(SecureDigestHash); - static unsigned GetHash(ParkableStringImpl::SecureDigest* const digest) { + static unsigned GetHash( + const ParkableStringImpl::SecureDigest* const digest) { // The first bytes of the hash are as good as anything else. return *reinterpret_cast<const unsigned*>(digest->data()); } - static inline bool Equal(ParkableStringImpl::SecureDigest* const a, - ParkableStringImpl::SecureDigest* const b) { + static inline bool Equal(const ParkableStringImpl::SecureDigest* const a, + const ParkableStringImpl::SecureDigest* const b) { return a == b || std::equal(a->data(), a->data() + ParkableStringImpl::kDigestSize, b->data()); @@ -377,7 +378,7 @@ // The digest has an inline capacity set to the digest size, hence sizeof() is // accurate. constexpr size_t kParkableStringImplActualSize = - sizeof(ParkableStringImpl) + sizeof(ParkableStringImpl::SecureDigest); + sizeof(ParkableStringImpl) + sizeof(ParkableStringImpl::ParkableMetadata); for (const auto& kv : unparked_strings_) { ParkableStringImpl* str = kv.value;
diff --git a/third_party/blink/renderer/platform/bindings/parkable_string_manager.h b/third_party/blink/renderer/platform/bindings/parkable_string_manager.h index 1beafd16..e7fd729 100644 --- a/third_party/blink/renderer/platform/bindings/parkable_string_manager.h +++ b/third_party/blink/renderer/platform/bindings/parkable_string_manager.h
@@ -104,11 +104,11 @@ // Relies on secure hash equality for deduplication. If one day SHA256 becomes // insecure, then this would need to be updated to a more robust hash. - WTF::HashMap<ParkableStringImpl::SecureDigest*, + WTF::HashMap<const ParkableStringImpl::SecureDigest*, ParkableStringImpl*, SecureDigestHash> unparked_strings_; - WTF::HashMap<ParkableStringImpl::SecureDigest*, + WTF::HashMap<const ParkableStringImpl::SecureDigest*, ParkableStringImpl*, SecureDigestHash> parked_strings_;
diff --git a/third_party/blink/renderer/platform/bindings/parkable_string_test.cc b/third_party/blink/renderer/platform/bindings/parkable_string_test.cc index 9e02be18..a1e7a6a9 100644 --- a/third_party/blink/renderer/platform/bindings/parkable_string_test.cc +++ b/third_party/blink/renderer/platform/bindings/parkable_string_test.cc
@@ -611,6 +611,9 @@ using testing::Contains; using testing::Eq; + constexpr size_t kActualSize = + sizeof(ParkableStringImpl) + sizeof(ParkableStringImpl::ParkableMetadata); + auto& manager = ParkableStringManager::Instance(); ParkableString parkable1(MakeLargeString('a').ReleaseImpl()); ParkableString parkable2(MakeLargeString('b').ReleaseImpl()); @@ -647,20 +650,20 @@ kCompressedSize); EXPECT_THAT(dump->entries(), Contains(Eq(ByRef(overhead)))); - constexpr size_t kParkableStringImplActualSize = - sizeof(ParkableStringImpl) + sizeof(ParkableStringImpl::SecureDigest); MemoryAllocatorDump::Entry metadata("metadata_size", "bytes", - 2 * kParkableStringImplActualSize); + 2 * kActualSize); EXPECT_THAT(dump->entries(), Contains(Eq(ByRef(metadata)))); MemoryAllocatorDump::Entry savings( "savings_size", "bytes", - 2 * kStringSize - (kStringSize + 2 * kCompressedSize + - 2 * kParkableStringImplActualSize)); + 2 * kStringSize - (kStringSize + 2 * kCompressedSize + 2 * kActualSize)); EXPECT_THAT(dump->entries(), Contains(Eq(ByRef(savings)))); } TEST_F(ParkableStringTest, MemoryFootprintForDump) { + constexpr size_t kActualSize = + sizeof(ParkableStringImpl) + sizeof(ParkableStringImpl::ParkableMetadata); + size_t memory_footprint; ParkableString parkable1(MakeLargeString('a').ReleaseImpl()); ParkableString parkable2(MakeLargeString('b').ReleaseImpl()); @@ -670,19 +673,15 @@ parkable1.ToString(); // Compressed and uncompressed data. - memory_footprint = sizeof(ParkableStringImpl) + - sizeof(ParkableStringImpl::SecureDigest) + - parkable1.Impl()->compressed_size() + + memory_footprint = kActualSize + parkable1.Impl()->compressed_size() + parkable1.Impl()->CharactersSizeInBytes(); EXPECT_EQ(memory_footprint, parkable1.Impl()->MemoryFootprintForDump()); // Compressed uncompressed data only. - memory_footprint = sizeof(ParkableStringImpl) + - sizeof(ParkableStringImpl::SecureDigest) + - parkable2.Impl()->compressed_size(); + memory_footprint = kActualSize + parkable2.Impl()->compressed_size(); EXPECT_EQ(memory_footprint, parkable2.Impl()->MemoryFootprintForDump()); - // Short string, no digest. + // Short string, no metadata. memory_footprint = sizeof(ParkableStringImpl) + parkable3.Impl()->CharactersSizeInBytes(); EXPECT_EQ(memory_footprint, parkable3.Impl()->MemoryFootprintForDump()); @@ -694,10 +693,10 @@ ParkableString parkable(MakeLargeString().ReleaseImpl()); WaitForDelayedParking(); - EXPECT_FALSE(parkable.Impl()->is_parked()); + EXPECT_FALSE(parkable.Impl()->may_be_parked()); MemoryPressureListenerRegistry::Instance().OnPurgeMemory(); - EXPECT_FALSE(parkable.Impl()->is_parked()); + EXPECT_FALSE(parkable.Impl()->may_be_parked()); } TEST_F(ParkableStringTest, Aging) {
diff --git a/third_party/blink/renderer/platform/heap/incremental_marking_test.cc b/third_party/blink/renderer/platform/heap/incremental_marking_test.cc index c3000af..6a74078 100644 --- a/third_party/blink/renderer/platform/heap/incremental_marking_test.cc +++ b/third_party/blink/renderer/platform/heap/incremental_marking_test.cc
@@ -279,6 +279,20 @@ void Trace(Visitor* visitor) { LinkedObject::Trace(visitor); } }; +class RawPtrObjectWithManualWriteBarrier + : public GarbageCollected<RawPtrObjectWithManualWriteBarrier> { + public: + void Trace(Visitor* v) { v->Trace(object_); } + + void Set(Object* object) { + object_ = object; + MarkingVisitor::WriteBarrier(&object_); + } + + private: + Object* object_ = nullptr; +}; + // ============================================================================= // Basic infrastructure support. =============================================== // ============================================================================= @@ -293,20 +307,22 @@ } TEST_F(IncrementalMarkingTest, ManualWriteBarrierTriggersWhenMarkingIsOn) { - auto* object = MakeGarbageCollected<Object>(); + auto* object1 = MakeGarbageCollected<Object>(); + auto* object2 = MakeGarbageCollected<RawPtrObjectWithManualWriteBarrier>(); { - ExpectWriteBarrierFires scope(ThreadState::Current(), {object}); - EXPECT_FALSE(object->IsMarked()); - MarkingVisitor::WriteBarrier(&object); - EXPECT_TRUE(object->IsMarked()); + ExpectWriteBarrierFires scope(ThreadState::Current(), {object1}); + EXPECT_FALSE(object1->IsMarked()); + object2->Set(object1); + EXPECT_TRUE(object1->IsMarked()); } } TEST_F(IncrementalMarkingTest, ManualWriteBarrierBailoutWhenMarkingIsOff) { - auto* object = MakeGarbageCollected<Object>(); - EXPECT_FALSE(object->IsMarked()); - MarkingVisitor::WriteBarrier(&object); - EXPECT_FALSE(object->IsMarked()); + auto* object1 = MakeGarbageCollected<Object>(); + auto* object2 = MakeGarbageCollected<RawPtrObjectWithManualWriteBarrier>(); + EXPECT_FALSE(object1->IsMarked()); + object2->Set(object1); + EXPECT_FALSE(object1->IsMarked()); } // ============================================================================= @@ -348,10 +364,10 @@ } TEST_F(IncrementalMarkingTest, MemberReferenceAssignMember) { - auto* obj = MakeGarbageCollected<Object>(); - Member<Object> m1; - Member<Object>& m2 = m1; - Member<Object> m3(obj); + auto* obj = MakeGarbageCollected<LinkedObject>(); + auto* ref_obj = MakeGarbageCollected<LinkedObject>(); + Member<LinkedObject>& m2 = ref_obj->next_ref(); + Member<LinkedObject> m3(obj); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj}); m2 = m3; @@ -359,7 +375,8 @@ } TEST_F(IncrementalMarkingTest, MemberSetDeletedValueNoBarrier) { - Member<Object> m; + auto* obj = MakeGarbageCollected<LinkedObject>(); + Member<LinkedObject>& m = obj->next_ref(); { ExpectNoWriteBarrierFires scope(ThreadState::Current(), {}); m = WTF::kHashTableDeletedValue; @@ -367,26 +384,32 @@ } TEST_F(IncrementalMarkingTest, MemberCopyDeletedValueNoBarrier) { - Member<Object> m1(WTF::kHashTableDeletedValue); + auto* obj1 = MakeGarbageCollected<LinkedObject>(); + Member<LinkedObject>& m1 = obj1->next_ref(); + m1 = WTF::kHashTableDeletedValue; { ExpectNoWriteBarrierFires scope(ThreadState::Current(), {}); - Member<Object> m2(m1); + auto* obj2 = MakeGarbageCollected<LinkedObject>(); + obj2->next_ref() = m1; } } TEST_F(IncrementalMarkingTest, MemberHashTraitConstructDeletedValueNoBarrier) { - Member<Object> m1; + auto* obj = MakeGarbageCollected<LinkedObject>(); + Member<LinkedObject>& m = obj->next_ref(); { ExpectNoWriteBarrierFires scope(ThreadState::Current(), {}); - HashTraits<Member<Object>>::ConstructDeletedValue(m1, false); + HashTraits<Member<LinkedObject>>::ConstructDeletedValue(m, false); } } TEST_F(IncrementalMarkingTest, MemberHashTraitIsDeletedValueNoBarrier) { - Member<Object> m1(MakeGarbageCollected<Object>()); + auto* obj = + MakeGarbageCollected<LinkedObject>(MakeGarbageCollected<LinkedObject>()); + Member<LinkedObject>& m = obj->next_ref(); { ExpectNoWriteBarrierFires scope(ThreadState::Current(), {}); - EXPECT_FALSE(HashTraits<Member<Object>>::IsDeletedValue(m1)); + EXPECT_FALSE(HashTraits<Member<LinkedObject>>::IsDeletedValue(m)); } } @@ -512,158 +535,168 @@ TEST_F(IncrementalMarkingTest, HeapVectorPushBackMember) { auto* obj = MakeGarbageCollected<Object>(); - HeapVector<Member<Object>> vec; + auto* vec = MakeGarbageCollected<HeapVector<Member<Object>>>(); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj}); - vec.push_back(obj); + vec->push_back(obj); } } TEST_F(IncrementalMarkingTest, HeapVectorPushBackNonGCedContainer) { auto* obj = MakeGarbageCollected<Object>(); - HeapVector<NonGarbageCollectedContainer> vec; + auto* vec = MakeGarbageCollected<HeapVector<NonGarbageCollectedContainer>>(); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj}); - vec.push_back(NonGarbageCollectedContainer(obj, 1)); + vec->push_back(NonGarbageCollectedContainer(obj, 1)); } } TEST_F(IncrementalMarkingTest, HeapVectorPushBackStdPair) { auto* obj1 = MakeGarbageCollected<Object>(); auto* obj2 = MakeGarbageCollected<Object>(); - HeapVector<std::pair<Member<Object>, Member<Object>>> vec; + auto* vec = MakeGarbageCollected< + HeapVector<std::pair<Member<Object>, Member<Object>>>>(); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2}); - vec.push_back(std::make_pair(Member<Object>(obj1), Member<Object>(obj2))); + vec->push_back(std::make_pair(Member<Object>(obj1), Member<Object>(obj2))); } } TEST_F(IncrementalMarkingTest, HeapVectorEmplaceBackMember) { auto* obj = MakeGarbageCollected<Object>(); - HeapVector<Member<Object>> vec; + auto* vec = MakeGarbageCollected<HeapVector<Member<Object>>>(); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj}); - vec.emplace_back(obj); + vec->emplace_back(obj); } } TEST_F(IncrementalMarkingTest, HeapVectorEmplaceBackNonGCedContainer) { auto* obj = MakeGarbageCollected<Object>(); - HeapVector<NonGarbageCollectedContainer> vec; + auto* vec = MakeGarbageCollected<HeapVector<NonGarbageCollectedContainer>>(); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj}); - vec.emplace_back(obj, 1); + vec->emplace_back(obj, 1); } } TEST_F(IncrementalMarkingTest, HeapVectorEmplaceBackStdPair) { auto* obj1 = MakeGarbageCollected<Object>(); auto* obj2 = MakeGarbageCollected<Object>(); - HeapVector<std::pair<Member<Object>, Member<Object>>> vec; + auto* vec = MakeGarbageCollected< + HeapVector<std::pair<Member<Object>, Member<Object>>>>(); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2}); - vec.emplace_back(obj1, obj2); + vec->emplace_back(obj1, obj2); } } TEST_F(IncrementalMarkingTest, HeapVectorCopyMember) { auto* object = MakeGarbageCollected<Object>(); - HeapVector<Member<Object>> vec1; - vec1.push_back(object); + auto* vec1 = MakeGarbageCollected<HeapVector<Member<Object>>>(); + vec1->push_back(object); { ExpectWriteBarrierFires scope(ThreadState::Current(), {object}); - HeapVector<Member<Object>> vec2(vec1); + MakeGarbageCollected<HeapVector<Member<Object>>>(*vec1); } } TEST_F(IncrementalMarkingTest, HeapVectorCopyNonGCedContainer) { auto* obj = MakeGarbageCollected<Object>(); - HeapVector<NonGarbageCollectedContainer> vec1; - vec1.emplace_back(obj, 1); + auto* vec1 = MakeGarbageCollected<HeapVector<NonGarbageCollectedContainer>>(); + vec1->emplace_back(obj, 1); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj}); - HeapVector<NonGarbageCollectedContainer> vec2(vec1); + MakeGarbageCollected<HeapVector<NonGarbageCollectedContainer>>(*vec1); } } TEST_F(IncrementalMarkingTest, HeapVectorCopyStdPair) { + using ValueType = std::pair<Member<Object>, Member<Object>>; auto* obj1 = MakeGarbageCollected<Object>(); auto* obj2 = MakeGarbageCollected<Object>(); - HeapVector<std::pair<Member<Object>, Member<Object>>> vec1; - vec1.emplace_back(obj1, obj2); + auto* vec1 = MakeGarbageCollected<HeapVector<ValueType>>(); + vec1->emplace_back(obj1, obj2); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2}); - HeapVector<std::pair<Member<Object>, Member<Object>>> vec2(vec1); + MakeGarbageCollected<HeapVector<ValueType>>(*vec1); } } TEST_F(IncrementalMarkingTest, HeapVectorMoveMember) { auto* obj = MakeGarbageCollected<Object>(); - HeapVector<Member<Object>> vec1; - vec1.push_back(obj); + auto* vec1 = MakeGarbageCollected<HeapVector<Member<Object>>>(); + vec1->push_back(obj); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj}); - HeapVector<Member<Object>> vec2(std::move(vec1)); + MakeGarbageCollected<HeapVector<Member<Object>>>(std::move(*vec1)); } } TEST_F(IncrementalMarkingTest, HeapVectorMoveNonGCedContainer) { auto* obj = MakeGarbageCollected<Object>(); - HeapVector<NonGarbageCollectedContainer> vec1; - vec1.emplace_back(obj, 1); + auto* vec1 = MakeGarbageCollected<HeapVector<NonGarbageCollectedContainer>>(); + vec1->emplace_back(obj, 1); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj}); - HeapVector<NonGarbageCollectedContainer> vec2(std::move(vec1)); + MakeGarbageCollected<HeapVector<NonGarbageCollectedContainer>>( + std::move(*vec1)); } } TEST_F(IncrementalMarkingTest, HeapVectorMoveStdPair) { + using ValueType = std::pair<Member<Object>, Member<Object>>; + using VectorType = HeapVector<ValueType>; auto* obj1 = MakeGarbageCollected<Object>(); auto* obj2 = MakeGarbageCollected<Object>(); - HeapVector<std::pair<Member<Object>, Member<Object>>> vec1; - vec1.emplace_back(obj1, obj2); + auto* vec1 = MakeGarbageCollected<VectorType>(); + vec1->emplace_back(obj1, obj2); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2}); - HeapVector<std::pair<Member<Object>, Member<Object>>> vec2(std::move(vec1)); + MakeGarbageCollected<VectorType>(std::move(*vec1)); } } TEST_F(IncrementalMarkingTest, HeapVectorSwapMember) { + using VectorType = HeapVector<Member<Object>>; auto* obj1 = MakeGarbageCollected<Object>(); auto* obj2 = MakeGarbageCollected<Object>(); - HeapVector<Member<Object>> vec1; - vec1.push_back(obj1); - HeapVector<Member<Object>> vec2; - vec2.push_back(obj2); + auto* vec1 = MakeGarbageCollected<VectorType>(); + vec1->push_back(obj1); + auto* vec2 = MakeGarbageCollected<VectorType>(); + vec2->push_back(obj2); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2}); - std::swap(vec1, vec2); + std::swap(*vec1, *vec2); } } TEST_F(IncrementalMarkingTest, HeapVectorSwapNonGCedContainer) { + using VectorType = HeapVector<NonGarbageCollectedContainer>; auto* obj1 = MakeGarbageCollected<Object>(); auto* obj2 = MakeGarbageCollected<Object>(); - HeapVector<NonGarbageCollectedContainer> vec1; - vec1.emplace_back(obj1, 1); - HeapVector<NonGarbageCollectedContainer> vec2; - vec2.emplace_back(obj2, 2); + auto* vec1 = MakeGarbageCollected<VectorType>(); + vec1->emplace_back(obj1, 1); + auto* vec2 = MakeGarbageCollected<VectorType>(); + vec2->emplace_back(obj2, 2); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2}); - std::swap(vec1, vec2); + std::swap(*vec1, *vec2); } } TEST_F(IncrementalMarkingTest, HeapVectorSwapStdPair) { + using ValueType = std::pair<Member<Object>, Member<Object>>; + using VectorType = HeapVector<ValueType>; auto* obj1 = MakeGarbageCollected<Object>(); auto* obj2 = MakeGarbageCollected<Object>(); - HeapVector<std::pair<Member<Object>, Member<Object>>> vec1; - vec1.emplace_back(obj1, nullptr); - HeapVector<std::pair<Member<Object>, Member<Object>>> vec2; - vec2.emplace_back(nullptr, obj2); + auto* vec1 = MakeGarbageCollected<VectorType>(); + vec1->emplace_back(obj1, nullptr); + auto* vec2 = MakeGarbageCollected<VectorType>(); + vec2->emplace_back(nullptr, obj2); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2}); - std::swap(vec1, vec2); + std::swap(*vec1, *vec2); } } @@ -825,23 +858,23 @@ template <typename Container> void Move() { auto* obj = MakeGarbageCollected<Object>(); - Container container1; - Container container2; - container1.insert(obj); + auto* container1 = MakeGarbageCollected<Container>(); + auto* container2 = MakeGarbageCollected<Container>(); + container1->insert(obj); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj}); - container2 = std::move(container1); + *container2 = std::move(*container1); } } template <typename Container> void MoveNoBarrier() { auto* obj = MakeGarbageCollected<Object>(); - Container container1; - container1.insert(obj); + auto* container1 = MakeGarbageCollected<Container>(); + container1->insert(obj); { ExpectNoWriteBarrierFires scope(ThreadState::Current(), {obj}); - Container container2(std::move(container1)); + auto* container2 = MakeGarbageCollected<Container>(std::move(*container1)); } } @@ -849,13 +882,13 @@ void Swap() { auto* obj1 = MakeGarbageCollected<Object>(); auto* obj2 = MakeGarbageCollected<Object>(); - Container container1; - container1.insert(obj1); - Container container2; - container2.insert(obj2); + auto* container1 = MakeGarbageCollected<Container>(); + container1->insert(obj1); + auto* container2 = MakeGarbageCollected<Container>(); + container2->insert(obj2); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2}); - std::swap(container1, container2); + std::swap(*container1, *container2); } } @@ -863,13 +896,13 @@ void SwapNoBarrier() { auto* obj1 = MakeGarbageCollected<Object>(); auto* obj2 = MakeGarbageCollected<Object>(); - Container container1; - container1.insert(obj1); - Container container2; - container2.insert(obj2); + auto* container1 = MakeGarbageCollected<Container>(); + container1->insert(obj1); + auto* container2 = MakeGarbageCollected<Container>(); + container2->insert(obj2); { ExpectNoWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2}); - std::swap(container1, container2); + std::swap(*container1, *container2); } } @@ -944,26 +977,30 @@ { auto* obj1 = MakeGarbageCollected<Object>(); auto* obj2 = MakeGarbageCollected<Object>(); - HeapHashCountedSet<Member<Object>> container1; - container1.insert(obj1); - HeapHashCountedSet<Member<Object>> container2; - container2.insert(obj2); + auto* container1 = + MakeGarbageCollected<HeapHashCountedSet<Member<Object>>>(); + container1->insert(obj1); + auto* container2 = + MakeGarbageCollected<HeapHashCountedSet<Member<Object>>>(); + container2->insert(obj2); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2}); - container1.swap(container2); + container1->swap(*container2); } } { auto* obj1 = MakeGarbageCollected<Object>(); auto* obj2 = MakeGarbageCollected<Object>(); - HeapHashCountedSet<WeakMember<Object>> container1; - container1.insert(obj1); - HeapHashCountedSet<WeakMember<Object>> container2; - container2.insert(obj2); + auto* container1 = + MakeGarbageCollected<HeapHashCountedSet<WeakMember<Object>>>(); + container1->insert(obj1); + auto* container2 = + MakeGarbageCollected<HeapHashCountedSet<WeakMember<Object>>>(); + container2->insert(obj2); { // Weak references are strongified for the current cycle. ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2}); - container1.swap(container2); + container1->swap(*container2); } } } @@ -1131,47 +1168,55 @@ TEST_F(IncrementalMarkingTest, HeapHashMapMoveMember) { auto* obj1 = MakeGarbageCollected<Object>(); auto* obj2 = MakeGarbageCollected<Object>(); - HeapHashMap<Member<Object>, Member<Object>> map1; - map1.insert(obj1, obj2); + auto* map1 = + MakeGarbageCollected<HeapHashMap<Member<Object>, Member<Object>>>(); + map1->insert(obj1, obj2); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2}); - HeapHashMap<Member<Object>, Member<Object>> map2(std::move(map1)); + MakeGarbageCollected<HeapHashMap<Member<Object>, Member<Object>>>( + std::move(*map1)); } } TEST_F(IncrementalMarkingTest, HeapHashMapMoveWeakMember) { auto* obj1 = MakeGarbageCollected<Object>(); auto* obj2 = MakeGarbageCollected<Object>(); - HeapHashMap<WeakMember<Object>, WeakMember<Object>> map1; - map1.insert(obj1, obj2); + auto* map1 = MakeGarbageCollected< + HeapHashMap<WeakMember<Object>, WeakMember<Object>>>(); + map1->insert(obj1, obj2); { // Weak references are strongified for the current cycle. ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2}); - HeapHashMap<WeakMember<Object>, WeakMember<Object>> map2(std::move(map1)); + MakeGarbageCollected<HeapHashMap<WeakMember<Object>, WeakMember<Object>>>( + std::move(*map1)); } } TEST_F(IncrementalMarkingTest, HeapHashMapMoveMemberWeakMember) { auto* obj1 = MakeGarbageCollected<Object>(); auto* obj2 = MakeGarbageCollected<Object>(); - HeapHashMap<Member<Object>, WeakMember<Object>> map1; - map1.insert(obj1, obj2); + auto* map1 = + MakeGarbageCollected<HeapHashMap<Member<Object>, WeakMember<Object>>>(); + map1->insert(obj1, obj2); { // Weak references are strongified for the current cycle. ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2}); - HeapHashMap<Member<Object>, WeakMember<Object>> map2(std::move(map1)); + MakeGarbageCollected<HeapHashMap<Member<Object>, WeakMember<Object>>>( + std::move(*map1)); } } TEST_F(IncrementalMarkingTest, HeapHashMapMoveWeakMemberMember) { auto* obj1 = MakeGarbageCollected<Object>(); auto* obj2 = MakeGarbageCollected<Object>(); - HeapHashMap<WeakMember<Object>, Member<Object>> map1; - map1.insert(obj1, obj2); + auto* map1 = + MakeGarbageCollected<HeapHashMap<WeakMember<Object>, Member<Object>>>(); + map1->insert(obj1, obj2); { // Weak references are strongified for the current cycle. ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2}); - HeapHashMap<WeakMember<Object>, Member<Object>> map2(std::move(map1)); + MakeGarbageCollected<HeapHashMap<WeakMember<Object>, Member<Object>>>( + std::move(*map1)); } } @@ -1180,14 +1225,16 @@ auto* obj2 = MakeGarbageCollected<Object>(); auto* obj3 = MakeGarbageCollected<Object>(); auto* obj4 = MakeGarbageCollected<Object>(); - HeapHashMap<Member<Object>, Member<Object>> map1; - map1.insert(obj1, obj2); - HeapHashMap<Member<Object>, Member<Object>> map2; - map2.insert(obj3, obj4); + auto* map1 = + MakeGarbageCollected<HeapHashMap<Member<Object>, Member<Object>>>(); + map1->insert(obj1, obj2); + auto* map2 = + MakeGarbageCollected<HeapHashMap<Member<Object>, Member<Object>>>(); + map2->insert(obj3, obj4); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2, obj3, obj4}); - std::swap(map1, map2); + std::swap(*map1, *map2); } } @@ -1196,15 +1243,17 @@ auto* obj2 = MakeGarbageCollected<Object>(); auto* obj3 = MakeGarbageCollected<Object>(); auto* obj4 = MakeGarbageCollected<Object>(); - HeapHashMap<WeakMember<Object>, WeakMember<Object>> map1; - map1.insert(obj1, obj2); - HeapHashMap<WeakMember<Object>, WeakMember<Object>> map2; - map2.insert(obj3, obj4); + auto* map1 = MakeGarbageCollected< + HeapHashMap<WeakMember<Object>, WeakMember<Object>>>(); + map1->insert(obj1, obj2); + auto* map2 = MakeGarbageCollected< + HeapHashMap<WeakMember<Object>, WeakMember<Object>>>(); + map2->insert(obj3, obj4); { // Weak references are strongified for the current cycle. ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2, obj3, obj4}); - std::swap(map1, map2); + std::swap(*map1, *map2); } } @@ -1213,15 +1262,17 @@ auto* obj2 = MakeGarbageCollected<Object>(); auto* obj3 = MakeGarbageCollected<Object>(); auto* obj4 = MakeGarbageCollected<Object>(); - HeapHashMap<Member<Object>, WeakMember<Object>> map1; - map1.insert(obj1, obj2); - HeapHashMap<Member<Object>, WeakMember<Object>> map2; - map2.insert(obj3, obj4); + auto* map1 = + MakeGarbageCollected<HeapHashMap<Member<Object>, WeakMember<Object>>>(); + map1->insert(obj1, obj2); + auto* map2 = + MakeGarbageCollected<HeapHashMap<Member<Object>, WeakMember<Object>>>(); + map2->insert(obj3, obj4); { // Weak references are strongified for the current cycle. ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2, obj3, obj4}); - std::swap(map1, map2); + std::swap(*map1, *map2); } } @@ -1230,15 +1281,17 @@ auto* obj2 = MakeGarbageCollected<Object>(); auto* obj3 = MakeGarbageCollected<Object>(); auto* obj4 = MakeGarbageCollected<Object>(); - HeapHashMap<WeakMember<Object>, Member<Object>> map1; - map1.insert(obj1, obj2); - HeapHashMap<WeakMember<Object>, Member<Object>> map2; - map2.insert(obj3, obj4); + auto* map1 = + MakeGarbageCollected<HeapHashMap<WeakMember<Object>, Member<Object>>>(); + map1->insert(obj1, obj2); + auto* map2 = + MakeGarbageCollected<HeapHashMap<WeakMember<Object>, Member<Object>>>(); + map2->insert(obj3, obj4); { // Weak references are strongified for the current cycle. ExpectWriteBarrierFires scope(ThreadState::Current(), {obj1, obj2, obj3, obj4}); - std::swap(map1, map2); + std::swap(*map1, *map2); } }
diff --git a/third_party/blink/renderer/platform/mojo/BUILD.gn b/third_party/blink/renderer/platform/mojo/BUILD.gn deleted file mode 100644 index 23ffc07..0000000 --- a/third_party/blink/renderer/platform/mojo/BUILD.gn +++ /dev/null
@@ -1,55 +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. - -import("//mojo/public/tools/bindings/mojom.gni") - -mojom_cpp_typemap("big_string_typemap") { - types = [ - { - mojom = "mojo_base.mojom.BigString" - cpp = "::WTF::String" - nullable_is_same_type = true - }, - ] - public_headers = [ - "//third_party/blink/renderer/platform/mojo/big_string_mojom_traits.h", - "//third_party/blink/renderer/platform/wtf/text/wtf_string.h", - ] - public_deps = [ "//mojo/public/cpp/base" ] -} - -mojom_cpp_typemap("url_typemap") { - types = [ - { - mojom = "url.mojom.Url" - cpp = "::blink::KURL" - force_serialize = true - }, - ] - public_headers = [ - "//third_party/blink/renderer/platform/mojo/kurl_mojom_traits.h", - "//third_party/blink/renderer/platform/weborigin/kurl.h", - "//third_party/blink/renderer/platform/weborigin/kurl_hash.h", - ] - - # NOTE: Consumers of this typemap must themselves depend on platform. - public_deps = [ "//url" ] -} - -mojom_cpp_typemap("origin_typemap") { - types = [ - { - mojom = "url.mojom.Origin" - cpp = "::scoped_refptr<const ::blink::SecurityOrigin>" - nullable_is_same_type = true - }, - ] - public_headers = [ - "//third_party/blink/renderer/platform/mojo/security_origin_mojom_traits.h", - "//third_party/blink/renderer/platform/weborigin/security_origin.h", - ] - - # NOTE: Consumers of this typemap must themselves depend on platform. - public_deps = [ "//url" ] -}
diff --git a/third_party/blink/renderer/platform/mojo/big_string.typemap b/third_party/blink/renderer/platform/mojo/big_string.typemap new file mode 100644 index 0000000..bd4bac7 --- /dev/null +++ b/third_party/blink/renderer/platform/mojo/big_string.typemap
@@ -0,0 +1,11 @@ +# Copyright 2018 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. + +mojom = "//mojo/public/mojom/base/big_string.mojom" +public_headers = + [ "//third_party/blink/renderer/platform/wtf/text/wtf_string.h" ] +traits_headers = + [ "//third_party/blink/renderer/platform/mojo/big_string_mojom_traits.h" ] +type_mappings = + [ "mojo_base.mojom.BigString=::WTF::String[nullable_is_same_type]" ]
diff --git a/third_party/blink/renderer/platform/mojo/big_string_mojom_traits.h b/third_party/blink/renderer/platform/mojo/big_string_mojom_traits.h index 2b0f138..dda183c 100644 --- a/third_party/blink/renderer/platform/mojo/big_string_mojom_traits.h +++ b/third_party/blink/renderer/platform/mojo/big_string_mojom_traits.h
@@ -5,7 +5,6 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_MOJO_BIG_STRING_MOJOM_TRAITS_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_MOJO_BIG_STRING_MOJOM_TRAITS_H_ -#include "mojo/public/cpp/base/big_buffer.h" #include "mojo/public/cpp/bindings/struct_traits.h" #include "mojo/public/mojom/base/big_string.mojom-blink-forward.h" #include "third_party/blink/renderer/platform/platform_export.h"
diff --git a/third_party/blink/renderer/platform/mojo/blink_typemaps.gni b/third_party/blink/renderer/platform/mojo/blink_typemaps.gni index b5ff71d..eb93cfc 100644 --- a/third_party/blink/renderer/platform/mojo/blink_typemaps.gni +++ b/third_party/blink/renderer/platform/mojo/blink_typemaps.gni
@@ -5,6 +5,7 @@ typemaps = [ "//media/capture/mojom/video_capture_types_for_blink.typemap", "//media/mojo/mojom/audio_parameters.typemap", + "//mojo/public/cpp/base/values.typemap", "//services/network/public/cpp/http_request_headers.typemap", "//services/network/public/cpp/ip_address.typemap", "//services/network/public/cpp/ip_endpoint.typemap", @@ -21,7 +22,10 @@ "//third_party/blink/renderer/modules/indexeddb/indexed_db_blink.typemap", "//third_party/blink/renderer/platform/blob/serialized_blob.typemap", "//third_party/blink/renderer/platform/cookie/canonical_cookie.typemap", + "//third_party/blink/renderer/platform/mojo/big_string.typemap", "//third_party/blink/renderer/platform/mojo/fetch_api_request_headers.typemap", + "//third_party/blink/renderer/platform/mojo/kurl.typemap", + "//third_party/blink/renderer/platform/mojo/security_origin.typemap", "//third_party/blink/renderer/platform/mojo/string.typemap", "//third_party/blink/renderer/platform/mojo/time.typemap", "//third_party/blink/renderer/platform/network/encoded_form_data_element.typemap",
diff --git a/third_party/blink/renderer/platform/mojo/kurl.typemap b/third_party/blink/renderer/platform/mojo/kurl.typemap new file mode 100644 index 0000000..8a25d18 --- /dev/null +++ b/third_party/blink/renderer/platform/mojo/kurl.typemap
@@ -0,0 +1,18 @@ +# 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. + +mojom = "//url/mojom/url.mojom" +public_headers = [ + "//third_party/blink/renderer/platform/weborigin/kurl.h", + "//third_party/blink/renderer/platform/weborigin/kurl_hash.h", +] +traits_headers = + [ "//third_party/blink/renderer/platform/mojo/kurl_mojom_traits.h" ] + +# Note: consumers of this typemap must themselves depend on platform. +deps = [ + "//mojo/public/cpp/bindings", + "//url", +] +type_mappings = [ "url.mojom.Url=::blink::KURL[force_serialize]" ]
diff --git a/third_party/blink/renderer/platform/mojo/kurl_mojom_traits.h b/third_party/blink/renderer/platform/mojo/kurl_mojom_traits.h index f50dd84..bcd6a69 100644 --- a/third_party/blink/renderer/platform/mojo/kurl_mojom_traits.h +++ b/third_party/blink/renderer/platform/mojo/kurl_mojom_traits.h
@@ -5,16 +5,15 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_MOJO_KURL_MOJOM_TRAITS_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_MOJO_KURL_MOJOM_TRAITS_H_ -#include "mojo/public/cpp/bindings/string_traits_wtf.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" -#include "url/mojom/url.mojom-shared.h" +#include "url/mojom/url.mojom-blink-forward.h" #include "url/url_constants.h" namespace mojo { template <> -struct StructTraits<url::mojom::UrlDataView, ::blink::KURL> { +struct StructTraits<url::mojom::blink::Url::DataView, ::blink::KURL> { static WTF::String url(const ::blink::KURL& blinkUrl) { if (!blinkUrl.IsValid() || blinkUrl.GetString().length() > url::kMaxURLChars) { @@ -23,7 +22,7 @@ return blinkUrl.GetString(); } - static bool Read(url::mojom::UrlDataView data, ::blink::KURL* out) { + static bool Read(url::mojom::blink::Url::DataView data, ::blink::KURL* out) { WTF::String urlString; if (!data.ReadUrl(&urlString)) return false;
diff --git a/third_party/blink/renderer/platform/mojo/security_origin.typemap b/third_party/blink/renderer/platform/mojo/security_origin.typemap new file mode 100644 index 0000000..f94a2bb --- /dev/null +++ b/third_party/blink/renderer/platform/mojo/security_origin.typemap
@@ -0,0 +1,17 @@ +# 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. + +mojom = "//url/mojom/origin.mojom" +public_headers = + [ "//third_party/blink/renderer/platform/weborigin/security_origin.h" ] +traits_headers = [ + "//third_party/blink/renderer/platform/mojo/security_origin_mojom_traits.h", +] + +# Note: consumers of this typemap must themselves depend on platform. +deps = [ + "//mojo/public/cpp/bindings", + "//url", +] +type_mappings = [ "url.mojom.Origin=::scoped_refptr<const ::blink::SecurityOrigin>[nullable_is_same_type]" ]
diff --git a/third_party/blink/renderer/platform/mojo/security_origin_mojom_traits.h b/third_party/blink/renderer/platform/mojo/security_origin_mojom_traits.h index 925965d0..7a420cab 100644 --- a/third_party/blink/renderer/platform/mojo/security_origin_mojom_traits.h +++ b/third_party/blink/renderer/platform/mojo/security_origin_mojom_traits.h
@@ -5,12 +5,10 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_MOJO_SECURITY_ORIGIN_MOJOM_TRAITS_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_MOJO_SECURITY_ORIGIN_MOJOM_TRAITS_H_ -#include "mojo/public/cpp/base/unguessable_token_mojom_traits.h" -#include "mojo/public/cpp/bindings/string_traits_wtf.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" -#include "url/mojom/origin.mojom-shared.h" +#include "url/mojom/origin.mojom-blink-forward.h" #include "url/scheme_host_port.h" namespace mojo { @@ -47,7 +45,7 @@ }; template <> -struct StructTraits<url::mojom::OriginDataView, +struct StructTraits<url::mojom::blink::Origin::DataView, scoped_refptr<const ::blink::SecurityOrigin>> { static WTF::String scheme( const scoped_refptr<const ::blink::SecurityOrigin>& origin) { @@ -67,7 +65,7 @@ const scoped_refptr<const ::blink::SecurityOrigin>& origin) { return UrlOriginAdapter::nonce_if_opaque(origin); } - static bool Read(url::mojom::OriginDataView data, + static bool Read(url::mojom::blink::Origin::DataView data, scoped_refptr<const ::blink::SecurityOrigin>* out) { // This implementation is very close to // SecurityOrigin::CreateFromUrlOrigin, so keep in sync if modifications
diff --git a/third_party/blink/renderer/platform/wtf/vector_backed_linked_list.h b/third_party/blink/renderer/platform/wtf/vector_backed_linked_list.h index 359d5ed..089eb55 100644 --- a/third_party/blink/renderer/platform/wtf/vector_backed_linked_list.h +++ b/third_party/blink/renderer/platform/wtf/vector_backed_linked_list.h
@@ -129,6 +129,17 @@ // is executed by just updating indices of related nodes. void MoveTo(const_iterator target, const_iterator new_position); + iterator erase(const_iterator); + + void pop_front() { + DCHECK(!empty()); + erase(cbegin()); + } + void pop_back() { + DCHECK(!empty()); + erase(--cend()); + } + private: bool IsFreeListEmpty() const { return free_head_index_ == anchor_index_; } @@ -425,6 +436,24 @@ } template <typename T> +typename VectorBackedLinkedList<T>::iterator VectorBackedLinkedList<T>::erase( + const_iterator position) { + DCHECK(position != end()); + wtf_size_t position_index = position.GetIndex(); + Node& node = nodes_[position_index]; + wtf_size_t next_index = node.next_index_; + + Unlink(node); + node.value_ = HashTraits<T>::EmptyValue(); + + node.next_index_ = free_head_index_; + free_head_index_ = position_index; + + size_--; + return iterator(next_index, this); +} + +template <typename T> void VectorBackedLinkedList<T>::Unlink(const Node& node) { wtf_size_t prev_index = node.prev_index_; wtf_size_t next_index = node.next_index_;
diff --git a/third_party/blink/renderer/platform/wtf/vector_backed_linked_list_test.cc b/third_party/blink/renderer/platform/wtf/vector_backed_linked_list_test.cc index f09e33e..6cf193a 100644 --- a/third_party/blink/renderer/platform/wtf/vector_backed_linked_list_test.cc +++ b/third_party/blink/renderer/platform/wtf/vector_backed_linked_list_test.cc
@@ -110,6 +110,89 @@ EXPECT_EQ(*it, 2); } +TEST(VectorBackedLinkedList, Erase) { + using List = VectorBackedLinkedList<int>; + List list; + + List::iterator it = list.insert(list.end(), 1); + EXPECT_EQ(*it, 1); + list.push_back(2); + list.push_back(3); + list.push_back(4); + list.push_back(5); + EXPECT_EQ(list.size(), 5u); + + List::iterator target = list.begin(); + ++target; + it = list.erase(target); // list = {1, 3, 4, 5} + EXPECT_EQ(*it, 3); + EXPECT_EQ(list.size(), 4u); + it = list.erase(++it); // list = {1, 3, 5} + EXPECT_EQ(*it, 5); + EXPECT_EQ(list.size(), 3u); + + it = list.erase(list.begin()); // list = {3, 5} + EXPECT_EQ(*it, 3); + EXPECT_EQ(list.size(), 2u); + + it = list.begin(); + EXPECT_EQ(*it, 3); + ++it; + EXPECT_EQ(*it, 5); + ++it; + EXPECT_TRUE(it == list.end()); +} + +TEST(VectorBackedLinkedList, PopFront) { + using List = VectorBackedLinkedList<int>; + List list; + + list.push_back(1); + list.push_back(2); + list.push_back(3); + + int i = 1; + for (auto element : list) { + EXPECT_EQ(element, i); + i++; + } + + list.pop_front(); + EXPECT_EQ(list.front(), 2); + EXPECT_EQ(list.back(), 3); + EXPECT_EQ(list.size(), 2u); + + list.pop_front(); + EXPECT_EQ(list.front(), 3); + EXPECT_EQ(list.back(), 3); + EXPECT_EQ(list.size(), 1u); + + list.pop_front(); + EXPECT_TRUE(list.empty()); +} + +TEST(VectorBackedLinkedList, PopBack) { + using List = VectorBackedLinkedList<int>; + List list; + + list.push_back(1); + list.push_back(2); + list.push_back(3); + + list.pop_back(); + EXPECT_EQ(list.front(), 1); + EXPECT_EQ(list.back(), 2); + EXPECT_EQ(list.size(), 2u); + + list.pop_back(); + EXPECT_EQ(list.front(), 1); + EXPECT_EQ(list.back(), 1); + EXPECT_EQ(list.size(), 1u); + + list.pop_back(); + EXPECT_TRUE(list.empty()); +} + TEST(VectorBackedLinkedList, Iterator) { using List = VectorBackedLinkedList<int>; List list;
diff --git a/third_party/blink/tools/gdb/blink.py b/third_party/blink/tools/gdb/blink.py index 1259e40..25a6625 100644 --- a/third_party/blink/tools/gdb/blink.py +++ b/third_party/blink/tools/gdb/blink.py
@@ -360,6 +360,23 @@ return 'DataRef(%s)' % (str(self.val['data_'])) +class BlinkJSONValuePrinter: + def __init__(self, val): + self.val = val + + def to_string(self): + s = str(gdb.parse_and_eval("((blink::JSONValue*) %s)->ToPrettyJSONString().Utf8(0)" % self.val.address)) + return s.replace("\\n", "\n").replace('\\"', '"') + + +class CcPaintOpBufferPrinter: + def __init__(self, val): + self.val = val + + def to_string(self): + return gdb.parse_and_eval("blink::RecordAsJSON(*((cc::PaintOpBuffer*) %s))" % self.val.address) + + def add_pretty_printers(): pretty_printers = ( (re.compile("^WTF::Vector<.*>$"), WTFVectorPrinter), @@ -374,6 +391,12 @@ (re.compile("^blink::PixelsAndPercent$"), BlinkPixelsAndPercentPrinter), (re.compile("^blink::Length$"), BlinkLengthPrinter), (re.compile("^blink::DataRef<.*>$"), BlinkDataRefPrinter), + (re.compile("^blink::JSONValue$"), BlinkJSONValuePrinter), + (re.compile("^blink::JSONBasicValue$"), BlinkJSONValuePrinter), + (re.compile("^blink::JSONString$"), BlinkJSONValuePrinter), + (re.compile("^blink::JSONObject$"), BlinkJSONValuePrinter), + (re.compile("^blink::JSONArray$"), BlinkJSONValuePrinter), + (re.compile("^cc::PaintOpBuffer$"), CcPaintOpBufferPrinter), ) def lookup_function(val):
diff --git a/third_party/blink/web_tests/FlagExpectations/disable-features=OutOfBlinkCors b/third_party/blink/web_tests/FlagExpectations/disable-features=OutOfBlinkCors index 4d2a527..e258ba18 100644 --- a/third_party/blink/web_tests/FlagExpectations/disable-features=OutOfBlinkCors +++ b/third_party/blink/web_tests/FlagExpectations/disable-features=OutOfBlinkCors
@@ -54,6 +54,7 @@ crbug.com/835821 external/wpt/beacon/beacon-cors.sub.window.html [ Failure ] crbug.com/835821 external/wpt/beacon/beacon-navigate.html [ Failure ] crbug.com/835821 external/wpt/beacon/beacon-preflight-failure.sub.window.html [ Failure ] +crbug.com/835821 external/wpt/beacon/beacon-redirect.sub.window.html [ Failure ] crbug.com/835821 external/wpt/beacon/beacon-redirect.window.html [ Failure ] crbug.com/835821 external/wpt/fetch/api/basic/keepalive.html [ Failure ] crbug.com/835821 http/tests/sendbeacon/beacon-blob-with-non-simple-type.html [ Failure ] @@ -69,4 +70,20 @@ crbug.com/1050438 virtual/omt-worker-fetch/http/tests/workers/shared-worker-redirect.html [ Failure ] # XHRReplayData support for Blink CORS was dropped from m82. -crbug.com/958524 http/tests/inspector-protocol/network/xhr-post-replay-cors.js [ Failure ] +crbug.com/958524 http/tests/inspector-protocol/network/xhr-post-replay-cors.js [ Timeout ] + +# Added by https://chromium-review.googlesource.com/c/chromium/src/+/2054468 and +# Blink CORS does not support. +crbug.com/941297 http/tests/inspector-protocol/network/xhr-cors-preflight-redirect-failure.js [ Timeout ] + +# Started failing for unknown reasons. Bisect is needed before the next branch-cut. +crbug.com/1059776 external/wpt/xhr/event-upload-progress-crossorigin.any.html [ Failure ] +crbug.com/1059776 external/wpt/xhr/event-upload-progress-crossorigin.any.worker.html [ Failure ] +crbug.com/1059776 external/wpt/xhr/event-upload-progress.any.html [ Failure ] +crbug.com/1059776 external/wpt/xhr/event-upload-progress.any.worker.html [ Failure ] +crbug.com/1059776 external/wpt/xhr/send-redirect-to-cors.htm [ Failure ] +crbug.com/1059776 virtual/omt-worker-fetch/external/wpt/xhr/event-upload-progress-crossorigin.any.html [ Failure ] +crbug.com/1059776 virtual/omt-worker-fetch/external/wpt/xhr/event-upload-progress-crossorigin.any.worker.html [ Failure ] +crbug.com/1059776 virtual/omt-worker-fetch/external/wpt/xhr/event-upload-progress.any.html [ Failure ] +crbug.com/1059776 virtual/omt-worker-fetch/external/wpt/xhr/event-upload-progress.any.worker.html [ Failure ] +crbug.com/1059776 virtual/omt-worker-fetch/external/wpt/xhr/send-redirect-to-cors.htm [ Failure ]
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_7.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_7.json index 3aa97f6..96fb447a 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_7.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_7.json
@@ -161833,21 +161833,6 @@ "feature-policy/idlharness.window-expected.txt": [ [] ], - "feature-policy/parameters/feature-parameters-inf.html": [ - [] - ], - "feature-policy/parameters/feature-parameters-inf.html.headers": [ - [] - ], - "feature-policy/parameters/feature-parameters.html.headers": [ - [] - ], - "feature-policy/parameters/resources/feature-parameters-frame.html": [ - [] - ], - "feature-policy/parameters/resources/sample-1.png": [ - [] - ], "feature-policy/payment-allowed-by-feature-policy.https.sub.html.headers": [ [] ], @@ -164611,15 +164596,9 @@ "html/cross-origin-embedder-policy/require-corp-load-from-cache-storage.https.html.headers": [ [] ], - "html/cross-origin-embedder-policy/require-corp-sw-from-none.https-expected.txt": [ - [] - ], "html/cross-origin-embedder-policy/require-corp-sw-from-require-corp.https.html.headers": [ [] ], - "html/cross-origin-embedder-policy/require-corp-sw.https-expected.txt": [ - [] - ], "html/cross-origin-embedder-policy/require-corp.https.html.headers": [ [] ], @@ -164668,6 +164647,12 @@ "html/cross-origin-embedder-policy/resources/report.py": [ [] ], + "html/cross-origin-embedder-policy/resources/require-corp-sw-import-scripts.js": [ + [] + ], + "html/cross-origin-embedder-policy/resources/require-corp-sw-import-scripts.js.headers": [ + [] + ], "html/cross-origin-embedder-policy/resources/require-corp-sw.js": [ [] ], @@ -172570,33 +172555,6 @@ "keyboard-map/resources/iframe-keyboard-map-helper.html": [ [] ], - "kv-storage/META.yml": [ - [] - ], - "kv-storage/helpers/equality-asserters.js": [ - [] - ], - "kv-storage/helpers/expose-as-global.html": [ - [] - ], - "kv-storage/helpers/iter-assert.js": [ - [] - ], - "kv-storage/helpers/kvs-tests.js": [ - [] - ], - "kv-storage/secure-context/README.md": [ - [] - ], - "kv-storage/secure-context/import-statement-expected.txt": [ - [] - ], - "kv-storage/secure-context/resources/dummy-module.js": [ - [] - ], - "kv-storage/secure-context/resources/test-side-effects.js": [ - [] - ], "largest-contentful-paint/resources/iframe-stores-entry.html": [ [] ], @@ -175372,24 +175330,6 @@ "origin-policy/policies/op10 cspfp-valid.json": [ [] ], - "origin-policy/policies/op11 no-ids.json": [ - [] - ], - "origin-policy/policies/op12 empty-ids.json": [ - [] - ], - "origin-policy/policies/op13 empty-ids-after-nonempty.json": [ - [] - ], - "origin-policy/policies/op14 non-array-id.json": [ - [] - ], - "origin-policy/policies/op15 mix-of-ids.json": [ - [] - ], - "origin-policy/policies/op16 two-ids.json": [ - [] - ], "origin-policy/policies/op2 cspfp-double-top-level.json": [ [] ], @@ -183835,6 +183775,9 @@ "shadow-dom/resources/shadow-dom.js": [ [] ], + "shadow-dom/slots-imperative-slot-api.tentative-expected.txt": [ + [] + ], "shadow-dom/untriaged/README": [ [] ], @@ -189022,37 +188965,31 @@ "trusted-types/OWNERS": [ [] ], - "trusted-types/block-string-assignment-to-Element-outerHTML.tentative-expected.txt": [ + "trusted-types/default-policy-report-only.tentative.https.html.headers": [ [] ], - "trusted-types/block-string-assignment-to-HTMLElement-generic.tentative-expected.txt": [ + "trusted-types/default-policy.tentative.https.html.headers": [ [] ], - "trusted-types/default-policy-report-only.tentative.html.headers": [ + "trusted-types/empty-default-policy-report-only.tentative.https.html.headers": [ [] ], - "trusted-types/default-policy.tentative.html.headers": [ + "trusted-types/empty-default-policy.tentative.https.html.headers": [ [] ], - "trusted-types/empty-default-policy-report-only.tentative.html.headers": [ + "trusted-types/eval-csp-no-tt.tentative.https-expected.txt": [ [] ], - "trusted-types/empty-default-policy.tentative.html.headers": [ + "trusted-types/eval-no-csp-no-tt-default-policy.tentative.https-expected.txt": [ [] ], - "trusted-types/eval-csp-no-tt.tentative-expected.txt": [ + "trusted-types/eval-no-csp-no-tt.tentative.https-expected.txt": [ [] ], - "trusted-types/eval-no-csp-no-tt-default-policy.tentative-expected.txt": [ + "trusted-types/no-require-trusted-types-for-report-only.tentative.https.html.headers": [ [] ], - "trusted-types/eval-no-csp-no-tt.tentative-expected.txt": [ - [] - ], - "trusted-types/no-require-trusted-types-for-report-only.tentative.html.headers": [ - [] - ], - "trusted-types/require-trusted-types-for-report-only.tentative.html.headers": [ + "trusted-types/require-trusted-types-for-report-only.tentative.https.html.headers": [ [] ], "trusted-types/support/HTMLScriptElement-internal-slot-support.html": [ @@ -189082,7 +189019,7 @@ "trusted-types/support/worker.js": [ [] ], - "trusted-types/trusted-types-duplicate-names-list-report-only.tentative.html.headers": [ + "trusted-types/trusted-types-duplicate-names-list-report-only.tentative.https.html.headers": [ [] ], "trusted-types/trusted-types-eval-reporting-no-unsafe-eval.tentative.https.html.headers": [ @@ -237026,6 +236963,12 @@ {} ] ], + "css/cssom-view/cssom-getBoundingClientRect-003.html": [ + [ + "css/cssom-view/cssom-getBoundingClientRect-003.html", + {} + ] + ], "css/cssom-view/cssom-getBoxQuads-001.html": [ [ "css/cssom-view/cssom-getBoxQuads-001.html", @@ -255483,18 +255426,6 @@ } ] ], - "feature-policy/parameters/feature-parameters-with-frames.html": [ - [ - "feature-policy/parameters/feature-parameters-with-frames.html", - {} - ] - ], - "feature-policy/parameters/feature-parameters.html": [ - [ - "feature-policy/parameters/feature-parameters.html", - {} - ] - ], "feature-policy/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html": [ [ "feature-policy/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html", @@ -277278,112 +277209,6 @@ {} ] ], - "kv-storage/backingstore.https.html": [ - [ - "kv-storage/backingstore.https.html", - {} - ] - ], - "kv-storage/cause-errors-via-idb.https.html": [ - [ - "kv-storage/cause-errors-via-idb.https.html", - { - "timeout": "long" - } - ] - ], - "kv-storage/entries.https.html": [ - [ - "kv-storage/entries.https.html", - { - "timeout": "long" - } - ] - ], - "kv-storage/interface.https.html": [ - [ - "kv-storage/interface.https.html", - {} - ] - ], - "kv-storage/key-types.https.html": [ - [ - "kv-storage/key-types.https.html", - { - "timeout": "long" - } - ] - ], - "kv-storage/keys-values-entries.https.html": [ - [ - "kv-storage/keys-values-entries.https.html", - { - "timeout": "long" - } - ] - ], - "kv-storage/keys.https.html": [ - [ - "kv-storage/keys.https.html", - { - "timeout": "long" - } - ] - ], - "kv-storage/secure-context/dynamic-import.html": [ - [ - "kv-storage/secure-context/dynamic-import.html", - {} - ] - ], - "kv-storage/secure-context/import-maps.html": [ - [ - "kv-storage/secure-context/import-maps.html", - {} - ] - ], - "kv-storage/secure-context/import-statement.html": [ - [ - "kv-storage/secure-context/import-statement.html", - {} - ] - ], - "kv-storage/secure-context/script-element.html": [ - [ - "kv-storage/secure-context/script-element.html", - {} - ] - ], - "kv-storage/secure-context/side-effects.html": [ - [ - "kv-storage/secure-context/side-effects.html", - {} - ] - ], - "kv-storage/storage-smoke-test.https.html": [ - [ - "kv-storage/storage-smoke-test.https.html", - { - "timeout": "long" - } - ] - ], - "kv-storage/undefined-value.https.html": [ - [ - "kv-storage/undefined-value.https.html", - { - "timeout": "long" - } - ] - ], - "kv-storage/values.https.html": [ - [ - "kv-storage/values.https.html", - { - "timeout": "long" - } - ] - ], "largest-contentful-paint/contracted-image.html": [ [ "largest-contentful-paint/contracted-image.html", @@ -295022,132 +294847,6 @@ {} ] ], - "origin-policy/idlharness.any.js": [ - [ - "origin-policy/idlharness.any.html", - { - "script_metadata": [ - [ - "global", - "window,worker" - ], - [ - "script", - "/resources/WebIDLParser.js" - ], - [ - "script", - "/resources/idlharness.js" - ] - ] - } - ], - [ - "origin-policy/idlharness.any.serviceworker.html", - { - "script_metadata": [ - [ - "global", - "window,worker" - ], - [ - "script", - "/resources/WebIDLParser.js" - ], - [ - "script", - "/resources/idlharness.js" - ] - ] - } - ], - [ - "origin-policy/idlharness.any.sharedworker.html", - { - "script_metadata": [ - [ - "global", - "window,worker" - ], - [ - "script", - "/resources/WebIDLParser.js" - ], - [ - "script", - "/resources/idlharness.js" - ] - ] - } - ], - [ - "origin-policy/idlharness.any.worker.html", - { - "script_metadata": [ - [ - "global", - "window,worker" - ], - [ - "script", - "/resources/WebIDLParser.js" - ], - [ - "script", - "/resources/idlharness.js" - ] - ] - } - ] - ], - "origin-policy/ids/empty-ids-after-nonempty.https.html": [ - [ - "origin-policy/ids/empty-ids-after-nonempty.https.html", - {} - ] - ], - "origin-policy/ids/empty-ids.https.html": [ - [ - "origin-policy/ids/empty-ids.https.html", - {} - ] - ], - "origin-policy/ids/mix-of-ids.https.html": [ - [ - "origin-policy/ids/mix-of-ids.https.html", - {} - ] - ], - "origin-policy/ids/no-ids.https.html": [ - [ - "origin-policy/ids/no-ids.https.html", - {} - ] - ], - "origin-policy/ids/non-array-id.https.html": [ - [ - "origin-policy/ids/non-array-id.https.html", - {} - ] - ], - "origin-policy/ids/same-object-returned.https.html": [ - [ - "origin-policy/ids/same-object-returned.https.html", - {} - ] - ], - "origin-policy/ids/still-present-in-http.html": [ - [ - "origin-policy/ids/still-present-in-http.html", - {} - ] - ], - "origin-policy/ids/two-ids.https.html": [ - [ - "origin-policy/ids/two-ids.https.html", - {} - ] - ], "page-visibility/idlharness.window.js": [ [ "page-visibility/idlharness.window.html", @@ -342342,6 +342041,12 @@ {} ] ], + "shadow-dom/slots-imperative-slot-api.tentative.html": [ + [ + "shadow-dom/slots-imperative-slot-api.tentative.html", + {} + ] + ], "shadow-dom/slots-outside-shadow-dom.html": [ [ "shadow-dom/slots-outside-shadow-dom.html", @@ -351166,6 +350871,18 @@ {} ] ], + "svg/types/scripted/SVGGraphicsElement.getBBox-01.html": [ + [ + "svg/types/scripted/SVGGraphicsElement.getBBox-01.html", + {} + ] + ], + "svg/types/scripted/SVGGraphicsElement.getBBox-02.html": [ + [ + "svg/types/scripted/SVGGraphicsElement.getBBox-02.html", + {} + ] + ], "svg/types/scripted/SVGGraphicsElement.svg": [ [ "svg/types/scripted/SVGGraphicsElement.svg", @@ -351304,179 +351021,179 @@ {} ] ], - "trusted-types/DOMParser-parseFromString.tentative.html": [ + "trusted-types/DOMParser-parseFromString.tentative.https.html": [ [ - "trusted-types/DOMParser-parseFromString.tentative.html", + "trusted-types/DOMParser-parseFromString.tentative.https.html", {} ] ], - "trusted-types/DOMWindowTimers-setTimeout-setInterval.tentative.html": [ + "trusted-types/DOMWindowTimers-setTimeout-setInterval.tentative.https.html": [ [ - "trusted-types/DOMWindowTimers-setTimeout-setInterval.tentative.html", + "trusted-types/DOMWindowTimers-setTimeout-setInterval.tentative.https.html", {} ] ], - "trusted-types/Document-write.tentative.html": [ + "trusted-types/Document-write.tentative.https.html": [ [ - "trusted-types/Document-write.tentative.html", + "trusted-types/Document-write.tentative.https.html", {} ] ], - "trusted-types/Element-insertAdjacentHTML.tentative.html": [ + "trusted-types/Element-insertAdjacentHTML.tentative.https.html": [ [ - "trusted-types/Element-insertAdjacentHTML.tentative.html", + "trusted-types/Element-insertAdjacentHTML.tentative.https.html", {} ] ], - "trusted-types/Element-insertAdjacentText.tentative.html": [ + "trusted-types/Element-insertAdjacentText.tentative.https.html": [ [ - "trusted-types/Element-insertAdjacentText.tentative.html", + "trusted-types/Element-insertAdjacentText.tentative.https.html", {} ] ], - "trusted-types/Element-outerHTML.tentative.html": [ + "trusted-types/Element-outerHTML.tentative.https.html": [ [ - "trusted-types/Element-outerHTML.tentative.html", + "trusted-types/Element-outerHTML.tentative.https.html", {} ] ], - "trusted-types/Element-setAttribute.tentative.html": [ + "trusted-types/Element-setAttribute.tentative.https.html": [ [ - "trusted-types/Element-setAttribute.tentative.html", + "trusted-types/Element-setAttribute.tentative.https.html", {} ] ], - "trusted-types/Element-setAttributeNS.tentative.html": [ + "trusted-types/Element-setAttributeNS.tentative.https.html": [ [ - "trusted-types/Element-setAttributeNS.tentative.html", + "trusted-types/Element-setAttributeNS.tentative.https.html", {} ] ], - "trusted-types/GlobalEventHandlers-onclick.tentative.html": [ + "trusted-types/GlobalEventHandlers-onclick.tentative.https.html": [ [ - "trusted-types/GlobalEventHandlers-onclick.tentative.html", + "trusted-types/GlobalEventHandlers-onclick.tentative.https.html", {} ] ], - "trusted-types/HTMLElement-generic.tentative.html": [ + "trusted-types/HTMLElement-generic.tentative.https.html": [ [ - "trusted-types/HTMLElement-generic.tentative.html", + "trusted-types/HTMLElement-generic.tentative.https.html", {} ] ], - "trusted-types/HTMLScriptElement-internal-slot.tentative.html": [ + "trusted-types/HTMLScriptElement-internal-slot.tentative.https.html": [ [ - "trusted-types/HTMLScriptElement-internal-slot.tentative.html", + "trusted-types/HTMLScriptElement-internal-slot.tentative.https.html", {} ] ], - "trusted-types/Node-multiple-arguments.tentative.html": [ + "trusted-types/Node-multiple-arguments.tentative.https.html": [ [ - "trusted-types/Node-multiple-arguments.tentative.html", + "trusted-types/Node-multiple-arguments.tentative.https.html", {} ] ], - "trusted-types/Range-createContextualFragment.tentative.html": [ + "trusted-types/Range-createContextualFragment.tentative.https.html": [ [ - "trusted-types/Range-createContextualFragment.tentative.html", + "trusted-types/Range-createContextualFragment.tentative.https.html", {} ] ], - "trusted-types/TrustedType-AttributeNodes.tentative.html": [ + "trusted-types/TrustedType-AttributeNodes.tentative.https.html": [ [ - "trusted-types/TrustedType-AttributeNodes.tentative.html", + "trusted-types/TrustedType-AttributeNodes.tentative.https.html", {} ] ], - "trusted-types/TrustedTypePolicy-CSP-no-name.tentative.html": [ + "trusted-types/TrustedTypePolicy-CSP-no-name.tentative.https.html": [ [ - "trusted-types/TrustedTypePolicy-CSP-no-name.tentative.html", + "trusted-types/TrustedTypePolicy-CSP-no-name.tentative.https.html", {} ] ], - "trusted-types/TrustedTypePolicy-CSP-wildcard.tentative.html": [ + "trusted-types/TrustedTypePolicy-CSP-wildcard.tentative.https.html": [ [ - "trusted-types/TrustedTypePolicy-CSP-wildcard.tentative.html", + "trusted-types/TrustedTypePolicy-CSP-wildcard.tentative.https.html", {} ] ], - "trusted-types/TrustedTypePolicy-createXXX.tentative.html": [ + "trusted-types/TrustedTypePolicy-createXXX.tentative.https.html": [ [ - "trusted-types/TrustedTypePolicy-createXXX.tentative.html", + "trusted-types/TrustedTypePolicy-createXXX.tentative.https.html", {} ] ], - "trusted-types/TrustedTypePolicyFactory-constants.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-constants.tentative.https.html": [ [ - "trusted-types/TrustedTypePolicyFactory-constants.tentative.html", + "trusted-types/TrustedTypePolicyFactory-constants.tentative.https.html", {} ] ], - "trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.https.html": [ [ - "trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html", + "trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.https.html", {} ] ], - "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-noNamesGiven.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-noNamesGiven.tentative.https.html": [ [ - "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-noNamesGiven.tentative.html", + "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-noNamesGiven.tentative.https.html", {} ] ], - "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-wildcard.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-wildcard.tentative.https.html": [ [ - "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-wildcard.tentative.html", + "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-wildcard.tentative.https.html", {} ] ], - "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests.tentative.https.html": [ [ - "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests.tentative.html", + "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests.tentative.https.html", {} ] ], - "trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.https.html": [ [ - "trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html", + "trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.https.html", {} ] ], - "trusted-types/TrustedTypePolicyFactory-createPolicy-unenforced.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-createPolicy-unenforced.tentative.https.html": [ [ - "trusted-types/TrustedTypePolicyFactory-createPolicy-unenforced.tentative.html", + "trusted-types/TrustedTypePolicyFactory-createPolicy-unenforced.tentative.https.html", {} ] ], - "trusted-types/TrustedTypePolicyFactory-defaultPolicy.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-defaultPolicy.tentative.https.html": [ [ - "trusted-types/TrustedTypePolicyFactory-defaultPolicy.tentative.html", + "trusted-types/TrustedTypePolicyFactory-defaultPolicy.tentative.https.html", {} ] ], - "trusted-types/TrustedTypePolicyFactory-getPropertyType.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-getPropertyType.tentative.https.html": [ [ - "trusted-types/TrustedTypePolicyFactory-getPropertyType.tentative.html", + "trusted-types/TrustedTypePolicyFactory-getPropertyType.tentative.https.html", {} ] ], - "trusted-types/TrustedTypePolicyFactory-isXXX.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-isXXX.tentative.https.html": [ [ - "trusted-types/TrustedTypePolicyFactory-isXXX.tentative.html", + "trusted-types/TrustedTypePolicyFactory-isXXX.tentative.https.html", {} ] ], - "trusted-types/TrustedTypePolicyFactory-metadata.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-metadata.tentative.https.html": [ [ - "trusted-types/TrustedTypePolicyFactory-metadata.tentative.html", + "trusted-types/TrustedTypePolicyFactory-metadata.tentative.https.html", { "timeout": "long" } ] ], - "trusted-types/Window-TrustedTypes.tentative.html": [ + "trusted-types/Window-TrustedTypes.tentative.https.html": [ [ - "trusted-types/Window-TrustedTypes.tentative.html", + "trusted-types/Window-TrustedTypes.tentative.https.html", {} ] ], @@ -351486,141 +351203,141 @@ {} ] ], - "trusted-types/block-Node-multiple-arguments.tentative.html": [ + "trusted-types/block-Node-multiple-arguments.tentative.https.html": [ [ - "trusted-types/block-Node-multiple-arguments.tentative.html", + "trusted-types/block-Node-multiple-arguments.tentative.https.html", {} ] ], - "trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.html": [ + "trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.https.html": [ [ - "trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.html", + "trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.https.html", {} ] ], - "trusted-types/block-string-assignment-to-DOMWindowTimers-setTimeout-setInterval.tentative.html": [ + "trusted-types/block-string-assignment-to-DOMWindowTimers-setTimeout-setInterval.tentative.https.html": [ [ - "trusted-types/block-string-assignment-to-DOMWindowTimers-setTimeout-setInterval.tentative.html", + "trusted-types/block-string-assignment-to-DOMWindowTimers-setTimeout-setInterval.tentative.https.html", {} ] ], - "trusted-types/block-string-assignment-to-Document-write.tentative.html": [ + "trusted-types/block-string-assignment-to-Document-write.tentative.https.html": [ [ - "trusted-types/block-string-assignment-to-Document-write.tentative.html", + "trusted-types/block-string-assignment-to-Document-write.tentative.https.html", {} ] ], - "trusted-types/block-string-assignment-to-Element-insertAdjacentHTML.tentative.html": [ + "trusted-types/block-string-assignment-to-Element-insertAdjacentHTML.tentative.https.html": [ [ - "trusted-types/block-string-assignment-to-Element-insertAdjacentHTML.tentative.html", + "trusted-types/block-string-assignment-to-Element-insertAdjacentHTML.tentative.https.html", {} ] ], - "trusted-types/block-string-assignment-to-Element-outerHTML.tentative.html": [ + "trusted-types/block-string-assignment-to-Element-outerHTML.tentative.https.html": [ [ - "trusted-types/block-string-assignment-to-Element-outerHTML.tentative.html", + "trusted-types/block-string-assignment-to-Element-outerHTML.tentative.https.html", {} ] ], - "trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html": [ + "trusted-types/block-string-assignment-to-Element-setAttribute.tentative.https.html": [ [ - "trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html", + "trusted-types/block-string-assignment-to-Element-setAttribute.tentative.https.html", {} ] ], - "trusted-types/block-string-assignment-to-Element-setAttributeNS.tentative.html": [ + "trusted-types/block-string-assignment-to-Element-setAttributeNS.tentative.https.html": [ [ - "trusted-types/block-string-assignment-to-Element-setAttributeNS.tentative.html", + "trusted-types/block-string-assignment-to-Element-setAttributeNS.tentative.https.html", {} ] ], - "trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html": [ + "trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.https.html": [ [ - "trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html", + "trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.https.html", {} ] ], - "trusted-types/block-string-assignment-to-Range-createContextualFragment.tentative.html": [ + "trusted-types/block-string-assignment-to-Range-createContextualFragment.tentative.https.html": [ [ - "trusted-types/block-string-assignment-to-Range-createContextualFragment.tentative.html", + "trusted-types/block-string-assignment-to-Range-createContextualFragment.tentative.https.html", {} ] ], - "trusted-types/block-text-node-insertion-into-script-element.tentative.html": [ + "trusted-types/block-text-node-insertion-into-script-element.tentative.https.html": [ [ - "trusted-types/block-text-node-insertion-into-script-element.tentative.html", + "trusted-types/block-text-node-insertion-into-script-element.tentative.https.html", {} ] ], - "trusted-types/csp-block-eval.tentative.html": [ + "trusted-types/csp-block-eval.tentative.https.html": [ [ - "trusted-types/csp-block-eval.tentative.html", + "trusted-types/csp-block-eval.tentative.https.html", {} ] ], - "trusted-types/default-policy-report-only.tentative.html": [ + "trusted-types/default-policy-report-only.tentative.https.html": [ [ - "trusted-types/default-policy-report-only.tentative.html", + "trusted-types/default-policy-report-only.tentative.https.html", {} ] ], - "trusted-types/default-policy.tentative.html": [ + "trusted-types/default-policy.tentative.https.html": [ [ - "trusted-types/default-policy.tentative.html", + "trusted-types/default-policy.tentative.https.html", {} ] ], - "trusted-types/empty-default-policy-report-only.tentative.html": [ + "trusted-types/empty-default-policy-report-only.tentative.https.html": [ [ - "trusted-types/empty-default-policy-report-only.tentative.html", + "trusted-types/empty-default-policy-report-only.tentative.https.html", {} ] ], - "trusted-types/empty-default-policy.tentative.html": [ + "trusted-types/empty-default-policy.tentative.https.html": [ [ - "trusted-types/empty-default-policy.tentative.html", + "trusted-types/empty-default-policy.tentative.https.html", {} ] ], - "trusted-types/eval-csp-no-tt.tentative.html": [ + "trusted-types/eval-csp-no-tt.tentative.https.html": [ [ - "trusted-types/eval-csp-no-tt.tentative.html", + "trusted-types/eval-csp-no-tt.tentative.https.html", {} ] ], - "trusted-types/eval-csp-tt-default-policy.tentative.html": [ + "trusted-types/eval-csp-tt-default-policy.tentative.https.html": [ [ - "trusted-types/eval-csp-tt-default-policy.tentative.html", + "trusted-types/eval-csp-tt-default-policy.tentative.https.html", {} ] ], - "trusted-types/eval-csp-tt-no-default-policy.tentative.html": [ + "trusted-types/eval-csp-tt-no-default-policy.tentative.https.html": [ [ - "trusted-types/eval-csp-tt-no-default-policy.tentative.html", + "trusted-types/eval-csp-tt-no-default-policy.tentative.https.html", {} ] ], - "trusted-types/eval-no-csp-no-tt-default-policy.tentative.html": [ + "trusted-types/eval-no-csp-no-tt-default-policy.tentative.https.html": [ [ - "trusted-types/eval-no-csp-no-tt-default-policy.tentative.html", + "trusted-types/eval-no-csp-no-tt-default-policy.tentative.https.html", {} ] ], - "trusted-types/eval-no-csp-no-tt.tentative.html": [ + "trusted-types/eval-no-csp-no-tt.tentative.https.html": [ [ - "trusted-types/eval-no-csp-no-tt.tentative.html", + "trusted-types/eval-no-csp-no-tt.tentative.https.html", {} ] ], - "trusted-types/eval-with-permissive-csp.tentative.html": [ + "trusted-types/eval-with-permissive-csp.tentative.https.html": [ [ - "trusted-types/eval-with-permissive-csp.tentative.html", + "trusted-types/eval-with-permissive-csp.tentative.https.html", {} ] ], - "trusted-types/idlharness.tentative.window.js": [ + "trusted-types/idlharness.tentative.https.window.js": [ [ - "trusted-types/idlharness.tentative.window.html", + "trusted-types/idlharness.tentative.https.window.html", { "script_metadata": [ [ @@ -351635,51 +351352,51 @@ } ] ], - "trusted-types/no-require-trusted-types-for-report-only.tentative.html": [ + "trusted-types/no-require-trusted-types-for-report-only.tentative.https.html": [ [ - "trusted-types/no-require-trusted-types-for-report-only.tentative.html", + "trusted-types/no-require-trusted-types-for-report-only.tentative.https.html", {} ] ], - "trusted-types/no-require-trusted-types-for.tentative.html": [ + "trusted-types/no-require-trusted-types-for.tentative.https.html": [ [ - "trusted-types/no-require-trusted-types-for.tentative.html", + "trusted-types/no-require-trusted-types-for.tentative.https.html", {} ] ], - "trusted-types/require-trusted-types-for-report-only.tentative.html": [ + "trusted-types/require-trusted-types-for-report-only.tentative.https.html": [ [ - "trusted-types/require-trusted-types-for-report-only.tentative.html", + "trusted-types/require-trusted-types-for-report-only.tentative.https.html", {} ] ], - "trusted-types/require-trusted-types-for.tentative.html": [ + "trusted-types/require-trusted-types-for.tentative.https.html": [ [ - "trusted-types/require-trusted-types-for.tentative.html", + "trusted-types/require-trusted-types-for.tentative.https.html", {} ] ], - "trusted-types/trusted-types-createHTMLDocument.tentative.html": [ + "trusted-types/trusted-types-createHTMLDocument.tentative.https.html": [ [ - "trusted-types/trusted-types-createHTMLDocument.tentative.html", + "trusted-types/trusted-types-createHTMLDocument.tentative.https.html", {} ] ], - "trusted-types/trusted-types-duplicate-names-list-report-only.tentative.html": [ + "trusted-types/trusted-types-duplicate-names-list-report-only.tentative.https.html": [ [ - "trusted-types/trusted-types-duplicate-names-list-report-only.tentative.html", + "trusted-types/trusted-types-duplicate-names-list-report-only.tentative.https.html", {} ] ], - "trusted-types/trusted-types-duplicate-names-list.tentative.html": [ + "trusted-types/trusted-types-duplicate-names-list.tentative.https.html": [ [ - "trusted-types/trusted-types-duplicate-names-list.tentative.html", + "trusted-types/trusted-types-duplicate-names-list.tentative.https.html", {} ] ], - "trusted-types/trusted-types-duplicate-names.tentative.html": [ + "trusted-types/trusted-types-duplicate-names.tentative.https.html": [ [ - "trusted-types/trusted-types-duplicate-names.tentative.html", + "trusted-types/trusted-types-duplicate-names.tentative.https.html", {} ] ], @@ -351701,9 +351418,9 @@ {} ] ], - "trusted-types/trusted-types-navigation.tentative.html": [ + "trusted-types/trusted-types-navigation.tentative.https.html": [ [ - "trusted-types/trusted-types-navigation.tentative.html", + "trusted-types/trusted-types-navigation.tentative.https.html", {} ] ], @@ -351725,9 +351442,9 @@ {} ] ], - "trusted-types/tt-block-eval.tentative.html": [ + "trusted-types/tt-block-eval.tentative.https.html": [ [ - "trusted-types/tt-block-eval.tentative.html", + "trusted-types/tt-block-eval.tentative.https.html", {} ] ], @@ -400658,11 +400375,11 @@ "reftest" ], "css/CSS2/floats/floats-wrap-bfc-outside-001-ref.xht": [ - "5ea97a40f51c830da10dd0dd00e1197f40172b6b", + "20ae62757d41bc51c29192e8be71ad7be0fc5b78", "support" ], "css/CSS2/floats/floats-wrap-bfc-outside-001.xht": [ - "9ae6447f3c6e7fdd6dc080b1829782eeb6b8cb0e", + "1dec29a58388a844e2cb2bd4adba840c7017290f", "reftest" ], "css/CSS2/floats/floats-wrap-top-below-001l-notref.xht": [ @@ -476609,6 +476326,10 @@ "a7c3568969a77903d9b49f6b09d70046ba2b98b7", "testharness" ], + "css/cssom-view/cssom-getBoundingClientRect-003.html": [ + "5eb9448f67645309f38aa1d8361926386447b408", + "testharness" + ], "css/cssom-view/cssom-getBoundingClientRect-vertical-rl-ref.html": [ "1ee4fe2652ff56655c20963f90810de6a979462f", "support" @@ -494261,34 +493982,6 @@ "33bbe3c14ffe28d961cc4c71c0b367028ff8d2df", "testharness" ], - "feature-policy/parameters/feature-parameters-inf.html": [ - "db21427c8ed9f3c2f8e8b8ba9d91d4fd230fc2ff", - "support" - ], - "feature-policy/parameters/feature-parameters-inf.html.headers": [ - "1ec003431b3f090dbb596f6973b84f81de27ace0", - "support" - ], - "feature-policy/parameters/feature-parameters-with-frames.html": [ - "de0a3ab1e3963e3e7c8da1e6bec35d454b1a9fdb", - "testharness" - ], - "feature-policy/parameters/feature-parameters.html": [ - "9830f93eb4dcac9aaa2dfe6d209c452df5f94701", - "testharness" - ], - "feature-policy/parameters/feature-parameters.html.headers": [ - "b4fa805c5696ab5ef8171508aeccf200e9d95df3", - "support" - ], - "feature-policy/parameters/resources/feature-parameters-frame.html": [ - "4f01f85795da8114e762cb0ddc271cefdd02da1f", - "support" - ], - "feature-policy/parameters/resources/sample-1.png": [ - "92901925c6082b7fb01fade09f87356308218a47", - "support" - ], "feature-policy/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html": [ "daa2aa182daed73bd51bf32cf7981a805e3956c8", "testharness" @@ -495298,7 +494991,7 @@ "testharness" ], "fetch/api/redirect/redirect-mode.any.js": [ - "557c249ff9d86fb8f9f4829ef7b0e384957d0a53", + "eed44e0414cb8947c9b7c21df6ef288f733f8994", "testharness" ], "fetch/api/redirect/redirect-origin.any.js": [ @@ -501293,10 +500986,6 @@ "8df98474b589d070992677cb0134bd47bd0509c4", "support" ], - "html/cross-origin-embedder-policy/require-corp-sw-from-none.https-expected.txt": [ - "0e8e87598260a0a1af1beaae14a313c890344bd5", - "support" - ], "html/cross-origin-embedder-policy/require-corp-sw-from-none.https.html": [ "adb73bfba45bfee3eaaa3516482424189ac8c493", "testharness" @@ -501309,12 +500998,8 @@ "8df98474b589d070992677cb0134bd47bd0509c4", "support" ], - "html/cross-origin-embedder-policy/require-corp-sw.https-expected.txt": [ - "8b1013cd7299390f2597c4425aacd684564bb3a3", - "support" - ], "html/cross-origin-embedder-policy/require-corp-sw.https.html": [ - "690ea6314f5c28c1bd8b58cb0d2350831361314f", + "bb154aecae81235a20af44bc173bb559274cb59e", "testharness" ], "html/cross-origin-embedder-policy/require-corp.https.html": [ @@ -501385,6 +501070,14 @@ "8adf3009d08e2311cdf9c2008d7a10a0882ce030", "support" ], + "html/cross-origin-embedder-policy/resources/require-corp-sw-import-scripts.js": [ + "e652c5bf303074d7c396f53146bb8af6c3f35644", + "support" + ], + "html/cross-origin-embedder-policy/resources/require-corp-sw-import-scripts.js.headers": [ + "6604450991a122e3e241e40b1b9e0516c525389d", + "support" + ], "html/cross-origin-embedder-policy/resources/require-corp-sw.js": [ "3e2f069ded033f33528c8f850d330c5b4e84e46c", "support" @@ -509034,7 +508727,7 @@ "testharness" ], "html/rendering/widgets/baseline-alignment-and-overflow.tentative.html": [ - "9ff6662002e30a3ee7ab51373320eb1f15513892", + "1c0b312eb4520e789bee93a4669e16035fde1648", "testharness" ], "html/rendering/widgets/button-layout/abspos.html": [ @@ -522106,7 +521799,7 @@ "support" ], "interfaces/trusted-types.tentative.idl": [ - "5442d8b44e65d21cbfddbef6b5b323390640e6bb", + "18a8bfeb3cbeb1e35de3be13719a74dcdbf49d92", "support" ], "interfaces/uievents.idl": [ @@ -522605,102 +522298,6 @@ "5a4beba7e45830e72c28d460495e977a64a8bc7a", "support" ], - "kv-storage/META.yml": [ - "bf4a1e6e8b44bc78cf7a624a12b254cbac2f25a5", - "support" - ], - "kv-storage/backingstore.https.html": [ - "c0f49d48f48fdf3db7e724fa4760121c5e1f595a", - "testharness" - ], - "kv-storage/cause-errors-via-idb.https.html": [ - "16be979d037523974e9582175e9182a31bd7e092", - "testharness" - ], - "kv-storage/entries.https.html": [ - "07815920d5eec7235ceaa596558627991866715b", - "testharness" - ], - "kv-storage/helpers/equality-asserters.js": [ - "448ab31348cee50be8820185d8bdfb8f626eb9dc", - "support" - ], - "kv-storage/helpers/expose-as-global.html": [ - "4ff3c6cf9c22fdfedfe7987d46eeba37bd666266", - "support" - ], - "kv-storage/helpers/iter-assert.js": [ - "e1ac73c8e9abd0d6c55812523abcc590a638da9f", - "support" - ], - "kv-storage/helpers/kvs-tests.js": [ - "9fd9d205ae1996c355647d86e8b12b46369d1053", - "support" - ], - "kv-storage/interface.https.html": [ - "d98b1c876d39583546968bacfc2e6766bbedbf27", - "testharness" - ], - "kv-storage/key-types.https.html": [ - "210645f4c5a327f28465f46399a042f917f097ef", - "testharness" - ], - "kv-storage/keys-values-entries.https.html": [ - "8aa6b9053dbe0fad49301a55756b49f354497ef5", - "testharness" - ], - "kv-storage/keys.https.html": [ - "3535d2fb93993af74d752c80626d5f10c0d24a60", - "testharness" - ], - "kv-storage/secure-context/README.md": [ - "9b3539995bfa656860ce6cb9b51b287e4afcfb30", - "support" - ], - "kv-storage/secure-context/dynamic-import.html": [ - "e2d0ce378eff4ed6115173ecdb83c7c7b1ee4a71", - "testharness" - ], - "kv-storage/secure-context/import-maps.html": [ - "211b9e43b1f18e9bdab85b890af000e47395c2ff", - "testharness" - ], - "kv-storage/secure-context/import-statement-expected.txt": [ - "879a0facba4d00db9e8435b38ff5cd93d281f055", - "support" - ], - "kv-storage/secure-context/import-statement.html": [ - "71e14b04e3144f866ff6cda980998dedaa6a559b", - "testharness" - ], - "kv-storage/secure-context/resources/dummy-module.js": [ - "27fb98860ea352b1df491031487ccc0bbb9bdf42", - "support" - ], - "kv-storage/secure-context/resources/test-side-effects.js": [ - "39780a92fff17fdf64d8b43c025304b59b1fe2b7", - "support" - ], - "kv-storage/secure-context/script-element.html": [ - "b8170549ab558bbef98a357074b1ec6281a385a7", - "testharness" - ], - "kv-storage/secure-context/side-effects.html": [ - "f4c4b691d30db83342aaa5fc3a181d4dc98b4f1d", - "testharness" - ], - "kv-storage/storage-smoke-test.https.html": [ - "748b59bb2f2d0364669c55e566e8e84ae285b943", - "testharness" - ], - "kv-storage/undefined-value.https.html": [ - "d87641e95b8f55a0f7c3d724f620f17943537c96", - "testharness" - ], - "kv-storage/values.https.html": [ - "bbdc7aee84437ebd0e029556dd1d1fcb9670dc5d", - "testharness" - ], "largest-contentful-paint/contracted-image.html": [ "ed6adfb2c7c66c65bd13f514be173d1cb48ff19e", "testharness" @@ -522974,7 +522571,7 @@ "testharness" ], "lint.whitelist": [ - "6ea2bd4ec1e2dcc8ee77d962b723104b7ee02b0f", + "99a6309956e807a4459d36b94fe13574688d6c67", "support" ], "loading/preloader-css-import-no-quote.tentative.html": [ @@ -538061,42 +537658,6 @@ "8d2d0f4495ff7f401991accc044f21fef115ad75", "testharness" ], - "origin-policy/idlharness.any.js": [ - "c8ee8a326d1325ab38cae686c4647a81ec12e517", - "testharness" - ], - "origin-policy/ids/empty-ids-after-nonempty.https.html": [ - "3bffa9cffa713d49a78ce5effdb736ca07022da2", - "testharness" - ], - "origin-policy/ids/empty-ids.https.html": [ - "385aa7c66fe639b3f7d52c7d936a0ed09522e131", - "testharness" - ], - "origin-policy/ids/mix-of-ids.https.html": [ - "7be2c9f48df9fd192b4855e984cad13466caaf7b", - "testharness" - ], - "origin-policy/ids/no-ids.https.html": [ - "1fe3d480d0acebeb869b82cc7838575a6d915bbb", - "testharness" - ], - "origin-policy/ids/non-array-id.https.html": [ - "223b78f929c1346774fca040e767d93bc7605e40", - "testharness" - ], - "origin-policy/ids/same-object-returned.https.html": [ - "9286f9f7344808c4fa548f47c675a9e963421229", - "testharness" - ], - "origin-policy/ids/still-present-in-http.html": [ - "01969450f92aca7657b69fd1c58888d4627d58f6", - "testharness" - ], - "origin-policy/ids/two-ids.https.html": [ - "630f07280790e0631fe1c2e795194bd541ffee72", - "testharness" - ], "origin-policy/policies/README.md": [ "b07be74035f2dee0f379f0a8c499cd392f81f96a", "support" @@ -538109,30 +537670,6 @@ "0fc1d163f2b61951813eae9ca84f2d4fe7f59703", "support" ], - "origin-policy/policies/op11 no-ids.json": [ - "0f3907bb3e61b60750762db1167611184cfcf384", - "support" - ], - "origin-policy/policies/op12 empty-ids.json": [ - "e5c31d2561c1a52ecd728239c20a96c7052804ba", - "support" - ], - "origin-policy/policies/op13 empty-ids-after-nonempty.json": [ - "773772457448691e1c82003aabbe484a10903aa3", - "support" - ], - "origin-policy/policies/op14 non-array-id.json": [ - "bc7cf74fbaa766c7bc6d5af4603fd23aa6bec999", - "support" - ], - "origin-policy/policies/op15 mix-of-ids.json": [ - "b49637dbd5c6cecbbbebdad0535895809e87f8c0", - "support" - ], - "origin-policy/policies/op16 two-ids.json": [ - "7a7d8398aa1b8a10c3b4235da35b0094ef5a2214", - "support" - ], "origin-policy/policies/op2 cspfp-double-top-level.json": [ "26d798b585d96fd29994dc39544a15bd2f6a639d", "support" @@ -538166,11 +537703,11 @@ "support" ], "origin-policy/resources/origin-policy-test-runner.js": [ - "d3fd2e4ce11a7d18075c900a9087f47438d42c10", + "a1c6453debd20d7abc3923a273a0c1890dcab7a6", "support" ], "origin-policy/resources/subframe-with-origin-policy.py": [ - "258f23754ef7ef0b5c68f351c7c330c7e288c0c8", + "636a649a0e20bebe36ccd013b72b8e1f315d674e", "support" ], "page-visibility/META.yml": [ @@ -580314,7 +579851,7 @@ "support" ], "shadow-dom/resources/shadow-dom.js": [ - "81b9a3d4fae226ed460583cb94a2443c807e3ce0", + "3a4ad39d42a3d444e795aa539637123f16da0e66", "support" ], "shadow-dom/scroll-to-the-fragment-in-shadow-tree.html": [ @@ -580341,6 +579878,14 @@ "e705e18f4a9747d0ffffe0909bfa4d85bd8f7ad4", "testharness" ], + "shadow-dom/slots-imperative-slot-api.tentative-expected.txt": [ + "9dc356fbc25b5e57f21473f6ec8354500306e8fc", + "support" + ], + "shadow-dom/slots-imperative-slot-api.tentative.html": [ + "5999ec82a384a4dcf67451e8e83f3e59e5138c0b", + "testharness" + ], "shadow-dom/slots-outside-shadow-dom.html": [ "a6fa2b27f760d1daf6e7390c6e582108b035e57e", "testharness" @@ -585297,6 +584842,14 @@ "402bbd5e7065e30239ac82f5130466c0b257445a", "support" ], + "svg/types/scripted/SVGGraphicsElement.getBBox-01.html": [ + "a56dc4093203bcdcdc1f8b019a52f85f71eae23a", + "testharness" + ], + "svg/types/scripted/SVGGraphicsElement.getBBox-02.html": [ + "0efd590710c693db36da4ebc4f9b948e875d6363", + "testharness" + ], "svg/types/scripted/SVGGraphicsElement.svg": [ "8d5808f0db782984852f89289eda56973dde00d2", "testharness" @@ -590573,47 +590126,47 @@ "cc57ee7f8ea4cf42407868463e396cb2a4260d76", "testharness" ], - "trusted-types/DOMParser-parseFromString.tentative.html": [ + "trusted-types/DOMParser-parseFromString.tentative.https.html": [ "2dfc37686bca15431c216a50d29f9f9eed2782e0", "testharness" ], - "trusted-types/DOMWindowTimers-setTimeout-setInterval.tentative.html": [ + "trusted-types/DOMWindowTimers-setTimeout-setInterval.tentative.https.html": [ "5bd4003cfdd7c9e2f3be395483ab827ee5b12ef3", "testharness" ], - "trusted-types/Document-write.tentative.html": [ + "trusted-types/Document-write.tentative.https.html": [ "87e9e724699efc3f0edde3afade4cf53ec2c9c3e", "testharness" ], - "trusted-types/Element-insertAdjacentHTML.tentative.html": [ + "trusted-types/Element-insertAdjacentHTML.tentative.https.html": [ "6a9329b3fbf2fdfb4f00ce2acde7c38d6843d92f", "testharness" ], - "trusted-types/Element-insertAdjacentText.tentative.html": [ + "trusted-types/Element-insertAdjacentText.tentative.https.html": [ "f6221362c17d6231e0921d866b1cdc642fea9d39", "testharness" ], - "trusted-types/Element-outerHTML.tentative.html": [ + "trusted-types/Element-outerHTML.tentative.https.html": [ "c8daddfe9955196bf0b69410263cb7c01e473e5e", "testharness" ], - "trusted-types/Element-setAttribute.tentative.html": [ + "trusted-types/Element-setAttribute.tentative.https.html": [ "cd6617915bdd16343ff2499e09991fba50b444bc", "testharness" ], - "trusted-types/Element-setAttributeNS.tentative.html": [ + "trusted-types/Element-setAttributeNS.tentative.https.html": [ "67e8236febd77ed3b544126d8c5f9dd37cc513ab", "testharness" ], - "trusted-types/GlobalEventHandlers-onclick.tentative.html": [ + "trusted-types/GlobalEventHandlers-onclick.tentative.https.html": [ "6cbf680fa26d2e3aeea6152ecb22d3b8e2e1c098", "testharness" ], - "trusted-types/HTMLElement-generic.tentative.html": [ + "trusted-types/HTMLElement-generic.tentative.https.html": [ "3ec6cfa60da6d86e6be2e3ce68ae227441e6c5bb", "testharness" ], - "trusted-types/HTMLScriptElement-internal-slot.tentative.html": [ + "trusted-types/HTMLScriptElement-internal-slot.tentative.https.html": [ "2970e2a7ec6abd7b632a3fe36a1018a43f59f3a4", "testharness" ], @@ -590621,7 +590174,7 @@ "d0743949b6a122d8bd0adf7b1ed0181f0c51429d", "support" ], - "trusted-types/Node-multiple-arguments.tentative.html": [ + "trusted-types/Node-multiple-arguments.tentative.https.html": [ "e3e4a2635e9820c762ca0c10ccd54e244e7bb499", "testharness" ], @@ -590629,71 +590182,71 @@ "43db381528ce362bf4a113e08c93a81131562e87", "support" ], - "trusted-types/Range-createContextualFragment.tentative.html": [ + "trusted-types/Range-createContextualFragment.tentative.https.html": [ "3a880a53778acb165fd5d957eeaca22685baf2b5", "testharness" ], - "trusted-types/TrustedType-AttributeNodes.tentative.html": [ + "trusted-types/TrustedType-AttributeNodes.tentative.https.html": [ "77eef9cf39e42a842117e0910c1e398d2c22cb51", "testharness" ], - "trusted-types/TrustedTypePolicy-CSP-no-name.tentative.html": [ + "trusted-types/TrustedTypePolicy-CSP-no-name.tentative.https.html": [ "b1c7f51ddb3a14603cf6f11ea437484f09366c74", "testharness" ], - "trusted-types/TrustedTypePolicy-CSP-wildcard.tentative.html": [ + "trusted-types/TrustedTypePolicy-CSP-wildcard.tentative.https.html": [ "0e97a4a245a9ef01e1c65f159a9bd300a93b903f", "testharness" ], - "trusted-types/TrustedTypePolicy-createXXX.tentative.html": [ + "trusted-types/TrustedTypePolicy-createXXX.tentative.https.html": [ "81ad053f5cd549c0175788929f270f1a5fdaff3b", "testharness" ], - "trusted-types/TrustedTypePolicyFactory-constants.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-constants.tentative.https.html": [ "0ba2eb62375a57c78f1caba4592e880b92483599", "testharness" ], - "trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.https.html": [ "746d89fa3f8c3f21cb64d6fb348de15ef9b1f3e2", "testharness" ], - "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-noNamesGiven.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-noNamesGiven.tentative.https.html": [ "15728b9888f3cb0c7d9f509c86949f8942a66a22", "testharness" ], - "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-wildcard.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-wildcard.tentative.https.html": [ "f1b5f27e709bc1eb986f1a1160d0df0b5ec9a99d", "testharness" ], - "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests.tentative.https.html": [ "3a56546151e4e8fcef6bfecafa42cd50dd01ebcc", "testharness" ], - "trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.https.html": [ "9fdafb2ccf04bf2808e3399d64c83a131c8648d2", "testharness" ], - "trusted-types/TrustedTypePolicyFactory-createPolicy-unenforced.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-createPolicy-unenforced.tentative.https.html": [ "293444820216e17adb8c4f02a1615d7dfbfe2e6e", "testharness" ], - "trusted-types/TrustedTypePolicyFactory-defaultPolicy.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-defaultPolicy.tentative.https.html": [ "7ac09d8bb96c0ef163590db1552012651648b68b", "testharness" ], - "trusted-types/TrustedTypePolicyFactory-getPropertyType.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-getPropertyType.tentative.https.html": [ "0e5a0f51c80bf91c21b37bf02645c70b26ecf374", "testharness" ], - "trusted-types/TrustedTypePolicyFactory-isXXX.tentative.html": [ - "c620451ba8f797228fd20ea130aeff66d639cd73", + "trusted-types/TrustedTypePolicyFactory-isXXX.tentative.https.html": [ + "89d4a8b4efcda19f4937855f4f880792bf274ddd", "testharness" ], - "trusted-types/TrustedTypePolicyFactory-metadata.tentative.html": [ + "trusted-types/TrustedTypePolicyFactory-metadata.tentative.https.html": [ "50f877cda07f05e6f9fc916637bc8c3ecaa9da3b", "testharness" ], - "trusted-types/Window-TrustedTypes.tentative.html": [ + "trusted-types/Window-TrustedTypes.tentative.https.html": [ "718c763afafd12bfa498eb8827fb1b12b509c51d", "testharness" ], @@ -590701,155 +590254,147 @@ "0aa965e16e08e9ba90b63ef0ab9e731f6ebffbdf", "testharness" ], - "trusted-types/block-Node-multiple-arguments.tentative.html": [ + "trusted-types/block-Node-multiple-arguments.tentative.https.html": [ "d66b8c8f25b64e214312bb9cd507a5901ebde53c", "testharness" ], - "trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.html": [ + "trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.https.html": [ "bd038635df73560e23bf7ad4a50c93cebf827822", "testharness" ], - "trusted-types/block-string-assignment-to-DOMWindowTimers-setTimeout-setInterval.tentative.html": [ + "trusted-types/block-string-assignment-to-DOMWindowTimers-setTimeout-setInterval.tentative.https.html": [ "d2764936675168b3d0ea052f3860bcd95c049024", "testharness" ], - "trusted-types/block-string-assignment-to-Document-write.tentative.html": [ + "trusted-types/block-string-assignment-to-Document-write.tentative.https.html": [ "fa87d119f79f69a020e75c9749e04b4f73d6a7dd", "testharness" ], - "trusted-types/block-string-assignment-to-Element-insertAdjacentHTML.tentative.html": [ + "trusted-types/block-string-assignment-to-Element-insertAdjacentHTML.tentative.https.html": [ "c91e4e56acd483fe935839c3d95c712b6a1d76bc", "testharness" ], - "trusted-types/block-string-assignment-to-Element-outerHTML.tentative-expected.txt": [ - "b30ab101c4c8950fcfb2375cd8c83ee575a4f61c", - "support" - ], - "trusted-types/block-string-assignment-to-Element-outerHTML.tentative.html": [ - "397606bc056a8dd7729c5eb9ef66aeef59dda9db", + "trusted-types/block-string-assignment-to-Element-outerHTML.tentative.https.html": [ + "4764def3cb331fb22a323c4d1be8ae26163a8394", "testharness" ], - "trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html": [ + "trusted-types/block-string-assignment-to-Element-setAttribute.tentative.https.html": [ "e6abf602fb08817bc3cdb9828ae4c490922389e5", "testharness" ], - "trusted-types/block-string-assignment-to-Element-setAttributeNS.tentative.html": [ + "trusted-types/block-string-assignment-to-Element-setAttributeNS.tentative.https.html": [ "aa13d72ceb2f53d4fbf17ef80e6e66c4298f6ca3", "testharness" ], - "trusted-types/block-string-assignment-to-HTMLElement-generic.tentative-expected.txt": [ - "a0a879cc995d709dffcfb3e3709212e38f0cebcd", - "support" - ], - "trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html": [ - "b5745199f41c49d7aab63822c3138548907544f0", + "trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.https.html": [ + "dd6fa07475b31ab1a2a851f07397709deaa190f7", "testharness" ], - "trusted-types/block-string-assignment-to-Range-createContextualFragment.tentative.html": [ + "trusted-types/block-string-assignment-to-Range-createContextualFragment.tentative.https.html": [ "b38e4f3da5f8728eb3b67e63b250d63734a1b0aa", "testharness" ], - "trusted-types/block-text-node-insertion-into-script-element.tentative.html": [ + "trusted-types/block-text-node-insertion-into-script-element.tentative.https.html": [ "bc29f19f4c4a75da008dff5836573409fbd65e23", "testharness" ], - "trusted-types/csp-block-eval.tentative.html": [ + "trusted-types/csp-block-eval.tentative.https.html": [ "e3911bf9e6a9340a35906d9ec70f71f6b8152951", "testharness" ], - "trusted-types/default-policy-report-only.tentative.html": [ + "trusted-types/default-policy-report-only.tentative.https.html": [ "1cff751a80194bfaef6095617a89a423b76e70b2", "testharness" ], - "trusted-types/default-policy-report-only.tentative.html.headers": [ + "trusted-types/default-policy-report-only.tentative.https.html.headers": [ "67b9ef7a3c5ef2f53775de6965ca12343026a829", "support" ], - "trusted-types/default-policy.tentative.html": [ + "trusted-types/default-policy.tentative.https.html": [ "debde85cdac9d7bb1bcb19b56f7063fea0a53241", "testharness" ], - "trusted-types/default-policy.tentative.html.headers": [ + "trusted-types/default-policy.tentative.https.html.headers": [ "6a40e40a586a5b0ad3f01bf8e45402e74d424cd2", "support" ], - "trusted-types/empty-default-policy-report-only.tentative.html": [ + "trusted-types/empty-default-policy-report-only.tentative.https.html": [ "1ba9c5ec18e5da33725aaa9499977930563c4ba9", "testharness" ], - "trusted-types/empty-default-policy-report-only.tentative.html.headers": [ + "trusted-types/empty-default-policy-report-only.tentative.https.html.headers": [ "67b9ef7a3c5ef2f53775de6965ca12343026a829", "support" ], - "trusted-types/empty-default-policy.tentative.html": [ + "trusted-types/empty-default-policy.tentative.https.html": [ "d31b48ecd5a86670b7c6ea3c4d993cd3f11946df", "testharness" ], - "trusted-types/empty-default-policy.tentative.html.headers": [ + "trusted-types/empty-default-policy.tentative.https.html.headers": [ "6a40e40a586a5b0ad3f01bf8e45402e74d424cd2", "support" ], - "trusted-types/eval-csp-no-tt.tentative-expected.txt": [ + "trusted-types/eval-csp-no-tt.tentative.https-expected.txt": [ "fbec6cd6b60b3ef6ddc1632edb68bde2d47671a9", "support" ], - "trusted-types/eval-csp-no-tt.tentative.html": [ + "trusted-types/eval-csp-no-tt.tentative.https.html": [ "e8ed57708ef158d36cff2c0d0883910c84bb75e8", "testharness" ], - "trusted-types/eval-csp-tt-default-policy.tentative.html": [ + "trusted-types/eval-csp-tt-default-policy.tentative.https.html": [ "106a024f2c1a8f4e2b2e99d2f15a81457179d807", "testharness" ], - "trusted-types/eval-csp-tt-no-default-policy.tentative.html": [ + "trusted-types/eval-csp-tt-no-default-policy.tentative.https.html": [ "6d48ae48a01a1558e97efebc65ac9f42a893329a", "testharness" ], - "trusted-types/eval-no-csp-no-tt-default-policy.tentative-expected.txt": [ + "trusted-types/eval-no-csp-no-tt-default-policy.tentative.https-expected.txt": [ "1d20a7b832138b22be02981af9a36b91518370f9", "support" ], - "trusted-types/eval-no-csp-no-tt-default-policy.tentative.html": [ + "trusted-types/eval-no-csp-no-tt-default-policy.tentative.https.html": [ "84c224eac28f6b26d4c0a15d7390185a576df716", "testharness" ], - "trusted-types/eval-no-csp-no-tt.tentative-expected.txt": [ + "trusted-types/eval-no-csp-no-tt.tentative.https-expected.txt": [ "fbec6cd6b60b3ef6ddc1632edb68bde2d47671a9", "support" ], - "trusted-types/eval-no-csp-no-tt.tentative.html": [ + "trusted-types/eval-no-csp-no-tt.tentative.https.html": [ "45086a1d6abdec58df8f3d5de5421bab0a2162a5", "testharness" ], - "trusted-types/eval-with-permissive-csp.tentative.html": [ + "trusted-types/eval-with-permissive-csp.tentative.https.html": [ "5a35561438ab93c5066c4191bfcf3db0ddb83977", "testharness" ], - "trusted-types/idlharness.tentative.window.js": [ + "trusted-types/idlharness.tentative.https.window.js": [ "5a854a12b78026a3318dad70ffa0d6a690e39f55", "testharness" ], - "trusted-types/no-require-trusted-types-for-report-only.tentative.html": [ + "trusted-types/no-require-trusted-types-for-report-only.tentative.https.html": [ "56f6295221355dd0c0900f9932222c461c11eda8", "testharness" ], - "trusted-types/no-require-trusted-types-for-report-only.tentative.html.headers": [ + "trusted-types/no-require-trusted-types-for-report-only.tentative.https.html.headers": [ "fa87952ae486b3a902eca0257eadace8e25e881f", "support" ], - "trusted-types/no-require-trusted-types-for.tentative.html": [ + "trusted-types/no-require-trusted-types-for.tentative.https.html": [ "4e11b03617beb3716f51653843fd458c69274758", "testharness" ], - "trusted-types/require-trusted-types-for-report-only.tentative.html": [ + "trusted-types/require-trusted-types-for-report-only.tentative.https.html": [ "25b4440ef4117010bb7da7c8f3ad87f01d3bf55f", "testharness" ], - "trusted-types/require-trusted-types-for-report-only.tentative.html.headers": [ + "trusted-types/require-trusted-types-for-report-only.tentative.https.html.headers": [ "c6412f8d472fcfd6022b0ae485f52b3d3dedd820", "support" ], - "trusted-types/require-trusted-types-for.tentative.html": [ + "trusted-types/require-trusted-types-for.tentative.https.html": [ "2a3820a89b8ad36c324139bf75fab8d72d7087a4", "testharness" ], @@ -590889,23 +590434,23 @@ "4079f7e9c7933cf9ee195fe0e7a54e0f56f184ab", "support" ], - "trusted-types/trusted-types-createHTMLDocument.tentative.html": [ + "trusted-types/trusted-types-createHTMLDocument.tentative.https.html": [ "440d2a88b9367daa42c6aeb6e747f58a1487ea6f", "testharness" ], - "trusted-types/trusted-types-duplicate-names-list-report-only.tentative.html": [ + "trusted-types/trusted-types-duplicate-names-list-report-only.tentative.https.html": [ "46ca2edb6fb57b354b3a80f327dbfbe6760f21c6", "testharness" ], - "trusted-types/trusted-types-duplicate-names-list-report-only.tentative.html.headers": [ + "trusted-types/trusted-types-duplicate-names-list-report-only.tentative.https.html.headers": [ "b6608515aa85a08dbb56531c46c097e179c76200", "support" ], - "trusted-types/trusted-types-duplicate-names-list.tentative.html": [ + "trusted-types/trusted-types-duplicate-names-list.tentative.https.html": [ "afb2f5f7c4b7f6ddfe8da004750017e6c7f01f9a", "testharness" ], - "trusted-types/trusted-types-duplicate-names.tentative.html": [ + "trusted-types/trusted-types-duplicate-names.tentative.https.html": [ "decce5356467f9f4e6a8886c6b6eff7194bf2385", "testharness" ], @@ -590933,7 +590478,7 @@ "3f55bba7d1b8d0965d3f9f29c7db301806f7c1a0", "support" ], - "trusted-types/trusted-types-navigation.tentative.html": [ + "trusted-types/trusted-types-navigation.tentative.https.html": [ "657cbb74e0ecd5b30fbd73fb73a54eb6db62dfd7", "testharness" ], @@ -590961,7 +590506,7 @@ "fa8aceab74b0f6e937da3999d471f6afaac4c24e", "support" ], - "trusted-types/tt-block-eval.tentative.html": [ + "trusted-types/tt-block-eval.tentative.https.html": [ "f9c1a5d0b12365506fb62ec43a23d9bca4f61cf1", "testharness" ],
diff --git a/third_party/blink/web_tests/external/wpt/css/CSS2/floats/floats-wrap-bfc-outside-001-ref.xht b/third_party/blink/web_tests/external/wpt/css/CSS2/floats/floats-wrap-bfc-outside-001-ref.xht index 5ea97a40..20ae627 100644 --- a/third_party/blink/web_tests/external/wpt/css/CSS2/floats/floats-wrap-bfc-outside-001-ref.xht +++ b/third_party/blink/web_tests/external/wpt/css/CSS2/floats/floats-wrap-bfc-outside-001-ref.xht
@@ -5,7 +5,7 @@ #wrap {width:600px; border:1px solid;position:relative} .a {background:lime; color:#fff; width:80%;} .b {position:absolute; right:0; width:18%; background: cyan; color: #000; height:10em;} -textarea {width: 100%; height:10em;} +textarea {box-sizing: border-box; width: 100%; height:10em;} </style> <title>test</title>
diff --git a/third_party/blink/web_tests/external/wpt/css/CSS2/floats/floats-wrap-bfc-outside-001.xht b/third_party/blink/web_tests/external/wpt/css/CSS2/floats/floats-wrap-bfc-outside-001.xht index 9ae6447f3..1dec29a 100644 --- a/third_party/blink/web_tests/external/wpt/css/CSS2/floats/floats-wrap-bfc-outside-001.xht +++ b/third_party/blink/web_tests/external/wpt/css/CSS2/floats/floats-wrap-bfc-outside-001.xht
@@ -10,7 +10,7 @@ #wrap {width:600px; border:1px solid;} .a {background:lime; color:#fff; width:80%;} .b {float:right; width:18%; background: cyan; color: #000; height:10em;} -textarea {width: 100%; height:10em;} +textarea {box-sizing: border-box;width: 100%; height:10em;} </style> </head>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-animations/CSSAnimation-pausing.tentative-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-animations/CSSAnimation-pausing.tentative-expected.txt index c55bd4dd..c8e6a8202 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-animations/CSSAnimation-pausing.tentative-expected.txt +++ b/third_party/blink/web_tests/external/wpt/css/css-animations/CSSAnimation-pausing.tentative-expected.txt
@@ -7,6 +7,6 @@ FAIL Setting the startTime to null overrides animation-play-state if the animation is already running assert_equals: Should still be paused even after flipping the animation-play-state expected "paused" but got "running" FAIL Setting the startTime to non-null overrides animation-play-state if the animation is paused assert_equals: Should still be running even after flipping the animation-play-state expected "running" but got "paused" PASS Setting the startTime to non-null does NOT override the animation-play-state if the animation is already running -FAIL Setting the current time completes a pending pause assert_true: Animation is pause-pending expected true got false +PASS Setting the current time completes a pending pause Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/css/css-transitions/CSSTransition-canceling.tentative-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-transitions/CSSTransition-canceling.tentative-expected.txt deleted file mode 100644 index e72f9fd1..0000000 --- a/third_party/blink/web_tests/external/wpt/css/css-transitions/CSSTransition-canceling.tentative-expected.txt +++ /dev/null
@@ -1,14 +0,0 @@ -This is a testharness.js-based test. -PASS Animated style is cleared after canceling a running CSS transition -PASS After canceling a transition, it can still be re-used -PASS After canceling a finished transition, it can still be re-used -PASS After canceling a transition, updating transition properties doesn't make it live again -FAIL Setting display:none on an element cancels its transitions assert_equals: expected "idle" but got "running" -FAIL Setting display:none cancels transitions on a child element assert_equals: expected "idle" but got "running" -PASS Removing a property from transition-property cancels transitions on that property -PASS Setting zero combined duration -PASS Changing style to another interpolable value cancels the original transition -PASS An after-change style value can't be interpolated -PASS Reversing a running transition cancels the original transition -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/css/cssom-view/cssom-getBoundingClientRect-003.html b/third_party/blink/web_tests/external/wpt/css/cssom-view/cssom-getBoundingClientRect-003.html new file mode 100644 index 0000000..5eb9448 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/cssom-view/cssom-getBoundingClientRect-003.html
@@ -0,0 +1,34 @@ +<!doctype html> +<title>{Element,Range}.prototype.getBoundingClientRect on SVG <tspan></title> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css"> +<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-element-getboundingclientrect"> +<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-range-getboundingclientrect"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<svg> + <text y="180" font-size="100" font-family="Ahem" + fill="lightblue">X<tspan fill="blue">XX</tspan></text> +</svg> +<script> + function check(object) { + let rect = object.getBoundingClientRect(); + assert_equals(rect.left, 108, 'left'); + assert_equals(rect.top, 108, 'top'); + assert_equals(rect.width, 200, 'width'); + assert_equals(rect.height, 100, 'height'); + } + async_test(t => { + window.addEventListener("load", t.step_func_done(() => { + let tspan = document.querySelector('tspan'); + check(tspan); + })); + }, document.title + ', Element'); + async_test(t => { + window.addEventListener("load", t.step_func_done(() => { + let tspan = document.querySelector('tspan'); + let range = new Range(); + range.selectNode(tspan); + check(range); + })); + }, document.title + ', Range'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/fetch/api/redirect/redirect-mode.any.js b/third_party/blink/web_tests/external/wpt/fetch/api/redirect/redirect-mode.any.js index 557c249..eed44e0 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/api/redirect/redirect-mode.any.js +++ b/third_party/blink/web_tests/external/wpt/fetch/api/redirect/redirect-mode.any.js
@@ -6,6 +6,7 @@ var url = new URL("../resources/redirect.py", self.location); if (origin === "cross-origin") { url.host = get_host_info().REMOTE_HOST; + url.port = get_host_info().HTTP_PORT; } var urlParameters = "?redirect_status=" + redirectStatus;
diff --git a/third_party/blink/web_tests/external/wpt/html/rendering/widgets/baseline-alignment-and-overflow.tentative.html b/third_party/blink/web_tests/external/wpt/html/rendering/widgets/baseline-alignment-and-overflow.tentative.html index 9ff6662..1c0b312e 100644 --- a/third_party/blink/web_tests/external/wpt/html/rendering/widgets/baseline-alignment-and-overflow.tentative.html +++ b/third_party/blink/web_tests/external/wpt/html/rendering/widgets/baseline-alignment-and-overflow.tentative.html
@@ -213,6 +213,8 @@ for (const row of testTBody.children) { const input = row.firstChild.lastElementChild; + // FIXME: This test makes assumptions about default form control styling + // that don't hold in all platforms. const allowedDelta = 3; // This is not using test() because promise_setup() only allows promise_test(). promise_test(async () => {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/trusted-types.tentative.idl b/third_party/blink/web_tests/external/wpt/interfaces/trusted-types.tentative.idl index 29a1822..18a8bfe 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/trusted-types.tentative.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/trusted-types.tentative.idl
@@ -1,8 +1,8 @@ // https://github.com/wicg/trusted-types -typedef (DOMString or TrustedHTML) HTMLString; -typedef (DOMString or TrustedScript) ScriptString; -typedef (DOMString or TrustedScriptURL) ScriptURLString; +typedef [StringContext=TrustedHTML] DOMString HTMLString; +typedef [StringContext=TrustedScript] DOMString ScriptString; +typedef [StringContext=TrustedScriptURL] USVString ScriptURLString; [ Exposed=(Window, Worker), @@ -40,7 +40,7 @@ readonly attribute DOMString name; TrustedHTML createHTML(DOMString input); TrustedScript createScript(DOMString input); - TrustedScriptURL createScriptURL(DOMString input); + TrustedScriptURL createScriptURL(USVString input); }; dictionary TrustedTypePolicyOptions {
diff --git a/third_party/blink/web_tests/external/wpt/paint-timing/input-text.html b/third_party/blink/web_tests/external/wpt/paint-timing/input-text.html new file mode 100644 index 0000000..38527a4c --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/paint-timing/input-text.html
@@ -0,0 +1,19 @@ +<!DOCTYPE html> +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/utils.js"></script> +<form> + <input type="text" id='myInput'> +</form> +<script> +promise_test(async () => { + const onload = new Promise(r => window.addEventListener('load', r)); + await onload; + return assertNoFirstContentfulPaint().then(() => { + document.getElementById('myInput').value = 'default text'; + return assertFirstContentfulPaint(); + }) +}); +</script> +</body>
diff --git a/third_party/blink/web_tests/external/wpt/paint-timing/resources/utils.js b/third_party/blink/web_tests/external/wpt/paint-timing/resources/utils.js new file mode 100644 index 0000000..6ccb5f6 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/paint-timing/resources/utils.js
@@ -0,0 +1,53 @@ +// We use requestAnimationFrame() calls to force the user agent to paint. Hence, set +// |numFramesWaiting| to 3 and use that constant whenever the test needs to wait for +// the next paint to occur. +const numFramesWaiting = 3; + +function waitForAnimationFrames(count) { + return new Promise(resolve => { + if (count-- <= 0) { + resolve(); + } else { + requestAnimationFrame(() => { + waitForAnimationFrames(count).then(resolve); + }); + } + }); +} + +function assertNoFirstContentfulPaint() { + return waitForAnimationFrames(numFramesWaiting).then(() => { + return new Promise((resolve, reject) => { + const observer = new PerformanceObserver(entryList =>{ + const entries = entryList.getEntriesByName('first-contentful-paint'); + observer.disconnect(); + if (entries.length > 0) + reject('Received a first contentful paint entry.'); + else + resolve(); + }); + observer.observe({type: 'paint', buffered: true}); + observer.observe({type: 'mark'}); + performance.mark('flush'); + }); + }); +} + +function assertFirstContentfulPaint() { + return waitForAnimationFrames(numFramesWaiting).then(() => { + return new Promise((resolve, reject) => { + const observer = new PerformanceObserver(entryList =>{ + const entries = entryList.getEntriesByName('first-contentful-paint'); + observer.disconnect(); + if (entries.length === 0) + reject('Did not receive a first contentful paint entry.'); + else { + resolve(); + } + }); + observer.observe({type: 'paint', buffered: true}); + observer.observe({type: 'mark'}); + performance.mark('flush'); + }); + }); +}
diff --git a/third_party/blink/web_tests/svg/dom/getbbox.html b/third_party/blink/web_tests/external/wpt/svg/types/scripted/SVGGraphicsElement.getBBox-01.html similarity index 96% rename from third_party/blink/web_tests/svg/dom/getbbox.html rename to third_party/blink/web_tests/external/wpt/svg/types/scripted/SVGGraphicsElement.getBBox-01.html index eb7226f..a56dc40 100644 --- a/third_party/blink/web_tests/svg/dom/getbbox.html +++ b/third_party/blink/web_tests/external/wpt/svg/types/scripted/SVGGraphicsElement.getBBox-01.html
@@ -1,7 +1,7 @@ -<!DOCTYPE html> -<title>getBBox tests</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> +<!doctype html> +<title>SVGGraphicsElement.prototype.getBBox</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> <div id="testcontainer"> <svg width="1" height="1" visibility="hidden"> <g id="g1"> @@ -126,5 +126,4 @@ let r13 = document.getElementById("r13"); assert_rect_approx_equals(g11.getBBox(), r13.getBBox(), EPSILON); }, "empty image does not contribute to parent bbox"); - </script>
diff --git a/third_party/blink/web_tests/external/wpt/svg/types/scripted/SVGGraphicsElement.getBBox-02.html b/third_party/blink/web_tests/external/wpt/svg/types/scripted/SVGGraphicsElement.getBBox-02.html new file mode 100644 index 0000000..0efd590 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/svg/types/scripted/SVGGraphicsElement.getBBox-02.html
@@ -0,0 +1,19 @@ +<!doctype html> +<title>SVGGraphicsElement.prototype.getBBox on <tspan></title> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<svg height="100"> + <text y="180" font-size="100" font-family="Ahem" fill="lightblue" + transform="translate(0, -100)">X<tspan fill="blue">X</tspan></text> +</svg> +<script> + async_test(t => { + onload = t.step_func_done(() => { + let tspan = document.querySelector('tspan'); + let bbox = tspan.getBBox(); + for (let property of ['x', 'y', 'width', 'height']) + assert_equals(bbox[property], 100, property); + }); + }); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/trusted-types/DOMWindowTimers-setTimeout-setInterval.tentative.https.html b/third_party/blink/web_tests/external/wpt/trusted-types/DOMWindowTimers-setTimeout-setInterval.tentative.https.html index 5bd4003c..2ad4755 100644 --- a/third_party/blink/web_tests/external/wpt/trusted-types/DOMWindowTimers-setTimeout-setInterval.tentative.https.html +++ b/third_party/blink/web_tests/external/wpt/trusted-types/DOMWindowTimers-setTimeout-setInterval.tentative.https.html
@@ -2,19 +2,46 @@ <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="support/helper.sub.js"></script> +<meta http-equiv="Content-Security-Policy" content="require-trusted-types-for 'script'"> <body> <script> async_test(t => { - window.timeoutTest = t; + window.timeoutTrustedTest = t; let policy = createScript_policy(window, 'timeout'); - let script = policy.createScript("window.timeoutTest.done();"); + let script = policy.createScript("window.timeoutTrustedTest.done();"); setTimeout(script); }, "window.setTimeout assigned via policy (successful Script transformation)."); async_test(t => { - window.intervalTest = t; + window.intervalTrustedTest = t; let policy = createScript_policy(window, 'script'); - let script = policy.createScript("window.intervalTest.done();"); + let script = policy.createScript("window.intervalTrustedTest.done();"); setInterval(script); }, "window.setInterval assigned via policy (successful Script transformation)."); + + trustedTypes.createPolicy("default", {createScript: s => "window." + s + ".done()"}); + + async_test(t => { + window.timeoutStringTest = t; + let script = "timeoutStringTest"; + setTimeout(script); + }, "window.setTimeout assigned via default policy (successful Script transformation)."); + + async_test(t => { + window.intervalStringTest = t; + let script = "intervalStringTest"; + setInterval(script); + }, "window.setInterval assigned via default policy (successful Script transformation)."); + + async_test(t => { + window.timeoutFunctionTest = t; + let script = () => window.timeoutFunctionTest.done(); + setTimeout(script); + }, "window.setTimeout assigned with a function handler shouldn't go through default policy."); + + async_test(t => { + window.intervalFunctionTest = t; + let script = () => window.intervalFunctionTest.done(); + setInterval(script); + }, "window.setInterval assigned with a function handler shouldn't go through default policy."); </script>
diff --git a/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-Element-outerHTML.tentative.https-expected.txt b/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-Element-outerHTML.tentative.https-expected.txt deleted file mode 100644 index b30ab10..0000000 --- a/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-Element-outerHTML.tentative.https-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -This is a testharness.js-based test. -PASS outerHTML with html assigned via policy (successful HTML transformation). -PASS `outerHTML = string` throws. -PASS `outerHTML = null` throws. -PASS `outerHTML = string` assigned via default policy (successful HTML transformation). -FAIL `outerHTML = null` assigned via default policy does not throw assert_equals: expected "null" but got "" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-Element-outerHTML.tentative.https.html b/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-Element-outerHTML.tentative.https.html index 397606b..4764def3 100644 --- a/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-Element-outerHTML.tentative.https.html +++ b/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-Element-outerHTML.tentative.https.html
@@ -68,7 +68,7 @@ var d = document.createElement('div'); container.appendChild(d); d.outerHTML = null; - assert_equals(container.innerText, "null"); + assert_equals(container.innerText, ""); while (container.firstChild) container.firstChild.remove();
diff --git a/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.https-expected.txt b/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.https-expected.txt deleted file mode 100644 index a0a879cc..0000000 --- a/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.https-expected.txt +++ /dev/null
@@ -1,18 +0,0 @@ -This is a testharness.js-based test. -PASS embed.src accepts only TrustedScriptURL -PASS object.codeBase accepts only TrustedScriptURL -PASS object.data accepts only TrustedScriptURL -PASS script.src accepts only TrustedScriptURL -PASS div.innerHTML accepts only TrustedHTML -PASS iframe.srcdoc accepts only TrustedHTML -PASS embed.src accepts string and null after default policy was created -PASS object.codeBase accepts string and null after default policy was created -PASS object.data accepts string and null after default policy was created -PASS script.src accepts string and null after default policy was created -FAIL div.innerHTML accepts string and null after default policy was created assert_equals: expected "null" but got "" -PASS iframe.srcdoc accepts string and null after default policy was created -PASS script.text accepts only TrustedScript -PASS script.innerText accepts only TrustedScript -PASS script.textContent accepts only TrustedScript -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.https.html b/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.https.html index b574519..dd6fa07 100644 --- a/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.https.html +++ b/third_party/blink/web_tests/external/wpt/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.https.html
@@ -56,7 +56,7 @@ HTMLTestCases.forEach(c => { test(t => { assert_element_accepts_trusted_type(c[0], c[1], INPUTS.HTML, RESULTS.HTML); - assert_element_accepts_trusted_type(c[0], c[1], null, "null"); + assert_element_accepts_trusted_type(c[0], c[1], null, c[1] === 'innerHTML'? "" : "null"); }, c[0] + "." + c[1] + " accepts string and null after default policy was created"); });
diff --git a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/append-text-node-to-tspan-expected.txt b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/append-text-node-to-tspan-expected.txt index f948d815..9b89683 100644 --- a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/append-text-node-to-tspan-expected.txt +++ b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/append-text-node-to-tspan-expected.txt
@@ -27,39 +27,39 @@ "reason": "disappeared" }, { - "object": "InlineTextBox 'PA'", - "rect": [10, 60, 310, 380], + "object": "InlineTextBox 'PASS'", + "rect": [10, 300, 280, 140], "reason": "appeared" }, { + "object": "InlineTextBox 'PASS'", + "rect": [10, 300, 280, 140], + "reason": "disappeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 180, 280, 140], + "reason": "appeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 180, 280, 140], + "reason": "disappeared" + }, + { "object": "InlineTextBox 'PA'", - "rect": [10, 60, 310, 380], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], + "rect": [10, 60, 280, 140], "reason": "appeared" }, { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "appeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "disappeared" - }, - { "object": "InlineTextBox 'SS'", - "rect": [10, 60, 310, 380], + "rect": [10, 60, 280, 140], "reason": "appeared" + }, + { + "object": "InlineTextBox 'PA'", + "rect": [10, 60, 150, 140], + "reason": "disappeared" } ] }
diff --git a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/modify-text-node-in-tspan-expected.txt b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/modify-text-node-in-tspan-expected.txt index e1190ce..a69393d 100644 --- a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/modify-text-node-in-tspan-expected.txt +++ b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/modify-text-node-in-tspan-expected.txt
@@ -27,33 +27,33 @@ "reason": "disappeared" }, { + "object": "InlineTextBox 'PASS'", + "rect": [10, 300, 280, 140], + "reason": "appeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 300, 280, 140], + "reason": "disappeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 180, 280, 140], + "reason": "appeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 180, 280, 140], + "reason": "disappeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 60, 280, 140], + "reason": "appeared" + }, + { "object": "InlineTextBox 'PA'", - "rect": [10, 60, 310, 380], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "appeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "appeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "appeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], + "rect": [10, 60, 150, 140], "reason": "disappeared" } ]
diff --git a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/remove-text-node-from-tspan-expected.txt b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/remove-text-node-from-tspan-expected.txt index acaebe6..bcddaef 100644 --- a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/remove-text-node-from-tspan-expected.txt +++ b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/remove-text-node-from-tspan-expected.txt
@@ -17,34 +17,34 @@ "reason": "disappeared" }, { - "object": "InlineTextBox 'FAIL'", - "rect": [10, 60, 310, 380], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "disappeared" - }, - { "object": "InlineTextBox ' '", "rect": [10, 180, 310, 260], "reason": "appeared" }, { "object": "InlineTextBox 'PASS'", - "rect": [10, 180, 310, 260], + "rect": [10, 300, 280, 140], "reason": "appeared" }, { "object": "InlineTextBox 'PASS'", - "rect": [10, 180, 310, 260], + "rect": [10, 300, 280, 140], + "reason": "disappeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 180, 280, 140], "reason": "appeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 180, 280, 140], + "reason": "disappeared" + }, + { + "object": "InlineTextBox 'FAIL'", + "rect": [10, 60, 260, 140], + "reason": "disappeared" } ] }
diff --git a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/remove-tspan-from-text-expected.txt b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/remove-tspan-from-text-expected.txt index 1b2b2ab..987ab9c 100644 --- a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/remove-tspan-from-text-expected.txt +++ b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/remove-tspan-from-text-expected.txt
@@ -22,28 +22,28 @@ "reason": "disappeared" }, { + "object": "InlineTextBox 'PASS'", + "rect": [10, 180, 280, 140], + "reason": "appeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 180, 280, 140], + "reason": "disappeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 60, 280, 140], + "reason": "appeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 60, 280, 140], + "reason": "disappeared" + }, + { "object": "InlineTextBox 'FAIL'", - "rect": [10, 60, 310, 260], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 260], - "reason": "appeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 260], - "reason": "appeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 260], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 260], + "rect": [10, 60, 260, 140], "reason": "disappeared" } ]
diff --git a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/text-pattern-update-2-expected.txt b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/text-pattern-update-2-expected.txt index 60bfd75f..5c3df0cc 100644 --- a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/text-pattern-update-2-expected.txt +++ b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/text-pattern-update-2-expected.txt
@@ -12,13 +12,13 @@ "reason": "subtree" }, { - "object": "InlineTextBox 'Y'", + "object": "InlineTextBox 'Z'", "rect": [8, 8, 300, 100], "reason": "subtree" }, { - "object": "InlineTextBox 'Z'", - "rect": [8, 8, 300, 100], + "object": "InlineTextBox 'Y'", + "rect": [108, 8, 100, 100], "reason": "subtree" } ]
diff --git a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/tspan-pattern-update-expected.txt b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/tspan-pattern-update-expected.txt index 17f221d..d7404c8 100644 --- a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/tspan-pattern-update-expected.txt +++ b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/svg/tspan-pattern-update-expected.txt
@@ -8,7 +8,7 @@ "paintInvalidations": [ { "object": "InlineTextBox 'Y'", - "rect": [8, 8, 300, 100], + "rect": [108, 8, 100, 100], "reason": "subtree" } ]
diff --git a/third_party/blink/web_tests/http/tests/devtools/components/utilities-expected.txt b/third_party/blink/web_tests/http/tests/devtools/components/utilities-expected.txt index 9a1b852..6728aff1 100644 --- a/third_party/blink/web_tests/http/tests/devtools/components/utilities-expected.txt +++ b/third_party/blink/web_tests/http/tests/devtools/components/utilities-expected.txt
@@ -1,8 +1,6 @@ This test checks Web Inspector utilities. -Running: remove - Running: orderedMergeIntersect Running: binaryIndexOfTest
diff --git a/third_party/blink/web_tests/http/tests/devtools/components/utilities.js b/third_party/blink/web_tests/http/tests/devtools/components/utilities.js index 698b9a8..d9316da 100644 --- a/third_party/blink/web_tests/http/tests/devtools/components/utilities.js +++ b/third_party/blink/web_tests/http/tests/devtools/components/utilities.js
@@ -8,24 +8,6 @@ TestRunner.runTestSuite([ - function remove(next) { - var testArrays = [ - [], [], [], [1], [1], [1], [1, 2, 3, 4, 5, 4, 3, 2, 1], [1, 3, 4, 5, 4, 3, 2, 1], [1, 3, 4, 5, 4, 3, 1], - [2, 2, 2, 2, 2], [2, 2, 2, 2], [], [2, 2, 2, 1, 2, 2, 3, 2], [2, 2, 1, 2, 2, 3, 2], [1, 3] - ]; - for (var i = 0; i < testArrays.length; i += 3) { - var actual = testArrays[i].slice(0); - var expected = testArrays[i + 1]; - actual.remove(2, true); - TestRunner.assertEquals(JSON.stringify(expected), JSON.stringify(actual), 'remove(2, true) passed'); - actual = testArrays[i].slice(0); - expected = testArrays[i + 2]; - actual.remove(2, false); - TestRunner.assertEquals(JSON.stringify(expected), JSON.stringify(actual), 'remove(2, false) passed'); - } - next(); - }, - function orderedMergeIntersect(next) { function comparator(a, b) { return a - b;
diff --git a/third_party/blink/web_tests/paint/invalidation/svg/append-text-node-to-tspan-expected.txt b/third_party/blink/web_tests/paint/invalidation/svg/append-text-node-to-tspan-expected.txt index 5960deb..90fefae 100644 --- a/third_party/blink/web_tests/paint/invalidation/svg/append-text-node-to-tspan-expected.txt +++ b/third_party/blink/web_tests/paint/invalidation/svg/append-text-node-to-tspan-expected.txt
@@ -27,39 +27,39 @@ "reason": "disappeared" }, { - "object": "InlineTextBox 'PA'", - "rect": [10, 60, 310, 380], + "object": "InlineTextBox 'PASS'", + "rect": [10, 300, 280, 140], "reason": "appeared" }, { + "object": "InlineTextBox 'PASS'", + "rect": [10, 300, 280, 140], + "reason": "disappeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 180, 280, 140], + "reason": "appeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 180, 280, 140], + "reason": "disappeared" + }, + { "object": "InlineTextBox 'PA'", - "rect": [10, 60, 310, 380], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], + "rect": [10, 60, 280, 140], "reason": "appeared" }, { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "appeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "disappeared" - }, - { "object": "InlineTextBox 'SS'", - "rect": [10, 60, 310, 380], + "rect": [10, 60, 280, 140], "reason": "appeared" + }, + { + "object": "InlineTextBox 'PA'", + "rect": [10, 60, 150, 140], + "reason": "disappeared" } ] }
diff --git a/third_party/blink/web_tests/paint/invalidation/svg/modify-text-node-in-tspan-expected.txt b/third_party/blink/web_tests/paint/invalidation/svg/modify-text-node-in-tspan-expected.txt index 52ebb538..d93be4b2 100644 --- a/third_party/blink/web_tests/paint/invalidation/svg/modify-text-node-in-tspan-expected.txt +++ b/third_party/blink/web_tests/paint/invalidation/svg/modify-text-node-in-tspan-expected.txt
@@ -27,33 +27,33 @@ "reason": "disappeared" }, { + "object": "InlineTextBox 'PASS'", + "rect": [10, 300, 280, 140], + "reason": "appeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 300, 280, 140], + "reason": "disappeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 180, 280, 140], + "reason": "appeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 180, 280, 140], + "reason": "disappeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 60, 280, 140], + "reason": "appeared" + }, + { "object": "InlineTextBox 'PA'", - "rect": [10, 60, 310, 380], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "appeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "appeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "appeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], + "rect": [10, 60, 150, 140], "reason": "disappeared" } ]
diff --git a/third_party/blink/web_tests/paint/invalidation/svg/remove-text-node-from-tspan-expected.txt b/third_party/blink/web_tests/paint/invalidation/svg/remove-text-node-from-tspan-expected.txt index be6e103..a93bc8b 100644 --- a/third_party/blink/web_tests/paint/invalidation/svg/remove-text-node-from-tspan-expected.txt +++ b/third_party/blink/web_tests/paint/invalidation/svg/remove-text-node-from-tspan-expected.txt
@@ -17,34 +17,34 @@ "reason": "disappeared" }, { - "object": "InlineTextBox 'FAIL'", - "rect": [10, 60, 310, 380], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 380], - "reason": "disappeared" - }, - { "object": "InlineTextBox ' '", "rect": [10, 180, 310, 260], "reason": "appeared" }, { "object": "InlineTextBox 'PASS'", - "rect": [10, 180, 310, 260], + "rect": [10, 300, 280, 140], "reason": "appeared" }, { "object": "InlineTextBox 'PASS'", - "rect": [10, 180, 310, 260], + "rect": [10, 300, 280, 140], + "reason": "disappeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 180, 280, 140], "reason": "appeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 180, 280, 140], + "reason": "disappeared" + }, + { + "object": "InlineTextBox 'FAIL'", + "rect": [10, 60, 260, 140], + "reason": "disappeared" } ] }
diff --git a/third_party/blink/web_tests/paint/invalidation/svg/remove-tspan-from-text-expected.txt b/third_party/blink/web_tests/paint/invalidation/svg/remove-tspan-from-text-expected.txt index 42ce6a77..2b75576 100644 --- a/third_party/blink/web_tests/paint/invalidation/svg/remove-tspan-from-text-expected.txt +++ b/third_party/blink/web_tests/paint/invalidation/svg/remove-tspan-from-text-expected.txt
@@ -22,28 +22,28 @@ "reason": "disappeared" }, { + "object": "InlineTextBox 'PASS'", + "rect": [10, 180, 280, 140], + "reason": "appeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 180, 280, 140], + "reason": "disappeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 60, 280, 140], + "reason": "appeared" + }, + { + "object": "InlineTextBox 'PASS'", + "rect": [10, 60, 280, 140], + "reason": "disappeared" + }, + { "object": "InlineTextBox 'FAIL'", - "rect": [10, 60, 310, 260], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 260], - "reason": "appeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 260], - "reason": "appeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 260], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'PASS'", - "rect": [10, 60, 310, 260], + "rect": [10, 60, 260, 140], "reason": "disappeared" } ]
diff --git a/third_party/blink/web_tests/paint/invalidation/svg/text-pattern-update-2-expected.txt b/third_party/blink/web_tests/paint/invalidation/svg/text-pattern-update-2-expected.txt index 7f85a12d..bf66d5d0 100644 --- a/third_party/blink/web_tests/paint/invalidation/svg/text-pattern-update-2-expected.txt +++ b/third_party/blink/web_tests/paint/invalidation/svg/text-pattern-update-2-expected.txt
@@ -12,13 +12,13 @@ "reason": "subtree" }, { - "object": "InlineTextBox 'Y'", + "object": "InlineTextBox 'Z'", "rect": [8, 8, 300, 100], "reason": "subtree" }, { - "object": "InlineTextBox 'Z'", - "rect": [8, 8, 300, 100], + "object": "InlineTextBox 'Y'", + "rect": [108, 8, 100, 100], "reason": "subtree" } ]
diff --git a/third_party/blink/web_tests/paint/invalidation/svg/tspan-pattern-update-expected.txt b/third_party/blink/web_tests/paint/invalidation/svg/tspan-pattern-update-expected.txt index 6c28be0..cc90432 100644 --- a/third_party/blink/web_tests/paint/invalidation/svg/tspan-pattern-update-expected.txt +++ b/third_party/blink/web_tests/paint/invalidation/svg/tspan-pattern-update-expected.txt
@@ -8,7 +8,7 @@ "paintInvalidations": [ { "object": "InlineTextBox 'Y'", - "rect": [8, 8, 300, 100], + "rect": [108, 8, 100, 100], "reason": "subtree" } ]
diff --git a/third_party/closure_compiler/externs/passwords_private.js b/third_party/closure_compiler/externs/passwords_private.js index 6c04ff9..5124938 100644 --- a/third_party/closure_compiler/externs/passwords_private.js +++ b/third_party/closure_compiler/externs/passwords_private.js
@@ -106,6 +106,7 @@ * signonRealm: string, * username: string, * password: (string|undefined), + * compromiseTime: number, * elapsedTimeSinceCompromise: string, * compromiseType: !chrome.passwordsPrivate.CompromiseType * }}
diff --git a/tools/binary_size/libsupersize/static/auth-consts.js b/tools/binary_size/libsupersize/static/auth-consts.js index 891d70c..e7a0b23 100644 --- a/tools/binary_size/libsupersize/static/auth-consts.js +++ b/tools/binary_size/libsupersize/static/auth-consts.js
@@ -5,7 +5,6 @@ // @ts-check 'use strict'; -const AUTH_API_KEY = 'AIzaSyAeKy_bJvcqYoLG02gCVF23an0kx8KzMng'; const AUTH_CLIENT_ID = '84462612899-hsikvugfjv36k8nt8459b7at62hi9sba.apps.googleusercontent.com'; const AUTH_SCOPE = 'https://www.googleapis.com/auth/devstorage.read_only'; const AUTH_DISCOVERY_URL = 'https://www.googleapis.com/discovery/v1/apis/storage/v1/rest';
diff --git a/tools/binary_size/libsupersize/static/auth.js b/tools/binary_size/libsupersize/static/auth.js index 4b2cf766..537d21a 100644 --- a/tools/binary_size/libsupersize/static/auth.js +++ b/tools/binary_size/libsupersize/static/auth.js
@@ -5,12 +5,12 @@ // @ts-check 'use strict'; +let _googleAuthPromiseResolve = null; window.googleAuth = null; window.googleAuthPromise = new Promise((resolve, reject) => { - googleAuthPromiseResolve = resolve; + _googleAuthPromiseResolve = resolve; }); -let _googleAuthPromiseResolve = null; function handleClientLoad() { if (requiresAuthentication()) { gapi.load('client:auth2', initClient); @@ -19,7 +19,6 @@ function initClient() { return gapi.client.init({ - 'apiKey': AUTH_API_KEY, 'clientId': AUTH_CLIENT_ID, 'discoveryDocs': [AUTH_DISCOVERY_URL], 'scope': AUTH_SCOPE,
diff --git a/tools/binary_size/libsupersize/static/tree-worker-wasm.js b/tools/binary_size/libsupersize/static/tree-worker-wasm.js index 5146898..2d1147fb 100644 --- a/tools/binary_size/libsupersize/static/tree-worker-wasm.js +++ b/tools/binary_size/libsupersize/static/tree-worker-wasm.js
@@ -4,9 +4,9 @@ 'use strict'; +importScripts('./auth-consts.js'); importScripts('./shared.js'); importScripts('./caspian_web.js'); -importScripts('./auth-consts.js'); const LoadWasm = new Promise(function(resolve, reject) { Module['onRuntimeInitialized'] = function() { @@ -73,7 +73,7 @@ async _fetchFromGoogleCloudStorage(url) { const {bucket, file} = parseGoogleCloudStorageUrl(url); - const params = `alt=media&key=${AUTH_API_KEY}`; + const params = `alt=media`; const api_url = `${STORAGE_API_ENDPOINT}/b/${bucket}/o/${file}?${params}`; const headers = new Headers(); headers.append('Authorization', `Bearer ${this._accessToken}`);
diff --git a/tools/clang/scripts/build.py b/tools/clang/scripts/build.py index 905f487..d206b50b 100755 --- a/tools/clang/scripts/build.py +++ b/tools/clang/scripts/build.py
@@ -343,8 +343,6 @@ parser.add_argument('--gcc-toolchain', help='what gcc toolchain to use for ' 'building; --gcc-toolchain=/opt/foo picks ' '/opt/foo/bin/gcc') - parser.add_argument('--lto-lld', action='store_true', - help='build lld with LTO (only applies on Linux)') parser.add_argument('--pgo', action='store_true', help='build with PGO') parser.add_argument('--llvm-force-head-revision', action='store_true', help='build the latest revision') @@ -371,13 +369,6 @@ default=sys.platform in ('linux2', 'darwin')) args = parser.parse_args() - if args.lto_lld and not args.bootstrap: - print('--lto-lld requires --bootstrap') - return 1 - if args.lto_lld and not sys.platform.startswith('linux'): - # TODO(hans): Use it on Windows too. - print('--lto-lld is only effective on Linux. Ignoring the option.') - args.lto_lld = False if args.pgo and not args.bootstrap: print('--pgo requires --bootstrap') return 1 @@ -525,7 +516,7 @@ if args.pgo: # Need libclang_rt.profile projects += ';compiler-rt' - if sys.platform != 'darwin' or args.lto_lld: + if sys.platform != 'darwin': projects += ';lld' if sys.platform == 'darwin': # Need libc++ and compiler-rt for the bootstrap compiler on mac. @@ -762,22 +753,6 @@ if lld is not None: threads_enabled_cmake_args.append('-DCMAKE_LINKER=' + lld) - if args.lto_lld: - # Build lld with LTO. That speeds up the linker by ~10%. - # We only use LTO for Linux now. - # - # The linker expects all archive members to have symbol tables, so the - # archiver needs to be able to create symbol tables for bitcode files. - # GNU ar and ranlib don't understand bitcode files, but llvm-ar and - # llvm-ranlib do, so use them. - ar = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'llvm-ar') - ranlib = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'llvm-ranlib') - threads_enabled_cmake_args += [ - '-DCMAKE_AR=' + ar, - '-DCMAKE_RANLIB=' + ranlib, - '-DLLVM_ENABLE_LTO=thin', - ] - RunCommand(['cmake'] + threads_enabled_cmake_args + [os.path.join(LLVM_DIR, 'llvm')], msvc_arch='x64', env=deployment_env)
diff --git a/tools/clang/scripts/package.py b/tools/clang/scripts/package.py index 6b3fc376..4e4574a6 100755 --- a/tools/clang/scripts/package.py +++ b/tools/clang/scripts/package.py
@@ -187,8 +187,6 @@ build_cmd = [sys.executable, os.path.join(THIS_DIR, 'build.py'), '--bootstrap', '--disable-asserts', '--run-tests', '--pgo'] - if sys.platform.startswith('linux'): - build_cmd.append('--lto-lld') TeeCmd(build_cmd, log) stamp = open(STAMP_FILE).read().rstrip()
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py index 8046b2b..5e0643a 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py
@@ -41,7 +41,7 @@ # Reverting problematic clang rolls is safe, though. CLANG_REVISION = '9284abd0040afecfd619dbcf1b244a8b533291c9' CLANG_SVN_REVISION = 'n344329' -CLANG_SUB_REVISION = 1 +CLANG_SUB_REVISION = 2 PACKAGE_VERSION = '%s-%s-%s' % (CLANG_SVN_REVISION, CLANG_REVISION[:8], CLANG_SUB_REVISION)
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index dd0ea72..6cdfdcd 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -8344,6 +8344,15 @@ <description>Please enter the description of this user action.</description> </action> +<action name="IOSAccountsSettingsCloseWithSwipe"> + <owner>msarda@chromium.org</owner> + <owner>jlebel@chromium.org</owner> + <description> + Reported when Accounts Settings UI was dismissed was dismissed using swipe + down gesture. iOS only. + </description> +</action> + <action name="IOSBookmarkManagerCloseWithSwipe"> <owner>eugenebut@chromium.com</owner> <owner>sczs@chromium.org</owner> @@ -8352,6 +8361,25 @@ </description> </action> +<action name="IOSClearBrowsingDataCloseWithSwipe"> + <owner>edchin@chromium.org</owner> + <owner>gambard@chromium.org</owner> + <owner>sczs@chromium.org</owner> + <description> + Reported when Clear Browsing Data Settings UI was dismissed using swipe down + gesture. iOS only. + </description> +</action> + +<action name="IOSGoogleServicesSettingsCloseWithSwipe"> + <owner>msarda@chromium.org</owner> + <owner>jlebel@chromium.org</owner> + <description> + Reported when Google Services Settings UI was dismissed using swipe down + gesture. iOS only. + </description> +</action> + <action name="IOSHistoryCloseWithSwipe"> <owner>eugenebut@google.com</owner> <owner>sczs@chromium.org</owner> @@ -8368,6 +8396,15 @@ </description> </action> +<action name="IOSLanguagesSettingsCloseWithSwipe"> + <owner>eugenebut@chromium.org</owner> + <owner>pkl@chromium.org</owner> + <description> + Reported when Languages Settings UI was dismissed using swipe down gesture. + iOS only. + </description> +</action> + <action name="IOSLaunchedByOpenInChromeIntent"> <owner>justincohen@chromium.org</owner> <owner>rohitrao@chromium.org</owner> @@ -8381,6 +8418,15 @@ </description> </action> +<action name="IOSPasswordsSettingsCloseWithSwipe"> + <owner>djean@chromium.org</owner> + <owner>javierrobles@chromium.com</owner> + <description> + Reported when Passwords Settings UI was dismissed using swipe down gesture. + iOS only. + </description> +</action> + <action name="IOSReadingListCloseWithSwipe"> <owner>eugenebut@google.com</owner> <owner>olivierrobin@chromium.org</owner> @@ -8397,6 +8443,24 @@ </description> </action> +<action name="IOSSettingsCloseWithSwipe"> + <owner>edchin@chromium.org</owner> + <owner>gambard@chromium.org</owner> + <owner>sczs@chromium.org</owner> + <description> + Reported when Settings UI was dismissed using swipe down gesture. iOS only. + </description> +</action> + +<action name="IOSSyncEncryptionPassphraseSettingsCloseWithSwipe"> + <owner>msarda@chromium.org</owner> + <owner>jlebel@chromium.org</owner> + <description> + Reported when Sync Encryption Passphrase Settings UI was dismissed using + swipe down gesture. iOS only. + </description> +</action> + <action name="Italic"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description> @@ -11853,6 +11917,14 @@ </description> </action> +<action name="MobileAccountsSettingsClose"> + <owner>msarda@chromium.org</owner> + <owner>jlebel@chromium.org</owner> + <description> + Reported when Accounts Settings UI was dismissed. iOS only. + </description> +</action> + <action name="MobileActionBarShown"> <owner>donnd@chromium.org</owner> <description> @@ -12180,6 +12252,15 @@ <description>Please enter the description of this user action.</description> </action> +<action name="MobileClearBrowsingDataClose"> + <owner>edchin@chromium.org</owner> + <owner>gambard@chromium.org</owner> + <owner>sczs@chromium.org</owner> + <description> + Reported when Clear Browsing Data Settings UI was dismissed. iOS only. + </description> +</action> + <action name="MobileClearBrowsingDataTriggeredFromLegacyUI"> <owner>sczs@chromium.org</owner> <description> @@ -12549,6 +12630,14 @@ </description> </action> +<action name="MobileGoogleServicesSettingsClose"> + <owner>msarda@chromium.org</owner> + <owner>jlebel@chromium.org</owner> + <description> + Reported when Google Services Settings UI was dismissed. iOS only. + </description> +</action> + <action name="MobileGoToBackground"> <owner>tedchoc@chromium.org</owner> <description> @@ -13333,6 +13422,14 @@ <description>Please enter the description of this user action.</description> </action> +<action name="MobilePasswordsSettingsClose"> + <owner>djean@chromium.org</owner> + <owner>javierrobles@chromium.com</owner> + <description> + Reported when Passwords Settings UI was dismissed. iOS only. + </description> +</action> + <action name="MobilePopupMenuSwipeToSelect"> <owner>gambard@chromium.org</owner> <description> @@ -13553,6 +13650,13 @@ </description> </action> +<action name="MobileSettingsClose"> + <owner>edchin@chromium.org</owner> + <owner>gambard@chromium.org</owner> + <owner>sczs@chromium.org</owner> + <description>Reported when Settings UI was dismissed. iOS only.</description> +</action> + <action name="MobileSettingsStorageClearAll"> <owner>dmurph@chromium.org</owner> <description> @@ -16827,14 +16931,16 @@ <description>Settings: Keyboard settings</description> </action> -<action name="Options_ShowPasswordManager"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> - <description>Please enter the description of this user action.</description> +<action name="Options_ShowPasswordCheck"> + <owner>jdoerrie@chromium.org</owner> + <owner>vasilii@chromium.org</owner> + <description>Settings: passwords check</description> </action> -<action name="Options_ShowPasswordsExceptions"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> - <description>Please enter the description of this user action.</description> +<action name="Options_ShowPasswordManager"> + <owner>jdoerrie@chromium.org</owner> + <owner>vasilii@chromium.org</owner> + <description>Settings: saved passwords</description> </action> <action name="Options_ShowPowerSettings">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 892fd0c8..06b366d 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -43569,8 +43569,11 @@ </histogram> <histogram name="Enterprise.AttributesTPMConsistency" - enum="EnterpriseAttributesTPMConsistencyType" expires_after="M77"> - <owner>tnagel@chromium.org</owner> + enum="EnterpriseAttributesTPMConsistencyType" expires_after="never"> +<!-- expires-never: Needed for health check. --> + + <owner>igorcov@chromium.org</owner> + <owner>vsavu@chromium.org</owner> <summary> Consistency between TPM lock state and absence/presence of install attributes at boot. @@ -43888,8 +43891,11 @@ </histogram> <histogram name="Enterprise.EnrolledPolicyHasDMToken" enum="Boolean" - expires_after="M77"> - <owner>tnagel@chromium.org</owner> + expires_after="never"> +<!-- expires-never: Used for monitoring the health of device policy. --> + + <owner>igorcov@chromium.org</owner> + <owner>vsavu@chromium.org</owner> <summary> Whether loading of device policy from file on an enterprise-enrolled (checked against install_attributes.pb) Chrome OS device yields an @@ -69064,8 +69070,9 @@ </histogram> <histogram name="Media.Android.MediaPlayerSuccess" enum="MediaPlayerExitStatus" - expires_after="2020-04-05"> + expires_after="2021-04-05"> <owner>tguilbert@chromium.org</owner> + <owner>media-dev@chromium.org</owner> <summary>Android: Whether MediaPlayer exited without errors.</summary> </histogram> @@ -77954,8 +77961,9 @@ </histogram> <histogram name="Memory.ParkableString.CompressionRatio.5min" units="%" - expires_after="2019-12-31"> + expires_after="M85"> <owner>lizeb@chromium.org</owner> + <owner>pasko@chromium.org</owner> <summary> Average compression ratio, 100 * compressed_size / initial_size, for all compressed ParkableStrings. Recorded at the same time as @@ -77988,8 +77996,9 @@ </histogram> <histogram name="Memory.ParkableString.MainThreadTime.5min" units="ms" - expires_after="2019-12-31"> + expires_after="M85"> <owner>lizeb@chromium.org</owner> + <owner>pasko@chromium.org</owner> <summary> Total main thread time used by ParkableStrings over the first 5 minutes of a renderer lifetime. Starting time is from the first ParkableString being @@ -77998,8 +78007,9 @@ </histogram> <histogram name="Memory.ParkableString.ParkingThreadTime.5min" units="ms" - expires_after="2019-12-31"> + expires_after="M85"> <owner>lizeb@chromium.org</owner> + <owner>pasko@chromium.org</owner> <summary> Total thread time used by ParkableStrings for parking over the first 5 minutes of a renderer lifetime. Starting time is from the first @@ -78010,6 +78020,7 @@ <histogram name="Memory.ParkableString.SavingsKb" units="KB" expires_after="M85"> <owner>lizeb@chromium.org</owner> + <owner>pasko@chromium.org</owner> <summary> Sum of memory saved by compression, in KB. Recorded at the same time as "Memory.ParkableString.TotalSizeKb". @@ -78017,11 +78028,9 @@ </histogram> <histogram name="Memory.ParkableString.SavingsKb.5min" units="KB" - expires_after="2020-04-05"> - <obsolete> - Removed 07/2019. No longer recorded. - </obsolete> + expires_after="M85"> <owner>lizeb@chromium.org</owner> + <owner>pasko@chromium.org</owner> <summary> Sum of memory saved by compression, in KB. Recorded at the same time as "Memory.ParkableString.TotalSizeKb.5min". @@ -78042,8 +78051,9 @@ </histogram> <histogram name="Memory.ParkableString.TotalSizeKb.5min" units="KB" - expires_after="2019-12-31"> + expires_after="M85"> <owner>lizeb@chromium.org</owner> + <owner>pasko@chromium.org</owner> <summary> Total size of ParkableStrings assuming no compression, in KB. Recorded once, 5 minutes after the first ParkableString is added to a renderer, at the same @@ -78052,7 +78062,7 @@ </histogram> <histogram name="Memory.PartitionAlloc.MainThreadTime.5min" units="ms" - expires_after="2020-04-05"> + expires_after="M85"> <owner>lizeb@chromium.org</owner> <owner>pasko@chromium.org</owner> <summary> @@ -127089,12 +127099,14 @@ </histogram> <histogram name="Profile.SyncCustomize" enum="ProfileSyncCustomize" - expires_after="2018-08-30"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> + expires_after="M85"> + <owner>msalama@chromium.org</owner> + <owner>chrome-signin-team@google.com</owner> <summary> Number of times and ways the user customized the sync options of their profile. Percentages are not meaningful. To determine percentages, take the - count of a given action over the count of number of customizations. + count of a given action over the count of number of customizations. The + histogram has expired in '2018-08-30' and is resurrected in '2020-03-09'. </summary> </histogram> @@ -148568,6 +148580,9 @@ <histogram name="Signin.AndroidTimeBetweenUpdateAccountList" units="ms" expires_after="2020-03-14"> + <obsolete> + Removed on 2020-03 as it is not needed by the signin team. + </obsolete> <owner>bsazonov@chromium.org</owner> <owner>droger@chromium.org</owner> <summary>
diff --git a/tools/metrics/ukm/ukm.xml b/tools/metrics/ukm/ukm.xml index deabe95..70c898c5 100644 --- a/tools/metrics/ukm/ukm.xml +++ b/tools/metrics/ukm/ukm.xml
@@ -8375,6 +8375,12 @@ Boolean value to represent whether the popup was closed by user gesture. </summary> </metric> + <metric name="WindowOpenDisposition" enum="WindowOpenDisposition"> + <summary> + The UI window open disposition used when creating the web contents of the + pop-up. Set by the browser process when the pop up tracker is created. + </summary> + </metric> </event> <event name="Popup.Page">
diff --git a/tools/perf/contrib/system_health_infinite_scroll/system_health_infinite_scroll.py b/tools/perf/contrib/system_health_infinite_scroll/system_health_infinite_scroll.py index 0a43837..93c9b7d 100644 --- a/tools/perf/contrib/system_health_infinite_scroll/system_health_infinite_scroll.py +++ b/tools/perf/contrib/system_health_infinite_scroll/system_health_infinite_scroll.py
@@ -29,7 +29,7 @@ options.SetTimelineBasedMetrics([ 'tbmv3:scroll_jank_metric', 'tbmv3:janky_scroll_periods', - 'tmbv3:janky_time_per_scroll_processing_time', + 'tbmv3:janky_time_per_scroll_processing_time', ]) return options
diff --git a/tools/perf/expectations.config b/tools/perf/expectations.config index 2bb96294..26ea3242 100644 --- a/tools/perf/expectations.config +++ b/tools/perf/expectations.config
@@ -224,6 +224,8 @@ crbug.com/1053614 [ win ] rendering.desktop/filter_terrain_svg [ Skip ] crbug.com/1059200 [ win7 ] rendering.desktop/canvas_to_blob [ Skip ] crbug.com/1059273 [ win7 ] rendering.desktop/css_transitions_inline_style [ Skip ] +crbug.com/1059723 [ win7 ] rendering.desktop/css_value_type_shadow [ Skip ] +crbug.com/1059767 [ win7 ] rendering.desktop/main_30fps_impl_60fps [ Skip ] # Benchmark: rendering.mobile crbug.com/785485 [ android-webview ] rendering.mobile/kevs_3d [ Skip ] @@ -286,6 +288,7 @@ crbug.com/948789 [ android-nexus-5 ] startup.mobile/maps_pwa:with_http_cache [ Skip ] crbug.com/948789 [ android-nexus-5x ] startup.mobile/maps_pwa:with_http_cache [ Skip ] crbug.com/1030735 [ android-weblayer ] startup.mobile/maps_pwa:with_http_cache [ Skip ] +crbug.com/1059717 [ android-pixel-2 ] startup.mobile/maps_pwa:with_http_cache [ Skip ] # Benchmark: system_health.common_desktop crbug.com/903417 [ mac ] system_health.common_desktop/long_running:tools:gmail-foreground [ Skip ]
diff --git a/ui/latency/latency_info.cc b/ui/latency/latency_info.cc index 90c77e1..540a91a 100644 --- a/ui/latency/latency_info.cc +++ b/ui/latency/latency_info.cc
@@ -36,7 +36,6 @@ CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT); CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT); CASE_TYPE(INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT_COMPONENT); - CASE_TYPE(INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT); CASE_TYPE(INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT); CASE_TYPE(INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT); CASE_TYPE(DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT);
diff --git a/ui/latency/latency_info.h b/ui/latency/latency_info.h index fb1a15a..f77a938 100644 --- a/ui/latency/latency_info.h +++ b/ui/latency/latency_info.h
@@ -65,8 +65,6 @@ INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, // Original timestamp of the last event that has been coalesced into this one. INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT_COMPONENT, - // Timestamp when the event's ack is received by the RWH. - INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, // Timestamp when the frame is swapped in renderer. INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, // Timestamp of when the display compositor receives a compositor frame from
diff --git a/ui/latency/mojom/latency_info.mojom b/ui/latency/mojom/latency_info.mojom index d2641f3..b4d84409 100644 --- a/ui/latency/mojom/latency_info.mojom +++ b/ui/latency/mojom/latency_info.mojom
@@ -31,8 +31,6 @@ INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, // Timestamp for last event that has been coalesced into this one. INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT_COMPONENT, - // Timestamp when the event's ack is received by the RWH. - INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, // Timestamp when the frame is swapped in renderer. INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, // Timestamp of when the display compositor receives a compositor frame.
diff --git a/ui/latency/mojom/latency_info_mojom_traits.cc b/ui/latency/mojom/latency_info_mojom_traits.cc index 7826e69..11fc916 100644 --- a/ui/latency/mojom/latency_info_mojom_traits.cc +++ b/ui/latency/mojom/latency_info_mojom_traits.cc
@@ -169,9 +169,6 @@ case ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT_COMPONENT: return ui::mojom::LatencyComponentType:: INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT_COMPONENT; - case ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT: - return ui::mojom::LatencyComponentType:: - INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT; case ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT: return ui::mojom::LatencyComponentType:: INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT; @@ -225,9 +222,6 @@ INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT: *output = ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT; return true; - case ui::mojom::LatencyComponentType::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT: - *output = ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT; - return true; case ui::mojom::LatencyComponentType:: INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT: *output = ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT;
diff --git a/ui/ozone/platform/scenic/scenic_surface_factory.cc b/ui/ozone/platform/scenic/scenic_surface_factory.cc index f00e658f..9820474a 100644 --- a/ui/ozone/platform/scenic/scenic_surface_factory.cc +++ b/ui/ozone/platform/scenic/scenic_surface_factory.cc
@@ -94,6 +94,7 @@ return std::vector<gl::GLImplementation>{ gl::kGLImplementationSwiftShaderGL, gl::kGLImplementationEGLGLES2, + gl::kGLImplementationEGLANGLE, gl::kGLImplementationStubGL, }; } @@ -102,6 +103,7 @@ switch (implementation) { case gl::kGLImplementationSwiftShaderGL: case gl::kGLImplementationEGLGLES2: + case gl::kGLImplementationEGLANGLE: return egl_implementation_.get(); default: return nullptr;
diff --git a/ui/resources/BUILD.gn b/ui/resources/BUILD.gn index b955bff..e6482b17 100644 --- a/ui/resources/BUILD.gn +++ b/ui/resources/BUILD.gn
@@ -44,9 +44,6 @@ deps += [ "//ui/webui/resources/css:cros_colors_css" ] } - # The .grd contains references to generated files. - source_is_generated = true - outputs = [ "grit/webui_resources.h", "grit/webui_resources_map.cc",
diff --git a/ui/webui/resources/BUILD.gn b/ui/webui/resources/BUILD.gn index 218abd0..ad096337 100644 --- a/ui/webui/resources/BUILD.gn +++ b/ui/webui/resources/BUILD.gn
@@ -14,9 +14,11 @@ } group("modulize") { - deps = [ + public_deps = [ "cr_components:polymer3_elements", "cr_elements:polymer3_elements", "js:modulize", + "js/cr:modulize", + "js/cr/ui:modulize", ] }
diff --git a/ui/webui/resources/cr_components/BUILD.gn b/ui/webui/resources/cr_components/BUILD.gn index d631521..1f97246 100644 --- a/ui/webui/resources/cr_components/BUILD.gn +++ b/ui/webui/resources/cr_components/BUILD.gn
@@ -17,11 +17,11 @@ } group("polymer3_elements") { - deps = [ + public_deps = [ "certificate_manager:polymer3_elements", "managed_footnote:managed_footnote_module", ] if (is_chromeos) { - deps += [ "chromeos:polymer3_elements" ] + public_deps += [ "chromeos:polymer3_elements" ] } }
diff --git a/ui/webui/resources/cr_components/certificate_manager/BUILD.gn b/ui/webui/resources/cr_components/certificate_manager/BUILD.gn index d60f081f0..21da554f 100644 --- a/ui/webui/resources/cr_components/certificate_manager/BUILD.gn +++ b/ui/webui/resources/cr_components/certificate_manager/BUILD.gn
@@ -268,7 +268,7 @@ } group("polymer3_elements") { - deps = [ + public_deps = [ ":ca_trust_edit_dialog_module", ":certificate_delete_confirmation_dialog_module", ":certificate_entry_module",
diff --git a/ui/webui/resources/cr_components/chromeos/BUILD.gn b/ui/webui/resources/cr_components/chromeos/BUILD.gn index a0003ee..0be7ca9 100644 --- a/ui/webui/resources/cr_components/chromeos/BUILD.gn +++ b/ui/webui/resources/cr_components/chromeos/BUILD.gn
@@ -44,7 +44,7 @@ } group("polymer3_elements") { - deps = [ + public_deps = [ "smb_shares:add_smb_share_dialog_module", "smb_shares:smb_browser_proxy_module", ]
diff --git a/ui/webui/resources/cr_elements/BUILD.gn b/ui/webui/resources/cr_elements/BUILD.gn index 959f635..685c8ed 100644 --- a/ui/webui/resources/cr_elements/BUILD.gn +++ b/ui/webui/resources/cr_elements/BUILD.gn
@@ -149,7 +149,7 @@ } group("polymer3_elements") { - deps = [ + public_deps = [ ":action_link_css_module", ":cr_icons_css_module", ":cr_page_host_style_css_module", @@ -185,7 +185,7 @@ ] if (is_chromeos) { - deps += [ + public_deps += [ # cr-searchable-drop-down is only used in smb and cups dialogs, both of # which are chromeos only. "chromeos:cros_color_overrides_module",
diff --git a/ui/webui/resources/cr_elements/cr_input/BUILD.gn b/ui/webui/resources/cr_elements/cr_input/BUILD.gn index a3fb925..7453e56 100644 --- a/ui/webui/resources/cr_elements/cr_input/BUILD.gn +++ b/ui/webui/resources/cr_elements/cr_input/BUILD.gn
@@ -17,7 +17,7 @@ } group("polymer3_elements") { - deps = [ + public_deps = [ ":cr_input_module", ":cr_input_style_css_module", ]
diff --git a/ui/webui/resources/cr_elements/cr_profile_avatar_selector/BUILD.gn b/ui/webui/resources/cr_elements/cr_profile_avatar_selector/BUILD.gn index e170962..2ae5ef9b 100644 --- a/ui/webui/resources/cr_elements/cr_profile_avatar_selector/BUILD.gn +++ b/ui/webui/resources/cr_elements/cr_profile_avatar_selector/BUILD.gn
@@ -27,7 +27,7 @@ } group("polymer3_elements") { - deps = [ + public_deps = [ ":cr_profile_avatar_selector_grid_module", ":cr_profile_avatar_selector_module", ]
diff --git a/ui/webui/resources/cr_elements/cr_radio_button/BUILD.gn b/ui/webui/resources/cr_elements/cr_radio_button/BUILD.gn index 267295d..26a22834 100644 --- a/ui/webui/resources/cr_elements/cr_radio_button/BUILD.gn +++ b/ui/webui/resources/cr_elements/cr_radio_button/BUILD.gn
@@ -21,7 +21,7 @@ # Targets for auto-generating and typechecking Polymer 3 JS modules group("polymer3_elements") { - deps = [ + public_deps = [ ":cr_radio_button_module", ":cr_radio_button_style_css_module", ":modulize",
diff --git a/ui/webui/resources/cr_elements/cr_search_field/BUILD.gn b/ui/webui/resources/cr_elements/cr_search_field/BUILD.gn index 1af6530..4fa8b9d 100644 --- a/ui/webui/resources/cr_elements/cr_search_field/BUILD.gn +++ b/ui/webui/resources/cr_elements/cr_search_field/BUILD.gn
@@ -28,7 +28,7 @@ # Targets for auto-generating and typechecking Polymer 3 JS modules group("polymer3_elements") { - deps = [ + public_deps = [ ":cr_search_field_module", ":modulize", ]
diff --git a/ui/webui/resources/cr_elements/cr_toast/BUILD.gn b/ui/webui/resources/cr_elements/cr_toast/BUILD.gn index 6f4159e7..f55dd97 100644 --- a/ui/webui/resources/cr_elements/cr_toast/BUILD.gn +++ b/ui/webui/resources/cr_elements/cr_toast/BUILD.gn
@@ -25,7 +25,7 @@ } group("polymer3_elements") { - deps = [ + public_deps = [ ":cr_toast_manager_module", ":cr_toast_module", ]
diff --git a/ui/webui/resources/cr_elements/cr_toolbar/BUILD.gn b/ui/webui/resources/cr_elements/cr_toolbar/BUILD.gn index 71f1cff..040f9a4 100644 --- a/ui/webui/resources/cr_elements/cr_toolbar/BUILD.gn +++ b/ui/webui/resources/cr_elements/cr_toolbar/BUILD.gn
@@ -27,7 +27,7 @@ } group("polymer3_elements") { - deps = [ + public_deps = [ ":cr_toolbar_module", ":cr_toolbar_search_field_module", ":cr_toolbar_selection_overlay_module",
diff --git a/ui/webui/resources/cr_elements/policy/BUILD.gn b/ui/webui/resources/cr_elements/policy/BUILD.gn index 5f21fa2..22f8e5f 100644 --- a/ui/webui/resources/cr_elements/policy/BUILD.gn +++ b/ui/webui/resources/cr_elements/policy/BUILD.gn
@@ -120,7 +120,7 @@ } group("polymer3_elements") { - deps = [ + public_deps = [ ":cr_policy_indicator_module", ":cr_policy_pref_indicator_module", ":cr_tooltip_icon_module",
diff --git a/url/mojom/BUILD.gn b/url/mojom/BUILD.gn index fc99841..f809122c 100644 --- a/url/mojom/BUILD.gn +++ b/url/mojom/BUILD.gn
@@ -7,9 +7,6 @@ mojom("url_mojom_gurl") { generate_java = true sources = [ "url.mojom" ] - cpp_typemaps = [ ":url_typemap" ] - blink_cpp_typemaps = - [ "//third_party/blink/renderer/platform/mojo:url_typemap" ] } mojom("url_mojom_origin") { @@ -22,10 +19,6 @@ ] check_includes_blink = false - - cpp_typemaps = [ ":origin_typemap" ] - blink_cpp_typemaps = - [ "//third_party/blink/renderer/platform/mojo:origin_typemap" ] } mojom("test_url_mojom_gurl") { @@ -36,58 +29,3 @@ ":url_mojom_origin", ] } - -component("mojom_traits") { - output_name = "url_mojom_traits" - - sources = [ - "origin_mojom_traits.cc", - "origin_mojom_traits.h", - "url_gurl_mojom_traits.cc", - "url_gurl_mojom_traits.h", - ] - - defines = [ "IS_URL_MOJOM_TRAITS_IMPL" ] - - public_deps = [ - ":url_mojom_gurl_shared", - ":url_mojom_origin_shared", - "//base", - "//mojo/public/cpp/base:shared_typemap_traits", - "//url", - ] -} - -mojom_cpp_typemap("url_typemap") { - types = [ - { - mojom = "url.mojom.Url" - cpp = "::GURL" - }, - ] - public_headers = [ - "//url/gurl.h", - "//url/mojom/url_gurl_mojom_traits.h", - ] - public_deps = [ - ":mojom_traits", - "//url", - ] -} - -mojom_cpp_typemap("origin_typemap") { - types = [ - { - mojom = "url.mojom.Origin" - cpp = "::url::Origin" - }, - ] - public_headers = [ - "//url/origin.h", - "//url/mojom/origin_mojom_traits.h", - ] - public_deps = [ - ":mojom_traits", - "//url", - ] -}
diff --git a/url/mojom/OWNERS b/url/mojom/OWNERS index 06776ee..ff78c432a 100644 --- a/url/mojom/OWNERS +++ b/url/mojom/OWNERS
@@ -2,4 +2,6 @@ per-file *.mojom=file://ipc/SECURITY_OWNERS per-file *_mojom_traits*.*=set noparent per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS +per-file *.typemap=set noparent +per-file *.typemap=file://ipc/SECURITY_OWNERS # COMPONENT: Internals>Mojo
diff --git a/url/mojom/gurl.typemap b/url/mojom/gurl.typemap new file mode 100644 index 0000000..64d8507 --- /dev/null +++ b/url/mojom/gurl.typemap
@@ -0,0 +1,11 @@ +# 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. + +mojom = "//url/mojom/url.mojom" +public_headers = [ "//url/gurl.h" ] +traits_headers = [ "//url/mojom/url_gurl_mojom_traits.h" ] +deps = [ + "//url", +] +type_mappings = [ "url.mojom.Url=::GURL" ]
diff --git a/url/mojom/origin.typemap b/url/mojom/origin.typemap new file mode 100644 index 0000000..0dcf3bb0c --- /dev/null +++ b/url/mojom/origin.typemap
@@ -0,0 +1,11 @@ +# 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. + +mojom = "//url/mojom/origin.mojom" +public_headers = [ "//url/origin.h" ] +traits_headers = [ "//url/mojom/origin_mojom_traits.h" ] +deps = [ + "//url", +] +type_mappings = [ "url.mojom.Origin=::url::Origin" ]
diff --git a/url/mojom/origin_mojom_traits.cc b/url/mojom/origin_mojom_traits.cc deleted file mode 100644 index 213c43b..0000000 --- a/url/mojom/origin_mojom_traits.cc +++ /dev/null
@@ -1,34 +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 "url/mojom/origin_mojom_traits.h" - -#include "base/strings/string_piece.h" - -namespace mojo { - -// static -bool StructTraits<url::mojom::OriginDataView, url::Origin>::Read( - url::mojom::OriginDataView data, - url::Origin* out) { - base::StringPiece scheme, host; - base::Optional<base::UnguessableToken> nonce_if_opaque; - if (!data.ReadScheme(&scheme) || !data.ReadHost(&host) || - !data.ReadNonceIfOpaque(&nonce_if_opaque)) - return false; - - base::Optional<url::Origin> creation_result = - nonce_if_opaque - ? url::Origin::UnsafelyCreateOpaqueOriginWithoutNormalization( - scheme, host, data.port(), url::Origin::Nonce(*nonce_if_opaque)) - : url::Origin::UnsafelyCreateTupleOriginWithoutNormalization( - scheme, host, data.port()); - if (!creation_result) - return false; - - *out = std::move(creation_result.value()); - return true; -} - -} // namespace mojo
diff --git a/url/mojom/origin_mojom_traits.h b/url/mojom/origin_mojom_traits.h index 79ee161..ac34fe9 100644 --- a/url/mojom/origin_mojom_traits.h +++ b/url/mojom/origin_mojom_traits.h
@@ -5,18 +5,16 @@ #ifndef URL_MOJO_ORIGIN_MOJOM_TRAITS_H_ #define URL_MOJO_ORIGIN_MOJOM_TRAITS_H_ -#include "base/component_export.h" -#include "base/optional.h" +#include "base/strings/string_piece.h" #include "base/unguessable_token.h" #include "mojo/public/cpp/base/unguessable_token_mojom_traits.h" -#include "url/mojom/origin.mojom-shared.h" +#include "url/mojom/origin.mojom.h" #include "url/origin.h" namespace mojo { template <> -struct COMPONENT_EXPORT(URL_MOJOM_TRAITS) - StructTraits<url::mojom::OriginDataView, url::Origin> { +struct StructTraits<url::mojom::OriginDataView, url::Origin> { static const std::string& scheme(const url::Origin& r) { return r.GetTupleOrPrecursorTupleIfOpaque().scheme(); } @@ -31,7 +29,26 @@ // TODO(nasko): Consider returning a const reference here. return r.GetNonceForSerialization(); } - static bool Read(url::mojom::OriginDataView data, url::Origin* out); + static bool Read(url::mojom::OriginDataView data, url::Origin* out) { + base::StringPiece scheme, host; + base::Optional<base::UnguessableToken> nonce_if_opaque; + if (!data.ReadScheme(&scheme) || !data.ReadHost(&host) || + !data.ReadNonceIfOpaque(&nonce_if_opaque)) + return false; + + base::Optional<url::Origin> creation_result = + nonce_if_opaque + ? url::Origin::UnsafelyCreateOpaqueOriginWithoutNormalization( + scheme, host, data.port(), + url::Origin::Nonce(*nonce_if_opaque)) + : url::Origin::UnsafelyCreateTupleOriginWithoutNormalization( + scheme, host, data.port()); + if (!creation_result) + return false; + + *out = std::move(creation_result.value()); + return true; + } }; } // namespace mojo
diff --git a/url/mojom/typemaps.gni b/url/mojom/typemaps.gni new file mode 100644 index 0000000..53875c3cd --- /dev/null +++ b/url/mojom/typemaps.gni
@@ -0,0 +1,8 @@ +# 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. + +typemaps = [ + "//url/mojom/origin.typemap", + "//url/mojom/gurl.typemap", +]
diff --git a/url/mojom/url_gurl_mojom_traits.cc b/url/mojom/url_gurl_mojom_traits.cc deleted file mode 100644 index 4d776dba..0000000 --- a/url/mojom/url_gurl_mojom_traits.cc +++ /dev/null
@@ -1,40 +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 "url/mojom/url_gurl_mojom_traits.h" - -#include "url/url_constants.h" - -namespace mojo { - -// static -base::StringPiece StructTraits<url::mojom::UrlDataView, GURL>::url( - const GURL& r) { - if (r.possibly_invalid_spec().length() > url::kMaxURLChars || !r.is_valid()) { - return base::StringPiece(); - } - - return base::StringPiece(r.possibly_invalid_spec().c_str(), - r.possibly_invalid_spec().length()); -} - -// static -bool StructTraits<url::mojom::UrlDataView, GURL>::Read( - url::mojom::UrlDataView data, - GURL* out) { - base::StringPiece url_string; - if (!data.ReadUrl(&url_string)) - return false; - - if (url_string.length() > url::kMaxURLChars) - return false; - - *out = GURL(url_string); - if (!url_string.empty() && !out->is_valid()) - return false; - - return true; -} - -} // namespace mojo
diff --git a/url/mojom/url_gurl_mojom_traits.h b/url/mojom/url_gurl_mojom_traits.h index 7d668209..57a36c9 100644 --- a/url/mojom/url_gurl_mojom_traits.h +++ b/url/mojom/url_gurl_mojom_traits.h
@@ -5,19 +5,38 @@ #ifndef URL_MOJOM_URL_GURL_MOJOM_TRAITS_H_ #define URL_MOJOM_URL_GURL_MOJOM_TRAITS_H_ -#include "base/component_export.h" #include "base/strings/string_piece.h" -#include "mojo/public/cpp/bindings/struct_traits.h" #include "url/gurl.h" -#include "url/mojom/url.mojom-shared.h" +#include "url/mojom/url.mojom.h" +#include "url/url_constants.h" namespace mojo { template <> -struct COMPONENT_EXPORT(URL_MOJOM_TRAITS) - StructTraits<url::mojom::UrlDataView, GURL> { - static base::StringPiece url(const GURL& r); - static bool Read(url::mojom::UrlDataView data, GURL* out); +struct StructTraits<url::mojom::UrlDataView, GURL> { + static base::StringPiece url(const GURL& r) { + if (r.possibly_invalid_spec().length() > url::kMaxURLChars || + !r.is_valid()) { + return base::StringPiece(); + } + + return base::StringPiece(r.possibly_invalid_spec().c_str(), + r.possibly_invalid_spec().length()); + } + static bool Read(url::mojom::UrlDataView data, GURL* out) { + base::StringPiece url_string; + if (!data.ReadUrl(&url_string)) + return false; + + if (url_string.length() > url::kMaxURLChars) + return false; + + *out = GURL(url_string); + if (!url_string.empty() && !out->is_valid()) + return false; + + return true; + } }; } // namespace mojo
diff --git a/url/url_util.cc b/url/url_util.cc index 58d976cd..93a1063 100644 --- a/url/url_util.cc +++ b/url/url_util.cc
@@ -8,6 +8,7 @@ #include <string.h> #include <atomic> +#include "base/compiler_specific.h" #include "base/logging.h" #include "base/no_destructor.h" #include "base/stl_util.h" @@ -183,7 +184,7 @@ Component* found_scheme) { // Before extracting scheme, canonicalize the URL to remove any whitespace. // This matches the canonicalization done in DoCanonicalize function. - RawCanonOutputT<CHAR> whitespace_buffer; + STACK_UNINITIALIZED RawCanonOutputT<CHAR> whitespace_buffer; int spec_len; const CHAR* spec = RemoveURLWhitespace(str, str_len, &whitespace_buffer, &spec_len, nullptr); @@ -212,7 +213,7 @@ // Remove any whitespace from the middle of the relative URL if necessary. // Possibly this will result in copying to the new buffer. - RawCanonOutputT<CHAR> whitespace_buffer; + STACK_UNINITIALIZED RawCanonOutputT<CHAR> whitespace_buffer; if (whitespace_policy == REMOVE_WHITESPACE) { spec = RemoveURLWhitespace(spec, spec_len, &whitespace_buffer, &spec_len, &output_parsed->potentially_dangling_markup); @@ -291,7 +292,7 @@ Parsed* output_parsed) { // Remove any whitespace from the middle of the relative URL, possibly // copying to the new buffer. - RawCanonOutputT<CHAR> whitespace_buffer; + STACK_UNINITIALIZED RawCanonOutputT<CHAR> whitespace_buffer; int relative_length; const CHAR* relative = RemoveURLWhitespace( in_relative, in_relative_length, &whitespace_buffer, &relative_length, @@ -332,7 +333,7 @@ Parsed base_parsed_authority; ParseStandardURL(base_spec, base_spec_len, &base_parsed_authority); if (base_parsed_authority.host.is_nonempty()) { - RawCanonOutputT<char> temporary_output; + STACK_UNINITIALIZED RawCanonOutputT<char> temporary_output; bool did_resolve_succeed = ResolveRelativeURL(base_spec, base_parsed_authority, false, relative, relative_component, charset_converter, @@ -384,7 +385,7 @@ if (replacements.IsSchemeOverridden()) { // Canonicalize the new scheme so it is 8-bit and can be concatenated with // the existing spec. - RawCanonOutput<128> scheme_replaced; + STACK_UNINITIALIZED RawCanonOutput<128> scheme_replaced; Component scheme_replaced_parsed; CanonicalizeScheme(replacements.sources().scheme, replacements.components().scheme, @@ -401,7 +402,7 @@ // We now need to completely re-parse the resulting string since its meaning // may have changed with the different scheme. - RawCanonOutput<128> recanonicalized; + STACK_UNINITIALIZED RawCanonOutput<128> recanonicalized; Parsed recanonicalized_parsed; DoCanonicalize(scheme_replaced.data(), scheme_replaced.length(), true, REMOVE_WHITESPACE, charset_converter, &recanonicalized, @@ -699,7 +700,7 @@ } bool HostIsIPAddress(base::StringPiece host) { - url::RawCanonOutputT<char, 128> ignored_output; + STACK_UNINITIALIZED url::RawCanonOutputT<char, 128> ignored_output; url::CanonHostInfo host_info; url::CanonicalizeIPAddress(host.data(), Component(0, host.length()), &ignored_output, &host_info); @@ -778,7 +779,7 @@ int length, DecodeURLMode mode, CanonOutputW* output) { - RawCanonOutputT<char> unescaped_chars; + STACK_UNINITIALIZED RawCanonOutputT<char> unescaped_chars; for (int i = 0; i < length; i++) { if (input[i] == '%') { unsigned char ch;
diff --git a/weblayer/OWNERS b/weblayer/OWNERS index 5592a7c9..b97477b 100644 --- a/weblayer/OWNERS +++ b/weblayer/OWNERS
@@ -4,7 +4,7 @@ darin@chromium.org estade@chromium.org jam@chromium.org -pshmakov@chromium.org +nator@chromium.org sky@chromium.org timvolodine@chromium.org tobiasjs@chromium.org