diff --git a/DEPS b/DEPS index 907f2f9..d910577a 100644 --- a/DEPS +++ b/DEPS
@@ -138,11 +138,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': '5549cb00a2cf93261b37cf7e68216616fdbd5d96', + 'skia_revision': '82774f8bad1c47124706029b591912c545abdc5a', # 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': '994af5984123b8daa5e26d584f6de961facd1f57', + 'v8_revision': '52056cb43a0aac993c4e5cd8b393105d40ef871d', # 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. @@ -150,7 +150,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': 'bf4cfa77c4bf0474485c44aa4ec5922940e6c6a2', + 'angle_revision': '53c4495a336613240f618c0c64f14d9c4e83a336', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -158,7 +158,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': '6c7a857f7ee6ad009122fa377ce0f6551c091445', + 'pdfium_revision': '51472702711387a2ab6b9b5b23f1790d446a56a0', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling BoringSSL # and whatever else without interference from each other. @@ -201,7 +201,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '94c77e7ec6164015e09be1463642987391ef5577', + 'catapult_revision': '569931dc3a364f49c520d050e1c76e54c01e16b6', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -807,7 +807,7 @@ # Build tools for Chrome OS. Note: This depends on third_party/pyelftools. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '53848550d9985834f755395ebc31c4afa5cafc07', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + 'f1465c8cf20f545efeed0a0af57858ee296569d1', 'condition': 'checkout_linux', }, @@ -1355,7 +1355,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '6f0b34abee8dba611c253738d955c59f703c147a', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '6924d508a2fb1a43bf0072aad9a27cf2b2875969', + Var('webrtc_git') + '/src.git' + '@' + 'abf7eba8658c6facda98210399bf88d0c5f72036', 'src/third_party/xdg-utils': { 'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d', @@ -1396,7 +1396,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@0dfb80d9d88aacc68a4329186d25169b034404dc', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@a8ec6e758bb3f9920f68441536d59f9e75320ec9', 'condition': 'checkout_src_internal', },
diff --git a/android_webview/BUILD.gn b/android_webview/BUILD.gn index 620a6f2..701b9262 100644 --- a/android_webview/BUILD.gn +++ b/android_webview/BUILD.gn
@@ -1069,7 +1069,6 @@ "java/src/org/chromium/android_webview/services/AwMinidumpUploaderDelegate.java", "java/src/org/chromium/android_webview/services/AwVariationsSeedFetcher.java", "java/src/org/chromium/android_webview/services/CrashReceiverService.java", - "java/src/org/chromium/android_webview/services/ServiceInit.java", "java/src/org/chromium/android_webview/services/VariationsSeedHolder.java", "java/src/org/chromium/android_webview/services/VariationsSeedServer.java", ]
diff --git a/android_webview/apk/BUILD.gn b/android_webview/apk/BUILD.gn index 8f5d5559..cb7fe55 100644 --- a/android_webview/apk/BUILD.gn +++ b/android_webview/apk/BUILD.gn
@@ -31,6 +31,7 @@ "java/src/com/android/webview/chromium/WebViewApkApplication.java", ] deps = [ + "//android_webview:android_webview_commandline_java", "//base:base_java", "//components/embedder_support/android:application_java", ]
diff --git a/android_webview/apk/java/src/com/android/webview/chromium/WebViewApkApplication.java b/android_webview/apk/java/src/com/android/webview/chromium/WebViewApkApplication.java index 303ee895..540dd83b 100644 --- a/android_webview/apk/java/src/com/android/webview/chromium/WebViewApkApplication.java +++ b/android_webview/apk/java/src/com/android/webview/chromium/WebViewApkApplication.java
@@ -7,7 +7,9 @@ import android.app.Application; import android.content.Context; +import org.chromium.android_webview.command_line.CommandLineUtil; import org.chromium.base.ContextUtils; +import org.chromium.base.PathUtils; import org.chromium.base.annotations.JNINamespace; import org.chromium.base.library_loader.LibraryLoader; import org.chromium.components.embedder_support.application.FontPreloadingWorkaround; @@ -15,7 +17,9 @@ /** * Application subclass for SystemWebView and Trichrome. * - * Application subclass is only used in renderer processes and in the WebView APK's own services. + * Application subclass is used by renderer processes, services, and content providers that run + * under the WebView APK's package. + * * None of this code runs in an application which simply uses WebView. */ @JNINamespace("android_webview") @@ -26,6 +30,8 @@ protected void attachBaseContext(Context context) { super.attachBaseContext(context); ContextUtils.initApplicationContext(this); + PathUtils.setPrivateDataDirectorySuffix("webview"); + initCommandLine(); } @Override @@ -34,6 +40,11 @@ FontPreloadingWorkaround.maybeInstallWorkaround(this); } + // Overridden by webview shell to point to a different flags file. + protected void initCommandLine() { + CommandLineUtil.initCommandLine(); + } + /** * Performs minimal native library initialization required when running as a stand-alone APK. * @return True if the library was loaded, false if running as webview stub.
diff --git a/android_webview/java/src/org/chromium/android_webview/AwAutofillUMA.java b/android_webview/java/src/org/chromium/android_webview/AwAutofillUMA.java index bd3e3d4..0417902 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwAutofillUMA.java +++ b/android_webview/java/src/org/chromium/android_webview/AwAutofillUMA.java
@@ -6,8 +6,8 @@ import android.content.Context; +import org.chromium.autofill.mojom.SubmissionSource; import org.chromium.base.metrics.RecordHistogram; -import org.chromium.components.autofill.SubmissionSource; import java.util.concurrent.TimeUnit;
diff --git a/android_webview/java/src/org/chromium/android_webview/services/AwMinidumpUploadJobService.java b/android_webview/java/src/org/chromium/android_webview/services/AwMinidumpUploadJobService.java index f6856a6..66450bf 100644 --- a/android_webview/java/src/org/chromium/android_webview/services/AwMinidumpUploadJobService.java +++ b/android_webview/java/src/org/chromium/android_webview/services/AwMinidumpUploadJobService.java
@@ -15,13 +15,6 @@ // OBS: This class needs to be public to be started from android.app.ActivityThread. public class AwMinidumpUploadJobService extends MinidumpUploadJobService { @Override - @SuppressWarnings("NoContextGetApplicationContext") - public void onCreate() { - super.onCreate(); - ServiceInit.init(getApplicationContext()); - } - - @Override protected MinidumpUploader createMinidumpUploader(PersistableBundle unusedExtras) { return new MinidumpUploaderImpl(new AwMinidumpUploaderDelegate()); }
diff --git a/android_webview/java/src/org/chromium/android_webview/services/AwVariationsSeedFetcher.java b/android_webview/java/src/org/chromium/android_webview/services/AwVariationsSeedFetcher.java index 53e9df3..38819cd 100644 --- a/android_webview/java/src/org/chromium/android_webview/services/AwVariationsSeedFetcher.java +++ b/android_webview/java/src/org/chromium/android_webview/services/AwVariationsSeedFetcher.java
@@ -154,10 +154,8 @@ } @Override - @SuppressWarnings("NoContextGetApplicationContext") public void onCreate() { super.onCreate(); - ServiceInit.init(getApplicationContext()); mSeedHolder = VariationsSeedHolder.getInstance(); }
diff --git a/android_webview/java/src/org/chromium/android_webview/services/CrashReceiverService.java b/android_webview/java/src/org/chromium/android_webview/services/CrashReceiverService.java index a9554550..143a11f 100644 --- a/android_webview/java/src/org/chromium/android_webview/services/CrashReceiverService.java +++ b/android_webview/java/src/org/chromium/android_webview/services/CrashReceiverService.java
@@ -35,13 +35,6 @@ private final Object mCopyingLock = new Object(); private boolean mIsCopying; - @Override - @SuppressWarnings("NoContextGetApplicationContext") - public void onCreate() { - super.onCreate(); - ServiceInit.init(getApplicationContext()); - } - private final ICrashReceiverService.Stub mBinder = new ICrashReceiverService.Stub() { @Override public void transmitCrashes(ParcelFileDescriptor[] fileDescriptors, List crashInfo) {
diff --git a/android_webview/java/src/org/chromium/android_webview/services/ServiceInit.java b/android_webview/java/src/org/chromium/android_webview/services/ServiceInit.java deleted file mode 100644 index a6f2926..0000000 --- a/android_webview/java/src/org/chromium/android_webview/services/ServiceInit.java +++ /dev/null
@@ -1,39 +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. - -package org.chromium.android_webview.services; - -import android.content.Context; - -import org.chromium.android_webview.command_line.CommandLineUtil; -import org.chromium.base.ContextUtils; -import org.chromium.base.PathUtils; -import org.chromium.base.ThreadUtils; -import org.chromium.base.VisibleForTesting; - -/** - * Does initialization common to all WebView services. - */ -@VisibleForTesting -public class ServiceInit { - private static boolean sInitDone; - - @VisibleForTesting - public static void setPrivateDataDirectorySuffix() { - // This is unrelated to the PathUtils directory set in WebView proper, because this code - // runs only in the service process. - PathUtils.setPrivateDataDirectorySuffix("webview"); - } - - public static void init(Context appContext) { - ThreadUtils.assertOnUiThread(); - if (sInitDone) return; - ContextUtils.initApplicationContext(appContext); - // In Monochrome, ChromeApplication.attachBaseContext() will set Chrome's command line. - // initCommandLine() overwrites this with WebView's command line. - CommandLineUtil.initCommandLine(); - setPrivateDataDirectorySuffix(); - sInitDone = true; - } -}
diff --git a/android_webview/java/src/org/chromium/android_webview/services/VariationsSeedServer.java b/android_webview/java/src/org/chromium/android_webview/services/VariationsSeedServer.java index bd9c059..e0f8877 100644 --- a/android_webview/java/src/org/chromium/android_webview/services/VariationsSeedServer.java +++ b/android_webview/java/src/org/chromium/android_webview/services/VariationsSeedServer.java
@@ -30,10 +30,8 @@ } @Override - @SuppressWarnings("NoContextGetApplicationContext") public void onCreate() { super.onCreate(); - ServiceInit.init(getApplicationContext()); mSeedHolder = VariationsSeedHolder.getInstance(); } }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwAutofillTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwAutofillTest.java index 34b21538..e4f4dc5e 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwAutofillTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwAutofillTest.java
@@ -42,6 +42,7 @@ import org.chromium.android_webview.AwContentsClient.AwWebResourceRequest; import org.chromium.android_webview.AwWebResourceResponse; import org.chromium.android_webview.test.AwActivityTestRule.TestDependencyFactory; +import org.chromium.autofill.mojom.SubmissionSource; import org.chromium.base.Log; import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.task.PostTask; @@ -50,7 +51,6 @@ import org.chromium.base.test.util.MetricsUtils; import org.chromium.base.test.util.MinAndroidSdkLevel; import org.chromium.components.autofill.AutofillProvider; -import org.chromium.components.autofill.SubmissionSource; import org.chromium.content_public.browser.UiThreadTaskTraits; import org.chromium.content_public.browser.test.util.DOMUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils;
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwVariationsSeedFetcherTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwVariationsSeedFetcherTest.java index 1b5ce4a..d0798836e 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwVariationsSeedFetcherTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwVariationsSeedFetcherTest.java
@@ -23,13 +23,11 @@ import org.chromium.android_webview.VariationsUtils; import org.chromium.android_webview.services.AwVariationsSeedFetcher; -import org.chromium.android_webview.services.ServiceInit; import org.chromium.android_webview.test.util.VariationsTestUtils; import org.chromium.base.ContextUtils; import org.chromium.base.test.util.CallbackHelper; import org.chromium.components.background_task_scheduler.TaskIds; import org.chromium.components.variations.firstrun.VariationsSeedFetcher; -import org.chromium.components.variations.firstrun.VariationsSeedFetcher.SeedInfo; import java.io.File; import java.io.IOException; @@ -124,7 +122,6 @@ @Before public void setUp() throws IOException { - ServiceInit.setPrivateDataDirectorySuffix(); AwVariationsSeedFetcher.setMocks(mScheduler, mDownloader); VariationsTestUtils.deleteSeeds(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerStartupTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerStartupTest.java index edafa43..591f74e 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerStartupTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerStartupTest.java
@@ -4,7 +4,6 @@ package org.chromium.android_webview.test; -import android.content.Context; import android.os.Looper; import android.support.test.InstrumentationRegistry; import android.support.test.filters.MediumTest; @@ -23,7 +22,6 @@ import org.chromium.android_webview.AwWebResourceResponse; import org.chromium.android_webview.test.util.CommonResources; import org.chromium.android_webview.test.util.CookieUtils; -import org.chromium.base.ContextUtils; import org.chromium.base.ThreadUtils; import org.chromium.base.test.util.Feature; import org.chromium.net.test.util.TestWebServer; @@ -56,10 +54,6 @@ // CookieManager assumes that native is loaded, but webview browser should not be loaded for // these tests as webview is not necessarily loaded when CookieManager is called. - Context appContext = InstrumentationRegistry.getInstrumentation() - .getTargetContext() - .getApplicationContext(); - ContextUtils.initApplicationContext(appContext); AwBrowserProcess.loadLibrary(null); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedHolderTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedHolderTest.java index 19a77665..931dbac 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedHolderTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedHolderTest.java
@@ -16,7 +16,6 @@ import org.junit.runner.RunWith; import org.chromium.android_webview.VariationsUtils; -import org.chromium.android_webview.services.ServiceInit; import org.chromium.android_webview.services.VariationsSeedHolder; import org.chromium.android_webview.test.util.VariationsTestUtils; import org.chromium.base.test.util.CallbackHelper; @@ -83,7 +82,6 @@ @Before public void setUp() throws IOException { - ServiceInit.setPrivateDataDirectorySuffix(); VariationsTestUtils.deleteSeeds(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedLoaderTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedLoaderTest.java index b53043b..4733a80 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedLoaderTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedLoaderTest.java
@@ -9,7 +9,6 @@ import android.content.Intent; import android.os.Handler; import android.os.Looper; -import android.support.test.InstrumentationRegistry; import android.support.test.filters.MediumTest; import org.junit.After; @@ -20,7 +19,6 @@ import org.chromium.android_webview.VariationsSeedLoader; import org.chromium.android_webview.VariationsUtils; -import org.chromium.android_webview.services.ServiceInit; import org.chromium.android_webview.test.services.MockVariationsSeedServer; import org.chromium.android_webview.test.util.VariationsTestUtils; import org.chromium.base.ContextUtils; @@ -108,10 +106,6 @@ @Before public void setUp() throws IOException { mMainHandler = new Handler(Looper.getMainLooper()); - ContextUtils.initApplicationContextForTests( - InstrumentationRegistry.getInstrumentation() - .getTargetContext().getApplicationContext()); - ServiceInit.setPrivateDataDirectorySuffix(); RecordHistogram.setDisabledForTests(true); VariationsTestUtils.deleteSeeds(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/services/CrashReceiverServiceTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/services/CrashReceiverServiceTest.java index fc8d7eca..c8820b8 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/services/CrashReceiverServiceTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/services/CrashReceiverServiceTest.java
@@ -7,18 +7,15 @@ import static org.chromium.android_webview.test.OnlyRunIn.ProcessMode.SINGLE_PROCESS; import android.os.ParcelFileDescriptor; -import android.support.test.InstrumentationRegistry; import android.support.test.filters.MediumTest; import org.junit.Assert; -import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.chromium.android_webview.services.CrashReceiverService; import org.chromium.android_webview.test.AwJUnit4ClassRunner; import org.chromium.android_webview.test.OnlyRunIn; -import org.chromium.base.ContextUtils; import java.io.File; import java.io.IOException; @@ -29,13 +26,6 @@ @RunWith(AwJUnit4ClassRunner.class) @OnlyRunIn(SINGLE_PROCESS) public class CrashReceiverServiceTest { - @Before - public void setUp() throws Exception { - ContextUtils.initApplicationContextForTests(InstrumentationRegistry.getInstrumentation() - .getTargetContext() - .getApplicationContext()); - } - /** * Ensure that the minidump copying doesn't trigger when we pass it invalid file descriptors. */
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/services/VariationsSeedServerTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/services/VariationsSeedServerTest.java index 20ef2cf..618a335 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/services/VariationsSeedServerTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/services/VariationsSeedServerTest.java
@@ -14,7 +14,6 @@ import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.RemoteException; -import android.support.test.InstrumentationRegistry; import android.support.test.filters.MediumTest; import org.junit.After; @@ -45,9 +44,6 @@ @Before public void setUp() throws IOException { - ContextUtils.initApplicationContextForTests( - InstrumentationRegistry.getInstrumentation().getTargetContext() - .getApplicationContext()); mTempFile = File.createTempFile("test_variations_seed", null); }
diff --git a/android_webview/test/BUILD.gn b/android_webview/test/BUILD.gn index c8205de..8cc98d2 100644 --- a/android_webview/test/BUILD.gn +++ b/android_webview/test/BUILD.gn
@@ -48,6 +48,7 @@ "//android_webview:android_webview_java", "//android_webview:locale_pak_assets", "//android_webview:platform_service_bridge_upstream_implementation_java", + "//android_webview/apk:apk_java", "//base:base_java", "//base:base_java_test_support", "//components/heap_profiling:heap_profiling_java_test_support",
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java index 0d97cef..5b67248b 100644 --- a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java +++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java
@@ -36,7 +36,6 @@ import org.chromium.android_webview.test.AwTestContainerView; import org.chromium.android_webview.test.NullContentsClient; import org.chromium.base.CommandLine; -import org.chromium.base.ContextUtils; import org.chromium.base.Log; import org.chromium.base.TraceEvent; import org.chromium.content_public.browser.NavigationController; @@ -70,9 +69,6 @@ AwShellResourceProvider.registerResources(this); - ((AwShellApplication) getApplication()).initCommandLine(); - - ContextUtils.initApplicationContext(getApplicationContext()); AwBrowserProcess.loadLibrary(null); if (CommandLine.getInstance().hasSwitch(AwShellSwitches.ENABLE_ATRACE)) {
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java index d31e658..bef1cd59 100644 --- a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java +++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java
@@ -4,17 +4,16 @@ package org.chromium.android_webview.shell; -import android.app.Application; +import com.android.webview.chromium.WebViewApkApplication; import org.chromium.base.CommandLine; /** * The android_webview shell Application subclass. */ -public class AwShellApplication extends Application { - public void initCommandLine() { - if (!CommandLine.isInitialized()) { - CommandLine.initFromFile("/data/local/tmp/android-webview-command-line"); - } +public class AwShellApplication extends WebViewApkApplication { + @Override + protected void initCommandLine() { + CommandLine.initFromFile("/data/local/tmp/android-webview-command-line"); } }
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestRunnerActivity.java b/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestRunnerActivity.java index b05115d..63923a7 100644 --- a/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestRunnerActivity.java +++ b/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestRunnerActivity.java
@@ -13,7 +13,6 @@ import org.chromium.android_webview.AwBrowserProcess; import org.chromium.android_webview.shell.AwShellResourceProvider; -import org.chromium.base.ContextUtils; import org.chromium.base.StrictModeContext; /** @@ -30,7 +29,6 @@ super.onCreate(savedInstanceState); AwShellResourceProvider.registerResources(this); - ContextUtils.initApplicationContext(getApplicationContext()); try (StrictModeContext ctx = StrictModeContext.allowDiskReads()) { AwBrowserProcess.loadLibrary(null); }
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/test/SecondBrowserProcess.java b/android_webview/test/shell/src/org/chromium/android_webview/test/SecondBrowserProcess.java index 8427b41..ead70b98 100644 --- a/android_webview/test/shell/src/org/chromium/android_webview/test/SecondBrowserProcess.java +++ b/android_webview/test/shell/src/org/chromium/android_webview/test/SecondBrowserProcess.java
@@ -14,8 +14,6 @@ import org.chromium.android_webview.AwBrowserProcess; import org.chromium.android_webview.AwResource; import org.chromium.android_webview.shell.R; -import org.chromium.base.CommandLine; -import org.chromium.base.ContextUtils; /** * This is a service for imitating a second browser process in the application. @@ -52,10 +50,8 @@ } private void startBrowserProcess() throws Exception { - CommandLine.initFromFile("/data/local/tmp/android-webview-command-line"); AwResource.setResources(this.getResources()); AwResource.setConfigKeySystemUuidMapping(R.array.config_key_system_uuid_mapping); - ContextUtils.initApplicationContext(getApplicationContext()); AwBrowserProcess.loadLibrary(null); AwBrowserProcess.start(); }
diff --git a/base/test/android/javatests/src/org/chromium/base/test/BaseJUnit4TestRule.java b/base/test/android/javatests/src/org/chromium/base/test/BaseJUnit4TestRule.java index 4e1dbc5..e949d645 100644 --- a/base/test/android/javatests/src/org/chromium/base/test/BaseJUnit4TestRule.java +++ b/base/test/android/javatests/src/org/chromium/base/test/BaseJUnit4TestRule.java
@@ -121,13 +121,19 @@ if (file.getName().equals("shared_prefs")) { continue; } - if (!FileUtils.recursivelyDeleteFile(file)) { + if (file.isDirectory() + && (file.getName().startsWith("app_") || file.getName().equals("cache"))) { + // Directories are lazily created by PathUtils only once, and so can be cleared but + // not removed. + for (File subFile : file.listFiles()) { + if (!FileUtils.recursivelyDeleteFile(subFile)) { + throw new RuntimeException( + "Could not delete file: " + subFile.getAbsolutePath()); + } + } + } else if (!FileUtils.recursivelyDeleteFile(file)) { throw new RuntimeException("Could not delete file: " + file.getAbsolutePath()); } } - // We have to make sure the cache directory still exists, as the framework - // will try to create it otherwise and will fail for sandbox processes with - // a NullPointerException. - new File(dataDir, "cache").mkdir(); } }
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index db5e758c..b6020882 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -8910103654519288896 \ No newline at end of file +8910045712989608480 \ No newline at end of file
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 2223a2e1..fb54e78 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -8910103645053847664 \ No newline at end of file +8910048030561267904 \ No newline at end of file
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index fa06b7cbb..7b103c2 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -1552,12 +1552,6 @@ ] } -# Unwind tables are added to only official builds (public_apk(s)) so that -# developer builds are not affected. -_add_unwind_tables_in_chrome_32bit_apk = - is_android && !is_component_build && is_official_build && - (target_cpu == "arm" || target_cpu == "arm64") - # Defines a target that derives from the chrome public application. This # can be either an APK or an app bundle module. This supports both the # chrome_public_xxx targets (for Android J-K) and chrome_modern_public_xxx @@ -1601,11 +1595,6 @@ } shared_libraries = [ ":libchrome" ] - add_unwind_tables_in_apk = - _add_unwind_tables_in_chrome_32bit_apk && target_cpu == "arm" - if (add_unwind_tables_in_apk) { - shared_library_for_unwind_asset = "chrome" - } # Android supports webp transparent resources properly since API level 18, # so this can only be activated for modern ones (which target API >= 21). @@ -1757,12 +1746,6 @@ "//android_webview:platform_service_bridge_upstream_implementation_java", ] } - - _needs_arm32_lib = target_cpu == "arm" || - (target_cpu == "arm64" && build_apk_secondary_abi) - add_unwind_tables_in_apk = - _add_unwind_tables_in_chrome_32bit_apk && _needs_arm32_lib && - (!defined(use_trichrome_library) || !use_trichrome_library) } } @@ -1919,11 +1902,7 @@ testonly = true target_type = "instrumentation_test_apk" - add_unwind_tables_in_apk = - _add_unwind_tables_in_chrome_32bit_apk && target_cpu == "arm" - if (add_unwind_tables_in_apk) { - shared_library_for_unwind_asset = "chromefortest" - } + shared_library_for_unwind_asset = "chromefortest" deps = _chrome_public_shared_deps + invoker.deps + [ ":chrome_apk_pak_assets",
diff --git a/chrome/android/chrome_public_apk_tmpl.gni b/chrome/android/chrome_public_apk_tmpl.gni index 9cc31d00..4d4e09a 100644 --- a/chrome/android/chrome_public_apk_tmpl.gni +++ b/chrome/android/chrome_public_apk_tmpl.gni
@@ -30,6 +30,14 @@ "notouch_build=$notouch_build", ] +# Enable stack unwinding only on official build with specific channels. It is +# not enabled on non-official builds to not affect build time for developers. +# The unwind file is ~2MB in apk, which is fine for Canary. +_add_unwind_tables_in_chrome_32bit_apk = + is_official_build && (target_cpu == "arm" || target_cpu == "arm64") && + (android_channel == "default" || android_channel == "canary" || + android_channel == "dev") + # A template used to declare any target that will implement a full Chromium # or Chrome application, either as an APK, or an app bundle module. # @@ -64,33 +72,51 @@ # android_app_bundle_module(), depending on the target type. # template("chrome_public_common_apk_or_module_tmpl") { - assert(defined(invoker.target_type), "target_type is required!") assert( invoker.target_type == "android_apk" || invoker.target_type == "android_app_bundle_module" || invoker.target_type == "instrumentation_test_apk", "Invalid target_type definition, should be 'android_apk' or 'android_app_bundle_module'") - assert(!(defined(invoker.is_trichrome) && invoker.is_trichrome) || - !(defined(invoker.is_monochrome) && invoker.is_monochrome), + + _is_modern = defined(invoker.is_modern) && invoker.is_modern + _is_monochrome = defined(invoker.is_monochrome) && invoker.is_monochrome + _is_trichrome = defined(invoker.is_trichrome) && invoker.is_trichrome + assert(_is_modern || !_is_modern) # Mark as used. + assert(!(_is_monochrome && _is_trichrome), "Cannot be both trichrome and monochrome!") # Adds unwind table asset to the chrome apk for the given library target. This # is not part of generic apk assets target since it depends on the main shared # library of the apk, to extract unwind tables. - if (defined(invoker.add_unwind_tables_in_apk) && - invoker.add_unwind_tables_in_apk) { - _unwind_asset = "${target_name}_unwind_assets" - unwind_table_asset(_unwind_asset) { + if (defined(invoker.add_unwind_tables_in_apk)) { + _add_unwind_tables = invoker.add_unwind_tables_in_apk + } else { + _needs_32bit_lib = + target_cpu == "arm" || + (_is_monochrome && target_cpu == "arm64" && build_apk_secondary_abi) + _add_unwind_tables = + _needs_32bit_lib && _add_unwind_tables_in_chrome_32bit_apk + } + + if (_add_unwind_tables) { + _unwind_asset_target = "${target_name}__unwind_assets" + unwind_table_asset(_unwind_asset_target) { if (defined(invoker.testonly)) { testonly = invoker.testonly } - library_target = invoker.shared_library_for_unwind_asset + if (defined(invoker.shared_library_for_unwind_asset)) { + library_target = invoker.shared_library_for_unwind_asset + } else { + library_target = "chrome" + } deps = invoker.shared_libraries if (build_apk_secondary_abi && defined(android_secondary_abi_cpu)) { deps += [ "//chrome/android:lib${library_target}($android_secondary_abi_toolchain)" ] } } + } else if (defined(invoker.shared_library_for_unwind_asset)) { + not_needed(invoker, [ "shared_library_for_unwind_asset" ]) } if (!defined(invoker.target_type)) { @@ -99,13 +125,6 @@ _target_type = invoker.target_type } - _is_modern = defined(invoker.is_modern) && invoker.is_modern - assert(_is_modern || !_is_modern) # Mark as used. - - _is_monochrome = defined(invoker.is_monochrome) && invoker.is_monochrome - _is_trichrome = defined(invoker.is_trichrome) && invoker.is_trichrome - assert(_is_trichrome || !_is_trichrome) # Mark as used. - if (defined(invoker.enable_multidex)) { _enable_multidex = invoker.enable_multidex } else { @@ -251,9 +270,8 @@ "//chrome/android:product_version_resources" } - if (defined(invoker.add_unwind_tables_in_apk) && - invoker.add_unwind_tables_in_apk) { - deps += [ ":$_unwind_asset" ] + if (defined(_unwind_asset_target)) { + deps += [ ":$_unwind_asset_target" ] } deps += [ "//chrome/android:chrome_all_java" ] @@ -323,9 +341,7 @@ } else { shared_libraries = [ "//chrome/android:libmonochrome" ] } - if (invoker.add_unwind_tables_in_apk) { - shared_library_for_unwind_asset = "monochrome" - } + shared_library_for_unwind_asset = "monochrome" _deps += [ "//android_webview:monochrome_webview_assets",
diff --git a/chrome/android/features/autofill_assistant/BUILD.gn b/chrome/android/features/autofill_assistant/BUILD.gn index 6f17ceb..5448947 100644 --- a/chrome/android/features/autofill_assistant/BUILD.gn +++ b/chrome/android/features/autofill_assistant/BUILD.gn
@@ -159,6 +159,7 @@ "javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionsCarouselUiTest.java", "javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDetailsUiTest.java", "javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInfoBoxUiTest.java", + "javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayUiTest.java", "javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPaymentRequestTestHelper.java", "javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPaymentRequestUiTest.java", "javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTestUtil.java", @@ -185,6 +186,10 @@ "//third_party/mockito:mockito_java", "//ui/android:ui_full_java", ] + + data = [ + "//components/test/data/autofill_assistant/", + ] } android_resources("java_resources") {
diff --git a/chrome/android/features/autofill_assistant/javatests/DEPS b/chrome/android/features/autofill_assistant/javatests/DEPS index 4455294..c3de06b 100644 --- a/chrome/android/features/autofill_assistant/javatests/DEPS +++ b/chrome/android/features/autofill_assistant/javatests/DEPS
@@ -1,3 +1,4 @@ include_rules = [ "+chrome/lib/image_fetcher", + "+content/public/android/java/src/org/chromium/content_public/browser", ]
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayUiTest.java new file mode 100644 index 0000000..89926b4 --- /dev/null +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayUiTest.java
@@ -0,0 +1,310 @@ +// 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. + +package org.chromium.chrome.browser.autofill_assistant; + +import static android.support.test.espresso.Espresso.onView; +import static android.support.test.espresso.assertion.ViewAssertions.matches; +import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; +import static android.support.test.espresso.matcher.ViewMatchers.isRoot; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.not; + +import static org.chromium.content_public.browser.test.util.TestThreadUtils.runOnUiThreadBlocking; + +import android.graphics.Rect; +import android.graphics.RectF; +import android.support.test.InstrumentationRegistry; +import android.support.test.filters.MediumTest; +import android.util.DisplayMetrics; + +import org.json.JSONArray; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.chromium.base.test.util.CommandLineFlags; +import org.chromium.chrome.browser.ChromeSwitches; +import org.chromium.chrome.browser.autofill_assistant.overlay.AssistantOverlayCoordinator; +import org.chromium.chrome.browser.autofill_assistant.overlay.AssistantOverlayModel; +import org.chromium.chrome.browser.autofill_assistant.overlay.AssistantOverlayState; +import org.chromium.chrome.browser.customtabs.CustomTabActivity; +import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; +import org.chromium.chrome.browser.customtabs.CustomTabsTestUtils; +import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.content_public.browser.WebContents; +import org.chromium.content_public.browser.test.util.TestCallbackHelperContainer; +import org.chromium.content_public.browser.test.util.TestTouchUtils; +import org.chromium.net.test.EmbeddedTestServer; + +import java.util.Collections; +import java.util.concurrent.ExecutionException; + +/** + * Tests for the Autofill Assistant overlay. + */ +@RunWith(ChromeJUnit4ClassRunner.class) +@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) +public class AutofillAssistantOverlayUiTest { + // TODO(crbug.com/806868): Create a more specific test site for overlay testing. + private static final String TEST_PAGE = + "/components/test/data/autofill_assistant/autofill_assistant_target_website.html"; + + private EmbeddedTestServer mTestServer; + + @Rule + public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule(); + + @Before + public void setUp() throws Exception { + mTestServer = EmbeddedTestServer.createAndStartServer( + InstrumentationRegistry.getTargetContext().getApplicationContext()); + String testPage = mTestServer.getURL(TEST_PAGE); + mCustomTabActivityTestRule.startCustomTabActivityWithIntent( + CustomTabsTestUtils.createMinimalCustomTabIntent( + InstrumentationRegistry.getTargetContext(), testPage)); + mCustomTabActivityTestRule.getActivity().getScrim().disableAnimationForTesting(true); + } + + @After + public void tearDown() throws Exception { + mTestServer.stopAndDestroyServer(); + } + + private CustomTabActivity getActivity() { + return mCustomTabActivityTestRule.getActivity(); + } + + private WebContents getWebContents() { + return mCustomTabActivityTestRule.getWebContents(); + } + + /** Creates a coordinator for use in UI tests. */ + private AssistantOverlayCoordinator createCoordinator(AssistantOverlayModel model) + throws ExecutionException { + return runOnUiThreadBlocking(() -> new AssistantOverlayCoordinator(getActivity(), model)); + } + + /** Tests assumptions about the initial state of the infobox. */ + @Test + @MediumTest + public void testInitialState() throws Exception { + AssistantOverlayModel model = new AssistantOverlayModel(); + AssistantOverlayCoordinator coordinator = createCoordinator(model); + + assertScrimDisplayed(false); + tapElement("touch_area_one"); + assertThat(checkElementExists("touch_area_one"), is(false)); + } + + /** Tests assumptions about the full overlay. */ + @Test + @MediumTest + public void testFullOverlay() throws Exception { + AssistantOverlayModel model = new AssistantOverlayModel(); + AssistantOverlayCoordinator coordinator = createCoordinator(model); + + runOnUiThreadBlocking( + () -> model.set(AssistantOverlayModel.STATE, AssistantOverlayState.FULL)); + assertScrimDisplayed(true); + tapElement("touch_area_one"); + assertThat(checkElementExists("touch_area_one"), is(true)); + + runOnUiThreadBlocking( + () -> model.set(AssistantOverlayModel.STATE, AssistantOverlayState.HIDDEN)); + assertScrimDisplayed(false); + tapElement("touch_area_one"); + assertThat(checkElementExists("touch_area_one"), is(false)); + } + + /** Tests assumptions about the partial overlay. */ + @Test + @MediumTest + public void testPartialOverlay() throws Exception { + AssistantOverlayModel model = new AssistantOverlayModel(); + AssistantOverlayCoordinator coordinator = createCoordinator(model); + + // Partial overlay, no touchable areas: equivalent to full overlay. + runOnUiThreadBlocking( + () -> model.set(AssistantOverlayModel.STATE, AssistantOverlayState.PARTIAL)); + assertScrimDisplayed(true); + tapElement("touch_area_one"); + assertThat(checkElementExists("touch_area_one"), is(true)); + + Rect rect = getBoundingRectForElement("touch_area_one"); + runOnUiThreadBlocking(() + -> model.set(AssistantOverlayModel.TOUCHABLE_AREA, + Collections.singletonList(new RectF(rect)))); + + // Touchable area set, but no viewport given: equivalent to full overlay. + tapElement("touch_area_one"); + assertThat(checkElementExists("touch_area_one"), is(true)); + + // Set viewport. + Rect viewport = getViewport(); + runOnUiThreadBlocking( + () -> model.set(AssistantOverlayModel.VISUAL_VIEWPORT, new RectF(viewport))); + + // Now the partial overlay allows tapping the highlighted touch area. + tapElement("touch_area_one"); + assertThat(checkElementExists("touch_area_one"), is(false)); + + runOnUiThreadBlocking( + () -> model.set(AssistantOverlayModel.TOUCHABLE_AREA, Collections.emptyList())); + tapElement("touch_area_three"); + assertThat(checkElementExists("touch_area_three"), is(true)); + } + + /** Scrolls a touchable area into view and then taps it. */ + @Test + @MediumTest + public void testSimpleScrollPartialOverlay() throws Exception { + AssistantOverlayModel model = new AssistantOverlayModel(); + AssistantOverlayCoordinator coordinator = createCoordinator(model); + + Rect rect = getBoundingRectForElement("touch_area_two"); + Rect viewport = getViewport(); + runOnUiThreadBlocking(() -> { + model.set(AssistantOverlayModel.STATE, AssistantOverlayState.PARTIAL); + model.set(AssistantOverlayModel.TOUCHABLE_AREA, + Collections.singletonList(new RectF(rect))); + model.set(AssistantOverlayModel.VISUAL_VIEWPORT, new RectF(viewport)); + }); + scrollIntoViewIfNeeded("touch_area_two"); + Rect newViewport = getViewport(); + runOnUiThreadBlocking( + () -> model.set(AssistantOverlayModel.VISUAL_VIEWPORT, new RectF(newViewport))); + tapElement("touch_area_two"); + assertThat(checkElementExists("touch_area_two"), is(false)); + } + + private void assertScrimDisplayed(boolean expected) throws Exception { + // Wait for UI thread to be idle. + onView(isRoot()).check(matches(isDisplayed())); + + // The scrim view is only attached to the view hierarchy when needed, preventing us from + // using regular espresso facilities. + boolean scrimInHierarchy = + runOnUiThreadBlocking(() -> getActivity().getScrim().getParent() != null); + if (expected && !scrimInHierarchy) { + throw new Exception("Expected scrim view visible, but scrim was not in view hierarchy"); + } + if (scrimInHierarchy) { + if (expected) { + onView(is(getActivity().getScrim())).check(matches(isDisplayed())); + } else { + onView(is(getActivity().getScrim())).check(matches(not(isDisplayed()))); + } + } + } + + /** Performs a single tap on the center of the specified element. */ + private void tapElement(String elementId) throws Exception { + Rect coords = getAbsoluteBoundingRect(elementId); + float x = coords.left + 0.5f * (coords.right - coords.left); + float y = coords.top + 0.5f * (coords.bottom - coords.top); + + // Sanity check, can only click on coordinates on screen. + DisplayMetrics displayMetrics = getActivity().getResources().getDisplayMetrics(); + if (x < 0 || x > displayMetrics.widthPixels || y < 0 || y > displayMetrics.heightPixels) { + throw new IllegalArgumentException(elementId + " not on screen: tried to tap x=" + x + + ", y=" + y + ", which is outside of display with w=" + + displayMetrics.widthPixels + ", h=" + displayMetrics.heightPixels); + } + TestTouchUtils.singleClick(InstrumentationRegistry.getInstrumentation(), x, y); + } + + /** Computes the bounding rectangle of the specified DOM element in absolute screen space. */ + private Rect getAbsoluteBoundingRect(String elementId) throws Exception { + // Get bounding rectangle in viewport space. + Rect elementRect = getBoundingRectForElement(elementId); + + /* + * Conversion from viewport space to screen space is done in two steps: + * - First, convert viewport to compositor space (scrolling offset, multiply with factor). + * - Then, convert compositor space to screen space (add content offset). + */ + Rect viewport = getViewport(); + float cssToPysicalPixels = (((float) getActivity().getCompositorViewHolder().getWidth() + / (float) viewport.width())); + + int[] compositorLocation = new int[2]; + getActivity().getCompositorViewHolder().getLocationOnScreen(compositorLocation); + int offsetY = + compositorLocation[1] + getActivity().getFullscreenManager().getContentOffset(); + return new Rect((int) ((elementRect.left - viewport.left) * cssToPysicalPixels), + (int) ((elementRect.top - viewport.top) * cssToPysicalPixels + offsetY), + (int) ((elementRect.right - viewport.left) * cssToPysicalPixels), + (int) ((elementRect.bottom - viewport.top) * cssToPysicalPixels + offsetY)); + } + + /** + * Retrieves the bounding rectangle for the specified element in the DOM tree in CSS pixel + * coordinates. + */ + private Rect getBoundingRectForElement(String elementId) throws Exception { + if (!checkElementExists(elementId)) { + throw new IllegalArgumentException(elementId + " does not exist"); + } + TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper javascriptHelper = + new TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper(); + javascriptHelper.evaluateJavaScriptForTests(getWebContents(), + "(function() {" + + " rect = document.getElementById('" + elementId + + "').getBoundingClientRect();" + + " return [window.scrollX + rect.left, window.scrollY + rect.top, " + + " window.scrollX + rect.right, window.scrollY + rect.bottom];" + + "})()"); + javascriptHelper.waitUntilHasValue(); + JSONArray rectJson = new JSONArray(javascriptHelper.getJsonResultAndClear()); + return new Rect( + rectJson.getInt(0), rectJson.getInt(1), rectJson.getInt(2), rectJson.getInt(3)); + } + + /** Checks whether the specified element exists in the DOM tree. */ + private boolean checkElementExists(String elementId) throws Exception { + TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper javascriptHelper = + new TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper(); + javascriptHelper.evaluateJavaScriptForTests(getWebContents(), + "(function() {" + + " return [document.getElementById('" + elementId + "') != null]; " + + "})()"); + javascriptHelper.waitUntilHasValue(); + JSONArray result = new JSONArray(javascriptHelper.getJsonResultAndClear()); + return result.getBoolean(0); + } + + /** + * Retrieves the visual viewport of the webpage in CSS pixel coordinates. + */ + private Rect getViewport() throws Exception { + TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper javascriptHelper = + new TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper(); + javascriptHelper.evaluateJavaScriptForTests(getWebContents(), + "(function() {" + + " const v = window.visualViewport;" + + " return [v.pageLeft, v.pageTop, v.width, v.height]" + + "})()"); + javascriptHelper.waitUntilHasValue(); + JSONArray values = new JSONArray(javascriptHelper.getJsonResultAndClear()); + return new Rect(values.getInt(0), values.getInt(1), values.getInt(2), values.getInt(3)); + } + + /** + * Scrolls to the specified element on the webpage, if necessary. + */ + private void scrollIntoViewIfNeeded(String elementId) throws Exception { + TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper javascriptHelper = + new TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper(); + javascriptHelper.evaluateJavaScriptForTests(getWebContents(), + "(function() {" + elementId + ".scrollIntoViewIfNeeded();" + + " return true;" + + "})()"); + javascriptHelper.waitUntilHasValue(); + } +}
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogCoordinator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogCoordinator.java index 07a60dd..09ee3e6 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogCoordinator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogCoordinator.java
@@ -66,7 +66,9 @@ TabListRecyclerView recyclerView = mTabListCoordinator.getContainerView(); mToolbarCoordinator = new TabGridSheetToolbarCoordinator( mContext, recyclerView, mToolbarPropertyModel, mParentLayout); + mMediator.onReset(tabs.get(0).getId()); } else { + mMediator.onReset(null); if (mToolbarCoordinator != null) { mToolbarCoordinator.destroy(); } @@ -80,6 +82,5 @@ public void resetWithListOfTabs(@Nullable List<Tab> tabs) { mTabListCoordinator.resetWithListOfTabs(tabs); updateDialogContent(tabs); - mMediator.onReset(tabs == null ? null : tabs.get(0).getId()); } }
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java index f2f907f..fda2c71 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java
@@ -88,8 +88,8 @@ mTabModelObserver = new EmptyTabModelObserver() { @Override public void didAddTab(Tab tab, @TabLaunchType int type) { - updateDialog(); - updateGridTabSwitcher(); + mModel.set(TabGridSheetProperties.ANIMATION_SOURCE_RECT, null); + mDialogResetHandler.resetWithListOfTabs(null); } @Override @@ -103,7 +103,7 @@ if (type == TabSelectionType.FROM_USER) { // Cancel the zooming into tab grid card animation. mModel.set(TabGridSheetProperties.ANIMATION_SOURCE_RECT, null); - mModel.set(TabGridSheetProperties.IS_DIALOG_VISIBLE, false); + mDialogResetHandler.resetWithListOfTabs(null); } } @@ -190,7 +190,7 @@ ScrimView.ScrimObserver scrimObserver = new ScrimView.ScrimObserver() { @Override public void onScrimClick() { - mModel.set(TabGridSheetProperties.IS_DIALOG_VISIBLE, false); + mDialogResetHandler.resetWithListOfTabs(null); } @Override public void onScrimVisibilityChanged(boolean visible) {} @@ -200,14 +200,14 @@ private View.OnClickListener getCollapseButtonClickListener() { return view -> { - mModel.set(TabGridSheetProperties.IS_DIALOG_VISIBLE, false); + mDialogResetHandler.resetWithListOfTabs(null); }; } private View.OnClickListener getAddButtonClickListener() { return view -> { mModel.set(TabGridSheetProperties.ANIMATION_SOURCE_RECT, null); - mModel.set(TabGridSheetProperties.IS_DIALOG_VISIBLE, false); + mDialogResetHandler.resetWithListOfTabs(null); Tab currentTab = mTabModelSelector.getTabById(mCurrentTabId); List<Tab> relatedTabs = getRelatedTabs(currentTab.getId());
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/ChromeSigninManagerDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/ChromeSigninManagerDelegate.java index 133700ef..107e5fb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/ChromeSigninManagerDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/ChromeSigninManagerDelegate.java
@@ -60,9 +60,9 @@ @Override public void fetchAndApplyCloudPolicy(@JCaller SigninManager signinManager, - long nativeSigninManagerAndroid, String username) { + long nativeSigninManagerAndroid, String username, Runnable callback) { SigninManagerJni.get().fetchAndApplyCloudPolicy( - signinManager, nativeSigninManagerAndroid, username); + signinManager, nativeSigninManagerAndroid, username, callback); } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java index c02df423..35211da6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java
@@ -441,12 +441,10 @@ } Log.d(TAG, "Checking if account has policy management enabled"); - // This will call back to onPolicyFetchedBeforeSignIn. - mDelegate.fetchAndApplyCloudPolicy( - this, mNativeSigninManagerAndroid, mSignInState.mAccount.name); + mDelegate.fetchAndApplyCloudPolicy(this, mNativeSigninManagerAndroid, + mSignInState.mAccount.name, this::onPolicyFetchedBeforeSignIn); } - @CalledByNative @VisibleForTesting /** * If the user is managed, its policy has been fetched and is being enforced; features like sync @@ -708,8 +706,8 @@ boolean isForceSigninEnabled(@JCaller SigninManager self, long nativeSigninManagerAndroid); - void fetchAndApplyCloudPolicy( - @JCaller SigninManager self, long nativeSigninManagerAndroid, String username); + void fetchAndApplyCloudPolicy(@JCaller SigninManager self, long nativeSigninManagerAndroid, + String username, Runnable callback); void abortSignIn(@JCaller SigninManager self, long nativeSigninManagerAndroid);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManagerDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManagerDelegate.java index e2bd40c..30c943e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManagerDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManagerDelegate.java
@@ -49,14 +49,17 @@ long nativeSigninManagerAndroid, String email, final Callback<Boolean> callback); /** - * Interact with the UserPolicySigninService to retrieve the user policy. + * Interact with the UserPolicySigninService to retrieve the user policy if necessary. * @param signinManager a reference on SigninManager used for the native calls * @param nativeSigninManagerAndroid a reference on the native SigninManager used for native * calls - * @param username (email) of the user signing in. + * @param username (email) of the account signing in. + * @param callback The callback called once the policy is retrieved and applied. This is always + * called, even if the user is not managed and no policy was retrieved or + * applied. */ - public void fetchAndApplyCloudPolicy( - @JCaller SigninManager signinManager, long nativeSigninManagerAndroid, String username); + public void fetchAndApplyCloudPolicy(@JCaller SigninManager signinManager, + long nativeSigninManagerAndroid, String username, Runnable callback); /** * Perform the required cloud policy cleanup when a signin is aborted.
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/signin/SigninManagerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/signin/SigninManagerTest.java index 17d82b9..2fae733 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/signin/SigninManagerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/signin/SigninManagerTest.java
@@ -191,7 +191,7 @@ doReturn(true).when(mAccountTrackerService).checkAndSeedSystemAccounts(); // Request that policy is loaded. It will pause sign-in until onPolicyCheckedBeforeSignIn is // invoked. - doNothing().when(mDelegateMock).fetchAndApplyCloudPolicy(any(), anyLong(), any()); + doNothing().when(mDelegateMock).fetchAndApplyCloudPolicy(any(), anyLong(), any(), any()); doReturn(true).when(mSigninManager).isSigninSupported(); doNothing().when(mNativeMock).onSignInCompleted(any(), anyLong(), any());
diff --git a/chrome/browser/android/signin/DEPS b/chrome/browser/android/signin/DEPS new file mode 100644 index 0000000..5f78a7f --- /dev/null +++ b/chrome/browser/android/signin/DEPS
@@ -0,0 +1,8 @@ +specific_include_rules = { + # Exception while there's no solution for the fact that SetPrimaryAccount() + # expects an account ID (which on Android is the Gaia ID), but we receive an + # email address instead along with SigninManagerAndroid::OnSignInCompleted(). + "signin_manager_android\.cc": [ + "+components/signin/core/browser/primary_account_manager.h", + ], +}
diff --git a/chrome/browser/android/signin/signin_manager_android.cc b/chrome/browser/android/signin/signin_manager_android.cc index f599078..ed022b69 100644 --- a/chrome/browser/android/signin/signin_manager_android.cc +++ b/chrome/browser/android/signin/signin_manager_android.cc
@@ -30,6 +30,7 @@ #include "components/policy/core/common/cloud/cloud_policy_store.h" #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" #include "components/prefs/pref_service.h" +#include "components/signin/core/browser/primary_account_manager.h" #include "components/signin/core/browser/signin_pref_names.h" #include "content/public/browser/browsing_data_filter_builder.h" #include "content/public/browser/browsing_data_remover.h" @@ -243,7 +244,8 @@ void SigninManagerAndroid::FetchAndApplyCloudPolicy( JNIEnv* env, const JavaParamRef<jobject>& obj, - const JavaParamRef<jstring>& j_username) { + const JavaParamRef<jstring>& j_username, + const base::android::JavaParamRef<jobject>& j_callback) { std::string username = base::android::ConvertJavaStringToUTF8(env, j_username); DCHECK(!username.empty()); @@ -256,25 +258,32 @@ ->FindAccountInfoForAccountWithRefreshTokenByEmailAddress(username) .value(); + auto callback = + base::BindOnce(base::android::RunRunnableAndroid, + base::android::ScopedJavaGlobalRef<jobject>(j_callback)); + RegisterPolicyWithAccount( - account, base::BindOnce(&SigninManagerAndroid::OnPolicyRegisterDone, - weak_factory_.GetWeakPtr(), account)); + account, + base::BindOnce(&SigninManagerAndroid::OnPolicyRegisterDone, + weak_factory_.GetWeakPtr(), account, std::move(callback))); } void SigninManagerAndroid::OnPolicyRegisterDone( const CoreAccountInfo& account, + base::OnceClosure policy_callback, const base::Optional<ManagementCredentials>& credentials) { if (credentials) { - FetchPolicyBeforeSignIn(account, credentials.value()); + FetchPolicyBeforeSignIn(account, std::move(policy_callback), + credentials.value()); } else { // User's account does not have a policy to fetch. - JNIEnv* env = base::android::AttachCurrentThread(); - Java_SigninManager_onPolicyFetchedBeforeSignIn(env, java_signin_manager_); + std::move(policy_callback).Run(); } } void SigninManagerAndroid::FetchPolicyBeforeSignIn( const CoreAccountInfo& account, + base::OnceClosure policy_callback, const ManagementCredentials& credentials) { policy::UserPolicySigninService* service = policy::UserPolicySigninServiceFactory::GetForProfile(profile_); @@ -284,13 +293,10 @@ service->FetchPolicyForSignedInUser( AccountIdFromAccountInfo(account), credentials.dm_token, credentials.client_id, url_loader_factory, - base::Bind(&SigninManagerAndroid::OnPolicyFetchDone, - weak_factory_.GetWeakPtr())); -} - -void SigninManagerAndroid::OnPolicyFetchDone(bool success) const { - Java_SigninManager_onPolicyFetchedBeforeSignIn( - base::android::AttachCurrentThread(), java_signin_manager_); + base::AdaptCallbackForRepeating( + base::BindOnce([](base::OnceClosure callback, + bool success) { std::move(callback).Run(); }, + std::move(policy_callback)))); } void SigninManagerAndroid::ClearLastSignedInUser(
diff --git a/chrome/browser/android/signin/signin_manager_android.h b/chrome/browser/android/signin/signin_manager_android.h index bb16d31..5770c2b3 100644 --- a/chrome/browser/android/signin/signin_manager_android.h +++ b/chrome/browser/android/signin/signin_manager_android.h
@@ -34,7 +34,8 @@ void FetchAndApplyCloudPolicy( JNIEnv* env, const base::android::JavaParamRef<jobject>& obj, - const base::android::JavaParamRef<jstring>& username); + const base::android::JavaParamRef<jstring>& username, + const base::android::JavaParamRef<jobject>& j_callback); void AbortSignIn(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); @@ -115,13 +116,13 @@ void OnPolicyRegisterDone( const CoreAccountInfo& account_id, + base::OnceClosure policy_callback, const base::Optional<ManagementCredentials>& credentials); void FetchPolicyBeforeSignIn(const CoreAccountInfo& account_id, + base::OnceClosure policy_callback, const ManagementCredentials& credentials); - void OnPolicyFetchDone(bool success) const; - void OnBrowsingDataRemoverDone(); void OnSigninAllowedPrefChanged();
diff --git a/chrome/browser/autofill/autofill_provider_browsertest.cc b/chrome/browser/autofill/autofill_provider_browsertest.cc index 41c47a1..35b20b2 100644 --- a/chrome/browser/autofill/autofill_provider_browsertest.cc +++ b/chrome/browser/autofill/autofill_provider_browsertest.cc
@@ -15,7 +15,7 @@ #include "components/autofill/core/browser/test_autofill_provider.h" #include "components/autofill/core/common/autofill_features.h" #include "components/autofill/core/common/form_data.h" -#include "components/autofill/core/common/submission_source.h" +#include "components/autofill/core/common/mojom/autofill_types.mojom.h" #include "content/public/browser/web_contents.h" #include "content/public/common/url_constants.h" #include "content/public/test/browser_test_utils.h" @@ -29,6 +29,9 @@ using ::testing::Invoke; namespace autofill { + +using mojom::SubmissionSource; + namespace { class MockAutofillProvider : public TestAutofillProvider {
diff --git a/chrome/browser/background_sync/OWNERS b/chrome/browser/background_sync/OWNERS index 9d607b2..f393583 100644 --- a/chrome/browser/background_sync/OWNERS +++ b/chrome/browser/background_sync/OWNERS
@@ -1,6 +1,8 @@ iclelland@chromium.org jkarlin@chromium.org +nator@chromium.org peter@chromium.org +rayankans@chromium.org per-file *permission_context*=file://chrome/browser/permissions/PERMISSIONS_OWNERS
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 38c1fde8..d37847a 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -2776,7 +2776,6 @@ "//chrome/browser/ui", "//chrome/browser/ui:ash_test_support", "//chrome/browser/web_applications/components", - "//chrome/browser/web_applications/components:test_support", "//chrome/common", "//chrome/services/wilco_dtc_supportd/public/mojom", "//chrome/test:test_support",
diff --git a/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl_unittest.cc b/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl_unittest.cc index 623526c..6c0b8da3 100644 --- a/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl_unittest.cc +++ b/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl_unittest.cc
@@ -20,8 +20,8 @@ #include "base/test/metrics/histogram_tester.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/web_applications/components/install_options.h" -#include "chrome/browser/web_applications/components/test_pending_app_manager.h" #include "chrome/browser/web_applications/components/web_app_constants.h" +#include "chrome/browser/web_applications/test/test_pending_app_manager.h" #include "chrome/test/base/testing_profile.h" #include "components/content_settings/core/browser/host_content_settings_map.h" #include "content/public/test/test_browser_thread_bundle.h"
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc index ec966f7..45e19d8 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
@@ -1064,6 +1064,13 @@ FilesAppBrowserTest, ::testing::Values(TestCase("breadcrumbsNavigate"))); +WRAPPED_INSTANTIATE_TEST_SUITE_P( + FormatDialog, /* format_dialog.js */ + FilesAppBrowserTest, + ::testing::Values(TestCase("formatDialog").EnableFormatDialog(), + TestCase("formatDialogEmpty").EnableFormatDialog(), + TestCase("formatDialogCancel").EnableFormatDialog())); + // Structure to describe an account info. struct TestAccountInfo { const char* const gaia_id;
diff --git a/chrome/browser/chromeos/file_manager/file_manager_string_util.cc b/chrome/browser/chromeos/file_manager/file_manager_string_util.cc index f01700c..283b9cd 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_string_util.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_string_util.cc
@@ -539,6 +539,16 @@ IDS_RENAMING_OF_DEVICE_FAILED_TITLE); SET_STRING("FORMAT_DEVICE_BUTTON_LABEL", IDS_FILE_BROWSER_FORMAT_DEVICE_BUTTON_LABEL); + SET_STRING("FORMAT_DIALOG_TITLE", IDS_FILE_BROWSER_FORMAT_DIALOG_TITLE); + SET_STRING("FORMAT_DIALOG_MESSAGE", IDS_FILE_BROWSER_FORMAT_DIALOG_MESSAGE); + SET_STRING("FORMAT_DIALOG_DELETE_WARNING", + IDS_FILE_BROWSER_FORMAT_DIALOG_DELETE_WARNING); + SET_STRING("FORMAT_DIALOG_DRIVE_NAME_LABEL", + IDS_FILE_BROWSER_FORMAT_DIALOG_DRIVE_NAME_LABEL); + SET_STRING("FORMAT_DIALOG_FORMAT_LABEL", + IDS_FILE_BROWSER_FORMAT_DIALOG_FORMAT_LABEL); + SET_STRING("FORMAT_DIALOG_CONFIRM_LABEL", + IDS_FILE_BROWSER_FORMAT_DIALOG_CONFIRM_LABEL); SET_STRING("SHARE_BUTTON_TOOLTIP", IDS_FILE_BROWSER_SHARE_BUTTON_TOOLTIP); SET_STRING("SORT_BUTTON_TOOLTIP", IDS_FILE_BROWSER_SORT_BUTTON_TOOLTIP); SET_STRING("GEAR_BUTTON_TOOLTIP", IDS_FILE_BROWSER_GEAR_BUTTON_TOOLTIP);
diff --git a/chrome/browser/policy/webusb_allow_devices_for_urls_policy_handler_unittest.cc b/chrome/browser/policy/webusb_allow_devices_for_urls_policy_handler_unittest.cc index 4cb2d29c..9e4c77e 100644 --- a/chrome/browser/policy/webusb_allow_devices_for_urls_policy_handler_unittest.cc +++ b/chrome/browser/policy/webusb_allow_devices_for_urls_policy_handler_unittest.cc
@@ -238,6 +238,12 @@ chrome_schema); } +std::unique_ptr<base::Value> ReadJson(base::StringPiece json) { + base::Optional<base::Value> value = base::JSONReader::Read(json); + EXPECT_TRUE(value); + return value ? base::Value::ToUniquePtrValue(std::move(*value)) : nullptr; +} + } // namespace class WebUsbAllowDevicesForUrlsPolicyHandlerTest @@ -273,8 +279,8 @@ policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, PolicyScope::POLICY_SCOPE_MACHINE, - PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kValidPolicy), nullptr); + PolicySource::POLICY_SOURCE_CLOUD, ReadJson(kValidPolicy), + nullptr); ASSERT_TRUE(errors.empty()); EXPECT_TRUE(handler()->CheckPolicySettings(policy, &errors)); EXPECT_TRUE(errors.empty()); @@ -285,20 +291,19 @@ PolicyMap policy; PolicyErrorMap errors; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyInvalidTopLevelEntry), - nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyInvalidTopLevelEntry), nullptr); ASSERT_TRUE(errors.empty()); EXPECT_FALSE(handler()->CheckPolicySettings(policy, &errors)); - EXPECT_EQ(errors.size(), 1ul); + EXPECT_EQ(1ul, errors.size()); const base::string16 kExpected = base::ASCIIToUTF16( "Schema validation error at \"items[1]\": Missing or invalid required " "property: devices"); - EXPECT_EQ(errors.GetErrors(policy_name_), kExpected); + EXPECT_EQ(kExpected, errors.GetErrors(policy_name_)); } TEST_P(WebUsbAllowDevicesForUrlsPolicyHandlerTest, @@ -306,20 +311,19 @@ PolicyMap policy; PolicyErrorMap errors; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyMissingDevicesProperty), - nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyMissingDevicesProperty), nullptr); ASSERT_TRUE(errors.empty()); EXPECT_FALSE(handler()->CheckPolicySettings(policy, &errors)); - EXPECT_EQ(errors.size(), 1ul); + EXPECT_EQ(1ul, errors.size()); const base::string16 kExpected = base::ASCIIToUTF16( "Schema validation error at \"items[0]\": Missing or invalid required " "property: devices"); - EXPECT_EQ(errors.GetErrors(policy_name_), kExpected); + EXPECT_EQ(kExpected, errors.GetErrors(policy_name_)); } TEST_P(WebUsbAllowDevicesForUrlsPolicyHandlerTest, @@ -327,20 +331,19 @@ PolicyMap policy; PolicyErrorMap errors; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyMissingUrlsProperty), - nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyMissingUrlsProperty), nullptr); ASSERT_TRUE(errors.empty()); EXPECT_FALSE(handler()->CheckPolicySettings(policy, &errors)); - EXPECT_EQ(errors.size(), 1ul); + EXPECT_EQ(1ul, errors.size()); const base::string16 kExpected = base::ASCIIToUTF16( "Schema validation error at \"items[0]\": Missing or invalid required " "property: urls"); - EXPECT_EQ(errors.GetErrors(policy_name_), kExpected); + EXPECT_EQ(kExpected, errors.GetErrors(policy_name_)); } TEST_P(WebUsbAllowDevicesForUrlsPolicyHandlerTest, @@ -348,18 +351,19 @@ PolicyMap policy; PolicyErrorMap errors; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyUnknownProperty), nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyUnknownProperty), nullptr); ASSERT_TRUE(errors.empty()); EXPECT_TRUE(handler()->CheckPolicySettings(policy, &errors)); - EXPECT_EQ(errors.size(), 1ul); + EXPECT_EQ(1ul, errors.size()); const base::string16 kExpected = base::ASCIIToUTF16( - "Schema validation error at \"(ROOT)\": Unknown property: serialNumber"); - EXPECT_EQ(errors.GetErrors(policy_name_), kExpected); + "Schema validation error at \"items[0].devices.items[0]\": Unknown " + "property: serialNumber"); + EXPECT_EQ(kExpected, errors.GetErrors(policy_name_)); } TEST_P(WebUsbAllowDevicesForUrlsPolicyHandlerTest, @@ -367,20 +371,19 @@ PolicyMap policy; PolicyErrorMap errors; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyMismatchedVendorIdType), - nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyMismatchedVendorIdType), nullptr); ASSERT_TRUE(errors.empty()); EXPECT_FALSE(handler()->CheckPolicySettings(policy, &errors)); - EXPECT_EQ(errors.size(), 1ul); + EXPECT_EQ(1ul, errors.size()); const base::string16 kExpected = base::ASCIIToUTF16( "Schema validation error at \"items[0].devices.items[0]\": The " "vendor_id must be an unsigned short integer"); - EXPECT_EQ(errors.GetErrors(policy_name_), kExpected); + EXPECT_EQ(kExpected, errors.GetErrors(policy_name_)); } TEST_P(WebUsbAllowDevicesForUrlsPolicyHandlerTest, @@ -388,20 +391,19 @@ PolicyMap policy; PolicyErrorMap errors; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyMismatchedProductIdType), - nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyMismatchedProductIdType), nullptr); ASSERT_TRUE(errors.empty()); EXPECT_FALSE(handler()->CheckPolicySettings(policy, &errors)); - EXPECT_EQ(errors.size(), 1ul); + EXPECT_EQ(1ul, errors.size()); const base::string16 kExpected = base::ASCIIToUTF16( "Schema validation error at \"items[0].devices.items[0]\": The " "product_id must be an unsigned short integer"); - EXPECT_EQ(errors.GetErrors(policy_name_), kExpected); + EXPECT_EQ(kExpected, errors.GetErrors(policy_name_)); } TEST_P(WebUsbAllowDevicesForUrlsPolicyHandlerTest, @@ -409,20 +411,19 @@ PolicyMap policy; PolicyErrorMap errors; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyProductIdWithoutVendorId), - nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyProductIdWithoutVendorId), nullptr); ASSERT_TRUE(errors.empty()); EXPECT_FALSE(handler()->CheckPolicySettings(policy, &errors)); - EXPECT_EQ(errors.size(), 1ul); + EXPECT_EQ(1ul, errors.size()); const base::string16 kExpected = base::ASCIIToUTF16( "Schema validation error at \"items[0].devices.items[0]\": A vendor_id " "must also be specified"); - EXPECT_EQ(errors.GetErrors(policy_name_), kExpected); + EXPECT_EQ(kExpected, errors.GetErrors(policy_name_)); } TEST_P(WebUsbAllowDevicesForUrlsPolicyHandlerTest, @@ -430,20 +431,19 @@ PolicyMap policy; PolicyErrorMap errors; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyInvalidRequestingUrl), - nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyInvalidRequestingUrl), nullptr); ASSERT_TRUE(errors.empty()); EXPECT_FALSE(handler()->CheckPolicySettings(policy, &errors)); - EXPECT_EQ(errors.size(), 1ul); + EXPECT_EQ(1ul, errors.size()); const base::string16 kExpected = base::ASCIIToUTF16( "Schema validation error at \"items[0].urls.items[0]\": The urls item " "must contain valid URLs"); - EXPECT_EQ(errors.GetErrors(policy_name_), kExpected); + EXPECT_EQ(kExpected, errors.GetErrors(policy_name_)); } TEST_P(WebUsbAllowDevicesForUrlsPolicyHandlerTest, @@ -451,20 +451,19 @@ PolicyMap policy; PolicyErrorMap errors; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyInvalidEmbeddingUrl), - nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyInvalidEmbeddingUrl), nullptr); ASSERT_TRUE(errors.empty()); EXPECT_FALSE(handler()->CheckPolicySettings(policy, &errors)); - EXPECT_EQ(errors.size(), 1ul); + EXPECT_EQ(1ul, errors.size()); const base::string16 kExpected = base::ASCIIToUTF16( "Schema validation error at \"items[0].urls.items[0]\": The urls item " "must contain valid URLs"); - EXPECT_EQ(errors.GetErrors(policy_name_), kExpected); + EXPECT_EQ(kExpected, errors.GetErrors(policy_name_)); } TEST_P(WebUsbAllowDevicesForUrlsPolicyHandlerTest, @@ -475,17 +474,16 @@ policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyInvalidUrlsEntry), - nullptr); + ReadJson(kInvalidPolicyInvalidUrlsEntry), nullptr); ASSERT_TRUE(errors.empty()); EXPECT_FALSE(handler()->CheckPolicySettings(policy, &errors)); - EXPECT_EQ(errors.size(), 1ul); + EXPECT_EQ(1ul, errors.size()); const base::string16 kExpected = base::ASCIIToUTF16( "Schema validation error at \"items[0].urls.items[0]\": Each urls " "string entry must contain between 1 to 2 URLs"); - EXPECT_EQ(errors.GetErrors(policy_name_), kExpected); + EXPECT_EQ(kExpected, errors.GetErrors(policy_name_)); } TEST_P(WebUsbAllowDevicesForUrlsPolicyHandlerTest, @@ -495,17 +493,17 @@ policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, PolicyScope::POLICY_SCOPE_MACHINE, - PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(InvalidPolicyNoUrls), nullptr); + PolicySource::POLICY_SOURCE_CLOUD, ReadJson(InvalidPolicyNoUrls), + nullptr); ASSERT_TRUE(errors.empty()); EXPECT_FALSE(handler()->CheckPolicySettings(policy, &errors)); - EXPECT_EQ(errors.size(), 1ul); + EXPECT_EQ(1ul, errors.size()); const base::string16 kExpected = base::ASCIIToUTF16( "Schema validation error at \"items[0].urls.items[0]\": Each urls " "string entry must contain between 1 to 2 URLs"); - EXPECT_EQ(errors.GetErrors(policy_name_), kExpected); + EXPECT_EQ(kExpected, errors.GetErrors(policy_name_)); } TEST_P(WebUsbAllowDevicesForUrlsPolicyHandlerTest, ApplyPolicySettings) { @@ -514,8 +512,8 @@ PolicyMap policy; policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, PolicyScope::POLICY_SCOPE_MACHINE, - PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kValidPolicy), nullptr); + PolicySource::POLICY_SOURCE_CLOUD, ReadJson(kValidPolicy), + nullptr); UpdateProviderPolicy(policy); const base::Value* pref_value = nullptr; @@ -525,26 +523,26 @@ // Ensure that the kManagedWebUsbAllowDevicesForUrls pref is set correctly. const auto& list = pref_value->GetList(); - ASSERT_EQ(list.size(), 2ul); + ASSERT_EQ(2ul, list.size()); // Check the first item's devices list. const base::Value* devices = list[0].FindKey(kDevicesKey); ASSERT_TRUE(devices); const auto& first_devices_list = devices->GetList(); - ASSERT_EQ(first_devices_list.size(), 2ul); + ASSERT_EQ(2ul, first_devices_list.size()); const base::Value* vendor_id = first_devices_list[0].FindKey(kVendorIdKey); ASSERT_TRUE(vendor_id); - EXPECT_EQ(vendor_id->GetInt(), 1234); + EXPECT_EQ(1234, vendor_id->GetInt()); const base::Value* product_id = first_devices_list[0].FindKey(kProductIdKey); ASSERT_TRUE(product_id); - EXPECT_EQ(product_id->GetInt(), 5678); + EXPECT_EQ(5678, product_id->GetInt()); vendor_id = first_devices_list[1].FindKey(kVendorIdKey); ASSERT_TRUE(vendor_id); - EXPECT_EQ(vendor_id->GetInt(), 4321); + EXPECT_EQ(4321, vendor_id->GetInt()); product_id = first_devices_list[1].FindKey(kProductIdKey); EXPECT_FALSE(product_id); @@ -554,19 +552,19 @@ ASSERT_TRUE(urls); const auto& first_urls_list = urls->GetList(); - ASSERT_EQ(first_urls_list.size(), 2ul); + ASSERT_EQ(2ul, first_urls_list.size()); ASSERT_TRUE(first_urls_list[0].is_string()); ASSERT_TRUE(first_urls_list[1].is_string()); - EXPECT_EQ(first_urls_list[0].GetString(), - "https://google.com,https://google.com"); - EXPECT_EQ(first_urls_list[1].GetString(), "https://www.youtube.com"); + EXPECT_EQ("https://google.com,https://google.com", + first_urls_list[0].GetString()); + EXPECT_EQ("https://www.youtube.com", first_urls_list[1].GetString()); // Check the second item's devices list. devices = list[1].FindKey(kDevicesKey); ASSERT_TRUE(devices); const auto& second_devices_list = devices->GetList(); - ASSERT_EQ(second_devices_list.size(), 1ul); + ASSERT_EQ(1ul, second_devices_list.size()); vendor_id = second_devices_list[0].FindKey(kVendorIdKey); EXPECT_FALSE(vendor_id); @@ -579,9 +577,9 @@ ASSERT_TRUE(urls); const auto& second_urls_list = urls->GetList(); - ASSERT_EQ(second_urls_list.size(), 1ul); + ASSERT_EQ(1ul, second_urls_list.size()); ASSERT_TRUE(second_urls_list[0].is_string()); - EXPECT_EQ(second_urls_list[0].GetString(), "https://chromium.org,"); + EXPECT_EQ("https://chromium.org,", second_urls_list[0].GetString()); } TEST_P(WebUsbAllowDevicesForUrlsPolicyHandlerTest, @@ -589,11 +587,10 @@ EXPECT_FALSE(store_->GetValue(pref_name_, nullptr)); PolicyMap policy; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyInvalidTopLevelEntry), - nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyInvalidTopLevelEntry), nullptr); UpdateProviderPolicy(policy); const base::Value* pref_value = nullptr; @@ -606,11 +603,10 @@ EXPECT_FALSE(store_->GetValue(pref_name_, nullptr)); PolicyMap policy; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyMissingDevicesProperty), - nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyMissingDevicesProperty), nullptr); UpdateProviderPolicy(policy); const base::Value* pref_value = nullptr; EXPECT_FALSE(store_->GetValue(pref_name_, &pref_value)); @@ -622,11 +618,10 @@ EXPECT_FALSE(store_->GetValue(pref_name_, nullptr)); PolicyMap policy; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyMissingUrlsProperty), - nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyMissingUrlsProperty), nullptr); UpdateProviderPolicy(policy); const base::Value* pref_value = nullptr; EXPECT_FALSE(store_->GetValue(pref_name_, &pref_value)); @@ -638,18 +633,17 @@ EXPECT_FALSE(store_->GetValue(pref_name_, nullptr)); PolicyMap policy; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyUnknownProperty), nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyUnknownProperty), nullptr); UpdateProviderPolicy(policy); const base::Value* pref_value = nullptr; EXPECT_TRUE(store_->GetValue(pref_name_, &pref_value)); EXPECT_TRUE(pref_value); - base::Optional<base::Value> expected_pref_value = - base::JSONReader::Read(kInvalidPolicyUnknownPropertyAfterCleanup); - ASSERT_TRUE(expected_pref_value); + std::unique_ptr<base::Value> expected_pref_value = + ReadJson(kInvalidPolicyUnknownPropertyAfterCleanup); EXPECT_EQ(*expected_pref_value, *pref_value); } @@ -658,11 +652,10 @@ EXPECT_FALSE(store_->GetValue(pref_name_, nullptr)); PolicyMap policy; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyMismatchedVendorIdType), - nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyMismatchedVendorIdType), nullptr); UpdateProviderPolicy(policy); const base::Value* pref_value = nullptr; EXPECT_FALSE(store_->GetValue(pref_name_, &pref_value)); @@ -674,11 +667,10 @@ EXPECT_FALSE(store_->GetValue(pref_name_, nullptr)); PolicyMap policy; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyMismatchedProductIdType), - nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyMismatchedProductIdType), nullptr); UpdateProviderPolicy(policy); const base::Value* pref_value = nullptr; EXPECT_FALSE(store_->GetValue(pref_name_, &pref_value)); @@ -690,11 +682,10 @@ EXPECT_FALSE(store_->GetValue(pref_name_, nullptr)); PolicyMap policy; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyProductIdWithoutVendorId), - nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyProductIdWithoutVendorId), nullptr); UpdateProviderPolicy(policy); const base::Value* pref_value = nullptr; EXPECT_FALSE(store_->GetValue(pref_name_, &pref_value)); @@ -706,11 +697,10 @@ EXPECT_FALSE(store_->GetValue(pref_name_, nullptr)); PolicyMap policy; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyInvalidRequestingUrl), - nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyInvalidRequestingUrl), nullptr); UpdateProviderPolicy(policy); const base::Value* pref_value = nullptr; EXPECT_FALSE(store_->GetValue(pref_name_, &pref_value)); @@ -722,11 +712,10 @@ EXPECT_FALSE(store_->GetValue(pref_name_, nullptr)); PolicyMap policy; - policy.Set( - policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, - PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyInvalidEmbeddingUrl), - nullptr); + policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, + PolicyScope::POLICY_SCOPE_MACHINE, + PolicySource::POLICY_SOURCE_CLOUD, + ReadJson(kInvalidPolicyInvalidEmbeddingUrl), nullptr); UpdateProviderPolicy(policy); const base::Value* pref_value = nullptr; EXPECT_FALSE(store_->GetValue(pref_name_, &pref_value)); @@ -741,8 +730,7 @@ policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, PolicyScope::POLICY_SCOPE_MACHINE, PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(kInvalidPolicyInvalidUrlsEntry), - nullptr); + ReadJson(kInvalidPolicyInvalidUrlsEntry), nullptr); UpdateProviderPolicy(policy); const base::Value* pref_value = nullptr; EXPECT_FALSE(store_->GetValue(pref_name_, &pref_value)); @@ -755,8 +743,8 @@ PolicyMap policy; policy.Set(policy_name_, PolicyLevel::POLICY_LEVEL_MANDATORY, PolicyScope::POLICY_SCOPE_MACHINE, - PolicySource::POLICY_SOURCE_CLOUD, - base::JSONReader::ReadDeprecated(InvalidPolicyNoUrls), nullptr); + PolicySource::POLICY_SOURCE_CLOUD, ReadJson(InvalidPolicyNoUrls), + nullptr); UpdateProviderPolicy(policy); const base::Value* pref_value = nullptr; EXPECT_FALSE(store_->GetValue(pref_name_, &pref_value));
diff --git a/chrome/browser/sharing/sharing_device_info.cc b/chrome/browser/sharing/sharing_device_info.cc index 47d02d7..686d32f 100644 --- a/chrome/browser/sharing/sharing_device_info.cc +++ b/chrome/browser/sharing/sharing_device_info.cc
@@ -15,6 +15,8 @@ SharingDeviceInfo::~SharingDeviceInfo() = default; +SharingDeviceInfo::SharingDeviceInfo(SharingDeviceInfo&& other) = default; + const std::string& SharingDeviceInfo::guid() const { return guid_; }
diff --git a/chrome/browser/sharing/sharing_device_info.h b/chrome/browser/sharing/sharing_device_info.h index 3eb512d..22f04eba 100644 --- a/chrome/browser/sharing/sharing_device_info.h +++ b/chrome/browser/sharing/sharing_device_info.h
@@ -21,6 +21,7 @@ base::Time last_online_timestamp, int capabilities); ~SharingDeviceInfo(); + SharingDeviceInfo(SharingDeviceInfo&& other); // Unique identifier for the device. const std::string& guid() const;
diff --git a/chrome/browser/sharing/sharing_service.cc b/chrome/browser/sharing/sharing_service.cc index 59d48f17..f1322f2 100644 --- a/chrome/browser/sharing/sharing_service.cc +++ b/chrome/browser/sharing/sharing_service.cc
@@ -4,13 +4,67 @@ #include "chrome/browser/sharing/sharing_service.h" -SharingService::SharingService() = default; +#include <map> + +#include "base/time/time.h" +#include "chrome/browser/sharing/sharing_device_info.h" +#include "chrome/browser/sharing/sharing_message_handler.h" +#include "chrome/browser/sharing/sharing_sync_preference.h" +#include "components/sync_device_info/device_info.h" +#include "components/sync_device_info/device_info_tracker.h" + +// Undefine SendMessage defined in Windows headers. +#ifdef SendMessage +#undef SendMessage +#endif + +namespace { +// TODO(knollr): Should this be configurable or shared between similar features? +constexpr base::TimeDelta kDeviceExpiration = base::TimeDelta::FromDays(2); +} // namespace + +SharingService::SharingService( + std::unique_ptr<SharingSyncPreference> sync_prefs, + syncer::DeviceInfoTracker* device_info_tracker) + : sync_prefs_(std::move(sync_prefs)), + device_info_tracker_(device_info_tracker) { + DCHECK(sync_prefs_); + DCHECK(device_info_tracker_); +} SharingService::~SharingService() = default; std::vector<SharingDeviceInfo> SharingService::GetDeviceCandidates( int required_capabilities) const { - return std::vector<SharingDeviceInfo>(); + std::vector<std::unique_ptr<syncer::DeviceInfo>> all_devices = + device_info_tracker_->GetAllDeviceInfo(); + std::map<std::string, SharingSyncPreference::Device> synced_devices = + sync_prefs_->GetSyncedDevices(); + + const base::Time min_updated_time = base::Time::Now() - kDeviceExpiration; + + std::vector<SharingDeviceInfo> device_candidates; + for (const auto& device : all_devices) { + if (device->last_updated_timestamp() < min_updated_time) + continue; + + auto synced_device = synced_devices.find(device->guid()); + if (synced_device == synced_devices.end()) + continue; + + int device_capabilities = synced_device->second.capabilities; + if ((device_capabilities & required_capabilities) != required_capabilities) + continue; + + device_candidates.emplace_back(device->guid(), device->client_name(), + device->last_updated_timestamp(), + device_capabilities); + } + + // TODO(knollr): Remove devices from |sync_prefs_| that are in + // |synced_devices| but not in |all_devices|? + + return device_candidates; } bool SharingService::SendMessage(
diff --git a/chrome/browser/sharing/sharing_service.h b/chrome/browser/sharing/sharing_service.h index c59f803..1d26dd7c 100644 --- a/chrome/browser/sharing/sharing_service.h +++ b/chrome/browser/sharing/sharing_service.h
@@ -5,19 +5,27 @@ #ifndef CHROME_BROWSER_SHARING_SHARING_SERVICE_H_ #define CHROME_BROWSER_SHARING_SHARING_SERVICE_H_ +#include <memory> #include <string> #include <vector> #include "chrome/browser/sharing/proto/sharing_message.pb.h" -#include "chrome/browser/sharing/sharing_device_info.h" -#include "chrome/browser/sharing/sharing_message_handler.h" #include "components/keyed_service/core/keyed_service.h" +namespace syncer { +class DeviceInfoTracker; +} // namespace syncer + +class SharingDeviceInfo; +class SharingMessageHandler; +class SharingSyncPreference; + // Class to manage lifecycle of sharing feature, and provide APIs to send // sharing messages to other devices. class SharingService : public KeyedService { public: - SharingService(); + SharingService(std::unique_ptr<SharingSyncPreference> sync_prefs, + syncer::DeviceInfoTracker* device_info_tracker); ~SharingService() override; // Returns a list of DeviceInfo that is available to receive messages. @@ -36,6 +44,9 @@ SharingMessageHandler* handler); private: + std::unique_ptr<SharingSyncPreference> sync_prefs_; + syncer::DeviceInfoTracker* device_info_tracker_; + DISALLOW_COPY_AND_ASSIGN(SharingService); };
diff --git a/chrome/browser/sharing/sharing_service_factory.cc b/chrome/browser/sharing/sharing_service_factory.cc index bae69e3..7b294a2 100644 --- a/chrome/browser/sharing/sharing_service_factory.cc +++ b/chrome/browser/sharing/sharing_service_factory.cc
@@ -4,10 +4,16 @@ #include "chrome/browser/sharing/sharing_service_factory.h" +#include <memory> + #include "base/memory/singleton.h" #include "chrome/browser/profiles/incognito_helpers.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/sharing/sharing_service.h" +#include "chrome/browser/sharing/sharing_sync_preference.h" +#include "chrome/browser/sync/device_info_sync_service_factory.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" +#include "components/sync_device_info/device_info_sync_service.h" #include "content/public/browser/browser_context.h" namespace { @@ -29,13 +35,24 @@ SharingServiceFactory::SharingServiceFactory() : BrowserContextKeyedServiceFactory( kServiceName, - BrowserContextDependencyManager::GetInstance()) {} + BrowserContextDependencyManager::GetInstance()) { + DependsOn(DeviceInfoSyncServiceFactory::GetInstance()); +} SharingServiceFactory::~SharingServiceFactory() = default; KeyedService* SharingServiceFactory::BuildServiceInstanceFor( content::BrowserContext* context) const { - return new SharingService(); + Profile* profile = Profile::FromBrowserContext(context); + + syncer::DeviceInfoTracker* device_info_tracker = + DeviceInfoSyncServiceFactory::GetForProfile(profile) + ->GetDeviceInfoTracker(); + + std::unique_ptr<SharingSyncPreference> sync_prefs = + std::make_unique<SharingSyncPreference>(profile->GetPrefs()); + + return new SharingService(std::move(sync_prefs), device_info_tracker); } content::BrowserContext* SharingServiceFactory::GetBrowserContextToUse( @@ -46,3 +63,7 @@ bool SharingServiceFactory::ServiceIsCreatedWithBrowserContext() const { return true; } + +bool SharingServiceFactory::ServiceIsNULLWhileTesting() const { + return true; +}
diff --git a/chrome/browser/sharing/sharing_service_factory.h b/chrome/browser/sharing/sharing_service_factory.h index 8e9bc8a..220131e 100644 --- a/chrome/browser/sharing/sharing_service_factory.h +++ b/chrome/browser/sharing/sharing_service_factory.h
@@ -39,6 +39,7 @@ content::BrowserContext* GetBrowserContextToUse( content::BrowserContext* context) const override; bool ServiceIsCreatedWithBrowserContext() const override; + bool ServiceIsNULLWhileTesting() const override; DISALLOW_COPY_AND_ASSIGN(SharingServiceFactory); };
diff --git a/chrome/browser/sharing/sharing_service_unittest.cc b/chrome/browser/sharing/sharing_service_unittest.cc new file mode 100644 index 0000000..8fd4a126 --- /dev/null +++ b/chrome/browser/sharing/sharing_service_unittest.cc
@@ -0,0 +1,129 @@ +// 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. + +#include "chrome/browser/sharing/sharing_service.h" + +#include <memory> +#include <vector> + +#include "base/guid.h" +#include "base/memory/ptr_util.h" +#include "base/test/scoped_task_environment.h" +#include "chrome/browser/sharing/sharing_device_info.h" +#include "chrome/browser/sharing/sharing_sync_preference.h" +#include "components/sync_device_info/device_info.h" +#include "components/sync_device_info/fake_device_info_tracker.h" +#include "components/sync_preferences/testing_pref_service_syncable.h" +#include "testing/gtest/include/gtest/gtest.h" + +using base::test::ScopedTaskEnvironment; + +namespace { + +constexpr int kNoCapabilities = + static_cast<int>(SharingDeviceCapability::kNone); + +class SharingServiceTest : public testing::Test { + public: + SharingServiceTest() { + sync_prefs_ = new SharingSyncPreference(&prefs_); + sharing_service_ = std::make_unique<SharingService>( + base::WrapUnique(sync_prefs_), &device_info_tracker_); + SharingSyncPreference::RegisterProfilePrefs(prefs_.registry()); + } + + protected: + static std::unique_ptr<syncer::DeviceInfo> CreateFakeDeviceInfo( + const std::string& id) { + return std::make_unique<syncer::DeviceInfo>( + id, "name", "chrome_version", "user_agent", + sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id", + /* last_updated_timestamp= */ base::Time::Now(), + /* send_tab_to_self_receiving_enabled= */ false); + } + + static SharingSyncPreference::Device CreateFakeSyncDevice() { + return SharingSyncPreference::Device("fcm_token", "p256dh", "auth_token", + kNoCapabilities); + } + + ScopedTaskEnvironment scoped_task_environment_{ + ScopedTaskEnvironment::MainThreadType::MOCK_TIME, + ScopedTaskEnvironment::NowSource::MAIN_THREAD_MOCK_TIME}; + + syncer::FakeDeviceInfoTracker device_info_tracker_; + SharingSyncPreference* sync_prefs_ = nullptr; + std::unique_ptr<SharingService> sharing_service_; + + private: + sync_preferences::TestingPrefServiceSyncable prefs_; +}; + +} // namespace + +TEST_F(SharingServiceTest, GetDeviceCandidates_Empty) { + std::vector<SharingDeviceInfo> candidates = + sharing_service_->GetDeviceCandidates(kNoCapabilities); + EXPECT_TRUE(candidates.empty()); +} + +TEST_F(SharingServiceTest, GetDeviceCandidates_NoSynced) { + std::string id = base::GenerateGUID(); + std::unique_ptr<syncer::DeviceInfo> device_info = CreateFakeDeviceInfo(id); + device_info_tracker_.Add(device_info.get()); + + std::vector<SharingDeviceInfo> candidates = + sharing_service_->GetDeviceCandidates(kNoCapabilities); + + EXPECT_TRUE(candidates.empty()); +} + +TEST_F(SharingServiceTest, GetDeviceCandidates_NoTracked) { + sync_prefs_->SetSyncDevice(base::GenerateGUID(), CreateFakeSyncDevice()); + + std::vector<SharingDeviceInfo> candidates = + sharing_service_->GetDeviceCandidates(kNoCapabilities); + + EXPECT_TRUE(candidates.empty()); +} + +TEST_F(SharingServiceTest, GetDeviceCandidates_SyncedAndTracked) { + std::string id = base::GenerateGUID(); + std::unique_ptr<syncer::DeviceInfo> device_info = CreateFakeDeviceInfo(id); + device_info_tracker_.Add(device_info.get()); + sync_prefs_->SetSyncDevice(id, CreateFakeSyncDevice()); + + std::vector<SharingDeviceInfo> candidates = + sharing_service_->GetDeviceCandidates(kNoCapabilities); + + ASSERT_EQ(1u, candidates.size()); +} + +TEST_F(SharingServiceTest, GetDeviceCandidates_Expired) { + std::string id = base::GenerateGUID(); + std::unique_ptr<syncer::DeviceInfo> device_info = CreateFakeDeviceInfo(id); + device_info_tracker_.Add(device_info.get()); + sync_prefs_->SetSyncDevice(id, CreateFakeSyncDevice()); + + // Forward time until device expires. + scoped_task_environment_.FastForwardBy(base::TimeDelta::FromDays(10)); + + std::vector<SharingDeviceInfo> candidates = + sharing_service_->GetDeviceCandidates(kNoCapabilities); + + EXPECT_TRUE(candidates.empty()); +} + +TEST_F(SharingServiceTest, GetDeviceCandidates_MissingRequirements) { + std::string id = base::GenerateGUID(); + std::unique_ptr<syncer::DeviceInfo> device_info = CreateFakeDeviceInfo(id); + device_info_tracker_.Add(device_info.get()); + sync_prefs_->SetSyncDevice(id, CreateFakeSyncDevice()); + + // Require all capabilities. + std::vector<SharingDeviceInfo> candidates = + sharing_service_->GetDeviceCandidates(-1); + + EXPECT_TRUE(candidates.empty()); +}
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker.cc b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker.cc index 34e337a7..0a078ae 100644 --- a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker.cc +++ b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker.cc
@@ -328,16 +328,20 @@ return SortAndTruncateRanks(n, Rank(condition)); } -void RecurrenceRanker::MaybeSave() { +void RecurrenceRanker::SaveToDisk() { if (is_ephemeral_user_) return; + time_of_last_save_ = Time::Now(); + RecurrenceRankerProto proto; + ToProto(&proto); + task_runner_->PostTask( + FROM_HERE, base::BindOnce(&SaveProtoToDisk, proto_filepath_, proto)); +} + +void RecurrenceRanker::MaybeSave() { if (Time::Now() - time_of_last_save_ > min_seconds_between_saves_) { - time_of_last_save_ = Time::Now(); - RecurrenceRankerProto proto; - ToProto(&proto); - task_runner_->PostTask( - FROM_HERE, base::BindOnce(&SaveProtoToDisk, proto_filepath_, proto)); + SaveToDisk(); } } @@ -348,10 +352,6 @@ conditions_->ToProto(proto->mutable_conditions()); } -void RecurrenceRanker::ForceSaveOnNextUpdateForTesting() { - time_of_last_save_ = Time::UnixEpoch(); -} - const char* RecurrenceRanker::GetPredictorNameForTesting() const { return predictor_->GetPredictorName(); }
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker.h b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker.h index 7fad253..1c350dd 100644 --- a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker.h +++ b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker.h
@@ -42,7 +42,6 @@ // Rename a target, while keeping learned information on it. This may save to // disk, but is not guaranteed to. - // TODO(921444): Provide a mechanism to force save to disk. void RenameTarget(const std::string& target, const std::string& new_target); void RenameCondition(const std::string& condition, const std::string& new_condition); @@ -51,7 +50,6 @@ // guaranteed to. If the intention of this removal is to removal all knowledge // of, for example, a sensitive target, then a ForceSaveToDisk call should be // made after removal. - // TODO(921444): Provide a mechanism to force save to disk. void RemoveTarget(const std::string& target); void RemoveCondition(const std::string& condition); @@ -78,6 +76,12 @@ // TODO(921444): Create a system for cleaning up internal predictor state that // is stored indepent of the target/condition frecency stores. + // Force saving all model state to disk. If the user is an ephemeral user, + // this does nothing. This is not necessary in normal operation, as the ranker + // automatically saves at regular intervals. Example use: syncing to disk + // after a target or condition is deleted. + void SaveToDisk(); + const char* GetPredictorNameForTesting() const; private: @@ -98,8 +102,6 @@ void ToProto(RecurrenceRankerProto* proto); void FromProto(const RecurrenceRankerProto& proto); - void ForceSaveOnNextUpdateForTesting(); - // Internal predictor that drives ranking. std::unique_ptr<RecurrencePredictor> predictor_;
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_unittest.cc b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_unittest.cc index 9bad6ba..2a91d27 100644 --- a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_unittest.cc +++ b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_unittest.cc
@@ -289,8 +289,8 @@ ranker->Record("A"); ranker->Record("B"); ranker->Record("B"); - ranker->ForceSaveOnNextUpdateForTesting(); ranker->Record("C"); + ranker->SaveToDisk(); Wait(); // Check the ranker file is created. @@ -313,8 +313,8 @@ auto ranker = MakeSimpleRanker(); // Make the first ranker do a save. - ranker->ForceSaveOnNextUpdateForTesting(); ranker->Record("A"); + ranker->SaveToDisk(); Wait(); // Construct a second ranker with a slightly different config.
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc index 09fb4b7..dc5d468 100644 --- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc +++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
@@ -12,7 +12,6 @@ #include <string> #include <vector> -#include "base/metrics/histogram_macros.h" #include "base/strings/utf_string_conversions.h" #include "base/time/default_clock.h" #include "chrome/browser/password_manager/password_store_factory.h" @@ -83,17 +82,8 @@ dismissal_reason_ = reason; } - void set_sign_in_promo_dismissal_reason( - password_manager::metrics_util::SyncSignInUserAction reason) { - sign_in_promo_dismissal_reason_ = reason; - } - void SetClockForTesting(base::Clock* clock) { clock_ = clock; } - void set_sign_in_promo_shown_count(int count) { - sign_in_promo_shown_count = count; - } - private: // The way the bubble appeared. const password_manager::metrics_util::UIDisplayDisposition @@ -102,19 +92,12 @@ // Dismissal reason for a password bubble. password_manager::metrics_util::UIDismissalReason dismissal_reason_; - // Dismissal reason for the Chrome Sign in bubble. - password_manager::metrics_util::SyncSignInUserAction - sign_in_promo_dismissal_reason_; - // Current statistics for the save password bubble; password_manager::InteractionsStats interaction_stats_; // Used to retrieve the current time, in base::Time units. base::Clock* clock_; - // Number of times the sign-in promo was shown to the user. - int sign_in_promo_shown_count; - DISALLOW_COPY_AND_ASSIGN(InteractionKeeper); }; @@ -123,10 +106,8 @@ password_manager::metrics_util::UIDisplayDisposition display_disposition) : display_disposition_(display_disposition), dismissal_reason_(metrics_util::NO_DIRECT_INTERACTION), - sign_in_promo_dismissal_reason_(metrics_util::CHROME_SIGNIN_DISMISSED), interaction_stats_(std::move(stats)), - clock_(base::DefaultClock::GetInstance()), - sign_in_promo_shown_count(0) {} + clock_(base::DefaultClock::GetInstance()) {} void ManagePasswordsBubbleModel::InteractionKeeper::ReportInteractions( const ManagePasswordsBubbleModel* model) { @@ -151,27 +132,7 @@ } // Log UMA histograms. - if (model->state() == password_manager::ui::CHROME_SIGN_IN_PROMO_STATE) { - metrics_util::LogSyncSigninPromoUserAction(sign_in_promo_dismissal_reason_); - switch (sign_in_promo_dismissal_reason_) { - case password_manager::metrics_util::CHROME_SIGNIN_OK: - UMA_HISTOGRAM_COUNTS_100("PasswordManager.SignInPromoCountTilSignIn", - sign_in_promo_shown_count); - break; - case password_manager::metrics_util::CHROME_SIGNIN_CANCEL: - UMA_HISTOGRAM_COUNTS_100("PasswordManager.SignInPromoCountTilNoThanks", - sign_in_promo_shown_count); - break; - case password_manager::metrics_util::CHROME_SIGNIN_DISMISSED: - UMA_HISTOGRAM_COUNTS_100("PasswordManager.SignInPromoDismissalCount", - sign_in_promo_shown_count); - break; - case password_manager::metrics_util::CHROME_SIGNIN_ACTION_COUNT: - NOTREACHED(); - break; - } - } else if (model->state() == - password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) { + if (model->state() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) { metrics_util::LogUpdateUIDismissalReason(dismissal_reason_); } else if (model->state() == password_manager::ui::PENDING_PASSWORD_STATE) { metrics_util::LogSaveUIDismissalReason(dismissal_reason_); @@ -418,8 +379,6 @@ bool is_default_promo_account) { // Enabling sync for an existing account and starting a new sign-in are // triggered by the user interacting with the sign-in promo. - interaction_keeper_->set_sign_in_promo_dismissal_reason( - metrics_util::CHROME_SIGNIN_OK); GetProfile()->GetPrefs()->SetBoolean( password_manager::prefs::kWasSignInPasswordPromoClicked, true); if (delegate_) @@ -427,8 +386,6 @@ } void ManagePasswordsBubbleModel::OnSkipSignInClicked() { - interaction_keeper_->set_sign_in_promo_dismissal_reason( - metrics_util::CHROME_SIGNIN_CANCEL); GetProfile()->GetPrefs()->SetBoolean( password_manager::prefs::kWasSignInPasswordPromoClicked, true); } @@ -483,7 +440,6 @@ show_count++; prefs->SetInteger(password_manager::prefs::kNumberSignInPasswordPromoShown, show_count); - interaction_keeper_->set_sign_in_promo_shown_count(show_count); return true; } return false;
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc index 5d9921dc3..bb37a80d 100644 --- a/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc +++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
@@ -48,14 +48,6 @@ constexpr ukm::SourceId kTestSourceId = 0x1234; -constexpr char kSignInPromoCountTilNoThanksMetric[] = - "PasswordManager.SignInPromoCountTilNoThanks"; -constexpr char kSignInPromoCountTilSignInMetric[] = - "PasswordManager.SignInPromoCountTilSignIn"; -constexpr char kSignInPromoDismissalCountMetric[] = - "PasswordManager.SignInPromoDismissalCount"; -constexpr char kSignInPromoDismissalReasonMetric[] = - "PasswordManager.SignInPromo"; constexpr char kSiteOrigin[] = "http://example.com/login"; constexpr char kUsername[] = "Admin"; constexpr char kUsernameExisting[] = "User"; @@ -409,7 +401,6 @@ TEST_F(ManagePasswordsBubbleModelTest, SuppressSignInPromo) { prefs()->SetBoolean(password_manager::prefs::kWasSignInPasswordPromoClicked, true); - base::HistogramTester histogram_tester; PretendPasswordWaiting(); EXPECT_CALL(*GetStore(), RemoveSiteStatsImpl(GURL(kSiteOrigin).GetOrigin())); EXPECT_CALL(*controller(), SavePassword(pending_password().username_value, @@ -418,10 +409,6 @@ EXPECT_FALSE(model()->ReplaceToShowPromotionIfNeeded()); DestroyModelAndVerifyControllerExpectations(); - histogram_tester.ExpectTotalCount(kSignInPromoDismissalReasonMetric, 0); - histogram_tester.ExpectTotalCount(kSignInPromoCountTilSignInMetric, 0); - histogram_tester.ExpectTotalCount(kSignInPromoCountTilNoThanksMetric, 0); - histogram_tester.ExpectTotalCount(kSignInPromoDismissalCountMetric, 0); } TEST_F(ManagePasswordsBubbleModelTest, SignInPromoOK) { @@ -445,12 +432,6 @@ histogram_tester.ExpectUniqueSample( kUIDismissalReasonSaveMetric, password_manager::metrics_util::CLICKED_SAVE, 1); - histogram_tester.ExpectUniqueSample( - kSignInPromoDismissalReasonMetric, - password_manager::metrics_util::CHROME_SIGNIN_OK, 1); - histogram_tester.ExpectUniqueSample(kSignInPromoCountTilSignInMetric, 1, 1); - histogram_tester.ExpectTotalCount(kSignInPromoCountTilNoThanksMetric, 0); - histogram_tester.ExpectTotalCount(kSignInPromoDismissalCountMetric, 0); EXPECT_TRUE(prefs()->GetBoolean( password_manager::prefs::kWasSignInPasswordPromoClicked)); } @@ -469,12 +450,6 @@ histogram_tester.ExpectUniqueSample( kUIDismissalReasonSaveMetric, password_manager::metrics_util::CLICKED_SAVE, 1); - histogram_tester.ExpectUniqueSample( - kSignInPromoDismissalReasonMetric, - password_manager::metrics_util::CHROME_SIGNIN_CANCEL, 1); - histogram_tester.ExpectUniqueSample(kSignInPromoCountTilNoThanksMetric, 1, 1); - histogram_tester.ExpectTotalCount(kSignInPromoCountTilSignInMetric, 0); - histogram_tester.ExpectTotalCount(kSignInPromoDismissalCountMetric, 0); EXPECT_TRUE(prefs()->GetBoolean( password_manager::prefs::kWasSignInPasswordPromoClicked)); } @@ -492,12 +467,6 @@ histogram_tester.ExpectUniqueSample( kUIDismissalReasonSaveMetric, password_manager::metrics_util::CLICKED_SAVE, 1); - histogram_tester.ExpectUniqueSample( - kSignInPromoDismissalReasonMetric, - password_manager::metrics_util::CHROME_SIGNIN_DISMISSED, 1); - histogram_tester.ExpectTotalCount(kSignInPromoCountTilSignInMetric, 0); - histogram_tester.ExpectTotalCount(kSignInPromoCountTilNoThanksMetric, 0); - histogram_tester.ExpectUniqueSample(kSignInPromoDismissalCountMetric, 1, 1); EXPECT_FALSE(prefs()->GetBoolean( password_manager::prefs::kWasSignInPasswordPromoClicked)); }
diff --git a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc index e837aff..6a1917e 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
@@ -388,7 +388,7 @@ node_data->AddIntAttribute(ax::mojom::IntAttribute::kPosInSet, model_index_ + 1); node_data->AddIntAttribute(ax::mojom::IntAttribute::kSetSize, - int{popup_contents_view_->children().size()}); + popup_contents_view_->model()->result().size()); node_data->AddBoolAttribute(ax::mojom::BoolAttribute::kSelected, IsSelected());
diff --git a/chrome/browser/ui/views/omnibox/omnibox_result_view_unittest.cc b/chrome/browser/ui/views/omnibox/omnibox_result_view_unittest.cc index 0bd716f..1751662 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_result_view_unittest.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_result_view_unittest.cc
@@ -228,8 +228,9 @@ EXPECT_EQ( result_node_data.GetIntAttribute(ax::mojom::IntAttribute::kPosInSet), kTestResultViewIndex + 1); - EXPECT_EQ(result_node_data.GetIntAttribute(ax::mojom::IntAttribute::kSetSize), - 6); + // TODO(accessibility) Find a way to test this. + // EXPECT_EQ(result_node_data.GetIntAttribute( + // ax::mojom::IntAttribute::kSetSize), 1); // Select it and check selected state. ui::AXNodeData result_after_click;
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.h b/chrome/browser/ui/webui/print_preview/print_preview_handler.h index 1b34ac7..540db6f5 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.h +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.h
@@ -17,6 +17,7 @@ #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" #include "chrome/common/buildflags.h" +#include "components/prefs/pref_service.h" #include "content/public/browser/web_ui_message_handler.h" #include "printing/backend/print_backend.h" #include "printing/buildflags/buildflags.h"
diff --git a/chrome/browser/web_applications/BUILD.gn b/chrome/browser/web_applications/BUILD.gn index f51c682..0e62a8cf 100644 --- a/chrome/browser/web_applications/BUILD.gn +++ b/chrome/browser/web_applications/BUILD.gn
@@ -72,6 +72,8 @@ "test/test_file_utils.h", "test/test_install_finalizer.cc", "test/test_install_finalizer.h", + "test/test_pending_app_manager.cc", + "test/test_pending_app_manager.h", "test/test_system_web_app_manager.cc", "test/test_system_web_app_manager.h", "test/test_web_app_database.cc", @@ -92,6 +94,7 @@ "//base/test:test_support", "//chrome/browser", "//chrome/browser/web_applications/components", + "//components/crx_file:crx_file", "//components/sync:test_support_model", "//content/test:test_support", "//testing/gtest",
diff --git a/chrome/browser/web_applications/bookmark_apps/BUILD.gn b/chrome/browser/web_applications/bookmark_apps/BUILD.gn index eb2e00d..a0e5d37 100644 --- a/chrome/browser/web_applications/bookmark_apps/BUILD.gn +++ b/chrome/browser/web_applications/bookmark_apps/BUILD.gn
@@ -66,7 +66,6 @@ "//chrome/browser/web_applications:web_applications_on_extensions", "//chrome/browser/web_applications:web_applications_test_support", "//chrome/browser/web_applications/components", - "//chrome/browser/web_applications/components:test_support", "//chrome/browser/web_applications/extensions", "//chrome/common:constants", "//chrome/test:test_support",
diff --git a/chrome/browser/web_applications/bookmark_apps/bookmark_app_install_manager.cc b/chrome/browser/web_applications/bookmark_apps/bookmark_app_install_manager.cc index 943a04a6..15e1b8a 100644 --- a/chrome/browser/web_applications/bookmark_apps/bookmark_app_install_manager.cc +++ b/chrome/browser/web_applications/bookmark_apps/bookmark_app_install_manager.cc
@@ -170,6 +170,7 @@ helper->set_is_system_app(); break; case web_app::InstallSource::kArc: + case web_app::InstallSource::kInvalid: NOTREACHED(); break; }
diff --git a/chrome/browser/web_applications/bookmark_apps/policy/web_app_policy_manager_unittest.cc b/chrome/browser/web_applications/bookmark_apps/policy/web_app_policy_manager_unittest.cc index fe8aebb..929d0df 100644 --- a/chrome/browser/web_applications/bookmark_apps/policy/web_app_policy_manager_unittest.cc +++ b/chrome/browser/web_applications/bookmark_apps/policy/web_app_policy_manager_unittest.cc
@@ -12,12 +12,12 @@ #include "base/values.h" #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/web_applications/bookmark_apps/test_web_app_provider.h" -#include "chrome/browser/web_applications/components/externally_installed_web_app_prefs.h" +#include "chrome/browser/web_applications/components/app_registrar.h" #include "chrome/browser/web_applications/components/install_options.h" #include "chrome/browser/web_applications/components/pending_app_manager.h" #include "chrome/browser/web_applications/components/policy/web_app_policy_constants.h" -#include "chrome/browser/web_applications/components/test_pending_app_manager.h" #include "chrome/browser/web_applications/components/web_app_constants.h" +#include "chrome/browser/web_applications/test/test_pending_app_manager.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" @@ -181,21 +181,9 @@ return provider; } - std::string GenerateFakeExtensionId(const GURL& url) { - return crx_file::id_util::GenerateId("fake_app_id_for:" + url.spec()); - } - void SimulatePreviouslyInstalledApp( GURL url, InstallSource install_source) { - std::string id = GenerateFakeExtensionId(url); - extensions::ExtensionRegistry::Get(profile())->AddEnabled( - extensions::ExtensionBuilder("Dummy Name").SetID(id).Build()); - - ExternallyInstalledWebAppPrefs externally_installed_app_prefs( - profile()->GetPrefs()); - externally_installed_app_prefs.Insert(url, id, install_source); - pending_app_manager()->SimulatePreviouslyInstalledApp(url, install_source); } @@ -477,9 +465,12 @@ pending_app_manager()->uninstall_requests()); // There should be exactly 1 app remaining. - EXPECT_EQ(1u, pending_app_manager()->installed_apps().size()); - EXPECT_EQ(InstallSource::kExternalPolicy, - pending_app_manager()->installed_apps().at(kTabbedUrl)); + std::map<AppId, GURL> apps = + pending_app_manager()->registrar()->GetExternallyInstalledApps( + InstallSource::kExternalPolicy); + EXPECT_EQ(1u, apps.size()); + for (auto& it : apps) + EXPECT_EQ(it.second, kTabbedUrl); } } // namespace web_app
diff --git a/chrome/browser/web_applications/bookmark_apps/system_web_app_manager_unittest.cc b/chrome/browser/web_applications/bookmark_apps/system_web_app_manager_unittest.cc index a9b3c74f..5d83c75e 100644 --- a/chrome/browser/web_applications/bookmark_apps/system_web_app_manager_unittest.cc +++ b/chrome/browser/web_applications/bookmark_apps/system_web_app_manager_unittest.cc
@@ -15,8 +15,9 @@ #include "chrome/browser/web_applications/bookmark_apps/test_web_app_provider.h" #include "chrome/browser/web_applications/components/externally_installed_web_app_prefs.h" #include "chrome/browser/web_applications/components/pending_app_manager.h" -#include "chrome/browser/web_applications/components/test_pending_app_manager.h" #include "chrome/browser/web_applications/components/web_app_constants.h" +#include "chrome/browser/web_applications/test/test_app_registrar.h" +#include "chrome/browser/web_applications/test/test_pending_app_manager.h" #include "chrome/browser/web_applications/test/test_system_web_app_manager.h" #include "chrome/browser/web_applications/test/test_web_app_ui_delegate.h" #include "chrome/browser/web_applications/web_app_provider.h" @@ -82,14 +83,6 @@ void SimulatePreviouslyInstalledApp( GURL url, InstallSource install_source) { - std::string id = - crx_file::id_util::GenerateId("fake_app_id_for:" + url.spec()); - extensions::ExtensionRegistry::Get(profile())->AddEnabled( - extensions::ExtensionBuilder("Dummy Name").SetID(id).Build()); - - ExternallyInstalledWebAppPrefs(profile()->GetPrefs()) - .Insert(url, id, install_source); - pending_app_manager()->SimulatePreviouslyInstalledApp(url, install_source); }
diff --git a/chrome/browser/web_applications/components/BUILD.gn b/chrome/browser/web_applications/components/BUILD.gn index bad3dd00..031311e 100644 --- a/chrome/browser/web_applications/components/BUILD.gn +++ b/chrome/browser/web_applications/components/BUILD.gn
@@ -88,23 +88,6 @@ ] } -source_set("test_support") { - testonly = true - - sources = [ - "test_pending_app_manager.cc", - "test_pending_app_manager.h", - ] - - deps = [ - ":components", - "//base", - "//base/test:test_support", - "//content/public/browser", - "//url", - ] -} - source_set("unit_tests") { testonly = true @@ -126,10 +109,10 @@ deps = [ ":components", - ":test_support", "//base/test:test_support", "//chrome/app/theme:theme_resources", "//chrome/browser/web_applications:web_app_test_group", + "//chrome/browser/web_applications:web_applications_test_support", "//chrome/test:test_support", "//content/public/browser", "//skia",
diff --git a/chrome/browser/web_applications/components/app_registrar.cc b/chrome/browser/web_applications/components/app_registrar.cc index d904760d..617b5564 100644 --- a/chrome/browser/web_applications/components/app_registrar.cc +++ b/chrome/browser/web_applications/components/app_registrar.cc
@@ -4,8 +4,10 @@ #include "chrome/browser/web_applications/components/app_registrar.h" +#include "base/stl_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/web_applications/components/app_registrar_observer.h" +#include "chrome/browser/web_applications/components/externally_installed_web_app_prefs.h" #include "chrome/browser/web_applications/components/install_bounce_metric.h" namespace web_app { @@ -43,4 +45,29 @@ observer.OnAppRegistrarShutdown(); } +std::map<AppId, GURL> AppRegistrar::GetExternallyInstalledApps( + InstallSource install_source) const { + std::map<AppId, GURL> installed_apps = + ExternallyInstalledWebAppPrefs::BuildAppIdsMap(profile()->GetPrefs(), + install_source); + base::EraseIf(installed_apps, [this](const std::pair<AppId, GURL>& app) { + return !IsInstalled(app.first); + }); + + return installed_apps; +} + +base::Optional<AppId> AppRegistrar::LookupExternalAppId( + const GURL& install_url) const { + return ExternallyInstalledWebAppPrefs(profile()->GetPrefs()) + .LookupAppId(install_url); +} + +bool AppRegistrar::HasExternalAppWithInstallSource( + const AppId& app_id, + InstallSource install_source) const { + return ExternallyInstalledWebAppPrefs::HasAppIdWithInstallSource( + profile()->GetPrefs(), app_id, install_source); +} + } // namespace web_app
diff --git a/chrome/browser/web_applications/components/app_registrar.h b/chrome/browser/web_applications/components/app_registrar.h index 3b30a3c..42d3aa3 100644 --- a/chrome/browser/web_applications/components/app_registrar.h +++ b/chrome/browser/web_applications/components/app_registrar.h
@@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_APP_REGISTRAR_H_ #define CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_APP_REGISTRAR_H_ +#include <map> + #include "base/callback_forward.h" #include "base/observer_list.h" #include "chrome/browser/web_applications/components/web_app_helpers.h" @@ -16,6 +18,8 @@ class AppRegistrarObserver; +enum class InstallSource; + class AppRegistrar { public: explicit AppRegistrar(Profile* profile); @@ -51,6 +55,24 @@ // method. virtual GURL GetScopeUrlForApp(const AppId& app_id) const = 0; + // Returns the AppIds and URLs of apps externally installed from + // |install_source|. + virtual std::map<AppId, GURL> GetExternallyInstalledApps( + InstallSource install_source) const; + + // Returns the app id for |install_url| if the AppRegistrar is aware of an + // externally installed app for it. Note that the |install_url| is the URL + // that the app was installed from, which may not necessarily match the app's + // current start URL. + virtual base::Optional<AppId> LookupExternalAppId( + const GURL& install_url) const; + + // Returns whether the AppRegistrar has an externally installed app with + // |app_id| from |install_source|. + virtual bool HasExternalAppWithInstallSource( + const AppId& app_id, + web_app::InstallSource install_source) const; + // Returns the app id for which the |url| is in scope of, empty if none. virtual AppId FindAppIdForUrl(const GURL& url) const = 0;
diff --git a/chrome/browser/web_applications/components/install_options.h b/chrome/browser/web_applications/components/install_options.h index 7f3d91e..366608e 100644 --- a/chrome/browser/web_applications/components/install_options.h +++ b/chrome/browser/web_applications/components/install_options.h
@@ -29,7 +29,7 @@ GURL url; LaunchContainer launch_container = LaunchContainer::kTab; - InstallSource install_source = InstallSource::kInternal; + InstallSource install_source = InstallSource::kInvalid; // If true, a shortcut is added to the Applications folder on macOS, and Start // Menu on Linux and Windows. On Chrome OS, all installed apps show up in the
diff --git a/chrome/browser/web_applications/components/pending_app_manager.cc b/chrome/browser/web_applications/components/pending_app_manager.cc index 575bb50b..8b07ba0c6 100644 --- a/chrome/browser/web_applications/components/pending_app_manager.cc +++ b/chrome/browser/web_applications/components/pending_app_manager.cc
@@ -11,6 +11,7 @@ #include "base/bind_helpers.h" #include "base/stl_util.h" #include "base/threading/thread_task_runner_handle.h" +#include "chrome/browser/web_applications/components/app_registrar.h" #include "chrome/browser/web_applications/components/web_app_constants.h" namespace web_app { @@ -28,7 +29,8 @@ PendingAppManager::SynchronizeRequest::SynchronizeRequest( SynchronizeRequest&& other) = default; -PendingAppManager::PendingAppManager() = default; +PendingAppManager::PendingAppManager(AppRegistrar* registrar) + : registrar_(registrar) {} PendingAppManager::~PendingAppManager() = default; @@ -36,6 +38,7 @@ std::vector<InstallOptions> desired_apps_install_options, InstallSource install_source, SynchronizeCallback callback) { + DCHECK(registrar_); DCHECK(std::all_of(desired_apps_install_options.begin(), desired_apps_install_options.end(), [&install_source](const InstallOptions& install_options) { @@ -44,17 +47,20 @@ // Only one concurrent SynchronizeInstalledApps() expected per InstallSource. DCHECK(!base::Contains(synchronize_requests_, install_source)); - std::vector<GURL> current_urls = GetInstalledAppUrls(install_source); - std::sort(current_urls.begin(), current_urls.end()); + std::vector<GURL> installed_urls; + for (auto apps_it : registrar_->GetExternallyInstalledApps(install_source)) + installed_urls.push_back(apps_it.second); + + std::sort(installed_urls.begin(), installed_urls.end()); std::vector<GURL> desired_urls; - for (const auto& info : desired_apps_install_options) { - desired_urls.emplace_back(info.url); - } + for (const auto& info : desired_apps_install_options) + desired_urls.push_back(info.url); + std::sort(desired_urls.begin(), desired_urls.end()); auto urls_to_remove = - base::STLSetDifference<std::vector<GURL>>(current_urls, desired_urls); + base::STLSetDifference<std::vector<GURL>>(installed_urls, desired_urls); // Run callback immediately if there's no work to be done. if (urls_to_remove.empty() && desired_apps_install_options.empty()) {
diff --git a/chrome/browser/web_applications/components/pending_app_manager.h b/chrome/browser/web_applications/components/pending_app_manager.h index 9b94b65..87834d8 100644 --- a/chrome/browser/web_applications/components/pending_app_manager.h +++ b/chrome/browser/web_applications/components/pending_app_manager.h
@@ -22,6 +22,8 @@ enum class InstallResultCode; +class AppRegistrar; + // PendingAppManager installs, uninstalls, and updates apps. // // Implementations of this class should perform each set of operations serially @@ -45,7 +47,7 @@ using SynchronizeCallback = base::OnceCallback<void(SynchronizeResult result)>; - PendingAppManager(); + explicit PendingAppManager(AppRegistrar* registrar); virtual ~PendingAppManager(); virtual void Shutdown() = 0; @@ -78,10 +80,6 @@ virtual void UninstallApps(std::vector<GURL> uninstall_urls, const UninstallCallback& callback) = 0; - // Returns the URLs of those apps installed from |install_source|. - virtual std::vector<GURL> GetInstalledAppUrls( - InstallSource install_source) const = 0; - // Installs an app for each InstallOptions in |desired_apps_install_options| // and uninstalls any apps in GetInstalledAppUrls(install_source) that are not // in |desired_apps_install_options|'s URLs. @@ -99,14 +97,7 @@ InstallSource install_source, SynchronizeCallback callback); - // Returns the app id for |url| if the PendingAppManager is aware of it. - virtual base::Optional<AppId> LookupAppId(const GURL& url) const = 0; - - // Returns whether the PendingAppManager has installed an app with |app_id| - // from |install_source|. - virtual bool HasAppIdWithInstallSource( - const AppId& app_id, - web_app::InstallSource install_source) const = 0; + AppRegistrar* registrar() { return registrar_; } private: struct SynchronizeRequest { @@ -132,6 +123,8 @@ bool succeeded); void OnAppSynchronized(InstallSource source, bool succeeded); + AppRegistrar* registrar_; + base::flat_map<InstallSource, SynchronizeRequest> synchronize_requests_; base::WeakPtrFactory<PendingAppManager> weak_ptr_factory_{this};
diff --git a/chrome/browser/web_applications/components/pending_app_manager_unittest.cc b/chrome/browser/web_applications/components/pending_app_manager_unittest.cc index d0b59e0..9456752c 100644 --- a/chrome/browser/web_applications/components/pending_app_manager_unittest.cc +++ b/chrome/browser/web_applications/components/pending_app_manager_unittest.cc
@@ -12,13 +12,17 @@ #include "base/run_loop.h" #include "base/test/bind_test_util.h" #include "base/test/scoped_task_environment.h" -#include "chrome/browser/web_applications/components/test_pending_app_manager.h" +#include "chrome/browser/web_applications/components/app_registrar.h" #include "chrome/browser/web_applications/components/web_app_constants.h" +#include "chrome/browser/web_applications/test/test_pending_app_manager.h" #include "testing/gtest/include/gtest/gtest.h" namespace web_app { class PendingAppManagerTest : public testing::Test { + public: + PendingAppManagerTest() {} + protected: void Sync(std::vector<GURL> urls) { pending_app_manager_.ResetCounts(); @@ -49,8 +53,13 @@ EXPECT_EQ(deduped_uninstall_count, pending_app_manager_.deduped_uninstall_count()); - std::vector<GURL> urls = - pending_app_manager_.GetInstalledAppUrls(InstallSource::kInternal); + std::map<AppId, GURL> apps = + pending_app_manager_.registrar()->GetExternallyInstalledApps( + InstallSource::kInternal); + std::vector<GURL> urls; + for (auto it : apps) + urls.push_back(it.second); + std::sort(urls.begin(), urls.end()); EXPECT_EQ(installed_app_urls, urls); }
diff --git a/chrome/browser/web_applications/components/web_app_constants.h b/chrome/browser/web_applications/components/web_app_constants.h index 1364a76d..bbad365f 100644 --- a/chrome/browser/web_applications/components/web_app_constants.h +++ b/chrome/browser/web_applications/components/web_app_constants.h
@@ -73,6 +73,8 @@ // Do not remove or re-order the names, only append to the end. Their // integer values are persisted in the preferences. + kInvalid = -1, + kInternal = 0, // Installed by default on the system, such as "all such-and-such make and // model Chromebooks should have this app installed".
diff --git a/chrome/browser/web_applications/components/web_app_install_utils.cc b/chrome/browser/web_applications/components/web_app_install_utils.cc index 0a457f5..1aacdde 100644 --- a/chrome/browser/web_applications/components/web_app_install_utils.cc +++ b/chrome/browser/web_applications/components/web_app_install_utils.cc
@@ -219,6 +219,7 @@ metrics_install_source = WebappInstallSource::SYSTEM_DEFAULT; break; case InstallSource::kArc: + case InstallSource::kInvalid: NOTREACHED(); break; }
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_helper_installation_task_unittest.cc b/chrome/browser/web_applications/extensions/bookmark_app_helper_installation_task_unittest.cc index 2bb15ba..cb5a3b7d0 100644 --- a/chrome/browser/web_applications/extensions/bookmark_app_helper_installation_task_unittest.cc +++ b/chrome/browser/web_applications/extensions/bookmark_app_helper_installation_task_unittest.cc
@@ -33,6 +33,7 @@ #include "chrome/browser/web_applications/components/web_app_provider_base.h" #include "chrome/browser/web_applications/test/test_app_registrar.h" #include "chrome/browser/web_applications/test/test_data_retriever.h" +#include "chrome/browser/web_applications/test/test_install_finalizer.h" #include "chrome/common/chrome_features.h" #include "chrome/common/pref_names.h" #include "chrome/common/web_application_info.h" @@ -111,17 +112,16 @@ DISALLOW_COPY_AND_ASSIGN(TestBookmarkAppHelper); }; +web_app::AppId GetAppIdForUrl(const GURL& url) { + return web_app::TestInstallFinalizer::GetAppIdForUrl(url); +} + class TestBookmarkAppInstallFinalizer : public web_app::InstallFinalizer { public: explicit TestBookmarkAppInstallFinalizer(web_app::TestAppRegistrar* registrar) : registrar_(registrar) {} ~TestBookmarkAppInstallFinalizer() override = default; - // Returns what would be the AppId if an app is installed with |url|. - web_app::AppId GetAppIdForUrl(const GURL& url) { - return crx_file::id_util::GenerateId("fake_app_id_for:" + url.spec()); - } - void SetNextFinalizeInstallResult(const GURL& url, web_app::InstallResultCode code) { DCHECK(!base::Contains(next_finalize_install_results_, url)); @@ -178,12 +178,14 @@ std::tie(app_id, code) = next_finalize_install_results_[web_app_info.app_url]; next_finalize_install_results_.erase(web_app_info.app_url); + const GURL& url = web_app_info.app_url; base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindLambdaForTesting( - [&, app_id, code, callback = std::move(callback)]() mutable { - registrar_->AddAsInstalled(app_id); + [&, app_id, url, code, callback = std::move(callback)]() mutable { + registrar_->AddExternalApp( + app_id, {url, web_app::InstallSource::kInternal}); std::move(callback).Run(app_id, code); })); } @@ -205,7 +207,7 @@ base::BindLambdaForTesting( [&, app_id, uninstalled, callback = std::move(callback)]() mutable { if (uninstalled) - registrar_->RemoveAsInstalled(app_id); + registrar_->RemoveExternalApp(app_id); std::move(callback).Run(uninstalled); })); } @@ -295,8 +297,7 @@ void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); - registrar_ = - std::make_unique<web_app::TestAppRegistrar>(/*profile=*/nullptr); + registrar_ = std::make_unique<web_app::TestAppRegistrar>(); install_finalizer_ = std::make_unique<TestBookmarkAppInstallFinalizer>(registrar_.get()); @@ -647,7 +648,7 @@ install_finalizer()->SetNextFinalizeInstallResult( kWebAppUrl, web_app::InstallResultCode::kSuccess); install_finalizer()->SetNextCreateOsShortcutsResult( - install_finalizer()->GetAppIdForUrl(kWebAppUrl), true); + GetAppIdForUrl(kWebAppUrl), true); base::RunLoop run_loop; task->Install( @@ -689,7 +690,7 @@ install_finalizer()->SetNextFinalizeInstallResult( kWebAppUrl, web_app::InstallResultCode::kSuccess); install_finalizer()->SetNextCreateOsShortcutsResult( - install_finalizer()->GetAppIdForUrl(kWebAppUrl), true); + GetAppIdForUrl(kWebAppUrl), true); base::RunLoop run_loop; task->Install( @@ -738,7 +739,7 @@ install_finalizer()->SetNextFinalizeInstallResult( kWebAppUrl, web_app::InstallResultCode::kSuccess); install_finalizer()->SetNextCreateOsShortcutsResult( - install_finalizer()->GetAppIdForUrl(kWebAppUrl), true); + GetAppIdForUrl(kWebAppUrl), true); base::RunLoop run_loop; task->Install( @@ -796,7 +797,7 @@ install_finalizer()->SetNextFinalizeInstallResult( kWebAppUrl, web_app::InstallResultCode::kSuccess); install_finalizer()->SetNextCreateOsShortcutsResult( - install_finalizer()->GetAppIdForUrl(kWebAppUrl), true); + GetAppIdForUrl(kWebAppUrl), true); base::RunLoop run_loop; task->Install(
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_installation_task_unittest.cc b/chrome/browser/web_applications/extensions/bookmark_app_installation_task_unittest.cc index 84e8769b..e5a0f12 100644 --- a/chrome/browser/web_applications/extensions/bookmark_app_installation_task_unittest.cc +++ b/chrome/browser/web_applications/extensions/bookmark_app_installation_task_unittest.cc
@@ -30,6 +30,7 @@ #include "chrome/browser/web_applications/components/web_app_provider_base.h" #include "chrome/browser/web_applications/test/test_app_registrar.h" #include "chrome/browser/web_applications/test/test_data_retriever.h" +#include "chrome/browser/web_applications/test/test_install_finalizer.h" #include "chrome/browser/web_applications/test/test_web_app_url_loader.h" #include "chrome/browser/web_applications/web_app_install_manager.h" #include "chrome/common/chrome_features.h" @@ -93,7 +94,7 @@ // Returns what would be the AppId if an app is installed with |url|. web_app::AppId GetAppIdForUrl(const GURL& url) { - return web_app::GenerateAppIdFromURL(url); + return web_app::TestInstallFinalizer::GetAppIdForUrl(url); } void SetNextFinalizeInstallResult(const GURL& url, @@ -155,12 +156,14 @@ std::tie(app_id, code) = next_finalize_install_results_[web_app_info.app_url]; next_finalize_install_results_.erase(web_app_info.app_url); + const GURL& url = web_app_info.app_url; base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindLambdaForTesting( - [&, app_id, code, callback = std::move(callback)]() mutable { - registrar_->AddAsInstalled(app_id); + [&, app_id, url, code, callback = std::move(callback)]() mutable { + registrar_->AddExternalApp( + app_id, {url, web_app::InstallSource::kExternalPolicy}); std::move(callback).Run(app_id, code); })); } @@ -182,7 +185,7 @@ base::BindLambdaForTesting( [&, app_id, uninstalled, callback = std::move(callback)]() mutable { if (uninstalled) - registrar_->RemoveAsInstalled(app_id); + registrar_->RemoveExternalApp(app_id); std::move(callback).Run(uninstalled); })); } @@ -279,7 +282,7 @@ auto* provider = static_cast<web_app::TestWebAppProvider*>( web_app::WebAppProvider::Get(profile())); - auto registrar = std::make_unique<web_app::TestAppRegistrar>(profile()); + auto registrar = std::make_unique<web_app::TestAppRegistrar>(); registrar_ = registrar.get(); auto install_finalizer =
diff --git a/chrome/browser/web_applications/extensions/install_manager_bookmark_app_unittest.cc b/chrome/browser/web_applications/extensions/install_manager_bookmark_app_unittest.cc index 8c813c05..18204a6 100644 --- a/chrome/browser/web_applications/extensions/install_manager_bookmark_app_unittest.cc +++ b/chrome/browser/web_applications/extensions/install_manager_bookmark_app_unittest.cc
@@ -543,6 +543,7 @@ web_app::InstallOptions install_options; install_options.launch_container = web_app::LaunchContainer::kTab; + install_options.install_source = web_app::InstallSource::kInternal; const Extension* extension = InstallWebAppWithOptions(install_options); @@ -555,6 +556,7 @@ web_app::InstallOptions install_options; install_options.launch_container = web_app::LaunchContainer::kWindow; + install_options.install_source = web_app::InstallSource::kInternal; const Extension* extension = InstallWebAppWithOptions(install_options);
diff --git a/chrome/browser/web_applications/extensions/pending_bookmark_app_manager.cc b/chrome/browser/web_applications/extensions/pending_bookmark_app_manager.cc index 5c6020c..1801d5b9 100644 --- a/chrome/browser/web_applications/extensions/pending_bookmark_app_manager.cc +++ b/chrome/browser/web_applications/extensions/pending_bookmark_app_manager.cc
@@ -49,8 +49,8 @@ Profile* profile, web_app::AppRegistrar* registrar, web_app::InstallFinalizer* install_finalizer) - : profile_(profile), - registrar_(registrar), + : PendingAppManager(registrar), + profile_(profile), install_finalizer_(install_finalizer), externally_installed_app_prefs_(profile->GetPrefs()), url_loader_(std::make_unique<web_app::WebAppUrlLoader>()), @@ -69,7 +69,7 @@ return; pending_tasks_and_callbacks_.push_front(std::make_unique<TaskAndCallback>( - task_factory_.Run(profile_, registrar_, install_finalizer_, + task_factory_.Run(profile_, registrar(), install_finalizer_, std::move(install_options)), std::move(callback))); @@ -84,7 +84,7 @@ const RepeatingInstallCallback& callback) { for (auto& install_options : install_options_list) { pending_tasks_and_callbacks_.push_back(std::make_unique<TaskAndCallback>( - task_factory_.Run(profile_, registrar_, install_finalizer_, + task_factory_.Run(profile_, registrar(), install_finalizer_, std::move(install_options)), callback)); } @@ -107,31 +107,6 @@ } } -std::vector<GURL> PendingBookmarkAppManager::GetInstalledAppUrls( - web_app::InstallSource install_source) const { - std::vector<GURL> installed_apps; - for (const auto& id_and_url : - web_app::ExternallyInstalledWebAppPrefs::BuildAppIdsMap( - profile_->GetPrefs(), install_source)) { - if (registrar_->IsInstalled(id_and_url.first)) - installed_apps.push_back(id_and_url.second); - } - - return installed_apps; -} - -base::Optional<web_app::AppId> PendingBookmarkAppManager::LookupAppId( - const GURL& url) const { - return externally_installed_app_prefs_.LookupAppId(url); -} - -bool PendingBookmarkAppManager::HasAppIdWithInstallSource( - const web_app::AppId& app_id, - web_app::InstallSource install_source) const { - return web_app::ExternallyInstalledWebAppPrefs::HasAppIdWithInstallSource( - profile_->GetPrefs(), app_id, install_source); -} - void PendingBookmarkAppManager::SetTaskFactoryForTesting( TaskFactory task_factory) { task_factory_ = std::move(task_factory); @@ -173,7 +148,7 @@ return; } - if (registrar_->IsInstalled(app_id.value())) { + if (registrar()->IsInstalled(app_id.value())) { if (install_options.wait_for_windows_closed && GetUiDelegate().GetNumWindowsForApp(app_id.value()) != 0) { GetUiDelegate().NotifyOnAllAppWindowsClosed( @@ -204,7 +179,7 @@ // The app is not installed, but it might have been previously uninstalled // by the user. If that's the case, don't install it again unless // |override_previous_user_uninstall| is true. - if (registrar_->WasExternalAppUninstalledByUser(app_id.value()) && + if (registrar()->WasExternalAppUninstalledByUser(app_id.value()) && !install_options.override_previous_user_uninstall) { std::move(front->callback) .Run(install_options.url,
diff --git a/chrome/browser/web_applications/extensions/pending_bookmark_app_manager.h b/chrome/browser/web_applications/extensions/pending_bookmark_app_manager.h index 662df6b9..e62ee81 100644 --- a/chrome/browser/web_applications/extensions/pending_bookmark_app_manager.h +++ b/chrome/browser/web_applications/extensions/pending_bookmark_app_manager.h
@@ -65,12 +65,6 @@ const RepeatingInstallCallback& callback) override; void UninstallApps(std::vector<GURL> uninstall_urls, const UninstallCallback& callback) override; - std::vector<GURL> GetInstalledAppUrls( - web_app::InstallSource install_source) const override; - base::Optional<web_app::AppId> LookupAppId(const GURL& url) const override; - bool HasAppIdWithInstallSource( - const web_app::AppId& app_id, - web_app::InstallSource install_source) const override; void SetTaskFactoryForTesting(TaskFactory task_factory); void SetUrlLoaderForTesting( @@ -98,7 +92,6 @@ void CurrentInstallationFinished(const base::Optional<std::string>& app_id); Profile* profile_; - web_app::AppRegistrar* registrar_; web_app::InstallFinalizer* install_finalizer_; web_app::ExternallyInstalledWebAppPrefs externally_installed_app_prefs_;
diff --git a/chrome/browser/web_applications/extensions/pending_bookmark_app_manager_unittest.cc b/chrome/browser/web_applications/extensions/pending_bookmark_app_manager_unittest.cc index 06a3c25be..6dc8f18 100644 --- a/chrome/browser/web_applications/extensions/pending_bookmark_app_manager_unittest.cc +++ b/chrome/browser/web_applications/extensions/pending_bookmark_app_manager_unittest.cc
@@ -72,7 +72,7 @@ } std::string GenerateFakeAppId(const GURL& url) { - return std::string("fake_app_id_for:") + url.spec(); + return web_app::TestInstallFinalizer::GetAppIdForUrl(url); } class TestBookmarkAppInstallationTaskFactory { @@ -146,14 +146,14 @@ factory_->GetNextInstallationTaskResult(install_options_.url); if (result_code == web_app::InstallResultCode::kSuccess) { app_id = GenerateFakeAppId(install_options_.url); - externally_installed_app_prefs_.Insert(install_options_.url, - app_id.value(), + registrar_->AddExternalApp( + *app_id, {install_options_.url, install_options_.install_source}); + externally_installed_app_prefs_.Insert(install_options_.url, *app_id, install_options_.install_source); const bool is_placeholder = (url_loaded_result != web_app::WebAppUrlLoader::Result::kUrlLoaded); externally_installed_app_prefs_.SetIsPlaceholder(install_options_.url, is_placeholder); - registrar_->AddAsInstalled(app_id.value()); } std::move(callback).Run({result_code, app_id}); } @@ -184,7 +184,7 @@ void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); - registrar_ = std::make_unique<web_app::TestAppRegistrar>(profile()); + registrar_ = std::make_unique<web_app::TestAppRegistrar>(); ui_delegate_ = std::make_unique<web_app::TestWebAppUiDelegate>(); install_finalizer_ = std::make_unique<web_app::TestInstallFinalizer>(); task_factory_ = std::make_unique<TestBookmarkAppInstallationTaskFactory>(); @@ -1018,8 +1018,7 @@ } // Simulate the extension for the app getting uninstalled. - const std::string app_id = GenerateFakeAppId(kFooWebAppUrl); - registrar()->RemoveAsInstalled(app_id); + registrar()->RemoveExternalAppByInstallUrl(kFooWebAppUrl); // Try to install the app again. { @@ -1058,8 +1057,7 @@ // Simulate external extension for the app getting uninstalled by the user. const std::string app_id = GenerateFakeAppId(kFooWebAppUrl); - registrar()->AddAsExternalAppUninstalledByUser(app_id); - registrar()->RemoveAsInstalled(app_id); + registrar()->SimulateExternalAppUninstalledByUser(app_id); // The extension was uninstalled by the user. Installing again should succeed // or fail depending on whether we set override_previous_user_uninstall. We @@ -1096,7 +1094,9 @@ TEST_F(PendingBookmarkAppManagerTest, UninstallApps_Succeeds) { auto pending_app_manager = GetPendingBookmarkAppManagerWithTestMocks(); - registrar()->AddAsInstalled(GenerateFakeAppId(kFooWebAppUrl)); + registrar()->AddExternalApp( + GenerateFakeAppId(kFooWebAppUrl), + {kFooWebAppUrl, web_app::InstallSource::kExternalPolicy}); install_finalizer()->SetNextUninstallExternalWebAppResult(kFooWebAppUrl, true); @@ -1124,8 +1124,12 @@ TEST_F(PendingBookmarkAppManagerTest, UninstallApps_Multiple) { auto pending_app_manager = GetPendingBookmarkAppManagerWithTestMocks(); - registrar()->AddAsInstalled(GenerateFakeAppId(kFooWebAppUrl)); - registrar()->AddAsInstalled(GenerateFakeAppId(kBarWebAppUrl)); + registrar()->AddExternalApp( + GenerateFakeAppId(kFooWebAppUrl), + {kFooWebAppUrl, web_app::InstallSource::kExternalPolicy}); + registrar()->AddExternalApp( + GenerateFakeAppId(kBarWebAppUrl), + {kFooWebAppUrl, web_app::InstallSource::kExternalPolicy}); install_finalizer()->SetNextUninstallExternalWebAppResult(kFooWebAppUrl, true);
diff --git a/chrome/browser/web_applications/system_web_app_manager.cc b/chrome/browser/web_applications/system_web_app_manager.cc index b247cd8..a709f27 100644 --- a/chrome/browser/web_applications/system_web_app_manager.cc +++ b/chrome/browser/web_applications/system_web_app_manager.cc
@@ -13,6 +13,7 @@ #include "base/strings/string_number_conversions.h" #include "base/version.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/web_applications/components/app_registrar.h" #include "chrome/browser/web_applications/components/web_app_constants.h" #include "chrome/browser/web_applications/components/web_app_ui_delegate.h" #include "chrome/common/chrome_features.h" @@ -106,14 +107,19 @@ if (!NeedsUpdate()) return; - std::vector<GURL> installed_apps = pending_app_manager_->GetInstalledAppUrls( - InstallSource::kSystemInstalled); + std::map<AppId, GURL> installed_apps = + pending_app_manager_->registrar()->GetExternallyInstalledApps( + InstallSource::kSystemInstalled); std::set<SystemAppType> installed_app_types; - for (const auto& it : system_app_infos_) { - if (std::find(installed_apps.begin(), installed_apps.end(), - it.second.install_url) != installed_apps.end()) - installed_app_types.insert(it.first); + for (const auto& type_and_info : system_app_infos_) { + const GURL& install_url = type_and_info.second.install_url; + if (std::find_if(installed_apps.begin(), installed_apps.end(), + [install_url](const std::pair<AppId, GURL> id_and_url) { + return id_and_url.second == install_url; + }) != installed_apps.end()) { + installed_app_types.insert(type_and_info.first); + } } std::vector<InstallOptions> install_options_list; @@ -149,11 +155,12 @@ if (app_url_it == system_app_infos_.end()) return base::Optional<AppId>(); - return pending_app_manager_->LookupAppId(app_url_it->second.install_url); + return pending_app_manager_->registrar()->LookupExternalAppId( + app_url_it->second.install_url); } bool SystemWebAppManager::IsSystemWebApp(const AppId& app_id) const { - return pending_app_manager_->HasAppIdWithInstallSource( + return pending_app_manager_->registrar()->HasExternalAppWithInstallSource( app_id, InstallSource::kSystemInstalled); } @@ -217,9 +224,18 @@ // installed. if (!type_and_info.second.migration_source.empty() && !base::Contains(already_installed, type_and_info.first)) { - ui_delegate_->MigrateOSAttributes( - type_and_info.second.migration_source, - *GetAppIdForSystemApp(type_and_info.first)); + base::Optional<AppId> system_app_id = + GetAppIdForSystemApp(type_and_info.first); + // TODO(crbug.com/977466): Replace with a DCHECK once we understand why + // this is happening. + if (!system_app_id) { + LOG(ERROR) << "System App Type " + << static_cast<int>(type_and_info.first) + << " could not be found when running migration."; + continue; + } + ui_delegate_->MigrateOSAttributes(type_and_info.second.migration_source, + *system_app_id); } } }
diff --git a/chrome/browser/web_applications/test/test_app_registrar.cc b/chrome/browser/web_applications/test/test_app_registrar.cc index 4b3c6c6..3733e4a 100644 --- a/chrome/browser/web_applications/test/test_app_registrar.cc +++ b/chrome/browser/web_applications/test/test_app_registrar.cc
@@ -10,22 +10,30 @@ namespace web_app { -TestAppRegistrar::TestAppRegistrar(Profile* profile) : AppRegistrar(profile) {} +TestAppRegistrar::TestAppRegistrar() : AppRegistrar(nullptr) {} TestAppRegistrar::~TestAppRegistrar() = default; -void TestAppRegistrar::AddAsInstalled(const AppId& app_id) { - installed_apps_.insert(app_id); +void TestAppRegistrar::AddExternalApp(const AppId& app_id, + const AppInfo& info) { + installed_apps_[app_id] = info; } -void TestAppRegistrar::RemoveAsInstalled(const AppId& app_id) { +void TestAppRegistrar::RemoveExternalApp(const AppId& app_id) { DCHECK(base::Contains(installed_apps_, app_id)); installed_apps_.erase(app_id); } -void TestAppRegistrar::AddAsExternalAppUninstalledByUser(const AppId& app_id) { - DCHECK(!base::Contains(uninstalled_external_apps_, app_id)); - uninstalled_external_apps_.insert(app_id); +void TestAppRegistrar::RemoveExternalAppByInstallUrl(const GURL& install_url) { + RemoveExternalApp(*LookupExternalAppId(install_url)); +} + +void TestAppRegistrar::SimulateExternalAppUninstalledByUser( + const AppId& app_id) { + DCHECK(!base::Contains(user_uninstalled_external_apps_, app_id)); + user_uninstalled_external_apps_.insert(app_id); + if (base::Contains(installed_apps_, app_id)) + RemoveExternalApp(app_id); } void TestAppRegistrar::Init(base::OnceClosure callback) {} @@ -41,7 +49,7 @@ bool TestAppRegistrar::WasExternalAppUninstalledByUser( const AppId& app_id) const { - return base::Contains(uninstalled_external_apps_, app_id); + return base::Contains(user_uninstalled_external_apps_, app_id); } bool TestAppRegistrar::HasScopeUrl(const AppId& app_id) const { @@ -54,6 +62,37 @@ return GURL(); } +std::map<AppId, GURL> TestAppRegistrar::GetExternallyInstalledApps( + InstallSource install_source) const { + std::map<AppId, GURL> apps; + for (auto& id_and_info : installed_apps_) { + if (id_and_info.second.source == install_source) + apps[id_and_info.first] = id_and_info.second.install_url; + } + + return apps; +} + +base::Optional<AppId> TestAppRegistrar::LookupExternalAppId( + const GURL& install_url) const { + auto it = std::find_if(installed_apps_.begin(), installed_apps_.end(), + [install_url](const auto& app_it) { + return app_it.second.install_url == install_url; + }); + return it == installed_apps_.end() ? base::Optional<AppId>() : it->first; +} + +bool TestAppRegistrar::HasExternalAppWithInstallSource( + const AppId& app_id, + InstallSource install_source) const { + auto it = std::find_if(installed_apps_.begin(), installed_apps_.end(), + [app_id, install_source](const auto& app_it) { + return app_it.first == app_id && + app_it.second.source == install_source; + }); + return it != installed_apps_.end(); +} + AppId TestAppRegistrar::FindAppIdForUrl(const GURL& url) const { NOTIMPLEMENTED(); return AppId();
diff --git a/chrome/browser/web_applications/test/test_app_registrar.h b/chrome/browser/web_applications/test/test_app_registrar.h index d6b39bb..0e08417 100644 --- a/chrome/browser/web_applications/test/test_app_registrar.h +++ b/chrome/browser/web_applications/test/test_app_registrar.h
@@ -7,24 +7,35 @@ #include <set> +#include "base/optional.h" #include "chrome/browser/web_applications/components/app_registrar.h" +#include "chrome/browser/web_applications/components/web_app_constants.h" #include "chrome/browser/web_applications/components/web_app_helpers.h" +#include "url/gurl.h" namespace web_app { class TestAppRegistrar : public AppRegistrar { public: - explicit TestAppRegistrar(Profile* profile); + struct AppInfo { + GURL install_url; + InstallSource source = InstallSource::kInvalid; + }; + + TestAppRegistrar(); ~TestAppRegistrar() override; - // Adds |app_id| to the map of installed apps. - void AddAsInstalled(const AppId& app_id); + // Adds |url| to the map of installed apps and returns the generated AppId. + void AddExternalApp(const AppId& app_id, const AppInfo& info); - // Removes |app_id| from the map of installed apps. - void RemoveAsInstalled(const AppId& app_id); + // Removes an app from the map of installed apps. + void RemoveExternalApp(const AppId& app_id); + void RemoveExternalAppByInstallUrl(const GURL& install_url); - // Adds |app_id| to the map of external extensions uninstalled by the user. - void AddAsExternalAppUninstalledByUser(const AppId& app_id); + // Uninstall the app and add |app_id| to the map of external extensions + // uninstalled by the user. May be called on an app that isn't installed to + // simulate that the app was uninstalled previously. + void SimulateExternalAppUninstalledByUser(const AppId& app_id); // AppRegistrar void Init(base::OnceClosure callback) override; @@ -33,12 +44,19 @@ bool WasExternalAppUninstalledByUser(const AppId& app_id) const override; bool HasScopeUrl(const AppId& app_id) const override; GURL GetScopeUrlForApp(const AppId& app_id) const override; + std::map<AppId, GURL> GetExternallyInstalledApps( + InstallSource install_source) const override; + base::Optional<AppId> LookupExternalAppId( + const GURL& install_url) const override; + bool HasExternalAppWithInstallSource( + const AppId& app_id, + InstallSource install_source) const override; AppId FindAppIdForUrl(const GURL& url) const override; int CountUserInstalledApps() const override; private: - std::set<AppId> installed_apps_; - std::set<AppId> uninstalled_external_apps_; + std::map<AppId, AppInfo> installed_apps_; + std::set<AppId> user_uninstalled_external_apps_; }; } // namespace web_app
diff --git a/chrome/browser/web_applications/test/test_install_finalizer.cc b/chrome/browser/web_applications/test/test_install_finalizer.cc index 8f58bf12..4521912 100644 --- a/chrome/browser/web_applications/test/test_install_finalizer.cc +++ b/chrome/browser/web_applications/test/test_install_finalizer.cc
@@ -12,9 +12,15 @@ #include "chrome/browser/web_applications/components/web_app_constants.h" #include "chrome/browser/web_applications/components/web_app_helpers.h" #include "chrome/common/web_application_info.h" +#include "components/crx_file/id_util.h" namespace web_app { +// static +AppId TestInstallFinalizer::GetAppIdForUrl(const GURL& url) { + return GenerateAppIdFromURL(url); +} + TestInstallFinalizer::TestInstallFinalizer() {} TestInstallFinalizer::~TestInstallFinalizer() = default; @@ -23,7 +29,7 @@ const WebApplicationInfo& web_app_info, const FinalizeOptions& options, InstallFinalizedCallback callback) { - AppId app_id = GenerateAppIdFromURL(web_app_info.app_url); + AppId app_id = GetAppIdForUrl(web_app_info.app_url); if (next_app_id_.has_value()) { app_id = next_app_id_.value(); next_app_id_.reset();
diff --git a/chrome/browser/web_applications/test/test_install_finalizer.h b/chrome/browser/web_applications/test/test_install_finalizer.h index ddff3d6..6cf9fa95 100644 --- a/chrome/browser/web_applications/test/test_install_finalizer.h +++ b/chrome/browser/web_applications/test/test_install_finalizer.h
@@ -18,6 +18,9 @@ class TestInstallFinalizer final : public InstallFinalizer { public: + // Returns what would be the AppId if an app is installed with |url|. + static AppId GetAppIdForUrl(const GURL& url); + TestInstallFinalizer(); ~TestInstallFinalizer() override;
diff --git a/chrome/browser/web_applications/components/test_pending_app_manager.cc b/chrome/browser/web_applications/test/test_pending_app_manager.cc similarity index 68% rename from chrome/browser/web_applications/components/test_pending_app_manager.cc rename to chrome/browser/web_applications/test/test_pending_app_manager.cc index 3424376a..5892ee2 100644 --- a/chrome/browser/web_applications/components/test_pending_app_manager.cc +++ b/chrome/browser/web_applications/test/test_pending_app_manager.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/web_applications/components/test_pending_app_manager.h" +#include "chrome/browser/web_applications/test/test_pending_app_manager.h" #include <string> #include <utility> @@ -13,19 +13,24 @@ #include "base/test/bind_test_util.h" #include "base/threading/sequenced_task_runner_handle.h" #include "chrome/browser/web_applications/components/web_app_constants.h" +#include "chrome/browser/web_applications/test/test_app_registrar.h" +#include "chrome/browser/web_applications/test/test_install_finalizer.h" #include "url/gurl.h" namespace web_app { TestPendingAppManager::TestPendingAppManager() - : deduped_install_count_(0), deduped_uninstall_count_(0) {} + : PendingAppManager(®istrar_), + deduped_install_count_(0), + deduped_uninstall_count_(0) {} TestPendingAppManager::~TestPendingAppManager() = default; void TestPendingAppManager::SimulatePreviouslyInstalledApp( const GURL& url, InstallSource install_source) { - installed_apps_[url] = install_source; + registrar_.AddExternalApp(TestInstallFinalizer::GetAppIdForUrl(url), + {url, install_source}); } void TestPendingAppManager::SetInstallResultCode( @@ -43,18 +48,18 @@ FROM_HERE, base::BindLambdaForTesting([this, weak_ptr, install_options, result_code, callback = std::move(callback)]() mutable { + const GURL& url = install_options.url; // Use a WeakPtr to be able to simulate the Install callback running // after PendingAppManager gets deleted. if (weak_ptr) { - auto i = installed_apps_.find(install_options.url); - if (i == installed_apps_.end()) { - installed_apps_[install_options.url] = - install_options.install_source; + if (!registrar_.LookupExternalAppId(url)) { + registrar_.AddExternalApp(TestInstallFinalizer::GetAppIdForUrl(url), + {url, install_options.install_source}); deduped_install_count_++; } install_requests_.push_back(install_options); } - std::move(std::move(callback)).Run(install_options.url, result_code); + std::move(std::move(callback)).Run(url, result_code); })); } @@ -73,9 +78,9 @@ FROM_HERE, base::BindLambdaForTesting([this, weak_ptr, url, callback]() { if (weak_ptr) { - auto i = installed_apps_.find(url); - if (i != installed_apps_.end()) { - installed_apps_.erase(i); + base::Optional<AppId> app_id = registrar_.LookupExternalAppId(url); + if (app_id) { + registrar_.RemoveExternalApp(*app_id); deduped_uninstall_count_++; } uninstall_requests_.push_back(url); @@ -85,26 +90,4 @@ } } -std::vector<GURL> TestPendingAppManager::GetInstalledAppUrls( - InstallSource install_source) const { - std::vector<GURL> urls; - for (auto& it : installed_apps_) { - if (it.second == install_source) { - urls.emplace_back(it.first); - } - } - return urls; -} - -base::Optional<AppId> TestPendingAppManager::LookupAppId( - const GURL& url) const { - return base::Optional<std::string>(); -} - -bool TestPendingAppManager::HasAppIdWithInstallSource( - const AppId& app_id, - web_app::InstallSource install_source) const { - return false; -} - } // namespace web_app
diff --git a/chrome/browser/web_applications/components/test_pending_app_manager.h b/chrome/browser/web_applications/test/test_pending_app_manager.h similarity index 76% rename from chrome/browser/web_applications/components/test_pending_app_manager.h rename to chrome/browser/web_applications/test/test_pending_app_manager.h index 6a0f202..7a651e8f 100644 --- a/chrome/browser/web_applications/components/test_pending_app_manager.h +++ b/chrome/browser/web_applications/test/test_pending_app_manager.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_WEB_APPLICATIONS_COMPONENTS_TEST_PENDING_APP_MANAGER_H_ -#define CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_TEST_PENDING_APP_MANAGER_H_ +#ifndef CHROME_BROWSER_WEB_APPLICATIONS_TEST_TEST_PENDING_APP_MANAGER_H_ +#define CHROME_BROWSER_WEB_APPLICATIONS_TEST_TEST_PENDING_APP_MANAGER_H_ #include <map> #include <string> @@ -11,10 +11,13 @@ #include "base/macros.h" #include "chrome/browser/web_applications/components/pending_app_manager.h" +#include "chrome/browser/web_applications/test/test_app_registrar.h" #include "url/gurl.h" namespace web_app { +class TestAppRegistrar; + class TestPendingAppManager : public PendingAppManager { public: TestPendingAppManager(); @@ -39,10 +42,6 @@ deduped_uninstall_count_ = 0; } - const std::map<GURL, InstallSource>& installed_apps() const { - return installed_apps_; - } - void SimulatePreviouslyInstalledApp(const GURL& url, InstallSource install_source); @@ -55,12 +54,6 @@ const RepeatingInstallCallback& callback) override; void UninstallApps(std::vector<GURL> uninstall_urls, const UninstallCallback& callback) override; - std::vector<GURL> GetInstalledAppUrls( - InstallSource install_source) const override; - base::Optional<AppId> LookupAppId(const GURL& url) const override; - bool HasAppIdWithInstallSource( - const AppId& app_id, - web_app::InstallSource install_source) const override; void Shutdown() override {} private: @@ -68,12 +61,14 @@ std::vector<InstallOptions> install_requests_; std::vector<GURL> uninstall_requests_; + // TODO(calamity): Remove and replace with TestAppRegistrar methods. int deduped_install_count_; int deduped_uninstall_count_; - std::map<GURL, InstallSource> installed_apps_; InstallResultCode install_result_code_ = InstallResultCode::kSuccess; + TestAppRegistrar registrar_; + base::WeakPtrFactory<TestPendingAppManager> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(TestPendingAppManager); @@ -81,4 +76,4 @@ } // namespace web_app -#endif // CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_TEST_PENDING_APP_MANAGER_H_ +#endif // CHROME_BROWSER_WEB_APPLICATIONS_TEST_TEST_PENDING_APP_MANAGER_H_
diff --git a/chrome/browser/web_applications/web_app_install_manager_unittest.cc b/chrome/browser/web_applications/web_app_install_manager_unittest.cc index 5d50bdd..89fd019 100644 --- a/chrome/browser/web_applications/web_app_install_manager_unittest.cc +++ b/chrome/browser/web_applications/web_app_install_manager_unittest.cc
@@ -37,7 +37,7 @@ void SetUp() override { WebAppTest::SetUp(); - registrar_ = std::make_unique<TestAppRegistrar>(profile()); + registrar_ = std::make_unique<TestAppRegistrar>(); install_finalizer_ = std::make_unique<TestInstallFinalizer>();
diff --git a/chrome/browser/web_applications/web_app_install_task.cc b/chrome/browser/web_applications/web_app_install_task.cc index d441d6c..a475c72 100644 --- a/chrome/browser/web_applications/web_app_install_task.cc +++ b/chrome/browser/web_applications/web_app_install_task.cc
@@ -369,6 +369,7 @@ finalize_options.source = InstallFinalizer::Source::kSystemInstalled; break; case InstallSource::kArc: + case InstallSource::kInvalid: NOTREACHED(); break; }
diff --git a/chrome/renderer/autofill/autofill_renderer_browsertest.cc b/chrome/renderer/autofill/autofill_renderer_browsertest.cc index 36d08e68..c124faa 100644 --- a/chrome/renderer/autofill/autofill_renderer_browsertest.cc +++ b/chrome/renderer/autofill/autofill_renderer_browsertest.cc
@@ -79,7 +79,7 @@ void FormSubmitted(const FormData& form, bool known_success, - SubmissionSource source) override {} + mojom::SubmissionSource source) override {} void TextFieldDidChange(const FormData& form, const FormFieldData& field,
diff --git a/chrome/renderer/autofill/form_autocomplete_browsertest.cc b/chrome/renderer/autofill/form_autocomplete_browsertest.cc index 14ae59c..4b55c11 100644 --- a/chrome/renderer/autofill/form_autocomplete_browsertest.cc +++ b/chrome/renderer/autofill/form_autocomplete_browsertest.cc
@@ -30,6 +30,8 @@ namespace autofill { +using mojom::SubmissionSource; + namespace { class FakeContentAutofillDriver : public mojom::AutofillDriver {
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 28ff84d..6114f0fd 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -3039,6 +3039,7 @@ "../browser/sessions/restore_on_startup_policy_handler_unittest.cc", "../browser/sessions/session_common_utils_unittest.cc", "../browser/sharing/sharing_fcm_handler_unittest.cc", + "../browser/sharing/sharing_service_unittest.cc", "../browser/sharing/sharing_sync_preference_unittest.cc", "../browser/sharing/vapid_key_manager_unittest.cc", "../browser/shell_integration_win_unittest.cc",
diff --git a/chrome/test/data/policy/policy_test_cases.json b/chrome/test/data/policy/policy_test_cases.json index 8fd9782..2d65685f 100644 --- a/chrome/test/data/policy/policy_test_cases.json +++ b/chrome/test/data/policy/policy_test_cases.json
@@ -1013,11 +1013,15 @@ "KerberosAccounts": [ { "principal": "user1@realm", - "password": "password1" + "password": "password1", + "remember_password": true }, { - "principal": "user2@realm", - "remember_password": true, + "principal": "${LOGIN_EMAIL}" + }, + { + "principal": "${LOGIN_ID}", + "password": "${PASSWORD}", "krb5conf": [ "line1", "line2"
diff --git a/chrome/test/data/webui/settings/settings_ui_browsertest.js b/chrome/test/data/webui/settings/settings_ui_browsertest.js index 016e899dc..15d38fbf 100644 --- a/chrome/test/data/webui/settings/settings_ui_browsertest.js +++ b/chrome/test/data/webui/settings/settings_ui_browsertest.js
@@ -26,7 +26,7 @@ // and several times that in a Debug build. See https://crbug.com/558434 // and http://crbug.com/711256. -GEN('#if !defined(NDEBUG) || defined(OS_MACOSX) || defined(OS_WINDOWS)'); +GEN('#if !defined(NDEBUG) || defined(OS_MACOSX)'); GEN('#define MAYBE_All DISABLED_All'); GEN('#else'); GEN('#define MAYBE_All All');
diff --git a/components/autofill/android/BUILD.gn b/components/autofill/android/BUILD.gn index 7bdc410..2c2b8a5e 100644 --- a/components/autofill/android/BUILD.gn +++ b/components/autofill/android/BUILD.gn
@@ -97,15 +97,10 @@ srcjar_deps = [ ":autofill_core_browser_java_enums" ] } -java_cpp_enum("autofill_core_common_java_enums") { - sources = [ - "../core/common/submission_source.h", - ] -} - android_library("provider_java") { deps = [ "//base:base_java", + "//components/autofill/core/common/mojom:mojo_types_java", "//content/public/android:content_java", "//third_party/android_deps:com_android_support_support_annotations_java", ] @@ -114,7 +109,6 @@ "java/src/org/chromium/components/autofill/FormData.java", "java/src/org/chromium/components/autofill/FormFieldData.java", ] - srcjar_deps = [ ":autofill_core_common_java_enums" ] } generate_jni("jni_headers") {
diff --git a/components/autofill/android/autofill_provider_android.cc b/components/autofill/android/autofill_provider_android.cc index a08b4a3..a16cceb 100644 --- a/components/autofill/android/autofill_provider_android.cc +++ b/components/autofill/android/autofill_provider_android.cc
@@ -28,6 +28,8 @@ namespace autofill { +using mojom::SubmissionSource; + AutofillProviderAndroid::AutofillProviderAndroid( const JavaRef<jobject>& jcaller, content::WebContents* web_contents)
diff --git a/components/autofill/android/autofill_provider_android.h b/components/autofill/android/autofill_provider_android.h index 457be94..d99e491 100644 --- a/components/autofill/android/autofill_provider_android.h +++ b/components/autofill/android/autofill_provider_android.h
@@ -49,7 +49,7 @@ void OnFormSubmitted(AutofillHandlerProxy* handler, const FormData& form, bool known_success, - SubmissionSource source) override; + mojom::SubmissionSource source) override; void OnFocusNoLongerOnForm(AutofillHandlerProxy* handler) override; void OnFocusOnFormField(AutofillHandlerProxy* handler, const FormData& form, @@ -68,7 +68,7 @@ void OnAutofillAvailable(JNIEnv* env, jobject jcaller, jobject form_data); private: - void FireSuccessfulSubmission(SubmissionSource source); + void FireSuccessfulSubmission(mojom::SubmissionSource source); void OnFocusChanged(bool focus_on_form, size_t index, const gfx::RectF& bounding_box); @@ -100,7 +100,7 @@ content::WebContents* web_contents_; bool check_submission_; // Valid only if check_submission_ is true. - SubmissionSource pending_submission_source_; + mojom::SubmissionSource pending_submission_source_; base::WeakPtr<AutofillHandlerProxy> handler_for_testing_;
diff --git a/components/autofill/content/browser/content_autofill_driver.cc b/components/autofill/content/browser/content_autofill_driver.cc index b5d6c78..de4f138 100644 --- a/components/autofill/content/browser/content_autofill_driver.cc +++ b/components/autofill/content/browser/content_autofill_driver.cc
@@ -189,7 +189,7 @@ void ContentAutofillDriver::FormSubmitted(const FormData& form, bool known_success, - SubmissionSource source) { + mojom::SubmissionSource source) { autofill_handler_->OnFormSubmitted(form, known_success, source); }
diff --git a/components/autofill/content/browser/content_autofill_driver.h b/components/autofill/content/browser/content_autofill_driver.h index b540fc96..59c2b9d 100644 --- a/components/autofill/content/browser/content_autofill_driver.h +++ b/components/autofill/content/browser/content_autofill_driver.h
@@ -77,7 +77,7 @@ base::TimeTicks timestamp) override; void FormSubmitted(const FormData& form, bool known_success, - SubmissionSource source) override; + mojom::SubmissionSource source) override; void TextFieldDidChange(const FormData& form, const FormFieldData& field, const gfx::RectF& bounding_box,
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc index 83e9a6d5..00050245c 100644 --- a/components/autofill/content/renderer/autofill_agent.cc +++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -81,6 +81,8 @@ namespace autofill { +using mojom::SubmissionSource; + namespace { // Time to wait, in ms, o ensure that only a single select change will be acted
diff --git a/components/autofill/content/renderer/autofill_agent.h b/components/autofill/content/renderer/autofill_agent.h index 66a009e..4f47f065 100644 --- a/components/autofill/content/renderer/autofill_agent.h +++ b/components/autofill/content/renderer/autofill_agent.h
@@ -106,7 +106,7 @@ ElementChangeSource source) override; void OnProbablyFormSubmitted() override; void OnFormSubmitted(const blink::WebFormElement& form) override; - void OnInferredFormSubmission(SubmissionSource source) override; + void OnInferredFormSubmission(mojom::SubmissionSource source) override; void AddFormObserver(Observer* observer); void RemoveFormObserver(Observer* observer); @@ -171,10 +171,10 @@ // Fires Mojo messages for a given form submission. void FireHostSubmitEvents(const blink::WebFormElement& form, bool known_success, - SubmissionSource source); + mojom::SubmissionSource source); void FireHostSubmitEvents(const FormData& form_data, bool known_success, - SubmissionSource source); + mojom::SubmissionSource source); // Shuts the AutofillAgent down on RenderFrame deletion. Safe to call multiple // times.
diff --git a/components/autofill/content/renderer/form_autofill_util.cc b/components/autofill/content/renderer/form_autofill_util.cc index 01ea744..9592494d 100644 --- a/components/autofill/content/renderer/form_autofill_util.cc +++ b/components/autofill/content/renderer/form_autofill_util.cc
@@ -31,7 +31,6 @@ #include "components/autofill/core/common/autofill_regexes.h" #include "components/autofill/core/common/autofill_switches.h" #include "components/autofill/core/common/autofill_util.h" -#include "components/autofill/core/common/button_title_type.h" #include "components/autofill/core/common/form_data.h" #include "components/autofill/core/common/form_field_data.h" #include "third_party/blink/public/platform/url_conversion.h" @@ -49,7 +48,6 @@ #include "third_party/blink/public/web/web_option_element.h" #include "third_party/blink/public/web/web_select_element.h" -using autofill::FormFieldData; using blink::WebAutofillState; using blink::WebDocument; using blink::WebElement; @@ -66,6 +64,9 @@ using blink::WebVector; namespace autofill { + +using mojom::ButtonTitleType; + namespace form_util { const size_t kMaxParseableFields = 200;
diff --git a/components/autofill/content/renderer/form_autofill_util_browsertest.cc b/components/autofill/content/renderer/form_autofill_util_browsertest.cc index c10b000d..18df823 100644 --- a/components/autofill/content/renderer/form_autofill_util_browsertest.cc +++ b/components/autofill/content/renderer/form_autofill_util_browsertest.cc
@@ -21,6 +21,7 @@ #include "third_party/blink/public/web/web_select_element.h" using autofill::FormFieldData; +using autofill::mojom::ButtonTitleType; using blink::WebDocument; using blink::WebElement; using blink::WebFormControlElement; @@ -292,17 +293,16 @@ autofill::form_util::InferButtonTitlesForTesting(form_target); autofill::ButtonTitleList expected = { {base::UTF8ToUTF16("Clear field"), - autofill::ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE}, + ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE}, {base::UTF8ToUTF16("Show password"), - autofill::ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE}, + ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE}, {base::UTF8ToUTF16("Sign Up"), - autofill::ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE}, + ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE}, {base::UTF8ToUTF16("Register"), - autofill::ButtonTitleType::BUTTON_ELEMENT_BUTTON_TYPE}, - {base::UTF8ToUTF16("Create account"), - autofill::ButtonTitleType::HYPERLINK}, - {base::UTF8ToUTF16("Join"), autofill::ButtonTitleType::DIV}, - {base::UTF8ToUTF16("Start"), autofill::ButtonTitleType::SPAN}}; + ButtonTitleType::BUTTON_ELEMENT_BUTTON_TYPE}, + {base::UTF8ToUTF16("Create account"), ButtonTitleType::HYPERLINK}, + {base::UTF8ToUTF16("Join"), ButtonTitleType::DIV}, + {base::UTF8ToUTF16("Start"), ButtonTitleType::SPAN}}; EXPECT_EQ(expected, actual); } @@ -361,11 +361,11 @@ autofill::form_util::InferButtonTitlesForTesting(body); autofill::ButtonTitleList expected = { {base::UTF8ToUTF16("Show password"), - autofill::ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE}, + ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE}, {base::UTF8ToUTF16("Sign Up"), - autofill::ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE}, + ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE}, {base::UTF8ToUTF16("Register"), - autofill::ButtonTitleType::BUTTON_ELEMENT_BUTTON_TYPE}}; + ButtonTitleType::BUTTON_ELEMENT_BUTTON_TYPE}}; EXPECT_EQ(expected, actual); }
diff --git a/components/autofill/content/renderer/form_tracker.cc b/components/autofill/content/renderer/form_tracker.cc index 7043a89f..0731209 100644 --- a/components/autofill/content/renderer/form_tracker.cc +++ b/components/autofill/content/renderer/form_tracker.cc
@@ -21,6 +21,8 @@ namespace autofill { +using mojom::SubmissionSource; + FormTracker::FormTracker(content::RenderFrame* render_frame) : content::RenderFrameObserver(render_frame), weak_ptr_factory_(this) { DCHECK_CALLED_ON_VALID_SEQUENCE(form_tracker_sequence_checker_);
diff --git a/components/autofill/content/renderer/form_tracker.h b/components/autofill/content/renderer/form_tracker.h index 1eecd90..f2d4c4d 100644 --- a/components/autofill/content/renderer/form_tracker.h +++ b/components/autofill/content/renderer/form_tracker.h
@@ -8,7 +8,7 @@ #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/sequence_checker.h" -#include "components/autofill/core/common/submission_source.h" +#include "components/autofill/core/common/mojom/autofill_types.mojom.h" #include "content/public/renderer/render_frame_observer.h" #include "third_party/blink/public/web/web_input_element.h" @@ -54,7 +54,7 @@ // OnProvisionallySaveForm() is submitted from the |source|, the tracker // infers submission from the disappearance of form or element, observer // might not need to check it again. - virtual void OnInferredFormSubmission(SubmissionSource source) = 0; + virtual void OnInferredFormSubmission(mojom::SubmissionSource source) = 0; protected: virtual ~Observer() {} @@ -104,8 +104,8 @@ Observer::ElementChangeSource change_source); void FireProbablyFormSubmitted(); void FireFormSubmitted(const blink::WebFormElement& form); - void FireInferredFormSubmission(SubmissionSource source); - void FireSubmissionIfFormDisappear(SubmissionSource source); + void FireInferredFormSubmission(mojom::SubmissionSource source); + void FireSubmissionIfFormDisappear(mojom::SubmissionSource source); bool CanInferFormSubmitted(); void TrackElement();
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc index 1af1cc92..7ceb573 100644 --- a/components/autofill/content/renderer/password_autofill_agent.cc +++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -74,6 +74,7 @@ using mojom::FillingStatus; using mojom::FocusedFieldType; using mojom::SubmissionIndicatorEvent; +using mojom::SubmissionSource; namespace {
diff --git a/components/autofill/content/renderer/password_autofill_agent.h b/components/autofill/content/renderer/password_autofill_agent.h index b74c1f6..9092f00b 100644 --- a/components/autofill/content/renderer/password_autofill_agent.h +++ b/components/autofill/content/renderer/password_autofill_agent.h
@@ -136,7 +136,7 @@ ElementChangeSource source) override; void OnProbablyFormSubmitted() override; void OnFormSubmitted(const blink::WebFormElement& form) override; - void OnInferredFormSubmission(SubmissionSource source) override; + void OnInferredFormSubmission(mojom::SubmissionSource source) override; // WebLocalFrameClient editor related calls forwarded by AutofillAgent. // If they return true, it indicates the event was consumed and should not
diff --git a/components/autofill/core/browser/autofill_download_manager.cc b/components/autofill/core/browser/autofill_download_manager.cc index bb9fc30..9f1fef6 100644 --- a/components/autofill/core/browser/autofill_download_manager.cc +++ b/components/autofill/core/browser/autofill_download_manager.cc
@@ -32,7 +32,7 @@ #include "components/autofill/core/common/autofill_features.h" #include "components/autofill/core/common/autofill_prefs.h" #include "components/autofill/core/common/autofill_switches.h" -#include "components/autofill/core/common/submission_source.h" +#include "components/autofill/core/common/mojom/autofill_types.mojom.h" #include "components/google/core/common/google_util.h" #include "components/history/core/browser/history_service.h" #include "components/prefs/pref_service.h"
diff --git a/components/autofill/core/browser/autofill_download_manager_unittest.cc b/components/autofill/core/browser/autofill_download_manager_unittest.cc index ff2edef..08d9a32 100644 --- a/components/autofill/core/browser/autofill_download_manager_unittest.cc +++ b/components/autofill/core/browser/autofill_download_manager_unittest.cc
@@ -62,6 +62,8 @@ using net::test_server::HttpResponse; namespace autofill { +using mojom::SubmissionSource; + namespace { const int METHOD_GET = 0; @@ -1951,10 +1953,11 @@ FormStructure form_structure(form); form_structure.set_page_language("fr-ca"); - for (int i = 0; i < 7; ++i) { - SCOPED_TRACE(base::StringPrintf("submission source = %d", i)); + for (int i = 0; i <= static_cast<int>(SubmissionSource::kMaxValue); ++i) { base::HistogramTester histogram_tester; auto submission_source = static_cast<SubmissionSource>(i); + SCOPED_TRACE(testing::Message() + << "submission source = " << submission_source); form_structure.set_submission_source(submission_source); form_structure.set_randomized_encoder( RandomizedEncoder::Create(pref_service_.get())); @@ -2022,10 +2025,11 @@ AutofillDownloadManager download_manager(driver_.get(), this); FormStructure form_structure(form); - for (int i = 0; i < 7; ++i) { - SCOPED_TRACE(base::StringPrintf("submission source = %d", i)); + for (int i = 0; i <= static_cast<int>(SubmissionSource::kMaxValue); ++i) { base::HistogramTester histogram_tester; auto submission_source = static_cast<SubmissionSource>(i); + SCOPED_TRACE(testing::Message() + << "submission source = " << submission_source); form_structure.set_submission_source(submission_source); // The first attempt should succeed. @@ -2083,10 +2087,11 @@ FormStructure form_structure(form); FormStructure small_form_structure(small_form); - for (int i = 0; i < 7; ++i) { - SCOPED_TRACE(base::StringPrintf("submission source = %d", i)); + for (int i = 0; i <= static_cast<int>(SubmissionSource::kMaxValue); ++i) { base::HistogramTester histogram_tester; auto submission_source = static_cast<SubmissionSource>(i); + SCOPED_TRACE(testing::Message() + << "submission source = " << submission_source); form_structure.set_submission_source(submission_source); small_form_structure.set_submission_source(submission_source);
diff --git a/components/autofill/core/browser/autofill_handler.cc b/components/autofill/core/browser/autofill_handler.cc index f0af93b..40cc43f 100644 --- a/components/autofill/core/browser/autofill_handler.cc +++ b/components/autofill/core/browser/autofill_handler.cc
@@ -55,7 +55,7 @@ void AutofillHandler::OnFormSubmitted(const FormData& form, bool known_success, - SubmissionSource source) { + mojom::SubmissionSource source) { if (IsValidFormData(form)) OnFormSubmittedImpl(form, known_success, source); }
diff --git a/components/autofill/core/browser/autofill_handler.h b/components/autofill/core/browser/autofill_handler.h index b1744e8..afde406 100644 --- a/components/autofill/core/browser/autofill_handler.h +++ b/components/autofill/core/browser/autofill_handler.h
@@ -14,8 +14,8 @@ #include "build/build_config.h" #include "components/autofill/core/browser/autofill_driver.h" #include "components/autofill/core/common/form_data.h" +#include "components/autofill/core/common/mojom/autofill_types.mojom.h" #include "components/autofill/core/common/signatures_util.h" -#include "components/autofill/core/common/submission_source.h" namespace gfx { class RectF; @@ -83,7 +83,7 @@ // personal profile. void OnFormSubmitted(const FormData& form, bool known_success, - SubmissionSource source); + mojom::SubmissionSource source); // Invoked when |forms| has been detected. void OnFormsSeen(const std::vector<FormData>& forms, @@ -145,7 +145,7 @@ virtual void OnFormSubmittedImpl(const FormData& form, bool known_success, - SubmissionSource source) = 0; + mojom::SubmissionSource source) = 0; virtual void OnTextFieldDidChangeImpl(const FormData& form, const FormFieldData& field,
diff --git a/components/autofill/core/browser/autofill_handler_proxy.cc b/components/autofill/core/browser/autofill_handler_proxy.cc index cf75c3d..4bbaac5 100644 --- a/components/autofill/core/browser/autofill_handler_proxy.cc +++ b/components/autofill/core/browser/autofill_handler_proxy.cc
@@ -18,7 +18,7 @@ void AutofillHandlerProxy::OnFormSubmittedImpl(const FormData& form, bool known_success, - SubmissionSource source) { + mojom::SubmissionSource source) { provider_->OnFormSubmitted(this, form, known_success, source); }
diff --git a/components/autofill/core/browser/autofill_handler_proxy.h b/components/autofill/core/browser/autofill_handler_proxy.h index 3c560df..e7cce5c1 100644 --- a/components/autofill/core/browser/autofill_handler_proxy.h +++ b/components/autofill/core/browser/autofill_handler_proxy.h
@@ -39,7 +39,7 @@ protected: void OnFormSubmittedImpl(const FormData& form, bool known_success, - SubmissionSource source) override; + mojom::SubmissionSource source) override; void OnTextFieldDidChangeImpl(const FormData& form, const FormFieldData& field,
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc index ff6a620..baf34644 100644 --- a/components/autofill/core/browser/autofill_manager.cc +++ b/components/autofill/core/browser/autofill_manager.cc
@@ -93,6 +93,7 @@ using base::StartsWith; using base::TimeTicks; +using mojom::SubmissionSource; const int kCreditCardSigninPromoImpressionLimit = 3;
diff --git a/components/autofill/core/browser/autofill_manager.h b/components/autofill/core/browser/autofill_manager.h index 5094f37..bff2eca6 100644 --- a/components/autofill/core/browser/autofill_manager.h +++ b/components/autofill/core/browser/autofill_manager.h
@@ -266,7 +266,7 @@ // AutofillHandler: void OnFormSubmittedImpl(const FormData& form, bool known_success, - SubmissionSource source) override; + mojom::SubmissionSource source) override; void OnTextFieldDidChangeImpl(const FormData& form, const FormFieldData& field, const gfx::RectF& bounding_box,
diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc index 69fd5b6..8f9a296 100644 --- a/components/autofill/core/browser/autofill_manager_unittest.cc +++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -78,11 +78,6 @@ #include "ui/gfx/geometry/rect.h" #include "url/gurl.h" -using autofill::features::kAutofillEnforceMinRequiredFieldsForHeuristics; -using autofill::features::kAutofillEnforceMinRequiredFieldsForQuery; -using autofill::features::kAutofillEnforceMinRequiredFieldsForUpload; -using autofill::features::kAutofillRestrictUnownedFieldsToFormlessCheckout; -using autofill::mojom::SubmissionIndicatorEvent; using base::ASCIIToUTF16; using base::UTF8ToUTF16; using testing::_; @@ -95,6 +90,15 @@ using testing::UnorderedElementsAre; namespace autofill { + +using features::kAutofillEnforceMinRequiredFieldsForHeuristics; +using features::kAutofillEnforceMinRequiredFieldsForQuery; +using features::kAutofillEnforceMinRequiredFieldsForUpload; +using features::kAutofillRestrictUnownedFieldsToFormlessCheckout; +using mojom::ButtonTitleType; +using mojom::SubmissionIndicatorEvent; +using mojom::SubmissionSource; + namespace { const int kDefaultPageID = 137; @@ -661,6 +665,54 @@ } }; +class SuggestionMatchingTest : public AutofillManagerTest, + public testing::WithParamInterface<bool> { + protected: + void SetUp() override { + AutofillManagerTest::SetUp(); + InitializeFeatures(); + } + +#if defined(OS_ANDROID) || defined(OS_IOS) + void InitializeFeatures(); +#else + void InitializeFeatures(); +#endif // defined(OS_ANDROID) || defined(OS_IOS) + + std::string MakeLabel(const std::vector<std::string>& parts); + + enum class EnabledFeature { kNone, kDesktop, kMobile }; + EnabledFeature enabled_feature_; + std::string icon_; + base::test::ScopedFeatureList features_; +}; + +// TODO(crbug.com/963630): Implement tests for mobile label experiment. +#if defined(OS_ANDROID) || defined(OS_IOS) +void SuggestionMatchingTest::InitializeFeatures() { + enabled_feature_ = + GetParam() ? EnabledFeature::kMobile : EnabledFeature::kNone; + features_.InitWithFeatureState( + features::kAutofillUseMobileLabelDisambiguation, false); +} +#else +void SuggestionMatchingTest::InitializeFeatures() { + enabled_feature_ = + GetParam() ? EnabledFeature::kDesktop : EnabledFeature::kNone; + if (enabled_feature_ == EnabledFeature::kDesktop) { + icon_ = "accountBoxIcon"; + } + features_.InitWithFeatureState( + features::kAutofillUseImprovedLabelDisambiguation, GetParam()); +} +#endif // defined(OS_ANDROID) || defined(OS_IOS) + +std::string SuggestionMatchingTest::MakeLabel( + const std::vector<std::string>& parts) { + return base::JoinString( + parts, l10n_util::GetStringUTF8(IDS_AUTOFILL_SUGGESTION_LABEL_SEPARATOR)); +} + // Test that calling OnFormsSeen with an empty set of forms (such as when // reloading a page or when the renderer processes a set of forms but detects // no changes) does not load the forms again. @@ -970,9 +1022,9 @@ autofill_manager_->OnAutocompleteEntrySelected(test_value); } -// Test that we return all address profile suggestions when all form fields are -// empty. -TEST_F(AutofillManagerTest, GetProfileSuggestions_EmptyValue) { +// Test that we return all address profile suggestions when all form fields +// are empty. +TEST_P(SuggestionMatchingTest, GetProfileSuggestions_EmptyValue) { // Set up our form data. FormData form; test::CreateTestAddressFormData(&form); @@ -982,17 +1034,31 @@ const FormFieldData& field = form.fields[0]; GetAutofillSuggestions(form, field); - // Test that we sent the right values to the external delegate. Inferred - // labels include full first relevant field, which in this case is the - // address line 1. - CheckSuggestions(kDefaultPageID, - Suggestion("Charles", "123 Apple St.", "", 1), - Suggestion("Elvis", "3734 Elvis Presley Blvd.", "", 2)); + std::string label1; + std::string label2; + + switch (enabled_feature_) { + case EnabledFeature::kDesktop: + label1 = MakeLabel( + {"123 Apple St., unit 6", "23456789012", "buddy@gmail.com"}); + label2 = MakeLabel({"3734 Elvis Presley Blvd., Apt. 10", "(234) 567-8901", + "theking@gmail.com"}); + break; + case EnabledFeature::kMobile: + // TODO(crbug.com/963630) + return; + case EnabledFeature::kNone: + label1 = "123 Apple St."; + label2 = "3734 Elvis Presley Blvd."; + } + // Test that we sent the right values to the external delegate. + CheckSuggestions(kDefaultPageID, Suggestion("Charles", label1, icon_, 1), + Suggestion("Elvis", label2, icon_, 2)); } // Test that we return only matching address profile suggestions when the // selected form field has been partially filled out. -TEST_F(AutofillManagerTest, GetProfileSuggestions_MatchCharacter) { +TEST_P(SuggestionMatchingTest, GetProfileSuggestions_MatchCharacter) { // Set up our form data. FormData form; test::CreateTestAddressFormData(&form); @@ -1003,14 +1069,25 @@ test::CreateTestFormField("First Name", "firstname", "E", "text", &field); GetAutofillSuggestions(form, field); + std::string label; + + switch (enabled_feature_) { + case EnabledFeature::kDesktop: + label = "3734 Elvis Presley Blvd., Apt. 10"; + break; + case EnabledFeature::kMobile: + // TODO(crbug.com/963630) + return; + case EnabledFeature::kNone: + label = "3734 Elvis Presley Blvd."; + } // Test that we sent the right values to the external delegate. - CheckSuggestions(kDefaultPageID, - Suggestion("Elvis", "3734 Elvis Presley Blvd.", "", 1)); + CheckSuggestions(kDefaultPageID, Suggestion("Elvis", label, icon_, 1)); } // Tests that we return address profile suggestions values when the section // is already autofilled, and that we merge identical values. -TEST_F(AutofillManagerTest, +TEST_P(SuggestionMatchingTest, GetProfileSuggestions_AlreadyAutofilledMergeValues) { // Set up our form data. FormData form; @@ -1052,17 +1129,31 @@ test::CreateTestFormField("Last Name", "lastname", "G", "text", &field); GetAutofillSuggestions(form, field); - // Test that we sent the right values to the external delegate. No labels, - // with duplicate values "Grimes" merged. - CheckSuggestions( - kDefaultPageID, Suggestion("Googler", "1600 Amphitheater pkwy", "", 1), - Suggestion("Grimes", "1234 Smith Blvd., Carl Grimes", "", 2), - Suggestion("Grimes", "1234 Smith Blvd., Robin Grimes", "", 3)); + switch (enabled_feature_) { + case EnabledFeature::kDesktop: + CheckSuggestions( + kDefaultPageID, + Suggestion("Googler", "1600 Amphitheater pkwy", icon_, 1), + Suggestion("Grimes", "1234 Smith Blvd.", icon_, 2)); + break; + case EnabledFeature::kMobile: + // TODO(crbug.com/963630) + return; + case EnabledFeature::kNone: + // Test that we sent the right values to the external delegate. No labels + // with duplicate values "Grimes" merged. + CheckSuggestions( + kDefaultPageID, + Suggestion("Googler", "1600 Amphitheater pkwy", "", 1), + Suggestion("Grimes", "1234 Smith Blvd., Carl Grimes", "", 2), + Suggestion("Grimes", "1234 Smith Blvd., Robin Grimes", "", 3)); + } } // Tests that we return address profile suggestions values when the section // is already autofilled, and that they have no label. -TEST_F(AutofillManagerTest, GetProfileSuggestions_AlreadyAutofilledNoLabels) { +TEST_P(SuggestionMatchingTest, + GetProfileSuggestions_AlreadyAutofilledNoLabels) { // Set up our form data. FormData form; test::CreateTestAddressFormData(&form); @@ -1077,9 +1168,20 @@ test::CreateTestFormField("First Name", "firstname", "E", "text", &field); GetAutofillSuggestions(form, field); - // Test that we sent the right values to the external delegate. No labels. - CheckSuggestions(kDefaultPageID, - Suggestion("Elvis", "3734 Elvis Presley Blvd.", "", 1)); + std::string label; + + switch (enabled_feature_) { + case EnabledFeature::kDesktop: + label = "3734 Elvis Presley Blvd., Apt. 10"; + break; + case EnabledFeature::kMobile: + // TODO(crbug.com/963630) + return; + case EnabledFeature::kNone: + label = "3734 Elvis Presley Blvd."; + } + // Test that we sent the right values to the external delegate. + CheckSuggestions(kDefaultPageID, Suggestion("Elvis", label, icon_, 1)); } // Test that we return no suggestions when the form has no relevant fields. @@ -1108,7 +1210,7 @@ } // Test that we cull duplicate profile suggestions. -TEST_F(AutofillManagerTest, GetProfileSuggestions_WithDuplicates) { +TEST_P(SuggestionMatchingTest, GetProfileSuggestions_WithDuplicates) { // Set up our form data. FormData form; test::CreateTestAddressFormData(&form); @@ -1123,10 +1225,26 @@ const FormFieldData& field = form.fields[0]; GetAutofillSuggestions(form, field); + std::string label1; + std::string label2; + + switch (enabled_feature_) { + case EnabledFeature::kDesktop: + label1 = MakeLabel( + {"123 Apple St., unit 6", "23456789012", "buddy@gmail.com"}); + label2 = MakeLabel({"3734 Elvis Presley Blvd., Apt. 10", "(234) 567-8901", + "theking@gmail.com"}); + break; + case EnabledFeature::kMobile: + // TODO(crbug.com/963630) + return; + case EnabledFeature::kNone: + label1 = "123 Apple St."; + label2 = "3734 Elvis Presley Blvd."; + } // Test that we sent the right values to the external delegate. - CheckSuggestions(kDefaultPageID, - Suggestion("Charles", "123 Apple St.", "", 1), - Suggestion("Elvis", "3734 Elvis Presley Blvd.", "", 2)); + CheckSuggestions(kDefaultPageID, Suggestion("Charles", label1, icon_, 1), + Suggestion("Elvis", label2, icon_, 2)); } // Test that we return no suggestions when autofill is disabled. @@ -1591,7 +1709,7 @@ } // Test that we return profile and credit card suggestions for combined forms. -TEST_F(AutofillManagerTest, GetAddressAndCreditCardSuggestions) { +TEST_P(SuggestionMatchingTest, GetAddressAndCreditCardSuggestions) { // Set up our form data. FormData form; test::CreateTestAddressFormData(&form); @@ -1602,10 +1720,28 @@ FormFieldData field = form.fields[0]; GetAutofillSuggestions(form, field); - // Test that we sent the right address suggestions to the external delegate. - CheckSuggestions(kDefaultPageID, - Suggestion("Charles", "123 Apple St.", "", 1), - Suggestion("Elvis", "3734 Elvis Presley Blvd.", "", 2)); + std::string label1; + std::string label2; + + switch (enabled_feature_) { + case EnabledFeature::kDesktop: + // The first phone number is not formatted because it is invalid for the + // app locale. + label1 = MakeLabel( + {"123 Apple St., unit 6", "23456789012", "buddy@gmail.com"}); + label2 = MakeLabel({"3734 Elvis Presley Blvd., Apt. 10", "(234) 567-8901", + "theking@gmail.com"}); + break; + case EnabledFeature::kMobile: + // TODO(crbug.com/963630) + return; + case EnabledFeature::kNone: + label1 = "123 Apple St."; + label2 = "3734 Elvis Presley Blvd."; + } + // Test that we sent the right values to the external delegate. + CheckSuggestions(kDefaultPageID, Suggestion("Charles", label1, icon_, 1), + Suggestion("Elvis", label2, icon_, 2)); const int kPageID2 = 2; test::CreateTestFormField("Card Number", "cardnumber", "", "text", &field); @@ -1636,7 +1772,7 @@ // only return address suggestions. Instead of credit card suggestions, we // should return a warning explaining that credit card profile suggestions are // unavailable when the form is not https. -TEST_F(AutofillManagerTest, GetAddressAndCreditCardSuggestionsNonHttps) { +TEST_P(SuggestionMatchingTest, GetAddressAndCreditCardSuggestionsNonHttps) { // Set up our form data. FormData form; test::CreateTestAddressFormData(&form); @@ -1647,10 +1783,26 @@ FormFieldData field = form.fields[0]; GetAutofillSuggestions(form, field); - // Test that we sent the right suggestions to the external delegate. - CheckSuggestions(kDefaultPageID, - Suggestion("Charles", "123 Apple St.", "", 1), - Suggestion("Elvis", "3734 Elvis Presley Blvd.", "", 2)); + std::string label1; + std::string label2; + + switch (enabled_feature_) { + case EnabledFeature::kDesktop: + label1 = MakeLabel( + {"123 Apple St., unit 6", "23456789012", "buddy@gmail.com"}); + label2 = MakeLabel({"3734 Elvis Presley Blvd., Apt. 10", "(234) 567-8901", + "theking@gmail.com"}); + break; + case EnabledFeature::kMobile: + // TODO(crbug.com/963630) + return; + case EnabledFeature::kNone: + label1 = "123 Apple St."; + label2 = "3734 Elvis Presley Blvd."; + } + // Test that we sent the right values to the external delegate. + CheckSuggestions(kDefaultPageID, Suggestion("Charles", label1, icon_, 1), + Suggestion("Elvis", label2, icon_, 2)); test::CreateTestFormField("Card Number", "cardnumber", "", "text", &field); const int kPageID2 = 2; @@ -1668,9 +1820,11 @@ external_delegate_->CheckNoSuggestions(kDefaultPageID); } -TEST_F(AutofillManagerTest, +TEST_P(SuggestionMatchingTest, ShouldShowAddressSuggestionsIfCreditCardAutofillDisabled) { - DisableCreditCardAutofill(); + base::test::ScopedFeatureList features; + features.InitAndEnableFeature( + features::kAutofillCreditCardAblationExperiment); // Set up our form data. FormData form; @@ -1681,10 +1835,26 @@ FormFieldData field = form.fields[0]; GetAutofillSuggestions(form, field); - // Check that address suggestions will still be available. - CheckSuggestions(kDefaultPageID, - Suggestion("Charles", "123 Apple St.", "", 1), - Suggestion("Elvis", "3734 Elvis Presley Blvd.", "", 2)); + std::string label1; + std::string label2; + + switch (enabled_feature_) { + case EnabledFeature::kDesktop: + label1 = MakeLabel( + {"123 Apple St., unit 6", "23456789012", "buddy@gmail.com"}); + label2 = MakeLabel({"3734 Elvis Presley Blvd., Apt. 10", "(234) 567-8901", + "theking@gmail.com"}); + break; + case EnabledFeature::kMobile: + // TODO(crbug.com/963630) + return; + case EnabledFeature::kNone: + label1 = "123 Apple St."; + label2 = "3734 Elvis Presley Blvd."; + } + // Test that we sent the right values to the external delegate. + CheckSuggestions(kDefaultPageID, Suggestion("Charles", label1, icon_, 1), + Suggestion("Elvis", label2, icon_, 2)); } TEST_F(AutofillManagerTest, @@ -1726,7 +1896,7 @@ // Test that we return normal autofill suggestions when trying to autofill // already filled forms. -TEST_F(AutofillManagerTest, GetFieldSuggestionsWhenFormIsAutofilled) { +TEST_P(SuggestionMatchingTest, GetFieldSuggestionsWhenFormIsAutofilled) { // Set up our form data. FormData form; test::CreateTestAddressFormData(&form); @@ -1738,10 +1908,28 @@ const FormFieldData& field = form.fields[0]; GetAutofillSuggestions(form, field); + std::string label1; + std::string label2; + + switch (enabled_feature_) { + case EnabledFeature::kDesktop: + // The below phone number is not formatted because it is not valid for the + // app locale. It has an extra digit. + label1 = MakeLabel( + {"123 Apple St., unit 6", "23456789012", "buddy@gmail.com"}); + label2 = MakeLabel({"3734 Elvis Presley Blvd., Apt. 10", "(234) 567-8901", + "theking@gmail.com"}); + break; + case EnabledFeature::kMobile: + // TODO(crbug.com/963630) + return; + case EnabledFeature::kNone: + label1 = "123 Apple St."; + label2 = "3734 Elvis Presley Blvd."; + } // Test that we sent the right values to the external delegate. - CheckSuggestions(kDefaultPageID, - Suggestion("Charles", "123 Apple St.", "", 1), - Suggestion("Elvis", "3734 Elvis Presley Blvd.", "", 2)); + CheckSuggestions(kDefaultPageID, Suggestion("Charles", label1, icon_, 1), + Suggestion("Elvis", label2, icon_, 2)); } // Test that nothing breaks when there are autocomplete suggestions but no @@ -1772,7 +1960,7 @@ // Test that we do not return duplicate values drawn from multiple profiles when // filling an already filled field. -TEST_F(AutofillManagerTest, GetFieldSuggestionsWithDuplicateValues) { +TEST_P(SuggestionMatchingTest, GetFieldSuggestionsWithDuplicateValues) { // Set up our form data. FormData form; test::CreateTestAddressFormData(&form); @@ -1791,12 +1979,23 @@ field.value = ASCIIToUTF16("Elvis"); GetAutofillSuggestions(form, field); + std::string label; + + switch (enabled_feature_) { + case EnabledFeature::kDesktop: + label = "3734 Elvis Presley Blvd., Apt. 10"; + break; + case EnabledFeature::kMobile: + // TODO(crbug.com/963630) + return; + case EnabledFeature::kNone: + label = "3734 Elvis Presley Blvd."; + } // Test that we sent the right values to the external delegate. - CheckSuggestions(kDefaultPageID, - Suggestion("Elvis", "3734 Elvis Presley Blvd.", "", 1)); + CheckSuggestions(kDefaultPageID, Suggestion("Elvis", label, icon_, 1)); } -TEST_F(AutofillManagerTest, GetProfileSuggestions_FancyPhone) { +TEST_P(SuggestionMatchingTest, GetProfileSuggestions_FancyPhone) { // Set up our form data. FormData form; test::CreateTestAddressFormData(&form); @@ -1812,13 +2011,41 @@ const FormFieldData& field = form.fields[9]; GetAutofillSuggestions(form, field); - // Test that we sent the right values to the external delegate. Inferred - // labels include the most private field of those that would be filled. - CheckSuggestions( - kDefaultPageID, - Suggestion("18007724743", "Natty Bumppo", "", 1), // 1800PRAIRIE - Suggestion("23456789012", "123 Apple St.", "", 2), - Suggestion("12345678901", "3734 Elvis Presley Blvd.", "", 3)); + std::string value1; + std::string value2; + std::string value3; + std::string label1; + std::string label2; + std::string label3; + + switch (enabled_feature_) { + case EnabledFeature::kDesktop: + value1 = "(800) 772-4743"; + // The below phone number is not formatted because it is not valid for the + // app locale. It has an extra digit. + value2 = "23456789012"; + value3 = "(234) 567-8901"; + label1 = "Natty Bumppo"; + label2 = MakeLabel( + {"Charles Holley", "123 Apple St., unit 6", "buddy@gmail.com"}); + label3 = MakeLabel({"Elvis Presley", "3734 Elvis Presley Blvd., Apt. 10", + "theking@gmail.com"}); + break; + case EnabledFeature::kMobile: + // TODO(crbug.com/963630) + return; + case EnabledFeature::kNone: + value1 = "18007724743"; // 1800PRAIRIE + value2 = "23456789012"; + value3 = "12345678901"; + label1 = "Natty Bumppo"; + label2 = "123 Apple St."; + label3 = "3734 Elvis Presley Blvd."; + } + // Test that we sent the right values to the external delegate. + CheckSuggestions(kDefaultPageID, Suggestion(value1, label1, icon_, 1), + Suggestion(value2, label2, icon_, 2), + Suggestion(value3, label3, icon_, 3)); } TEST_F(AutofillManagerTest, GetProfileSuggestions_ForPhonePrefixOrSuffix) { @@ -3957,7 +4184,8 @@ // Test that we do not query for Autocomplete suggestions when there are // Autofill suggestions available. -TEST_F(AutofillManagerTest, AutocompleteSuggestions_NoneWhenAutofillPresent) { +TEST_P(SuggestionMatchingTest, + AutocompleteSuggestions_NoneWhenAutofillPresent) { // Set up our form data. FormData form; test::CreateTestAddressFormData(&form); @@ -3973,12 +4201,25 @@ GetAutofillSuggestions(form, field); - // Test that we sent the right values to the external delegate. Inferred - // labels include full first relevant field, which in this case is the - // address line 1. - CheckSuggestions(kDefaultPageID, - Suggestion("Charles", "123 Apple St.", "", 1), - Suggestion("Elvis", "3734 Elvis Presley Blvd.", "", 2)); + if (enabled_feature_ == EnabledFeature::kDesktop) { + CheckSuggestions( + kDefaultPageID, + Suggestion("Charles", + MakeLabel({"123 Apple St., unit 6", "23456789012", + "buddy@gmail.com"}), + icon_, 1), + Suggestion("Elvis", + MakeLabel({"3734 Elvis Presley Blvd., Apt. 10", + "(234) 567-8901", "theking@gmail.com"}), + icon_, 2)); + } else { + // Test that we sent the right values to the external delegate. Inferred + // labels include full first relevant field, which in this case is the + // address line 1. + CheckSuggestions(kDefaultPageID, + Suggestion("Charles", "123 Apple St.", "", 1), + Suggestion("Elvis", "3734 Elvis Presley Blvd.", "", 2)); + } } // Test that we query for Autocomplete suggestions when there are no Autofill @@ -4773,15 +5014,6 @@ } } -INSTANTIATE_TEST_SUITE_P( - AutofillManagerTest, - ProfileMatchingTypesTest, - testing::Combine( - testing::ValuesIn(kProfileMatchingTypesTestCases), - testing::Range(static_cast<int>(AutofillDataModel::UNVALIDATED), - static_cast<int>(AutofillDataModel::UNSUPPORTED) + 1), - testing::Bool())); - // Tests that DeterminePossibleFieldTypesForUpload is called when a form is // submitted. TEST_F(AutofillManagerTest, DeterminePossibleFieldTypesForUpload_IsTriggered) { @@ -5560,9 +5792,9 @@ EXPECT_FALSE(external_delegate_->on_suggestions_returned_seen()); } -// Verify that typing "gmail" will match "theking@gmail.com" and -// "buddy@gmail.com" when substring matching is enabled. -TEST_F(AutofillManagerTest, DisplaySuggestionsWithMatchingTokens) { +// Verify that typing "gmail" matches "theking@gmail.com" and "buddy@gmail.com" +// when substring matching is enabled. +TEST_P(SuggestionMatchingTest, DisplaySuggestionsWithMatchingTokens) { base::test::ScopedFeatureList features; features.InitAndEnableFeature(features::kAutofillTokenPrefixMatching); @@ -5576,14 +5808,33 @@ test::CreateTestFormField("Email", "email", "gmail", "email", &field); GetAutofillSuggestions(form, field); - CheckSuggestions( - kDefaultPageID, Suggestion("buddy@gmail.com", "123 Apple St.", "", 1), - Suggestion("theking@gmail.com", "3734 Elvis Presley Blvd.", "", 2)); + std::string label1; + std::string label2; + + switch (enabled_feature_) { + case EnabledFeature::kDesktop: + label1 = + MakeLabel({"Charles Holley", "123 Apple St., unit 6", "23456789012"}); + label2 = MakeLabel({"Elvis Presley", "3734 Elvis Presley Blvd., Apt. 10", + "(234) 567-8901"}); + break; + case EnabledFeature::kMobile: + // TODO(crbug.com/963630) + return; + case EnabledFeature::kNone: + label1 = "123 Apple St."; + label2 = "3734 Elvis Presley Blvd."; + } + // Test that we sent the right values to the external delegate. + CheckSuggestions(kDefaultPageID, + Suggestion("buddy@gmail.com", label1, icon_, 1), + Suggestion("theking@gmail.com", label2, icon_, 2)); } // Verify that typing "apple" will match "123 Apple St." when substring matching // is enabled. -TEST_F(AutofillManagerTest, DisplaySuggestionsWithMatchingTokens_CaseIgnored) { +TEST_P(SuggestionMatchingTest, + DisplaySuggestionsWithMatchingTokens_CaseIgnored) { base::test::ScopedFeatureList features; features.InitAndEnableFeature(features::kAutofillTokenPrefixMatching); @@ -5597,8 +5848,23 @@ test::CreateTestFormField("Address Line 2", "addr2", "apple", "text", &field); GetAutofillSuggestions(form, field); - CheckSuggestions(kDefaultPageID, - Suggestion("123 Apple St., unit 6", "123 Apple St.", "", 1)); + std::string value; + std::string label; + + switch (enabled_feature_) { + case EnabledFeature::kDesktop: + value = "123 Apple St., unit 6"; + label = "Charles Holley"; + break; + case EnabledFeature::kMobile: + // TODO(crbug.com/963630) + return; + case EnabledFeature::kNone: + value = "123 Apple St., unit 6"; + label = "123 Apple St."; + } + // Test that we sent the right values to the external delegate. + CheckSuggestions(kDefaultPageID, Suggestion(value, label, icon_, 1)); } // Verify that typing "mail" will not match any of the "@gmail.com" email @@ -5871,7 +6137,7 @@ // Verify that typing "S" into the middle name field will match and order middle // names "Shawn Smith" followed by "Adam Smith" i.e. prefix matched followed by // substring matched. -TEST_F(AutofillManagerTest, +TEST_P(SuggestionMatchingTest, DisplaySuggestionsWithPrefixesPrecedeSubstringMatched) { base::test::ScopedFeatureList features; features.InitAndEnableFeature(features::kAutofillTokenPrefixMatching); @@ -5904,12 +6170,18 @@ test::CreateTestFormField("Middle Name", "middlename", "S", "text", &field); GetAutofillSuggestions(form, field); - CheckSuggestions( - kDefaultPageID, - Suggestion("Shawn Smith", "1234 Smith Blvd., Carl Shawn Smith Grimes", "", - 1), - Suggestion("Adam Smith", "1234 Smith Blvd., Robin Adam Smith Grimes", "", - 2)); + if (enabled_feature_ == EnabledFeature::kDesktop) { + CheckSuggestions(kDefaultPageID, + Suggestion("Shawn Smith", "1234 Smith Blvd.", icon_, 1), + Suggestion("Adam Smith", "1234 Smith Blvd.", icon_, 2)); + } else { + CheckSuggestions( + kDefaultPageID, + Suggestion("Shawn Smith", "1234 Smith Blvd., Carl Shawn Smith Grimes", + "", 1), + Suggestion("Adam Smith", "1234 Smith Blvd., Robin Adam Smith Grimes", + "", 2)); + } } TEST_F(AutofillManagerTest, ShouldUploadForm) { @@ -7160,6 +7432,17 @@ CheckNoSuggestionsAvailableOnFieldFocus(); } +INSTANTIATE_TEST_SUITE_P( + AutofillManagerTest, + ProfileMatchingTypesTest, + testing::Combine( + testing::ValuesIn(kProfileMatchingTypesTestCases), + testing::Range(static_cast<int>(AutofillDataModel::UNVALIDATED), + static_cast<int>(AutofillDataModel::UNSUPPORTED) + 1), + testing::Bool())); + INSTANTIATE_TEST_SUITE_P(All, OnFocusOnFormFieldTest, testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, SuggestionMatchingTest, testing::Bool()); + } // namespace autofill
diff --git a/components/autofill/core/browser/autofill_metrics.cc b/components/autofill/core/browser/autofill_metrics.cc index 0c6e4b5..3537956 100644 --- a/components/autofill/core/browser/autofill_metrics.cc +++ b/components/autofill/core/browser/autofill_metrics.cc
@@ -23,12 +23,13 @@ #include "components/autofill/core/common/autofill_clock.h" #include "components/autofill/core/common/autofill_prefs.h" #include "components/autofill/core/common/form_data.h" -#include "components/autofill/core/common/submission_source.h" #include "services/metrics/public/cpp/metrics_utils.h" #include "services/metrics/public/cpp/ukm_builders.h" namespace autofill { +using mojom::SubmissionSource; + namespace { // Exponential bucket spacing for UKM event data.
diff --git a/components/autofill/core/browser/autofill_metrics.h b/components/autofill/core/browser/autofill_metrics.h index e6ff3c84..722b1cae 100644 --- a/components/autofill/core/browser/autofill_metrics.h +++ b/components/autofill/core/browser/autofill_metrics.h
@@ -22,6 +22,7 @@ #include "components/autofill/core/browser/sync_utils.h" #include "components/autofill/core/browser/ui/popup_types.h" #include "components/autofill/core/common/form_field_data.h" +#include "components/autofill/core/common/mojom/autofill_types.mojom.h" #include "components/autofill/core/common/signatures_util.h" #include "components/security_state/core/security_state.h" #include "services/metrics/public/cpp/ukm_recorder.h" @@ -30,7 +31,6 @@ class AutofillField; class CreditCard; -enum class SubmissionSource; // A given maximum is enforced to minimize the number of buckets generated. extern const int kMaxBucketsCount; @@ -1243,11 +1243,12 @@ // Returns the UMA metric used to track whether or not an upload was sent // after being triggered by |submission_source|. This is exposed for testing. static const char* SubmissionSourceToUploadEventMetric( - SubmissionSource submission_source); + mojom::SubmissionSource submission_source); // Logs whether or not an upload |was_sent| after being triggered by a // |submission_source| event. - static void LogUploadEvent(SubmissionSource submission_source, bool was_sent); + static void LogUploadEvent(mojom::SubmissionSource submission_source, + bool was_sent); // Logs the card upload decisions ukm for the specified |url|. // |upload_decision_metrics| is a bitmask of |CardUploadDecisionMetric|.
diff --git a/components/autofill/core/browser/autofill_metrics_unittest.cc b/components/autofill/core/browser/autofill_metrics_unittest.cc index 99b4e5ff30..0d924c1 100644 --- a/components/autofill/core/browser/autofill_metrics_unittest.cc +++ b/components/autofill/core/browser/autofill_metrics_unittest.cc
@@ -57,10 +57,6 @@ #include "ui/gfx/geometry/rect.h" #include "url/gurl.h" -using autofill::features::kAutofillEnforceMinRequiredFieldsForHeuristics; -using autofill::features::kAutofillEnforceMinRequiredFieldsForQuery; -using autofill::features::kAutofillEnforceMinRequiredFieldsForUpload; -using SyncSigninState = autofill::AutofillSyncSigninState; using base::ASCIIToUTF16; using base::Bucket; using base::TimeTicks; @@ -70,6 +66,13 @@ using ::testing::UnorderedPointwise; namespace autofill { + +using features::kAutofillEnforceMinRequiredFieldsForHeuristics; +using features::kAutofillEnforceMinRequiredFieldsForQuery; +using features::kAutofillEnforceMinRequiredFieldsForUpload; +using mojom::SubmissionSource; +using SyncSigninState = AutofillSyncSigninState; + namespace { using UkmCardUploadDecisionType = ukm::builders::Autofill_CardUploadDecision;
diff --git a/components/autofill/core/browser/autofill_provider.h b/components/autofill/core/browser/autofill_provider.h index ada8e1d..09f87a9 100644 --- a/components/autofill/core/browser/autofill_provider.h +++ b/components/autofill/core/browser/autofill_provider.h
@@ -7,7 +7,7 @@ #include "base/time/time.h" #include "components/autofill/core/common/form_data.h" -#include "components/autofill/core/common/submission_source.h" +#include "components/autofill/core/common/mojom/autofill_types.mojom.h" namespace gfx { class RectF; @@ -50,7 +50,7 @@ virtual void OnFormSubmitted(AutofillHandlerProxy* handler, const FormData& form, bool known_success, - SubmissionSource source) = 0; + mojom::SubmissionSource source) = 0; virtual void OnFocusNoLongerOnForm(AutofillHandlerProxy* handler) = 0;
diff --git a/components/autofill/core/browser/autofill_test_utils.cc b/components/autofill/core/browser/autofill_test_utils.cc index 3db61385..ebaee70 100644 --- a/components/autofill/core/browser/autofill_test_utils.cc +++ b/components/autofill/core/browser/autofill_test_utils.cc
@@ -113,8 +113,9 @@ const char* unique_id) { form->name = ASCIIToUTF16("MyForm") + ASCIIToUTF16(unique_id ? unique_id : ""); - form->button_titles = {std::make_pair( - ASCIIToUTF16("Submit"), ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE)}; + form->button_titles = { + std::make_pair(ASCIIToUTF16("Submit"), + mojom::ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE)}; form->url = GURL("http://myform.com/form.html"); form->action = GURL("http://myform.com/submit.html"); form->main_frame_origin =
diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc index e10b5cc7..5507589 100644 --- a/components/autofill/core/browser/form_structure.cc +++ b/components/autofill/core/browser/form_structure.cc
@@ -53,6 +53,7 @@ namespace autofill { +using mojom::ButtonTitleType; using mojom::SubmissionIndicatorEvent; namespace { @@ -347,9 +348,9 @@ } // Helper function for explicit conversion between |ButtonTitleType| defined in -// "button_title_type.h" and "server.proto". +// "autofill_types.mojom.h" and "server.proto". AutofillUploadContents_ButtonTitle_ButtonTitleType ToServerButtonTitleType( - autofill::ButtonTitleType input) { + ButtonTitleType input) { switch (input) { case ButtonTitleType::NONE: return AutofillUploadContents::ButtonTitle::NONE;
diff --git a/components/autofill/core/browser/form_structure.h b/components/autofill/core/browser/form_structure.h index c3c8af9..296c1f3 100644 --- a/components/autofill/core/browser/form_structure.h +++ b/components/autofill/core/browser/form_structure.h
@@ -27,7 +27,6 @@ #include "components/autofill/core/browser/proto/server.pb.h" #include "components/autofill/core/common/mojom/autofill_types.mojom.h" #include "components/autofill/core/common/password_form.h" -#include "components/autofill/core/common/submission_source.h" #include "url/gurl.h" #include "url/origin.h" @@ -323,8 +322,10 @@ } #endif - SubmissionSource submission_source() const { return submission_source_; } - void set_submission_source(SubmissionSource submission_source) { + mojom::SubmissionSource submission_source() const { + return submission_source_; + } + void set_submission_source(mojom::SubmissionSource submission_source) { submission_source_ = submission_source; } bool operator==(const FormData& form) const; @@ -612,7 +613,7 @@ // DetermineHeuristicTypes(). int developer_engagement_metrics_; - SubmissionSource submission_source_ = SubmissionSource::NONE; + mojom::SubmissionSource submission_source_ = mojom::SubmissionSource::NONE; // The randomized encoder to use to encode form metadata during upload. // If this is nullptr, no randomized metadata will be sent.
diff --git a/components/autofill/core/browser/form_structure_unittest.cc b/components/autofill/core/browser/form_structure_unittest.cc index ee316e5..e9e4ee7 100644 --- a/components/autofill/core/browser/form_structure_unittest.cc +++ b/components/autofill/core/browser/form_structure_unittest.cc
@@ -29,14 +29,17 @@ #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" -using autofill::features::kAutofillEnforceMinRequiredFieldsForHeuristics; -using autofill::features::kAutofillEnforceMinRequiredFieldsForQuery; -using autofill::features::kAutofillEnforceMinRequiredFieldsForUpload; -using autofill::mojom::SubmissionIndicatorEvent; using base::ASCIIToUTF16; namespace autofill { +using features::kAutofillEnforceMinRequiredFieldsForHeuristics; +using features::kAutofillEnforceMinRequiredFieldsForQuery; +using features::kAutofillEnforceMinRequiredFieldsForUpload; +using mojom::ButtonTitleType; +using mojom::SubmissionIndicatorEvent; +using mojom::SubmissionSource; + class FormStructureTest : public testing::Test { public: static std::string Hash64Bit(const std::string& str) { @@ -2480,6 +2483,47 @@ "PROBABLE_FORM_SUBMISSION enumerator does not match!"); } +TEST_F(FormStructureTest, ButtonTitleType_Match) { + // Statically assert that the mojo ButtonTitleType enum matches the + // corresponding entries the in proto AutofillUploadContents::ButtonTitle + // ButtonTitleType enum. + static_assert(AutofillUploadContents::ButtonTitle::NONE == + static_cast<int>(ButtonTitleType::NONE), + "NONE enumerator does not match!"); + + static_assert( + AutofillUploadContents::ButtonTitle::BUTTON_ELEMENT_SUBMIT_TYPE == + static_cast<int>(ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE), + "BUTTON_ELEMENT_SUBMIT_TYPE enumerator does not match!"); + + static_assert( + AutofillUploadContents::ButtonTitle::BUTTON_ELEMENT_BUTTON_TYPE == + static_cast<int>(ButtonTitleType::BUTTON_ELEMENT_BUTTON_TYPE), + "BUTTON_ELEMENT_BUTTON_TYPE enumerator does not match!"); + + static_assert( + AutofillUploadContents::ButtonTitle::INPUT_ELEMENT_SUBMIT_TYPE == + static_cast<int>(ButtonTitleType::INPUT_ELEMENT_SUBMIT_TYPE), + "INPUT_ELEMENT_SUBMIT_TYPE enumerator does not match!"); + + static_assert( + AutofillUploadContents::ButtonTitle::INPUT_ELEMENT_BUTTON_TYPE == + static_cast<int>(ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE), + "INPUT_ELEMENT_BUTTON_TYPE enumerator does not match!"); + + static_assert(AutofillUploadContents::ButtonTitle::HYPERLINK == + static_cast<int>(ButtonTitleType::HYPERLINK), + "HYPERLINK enumerator does not match!"); + + static_assert(AutofillUploadContents::ButtonTitle::DIV == + static_cast<int>(ButtonTitleType::DIV), + "DIV enumerator does not match!"); + + static_assert(AutofillUploadContents::ButtonTitle::SPAN == + static_cast<int>(ButtonTitleType::SPAN), + "SPAN enumerator does not match!"); +} + TEST_F(FormStructureTest, EncodeUploadRequest_WithMatchingValidities) { //////////////// // Setup
diff --git a/components/autofill/core/browser/payments/credit_card_save_manager_unittest.cc b/components/autofill/core/browser/payments/credit_card_save_manager_unittest.cc index 32a9ff57..4397bd7 100644 --- a/components/autofill/core/browser/payments/credit_card_save_manager_unittest.cc +++ b/components/autofill/core/browser/payments/credit_card_save_manager_unittest.cc
@@ -196,8 +196,8 @@ } void FormSubmitted(const FormData& form) { - autofill_manager_->OnFormSubmitted(form, false, - SubmissionSource::FORM_SUBMISSION); + autofill_manager_->OnFormSubmitted( + form, false, mojom::SubmissionSource::FORM_SUBMISSION); } void UserHasAcceptedUpload(
diff --git a/components/autofill/core/browser/payments/local_card_migration_manager_unittest.cc b/components/autofill/core/browser/payments/local_card_migration_manager_unittest.cc index a784a8c..49b1e14e 100644 --- a/components/autofill/core/browser/payments/local_card_migration_manager_unittest.cc +++ b/components/autofill/core/browser/payments/local_card_migration_manager_unittest.cc
@@ -120,8 +120,8 @@ } void FormSubmitted(const FormData& form) { - autofill_manager_->OnFormSubmitted(form, false, - SubmissionSource::FORM_SUBMISSION); + autofill_manager_->OnFormSubmitted( + form, false, mojom::SubmissionSource::FORM_SUBMISSION); } void EditCreditCardFrom(FormData& credit_card_form,
diff --git a/components/autofill/core/browser/personal_data_manager_unittest.cc b/components/autofill/core/browser/personal_data_manager_unittest.cc index 030fde7..15c88591 100644 --- a/components/autofill/core/browser/personal_data_manager_unittest.cc +++ b/components/autofill/core/browser/personal_data_manager_unittest.cc
@@ -2029,7 +2029,12 @@ suggestions[0].value); } -TEST_F(PersonalDataManagerTest, GetProfileSuggestions_PhoneSubstring) { +TEST_F(PersonalDataManagerTest, + GetProfileSuggestions_PhoneSubstring_NoImprovedDisambiguation) { + base::test::ScopedFeatureList scoped_features; + scoped_features.InitAndDisableFeature( + features::kAutofillUseImprovedLabelDisambiguation); + AutofillProfile profile(base::GenerateGUID(), test::kEmptyOrigin); test::SetProfileInfo(&profile, "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", @@ -2045,6 +2050,29 @@ EXPECT_EQ(base::ASCIIToUTF16("12345678910"), suggestions[0].value); } +#if !defined(OS_ANDROID) && !defined(OS_IOS) +TEST_F(PersonalDataManagerTest, + GetProfileSuggestions_PhoneSubstring_ImprovedDisambiguation) { + base::test::ScopedFeatureList scoped_features; + scoped_features.InitAndEnableFeature( + features::kAutofillUseImprovedLabelDisambiguation); + + AutofillProfile profile(base::GenerateGUID(), test::kEmptyOrigin); + test::SetProfileInfo(&profile, "Marion", "Mitchell", "Morrison", + "johnwayne@me.xyz", "Fox", + "123 Zoo St.\nSecond Line\nThird line", "unit 5", + "Hollywood", "CA", "91601", "US", "12345678910"); + AddProfileToPersonalDataManager(profile); + ResetPersonalDataManager(USER_MODE_NORMAL); + + std::vector<Suggestion> suggestions = personal_data_->GetProfileSuggestions( + AutofillType(PHONE_HOME_WHOLE_NUMBER), base::ASCIIToUTF16("234"), false, + std::vector<ServerFieldType>()); + ASSERT_FALSE(suggestions.empty()); + EXPECT_EQ(base::ASCIIToUTF16("(234) 567-8910"), suggestions[0].value); +} +#endif // !defined(OS_ANDROID) && !defined(OS_IOS) + TEST_F(PersonalDataManagerTest, GetProfileSuggestions_HideSubsets) { AutofillProfile profile(base::GenerateGUID(), test::kEmptyOrigin); test::SetProfileInfo(&profile, "Marion", "Mitchell", "Morrison",
diff --git a/components/autofill/core/browser/proto/server.proto b/components/autofill/core/browser/proto/server.proto index 83a3e57..a77adf9 100644 --- a/components/autofill/core/browser/proto/server.proto +++ b/components/autofill/core/browser/proto/server.proto
@@ -384,7 +384,8 @@ optional string title = 1; // Describes how the button is implemented in HTML source. Corresponds to - // components/autofill/core/common/button_title_type.h + // the mojo ButtonTitleType enum defined in + // components/autofill/core/common/mojom/autofill_types.mojom.h enum ButtonTitleType { NONE = 0; BUTTON_ELEMENT_SUBMIT_TYPE = 1; // <button type='submit'>
diff --git a/components/autofill/core/browser/test_autofill_provider.h b/components/autofill/core/browser/test_autofill_provider.h index ef533d8..a7fc221 100644 --- a/components/autofill/core/browser/test_autofill_provider.h +++ b/components/autofill/core/browser/test_autofill_provider.h
@@ -36,7 +36,7 @@ void OnFormSubmitted(AutofillHandlerProxy* handler, const FormData& form, bool known_success, - SubmissionSource source) override {} + mojom::SubmissionSource source) override {} void OnFocusNoLongerOnForm(AutofillHandlerProxy* handler) override; void OnFocusOnFormField(AutofillHandlerProxy* handler, const FormData& form,
diff --git a/components/autofill/core/common/BUILD.gn b/components/autofill/core/common/BUILD.gn index 236e460..17b0348 100644 --- a/components/autofill/core/common/BUILD.gn +++ b/components/autofill/core/common/BUILD.gn
@@ -27,7 +27,6 @@ "autofill_switches.h", "autofill_util.cc", "autofill_util.h", - "button_title_type.h", "form_data.cc", "form_data.h", "form_data_predictions.cc", @@ -49,7 +48,6 @@ "save_password_progress_logger.h", "signatures_util.cc", "signatures_util.h", - "submission_source.h", ] deps = [
diff --git a/components/autofill/core/common/autofill_util.cc b/components/autofill/core/common/autofill_util.cc index d0b2208..3da190d5 100644 --- a/components/autofill/core/common/autofill_util.cc +++ b/components/autofill/core/common/autofill_util.cc
@@ -25,6 +25,7 @@ using features::kAutofillKeyboardAccessory; using mojom::FocusedFieldType; using mojom::SubmissionIndicatorEvent; +using mojom::SubmissionSource; const char kAutofillKeyboardAccessoryAnimationDurationKey[] = "animation_duration_millis";
diff --git a/components/autofill/core/common/autofill_util.h b/components/autofill/core/common/autofill_util.h index 21fa3ce2..21ab53a 100644 --- a/components/autofill/core/common/autofill_util.h +++ b/components/autofill/core/common/autofill_util.h
@@ -13,7 +13,6 @@ #include "base/strings/string16.h" #include "components/autofill/core/common/form_field_data.h" #include "components/autofill/core/common/mojom/autofill_types.mojom-shared.h" -#include "components/autofill/core/common/submission_source.h" namespace base { struct Feature; @@ -107,7 +106,7 @@ bool IsFillable(mojom::FocusedFieldType focused_field_type); mojom::SubmissionIndicatorEvent ToSubmissionIndicatorEvent( - SubmissionSource source); + mojom::SubmissionSource source); } // namespace autofill
diff --git a/components/autofill/core/common/button_title_type.h b/components/autofill/core/common/button_title_type.h deleted file mode 100644 index bf3696d..0000000 --- a/components/autofill/core/common/button_title_type.h +++ /dev/null
@@ -1,26 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_AUTOFILL_CORE_COMMON_BUTTON_TITLE_TYPE_H_ -#define COMPONENTS_AUTOFILL_CORE_COMMON_BUTTON_TITLE_TYPE_H_ - -namespace autofill { - -// Describes how a form button is implemented in HTML source. Should be -// synced with |ButtonTitleType| in -// components/autofill/core/browser/proto/server.proto. -enum ButtonTitleType { - NONE = 0, - BUTTON_ELEMENT_SUBMIT_TYPE = 1, // <button type='submit'> - BUTTON_ELEMENT_BUTTON_TYPE = 2, // <button type='button'> - INPUT_ELEMENT_SUBMIT_TYPE = 3, // <input type='submit'> - INPUT_ELEMENT_BUTTON_TYPE = 4, // <input type='button'> - HYPERLINK = 5, // e.g. <a class='button'> - DIV = 6, // e.g. <div id='submit'> - SPAN = 7 // e.g. <span name='btn'> -}; - -} // namespace autofill - -#endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_SUBMISSION_SOURCE_H_
diff --git a/components/autofill/core/common/form_data.h b/components/autofill/core/common/form_data.h index 1a2c275d..0786bfda 100644 --- a/components/autofill/core/common/form_data.h +++ b/components/autofill/core/common/form_data.h
@@ -9,7 +9,6 @@ #include <vector> #include "base/strings/string16.h" -#include "components/autofill/core/common/button_title_type.h" #include "components/autofill/core/common/form_field_data.h" #include "components/autofill/core/common/mojom/autofill_types.mojom-shared.h" #include "url/gurl.h" @@ -19,7 +18,7 @@ // Pair of a button title (e.g. "Register") and its type (e.g. // INPUT_ELEMENT_SUBMIT_TYPE). -using ButtonTitleInfo = std::pair<base::string16, ButtonTitleType>; +using ButtonTitleInfo = std::pair<base::string16, mojom::ButtonTitleType>; // List of button titles of a given form. using ButtonTitleList = std::vector<ButtonTitleInfo>;
diff --git a/components/autofill/core/common/mojom/autofill_types.mojom b/components/autofill/core/common/mojom/autofill_types.mojom index 82b13bb..015e1b91 100644 --- a/components/autofill/core/common/mojom/autofill_types.mojom +++ b/components/autofill/core/common/mojom/autofill_types.mojom
@@ -37,15 +37,16 @@ PREDICTION_NOT_PASSWORD }; -// autofill::SubmissionSource enum SubmissionSource { - NONE, - SAME_DOCUMENT_NAVIGATION, - XHR_SUCCEEDED, - FRAME_DETACHED, - DOM_MUTATION_AFTER_XHR, - PROBABLY_FORM_SUBMITTED, - FORM_SUBMISSION, + NONE, // No submission signal was detected. + SAME_DOCUMENT_NAVIGATION, // The form was removed in same document + // navigation. + XHR_SUCCEEDED, // The form was removed whem XHR succeeded. + FRAME_DETACHED, // The subframe which has form was detached. + DOM_MUTATION_AFTER_XHR, // The form was removed after XHR. + PROBABLY_FORM_SUBMITTED, // The form was probably submitted since new page + // is loaded. + FORM_SUBMISSION, // Normal form submission. }; enum FocusedFieldType { @@ -63,16 +64,18 @@ ERROR_NOT_ALLOWED, // Filling not permitted (e.g. password in email field). }; -// autofill::ButtonTitleType +// Describes how a form button is implemented in HTML source. Should be +// synced with |ButtonTitleType| in +// components/autofill/core/browser/proto/server.proto. enum ButtonTitleType { - NONE, - BUTTON_ELEMENT_SUBMIT_TYPE, - BUTTON_ELEMENT_BUTTON_TYPE, - INPUT_ELEMENT_SUBMIT_TYPE, - INPUT_ELEMENT_BUTTON_TYPE, - HYPERLINK, - DIV, - SPAN + NONE = 0, + BUTTON_ELEMENT_SUBMIT_TYPE = 1, // <button type='submit'> + BUTTON_ELEMENT_BUTTON_TYPE = 2, // <button type='button'> + INPUT_ELEMENT_SUBMIT_TYPE = 3, // <input type='submit'> + INPUT_ELEMENT_BUTTON_TYPE = 4, // <input type='button'> + HYPERLINK = 5, // e.g. <a class='button'> + DIV = 6, // e.g. <div id='submit'> + SPAN = 7 // e.g. <span name='btn'> }; // autofill::FormFieldData
diff --git a/components/autofill/core/common/mojom/autofill_types.typemap b/components/autofill/core/common/mojom/autofill_types.typemap index b8a3fc3..cbc980b 100644 --- a/components/autofill/core/common/mojom/autofill_types.typemap +++ b/components/autofill/core/common/mojom/autofill_types.typemap
@@ -13,7 +13,6 @@ "//components/autofill/core/common/password_form_fill_data.h", "//components/autofill/core/common/password_form_generation_data.h", "//components/autofill/core/common/password_generation_util.h", - "//components/autofill/core/common/submission_source.h", ] traits_headers = [ "//components/autofill/core/common/mojom/autofill_types_struct_traits.h" ] @@ -41,6 +40,5 @@ "autofill.mojom.PasswordFormFillData=autofill::PasswordFormFillData", "autofill.mojom.PasswordFormGenerationData=autofill::PasswordFormGenerationData", "autofill.mojom.PasswordGenerationUIData=autofill::password_generation::PasswordGenerationUIData", - "autofill.mojom.SubmissionSource=autofill::SubmissionSource", "autofill.mojom.ValueElementPair=autofill::ValueElementPair", ]
diff --git a/components/autofill/core/common/mojom/autofill_types_struct_traits.cc b/components/autofill/core/common/mojom/autofill_types_struct_traits.cc index f616c02..ce270c55 100644 --- a/components/autofill/core/common/mojom/autofill_types_struct_traits.cc +++ b/components/autofill/core/common/mojom/autofill_types_struct_traits.cc
@@ -69,121 +69,6 @@ } // static -autofill::mojom::SubmissionSource EnumTraits< - autofill::mojom::SubmissionSource, - autofill::SubmissionSource>::ToMojom(autofill::SubmissionSource input) { - switch (input) { - case autofill::SubmissionSource::NONE: - return autofill::mojom::SubmissionSource::NONE; - case autofill::SubmissionSource::SAME_DOCUMENT_NAVIGATION: - return autofill::mojom::SubmissionSource::SAME_DOCUMENT_NAVIGATION; - case autofill::SubmissionSource::XHR_SUCCEEDED: - return autofill::mojom::SubmissionSource::XHR_SUCCEEDED; - case autofill::SubmissionSource::FRAME_DETACHED: - return autofill::mojom::SubmissionSource::FRAME_DETACHED; - case autofill::SubmissionSource::DOM_MUTATION_AFTER_XHR: - return autofill::mojom::SubmissionSource::DOM_MUTATION_AFTER_XHR; - case autofill::SubmissionSource::PROBABLY_FORM_SUBMITTED: - return autofill::mojom::SubmissionSource::PROBABLY_FORM_SUBMITTED; - case autofill::SubmissionSource::FORM_SUBMISSION: - return autofill::mojom::SubmissionSource::FORM_SUBMISSION; - } - NOTREACHED(); - return autofill::mojom::SubmissionSource::NONE; -} - -// static -bool EnumTraits<autofill::mojom::SubmissionSource, autofill::SubmissionSource>:: - FromMojom(autofill::mojom::SubmissionSource input, - autofill::SubmissionSource* output) { - switch (input) { - case autofill::mojom::SubmissionSource::NONE: - *output = autofill::SubmissionSource::NONE; - return true; - case autofill::mojom::SubmissionSource::SAME_DOCUMENT_NAVIGATION: - *output = autofill::SubmissionSource::SAME_DOCUMENT_NAVIGATION; - return true; - case autofill::mojom::SubmissionSource::XHR_SUCCEEDED: - *output = autofill::SubmissionSource::XHR_SUCCEEDED; - return true; - case autofill::mojom::SubmissionSource::FRAME_DETACHED: - *output = autofill::SubmissionSource::FRAME_DETACHED; - return true; - case autofill::mojom::SubmissionSource::DOM_MUTATION_AFTER_XHR: - *output = autofill::SubmissionSource::DOM_MUTATION_AFTER_XHR; - return true; - case autofill::mojom::SubmissionSource::PROBABLY_FORM_SUBMITTED: - *output = autofill::SubmissionSource::PROBABLY_FORM_SUBMITTED; - return true; - case autofill::mojom::SubmissionSource::FORM_SUBMISSION: - *output = autofill::SubmissionSource::FORM_SUBMISSION; - return true; - } - NOTREACHED(); - return false; -} - -// static -autofill::mojom::ButtonTitleType EnumTraits< - autofill::mojom::ButtonTitleType, - autofill::ButtonTitleType>::ToMojom(autofill::ButtonTitleType input) { - switch (input) { - case autofill::ButtonTitleType::NONE: - return autofill::mojom::ButtonTitleType::NONE; - case autofill::ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE: - return autofill::mojom::ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE; - case autofill::ButtonTitleType::BUTTON_ELEMENT_BUTTON_TYPE: - return autofill::mojom::ButtonTitleType::BUTTON_ELEMENT_BUTTON_TYPE; - case autofill::ButtonTitleType::INPUT_ELEMENT_SUBMIT_TYPE: - return autofill::mojom::ButtonTitleType::INPUT_ELEMENT_SUBMIT_TYPE; - case autofill::ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE: - return autofill::mojom::ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE; - case autofill::ButtonTitleType::HYPERLINK: - return autofill::mojom::ButtonTitleType::HYPERLINK; - case autofill::ButtonTitleType::DIV: - return autofill::mojom::ButtonTitleType::DIV; - case autofill::ButtonTitleType::SPAN: - return autofill::mojom::ButtonTitleType::SPAN; - } - NOTREACHED(); - return autofill::mojom::ButtonTitleType::NONE; -} - -// static -bool EnumTraits<autofill::mojom::ButtonTitleType, autofill::ButtonTitleType>:: - FromMojom(autofill::mojom::ButtonTitleType input, - autofill::ButtonTitleType* output) { - switch (input) { - case autofill::mojom::ButtonTitleType::NONE: - *output = autofill::ButtonTitleType::NONE; - return true; - case autofill::mojom::ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE: - *output = autofill::ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE; - return true; - case autofill::mojom::ButtonTitleType::BUTTON_ELEMENT_BUTTON_TYPE: - *output = autofill::ButtonTitleType::BUTTON_ELEMENT_BUTTON_TYPE; - return true; - case autofill::mojom::ButtonTitleType::INPUT_ELEMENT_SUBMIT_TYPE: - *output = autofill::ButtonTitleType::INPUT_ELEMENT_SUBMIT_TYPE; - return true; - case autofill::mojom::ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE: - *output = autofill::ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE; - return true; - case autofill::mojom::ButtonTitleType::HYPERLINK: - *output = autofill::ButtonTitleType::HYPERLINK; - return true; - case autofill::mojom::ButtonTitleType::DIV: - *output = autofill::ButtonTitleType::DIV; - return true; - case autofill::mojom::ButtonTitleType::SPAN: - *output = autofill::ButtonTitleType::SPAN; - return true; - } - NOTREACHED(); - return false; -} - -// static bool StructTraits< autofill::mojom::FormFieldDataDataView, autofill::FormFieldData>::Read(autofill::mojom::FormFieldDataDataView data,
diff --git a/components/autofill/core/common/mojom/autofill_types_struct_traits.h b/components/autofill/core/common/mojom/autofill_types_struct_traits.h index dc11967..67c55d80 100644 --- a/components/autofill/core/common/mojom/autofill_types_struct_traits.h +++ b/components/autofill/core/common/mojom/autofill_types_struct_traits.h
@@ -22,7 +22,6 @@ #include "components/autofill/core/common/password_form_fill_data.h" #include "components/autofill/core/common/password_form_generation_data.h" #include "components/autofill/core/common/password_generation_util.h" -#include "components/autofill/core/common/submission_source.h" #include "mojo/public/cpp/base/text_direction_mojom_traits.h" #include "mojo/public/cpp/bindings/struct_traits.h" #include "ui/gfx/geometry/rect_f.h" @@ -40,23 +39,6 @@ }; template <> -struct EnumTraits<autofill::mojom::SubmissionSource, - autofill::SubmissionSource> { - static autofill::mojom::SubmissionSource ToMojom( - autofill::SubmissionSource input); - static bool FromMojom(autofill::mojom::SubmissionSource input, - autofill::SubmissionSource* output); -}; - -template <> -struct EnumTraits<autofill::mojom::ButtonTitleType, autofill::ButtonTitleType> { - static autofill::mojom::ButtonTitleType ToMojom( - autofill::ButtonTitleType input); - static bool FromMojom(autofill::mojom::ButtonTitleType input, - autofill::ButtonTitleType* output); -}; - -template <> struct StructTraits<autofill::mojom::FormFieldDataDataView, autofill::FormFieldData> { static const base::string16& label(const autofill::FormFieldData& r) { @@ -188,7 +170,7 @@ return r.first; } - static const autofill::ButtonTitleType& type( + static autofill::mojom::ButtonTitleType type( const autofill::ButtonTitleInfo& r) { return r.second; }
diff --git a/components/autofill/core/common/mojom/autofill_types_struct_traits_unittest.cc b/components/autofill/core/common/mojom/autofill_types_struct_traits_unittest.cc index abf720b..8071a635 100644 --- a/components/autofill/core/common/mojom/autofill_types_struct_traits_unittest.cc +++ b/components/autofill/core/common/mojom/autofill_types_struct_traits_unittest.cc
@@ -9,7 +9,6 @@ #include "base/strings/utf_string_conversions.h" #include "base/test/scoped_task_environment.h" #include "components/autofill/core/browser/autofill_test_utils.h" -#include "components/autofill/core/common/button_title_type.h" #include "components/autofill/core/common/form_data.h" #include "components/autofill/core/common/form_field_data.h" #include "components/autofill/core/common/mojom/test_autofill_types.mojom.h" @@ -387,7 +386,7 @@ input.username_predictions = {1, 13, 2}; input.button_titles.push_back( std::make_pair(base::ASCIIToUTF16("Sign-up"), - autofill::ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE)); + mojom::ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE)); base::RunLoop loop; mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy();
diff --git a/components/autofill/core/common/password_form.cc b/components/autofill/core/common/password_form.cc index 82b8425..421aecf 100644 --- a/components/autofill/core/common/password_form.cc +++ b/components/autofill/core/common/password_form.cc
@@ -12,7 +12,6 @@ #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "components/autofill/core/common/password_form.h" -#include "components/autofill/core/common/submission_source.h" namespace autofill {
diff --git a/components/autofill/core/common/password_form.h b/components/autofill/core/common/password_form.h index 7061e48..f67af1d 100644 --- a/components/autofill/core/common/password_form.h +++ b/components/autofill/core/common/password_form.h
@@ -19,8 +19,6 @@ namespace autofill { -enum class SubmissionSource; - // Pair of a value and the name of the element that contained this value. using ValueElementPair = std::pair<base::string16, base::string16>;
diff --git a/components/autofill/core/common/submission_source.h b/components/autofill/core/common/submission_source.h deleted file mode 100644 index 5eab05a1..0000000 --- a/components/autofill/core/common/submission_source.h +++ /dev/null
@@ -1,25 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_AUTOFILL_CORE_COMMON_SUBMISSION_SOURCE_H_ -#define COMPONENTS_AUTOFILL_CORE_COMMON_SUBMISSION_SOURCE_H_ - -namespace autofill { - -// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.autofill -enum class SubmissionSource { - NONE, // No submission signal was detected. - SAME_DOCUMENT_NAVIGATION, // The form was removed in same document - // navigation. - XHR_SUCCEEDED, // The form was removed whem XHR succeeded. - FRAME_DETACHED, // The subframe which has form was detached. - DOM_MUTATION_AFTER_XHR, // The form was removed after XHR. - PROBABLY_FORM_SUBMITTED, // The form was probably submitted since new page - // is loaded. - FORM_SUBMISSION, // Normal form submission. -}; - -} // namespace autofill - -#endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_SUBMISSION_SOURCE_H_
diff --git a/components/autofill/ios/browser/autofill_agent.mm b/components/autofill/ios/browser/autofill_agent.mm index 217b154..ad390756 100644 --- a/components/autofill/ios/browser/autofill_agent.mm +++ b/components/autofill/ios/browser/autofill_agent.mm
@@ -229,8 +229,8 @@ // Exactly one form should be extracted. DCHECK_EQ(1U, forms.size()); autofill::FormData form = forms[0]; - autofillManager->OnFormSubmitted(form, false, - autofill::SubmissionSource::FORM_SUBMISSION); + autofillManager->OnFormSubmitted( + form, false, autofill::mojom::SubmissionSource::FORM_SUBMISSION); autofill::KeyboardAccessoryMetricsLogger::OnFormSubmitted(); }
diff --git a/components/autofill_assistant/browser/controller.cc b/components/autofill_assistant/browser/controller.cc index 792ad36..9202f4b5 100644 --- a/components/autofill_assistant/browser/controller.cc +++ b/components/autofill_assistant/browser/controller.cc
@@ -654,38 +654,25 @@ bool Controller::MaybeAutostartScript( const std::vector<ScriptHandle>& runnable_scripts) { - // We want to go through all runnable autostart interrupts first, one at a - // time. To do that, always run highest priority autostartable interrupt from - // runnable_script, which is ordered by priority. - for (const auto& script : runnable_scripts) { - if (script.autostart && script.interrupt) { - std::string script_path = script.path; - ExecuteScript(script_path, state_); - // making a copy of script.path is necessary, as ExecuteScript clears - // runnable_scripts, so script.path will not survive until the end of - // ExecuteScript. - return true; - } - } - // Under specific conditions, we can directly run a non-interrupt script // without first displaying it. This is meant to work only at the very - // beginning, when no non-interrupt scripts have run, and only if there's - // exactly one autostartable script. - if (allow_autostart_) { - int autostart_count = 0; - std::string autostart_path; - for (const auto& script : runnable_scripts) { - if (script.autostart && !script.interrupt) { - autostart_count++; - autostart_path = script.path; - } + // beginning, when no scripts have run, and only if there's exactly one + // autostartable script. + if (!allow_autostart_) + return false; + + int autostart_count = 0; + std::string autostart_path; + for (const auto& script : runnable_scripts) { + if (script.autostart) { + autostart_count++; + autostart_path = script.path; } - if (autostart_count == 1) { - DisableAutostart(); - ExecuteScript(autostart_path, AutofillAssistantState::PROMPT); - return true; - } + } + if (autostart_count == 1) { + DisableAutostart(); + ExecuteScript(autostart_path, AutofillAssistantState::PROMPT); + return true; } return false; }
diff --git a/components/autofill_assistant/browser/controller_unittest.cc b/components/autofill_assistant/browser/controller_unittest.cc index 60338d4f..001fb16c 100644 --- a/components/autofill_assistant/browser/controller_unittest.cc +++ b/components/autofill_assistant/browser/controller_unittest.cc
@@ -471,59 +471,6 @@ Start("http://a.example.com/path"); } -TEST_F(ControllerTest, AutostartFirstInterrupt) { - SupportsScriptResponseProto script_response; - AddRunnableScript(&script_response, "runnable"); - - auto* interrupt1 = - AddRunnableScript(&script_response, "autostart interrupt 1"); - interrupt1->mutable_presentation()->set_interrupt(true); - interrupt1->mutable_presentation()->set_priority(1); - interrupt1->mutable_presentation()->set_autostart(true); - - auto* interrupt2 = - AddRunnableScript(&script_response, "autostart interrupt 2"); - interrupt2->mutable_presentation()->set_interrupt(true); - interrupt2->mutable_presentation()->set_priority(2); - interrupt2->mutable_presentation()->set_autostart(true); - - SetNextScriptResponse(script_response); - - EXPECT_CALL(*mock_service_, - OnGetActions(StrEq("autostart interrupt 1"), _, _, _, _, _)) - .WillOnce(RunOnceCallback<5>(false, "")); - // The script fails, ending the flow. What matters is that the correct - // expectation is met. - - Start("http://a.example.com/path"); -} - -TEST_F(ControllerTest, InterruptThenAutostart) { - SupportsScriptResponseProto script_response; - AddRunnableScript(&script_response, "runnable"); - - auto* interrupt = AddRunnableScript(&script_response, "autostart interrupt"); - interrupt->mutable_presentation()->set_interrupt(true); - interrupt->mutable_presentation()->set_autostart(true); - RunOnce(interrupt); - - auto* autostart = AddRunnableScript(&script_response, "autostart"); - autostart->mutable_presentation()->set_autostart(true); - RunOnce(autostart); - - SetRepeatedScriptResponse(script_response); - - { - testing::InSequence seq; - EXPECT_CALL(*mock_service_, - OnGetActions(StrEq("autostart interrupt"), _, _, _, _, _)); - EXPECT_CALL(*mock_service_, - OnGetActions(StrEq("autostart"), _, _, _, _, _)); - } - - Start("http://a.example.com/path"); -} - TEST_F(ControllerTest, AutostartIsNotPassedToTheUi) { SupportsScriptResponseProto script_response; auto* autostart = AddRunnableScript(&script_response, "runnable");
diff --git a/components/autofill_assistant/browser/protocol_utils.cc b/components/autofill_assistant/browser/protocol_utils.cc index 16c45690..95686a0b 100644 --- a/components/autofill_assistant/browser/protocol_utils.cc +++ b/components/autofill_assistant/browser/protocol_utils.cc
@@ -87,8 +87,12 @@ script->handle.path = script_proto.path(); const auto& presentation = script_proto.presentation(); - script->handle.autostart = presentation.autostart(); script->handle.interrupt = presentation.interrupt(); + if (presentation.interrupt()) { + script->handle.interrupt = true; + } else { + script->handle.autostart = presentation.autostart(); + } script->handle.initial_prompt = presentation.initial_prompt(); if (presentation.has_chip()) {
diff --git a/components/autofill_assistant/browser/protocol_utils_unittest.cc b/components/autofill_assistant/browser/protocol_utils_unittest.cc index ff9899fa..79985a91 100644 --- a/components/autofill_assistant/browser/protocol_utils_unittest.cc +++ b/components/autofill_assistant/browser/protocol_utils_unittest.cc
@@ -96,6 +96,21 @@ EXPECT_TRUE(scripts[0]->handle.interrupt); } +TEST(ProtocolUtilsTest, InterruptsCannotBeAutostart) { + SupportedScriptProto script_proto; + script_proto.set_path("path"); + auto* presentation = script_proto.mutable_presentation(); + presentation->set_autostart(true); + presentation->set_interrupt(true); + presentation->mutable_precondition()->add_domain("www.example.com"); + + std::vector<std::unique_ptr<Script>> scripts; + ProtocolUtils::AddScript(script_proto, &scripts); + ASSERT_THAT(scripts, SizeIs(1)); + EXPECT_FALSE(scripts[0]->handle.autostart); + EXPECT_TRUE(scripts[0]->handle.interrupt); +} + TEST(ProtocolUtilsTest, CreateInitialScriptActionsRequest) { TriggerContext trigger_context; trigger_context.script_parameters["a"] = "b";
diff --git a/components/autofill_assistant/browser/script_tracker_unittest.cc b/components/autofill_assistant/browser/script_tracker_unittest.cc index a1391fa..a666ca9c 100644 --- a/components/autofill_assistant/browser/script_tracker_unittest.cc +++ b/components/autofill_assistant/browser/script_tracker_unittest.cc
@@ -174,19 +174,6 @@ EXPECT_EQ("with name", runnable_scripts()[0].chip.text()); } -TEST_F(ScriptTrackerTest, ReportInterruptToAutostart) { - - // The interrupt's preconditions are met and it will be reported as runnable - // for autostart. - auto* autostart = AddScript("", "path2", "exists"); - autostart->mutable_presentation()->set_interrupt(true); - autostart->mutable_presentation()->set_autostart(true); - SetAndCheckScripts(); - - EXPECT_EQ(1, runnable_scripts_changed_); - ASSERT_THAT(runnable_scripts(), SizeIs(1)); -} - TEST_F(ScriptTrackerTest, OrderScriptsByPriority) { SupportedScriptProto* a = AddScript(); a->set_path("a");
diff --git a/components/favicon/core/favicon_request_handler.cc b/components/favicon/core/favicon_request_handler.cc index 8ce2a4969..143ce86 100644 --- a/components/favicon/core/favicon_request_handler.cc +++ b/components/favicon/core/favicon_request_handler.cc
@@ -16,7 +16,9 @@ #include "components/favicon/core/features.h" #include "components/favicon/core/large_icon_service.h" #include "components/favicon_base/favicon_types.h" +#include "components/favicon_base/favicon_util.h" #include "net/traffic_annotation/network_traffic_annotation.h" +#include "ui/gfx/image/image_png_rep.h" namespace favicon { @@ -215,9 +217,11 @@ favicon_base::FaviconRawBitmapResult sync_bitmap_result = synced_favicon_getter_.Run(page_url); if (sync_bitmap_result.is_valid()) { - // If request to sync succeeds, send the retrieved bitmap. + // If request to sync succeeds, resize bitmap to desired size and send. RecordFaviconAvailabilityMetric(origin, FaviconAvailability::kSync); - std::move(response_callback).Run(sync_bitmap_result); + std::move(response_callback) + .Run(favicon_base::ResizeFaviconBitmapResult({sync_bitmap_result}, + desired_size_in_pixel)); return; }
diff --git a/components/favicon/core/favicon_request_handler_unittest.cc b/components/favicon/core/favicon_request_handler_unittest.cc index 4ba8398..2d980a33 100644 --- a/components/favicon/core/favicon_request_handler_unittest.cc +++ b/components/favicon/core/favicon_request_handler_unittest.cc
@@ -32,31 +32,39 @@ const char kDummyPageUrl[] = "https://www.example.com"; const char kDummyIconUrl[] = "https://www.example.com/favicon16.png"; -const int kDesiredSizeInPixel = 16; +const int kDefaultDesiredSizeInPixel = 16; // TODO(victorvianna): Add unit tests specific for mobile. const FaviconRequestPlatform kDummyPlatform = FaviconRequestPlatform::kDesktop; const SkColor kTestColor = SK_ColorRED; base::CancelableTaskTracker::TaskId kDummyTaskId = 1; -SkBitmap CreateTestSkBitmap() { +SkBitmap CreateTestSkBitmap(int desired_size_in_pixel) { SkBitmap bitmap; - bitmap.allocN32Pixels(kDesiredSizeInPixel, kDesiredSizeInPixel); + bitmap.allocN32Pixels(desired_size_in_pixel, desired_size_in_pixel); bitmap.eraseColor(kTestColor); return bitmap; } -favicon_base::FaviconRawBitmapResult CreateTestBitmapResult() { +favicon_base::FaviconRawBitmapResult CreateTestBitmapResult( + int desired_size_in_pixel) { scoped_refptr<base::RefCountedBytes> data(new base::RefCountedBytes()); - gfx::PNGCodec::EncodeBGRASkBitmap(CreateTestSkBitmap(), false, &data->data()); + gfx::PNGCodec::EncodeBGRASkBitmap(CreateTestSkBitmap(desired_size_in_pixel), + false, &data->data()); favicon_base::FaviconRawBitmapResult result; result.bitmap_data = data; result.icon_url = GURL(kDummyIconUrl); + result.pixel_size = gfx::Size(desired_size_in_pixel, desired_size_in_pixel); return result; } +favicon_base::FaviconRawBitmapResult CreateTestBitmapResult() { + return CreateTestBitmapResult(kDefaultDesiredSizeInPixel); +} + favicon_base::FaviconImageResult CreateTestImageResult() { favicon_base::FaviconImageResult result; - result.image = gfx::Image::CreateFrom1xBitmap(CreateTestSkBitmap()); + result.image = gfx::Image::CreateFrom1xBitmap( + CreateTestSkBitmap(kDefaultDesiredSizeInPixel)); result.icon_url = GURL(kDummyIconUrl); return result; } @@ -133,9 +141,10 @@ TEST_F(FaviconRequestHandlerTest, ShouldGetEmptyBitmap) { scoped_feature_list_.InitAndDisableFeature( kEnableHistoryFaviconsGoogleServerQuery); - EXPECT_CALL(mock_favicon_service_, - GetRawFaviconForPageURL(GURL(kDummyPageUrl), _, - kDesiredSizeInPixel, _, _, &tracker_)) + EXPECT_CALL( + mock_favicon_service_, + GetRawFaviconForPageURL(GURL(kDummyPageUrl), _, + kDefaultDesiredSizeInPixel, _, _, &tracker_)) .WillOnce([](auto, auto, auto, auto, favicon_base::FaviconRawBitmapCallback callback, auto) { std::move(callback).Run(favicon_base::FaviconRawBitmapResult()); @@ -145,7 +154,7 @@ .WillOnce([](auto) { return favicon_base::FaviconRawBitmapResult(); }); favicon_base::FaviconRawBitmapResult result; favicon_request_handler_.GetRawFaviconForPageURL( - GURL(kDummyPageUrl), kDesiredSizeInPixel, + GURL(kDummyPageUrl), kDefaultDesiredSizeInPixel, base::BindOnce(&StoreBitmap, &result), FaviconRequestOrigin::UNKNOWN, kDummyPlatform, /*icon_url_for_uma=*/GURL(), @@ -158,9 +167,10 @@ TEST_F(FaviconRequestHandlerTest, ShouldGetSyncBitmap) { scoped_feature_list_.InitAndDisableFeature( kEnableHistoryFaviconsGoogleServerQuery); - EXPECT_CALL(mock_favicon_service_, - GetRawFaviconForPageURL(GURL(kDummyPageUrl), _, - kDesiredSizeInPixel, _, _, &tracker_)) + EXPECT_CALL( + mock_favicon_service_, + GetRawFaviconForPageURL(GURL(kDummyPageUrl), _, + kDefaultDesiredSizeInPixel, _, _, &tracker_)) .WillOnce([](auto, auto, auto, auto, favicon_base::FaviconRawBitmapCallback callback, auto) { std::move(callback).Run(favicon_base::FaviconRawBitmapResult()); @@ -170,7 +180,7 @@ .WillOnce([](auto) { return CreateTestBitmapResult(); }); favicon_base::FaviconRawBitmapResult result; favicon_request_handler_.GetRawFaviconForPageURL( - GURL(kDummyPageUrl), kDesiredSizeInPixel, + GURL(kDummyPageUrl), kDefaultDesiredSizeInPixel, base::BindOnce(&StoreBitmap, &result), FaviconRequestOrigin::UNKNOWN, kDummyPlatform, /*icon_url_for_uma=*/GURL(), @@ -183,9 +193,10 @@ TEST_F(FaviconRequestHandlerTest, ShouldGetLocalBitmap) { scoped_feature_list_.InitAndDisableFeature( kEnableHistoryFaviconsGoogleServerQuery); - EXPECT_CALL(mock_favicon_service_, - GetRawFaviconForPageURL(GURL(kDummyPageUrl), _, - kDesiredSizeInPixel, _, _, &tracker_)) + EXPECT_CALL( + mock_favicon_service_, + GetRawFaviconForPageURL(GURL(kDummyPageUrl), _, + kDefaultDesiredSizeInPixel, _, _, &tracker_)) .WillOnce([](auto, auto, auto, auto, favicon_base::FaviconRawBitmapCallback callback, auto) { std::move(callback).Run(CreateTestBitmapResult()); @@ -196,7 +207,7 @@ EXPECT_CALL(synced_favicon_getter_, Run(_)).Times(0); favicon_base::FaviconRawBitmapResult result; favicon_request_handler_.GetRawFaviconForPageURL( - GURL(kDummyPageUrl), kDesiredSizeInPixel, + GURL(kDummyPageUrl), kDefaultDesiredSizeInPixel, base::BindOnce(&StoreBitmap, &result), FaviconRequestOrigin::UNKNOWN, kDummyPlatform, /*icon_url_for_uma=*/GURL(), @@ -209,9 +220,10 @@ TEST_F(FaviconRequestHandlerTest, ShouldGetGoogleServerBitmapForFullUrl) { scoped_feature_list_.InitAndEnableFeatureWithParameters( kEnableHistoryFaviconsGoogleServerQuery, {{"trim_url_path", "false"}}); - EXPECT_CALL(mock_favicon_service_, - GetRawFaviconForPageURL(GURL(kDummyPageUrl), _, - kDesiredSizeInPixel, _, _, &tracker_)) + EXPECT_CALL( + mock_favicon_service_, + GetRawFaviconForPageURL(GURL(kDummyPageUrl), _, + kDefaultDesiredSizeInPixel, _, _, &tracker_)) .WillOnce([](auto, auto, auto, auto, favicon_base::FaviconRawBitmapCallback callback, auto) { std::move(callback).Run(favicon_base::FaviconRawBitmapResult()); @@ -233,7 +245,7 @@ EXPECT_CALL(synced_favicon_getter_, Run(_)).Times(0); favicon_base::FaviconRawBitmapResult result; favicon_request_handler_.GetRawFaviconForPageURL( - GURL(kDummyPageUrl), kDesiredSizeInPixel, + GURL(kDummyPageUrl), kDefaultDesiredSizeInPixel, base::BindOnce(&StoreBitmap, &result), FaviconRequestOrigin::HISTORY, kDummyPlatform, /*icon_url_for_uma=*/GURL(), @@ -244,9 +256,10 @@ TEST_F(FaviconRequestHandlerTest, ShouldGetGoogleServerBitmapForTrimmedUrl) { scoped_feature_list_.InitAndEnableFeatureWithParameters( kEnableHistoryFaviconsGoogleServerQuery, {{"trim_url_path", "true"}}); - EXPECT_CALL(mock_favicon_service_, - GetRawFaviconForPageURL(GURL(kDummyPageUrl), _, - kDesiredSizeInPixel, _, _, &tracker_)) + EXPECT_CALL( + mock_favicon_service_, + GetRawFaviconForPageURL(GURL(kDummyPageUrl), _, + kDefaultDesiredSizeInPixel, _, _, &tracker_)) .WillOnce([](auto, auto, auto, auto, favicon_base::FaviconRawBitmapCallback callback, auto) { std::move(callback).Run(favicon_base::FaviconRawBitmapResult()); @@ -268,7 +281,7 @@ EXPECT_CALL(synced_favicon_getter_, Run(_)).Times(0); favicon_base::FaviconRawBitmapResult result; favicon_request_handler_.GetRawFaviconForPageURL( - GURL(kDummyPageUrl), kDesiredSizeInPixel, + GURL(kDummyPageUrl), kDefaultDesiredSizeInPixel, base::BindOnce(&StoreBitmap, &result), FaviconRequestOrigin::HISTORY, kDummyPlatform, /*icon_url_for_uma=*/GURL(), @@ -416,9 +429,10 @@ TEST_F(FaviconRequestHandlerTest, ShouldNotQueryGoogleServerIfCannotSendData) { scoped_feature_list_.InitAndEnableFeature( kEnableHistoryFaviconsGoogleServerQuery); - EXPECT_CALL(mock_favicon_service_, - GetRawFaviconForPageURL(GURL(kDummyPageUrl), _, - kDesiredSizeInPixel, _, _, &tracker_)) + EXPECT_CALL( + mock_favicon_service_, + GetRawFaviconForPageURL(GURL(kDummyPageUrl), _, + kDefaultDesiredSizeInPixel, _, _, &tracker_)) .WillOnce([](auto, auto, auto, auto, favicon_base::FaviconRawBitmapCallback callback, auto) { std::move(callback).Run(favicon_base::FaviconRawBitmapResult()); @@ -430,12 +444,40 @@ .Times(0); favicon_base::FaviconRawBitmapResult result; favicon_request_handler_.GetRawFaviconForPageURL( - GURL(kDummyPageUrl), kDesiredSizeInPixel, + GURL(kDummyPageUrl), kDefaultDesiredSizeInPixel, base::BindOnce(&StoreBitmap, &result), FaviconRequestOrigin::HISTORY, kDummyPlatform, /*icon_url_for_uma=*/GURL(), /*can_send_history_data=*/false, &tracker_); } +TEST_F(FaviconRequestHandlerTest, ShouldResizeSyncBitmap) { + const int kDesiredSizeInPixel = 32; + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list_.InitAndDisableFeature( + kEnableHistoryFaviconsGoogleServerQuery); + EXPECT_CALL(mock_favicon_service_, + GetRawFaviconForPageURL(GURL(kDummyPageUrl), _, + kDesiredSizeInPixel, _, _, &tracker_)) + .WillOnce([](auto, auto, auto, auto, + favicon_base::FaviconRawBitmapCallback callback, auto) { + std::move(callback).Run(favicon_base::FaviconRawBitmapResult()); + return kDummyTaskId; + }); + // Have sync return bitmap of different size from the one requested. + EXPECT_CALL(synced_favicon_getter_, Run(GURL(kDummyPageUrl))) + .WillOnce([](auto) { return CreateTestBitmapResult(16); }); + favicon_base::FaviconRawBitmapResult result; + favicon_request_handler_.GetRawFaviconForPageURL( + GURL(kDummyPageUrl), kDesiredSizeInPixel, + base::BindOnce(&StoreBitmap, &result), FaviconRequestOrigin::UNKNOWN, + kDummyPlatform, + /*icon_url_for_uma=*/GURL(), + /*can_send_history_data=*/true, &tracker_); + EXPECT_TRUE(result.is_valid()); + EXPECT_EQ(gfx::Size(kDesiredSizeInPixel, kDesiredSizeInPixel), + result.pixel_size); +} + } // namespace } // namespace favicon
diff --git a/components/password_manager/core/browser/credential_manager_pending_request_task.cc b/components/password_manager/core/browser/credential_manager_pending_request_task.cc index 9179e89e..9ff4c1d 100644 --- a/components/password_manager/core/browser/credential_manager_pending_request_task.cc +++ b/components/password_manager/core/browser/credential_manager_pending_request_task.cc
@@ -27,31 +27,6 @@ namespace password_manager { namespace { -// Send a UMA histogram about if |local_results| has empty or duplicate -// usernames. -void ReportAccountChooserUsabilityMetrics( - const std::vector<std::unique_ptr<autofill::PasswordForm>>& forms, - bool had_duplicates, - bool had_empty_username) { - metrics_util::AccountChooserUsabilityMetric metric; - if (had_empty_username && had_duplicates) - metric = metrics_util::ACCOUNT_CHOOSER_EMPTY_USERNAME_AND_DUPLICATES; - else if (had_empty_username) - metric = metrics_util::ACCOUNT_CHOOSER_EMPTY_USERNAME; - else if (had_duplicates) - metric = metrics_util::ACCOUNT_CHOOSER_DUPLICATES; - else - metric = metrics_util::ACCOUNT_CHOOSER_LOOKS_OK; - - int count_empty_icons = - std::count_if(forms.begin(), forms.end(), - [](const std::unique_ptr<autofill::PasswordForm>& form) { - return !form->icon_url.is_valid(); - }); - metrics_util::LogAccountChooserUsability(metric, count_empty_icons, - forms.size()); -} - // Returns true iff |form1| is better suitable for showing in the account // chooser than |form2|. Inspired by PasswordFormManager::ScoreResult. bool IsBetterMatch(const autofill::PasswordForm& form1, @@ -94,20 +69,14 @@ // Sift |forms| for the account chooser so it doesn't have empty usernames or // duplicates. void FilterDuplicatesAndEmptyUsername( - std::vector<std::unique_ptr<autofill::PasswordForm>>* forms, - bool* has_empty_username, - bool* has_duplicates) { + std::vector<std::unique_ptr<autofill::PasswordForm>>* forms) { // Remove empty usernames from the list. - size_t size_before = forms->size(); base::EraseIf(*forms, [](const std::unique_ptr<autofill::PasswordForm>& form) { return form->username_value.empty(); }); - *has_empty_username = (size_before != forms->size()); - size_before = forms->size(); FilterDuplicates(forms); - *has_duplicates = (size_before != forms->size()); } } // namespace @@ -187,10 +156,7 @@ } } - bool has_empty_username = false; - bool has_duplicates = false; - FilterDuplicatesAndEmptyUsername(&local_results, &has_empty_username, - &has_duplicates); + FilterDuplicatesAndEmptyUsername(&local_results); // We only perform zero-click sign-in when it is not forbidden via the // mediation requirement and the result is completely unambigious. @@ -247,8 +213,7 @@ // should list the PSL matches. if (local_results.empty()) { local_results = std::move(psl_results); - FilterDuplicatesAndEmptyUsername(&local_results, &has_empty_username, - &has_duplicates); + FilterDuplicatesAndEmptyUsername(&local_results); } if (local_results.empty()) { @@ -258,8 +223,6 @@ return; } - ReportAccountChooserUsabilityMetrics(local_results, has_duplicates, - has_empty_username); if (!delegate_->client()->PromptUserToChooseCredentials( std::move(local_results), origin_, base::Bind(
diff --git a/components/password_manager/core/browser/http_auth_manager_impl.cc b/components/password_manager/core/browser/http_auth_manager_impl.cc index 698ef031..1de5d5fb 100644 --- a/components/password_manager/core/browser/http_auth_manager_impl.cc +++ b/components/password_manager/core/browser/http_auth_manager_impl.cc
@@ -103,6 +103,11 @@ return; } + // ProvisionallySaveForm() might not have called, so |form_manager_| might be + // not in submitted state. Do nothing in that case. + if (!form_manager_->is_submitted()) + return; + // TODO(crbug/831123) Move the logic into the PasswordFormManager. bool is_update = form_manager_->IsPasswordUpdate(); bool is_new_login = form_manager_->IsNewLogin();
diff --git a/components/password_manager/core/browser/http_auth_manager_unittest.cc b/components/password_manager/core/browser/http_auth_manager_unittest.cc index 11bd42d..ba08e4fe 100644 --- a/components/password_manager/core/browser/http_auth_manager_unittest.cc +++ b/components/password_manager/core/browser/http_auth_manager_unittest.cc
@@ -196,4 +196,26 @@ } } +TEST_F(HttpAuthManagerTest, NavigationWithoutSubmission) { + EXPECT_CALL(client_, IsSavingAndFillingEnabled(_)) + .WillRepeatedly(Return(true)); + PasswordForm observed_form; + observed_form.scheme = PasswordForm::Scheme::kBasic; + observed_form.origin = GURL("http://proxy.com/"); + observed_form.signon_realm = "proxy.com/realm"; + + MockHttpAuthObserver observer; + EXPECT_CALL(*store_, GetLogins(_, _)) + .WillRepeatedly(WithArg<1>(InvokeEmptyConsumerWithForms())); + + // Initiate creating a form manager. + httpauth_manager()->SetObserverAndDeliverCredentials(&observer, + observed_form); + + // Expect no prompt, since no submission was happened. + EXPECT_CALL(client_, PromptUserToSaveOrUpdatePasswordPtr()).Times(0); + httpauth_manager()->OnDidFinishMainFrameNavigation(); + httpauth_manager()->DetachObserver(&observer); +} + } // namespace password_manager
diff --git a/components/password_manager/core/browser/login_database.cc b/components/password_manager/core/browser/login_database.cc index 13892ec..05f77d2 100644 --- a/components/password_manager/core/browser/login_database.cc +++ b/components/password_manager/core/browser/login_database.cc
@@ -718,8 +718,6 @@ meta_table_.SetVersionNumber(kCurrentVersionNumber); } else { LogDatabaseInitError(MIGRATION_ERROR); - base::UmaHistogramSparse("PasswordManager.LoginDatabaseFailedVersion", - meta_table_.GetVersionNumber()); LOG(ERROR) << "Unable to migrate database from " << meta_table_.GetVersionNumber() << " to " << kCurrentVersionNumber;
diff --git a/components/password_manager/core/browser/password_manager_metrics_util.cc b/components/password_manager/core/browser/password_manager_metrics_util.cc index 0e8cbff..c0a1b629 100644 --- a/components/password_manager/core/browser/password_manager_metrics_util.cc +++ b/components/password_manager/core/browser/password_manager_metrics_util.cc
@@ -101,11 +101,6 @@ ACCOUNT_CHOOSER_ACTION_COUNT); } -void LogSyncSigninPromoUserAction(SyncSignInUserAction action) { - UMA_HISTOGRAM_ENUMERATION("PasswordManager.SignInPromo", action, - CHROME_SIGNIN_ACTION_COUNT); -} - void LogShouldBlockPasswordForSameOriginButDifferentScheme(bool should_block) { UMA_HISTOGRAM_BOOLEAN( "PasswordManager.ShouldBlockPasswordForSameOriginButDifferentScheme", @@ -121,17 +116,6 @@ HTTP_PASSWORD_MIGRATION_MODE_COUNT); } -void LogAccountChooserUsability(AccountChooserUsabilityMetric usability, - int count_empty_icons, - int count_accounts) { - UMA_HISTOGRAM_ENUMERATION("PasswordManager.AccountChooserDialogUsability", - usability, ACCOUNT_CHOOSER_USABILITY_COUNT); - UMA_HISTOGRAM_COUNTS_100("PasswordManager.AccountChooserDialogEmptyAvatars", - count_empty_icons); - UMA_HISTOGRAM_COUNTS_100("PasswordManager.AccountChooserDialogAccounts", - count_accounts); -} - void LogCredentialManagerGetResult(CredentialManagerGetResult result, CredentialMediationRequirement mediation) { switch (mediation) {
diff --git a/components/password_manager/core/browser/password_manager_metrics_util.h b/components/password_manager/core/browser/password_manager_metrics_util.h index 5e38de58..3e95ec6a 100644 --- a/components/password_manager/core/browser/password_manager_metrics_util.h +++ b/components/password_manager/core/browser/password_manager_metrics_util.h
@@ -121,21 +121,6 @@ ACCOUNT_CHOOSER_ACTION_COUNT }; -enum SyncSignInUserAction { - CHROME_SIGNIN_DISMISSED, - CHROME_SIGNIN_OK, - CHROME_SIGNIN_CANCEL, - CHROME_SIGNIN_ACTION_COUNT -}; - -enum AccountChooserUsabilityMetric { - ACCOUNT_CHOOSER_LOOKS_OK, - ACCOUNT_CHOOSER_EMPTY_USERNAME, - ACCOUNT_CHOOSER_DUPLICATES, - ACCOUNT_CHOOSER_EMPTY_USERNAME_AND_DUPLICATES, - ACCOUNT_CHOOSER_USABILITY_COUNT, -}; - enum CredentialManagerGetResult { // The promise is rejected. CREDENTIAL_MANAGER_GET_REJECTED, @@ -385,9 +370,6 @@ void LogAccountChooserUserActionOneAccount(AccountChooserUserAction action); void LogAccountChooserUserActionManyAccounts(AccountChooserUserAction action); -// Log a user action on showing the Chrome sign in promo. -void LogSyncSigninPromoUserAction(SyncSignInUserAction action); - // Logs whether a password was rejected due to same origin but different scheme. void LogShouldBlockPasswordForSameOriginButDifferentScheme(bool should_block); @@ -397,12 +379,6 @@ // Logs mode of HTTP password migration. void LogHttpPasswordMigrationMode(HttpPasswordMigrationMode mode); -// Log if the account chooser has empty username or duplicate usernames. In -// addition record number of the placeholder avatars and total number of rows. -void LogAccountChooserUsability(AccountChooserUsabilityMetric usability, - int count_empty_icons, - int count_accounts); - // Log the result of navigator.credentials.get. void LogCredentialManagerGetResult(CredentialManagerGetResult result, CredentialMediationRequirement mediation);
diff --git a/components/password_manager/core/browser/store_metrics_reporter.cc b/components/password_manager/core/browser/store_metrics_reporter.cc index ec69f287..d4e8104 100644 --- a/components/password_manager/core/browser/store_metrics_reporter.cc +++ b/components/password_manager/core/browser/store_metrics_reporter.cc
@@ -29,10 +29,6 @@ client->IsUnderAdvancedProtection()); } UMA_HISTOGRAM_BOOLEAN("PasswordManager.Enabled", password_manager_enabled); - UMA_HISTOGRAM_BOOLEAN( - "PasswordManager.ShouldShowAutoSignInFirstRunExperience", - password_bubble_experiment::ShouldShowAutoSignInPromptFirstRunExperience( - prefs)); } StoreMetricsReporter::~StoreMetricsReporter() = default;
diff --git a/components/password_manager/core/browser/store_metrics_reporter_unittest.cc b/components/password_manager/core/browser/store_metrics_reporter_unittest.cc index f90f807..9083651 100644 --- a/components/password_manager/core/browser/store_metrics_reporter_unittest.cc +++ b/components/password_manager/core/browser/store_metrics_reporter_unittest.cc
@@ -63,9 +63,6 @@ histogram_tester.ExpectBucketCount("PasswordManager.Enabled", password_manager_enabled, 1); - histogram_tester.ExpectBucketCount( - "PasswordManager.ShouldShowAutoSignInFirstRunExperience", - !first_run_ui_shown, 1); } } }
diff --git a/components/policy/core/browser/configuration_policy_pref_store_test.h b/components/policy/core/browser/configuration_policy_pref_store_test.h index 3799f0c..bad9c61 100644 --- a/components/policy/core/browser/configuration_policy_pref_store_test.h +++ b/components/policy/core/browser/configuration_policy_pref_store_test.h
@@ -9,7 +9,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/message_loop/message_loop.h" +#include "base/test/scoped_task_environment.h" #include "components/policy/core/browser/configuration_policy_handler_list.h" #include "components/policy/core/common/mock_configuration_policy_provider.h" #include "components/policy/core/common/policy_service_impl.h" @@ -38,7 +38,7 @@ MockConfigurationPolicyProvider provider_; std::unique_ptr<PolicyServiceImpl> policy_service_; scoped_refptr<ConfigurationPolicyPrefStore> store_; - base::MessageLoop loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; private: DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyPrefStoreTest);
diff --git a/components/policy/core/common/schema.cc b/components/policy/core/common/schema.cc index 9d03cb7d..6299234 100644 --- a/components/policy/core/common/schema.cc +++ b/components/policy/core/common/schema.cc
@@ -1270,13 +1270,17 @@ bool all_subschemas_are_valid = true; for (auto subschema = schema_list.begin(); subschema != schema_list.end(); ++subschema) { - if (!subschema->Validate(it.value(), - StrategyForNextLevel(strategy), - error_path, - error)) { + std::string new_error; + const bool validation_result = + subschema->Validate(it.value(), StrategyForNextLevel(strategy), + error_path, &new_error); + if (!new_error.empty()) { + AddDictKeyPrefixToPath(it.key(), error_path); + *error = std::move(new_error); + } + if (!validation_result) { // Invalid property was detected. all_subschemas_are_valid = false; - AddDictKeyPrefixToPath(it.key(), error_path); if (!StrategyAllowInvalidOnTopLevel(strategy)) return false; } @@ -1297,13 +1301,15 @@ } } else if (value.GetAsList(&list)) { for (auto it = list->begin(); it != list->end(); ++it) { - if (!GetItems().Validate(*it, StrategyForNextLevel(strategy), error_path, - error)) { - // Invalid list item was detected. + std::string new_error; + const bool validation_result = GetItems().Validate( + *it, StrategyForNextLevel(strategy), error_path, &new_error); + if (!new_error.empty()) { AddListIndexPrefixToPath(it - list->begin(), error_path); - if (!StrategyAllowInvalidOnTopLevel(strategy)) - return false; + *error = std::move(new_error); } + if (!validation_result && !StrategyAllowInvalidOnTopLevel(strategy)) + return false; // Invalid list item was detected. } } else if (value.GetAsInteger(&int_value)) { if (node_->extra != kInvalid && @@ -1355,30 +1361,30 @@ if (schema_list.empty()) { // Unknown property was detected. SchemaErrorFound(error_path, error, "Unknown property: " + it.key()); - if (StrategyAllowUnknownOnTopLevel(strategy)) - drop_list.push_back(it.key()); - else + if (!StrategyAllowUnknownOnTopLevel(strategy)) return false; + drop_list.push_back(it.key()); } else { bool all_subschemas_are_valid = true; for (auto subschema = schema_list.begin(); subschema != schema_list.end(); ++subschema) { base::Value* sub_value = nullptr; dict->GetWithoutPathExpansion(it.key(), &sub_value); - if (!subschema->Normalize(sub_value, - StrategyForNextLevel(strategy), - error_path, - error, - changed)) { + std::string new_error; + const bool normalization_result = + subschema->Normalize(sub_value, StrategyForNextLevel(strategy), + error_path, &new_error, changed); + if (!new_error.empty()) { + AddDictKeyPrefixToPath(it.key(), error_path); + *error = std::move(new_error); + } + if (!normalization_result) { // Invalid property was detected. all_subschemas_are_valid = false; - AddDictKeyPrefixToPath(it.key(), error_path); - if (StrategyAllowInvalidOnTopLevel(strategy)) { - drop_list.push_back(it.key()); - break; - } else { + if (!StrategyAllowInvalidOnTopLevel(strategy)) return false; - } + drop_list.push_back(it.key()); + break; } } if (all_subschemas_are_valid) @@ -1406,20 +1412,23 @@ return true; } else if (value->GetAsList(&list)) { std::vector<size_t> drop_list; // Contains the indexes to drop. + // TODO: use iterators like in Validate() here instead of iterating over + // indices. for (size_t index = 0; index < list->GetSize(); index++) { - base::Value* sub_value = nullptr; - list->Get(index, &sub_value); - if (!sub_value || !GetItems().Normalize(sub_value, - StrategyForNextLevel(strategy), - error_path, - error, - changed)) { - // Invalid list item was detected. + base::Value& sub_value = list->GetList()[index]; + std::string new_error; + const bool normalization_result = + GetItems().Normalize(&sub_value, StrategyForNextLevel(strategy), + error_path, &new_error, changed); + if (!new_error.empty()) { AddListIndexPrefixToPath(index, error_path); - if (StrategyAllowInvalidOnTopLevel(strategy)) - drop_list.push_back(index); - else + *error = std::move(new_error); + } + if (!normalization_result) { + // Invalid list item was detected. + if (!StrategyAllowInvalidOnTopLevel(strategy)) return false; + drop_list.push_back(index); } } if (changed && !drop_list.empty())
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index 49dc25d..ae9af427 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -16017,7 +16017,7 @@ 'principal': { 'description': '''User principal 'user@realm'. The placeholder ${{LOGIN_ID}} is replaced by the username 'user'. The placeholder ${{LOGIN_EMAIL}} is replaced by the full principal 'user@realm'.''', 'type': 'string', - 'pattern': '^(?:[^@]+@[^@]+)|(?:\${LOGIN_ID})|(?:\${LOGIN_EMAIL})$', + 'pattern': '^(?:[^@]+@[^@]+)|(?:\\${LOGIN_ID})|(?:\\${LOGIN_EMAIL})$', }, 'password': { 'description': '''Kerberos password. The placeholder ${{PASSWORD}} is replaced by the login password.''',
diff --git a/components/signin/core/browser/BUILD.gn b/components/signin/core/browser/BUILD.gn index 506e781..85a48a9 100644 --- a/components/signin/core/browser/BUILD.gn +++ b/components/signin/core/browser/BUILD.gn
@@ -124,7 +124,13 @@ } if (is_chromeos) { - deps += [ "//chromeos/components/account_manager" ] + deps += [ + "//chromeos/components/account_manager", + + # TODO(crbug.com/816954): Remove this line when Account Manager is + # launched. + "//chromeos/constants", + ] } }
diff --git a/components/signin/core/browser/DEPS b/components/signin/core/browser/DEPS index a16dee71..6aa48343a 100644 --- a/components/signin/core/browser/DEPS +++ b/components/signin/core/browser/DEPS
@@ -1,5 +1,8 @@ include_rules = [ "+chromeos/components/account_manager", + # TODO(crbug.com/816954): Remove this line when Account Manager is + # launched. + "+chromeos/constants", "+components/account_id", "+components/image_fetcher/core", "+components/metrics",
diff --git a/components/signin/core/browser/gaia_cookie_manager_service.cc b/components/signin/core/browser/gaia_cookie_manager_service.cc index fe84d14..372b737 100644 --- a/components/signin/core/browser/gaia_cookie_manager_service.cc +++ b/components/signin/core/browser/gaia_cookie_manager_service.cc
@@ -39,6 +39,10 @@ #include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/cpp/simple_url_loader.h" +#if defined(OS_CHROMEOS) +#include "chromeos/constants/chromeos_switches.h" +#endif + namespace signin { MultiloginParameters::MultiloginParameters( const gaia::MultiloginMode mode, @@ -964,6 +968,8 @@ bool use_continue_url = false; #if defined(OS_ANDROID) use_continue_url = base::FeatureList::IsEnabled(signin::kMiceFeature); +#elif defined(OS_CHROMEOS) + use_continue_url = chromeos::switches::IsAccountManagerEnabled(); #endif if (use_continue_url) { gaia_auth_fetcher_->StartLogOutWithBlankContinueURL();
diff --git a/components/signin/core/browser/identity_manager_wrapper.cc b/components/signin/core/browser/identity_manager_wrapper.cc index a7f12f6ed..7134830 100644 --- a/components/signin/core/browser/identity_manager_wrapper.cc +++ b/components/signin/core/browser/identity_manager_wrapper.cc
@@ -8,6 +8,7 @@ #include "components/signin/core/browser/account_fetcher_service.h" #include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/gaia_cookie_manager_service.h" +#include "components/signin/core/browser/primary_account_manager.h" #include "components/signin/core/browser/profile_oauth2_token_service.h" #include "services/identity/public/cpp/accounts_cookie_mutator.h" #include "services/identity/public/cpp/accounts_mutator.h"
diff --git a/components/signin/core/browser/mutable_profile_oauth2_token_service_delegate_unittest.cc b/components/signin/core/browser/mutable_profile_oauth2_token_service_delegate_unittest.cc index 47ae786..4f090dd0 100644 --- a/components/signin/core/browser/mutable_profile_oauth2_token_service_delegate_unittest.cc +++ b/components/signin/core/browser/mutable_profile_oauth2_token_service_delegate_unittest.cc
@@ -82,7 +82,6 @@ : public testing::Test, public OAuth2AccessTokenConsumer, public OAuth2TokenServiceObserver, - public OAuth2TokenService::DiagnosticsObserver, public WebDataServiceConsumer { public: MutableProfileOAuth2TokenServiceDelegateTest() @@ -203,14 +202,14 @@ ++auth_error_changed_count_; } - // OAuth2TokenService::DiagnosticsObserver implementation + // ProfileOAuth2TokenService callbacks. void OnRefreshTokenAvailableFromSource(const CoreAccountId& account_id, bool is_refresh_token_valid, - const std::string& source) override { + const std::string& source) { source_for_refresh_token_available_ = source; } void OnRefreshTokenRevokedFromSource(const CoreAccountId& account_id, - const std::string& source) override { + const std::string& source) { source_for_refresh_token_revoked_ = source; } @@ -1518,7 +1517,14 @@ ProfileOAuth2TokenService token_service( &pref_service_, CreateOAuth2ServiceDelegate(signin::AccountConsistencyMethod::kDisabled)); - token_service.AddDiagnosticsObserver(this); + token_service.SetRefreshTokenAvailableFromSourceCallback( + base::BindRepeating(&MutableProfileOAuth2TokenServiceDelegateTest:: + OnRefreshTokenAvailableFromSource, + base::Unretained(this))); + token_service.SetRefreshTokenRevokedFromSourceCallback( + base::BindRepeating(&MutableProfileOAuth2TokenServiceDelegateTest:: + OnRefreshTokenRevokedFromSource, + base::Unretained(this))); { base::HistogramTester h_tester; @@ -1579,7 +1585,6 @@ base::RunLoop().RunUntilIdle(); } - token_service.RemoveDiagnosticsObserver(this); token_service.Shutdown(); }
diff --git a/components/signin/core/browser/primary_account_manager.cc b/components/signin/core/browser/primary_account_manager.cc index 5f0af06..b604a4b 100644 --- a/components/signin/core/browser/primary_account_manager.cc +++ b/components/signin/core/browser/primary_account_manager.cc
@@ -42,8 +42,6 @@ } PrimaryAccountManager::~PrimaryAccountManager() { - DCHECK(!observer_); - token_service_->RemoveObserver(this); } @@ -230,15 +228,15 @@ // if Chrome crashes before the next commit interval. client_->GetPrefs()->CommitPendingWrite(); - if (observer_) { - observer_->AuthenticatedAccountSet(info); + if (on_authenticated_account_set_callback_) { + on_authenticated_account_set_callback_.Run(info); } } void PrimaryAccountManager::ClearAuthenticatedAccountId() { authenticated_account_id_ = CoreAccountId(); - if (observer_) { - observer_->AuthenticatedAccountCleared(); + if (on_authenticated_account_cleared_callback_) { + on_authenticated_account_cleared_callback_.Run(); } } @@ -246,14 +244,34 @@ return !authenticated_account_id_.empty(); } -void PrimaryAccountManager::SetObserver(Observer* observer) { - DCHECK(!observer_) << "SetObserver shouldn't be called multiple times."; - observer_ = observer; +void PrimaryAccountManager::SetGoogleSigninSucceededCallback( + AccountSigninCallback callback) { + DCHECK(!on_google_signin_succeeded_callback_) + << "GoogleSigninSucceededCallback shouldn't be set multiple times."; + on_google_signin_succeeded_callback_ = callback; } -void PrimaryAccountManager::ClearObserver() { - DCHECK(observer_); - observer_ = nullptr; +#if !defined(OS_CHROMEOS) +void PrimaryAccountManager::SetGoogleSignedOutCallback( + AccountSigninCallback callback) { + DCHECK(!on_google_signed_out_callback_) + << "GoogleSignedOutCallback shouldn't be set multiple times."; + on_google_signed_out_callback_ = callback; +} +#endif // !defined(OS_CHROMEOS) + +void PrimaryAccountManager::SetAuthenticatedAccountSetCallback( + AccountSigninCallback callback) { + DCHECK(!on_authenticated_account_set_callback_) + << "AuthenticatedAccountSetCallback shouldn't be set multiple times."; + on_authenticated_account_set_callback_ = callback; +} + +void PrimaryAccountManager::SetAuthenticatedAccountClearedCallback( + AccountClearedCallback callback) { + DCHECK(!on_authenticated_account_cleared_callback_) + << "AuthenticatedAccountClearedCallback shouldn't be set multiple times."; + on_authenticated_account_cleared_callback_ = callback; } void PrimaryAccountManager::SignIn(const std::string& username) { @@ -269,8 +287,8 @@ SetAuthenticatedAccountInfo(info.gaia, info.email); - if (!reauth_in_progress && observer_ != nullptr) - observer_->GoogleSigninSucceeded(GetAuthenticatedAccountInfo()); + if (!reauth_in_progress && on_google_signin_succeeded_callback_) + on_google_signin_succeeded_callback_.Run(GetAuthenticatedAccountInfo()); signin_metrics::LogSigninProfile(client_->IsFirstRun(), client_->GetInstallDate()); @@ -381,8 +399,8 @@ void PrimaryAccountManager::FireGoogleSignedOut( const AccountInfo& account_info) { - if (observer_ != nullptr) { - observer_->GoogleSignedOut(account_info); + if (on_google_signed_out_callback_) { + on_google_signed_out_callback_.Run(account_info); } }
diff --git a/components/signin/core/browser/primary_account_manager.h b/components/signin/core/browser/primary_account_manager.h index 6599ac6..23c2fe4 100644 --- a/components/signin/core/browser/primary_account_manager.h +++ b/components/signin/core/browser/primary_account_manager.h
@@ -21,11 +21,12 @@ #include <memory> #include <string> +#include "base/callback.h" #include "base/callback_list.h" #include "base/macros.h" #include "components/signin/core/browser/account_consistency_method.h" #include "components/signin/core/browser/signin_client.h" -#include "google_apis/gaia/oauth2_token_service.h" +#include "google_apis/gaia/oauth2_token_service_observer.h" struct AccountInfo; class AccountTrackerService; @@ -41,26 +42,9 @@ class PrimaryAccountManager : public OAuth2TokenServiceObserver { public: - class Observer { - public: - // Called when a user signs into Google services such as sync. - // This method is not called during a reauth. - virtual void GoogleSigninSucceeded(const AccountInfo& account_info) {} - - // Called when the currently signed-in user for a user has been signed out. - virtual void GoogleSignedOut(const AccountInfo& account_info) {} - - // Called during the signin as soon as - // PrimaryAccountManager::authenticated_account_id_ is set. - virtual void AuthenticatedAccountSet(const AccountInfo& account_info) {} - - // Called during the signout as soon as - // PrimaryAccountManager::authenticated_account_id_ is cleared. - virtual void AuthenticatedAccountCleared() {} - - protected: - virtual ~Observer() {} - }; + typedef base::RepeatingCallback<void(const AccountInfo&)> + AccountSigninCallback; + typedef base::RepeatingCallback<void()> AccountClearedCallback; #if !defined(OS_CHROMEOS) // Used to remove accounts from the token service and the account tracker. @@ -117,12 +101,23 @@ // Returns true if there is an authenticated user. bool IsAuthenticated() const; - // Methods to set or clear the observer of signin. - // In practice these should only be used by IdentityManager. - // NOTE: If SetObserver is called, ClearObserver should be called before - // the destruction of PrimaryAccountManager. - void SetObserver(Observer* observer); - void ClearObserver(); + // If set, this callback will be invoked whenever a user signs into Google + // services such as sync. This callback is not called during a reauth. + void SetGoogleSigninSucceededCallback(AccountSigninCallback callback); + +#if !defined(OS_CHROMEOS) + // If set, this callback will be invoked whenever the currently signed-in user + // for a user has been signed out. + void SetGoogleSignedOutCallback(AccountSigninCallback callback); +#endif + + // If set, this callback will be invoked during the signin as soon as + // PrimaryAccountManager::authenticated_account_id_ is set. + void SetAuthenticatedAccountSetCallback(AccountSigninCallback callback); + + // If set, this callback will be invoked during the signout as soon as + // PrimaryAccountManager::authenticated_account_id_ is cleared. + void SetAuthenticatedAccountClearedCallback(AccountClearedCallback callback); // Signs a user in. PrimaryAccountManager assumes that |username| can be used // to look up the corresponding account_id and gaia_id for this email. @@ -192,10 +187,6 @@ void OnRefreshTokensLoaded() override; #endif - // Observer to notify on signin events. - // There is a DCHECK on destruction that this has been cleared. - Observer* observer_ = nullptr; - SigninClient* client_; // The ProfileOAuth2TokenService instance associated with this object. Must @@ -209,6 +200,14 @@ // Account id after successful authentication. CoreAccountId authenticated_account_id_; + // Callbacks which will be invoked, if set, for signin-related events. + AccountSigninCallback on_google_signin_succeeded_callback_; +#if !defined(OS_CHROMEOS) + AccountSigninCallback on_google_signed_out_callback_; +#endif + AccountSigninCallback on_authenticated_account_set_callback_; + AccountClearedCallback on_authenticated_account_cleared_callback_; + // The list of callbacks notified on shutdown. base::CallbackList<void()> on_shutdown_callback_list_;
diff --git a/components/signin/core/browser/primary_account_manager_unittest.cc b/components/signin/core/browser/primary_account_manager_unittest.cc index 2d5460d..892958e 100644 --- a/components/signin/core/browser/primary_account_manager_unittest.cc +++ b/components/signin/core/browser/primary_account_manager_unittest.cc
@@ -9,6 +9,7 @@ #include <utility> #include <vector> +#include "base/bind.h" #include "base/run_loop.h" #include "base/test/scoped_task_environment.h" #include "components/image_fetcher/core/fake_image_decoder.h" @@ -27,38 +28,15 @@ #include "google_apis/gaia/fake_oauth2_token_service_delegate.h" #include "testing/gtest/include/gtest/gtest.h" -namespace { - -class TestPrimaryAccountManagerObserver - : public PrimaryAccountManager::Observer { - public: - TestPrimaryAccountManagerObserver() - : num_successful_signins_(0), num_signouts_(0) {} - - ~TestPrimaryAccountManagerObserver() override {} - - int num_successful_signins_; - int num_signouts_; - - private: - void GoogleSigninSucceeded(const AccountInfo& account_info) override { - num_successful_signins_++; - } - - void GoogleSignedOut(const AccountInfo& account_info) override { - num_signouts_++; - } -}; - -} // namespace - class PrimaryAccountManagerTest : public testing::Test { public: PrimaryAccountManagerTest() : test_signin_client_(&user_prefs_), token_service_(&user_prefs_, std::make_unique<FakeOAuth2TokenServiceDelegate>()), - account_consistency_(signin::AccountConsistencyMethod::kDisabled) { + account_consistency_(signin::AccountConsistencyMethod::kDisabled), + num_successful_signins_(0), + num_signouts_(0) { AccountFetcherService::RegisterPrefs(user_prefs_.registry()); AccountTrackerService::RegisterPrefs(user_prefs_.registry()); ProfileOAuth2TokenService::RegisterProfilePrefs(user_prefs_.registry()); @@ -106,13 +84,19 @@ &test_signin_client_, &token_service_, &account_tracker_, account_consistency_, std::move(policy_manager)); manager_->Initialize(&local_state_); - manager_->SetObserver(&test_observer_); + + // PrimaryAccountManagerTest will outlive the PrimaryAccountManager, so + // base::Unretained is safe. + manager_->SetGoogleSigninSucceededCallback( + base::BindRepeating(&PrimaryAccountManagerTest::GoogleSigninSucceeded, + base::Unretained(this))); + manager_->SetGoogleSignedOutCallback(base::BindRepeating( + &PrimaryAccountManagerTest::GoogleSignedOut, base::Unretained(this))); } // Shuts down |manager_|. void ShutDownManager() { DCHECK(manager_); - manager_->ClearObserver(); manager_.reset(); } @@ -125,9 +109,15 @@ manager_->GetAuthenticatedAccountId())); // Should go into token service and stop. - EXPECT_EQ(1, test_observer_.num_successful_signins_); + EXPECT_EQ(1, num_successful_signins_); } + void GoogleSigninSucceeded(const AccountInfo& account_info) { + num_successful_signins_++; + } + + void GoogleSignedOut(const AccountInfo& account_info) { num_signouts_++; } + base::test::ScopedTaskEnvironment task_environment_; sync_preferences::TestingPrefServiceSyncable user_prefs_; TestingPrefServiceSimple local_state_; @@ -137,10 +127,11 @@ AccountFetcherService account_fetcher_; PrimaryAccountPolicyManagerImpl* policy_manager_; std::unique_ptr<PrimaryAccountManager> manager_; - TestPrimaryAccountManagerObserver test_observer_; std::vector<std::string> oauth_tokens_fetched_; std::vector<std::string> cookies_; signin::AccountConsistencyMethod account_consistency_; + int num_successful_signins_; + int num_signouts_; }; TEST_F(PrimaryAccountManagerTest, SignOut) { @@ -302,11 +293,11 @@ CreatePrimaryAccountManager(); EXPECT_EQ("", manager_->GetAuthenticatedAccountInfo().email); EXPECT_EQ("", manager_->GetAuthenticatedAccountId()); - EXPECT_EQ(0, test_observer_.num_successful_signins_); + EXPECT_EQ(0, num_successful_signins_); std::string account_id = AddToAccountTracker("gaia_id", "user@gmail.com"); manager_->SignIn("user@gmail.com"); - EXPECT_EQ(1, test_observer_.num_successful_signins_); + EXPECT_EQ(1, num_successful_signins_); EXPECT_EQ("user@gmail.com", manager_->GetAuthenticatedAccountInfo().email); EXPECT_EQ(account_id, manager_->GetAuthenticatedAccountId()); } @@ -316,16 +307,16 @@ CreatePrimaryAccountManager(); EXPECT_EQ("", manager_->GetAuthenticatedAccountInfo().email); EXPECT_EQ("", manager_->GetAuthenticatedAccountId()); - EXPECT_EQ(0, test_observer_.num_successful_signins_); + EXPECT_EQ(0, num_successful_signins_); std::string account_id = AddToAccountTracker("gaia_id", "user@gmail.com"); manager_->SignIn("user@gmail.com"); - EXPECT_EQ(1, test_observer_.num_successful_signins_); + EXPECT_EQ(1, num_successful_signins_); EXPECT_EQ("user@gmail.com", manager_->GetAuthenticatedAccountInfo().email); EXPECT_EQ(account_id, manager_->GetAuthenticatedAccountId()); manager_->SignIn("user@gmail.com"); - EXPECT_EQ(1, test_observer_.num_successful_signins_); + EXPECT_EQ(1, num_successful_signins_); EXPECT_EQ("user@gmail.com", manager_->GetAuthenticatedAccountInfo().email); EXPECT_EQ(account_id, manager_->GetAuthenticatedAccountId()); }
diff --git a/components/signin/core/browser/profile_oauth2_token_service.cc b/components/signin/core/browser/profile_oauth2_token_service.cc index a425e1f0..0a97c47 100644 --- a/components/signin/core/browser/profile_oauth2_token_service.cc +++ b/components/signin/core/browser/profile_oauth2_token_service.cc
@@ -80,6 +80,16 @@ std::string()); } +void ProfileOAuth2TokenService::SetRefreshTokenAvailableFromSourceCallback( + RefreshTokenAvailableFromSourceCallback callback) { + on_refresh_token_available_callback_ = callback; +} + +void ProfileOAuth2TokenService::SetRefreshTokenRevokedFromSourceCallback( + RefreshTokenRevokedFromSourceCallback callback) { + on_refresh_token_revoked_callback_ = callback; +} + void ProfileOAuth2TokenService::Shutdown() { CancelAllRequests(); GetDelegate()->Shutdown(); @@ -156,10 +166,9 @@ is_valid, update_refresh_token_source_); std::string source_string = SourceToString(update_refresh_token_source_); - for (auto& diagnostic_observer : GetDiagnosticsObservers()) { - diagnostic_observer.OnRefreshTokenAvailableFromSource(account_id, is_valid, - source_string); - } + if (on_refresh_token_available_callback_) + on_refresh_token_available_callback_.Run(account_id, is_valid, + source_string); } void ProfileOAuth2TokenService::OnRefreshTokenRevoked( @@ -175,10 +184,8 @@ signin_metrics::RecordRefreshTokenRevokedFromSource( update_refresh_token_source_); std::string source_string = SourceToString(update_refresh_token_source_); - for (auto& diagnostic_observer : GetDiagnosticsObservers()) { - diagnostic_observer.OnRefreshTokenRevokedFromSource(account_id, - source_string); - } + if (on_refresh_token_revoked_callback_) + on_refresh_token_revoked_callback_.Run(account_id, source_string); } void ProfileOAuth2TokenService::OnRefreshTokensLoaded() {
diff --git a/components/signin/core/browser/profile_oauth2_token_service.h b/components/signin/core/browser/profile_oauth2_token_service.h index 1d034ef7..cf13c44 100644 --- a/components/signin/core/browser/profile_oauth2_token_service.h +++ b/components/signin/core/browser/profile_oauth2_token_service.h
@@ -5,8 +5,10 @@ #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_H_ #define COMPONENTS_SIGNIN_CORE_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_H_ +#include <memory> #include <string> +#include "base/callback.h" #include "base/macros.h" #include "build/buildflag.h" #include "components/keyed_service/core/keyed_service.h" @@ -16,8 +18,6 @@ #include "google_apis/gaia/oauth2_token_service_delegate.h" #include "net/base/backoff_entry.h" -#include <memory> - namespace identity { class IdentityManager; } @@ -41,6 +41,14 @@ // request from other thread, please use OAuth2TokenServiceRequest. class ProfileOAuth2TokenService : public OAuth2TokenService { public: + typedef base::RepeatingCallback<void(const CoreAccountId& /* account_id */, + bool /* is_refresh_token_valid */, + const std::string& /* source */)> + RefreshTokenAvailableFromSourceCallback; + typedef base::RepeatingCallback<void(const CoreAccountId& /* account_id */, + const std::string& /* source */)> + RefreshTokenRevokedFromSourceCallback; + ProfileOAuth2TokenService( PrefService* user_prefs, std::unique_ptr<OAuth2TokenServiceDelegate> delegate); @@ -49,6 +57,18 @@ // Registers per-profile prefs. static void RegisterProfilePrefs(PrefRegistrySimple* registry); + // If set, this callback will be invoked when a new refresh token is + // available. Contains diagnostic information about the source of the update + // credentials operation. + void SetRefreshTokenAvailableFromSourceCallback( + RefreshTokenAvailableFromSourceCallback callback); + + // If set, this callback will be invoked when a refresh token is revoked. + // Contains diagnostic information about the source that initiated the + // revocation operation. + void SetRefreshTokenRevokedFromSourceCallback( + RefreshTokenRevokedFromSourceCallback callback); + void Shutdown(); // Loads credentials from a backing persistent store to make them available @@ -114,6 +134,10 @@ PrefService* user_prefs_; + // Callbacks to invoke, if set, for refresh token-related events. + RefreshTokenAvailableFromSourceCallback on_refresh_token_available_callback_; + RefreshTokenRevokedFromSourceCallback on_refresh_token_revoked_callback_; + signin_metrics::SourceForRefreshTokenOperation update_refresh_token_source_ = signin_metrics::SourceForRefreshTokenOperation::kUnknown;
diff --git a/components/tracing/common/trace_startup_config.cc b/components/tracing/common/trace_startup_config.cc index d21058d..c767883 100644 --- a/components/tracing/common/trace_startup_config.cc +++ b/components/tracing/common/trace_startup_config.cc
@@ -96,7 +96,7 @@ } else if (EnableFromBackgroundTracing()) { DCHECK(IsEnabled()); DCHECK(!IsTracingStartupForDuration()); - DCHECK(GetBackgroundStartupTracingEnabled()); + DCHECK_EQ(SessionOwner::kBackgroundTracing, session_owner_); CHECK(!ShouldTraceToResultFile()); } } @@ -145,10 +145,6 @@ finished_writing_to_file_ = true; } -bool TraceStartupConfig::GetBackgroundStartupTracingEnabled() const { - return is_enabled_from_background_tracing_; -} - bool TraceStartupConfig::IsUsingPerfettoOutput() const { return base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kPerfettoOutputFile); @@ -241,21 +237,21 @@ } bool TraceStartupConfig::EnableFromBackgroundTracing() { + bool enabled = enable_background_tracing_for_testing_; #if defined(OS_ANDROID) // Tests can enable this value. - is_enabled_from_background_tracing_ = - is_enabled_from_background_tracing_ || - base::android::GetBackgroundStartupTracingFlag(); + enabled |= base::android::GetBackgroundStartupTracingFlag(); #else // TODO(ssid): Implement saving setting to preference for next startup. #endif // Do not set the flag to false if it's not enabled unnecessarily. - if (!is_enabled_from_background_tracing_) + if (!enabled) return false; SetBackgroundStartupTracingEnabled(false); trace_config_ = GetDefaultBrowserStartupConfig(); is_enabled_ = true; + session_owner_ = SessionOwner::kBackgroundTracing; should_trace_to_result_file_ = false; // Set startup duration to 0 since background tracing config will configure // the durations later.
diff --git a/components/tracing/common/trace_startup_config.h b/components/tracing/common/trace_startup_config.h index be13970..537a99c5 100644 --- a/components/tracing/common/trace_startup_config.h +++ b/components/tracing/common/trace_startup_config.h
@@ -84,7 +84,13 @@ // TracingControllerAndroid::GenerateTracingFilePath. class TRACING_EXPORT TraceStartupConfig { public: - enum class SessionOwner { kTracingController, kDevToolsTracingHandler }; + enum class SessionOwner { + kTracingController, + kDevToolsTracingHandler, + // The background tracing config set in application preferences on the + // previous session, for current session. + kBackgroundTracing + }; static TraceStartupConfig* GetInstance(); @@ -116,10 +122,6 @@ base::FilePath GetResultFile() const; void OnTraceToResultFileFinished(); - // Get the background tracing config set in application preferences on the - // previous session, for current session. - bool GetBackgroundStartupTracingEnabled() const; - // Set the background tracing config in preferences for the next session. void SetBackgroundStartupTracingEnabled(bool enabled); @@ -155,7 +157,7 @@ bool ParseTraceConfigFileContent(const std::string& content); bool is_enabled_ = false; - bool is_enabled_from_background_tracing_ = false; + bool enable_background_tracing_for_testing_ = false; base::trace_event::TraceConfig trace_config_; int startup_duration_ = 0; bool should_trace_to_result_file_ = false;
diff --git a/components/update_client/update_checker_unittest.cc b/components/update_client/update_checker_unittest.cc index ac4fa08a..b7f2540f 100644 --- a/components/update_client/update_checker_unittest.cc +++ b/components/update_client/update_checker_unittest.cc
@@ -323,17 +323,17 @@ .FindKey("fp") ->GetString()); -#if (OS_WIN) - EXPECT_TRUE(request->FindKey("domainjoined")); +#if defined(OS_WIN) + EXPECT_TRUE(request->FindKey("domainjoined")); #if defined(GOOGLE_CHROME_BUILD) - const auto* updater = request->FindKey("updater"); - EXPECT_TRUE(updater); - EXPECT_EQ("Omaha", updater->FindKey("name")->GetString()); - EXPECT_TRUE(updater->FindKey("autoupdatecheckenabled")->is_bool()); - EXPECT_TRUE(updater->FindKey("ismachine")->is_bool()); - EXPECT_TRUE(updater->FindKey("updatepolicy")->is_int()); + const auto* updater = request->FindKey("updater"); + EXPECT_TRUE(updater); + EXPECT_EQ("Omaha", updater->FindKey("name")->GetString()); + EXPECT_TRUE(updater->FindKey("autoupdatecheckenabled")->is_bool()); + EXPECT_TRUE(updater->FindKey("ismachine")->is_bool()); + EXPECT_TRUE(updater->FindKey("updatepolicy")->is_int()); #endif // GOOGLE_CHROME_BUILD -#endif // OS_WINDOWS +#endif // OS_WIN // Sanity check the arguments of the callback after parsing. EXPECT_EQ(ErrorCategory::kNone, error_category_);
diff --git a/content/DEPS b/content/DEPS index c33d096..087194fd 100644 --- a/content/DEPS +++ b/content/DEPS
@@ -115,7 +115,8 @@ "+storage/common", # For generated JNI includes. - "+jni", + "+content/public/android/content_jni_headers", + "+content/public/android/jar_jni", ] specific_include_rules = {
diff --git a/content/app/android/content_child_process_service_delegate.cc b/content/app/android/content_child_process_service_delegate.cc index cbed8cf..f9fb954 100644 --- a/content/app/android/content_child_process_service_delegate.cc +++ b/content/app/android/content_child_process_service_delegate.cc
@@ -15,11 +15,11 @@ #include "base/unguessable_token.h" #include "content/child/child_thread_impl.h" #include "content/common/android/surface_wrapper.h" +#include "content/public/android/content_jni_headers/ContentChildProcessServiceDelegate_jni.h" #include "content/public/common/content_descriptors.h" #include "content/public/common/content_switches.h" #include "gpu/ipc/common/android/scoped_surface_request_conduit.h" #include "gpu/ipc/common/gpu_surface_lookup.h" -#include "jni/ContentChildProcessServiceDelegate_jni.h" #include "services/service_manager/embedder/shared_file_util.h" #include "services/service_manager/embedder/switches.h" #include "ui/gl/android/scoped_java_surface.h"
diff --git a/content/app/android/content_main.cc b/content/app/android/content_main.cc index 2a9c900..25e3bbc 100644 --- a/content/app/android/content_main.cc +++ b/content/app/android/content_main.cc
@@ -7,9 +7,9 @@ #include "base/lazy_instance.h" #include "base/trace_event/trace_event.h" #include "content/app/content_service_manager_main_delegate.h" +#include "content/public/android/content_jni_headers/ContentMain_jni.h" #include "content/public/app/content_main.h" #include "content/public/app/content_main_delegate.h" -#include "jni/ContentMain_jni.h" #include "services/service_manager/embedder/main.h" using base::LazyInstance;
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index dfe4275..518027c0 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -1714,6 +1714,8 @@ "scheduler/responsiveness/calculator.h", "scheduler/responsiveness/message_loop_observer.cc", "scheduler/responsiveness/message_loop_observer.h", + "scheduler/responsiveness/metric_source.cc", + "scheduler/responsiveness/metric_source.h", "scheduler/responsiveness/native_event_observer.cc", "scheduler/responsiveness/native_event_observer.h", "scheduler/responsiveness/native_event_observer_mac.mm", @@ -2745,7 +2747,6 @@ if (is_android) { generate_jar_jni("reflection_jni_headers") { - jni_package = "content" classes = [ "java/lang/Class.class", "java/lang/Object.class",
diff --git a/content/browser/accessibility/browser_accessibility_state_impl_android.cc b/content/browser/accessibility/browser_accessibility_state_impl_android.cc index 1cc7b7a..a97a68c 100644 --- a/content/browser/accessibility/browser_accessibility_state_impl_android.cc +++ b/content/browser/accessibility/browser_accessibility_state_impl_android.cc
@@ -6,8 +6,8 @@ #include "base/android/jni_android.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/android/content_jni_headers/BrowserAccessibilityState_jni.h" #include "content/public/browser/browser_thread.h" -#include "jni/BrowserAccessibilityState_jni.h" #include "ui/gfx/animation/animation.h" using base::android::AttachCurrentThread;
diff --git a/content/browser/accessibility/captioning_controller.cc b/content/browser/accessibility/captioning_controller.cc index 0bd9b69..6ea587b7 100644 --- a/content/browser/accessibility/captioning_controller.cc +++ b/content/browser/accessibility/captioning_controller.cc
@@ -7,7 +7,7 @@ #include "base/android/jni_string.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/frame_messages.h" -#include "jni/CaptioningController_jni.h" +#include "content/public/android/content_jni_headers/CaptioningController_jni.h" using base::android::AttachCurrentThread; using base::android::ConvertJavaStringToUTF8;
diff --git a/content/browser/accessibility/web_contents_accessibility_android.cc b/content/browser/accessibility/web_contents_accessibility_android.cc index 549931e..b40338c 100644 --- a/content/browser/accessibility/web_contents_accessibility_android.cc +++ b/content/browser/accessibility/web_contents_accessibility_android.cc
@@ -17,9 +17,9 @@ #include "content/browser/android/render_widget_host_connector.h" #include "content/browser/renderer_host/render_widget_host_view_android.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/android/content_jni_headers/WebContentsAccessibilityImpl_jni.h" #include "content/public/common/content_features.h" #include "content/public/common/use_zoom_for_dsf_policy.h" -#include "jni/WebContentsAccessibilityImpl_jni.h" #include "ui/events/android/motion_event_android.h" using base::android::AttachCurrentThread;
diff --git a/content/browser/android/android_overlay_provider_impl.cc b/content/browser/android/android_overlay_provider_impl.cc index 79d37f2d..c4a1f4a0 100644 --- a/content/browser/android/android_overlay_provider_impl.cc +++ b/content/browser/android/android_overlay_provider_impl.cc
@@ -4,7 +4,7 @@ #include "content/browser/android/android_overlay_provider_impl.h" -#include "jni/AndroidOverlayProviderImpl_jni.h" +#include "content/public/android/content_jni_headers/AndroidOverlayProviderImpl_jni.h" using base::android::AttachCurrentThread; using base::android::ScopedJavaLocalRef;
diff --git a/content/browser/android/app_web_message_port.cc b/content/browser/android/app_web_message_port.cc index a1537873..057999b5 100644 --- a/content/browser/android/app_web_message_port.cc +++ b/content/browser/android/app_web_message_port.cc
@@ -9,7 +9,7 @@ #include "base/android/jni_string.h" #include "base/bind.h" #include "base/threading/thread_task_runner_handle.h" -#include "jni/AppWebMessagePort_jni.h" +#include "content/public/android/content_jni_headers/AppWebMessagePort_jni.h" #include "third_party/blink/public/common/messaging/string_message_codec.h" using blink::MessagePortChannel;
diff --git a/content/browser/android/background_sync_network_observer_android.cc b/content/browser/android/background_sync_network_observer_android.cc index 15237fef..4d91dda 100644 --- a/content/browser/android/background_sync_network_observer_android.cc +++ b/content/browser/android/background_sync_network_observer_android.cc
@@ -6,8 +6,8 @@ #include "base/bind.h" #include "base/task/post_task.h" +#include "content/public/android/content_jni_headers/BackgroundSyncNetworkObserver_jni.h" #include "content/public/browser/browser_task_traits.h" -#include "jni/BackgroundSyncNetworkObserver_jni.h" using base::android::JavaParamRef;
diff --git a/content/browser/android/browser_startup_controller.cc b/content/browser/android/browser_startup_controller.cc index e0eddff..bb6c2b43 100644 --- a/content/browser/android/browser_startup_controller.cc +++ b/content/browser/android/browser_startup_controller.cc
@@ -10,7 +10,7 @@ #include "content/browser/browser_main_loop.h" #include "ppapi/buildflags/buildflags.h" -#include "jni/BrowserStartupControllerImpl_jni.h" +#include "content/public/android/content_jni_headers/BrowserStartupControllerImpl_jni.h" using base::android::JavaParamRef;
diff --git a/content/browser/android/content_feature_list.cc b/content/browser/android/content_feature_list.cc index 35e7941..4c31a3cf 100644 --- a/content/browser/android/content_feature_list.cc +++ b/content/browser/android/content_feature_list.cc
@@ -7,8 +7,8 @@ #include "base/android/jni_string.h" #include "base/feature_list.h" #include "base/stl_util.h" +#include "content/public/android/content_jni_headers/ContentFeatureList_jni.h" #include "content/public/common/content_features.h" -#include "jni/ContentFeatureList_jni.h" using base::android::ConvertJavaStringToUTF8; using base::android::JavaParamRef;
diff --git a/content/browser/android/content_ui_event_handler.cc b/content/browser/android/content_ui_event_handler.cc index c043c6a7..a83b28f 100644 --- a/content/browser/android/content_ui_event_handler.cc +++ b/content/browser/android/content_ui_event_handler.cc
@@ -8,7 +8,7 @@ #include "content/browser/renderer_host/render_widget_host_view_android.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_contents_view_android.h" -#include "jni/ContentUiEventHandler_jni.h" +#include "content/public/android/content_jni_headers/ContentUiEventHandler_jni.h" #include "ui/android/window_android.h" #include "ui/events/android/event_handler_android.h" #include "ui/events/android/gesture_event_android.h"
diff --git a/content/browser/android/content_view_statics.cc b/content/browser/android/content_view_statics.cc index 2c9247a..4de0ef22 100644 --- a/content/browser/android/content_view_statics.cc +++ b/content/browser/android/content_view_statics.cc
@@ -12,9 +12,9 @@ #include "base/logging.h" #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/common/view_messages.h" +#include "content/public/android/content_jni_headers/ContentViewStaticsImpl_jni.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host_observer.h" -#include "jni/ContentViewStaticsImpl_jni.h" using base::android::ConvertJavaStringToUTF16; using base::android::ConvertUTF16ToJavaString;
diff --git a/content/browser/android/date_time_chooser_android.cc b/content/browser/android/date_time_chooser_android.cc index d78c9f3f..b3fc989 100644 --- a/content/browser/android/date_time_chooser_android.cc +++ b/content/browser/android/date_time_chooser_android.cc
@@ -11,9 +11,9 @@ #include "base/i18n/char_iterator.h" #include "base/i18n/unicodestring.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/android/content_jni_headers/DateTimeChooserAndroid_jni.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_view_host.h" -#include "jni/DateTimeChooserAndroid_jni.h" #include "third_party/icu/source/common/unicode/uchar.h" #include "third_party/icu/source/common/unicode/unistr.h" #include "ui/android/window_android.h"
diff --git a/content/browser/android/dialog_overlay_impl.cc b/content/browser/android/dialog_overlay_impl.cc index 0dd5d68d..fbf7801 100644 --- a/content/browser/android/dialog_overlay_impl.cc +++ b/content/browser/android/dialog_overlay_impl.cc
@@ -7,10 +7,10 @@ #include "content/browser/frame_host/render_frame_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/android/content_jni_headers/DialogOverlayImpl_jni.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_contents_delegate.h" #include "gpu/ipc/common/gpu_surface_tracker.h" -#include "jni/DialogOverlayImpl_jni.h" #include "ui/android/view_android_observer.h" #include "ui/android/window_android.h"
diff --git a/content/browser/android/gesture_listener_manager.cc b/content/browser/android/gesture_listener_manager.cc index 4d03f78e..cc70e593 100644 --- a/content/browser/android/gesture_listener_manager.cc +++ b/content/browser/android/gesture_listener_manager.cc
@@ -7,9 +7,9 @@ #include "content/browser/android/gesture_listener_manager.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_contents_view_android.h" +#include "content/public/android/content_jni_headers/GestureListenerManagerImpl_jni.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/web_contents_observer.h" -#include "jni/GestureListenerManagerImpl_jni.h" #include "third_party/blink/public/platform/web_input_event.h" #include "ui/events/android/gesture_event_type.h" #include "ui/gfx/geometry/size_f.h"
diff --git a/content/browser/android/gpu_process_callback.cc b/content/browser/android/gpu_process_callback.cc index 06c6dee..6521db2a 100644 --- a/content/browser/android/gpu_process_callback.cc +++ b/content/browser/android/gpu_process_callback.cc
@@ -9,7 +9,7 @@ #include "content/public/browser/browser_thread.h" #include "gpu/ipc/common/gpu_surface_tracker.h" -#include "jni/GpuProcessCallback_jni.h" +#include "content/public/android/content_jni_headers/GpuProcessCallback_jni.h" namespace content {
diff --git a/content/browser/android/ime_adapter_android.cc b/content/browser/android/ime_adapter_android.cc index 12ed31d..5ce9d65 100644 --- a/content/browser/android/ime_adapter_android.cc +++ b/content/browser/android/ime_adapter_android.cc
@@ -21,10 +21,10 @@ #include "content/browser/renderer_host/render_widget_host_view_android.h" #include "content/common/frame_messages.h" #include "content/common/view_messages.h" +#include "content/public/android/content_jni_headers/ImeAdapterImpl_jni.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/web_contents.h" -#include "jni/ImeAdapterImpl_jni.h" #include "third_party/blink/public/platform/web_input_event.h" #include "third_party/blink/public/platform/web_text_input_type.h" #include "ui/base/ime/ime_text_span.h"
diff --git a/content/browser/android/java/gin_java_bound_object.cc b/content/browser/android/java/gin_java_bound_object.cc index ce1cc16..57c10f0 100644 --- a/content/browser/android/java/gin_java_bound_object.cc +++ b/content/browser/android/java/gin_java_bound_object.cc
@@ -8,7 +8,7 @@ #include "base/android/scoped_java_ref.h" #include "content/browser/android/java/jni_reflect.h" -#include "jni/Object_jni.h" +#include "content/browser/reflection_jni_headers/Object_jni.h" using base::android::AttachCurrentThread; using base::android::JavaObjectArrayReader;
diff --git a/content/browser/android/java/jni_reflect.cc b/content/browser/android/java/jni_reflect.cc index cc2ef8b..509075a1 100644 --- a/content/browser/android/java/jni_reflect.cc +++ b/content/browser/android/java/jni_reflect.cc
@@ -7,10 +7,10 @@ #include "base/android/jni_android.h" #include "base/android/jni_string.h" -#include "jni/AccessibleObject_jni.h" -#include "jni/Class_jni.h" -#include "jni/Method_jni.h" -#include "jni/Modifier_jni.h" +#include "content/browser/reflection_jni_headers/AccessibleObject_jni.h" +#include "content/browser/reflection_jni_headers/Class_jni.h" +#include "content/browser/reflection_jni_headers/Method_jni.h" +#include "content/browser/reflection_jni_headers/Modifier_jni.h" using base::android::ConvertJavaStringToUTF8; using base::android::JavaRef;
diff --git a/content/browser/android/java_interfaces_impl.cc b/content/browser/android/java_interfaces_impl.cc index 7e2b2e2..e9b8cbb 100644 --- a/content/browser/android/java_interfaces_impl.cc +++ b/content/browser/android/java_interfaces_impl.cc
@@ -11,9 +11,9 @@ #include "base/android/jni_android.h" #include "base/memory/singleton.h" #include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/public/android/content_jni_headers/InterfaceRegistrarImpl_jni.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_contents.h" -#include "jni/InterfaceRegistrarImpl_jni.h" #include "mojo/public/cpp/system/message_pipe.h" #include "services/service_manager/public/cpp/interface_provider.h"
diff --git a/content/browser/android/javascript_injector.cc b/content/browser/android/javascript_injector.cc index ed41faa..807e917ce 100644 --- a/content/browser/android/javascript_injector.cc +++ b/content/browser/android/javascript_injector.cc
@@ -6,7 +6,7 @@ #include "base/android/jni_string.h" #include "content/browser/android/java/gin_java_bridge_dispatcher_host.h" -#include "jni/JavascriptInjectorImpl_jni.h" +#include "content/public/android/content_jni_headers/JavascriptInjectorImpl_jni.h" using base::android::AttachCurrentThread; using base::android::ConvertJavaStringToUTF8;
diff --git a/content/browser/android/launcher_thread.cc b/content/browser/android/launcher_thread.cc index 0995ec2..f40fa879 100644 --- a/content/browser/android/launcher_thread.cc +++ b/content/browser/android/launcher_thread.cc
@@ -4,7 +4,7 @@ #include "content/browser/android/launcher_thread.h" -#include "jni/LauncherThread_jni.h" +#include "content/public/android/content_jni_headers/LauncherThread_jni.h" namespace content { namespace android {
diff --git a/content/browser/android/load_url_params.cc b/content/browser/android/load_url_params.cc index 255ce77..c1e0207 100644 --- a/content/browser/android/load_url_params.cc +++ b/content/browser/android/load_url_params.cc
@@ -5,9 +5,9 @@ #include <jni.h> #include "base/android/jni_string.h" +#include "content/public/android/content_jni_headers/LoadUrlParams_jni.h" #include "content/public/browser/navigation_controller.h" #include "content/public/common/url_constants.h" -#include "jni/LoadUrlParams_jni.h" #include "url/gurl.h" using base::android::JavaParamRef;
diff --git a/content/browser/android/navigation_handle_proxy.cc b/content/browser/android/navigation_handle_proxy.cc index 7d438f4c..72cd549 100644 --- a/content/browser/android/navigation_handle_proxy.cc +++ b/content/browser/android/navigation_handle_proxy.cc
@@ -7,8 +7,8 @@ #include "base/android/jni_android.h" #include "base/android/jni_string.h" #include "base/android/scoped_java_ref.h" +#include "content/public/android/content_jni_headers/NavigationHandle_jni.h" #include "content/public/browser/navigation_handle.h" -#include "jni/NavigationHandle_jni.h" using base::android::AttachCurrentThread; using base::android::ConvertUTF8ToJavaString;
diff --git a/content/browser/android/nfc_host.cc b/content/browser/android/nfc_host.cc index 6ae07c5..f6c9dcd 100644 --- a/content/browser/android/nfc_host.cc +++ b/content/browser/android/nfc_host.cc
@@ -7,8 +7,8 @@ #include <utility> #include "base/atomic_sequence_num.h" +#include "content/public/android/content_jni_headers/NfcHost_jni.h" #include "content/public/browser/system_connector.h" -#include "jni/NfcHost_jni.h" #include "services/device/public/mojom/constants.mojom.h" #include "services/device/public/mojom/nfc.mojom.h" #include "services/service_manager/public/cpp/connector.h"
diff --git a/content/browser/android/select_popup.cc b/content/browser/android/select_popup.cc index 6aba4c8..f6561ff 100644 --- a/content/browser/android/select_popup.cc +++ b/content/browser/android/select_popup.cc
@@ -9,10 +9,10 @@ #include "base/android/scoped_java_ref.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_contents_view_android.h" +#include "content/public/android/content_jni_headers/SelectPopup_jni.h" #include "content/public/browser/render_frame_host.h" #include "content/public/common/menu_item.h" #include "content/public/common/use_zoom_for_dsf_policy.h" -#include "jni/SelectPopup_jni.h" #include "ui/gfx/geometry/rect_f.h" using base::android::AttachCurrentThread;
diff --git a/content/browser/android/selection/selection_popup_controller.cc b/content/browser/android/selection/selection_popup_controller.cc index f226423..64650a2f 100644 --- a/content/browser/android/selection/selection_popup_controller.cc +++ b/content/browser/android/selection/selection_popup_controller.cc
@@ -11,8 +11,8 @@ #include "content/browser/renderer_host/render_widget_host_view_android.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_contents_view_android.h" +#include "content/public/android/content_jni_headers/SelectionPopupControllerImpl_jni.h" #include "content/public/common/context_menu_params.h" -#include "jni/SelectionPopupControllerImpl_jni.h" #include "third_party/blink/public/web/web_context_menu_data.h" #include "ui/gfx/geometry/point_conversions.h"
diff --git a/content/browser/android/selection/smart_selection_client.cc b/content/browser/android/selection/smart_selection_client.cc index 9b66c9f..fecf854 100644 --- a/content/browser/android/selection/smart_selection_client.cc +++ b/content/browser/android/selection/smart_selection_client.cc
@@ -8,9 +8,9 @@ #include "base/android/jni_string.h" #include "base/bind.h" #include "base/supports_user_data.h" +#include "content/public/android/content_jni_headers/SmartSelectionClient_jni.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" -#include "jni/SmartSelectionClient_jni.h" using base::android::AttachCurrentThread; using base::android::ConvertUTF16ToJavaString;
diff --git a/content/browser/android/text_suggestion_host_android.cc b/content/browser/android/text_suggestion_host_android.cc index 931b747..37e7049 100644 --- a/content/browser/android/text_suggestion_host_android.cc +++ b/content/browser/android/text_suggestion_host_android.cc
@@ -10,12 +10,12 @@ #include "base/bind.h" #include "content/browser/android/text_suggestion_host_mojo_impl_android.h" #include "content/browser/renderer_host/render_widget_host_impl.h" +#include "content/public/android/content_jni_headers/SuggestionInfo_jni.h" +#include "content/public/android/content_jni_headers/TextSuggestionHost_jni.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/use_zoom_for_dsf_policy.h" -#include "jni/SuggestionInfo_jni.h" -#include "jni/TextSuggestionHost_jni.h" #include "services/service_manager/public/cpp/interface_provider.h" #include "ui/gfx/android/view_configuration.h"
diff --git a/content/browser/android/tracing_controller_android.cc b/content/browser/android/tracing_controller_android.cc index a3ec02202..43c4bcf5 100644 --- a/content/browser/android/tracing_controller_android.cc +++ b/content/browser/android/tracing_controller_android.cc
@@ -14,8 +14,8 @@ #include "base/logging.h" #include "base/trace_event/trace_event.h" #include "content/browser/tracing/tracing_controller_impl.h" +#include "content/public/android/content_jni_headers/TracingControllerAndroidImpl_jni.h" #include "content/public/browser/tracing_controller.h" -#include "jni/TracingControllerAndroidImpl_jni.h" using base::android::JavaParamRef; using base::android::ScopedJavaLocalRef;
diff --git a/content/browser/android/web_contents_observer_proxy.cc b/content/browser/android/web_contents_observer_proxy.cc index 6cfd351f..1359ea2 100644 --- a/content/browser/android/web_contents_observer_proxy.cc +++ b/content/browser/android/web_contents_observer_proxy.cc
@@ -17,10 +17,10 @@ #include "content/browser/frame_host/navigation_handle_impl.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/android/content_jni_headers/WebContentsObserverProxy_jni.h" #include "content/public/browser/navigation_details.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/navigation_handle.h" -#include "jni/WebContentsObserverProxy_jni.h" using base::android::AttachCurrentThread; using base::android::JavaParamRef;
diff --git a/content/browser/background_sync/OWNERS b/content/browser/background_sync/OWNERS index 7f3d55ba..4ecc5489 100644 --- a/content/browser/background_sync/OWNERS +++ b/content/browser/background_sync/OWNERS
@@ -1,5 +1,3 @@ -iclelland@chromium.org -jkarlin@chromium.org -peter@chromium.org +file://chrome/browser/background_sync/OWNERS # COMPONENT: Blink>BackgroundSync
diff --git a/content/browser/child_process_launcher_helper_android.cc b/content/browser/child_process_launcher_helper_android.cc index bed56cf..e7f74684 100644 --- a/content/browser/child_process_launcher_helper_android.cc +++ b/content/browser/child_process_launcher_helper_android.cc
@@ -17,13 +17,13 @@ #include "content/browser/child_process_launcher_helper_posix.h" #include "content/browser/posix_file_descriptor_info_impl.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/android/content_jni_headers/ChildProcessLauncherHelperImpl_jni.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_launcher_utils.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/content_descriptors.h" #include "content/public/common/content_switches.h" -#include "jni/ChildProcessLauncherHelperImpl_jni.h" #include "services/service_manager/sandbox/switches.h" using base::android::AttachCurrentThread;
diff --git a/content/browser/contacts/contacts_provider_android.cc b/content/browser/contacts/contacts_provider_android.cc index 4fc2199..370e4ed 100644 --- a/content/browser/contacts/contacts_provider_android.cc +++ b/content/browser/contacts/contacts_provider_android.cc
@@ -13,8 +13,8 @@ #include "base/callback.h" #include "components/url_formatter/elide_url.h" #include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/public/android/content_jni_headers/ContactsDialogHost_jni.h" #include "content/public/browser/web_contents.h" -#include "jni/ContactsDialogHost_jni.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "ui/android/window_android.h" #include "url/origin.h"
diff --git a/content/browser/frame_host/navigation_controller_android.cc b/content/browser/frame_host/navigation_controller_android.cc index 448ee7e1..06f8fed 100644 --- a/content/browser/frame_host/navigation_controller_android.cc +++ b/content/browser/frame_host/navigation_controller_android.cc
@@ -13,10 +13,10 @@ #include "base/strings/string16.h" #include "content/browser/frame_host/navigation_controller_impl.h" #include "content/browser/frame_host/navigation_entry_impl.h" +#include "content/public/android/content_jni_headers/NavigationControllerImpl_jni.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/ssl_host_state_delegate.h" #include "content/public/common/resource_request_body_android.h" -#include "jni/NavigationControllerImpl_jni.h" #include "net/base/data_url.h" #include "ui/gfx/android/java_bitmap.h"
diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc index ab14fcf..c25849f 100644 --- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc +++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -9843,8 +9843,17 @@ // When running OpenURL to an invalid URL on a frame proxy it should not spoof // the url by canceling a main frame navigation. // See https://crbug.com/966914. -IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, - CrossProcessIframeToInvalidURLCancelsRedirectSpoof) { +// Failing on Linux CFI. http://crbug.com/974319 +#if defined(OS_LINUX) +#define MAYBE_CrossProcessIframeToInvalidURLCancelsRedirectSpoof \ + DISABLED_CrossProcessIframeToInvalidURLCancelsRedirectSpoof +#else +#define MAYBE_CrossProcessIframeToInvalidURLCancelsRedirectSpoof \ + CrossProcessIframeToInvalidURLCancelsRedirectSpoof +#endif +IN_PROC_BROWSER_TEST_F( + NavigationControllerBrowserTest, + MAYBE_CrossProcessIframeToInvalidURLCancelsRedirectSpoof) { const GURL main_frame_url(embedded_test_server()->GetURL( "a.com", "/cross_site_iframe_factory.html?a(b{sandbox-allow-scripts,sandbox-allow-" @@ -9861,19 +9870,20 @@ std::string script = "var messageUnloadEventSent = false;" "window.addEventListener('beforeunload', function " - "onBeforeUnload(event) {" - "if(messageUnloadEventSent) {" - "return;" - "}" - "messageUnloadEventSent = true;" - "var iframe = document.getElementById('child-0');" - "iframe.contentWindow.postMessage('', '*');" - "});"; + " onBeforeUnload(event) {" + " if(messageUnloadEventSent) {" + " return;" + " }" + " messageUnloadEventSent = true;" + " var iframe = document.getElementById('child-0');" + " iframe.contentWindow.postMessage('', '*');" + " }" + ");"; EXPECT_TRUE(ExecJs(root, script)); script = "window.addEventListener('message', function (event) {" - "parent.location.href = 'chrome-guest://1234';" + " parent.location.href = 'chrome-guest://1234';" "});"; EXPECT_TRUE(ExecJs(root->child_at(0), script));
diff --git a/content/browser/frame_host/render_frame_host_android.cc b/content/browser/frame_host/render_frame_host_android.cc index 63de23c2..84359676 100644 --- a/content/browser/frame_host/render_frame_host_android.cc +++ b/content/browser/frame_host/render_frame_host_android.cc
@@ -13,9 +13,9 @@ #include "base/logging.h" #include "content/browser/frame_host/render_frame_host_delegate.h" #include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/public/android/content_jni_headers/RenderFrameHostImpl_jni.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/site_instance.h" -#include "jni/RenderFrameHostImpl_jni.h" using base::android::AttachCurrentThread; using base::android::ConvertUTF8ToJavaString;
diff --git a/content/browser/gpu/gpu_internals_ui.cc b/content/browser/gpu/gpu_internals_ui.cc index b049c96..eb2ccb2 100644 --- a/content/browser/gpu/gpu_internals_ui.cc +++ b/content/browser/gpu/gpu_internals_ui.cc
@@ -688,7 +688,6 @@ for (const auto& workaround : GetDriverBugWorkarounds()) workarounds->AppendString(workaround); feature_status->Set("workarounds", std::move(workarounds)); - feature_status->Set("ANGLEFeatures", GetANGLEFeatures()); gpu_info_val->Set("featureStatus", std::move(feature_status)); if (!GpuDataManagerImpl::GetInstance()->IsGpuProcessUsingHardwareGpu()) { auto feature_status_for_hardware_gpu = @@ -717,6 +716,7 @@ gpu_info_val->Set("gpuMemoryBufferInfo", GpuMemoryBufferInfo()); gpu_info_val->Set("displayInfo", getDisplayInfo()); gpu_info_val->Set("videoAcceleratorsInfo", GetVideoAcceleratorsInfo()); + gpu_info_val->Set("ANGLEFeatures", GetANGLEFeatures()); // Send GPU Info to javascript. web_ui()->CallJavascriptFunctionUnsafe("browserBridge.onGpuInfoUpdate",
diff --git a/content/browser/media/session/audio_focus_delegate_android.cc b/content/browser/media/session/audio_focus_delegate_android.cc index f835e2b..56344b84 100644 --- a/content/browser/media/session/audio_focus_delegate_android.cc +++ b/content/browser/media/session/audio_focus_delegate_android.cc
@@ -6,7 +6,7 @@ #include "base/android/jni_android.h" #include "content/browser/media/session/media_session_impl.h" -#include "jni/AudioFocusDelegate_jni.h" +#include "content/public/android/content_jni_headers/AudioFocusDelegate_jni.h" #include "media/base/media_switches.h" #include "services/media_session/public/mojom/audio_focus.mojom.h"
diff --git a/content/browser/media/session/media_session_android.cc b/content/browser/media/session/media_session_android.cc index 2b94e520..232d94a 100644 --- a/content/browser/media/session/media_session_android.cc +++ b/content/browser/media/session/media_session_android.cc
@@ -11,8 +11,8 @@ #include "content/browser/media/session/media_session_impl.h" #include "content/browser/web_contents/web_contents_android.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/android/content_jni_headers/MediaSessionImpl_jni.h" #include "content/public/browser/media_session.h" -#include "jni/MediaSessionImpl_jni.h" #include "services/media_session/public/cpp/media_image.h" #include "services/media_session/public/mojom/audio_focus.mojom.h"
diff --git a/content/browser/memory/memory_monitor_android.cc b/content/browser/memory/memory_monitor_android.cc index 3e8a5052..0d316bb 100644 --- a/content/browser/memory/memory_monitor_android.cc +++ b/content/browser/memory/memory_monitor_android.cc
@@ -7,7 +7,7 @@ #include "base/android/jni_android.h" #include "base/memory/memory_pressure_listener.h" #include "base/memory/ptr_util.h" -#include "jni/MemoryMonitorAndroid_jni.h" +#include "content/public/android/content_jni_headers/MemoryMonitorAndroid_jni.h" namespace content {
diff --git a/content/browser/renderer_host/input/synthetic_gesture_target_android.cc b/content/browser/renderer_host/input/synthetic_gesture_target_android.cc index 83089f9f..01212778 100644 --- a/content/browser/renderer_host/input/synthetic_gesture_target_android.cc +++ b/content/browser/renderer_host/input/synthetic_gesture_target_android.cc
@@ -8,7 +8,7 @@ #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_android.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" -#include "jni/SyntheticGestureTarget_jni.h" +#include "content/public/android/content_jni_headers/SyntheticGestureTarget_jni.h" #include "third_party/blink/public/platform/web_input_event.h" #include "third_party/blink/public/platform/web_mouse_event.h" #include "third_party/blink/public/platform/web_mouse_wheel_event.h"
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index a620bf2..6dd5029f 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -1039,7 +1039,7 @@ input_event_observers_; // The observers watching us. - base::ObserverList<RenderWidgetHostObserver>::Unchecked observers_; + base::ObserverList<RenderWidgetHostObserver> observers_; // This is true if the renderer is currently unresponsive. bool is_unresponsive_ = false;
diff --git a/content/browser/resources/gpu/info_view.js b/content/browser/resources/gpu/info_view.js index 16bcee8..42301d5a 100644 --- a/content/browser/resources/gpu/info_view.js +++ b/content/browser/resources/gpu/info_view.js
@@ -123,13 +123,11 @@ if (gpuInfo.featureStatus) { this.appendFeatureInfo_( gpuInfo.featureStatus, featureStatusList, problemsDiv, - problemsList, workaroundsDiv, workaroundsList, ANGLEFeaturesDiv, - ANGLEFeaturesList); + problemsList, workaroundsDiv, workaroundsList); } else { featureStatusList.textContent = ''; problemsList.hidden = true; workaroundsList.hidden = true; - ANGLEFeaturesList.hidden = true; } if (gpuInfo.featureStatusForHardwareGpu) { @@ -186,6 +184,20 @@ this.setTable_('video-acceleration-info', []); } + if (gpuInfo.ANGLEFeatures) { + if (gpuInfo.ANGLEFeatures.length) { + ANGLEFeaturesDiv.hidden = false; + ANGLEFeaturesList.textContent = ''; + for (i = 0; i < gpuInfo.ANGLEFeatures.length; i++) { + const ANGLEFeature = gpuInfo.ANGLEFeatures[i]; + const ANGLEFeatureEl = this.createANGLEFeatureEl_(ANGLEFeature); + ANGLEFeaturesList.appendChild(ANGLEFeatureEl); + } + } else { + ANGLEFeaturesDiv.hidden = true; + } + } + if (gpuInfo.diagnostics) { diagnosticsDiv.hidden = false; diagnosticsLoadingDiv.hidden = true; @@ -214,7 +226,7 @@ appendFeatureInfo_: function( featureInfo, featureStatusList, problemsDiv, problemsList, - workaroundsDiv, workaroundsList, ANGLEFeaturesDiv, ANGLEFeaturesList) { + workaroundsDiv, workaroundsList) { // Feature map const featureLabelMap = { '2d_canvas': 'Canvas', @@ -321,18 +333,6 @@ } else { workaroundsDiv.hidden = true; } - - if (featureInfo.ANGLEFeatures.length) { - ANGLEFeaturesDiv.hidden = false; - ANGLEFeaturesList.textContent = ''; - for (i = 0; i < featureInfo.ANGLEFeatures.length; i++) { - const ANGLEFeature = featureInfo.ANGLEFeatures[i]; - const ANGLEFeatureEl = this.createANGLEFeatureEl_(ANGLEFeature); - ANGLEFeaturesList.appendChild(ANGLEFeatureEl); - } - } else { - ANGLEFeaturesDiv.hidden = true; - } }, createProblemEl_: function(problem) {
diff --git a/content/browser/scheduler/responsiveness/metric_source.cc b/content/browser/scheduler/responsiveness/metric_source.cc new file mode 100644 index 0000000..ca180779 --- /dev/null +++ b/content/browser/scheduler/responsiveness/metric_source.cc
@@ -0,0 +1,127 @@ +// 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. + +#include "content/browser/scheduler/responsiveness/metric_source.h" + +#include "base/bind.h" +#include "base/pending_task.h" +#include "base/task/post_task.h" +#include "build/build_config.h" +#include "content/browser/scheduler/responsiveness/message_loop_observer.h" +#include "content/browser/scheduler/responsiveness/native_event_observer.h" +#include "content/public/browser/browser_task_traits.h" +#include "content/public/browser/browser_thread.h" + +#if defined(OS_CHROMEOS) +#include "ui/base/ui_base_features.h" +#endif + +namespace content { +namespace responsiveness { + +MetricSource::Delegate::~Delegate() = default; + +MetricSource::MetricSource(Delegate* delegate) : delegate_(delegate) { + DCHECK(delegate_); + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); +} + +void MetricSource::SetUp() { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + RegisterMessageLoopObserverUI(); + native_event_observer_ui_ = CreateNativeEventObserver(); + + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, + base::BindOnce(&MetricSource::SetUpOnIOThread, base::Unretained(this))); +} + +void MetricSource::Destroy(base::ScopedClosureRunner on_finish_destroy) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + DCHECK(!destroy_was_called_); + destroy_was_called_ = true; + + message_loop_observer_ui_.reset(); + native_event_observer_ui_.reset(); + + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, + base::BindOnce(&MetricSource::TearDownOnIOThread, base::Unretained(this), + std::move(on_finish_destroy))); +} + +std::unique_ptr<NativeEventObserver> MetricSource::CreateNativeEventObserver() { + // We can use base::Unretained(delegate_) since delegate_ is retained + // in the constructor, and we won't release it when it is in use. + NativeEventObserver::WillRunEventCallback will_run_callback = + base::BindRepeating(&Delegate::WillRunEventOnUIThread, + base::Unretained(delegate_)); + NativeEventObserver::DidRunEventCallback did_run_callback = + base::BindRepeating(&Delegate::DidRunEventOnUIThread, + base::Unretained(delegate_)); + return std::make_unique<NativeEventObserver>(std::move(will_run_callback), + std::move(did_run_callback)); +} + +MetricSource::~MetricSource() { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); +} + +void MetricSource::RegisterMessageLoopObserverUI() { + // We can use base::Unretained(delegate_) since delegate_ is retained + // in the constructor, and we won't release it when it is in use. + MessageLoopObserver::TaskCallback will_run_callback = base::BindRepeating( + &Delegate::WillRunTaskOnUIThread, base::Unretained(delegate_)); + MessageLoopObserver::TaskCallback did_run_callback = base::BindRepeating( + &Delegate::DidRunTaskOnUIThread, base::Unretained(delegate_)); + message_loop_observer_ui_ = std::make_unique<MessageLoopObserver>( + std::move(will_run_callback), std::move(did_run_callback)); +} + +void MetricSource::RegisterMessageLoopObserverIO() { + // We can use base::Unretained(delegate_) since delegate_ is retained + // in the constructor, and we won't release it when it is in use. + MessageLoopObserver::TaskCallback will_run_callback = base::BindRepeating( + &Delegate::WillRunTaskOnIOThread, base::Unretained(delegate_)); + MessageLoopObserver::TaskCallback did_run_callback = base::BindRepeating( + &Delegate::DidRunTaskOnIOThread, base::Unretained(delegate_)); + message_loop_observer_io_ = std::make_unique<MessageLoopObserver>( + std::move(will_run_callback), std::move(did_run_callback)); +} + +void MetricSource::SetUpOnIOThread() { + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + + RegisterMessageLoopObserverIO(); + + delegate_->SetUpOnIOThread(); +} + +void MetricSource::TearDownOnIOThread( + base::ScopedClosureRunner on_finish_destroy) { + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + + delegate_->TearDownOnIOThread(); + + message_loop_observer_io_.reset(); + + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, + base::BindOnce(&MetricSource::TearDownOnUIThread, base::Unretained(this), + std::move(on_finish_destroy))); +} + +void MetricSource::TearDownOnUIThread( + base::ScopedClosureRunner on_finish_destroy) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + delegate_->TearDownOnUIThread(); + // |on_finish_destroy| isn't further passed on. It gets run here and might + // destroy us. +} + +} // namespace responsiveness +} // namespace content
diff --git a/content/browser/scheduler/responsiveness/metric_source.h b/content/browser/scheduler/responsiveness/metric_source.h new file mode 100644 index 0000000..85c5a256 --- /dev/null +++ b/content/browser/scheduler/responsiveness/metric_source.h
@@ -0,0 +1,108 @@ +// 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. + +#ifndef CONTENT_BROWSER_SCHEDULER_RESPONSIVENESS_METRIC_SOURCE_H_ +#define CONTENT_BROWSER_SCHEDULER_RESPONSIVENESS_METRIC_SOURCE_H_ + +#include <memory> + +#include "base/callback.h" +#include "base/callback_helpers.h" +#include "base/gtest_prod_util.h" +#include "base/macros.h" +#include "base/time/time.h" +#include "content/common/content_export.h" + +namespace base { +struct PendingTask; +} // namespace base + +namespace content { +namespace responsiveness { + +class MessageLoopObserver; +class NativeEventObserver; + +// This class represents the source of browser responsiveness metrics. +// This class watches events and tasks processed on the UI and IO threads of the +// browser process. It notifies the registered Delegate implementer about +// event and task execution through the WillRun* and DidRun* methods. +// +// This class must only be constructed/destroyed on the UI thread. It has some +// private members that are affine to the IO thread. It takes care of deleting +// them appropriately. +// +// TODO(erikchen): Once the browser scheduler is implemented, this entire class +// should become simpler, as either BrowserUIThreadScheduler or +// BrowserIOThreadScheduler should implement much of the same functionality. +class CONTENT_EXPORT MetricSource { + public: + class CONTENT_EXPORT Delegate { + public: + virtual ~Delegate(); + + // Interface for SetUp/TearDown on UI/IO threads in the implementer. + virtual void SetUpOnIOThread() = 0; + virtual void TearDownOnUIThread() = 0; + virtual void TearDownOnIOThread() = 0; + + // These methods are called by the MessageLoopObserver of the UI thread to + // allow Delegate to collect metadata about the tasks being run. + virtual void WillRunTaskOnUIThread(const base::PendingTask* task) = 0; + virtual void DidRunTaskOnUIThread(const base::PendingTask* task) = 0; + + // These methods are called by the MessageLoopObserver of the IO thread to + // allow Delegate to collect metadata about the tasks being run. + virtual void WillRunTaskOnIOThread(const base::PendingTask* task) = 0; + virtual void DidRunTaskOnIOThread(const base::PendingTask* task) = 0; + + // These methods are called by the NativeEventObserver of the UI thread to + // allow Delegate to collect metadata about the events being run. + virtual void WillRunEventOnUIThread(const void* opaque_identifier) = 0; + virtual void DidRunEventOnUIThread(const void* opaque_identifier) = 0; + }; + + explicit MetricSource(Delegate* delegate); + virtual ~MetricSource(); + + // Must be called immediately after the constructor. This cannot be called + // from the constructor because subclasses [for tests] need to be able to + // override functions. + void SetUp(); + + // Destruction requires a thread-hop to the IO thread so cannot be completed + // synchronously. Owners of this class calling Destroy() should pass one + // base::ScopedClosureRunner for final cleanup when this class finishes the + // destruction on the UI thread. It's safe to delete this instance in + // |on_finish_destroy|. + void Destroy(base::ScopedClosureRunner on_finish_destroy); + + protected: + virtual std::unique_ptr<NativeEventObserver> CreateNativeEventObserver(); + virtual void RegisterMessageLoopObserverUI(); + virtual void RegisterMessageLoopObserverIO(); + + private: + void SetUpOnIOThread(); + void TearDownOnIOThread(base::ScopedClosureRunner on_finish_destroy); + void TearDownOnUIThread(base::ScopedClosureRunner on_finish_destroy); + + Delegate* delegate_; + + // The following members are all affine to the UI thread. + std::unique_ptr<MessageLoopObserver> message_loop_observer_ui_; + std::unique_ptr<NativeEventObserver> native_event_observer_ui_; + + // The following members are all affine to the IO thread. + std::unique_ptr<MessageLoopObserver> message_loop_observer_io_; + + bool destroy_was_called_ = false; + + DISALLOW_COPY_AND_ASSIGN(MetricSource); +}; + +} // namespace responsiveness +} // namespace content + +#endif // CONTENT_BROWSER_SCHEDULER_RESPONSIVENESS_METRIC_SOURCE_H_
diff --git a/content/browser/scheduler/responsiveness/metric_source_unittest.cc b/content/browser/scheduler/responsiveness/metric_source_unittest.cc new file mode 100644 index 0000000..89e4170 --- /dev/null +++ b/content/browser/scheduler/responsiveness/metric_source_unittest.cc
@@ -0,0 +1,178 @@ +// 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. + +#include "content/browser/scheduler/responsiveness/metric_source.h" + +#include <atomic> + +#include "base/bind_helpers.h" +#include "base/task/post_task.h" +#include "base/test/bind_test_util.h" +#include "content/browser/scheduler/responsiveness/native_event_observer.h" +#include "content/public/browser/browser_task_traits.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/test/test_browser_thread_bundle.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace content { +namespace responsiveness { +namespace { + +class FakeDelegate : public MetricSource::Delegate { + public: + FakeDelegate() + : set_up_on_io_thread_(false), tear_down_on_io_thread_(false), + will_run_task_on_io_thread_(0), did_run_task_on_io_thread_(0) {} + ~FakeDelegate() override = default; + + void SetUpOnIOThread() override { set_up_on_io_thread_ = true; } + void TearDownOnUIThread() override { tear_down_on_ui_thread_ = true; } + void TearDownOnIOThread() override { tear_down_on_io_thread_ = true; } + + void WillRunTaskOnUIThread(const base::PendingTask* task) override { + will_run_task_on_ui_thread_++; + } + void DidRunTaskOnUIThread(const base::PendingTask* task) override { + did_run_task_on_ui_thread_++; + } + + void WillRunTaskOnIOThread(const base::PendingTask* task) override { + will_run_task_on_io_thread_++; + } + void DidRunTaskOnIOThread(const base::PendingTask* task) override { + did_run_task_on_io_thread_++; + } + + void WillRunEventOnUIThread(const void* opaque_identifier) override {} + void DidRunEventOnUIThread(const void* opaque_identifier) override {} + + bool set_up_on_io_thread() { return set_up_on_io_thread_; } + bool tear_down_on_ui_thread() { return tear_down_on_ui_thread_; } + bool tear_down_on_io_thread() { return tear_down_on_io_thread_; } + + int will_run_task_on_ui_thread() { return will_run_task_on_ui_thread_; } + int did_run_task_on_ui_thread() { return did_run_task_on_ui_thread_; } + int will_run_task_on_io_thread() { return will_run_task_on_io_thread_; } + int did_run_task_on_io_thread() { return did_run_task_on_io_thread_; } + + private: + std::atomic_bool set_up_on_io_thread_; + bool tear_down_on_ui_thread_ = false; + std::atomic_bool tear_down_on_io_thread_; + + int will_run_task_on_ui_thread_ = 0; + int did_run_task_on_ui_thread_ = 0; + + std::atomic_int will_run_task_on_io_thread_; + std::atomic_int did_run_task_on_io_thread_; +}; + +class TestMetricSource : public MetricSource { + public: + TestMetricSource(MetricSource::Delegate* delegate, + base::OnceClosure on_destroyed = base::DoNothing()) + : MetricSource(delegate), on_destroyed_(std::move(on_destroyed)) {} + + std::unique_ptr<NativeEventObserver> CreateNativeEventObserver() override { + return nullptr; + } + + ~TestMetricSource() override { + DCHECK(on_destroyed_); + std::move(on_destroyed_).Run(); + } + + private: + base::OnceClosure on_destroyed_; +}; + +} // namespace + +class ResponsivenessMetricSourceTest : public testing::Test { + public: + ResponsivenessMetricSourceTest() + : test_browser_thread_bundle_( + base::test::ScopedTaskEnvironment::MainThreadType::UI, + content::TestBrowserThreadBundle::REAL_IO_THREAD) {} + + void SetUp() override { test_browser_thread_bundle_.RunIOThreadUntilIdle(); } + + void TearDown() override { + // Destroy a task onto the IO thread, which posts back to the UI thread + // to complete destruction. + test_browser_thread_bundle_.RunIOThreadUntilIdle(); + test_browser_thread_bundle_.RunUntilIdle(); + } + + protected: + // This member sets up BrowserThread::IO and BrowserThread::UI. It must be the + // first member, as other members may depend on these abstractions. + content::TestBrowserThreadBundle test_browser_thread_bundle_; +}; + +TEST_F(ResponsivenessMetricSourceTest, SetUpTearDown) { + std::unique_ptr<FakeDelegate> delegate = std::make_unique<FakeDelegate>(); + std::unique_ptr<TestMetricSource> metric_source = + std::make_unique<TestMetricSource>(delegate.get()); + + EXPECT_FALSE(delegate->set_up_on_io_thread()); + EXPECT_FALSE(delegate->tear_down_on_ui_thread()); + EXPECT_FALSE(delegate->tear_down_on_io_thread()); + + metric_source->SetUp(); + // Test SetUpOnIOThread() is called after running the IO thread RunLoop. + test_browser_thread_bundle_.RunIOThreadUntilIdle(); + EXPECT_TRUE(delegate->set_up_on_io_thread()); + + test_browser_thread_bundle_.RunUntilIdle(); + + base::ScopedClosureRunner on_finish_destroy( + base::BindLambdaForTesting([&]() { metric_source = nullptr; })); + metric_source->Destroy(std::move(on_finish_destroy)); + + // Run IO thread to test TearDownOnIOThread(). + test_browser_thread_bundle_.RunIOThreadUntilIdle(); + EXPECT_TRUE(delegate->tear_down_on_io_thread()); + EXPECT_FALSE(delegate->tear_down_on_ui_thread()); + + // Run the UI thread to test TearDownOnUIThread(). + base::RunLoop().RunUntilIdle(); + EXPECT_TRUE(delegate->tear_down_on_ui_thread()); + + EXPECT_FALSE(metric_source); +} + +// Test that the task callbacks are correctly called on UI and IO threads. +TEST_F(ResponsivenessMetricSourceTest, RunTasks) { + std::unique_ptr<FakeDelegate> delegate = std::make_unique<FakeDelegate>(); + std::unique_ptr<TestMetricSource> metric_source = + std::make_unique<TestMetricSource>(delegate.get()); + + metric_source->SetUp(); + test_browser_thread_bundle_.RunIOThreadUntilIdle(); + test_browser_thread_bundle_.RunUntilIdle(); + + base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI}, + base::DoNothing()); + test_browser_thread_bundle_.RunUntilIdle(); + EXPECT_GT(delegate->will_run_task_on_ui_thread(), 0); + EXPECT_GT(delegate->did_run_task_on_ui_thread(), 0); + + base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, + base::DoNothing()); + test_browser_thread_bundle_.RunUntilIdle(); + EXPECT_GT(delegate->will_run_task_on_io_thread(), 0); + EXPECT_GT(delegate->did_run_task_on_io_thread(), 0); + + base::ScopedClosureRunner on_finish_destroy( + base::BindLambdaForTesting([&]() { metric_source = nullptr; })); + metric_source->Destroy(std::move(on_finish_destroy)); + test_browser_thread_bundle_.RunIOThreadUntilIdle(); + test_browser_thread_bundle_.RunUntilIdle(); + + EXPECT_FALSE(metric_source); +} + +} // namespace responsiveness +} // namespace content
diff --git a/content/browser/scheduler/responsiveness/watcher.cc b/content/browser/scheduler/responsiveness/watcher.cc index e0d934b..dcc1ebd 100644 --- a/content/browser/scheduler/responsiveness/watcher.cc +++ b/content/browser/scheduler/responsiveness/watcher.cc
@@ -19,109 +19,13 @@ Watcher::Metadata::Metadata(const void* identifier) : identifier(identifier) {} -Watcher::Watcher() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); -} - -void Watcher::SetUp() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - // Destroy() has the corresponding call to Release(). - // We need this additional reference to make sure the object stays alive - // through hops to the IO thread, which are necessary both during construction - // and destruction. - AddRef(); - - calculator_ = CreateCalculator(); - native_event_observer_ui_ = CreateNativeEventObserver(); - currently_running_metadata_ui_.reserve(5); - - RegisterMessageLoopObserverUI(); - - base::PostTaskWithTraits( - FROM_HERE, {content::BrowserThread::IO}, - base::BindOnce(&Watcher::SetUpOnIOThread, base::Unretained(this), - calculator_.get())); -} - -void Watcher::Destroy() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - DCHECK(!destroy_was_called_); - destroy_was_called_ = true; - - message_loop_observer_ui_.reset(); - native_event_observer_ui_.reset(); - - base::PostTaskWithTraits( - FROM_HERE, {content::BrowserThread::IO}, - base::BindOnce(&Watcher::TearDownOnIOThread, base::Unretained(this))); -} std::unique_ptr<Calculator> Watcher::CreateCalculator() { return std::make_unique<Calculator>(); } -std::unique_ptr<NativeEventObserver> Watcher::CreateNativeEventObserver() { - NativeEventObserver::WillRunEventCallback will_run_callback = - base::BindRepeating(&Watcher::WillRunEventOnUIThread, - base::Unretained(this)); - NativeEventObserver::DidRunEventCallback did_run_callback = - base::BindRepeating(&Watcher::DidRunEventOnUIThread, - base::Unretained(this)); - return std::make_unique<NativeEventObserver>(std::move(will_run_callback), - std::move(did_run_callback)); -} - -Watcher::~Watcher() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DCHECK(destroy_was_called_); -} - -void Watcher::RegisterMessageLoopObserverUI() { - // We must use base::Unretained(this) to prevent ownership cycle. - MessageLoopObserver::TaskCallback will_run_callback = base::BindRepeating( - &Watcher::WillRunTaskOnUIThread, base::Unretained(this)); - MessageLoopObserver::TaskCallback did_run_callback = base::BindRepeating( - &Watcher::DidRunTaskOnUIThread, base::Unretained(this)); - message_loop_observer_ui_.reset(new MessageLoopObserver( - std::move(will_run_callback), std::move(did_run_callback))); -} - -void Watcher::RegisterMessageLoopObserverIO() { - // We must use base::Unretained(this) to prevent ownership cycle. - MessageLoopObserver::TaskCallback will_run_callback = base::BindRepeating( - &Watcher::WillRunTaskOnIOThread, base::Unretained(this)); - MessageLoopObserver::TaskCallback did_run_callback = base::BindRepeating( - &Watcher::DidRunTaskOnIOThread, base::Unretained(this)); - message_loop_observer_io_.reset(new MessageLoopObserver( - std::move(will_run_callback), std::move(did_run_callback))); -} - -void Watcher::SetUpOnIOThread(Calculator* calculator) { - DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - - currently_running_metadata_io_.reserve(5); - RegisterMessageLoopObserverIO(); - calculator_io_ = calculator; -} - -void Watcher::TearDownOnIOThread() { - DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - - message_loop_observer_io_.reset(); - - calculator_io_ = nullptr; - base::PostTaskWithTraits( - FROM_HERE, {content::BrowserThread::UI}, - base::BindOnce(&Watcher::TearDownOnUIThread, base::Unretained(this))); -} - -void Watcher::TearDownOnUIThread() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - // Corresponding call to AddRef() is in the constructor. - Release(); +std::unique_ptr<MetricSource> Watcher::CreateMetricSource() { + return std::make_unique<MetricSource>(this); } void Watcher::WillRunTaskOnUIThread(const base::PendingTask* task) { @@ -274,5 +178,42 @@ base::TimeTicks::Now()); } +Watcher::Watcher() = default; +Watcher::~Watcher() = default; + +void Watcher::SetUp() { + // Set up |calculator_| before |metric_source_| because SetUpOnIOThread() + // uses |calculator_|. + calculator_ = CreateCalculator(); + currently_running_metadata_ui_.reserve(5); + + metric_source_ = CreateMetricSource(); + metric_source_->SetUp(); +} + +void Watcher::Destroy() { + // This holds a ref to |this| until the destroy flow completes. + base::ScopedClosureRunner on_destroy_complete(base::BindOnce( + &Watcher::FinishDestroyMetricSource, base::RetainedRef(this))); + + metric_source_->Destroy(std::move(on_destroy_complete)); +} + +void Watcher::SetUpOnIOThread() { + currently_running_metadata_io_.reserve(5); + DCHECK(calculator_.get()); + calculator_io_ = calculator_.get(); +} + +void Watcher::TearDownOnUIThread() {} + +void Watcher::FinishDestroyMetricSource() { + metric_source_ = nullptr; +} + +void Watcher::TearDownOnIOThread() { + calculator_io_ = nullptr; +} + } // namespace responsiveness } // namespace content
diff --git a/content/browser/scheduler/responsiveness/watcher.h b/content/browser/scheduler/responsiveness/watcher.h index d6fafba..7ce3f39 100644 --- a/content/browser/scheduler/responsiveness/watcher.h +++ b/content/browser/scheduler/responsiveness/watcher.h
@@ -5,61 +5,46 @@ #ifndef CONTENT_BROWSER_SCHEDULER_RESPONSIVENESS_WATCHER_H_ #define CONTENT_BROWSER_SCHEDULER_RESPONSIVENESS_WATCHER_H_ -#include <memory> #include <vector> -#include "base/callback.h" -#include "base/gtest_prod_util.h" -#include "base/macros.h" -#include "base/time/time.h" -#include "content/common/content_export.h" - -namespace base { -struct PendingTask; -} // namespace base +#include "content/browser/scheduler/responsiveness/metric_source.h" namespace content { namespace responsiveness { class Calculator; -class MessageLoopObserver; -class NativeEventObserver; -// This class watches events and tasks processed on the UI and IO threads of the -// browser process. It forwards stats on execution latency to Calculator, which -// emits UMA metrics. -// -// This class must only be constructed/destroyed on the UI thread. It has some -// private members that are affine to the IO thread. It takes care of deleting -// them appropriately. -// -// TODO(erikchen): Once the browser scheduler is implemented, this entire class -// should become simpler, as either BrowserUIThreadScheduler or -// BrowserIOThreadScheduler should implement much of the same functionality. -class CONTENT_EXPORT Watcher : public base::RefCounted<Watcher> { +class CONTENT_EXPORT Watcher : public base::RefCounted<Watcher>, + public MetricSource::Delegate { public: Watcher(); - - // Must be called immediately after the constructor. This cannot be called - // from the constructor because subclasses [for tests] need to be able to - // override functions. void SetUp(); - - // Destruction requires a thread-hop to the IO thread, so cannot be completed - // synchronously. Owners of this class should call this method, and then - // release their reference. void Destroy(); protected: + friend class base::RefCounted<Watcher>; + // Exposed for tests. virtual std::unique_ptr<Calculator> CreateCalculator(); - virtual std::unique_ptr<NativeEventObserver> CreateNativeEventObserver(); - virtual ~Watcher(); - virtual void RegisterMessageLoopObserverUI(); - virtual void RegisterMessageLoopObserverIO(); + virtual std::unique_ptr<MetricSource> CreateMetricSource(); + + ~Watcher() override; + + // Delegate interface implementation. + void SetUpOnIOThread() override; + void TearDownOnUIThread() override; + void TearDownOnIOThread() override; + + void WillRunTaskOnUIThread(const base::PendingTask* task) override; + void DidRunTaskOnUIThread(const base::PendingTask* task) override; + + void WillRunTaskOnIOThread(const base::PendingTask* task) override; + void DidRunTaskOnIOThread(const base::PendingTask* task) override; + + void WillRunEventOnUIThread(const void* opaque_identifier) override; + void DidRunEventOnUIThread(const void* opaque_identifier) override; private: - friend class base::RefCounted<Watcher>; FRIEND_TEST_ALL_PREFIXES(ResponsivenessWatcherTest, TaskForwarding); FRIEND_TEST_ALL_PREFIXES(ResponsivenessWatcherTest, TaskNesting); FRIEND_TEST_ALL_PREFIXES(ResponsivenessWatcherTest, NativeEvents); @@ -88,19 +73,8 @@ base::TimeTicks execution_start_time; }; - void SetUpOnIOThread(Calculator*); - void TearDownOnIOThread(); - void TearDownOnUIThread(); - - // These methods are called by the MessageLoopObserver of the UI thread to - // allow Watcher to collect metadata about the tasks being run. - void WillRunTaskOnUIThread(const base::PendingTask* task); - void DidRunTaskOnUIThread(const base::PendingTask* task); - - // These methods are called by the MessageLoopObserver of the IO thread to - // allow Watcher to collect metadata about the tasks being run. - void WillRunTaskOnIOThread(const base::PendingTask* task); - void DidRunTaskOnIOThread(const base::PendingTask* task); + // This is called when |metric_source_| finishes destruction. + void FinishDestroyMetricSource(); // Common implementations for the thread-specific methods. void WillRunTask(const base::PendingTask* task, @@ -114,15 +88,11 @@ int* mismatched_task_identifiers, TaskOrEventFinishedCallback callback); - // These methods are called by the NativeEventObserver of the UI thread to - // allow Watcher to collect metadata about the events being run. - void WillRunEventOnUIThread(const void* opaque_identifier); - void DidRunEventOnUIThread(const void* opaque_identifier); + // The source that emits responsiveness events. + std::unique_ptr<MetricSource> metric_source_; // The following members are all affine to the UI thread. std::unique_ptr<Calculator> calculator_; - std::unique_ptr<MessageLoopObserver> message_loop_observer_ui_; - std::unique_ptr<NativeEventObserver> native_event_observer_ui_; // Metadata for currently running tasks and events on the UI thread. std::vector<Metadata> currently_running_metadata_ui_; @@ -140,7 +110,6 @@ // The following members are all affine to the IO thread. std::vector<Metadata> currently_running_metadata_io_; int mismatched_task_identifiers_io_ = 0; - std::unique_ptr<MessageLoopObserver> message_loop_observer_io_; // The implementation of this class guarantees that |calculator_io_| will be // non-nullptr and point to a valid object any time it is used on the IO @@ -149,10 +118,6 @@ // all consumers of |calculator_io_|, and then clears the member and destroys // Calculator. Calculator* calculator_io_ = nullptr; - - bool destroy_was_called_ = false; - - DISALLOW_COPY_AND_ASSIGN(Watcher); }; } // namespace responsiveness
diff --git a/content/browser/scheduler/responsiveness/watcher_unittest.cc b/content/browser/scheduler/responsiveness/watcher_unittest.cc index bb392e4..33c90ebe 100644 --- a/content/browser/scheduler/responsiveness/watcher_unittest.cc +++ b/content/browser/scheduler/responsiveness/watcher_unittest.cc
@@ -53,6 +53,30 @@ std::vector<base::TimeTicks> queue_times_io_; }; +class FakeMetricSource : public MetricSource { + public: + FakeMetricSource(Delegate* delegate, bool register_message_loop_observer) + : MetricSource(delegate), + register_message_loop_observer_(register_message_loop_observer) {} + ~FakeMetricSource() override {} + + void RegisterMessageLoopObserverUI() override { + if (register_message_loop_observer_) + MetricSource::RegisterMessageLoopObserverUI(); + } + void RegisterMessageLoopObserverIO() override { + if (register_message_loop_observer_) + MetricSource::RegisterMessageLoopObserverIO(); + } + + std::unique_ptr<NativeEventObserver> CreateNativeEventObserver() override { + return nullptr; + } + + private: + bool register_message_loop_observer_; +}; + class FakeWatcher : public Watcher { public: std::unique_ptr<Calculator> CreateCalculator() override { @@ -62,17 +86,9 @@ return calculator; } - std::unique_ptr<NativeEventObserver> CreateNativeEventObserver() override { - return nullptr; - } - - void RegisterMessageLoopObserverUI() override { - if (register_message_loop_observer_) - Watcher::RegisterMessageLoopObserverUI(); - } - void RegisterMessageLoopObserverIO() override { - if (register_message_loop_observer_) - Watcher::RegisterMessageLoopObserverIO(); + std::unique_ptr<MetricSource> CreateMetricSource() override { + return std::make_unique<FakeMetricSource>(this, + register_message_loop_observer_); } FakeWatcher(bool register_message_loop_observer)
diff --git a/content/browser/screen_orientation/screen_orientation_delegate_android.cc b/content/browser/screen_orientation/screen_orientation_delegate_android.cc index 535fd96..0c7e4019 100644 --- a/content/browser/screen_orientation/screen_orientation_delegate_android.cc +++ b/content/browser/screen_orientation/screen_orientation_delegate_android.cc
@@ -6,7 +6,7 @@ #include "base/android/scoped_java_ref.h" #include "content/browser/screen_orientation/screen_orientation_provider.h" -#include "jni/ScreenOrientationProviderImpl_jni.h" +#include "content/public/android/content_jni_headers/ScreenOrientationProviderImpl_jni.h" #include "ui/android/window_android.h" #include "ui/gfx/native_widget_types.h"
diff --git a/content/browser/service_manager/service_manager_context.cc b/content/browser/service_manager/service_manager_context.cc index 559c3bd..5d5176f 100644 --- a/content/browser/service_manager/service_manager_context.cc +++ b/content/browser/service_manager/service_manager_context.cc
@@ -96,7 +96,7 @@ #if defined(OS_ANDROID) #include "base/android/jni_android.h" #include "base/android/scoped_java_ref.h" -#include "jni/ContentNfcDelegate_jni.h" +#include "content/public/android/content_jni_headers/ContentNfcDelegate_jni.h" #endif #if defined(OS_LINUX)
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc index 5ad48024..215c811 100644 --- a/content/browser/site_per_process_browsertest.cc +++ b/content/browser/site_per_process_browsertest.cc
@@ -12896,17 +12896,10 @@ EXPECT_EQ(expected_touch_action, whitelisted_touch_action.value()); } -// Flaky on Android. http://crbug.com/951513 -#if defined(OS_ANDROID) -#define MAYBE_EffectiveTouchActionPropagatesAcrossNestedFrames \ - DISABLED_EffectiveTouchActionPropagatesAcrossNestedFrames -#else -#define MAYBE_EffectiveTouchActionPropagatesAcrossNestedFrames \ - EffectiveTouchActionPropagatesAcrossNestedFrames -#endif - -IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTouchActionTest, - MAYBE_EffectiveTouchActionPropagatesAcrossNestedFrames) { +// Flaky on all platform. http://crbug.com/9515270 +IN_PROC_BROWSER_TEST_F( + SitePerProcessBrowserTouchActionTest, + DISABLED_EffectiveTouchActionPropagatesAcrossNestedFrames) { GURL main_url(embedded_test_server()->GetURL( "a.com", "/cross_site_iframe_factory.html?a(b(c))")); EXPECT_TRUE(NavigateToURL(shell(), main_url));
diff --git a/content/browser/sms/sms_provider_android.cc b/content/browser/sms/sms_provider_android.cc index 29bfff8..504c06b5 100644 --- a/content/browser/sms/sms_provider_android.cc +++ b/content/browser/sms/sms_provider_android.cc
@@ -9,7 +9,7 @@ #include "url/gurl.h" #include "url/origin.h" -#include "jni/SmsReceiver_jni.h" +#include "content/public/android/content_jni_headers/SmsReceiver_jni.h" using base::android::AttachCurrentThread; using base::android::ConvertJavaStringToUTF8;
diff --git a/content/browser/speech/speech_recognizer_impl_android.cc b/content/browser/speech/speech_recognizer_impl_android.cc index a4b95f6..583a8356 100644 --- a/content/browser/speech/speech_recognizer_impl_android.cc +++ b/content/browser/speech/speech_recognizer_impl_android.cc
@@ -13,12 +13,12 @@ #include "base/bind.h" #include "base/strings/utf_string_conversions.h" #include "base/task/post_task.h" +#include "content/public/android/content_jni_headers/SpeechRecognitionImpl_jni.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/speech_recognition_event_listener.h" #include "content/public/browser/speech_recognition_manager.h" #include "content/public/browser/speech_recognition_session_config.h" -#include "jni/SpeechRecognitionImpl_jni.h" #include "third_party/blink/public/mojom/speech/speech_recognition_result.mojom.h" using base::android::AppendJavaStringArrayToStringVector;
diff --git a/content/browser/speech/tts_android.cc b/content/browser/speech/tts_android.cc index e88d403..27e78ae 100644 --- a/content/browser/speech/tts_android.cc +++ b/content/browser/speech/tts_android.cc
@@ -11,8 +11,8 @@ #include "base/memory/singleton.h" #include "base/strings/utf_string_conversions.h" #include "content/common/buildflags.h" +#include "content/public/android/content_jni_headers/TtsPlatformImpl_jni.h" #include "content/public/browser/tts_controller.h" -#include "jni/TtsPlatformImpl_jni.h" using base::android::AttachCurrentThread; using base::android::JavaParamRef;
diff --git a/content/browser/tracing/background_startup_tracing_observer.cc b/content/browser/tracing/background_startup_tracing_observer.cc index 25524e3..b481674 100644 --- a/content/browser/tracing/background_startup_tracing_observer.cc +++ b/content/browser/tracing/background_startup_tracing_observer.cc
@@ -25,8 +25,9 @@ } bool GetBackgroundStartupTracingEnabled() const override { - return tracing::TraceStartupConfig::GetInstance() - ->GetBackgroundStartupTracingEnabled(); + return tracing::TraceStartupConfig::GetInstance()->IsEnabled() && + tracing::TraceStartupConfig::GetInstance()->GetSessionOwner() == + tracing::TraceStartupConfig::SessionOwner::kBackgroundTracing; } };
diff --git a/content/browser/tracing/startup_tracing_browsertest.cc b/content/browser/tracing/startup_tracing_browsertest.cc index 5ce4792..6046f20 100644 --- a/content/browser/tracing/startup_tracing_browsertest.cc +++ b/content/browser/tracing/startup_tracing_browsertest.cc
@@ -162,7 +162,7 @@ void SetUpCommandLine(base::CommandLine* command_line) override { base::CreateTemporaryFile(&temp_file_path_); auto* startup_config = tracing::TraceStartupConfig::GetInstance(); - startup_config->is_enabled_from_background_tracing_ = true; + startup_config->enable_background_tracing_for_testing_ = true; startup_config->EnableFromBackgroundTracing(); startup_config->startup_duration_ = 3; tracing::EnableStartupTracingIfNeeded();
diff --git a/content/browser/web_contents/web_contents_android.cc b/content/browser/web_contents/web_contents_android.cc index 7d469fd..a681496 100644 --- a/content/browser/web_contents/web_contents_android.cc +++ b/content/browser/web_contents/web_contents_android.cc
@@ -35,13 +35,13 @@ #include "content/common/frame_messages.h" #include "content/common/input_messages.h" #include "content/common/view_messages.h" +#include "content/public/android/content_jni_headers/WebContentsImpl_jni.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/message_port_provider.h" #include "content/public/browser/render_widget_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" -#include "jni/WebContentsImpl_jni.h" #include "net/android/network_library.h" #include "ui/accessibility/ax_assistant_structure.h" #include "ui/accessibility/ax_node_data.h"
diff --git a/content/browser/web_contents/web_contents_view_android.cc b/content/browser/web_contents/web_contents_view_android.cc index 3d07268..fef8779 100644 --- a/content/browser/web_contents/web_contents_view_android.cc +++ b/content/browser/web_contents/web_contents_view_android.cc
@@ -21,11 +21,11 @@ #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_android.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/android/jar_jni/DragEvent_jni.h" #include "content/public/browser/android/synchronous_compositor.h" #include "content/public/browser/render_widget_host.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/common/drop_data.h" -#include "jni/DragEvent_jni.h" #include "ui/android/overscroll_refresh_handler.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/clipboard_constants.h"
diff --git a/content/browser/worker_host/shared_worker_host.cc b/content/browser/worker_host/shared_worker_host.cc index 277f89f..fb46218 100644 --- a/content/browser/worker_host/shared_worker_host.cc +++ b/content/browser/worker_host/shared_worker_host.cc
@@ -116,7 +116,6 @@ instance_(std::move(instance)), process_id_(process_id), next_connection_request_id_(1), - creation_time_(base::TimeTicks::Now()), interface_provider_binding_(this), weak_factory_(this) { DCHECK(instance_); @@ -133,8 +132,6 @@ } SharedWorkerHost::~SharedWorkerHost() { - UMA_HISTOGRAM_LONG_TIMES("SharedWorker.TimeToDeleted", - base::TimeTicks::Now() - creation_time_); switch (phase_) { case Phase::kInitial: // Tell clients that this worker failed to start. This is only needed in @@ -477,14 +474,7 @@ devtools_handle_->WorkerReadyForInspection(); } -void SharedWorkerHost::OnScriptLoaded() { - UMA_HISTOGRAM_TIMES("SharedWorker.TimeToScriptLoaded", - base::TimeTicks::Now() - creation_time_); -} - void SharedWorkerHost::OnScriptLoadFailed() { - UMA_HISTOGRAM_TIMES("SharedWorker.TimeToScriptLoadFailed", - base::TimeTicks::Now() - creation_time_); for (const ClientInfo& info : clients_) info.client->OnScriptLoadFailed(); }
diff --git a/content/browser/worker_host/shared_worker_host.h b/content/browser/worker_host/shared_worker_host.h index 888d83a..66869a6 100644 --- a/content/browser/worker_host/shared_worker_host.h +++ b/content/browser/worker_host/shared_worker_host.h
@@ -14,7 +14,6 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/strings/string16.h" -#include "base/time/time.h" #include "base/unguessable_token.h" #include "content/common/content_export.h" #include "content/public/browser/global_routing_id.h" @@ -165,7 +164,6 @@ void OnConnected(int connection_request_id) override; void OnContextClosed() override; void OnReadyForInspection() override; - void OnScriptLoaded() override; void OnScriptLoadFailed() override; void OnFeatureUsed(blink::mojom::WebFeature feature) override; @@ -197,7 +195,6 @@ const int process_id_; int next_connection_request_id_; - const base::TimeTicks creation_time_; std::unique_ptr<ScopedDevToolsHandle> devtools_handle_; // This is the set of features that this worker has used.
diff --git a/content/browser/worker_host/shared_worker_host_unittest.cc b/content/browser/worker_host/shared_worker_host_unittest.cc index 12052810..4b8cd49 100644 --- a/content/browser/worker_host/shared_worker_host_unittest.cc +++ b/content/browser/worker_host/shared_worker_host_unittest.cc
@@ -188,7 +188,6 @@ EXPECT_TRUE(client.CheckReceivedOnCreated()); // Simulate events the shared worker would send. worker_host->OnReadyForInspection(); - worker_host->OnScriptLoaded(); worker_host->OnConnected(connection_request_id); base::RunLoop().RunUntilIdle();
diff --git a/content/browser/worker_host/shared_worker_service_impl_unittest.cc b/content/browser/worker_host/shared_worker_service_impl_unittest.cc index 39b5705..0165b53 100644 --- a/content/browser/worker_host/shared_worker_service_impl_unittest.cc +++ b/content/browser/worker_host/shared_worker_service_impl_unittest.cc
@@ -239,7 +239,6 @@ // Simulate events the shared worker would send. worker_host->OnReadyForInspection(); - worker_host->OnScriptLoaded(); worker_host->OnConnected(connection_request_id); base::RunLoop().RunUntilIdle(); @@ -318,7 +317,6 @@ // Simulate events the shared worker would send. worker_host->OnReadyForInspection(); - worker_host->OnScriptLoaded(); worker_host->OnConnected(connection_request_id0); base::RunLoop().RunUntilIdle();
diff --git a/content/common/android/hash_set.cc b/content/common/android/hash_set.cc index 4e6839b..aa310b7 100644 --- a/content/common/android/hash_set.cc +++ b/content/common/android/hash_set.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "jni/HashSet_jni.h" +#include "content/public/android/jar_jni/HashSet_jni.h" namespace content {
diff --git a/content/common/android/surface_wrapper.cc b/content/common/android/surface_wrapper.cc index b7704b7..a9e9ecae 100644 --- a/content/common/android/surface_wrapper.cc +++ b/content/common/android/surface_wrapper.cc
@@ -4,7 +4,7 @@ #include "content/common/android/surface_wrapper.h" -#include "jni/SurfaceWrapper_jni.h" +#include "content/public/android/content_jni_headers/SurfaceWrapper_jni.h" namespace content {
diff --git a/content/common/android/use_zoom_for_dsf_policy_android.cc b/content/common/android/use_zoom_for_dsf_policy_android.cc index 6f9de9e..cf8db6f 100644 --- a/content/common/android/use_zoom_for_dsf_policy_android.cc +++ b/content/common/android/use_zoom_for_dsf_policy_android.cc
@@ -5,8 +5,8 @@ #include <jni.h> #include "base/android/scoped_java_ref.h" +#include "content/public/android/content_jni_headers/UseZoomForDSFPolicy_jni.h" #include "content/public/common/use_zoom_for_dsf_policy.h" -#include "jni/UseZoomForDSFPolicy_jni.h" using base::android::JavaParamRef;
diff --git a/content/common/service_manager/service_manager_connection_impl.cc b/content/common/service_manager/service_manager_connection_impl.cc index 6424062..7f4de78c 100644 --- a/content/common/service_manager/service_manager_connection_impl.cc +++ b/content/common/service_manager/service_manager_connection_impl.cc
@@ -29,7 +29,7 @@ #if defined(OS_ANDROID) #include "base/android/jni_android.h" -#include "jni/ServiceManagerConnectionImpl_jni.h" +#include "content/public/android/content_jni_headers/ServiceManagerConnectionImpl_jni.h" #include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/mojom/connector.mojom.h" #endif
diff --git a/content/public/DEPS b/content/public/DEPS index fdad1028..63b613bb 100644 --- a/content/public/DEPS +++ b/content/public/DEPS
@@ -10,4 +10,5 @@ # available to code in content/public. "+content/common/content_export.h", "+content/public/common", + "+content/public/android/content_jni_headers", ]
diff --git a/content/public/android/BUILD.gn b/content/public/android/BUILD.gn index 99c6583..5b4d304 100644 --- a/content/public/android/BUILD.gn +++ b/content/public/android/BUILD.gn
@@ -376,7 +376,6 @@ } generate_jar_jni("jar_jni") { - jni_package = "content" classes = [ "java/util/HashSet.class", "android/view/DragEvent.class", @@ -435,7 +434,6 @@ "java/src/org/chromium/content_public/common/ResourceRequestBody.java", "java/src/org/chromium/content_public/common/UseZoomForDSFPolicy.java", ] - jni_package = "content" } group("jni") {
diff --git a/content/public/browser/render_widget_host_observer.h b/content/public/browser/render_widget_host_observer.h index 88778577..e1609ff 100644 --- a/content/public/browser/render_widget_host_observer.h +++ b/content/public/browser/render_widget_host_observer.h
@@ -5,6 +5,7 @@ #ifndef CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_OBSERVER_H_ #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_OBSERVER_H_ +#include "base/observer_list_types.h" #include "content/common/content_export.h" namespace content { @@ -13,7 +14,7 @@ // An observer API implemented by classes which are interested // in RenderWidgetHost events. -class CONTENT_EXPORT RenderWidgetHostObserver { +class CONTENT_EXPORT RenderWidgetHostObserver : public base::CheckedObserver { public: // This method is invoked when the visibility of the RenderWidgetHost changes. virtual void RenderWidgetHostVisibilityChanged(RenderWidgetHost* widget_host, @@ -25,7 +26,7 @@ virtual void RenderWidgetHostDestroyed(RenderWidgetHost* widget_host) {} protected: - virtual ~RenderWidgetHostObserver() {} + ~RenderWidgetHostObserver() override = default; }; } // namespace content
diff --git a/content/public/common/resource_request_body_android.cc b/content/public/common/resource_request_body_android.cc index 9e2c72a..9d6a27a 100644 --- a/content/public/common/resource_request_body_android.cc +++ b/content/public/common/resource_request_body_android.cc
@@ -12,7 +12,7 @@ #include "base/android/scoped_java_ref.h" #include "base/memory/ref_counted.h" #include "content/common/page_state_serialization.h" -#include "jni/ResourceRequestBody_jni.h" +#include "content/public/android/content_jni_headers/ResourceRequestBody_jni.h" #include "services/network/public/cpp/resource_request_body.h" using base::android::JavaParamRef;
diff --git a/content/public/test/android/BUILD.gn b/content/public/test/android/BUILD.gn index f29bdac..c79beb90 100644 --- a/content/public/test/android/BUILD.gn +++ b/content/public/test/android/BUILD.gn
@@ -2,7 +2,6 @@ import("//build/config/android/rules.gni") generate_jni("test_support_content_jni_headers") { - jni_package = "content/public/test" sources = [ "javatests/src/org/chromium/content_public/browser/test/NestedSystemMessageHandler.java", ] @@ -63,7 +62,6 @@ generate_jni("content_test_jni") { testonly = true - jni_package = "content/public/test" sources = [ "javatests/src/org/chromium/content_public/browser/test/InterstitialPageDelegateAndroid.java", "javatests/src/org/chromium/content_public/browser/test/RenderFrameHostTestExt.java",
diff --git a/content/public/test/android/dom_utils.cc b/content/public/test/android/dom_utils.cc index 002b05b1..ae6282ac 100644 --- a/content/public/test/android/dom_utils.cc +++ b/content/public/test/android/dom_utils.cc
@@ -6,7 +6,7 @@ #include "base/android/scoped_java_ref.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_delegate.h" -#include "jni/DOMUtils_jni.h" +#include "content/public/test/android/content_test_jni/DOMUtils_jni.h" #include "ui/android/view_android.h" using base::android::JavaParamRef;
diff --git a/content/public/test/android/interstitial_page_delegate_android.cc b/content/public/test/android/interstitial_page_delegate_android.cc index d59c07d..058757b 100644 --- a/content/public/test/android/interstitial_page_delegate_android.cc +++ b/content/public/test/android/interstitial_page_delegate_android.cc
@@ -9,7 +9,7 @@ #include "base/android/scoped_java_ref.h" #include "content/public/browser/interstitial_page.h" #include "content/public/browser/web_contents.h" -#include "jni/InterstitialPageDelegateAndroid_jni.h" +#include "content/public/test/android/content_test_jni/InterstitialPageDelegateAndroid_jni.h" using base::android::AttachCurrentThread; using base::android::JavaParamRef;
diff --git a/content/public/test/android/render_frame_host_test_ext.cc b/content/public/test/android/render_frame_host_test_ext.cc index 02c1a75..000d42f 100644 --- a/content/public/test/android/render_frame_host_test_ext.cc +++ b/content/public/test/android/render_frame_host_test_ext.cc
@@ -11,7 +11,7 @@ #include "content/browser/frame_host/render_frame_host_android.h" #include "content/browser/frame_host/render_frame_host_impl.h" #include "content/public/browser/web_contents.h" -#include "jni/RenderFrameHostTestExt_jni.h" +#include "content/public/test/android/content_test_jni/RenderFrameHostTestExt_jni.h" using base::android::JavaParamRef;
diff --git a/content/public/test/android/ui_thread_scheduler_test_utils.cc b/content/public/test/android/ui_thread_scheduler_test_utils.cc index fa022bd3..9a852bb1 100644 --- a/content/public/test/android/ui_thread_scheduler_test_utils.cc +++ b/content/public/test/android/ui_thread_scheduler_test_utils.cc
@@ -4,7 +4,7 @@ #include "base/android/jni_android.h" #include "content/browser/browser_main_loop.h" -#include "jni/UiThreadSchedulerTestUtils_jni.h" +#include "content/public/test/android/content_test_jni/UiThreadSchedulerTestUtils_jni.h" namespace content {
diff --git a/content/public/test/android/web_contents_utils.cc b/content/public/test/android/web_contents_utils.cc index 4d3b81d..5803fd0 100644 --- a/content/public/test/android/web_contents_utils.cc +++ b/content/public/test/android/web_contents_utils.cc
@@ -11,7 +11,7 @@ #include "content/public/browser/render_frame_metadata_provider.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" -#include "jni/WebContentsUtils_jni.h" +#include "content/public/test/android/content_test_jni/WebContentsUtils_jni.h" using base::android::ConvertJavaStringToUTF16; using base::android::JavaParamRef;
diff --git a/content/public/test/nested_message_pump_android.cc b/content/public/test/nested_message_pump_android.cc index 412b9e3..12e54af 100644 --- a/content/public/test/nested_message_pump_android.cc +++ b/content/public/test/nested_message_pump_android.cc
@@ -11,7 +11,7 @@ #include "base/synchronization/waitable_event.h" #include "base/threading/thread_restrictions.h" #include "base/time/time.h" -#include "jni/NestedSystemMessageHandler_jni.h" +#include "content/public/test/android/test_support_content_jni_headers/NestedSystemMessageHandler_jni.h" namespace {
diff --git a/content/renderer/input/render_widget_input_handler.cc b/content/renderer/input/render_widget_input_handler.cc index 397dc1a..2281020 100644 --- a/content/renderer/input/render_widget_input_handler.cc +++ b/content/renderer/input/render_widget_input_handler.cc
@@ -443,8 +443,8 @@ // do this here so that we can attribute lateny information from the mouse as // a scroll interaction, instead of just classifying as mouse input. if (injected_scroll_params && injected_scroll_params->size()) { - HandleInjectedScrollGestures(*injected_scroll_params, input_event, - latency_info); + HandleInjectedScrollGestures(std::move(*injected_scroll_params), + input_event, latency_info); } // Send gesture scroll events and their dispositions to the compositor thread, @@ -497,6 +497,12 @@ delegate_->FocusChangeComplete(); } #endif + + // Ensure all injected scrolls were handled or queue up - any remaining + // injected scrolls at this point would not be processed. + DCHECK(!handling_injected_scroll_params_ || + !*handling_injected_scroll_params_ || + (*handling_injected_scroll_params_)->empty()); } void RenderWidgetInputHandler::DidOverscrollFromBlink(
diff --git a/content/renderer/media/stream/media_stream_constraints_util_audio.cc b/content/renderer/media/stream/media_stream_constraints_util_audio.cc index eb37d51..6f5dec7a 100644 --- a/content/renderer/media/stream/media_stream_constraints_util_audio.cc +++ b/content/renderer/media/stream/media_stream_constraints_util_audio.cc
@@ -428,6 +428,18 @@ return EchoCancellationTypeSet(types); } + static bool ShouldUseExperimentalSystemEchoCanceller( + const media::AudioParameters& parameters) { +#if defined(OS_MACOSX) || defined(OS_CHROMEOS) + if (base::FeatureList::IsEnabled(features::kForceEnableSystemAec) && + (parameters.effects() & + media::AudioParameters::EXPERIMENTAL_ECHO_CANCELLER)) { + return true; + } +#endif // defined(OS_MACOSX) || defined(OS_CHROMEOS) + return false; + } + EchoCancellationType SelectBestEcMode( const ConstraintSet& constraint_set) const { DCHECK(!IsEmpty()); @@ -455,13 +467,23 @@ if (device_parameters_.IsValid() && ec_mode_allowed_values_.Contains( EchoCancellationType::kEchoCancellationSystem) && - device_parameters_.effects() & media::AudioParameters::ECHO_CANCELLER) { + (device_parameters_.effects() & + media::AudioParameters::ECHO_CANCELLER || + ShouldUseExperimentalSystemEchoCanceller(device_parameters_))) { return EchoCancellationType::kEchoCancellationSystem; } + // At this point we have at least two elements, hence the only two options + // from which to select are either AEC3 or System, where AEC3 has higher + // priority. + if (ec_mode_allowed_values_.Contains( + EchoCancellationType::kEchoCancellationAec3)) { + return EchoCancellationType::kEchoCancellationAec3; + } + DCHECK(ec_mode_allowed_values_.Contains( - EchoCancellationType::kEchoCancellationAec3)); - return EchoCancellationType::kEchoCancellationAec3; + EchoCancellationType::kEchoCancellationDisabled)); + return EchoCancellationType::kEchoCancellationDisabled; } // This function computes the fitness score of the given |ec_mode|. The
diff --git a/content/renderer/worker/embedded_shared_worker_stub.cc b/content/renderer/worker/embedded_shared_worker_stub.cc index 0ced414..afa9ebc 100644 --- a/content/renderer/worker/embedded_shared_worker_stub.cc +++ b/content/renderer/worker/embedded_shared_worker_stub.cc
@@ -141,10 +141,6 @@ host_->OnReadyForInspection(); } -void EmbeddedSharedWorkerStub::WorkerScriptLoaded() { - host_->OnScriptLoaded(); -} - void EmbeddedSharedWorkerStub::WorkerScriptLoadFailed() { host_->OnScriptLoadFailed(); pending_channels_.clear();
diff --git a/content/renderer/worker/embedded_shared_worker_stub.h b/content/renderer/worker/embedded_shared_worker_stub.h index b1ec0a9..be3f460 100644 --- a/content/renderer/worker/embedded_shared_worker_stub.h +++ b/content/renderer/worker/embedded_shared_worker_stub.h
@@ -78,7 +78,6 @@ void WorkerContextClosed() override; void WorkerContextDestroyed() override; void WorkerReadyForInspection() override; - void WorkerScriptLoaded() override; void WorkerScriptLoadFailed() override; void WorkerScriptEvaluated(bool success) override; std::unique_ptr<blink::WebServiceWorkerNetworkProvider>
diff --git a/content/shell/android/BUILD.gn b/content/shell/android/BUILD.gn index 7f8e1b4..c120bb44 100644 --- a/content/shell/android/BUILD.gn +++ b/content/shell/android/BUILD.gn
@@ -11,7 +11,6 @@ "$target_gen_dir/content_shell_manifest/AndroidManifest.xml" generate_jni("content_shell_jni_headers") { - jni_package = "content/shell" sources = [ "java/src/org/chromium/content_shell/Shell.java", "java/src/org/chromium/content_shell/ShellManager.java", @@ -323,7 +322,6 @@ generate_jni("linker_test_jni_headers") { testonly = true - jni_package = "content/shell" sources = [ "linker_test_apk/src/org/chromium/chromium_linker_test_apk/LinkerTests.java", ]
diff --git a/content/shell/android/linker_test_apk/chromium_linker_test_linker_tests.cc b/content/shell/android/linker_test_apk/chromium_linker_test_linker_tests.cc index 360e516..fa410e3 100644 --- a/content/shell/android/linker_test_apk/chromium_linker_test_linker_tests.cc +++ b/content/shell/android/linker_test_apk/chromium_linker_test_linker_tests.cc
@@ -18,7 +18,7 @@ #include "base/debug/proc_maps_linux.h" #include "base/logging.h" #include "base/strings/stringprintf.h" -#include "jni/LinkerTests_jni.h" +#include "content/shell/android/linker_test_jni_headers/LinkerTests_jni.h" #include "third_party/re2/src/re2/re2.h" using base::android::JavaParamRef;
diff --git a/content/shell/android/shell_manager.cc b/content/shell/android/shell_manager.cc index d58e9a70..2c6fd9674 100644 --- a/content/shell/android/shell_manager.cc +++ b/content/shell/android/shell_manager.cc
@@ -10,10 +10,10 @@ #include "base/bind.h" #include "base/lazy_instance.h" #include "content/public/browser/web_contents.h" +#include "content/shell/android/content_shell_jni_headers/ShellManager_jni.h" #include "content/shell/browser/shell.h" #include "content/shell/browser/shell_browser_context.h" #include "content/shell/browser/shell_content_browser_client.h" -#include "jni/ShellManager_jni.h" #include "url/gurl.h" using base::android::JavaParamRef;
diff --git a/content/shell/browser/shell_android.cc b/content/shell/browser/shell_android.cc index 0c1834c..3d24dd2b 100644 --- a/content/shell/browser/shell_android.cc +++ b/content/shell/browser/shell_android.cc
@@ -13,8 +13,8 @@ #include "base/strings/string_piece.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" +#include "content/shell/android/content_shell_jni_headers/Shell_jni.h" #include "content/shell/android/shell_manager.h" -#include "jni/Shell_jni.h" using base::android::AttachCurrentThread; using base::android::ConvertUTF8ToJavaString;
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 849804f7..4b4f70a 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -1722,6 +1722,7 @@ "../browser/scheduler/browser_task_queues_unittest.cc", "../browser/scheduler/browser_ui_thread_scheduler_unittest.cc", "../browser/scheduler/responsiveness/calculator_unittest.cc", + "../browser/scheduler/responsiveness/metric_source_unittest.cc", "../browser/scheduler/responsiveness/watcher_unittest.cc", "../browser/screen_orientation/screen_orientation_provider_unittest.cc", "../browser/screenlock_monitor/screenlock_monitor_unittest.cc",
diff --git a/google_apis/gaia/oauth2_access_token_manager.cc b/google_apis/gaia/oauth2_access_token_manager.cc index bc859134..1d1a974 100644 --- a/google_apis/gaia/oauth2_access_token_manager.cc +++ b/google_apis/gaia/oauth2_access_token_manager.cc
@@ -117,6 +117,23 @@ } } +void OAuth2AccessTokenManager::CancelAllRequests() { + std::vector<OAuth2TokenService::Fetcher*> fetchers_to_cancel; + for (const auto& pending_fetcher : token_service_->pending_fetchers_) + fetchers_to_cancel.push_back(pending_fetcher.second.get()); + token_service_->CancelFetchers(fetchers_to_cancel); +} + +void OAuth2AccessTokenManager::CancelRequestsForAccount( + const CoreAccountId& account_id) { + std::vector<OAuth2TokenService::Fetcher*> fetchers_to_cancel; + for (const auto& pending_fetcher : token_service_->pending_fetchers_) { + if (pending_fetcher.first.account_id == account_id) + fetchers_to_cancel.push_back(pending_fetcher.second.get()); + } + token_service_->CancelFetchers(fetchers_to_cancel); +} + std::unique_ptr<OAuth2TokenService::Request> OAuth2AccessTokenManager::StartRequestForClientWithContext( const CoreAccountId& account_id, @@ -186,7 +203,7 @@ const OAuth2TokenService::RequestParameters& request_parameters, const std::string& token_to_remove) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - OAuth2TokenService::OAuth2TokenService::TokenCache::iterator token_iterator = + OAuth2TokenService::TokenCache::iterator token_iterator = token_cache_.find(request_parameters); if (token_iterator != token_cache_.end() && token_iterator->second.access_token == token_to_remove) {
diff --git a/google_apis/gaia/oauth2_access_token_manager.h b/google_apis/gaia/oauth2_access_token_manager.h index e3a6ba4..dd286c81 100644 --- a/google_apis/gaia/oauth2_access_token_manager.h +++ b/google_apis/gaia/oauth2_access_token_manager.h
@@ -80,6 +80,12 @@ // used to request the tokens. void ClearCacheForAccount(const CoreAccountId& account_id); + // Cancels all requests that are currently in progress. + void CancelAllRequests(); + + // Cancels all requests related to a given |account_id|. + void CancelRequestsForAccount(const CoreAccountId& account_id); + private: // TODO(https://crbug.com/967598): Remove this once |token_cache_| management // is moved to OAuth2AccessTokenManager.
diff --git a/google_apis/gaia/oauth2_token_service.cc b/google_apis/gaia/oauth2_token_service.cc index 064b321..2fa7dee 100644 --- a/google_apis/gaia/oauth2_token_service.cc +++ b/google_apis/gaia/oauth2_token_service.cc
@@ -430,15 +430,6 @@ delegate_->RemoveObserver(observer); } -void OAuth2TokenService::AddDiagnosticsObserver(DiagnosticsObserver* observer) { - diagnostics_observer_list_.AddObserver(observer); -} - -void OAuth2TokenService::RemoveDiagnosticsObserver( - DiagnosticsObserver* observer) { - diagnostics_observer_list_.RemoveObserver(observer); -} - void OAuth2TokenService::AddAccessTokenDiagnosticsObserver( AccessTokenDiagnosticsObserver* observer) { token_manager_->AddDiagnosticsObserver(observer); @@ -706,20 +697,12 @@ } void OAuth2TokenService::CancelAllRequests() { - std::vector<Fetcher*> fetchers_to_cancel; - for (const auto& pending_fetcher : pending_fetchers_) - fetchers_to_cancel.push_back(pending_fetcher.second.get()); - CancelFetchers(fetchers_to_cancel); + token_manager_->CancelAllRequests(); } void OAuth2TokenService::CancelRequestsForAccount( const CoreAccountId& account_id) { - std::vector<Fetcher*> fetchers_to_cancel; - for (const auto& pending_fetcher : pending_fetchers_) { - if (pending_fetcher.first.account_id == account_id) - fetchers_to_cancel.push_back(pending_fetcher.second.get()); - } - CancelFetchers(fetchers_to_cancel); + token_manager_->CancelRequestsForAccount(account_id); } void OAuth2TokenService::CancelFetchers(
diff --git a/google_apis/gaia/oauth2_token_service.h b/google_apis/gaia/oauth2_token_service.h index 2e36280..254e76f 100644 --- a/google_apis/gaia/oauth2_token_service.h +++ b/google_apis/gaia/oauth2_token_service.h
@@ -93,25 +93,6 @@ std::string id_; }; - // Classes that want to monitor status of refresh token and refresh token - // request should implement this interface and register with the - // AddDiagnosticsObserver() call. - class DiagnosticsObserver { - public: - // Caled when a new refresh token is available. Contains diagnostic - // information about the source of the update credentials operation. - virtual void OnRefreshTokenAvailableFromSource( - const CoreAccountId& account_id, - bool is_refresh_token_valid, - const std::string& source) {} - - // Called when a refreh token is revoked. Contains diagnostic information - // about the source that initiated the revokation operation. - virtual void OnRefreshTokenRevokedFromSource( - const CoreAccountId& account_id, - const std::string& source) {} - }; - // The parameters used to fetch an OAuth2 access token. struct RequestParameters { RequestParameters(const std::string& client_id, @@ -139,10 +120,6 @@ void AddObserver(OAuth2TokenServiceObserver* observer); void RemoveObserver(OAuth2TokenServiceObserver* observer); - // Add or remove observers of this token service. - void AddDiagnosticsObserver(DiagnosticsObserver* observer); - void RemoveDiagnosticsObserver(DiagnosticsObserver* observer); - // TODO(https://crbug.com/967598): Remove these APIs once we can use // OAuth2AccessTokenManager without OAuth2TokenService. // Add or remove observers of access token manager. @@ -255,11 +232,6 @@ // OAuth2TokenServiceTest. OAuth2TokenService::TokenCache& token_cache(); - const base::ObserverList<DiagnosticsObserver, true>::Unchecked& - GetDiagnosticsObservers() { - return diagnostics_observer_list_; - } - const base::ObserverList<AccessTokenDiagnosticsObserver, true>::Unchecked& GetAccessTokenDiagnosticsObservers(); @@ -322,10 +294,12 @@ // Cancels all requests that are currently in progress. Virtual so it can be // overridden for tests. + // Deprecated. It's moved to OAuth2AccessTokenManager. virtual void CancelAllRequests(); // Cancels all requests related to a given |account_id|. Virtual so it can be // overridden for tests. + // Deprecated. It's moved to OAuth2AccessTokenManager. virtual void CancelRequestsForAccount(const CoreAccountId& account_id); // Fetches an OAuth token for the specified client/scopes. Virtual so it can @@ -380,10 +354,6 @@ // token using these parameters. std::map<RequestParameters, std::unique_ptr<Fetcher>> pending_fetchers_; - // List of observers to notify when access token status changes. - base::ObserverList<DiagnosticsObserver, true>::Unchecked - diagnostics_observer_list_; - // The depth of batch changes. int batch_change_depth_;
diff --git a/ios/chrome/browser/metrics/BUILD.gn b/ios/chrome/browser/metrics/BUILD.gn index 75424c4c1..99babea 100644 --- a/ios/chrome/browser/metrics/BUILD.gn +++ b/ios/chrome/browser/metrics/BUILD.gn
@@ -154,6 +154,7 @@ "//ios/chrome/browser/ui/util", "//ios/chrome/browser/web_state_list", "//ios/web", + "//services/metrics/public/cpp:ukm_builders", "//ui/base", "//url", ]
diff --git a/ios/chrome/browser/metrics/tab_usage_recorder.mm b/ios/chrome/browser/metrics/tab_usage_recorder.mm index acc34dc..fbbdaee 100644 --- a/ios/chrome/browser/metrics/tab_usage_recorder.mm +++ b/ios/chrome/browser/metrics/tab_usage_recorder.mm
@@ -9,12 +9,14 @@ #include "base/metrics/histogram_macros.h" #include "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/browser/metrics/previous_session_info.h" +#include "ios/chrome/browser/metrics/ukm_url_recorder.h" #import "ios/chrome/browser/prerender/prerender_service.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" #import "ios/web/public/navigation_item.h" #import "ios/web/public/navigation_manager.h" #import "ios/web/public/web_state/navigation_context.h" #import "ios/web/public/web_state/web_state.h" +#include "services/metrics/public/cpp/ukm_builders.h" #include "ui/base/page_transition_types.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -326,6 +328,17 @@ live_web_states_count + termination_timestamps_.size(); UMA_HISTOGRAM_COUNTS_100(kRendererTerminationRecentlyAliveRenderers, recently_live_web_states_count); + + ukm::SourceId source_id = + ukm::GetSourceIdForWebStateDocument(terminated_web_state); + if (source_id != ukm::kInvalidSourceId) { + ukm::builders::IOS_RendererGone(source_id) + .SetInForeground(web_state_state) + .SetSawMemoryWarning(saw_memory_warning) + .SetAliveRendererCount(live_web_states_count) + .SetAliveRecentlyRendererCount(recently_live_web_states_count) + .Record(ukm::UkmRecorder::Get()); + } } void TabUsageRecorder::AppDidEnterBackground() {
diff --git a/ios/chrome/browser/open_in/open_in_tab_helper_unittest.mm b/ios/chrome/browser/open_in/open_in_tab_helper_unittest.mm index 632cfbd..5e0a7484 100644 --- a/ios/chrome/browser/open_in/open_in_tab_helper_unittest.mm +++ b/ios/chrome/browser/open_in/open_in_tab_helper_unittest.mm
@@ -56,13 +56,19 @@ @end namespace { + +// TODO(crbug.com/977314): Theses variables are only used in simulator until +// tests are fixed. +#if TARGET_IPHONE_SIMULATOR const char kContentDispositionWithFileName[] = "attachment; filename=\"suggested_filename.pdf\""; +const char kPdfContentType[] = "application/pdf"; +const char kInvalidFileNameUrl[] = "https://test.test/"; +#endif + +const char kValidFileNameUrl[] = "https://test.test/file_name.pdf"; const char kContentDispositionWithoutFileName[] = "attachment; parameter=parameter_value"; -const char kInvalidFileNameUrl[] = "https://test.test/"; -const char kValidFileNameUrl[] = "https://test.test/file_name.pdf"; -const char kPdfContentType[] = "application/pdf"; const char kHtmlContentType[] = "text/html"; } // namespace @@ -131,6 +137,8 @@ EXPECT_TRUE(delegate_.openInDestroyed); } +// TODO(crbug.com/977314): Tests fail on iOS devices. +#if TARGET_IPHONE_SIMULATOR // Tests that openIn is enabled for PDF documents and that it uses the file name // from the content desposition key in the response headers. TEST_F(OpenInTabHelperTest, OpenInForPDFWithFileNameFromContentDesposition) { @@ -142,7 +150,6 @@ EXPECT_EQ(url, delegate_.lastOpenedDocumentURL); EXPECT_NSEQ(@"suggested_filename.pdf", delegate_.lastSuggestedFileName); } - // Tests that openIn is enabled for PDF documents and that it uses the file name // from the URL if the content desposition key in the response headers doesn't // have file name. @@ -173,6 +180,7 @@ EXPECT_NSEQ(base::SysUTF8ToNSString(default_file_name), delegate_.lastSuggestedFileName); } +#endif // Tests that openIn is disabled for non PDF documents. TEST_F(OpenInTabHelperTest, OpenInDisabledForNonPDF) {
diff --git a/ios/chrome/browser/overlays/overlay_request_queue_impl.mm b/ios/chrome/browser/overlays/overlay_request_queue_impl.mm index b5cd770..6f13faf8 100644 --- a/ios/chrome/browser/overlays/overlay_request_queue_impl.mm +++ b/ios/chrome/browser/overlays/overlay_request_queue_impl.mm
@@ -121,5 +121,6 @@ void OverlayRequestQueueImpl::RequestCancellationHelper::WebStateDestroyed( web::WebState* web_state) { + queue_->CancelAllRequests(); web_state->RemoveObserver(this); }
diff --git a/ios/chrome/browser/passwords/password_controller.mm b/ios/chrome/browser/passwords/password_controller.mm index 91e00c4..e5d2ebd2 100644 --- a/ios/chrome/browser/passwords/password_controller.mm +++ b/ios/chrome/browser/passwords/password_controller.mm
@@ -106,7 +106,7 @@ SHOW_ALL = 1, // "Suggest Password" is listed. SUGGESTED = 2, - COUNT + COUNT = 3, }; // Password is considered not generated when user edits it below 4 characters.
diff --git a/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm b/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm index e216b3b..8b03098 100644 --- a/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm +++ b/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm
@@ -517,7 +517,7 @@ // Tap the search button. [[EarlGrey selectElementWithMatcher:grey_accessibilityID( - kToolbarOmniboxButtonIdentifier)] + kToolbarSearchButtonIdentifier)] performAction:grey_tap()]; // Check that the page is loaded. @@ -624,7 +624,7 @@ performAction:grey_swipeFastInDirection(kGREYDirectionUp)]; // Tap the search button. [[EarlGrey selectElementWithMatcher:grey_accessibilityID( - kToolbarOmniboxButtonIdentifier)] + kToolbarSearchButtonIdentifier)] performAction:grey_tap()]; [ChromeEarlGrey waitForSufficientlyVisibleElementWithMatcher:chrome_test_util::Omnibox()];
diff --git a/ios/chrome/browser/ui/overlays/overlay_presenter_ui_delegate_impl.mm b/ios/chrome/browser/ui/overlays/overlay_presenter_ui_delegate_impl.mm index db08334..c08e118 100644 --- a/ios/chrome/browser/ui/overlays/overlay_presenter_ui_delegate_impl.mm +++ b/ios/chrome/browser/ui/overlays/overlay_presenter_ui_delegate_impl.mm
@@ -115,11 +115,22 @@ // be deleted immediately. OverlayRequestUIState* state = GetRequestUIState(request); DCHECK(state); - if (!state->has_callback() || !coordinator_) { + if (!state->has_callback()) { states_.erase(request); return; } + // If the current request is being cancelled (e.g. for WebState closures) when + // there is no coordinator, simulate a dismissal and reset the current + // request. + if (!coordinator_) { + DCHECK_EQ(request_, request); + state->set_dismissal_reason(OverlayDismissalReason::kCancellation); + state->OverlayUIWasDismissed(); + SetRequest(nullptr); + return; + } + DismissPresentedUI(OverlayDismissalReason::kCancellation); }
diff --git a/ios/chrome/browser/ui/settings/BUILD.gn b/ios/chrome/browser/ui/settings/BUILD.gn index 37e8617..2f44bc7 100644 --- a/ios/chrome/browser/ui/settings/BUILD.gn +++ b/ios/chrome/browser/ui/settings/BUILD.gn
@@ -30,6 +30,7 @@ "//ios/chrome/browser/ui/table_view/cells", "//ios/chrome/browser/ui/util", "//ios/chrome/common/ui_util", + "//ios/chrome/common/ui_util:semantic_colors", "//ios/public/provider/chrome/browser", "//ios/public/provider/chrome/browser/user_feedback", "//ios/third_party/material_components_ios",
diff --git a/ios/chrome/browser/ui/settings/settings_root_table_view_controller.mm b/ios/chrome/browser/ui/settings/settings_root_table_view_controller.mm index 7766b1f..4535dfa 100644 --- a/ios/chrome/browser/ui/settings/settings_root_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_root_table_view_controller.mm
@@ -14,6 +14,7 @@ #import "ios/chrome/browser/ui/table_view/chrome_table_view_styler.h" #include "ios/chrome/browser/ui/ui_feature_flags.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h" +#import "ios/chrome/common/ui_util/UIColor+cr_semantic_colors.h" #include "ios/chrome/grit/ios_strings.h" #include "ui/base/l10n/l10n_util.h" @@ -122,7 +123,8 @@ if (base::FeatureList::IsEnabled(kSettingsRefresh)) { self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; } - self.styler.cellBackgroundColor = [UIColor whiteColor]; + self.styler.cellBackgroundColor = + UIColor.cr_secondarySystemGroupedBackgroundColor; self.styler.cellTitleColor = [UIColor blackColor]; self.tableView.estimatedSectionHeaderHeight = kEstimatedHeaderFooterHeight; self.tableView.estimatedRowHeight = kSettingsCellDefaultHeight;
diff --git a/ios/chrome/browser/ui/toolbar/adaptive_toolbar_coordinator.mm b/ios/chrome/browser/ui/toolbar/adaptive_toolbar_coordinator.mm index 0ef149a..5b38d434 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive_toolbar_coordinator.mm +++ b/ios/chrome/browser/ui/toolbar/adaptive_toolbar_coordinator.mm
@@ -10,6 +10,7 @@ #import "ios/chrome/browser/ui/ntp/ntp_util.h" #import "ios/chrome/browser/ui/toolbar/adaptive_toolbar_coordinator+subclassing.h" #import "ios/chrome/browser/ui/toolbar/adaptive_toolbar_view_controller.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_actions_handler.h" #import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h" #import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.h" #import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h" @@ -28,16 +29,12 @@ @property(nonatomic, assign) BOOL started; // Mediator for updating the toolbar when the WebState changes. @property(nonatomic, strong) ToolbarMediator* mediator; +// Actions handler for the toolbar buttons. +@property(nonatomic, strong) ToolbarButtonActionsHandler* actionHandler; @end @implementation AdaptiveToolbarCoordinator -@synthesize dispatcher = _dispatcher; -@synthesize longPressDelegate = _longPressDelegate; -@synthesize mediator = _mediator; -@synthesize started = _started; -@synthesize viewController = _viewController; -@synthesize webStateList = _webStateList; #pragma mark - ChromeCoordinator @@ -114,9 +111,12 @@ BOOL isIncognito = self.browserState->IsOffTheRecord(); ToolbarStyle style = isIncognito ? INCOGNITO : NORMAL; + self.actionHandler = [[ToolbarButtonActionsHandler alloc] init]; + self.actionHandler.dispatcher = self.dispatcher; + ToolbarButtonFactory* buttonFactory = [[ToolbarButtonFactory alloc] initWithStyle:style]; - buttonFactory.dispatcher = self.dispatcher; + buttonFactory.actionHandler = self.actionHandler; buttonFactory.visibilityConfiguration = [[ToolbarButtonVisibilityConfiguration alloc] initWithType:type];
diff --git a/ios/chrome/browser/ui/toolbar/adaptive_toolbar_egtest.mm b/ios/chrome/browser/ui/toolbar/adaptive_toolbar_egtest.mm index 17a877e..0c31012 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive_toolbar_egtest.mm +++ b/ios/chrome/browser/ui/toolbar/adaptive_toolbar_egtest.mm
@@ -113,7 +113,7 @@ // Returns a matcher for the search button. id<GREYMatcher> SearchButton() { - return grey_accessibilityID(kToolbarOmniboxButtonIdentifier); + return grey_accessibilityID(kToolbarSearchButtonIdentifier); } // Returns a matcher for the tab grid button. @@ -689,7 +689,7 @@ } [[EarlGrey selectElementWithMatcher:grey_accessibilityID( - kToolbarOmniboxButtonIdentifier)] + kToolbarSearchButtonIdentifier)] performAction:grey_tap()]; [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()] assertWithMatcher:firstResponder()];
diff --git a/ios/chrome/browser/ui/toolbar/adaptive_toolbar_view.h b/ios/chrome/browser/ui/toolbar/adaptive_toolbar_view.h index 0f9a5cd..1c20fc8 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive_toolbar_view.h +++ b/ios/chrome/browser/ui/toolbar/adaptive_toolbar_view.h
@@ -42,7 +42,7 @@ // Button to display the tools menu. @property(nonatomic, strong, readonly) ToolbarToolsMenuButton* toolsMenuButton; // Button to display the tools menu. -@property(nonatomic, strong, readonly) ToolbarButton* omniboxButton; +@property(nonatomic, strong, readonly) ToolbarButton* searchButton; // Separator between the toolbar and the content. @property(nonatomic, strong, readonly) UIView* separator;
diff --git a/ios/chrome/browser/ui/toolbar/adaptive_toolbar_view_controller.mm b/ios/chrome/browser/ui/toolbar/adaptive_toolbar_view_controller.mm index 1f35c17..5d0c932b 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive_toolbar_view_controller.mm +++ b/ios/chrome/browser/ui/toolbar/adaptive_toolbar_view_controller.mm
@@ -91,14 +91,14 @@ // Adds the layout guide to the buttons. self.view.toolsMenuButton.guideName = kToolsMenuGuide; self.view.tabGridButton.guideName = kTabSwitcherGuide; - self.view.omniboxButton.guideName = kSearchButtonGuide; + self.view.searchButton.guideName = kSearchButtonGuide; self.view.forwardButton.guideName = kForwardButtonGuide; self.view.backButton.guideName = kBackButtonGuide; // Add navigation popup menu triggers. [self addLongPressGestureToView:self.view.backButton]; [self addLongPressGestureToView:self.view.forwardButton]; - [self addLongPressGestureToView:self.view.omniboxButton]; + [self addLongPressGestureToView:self.view.searchButton]; [self addLongPressGestureToView:self.view.tabGridButton]; [self addLongPressGestureToView:self.view.toolsMenuButton]; @@ -217,7 +217,7 @@ } - (void)setSearchIcon:(UIImage*)searchIcon { - [self.view.omniboxButton setImage:searchIcon forState:UIControlStateNormal]; + [self.view.searchButton setImage:searchIcon forState:UIControlStateNormal]; } #pragma mark - NewTabPageControllerDelegate @@ -249,7 +249,7 @@ selectedButton = self.view.backButton; break; case PopupMenuTypeSearch: - selectedButton = self.view.omniboxButton; + selectedButton = self.view.searchButton; break; case PopupMenuTypeTabGrid: selectedButton = self.view.tabGridButton; @@ -272,7 +272,7 @@ - (void)updateUIForMenuDismissed { self.view.backButton.spotlighted = NO; self.view.forwardButton.spotlighted = NO; - self.view.omniboxButton.spotlighted = NO; + self.view.searchButton.spotlighted = NO; self.view.tabGridButton.spotlighted = NO; self.view.toolsMenuButton.spotlighted = NO; @@ -344,7 +344,7 @@ - (void)addStandardActionsForAllButtons { for (ToolbarButton* button in self.view.allButtons) { if (button != self.view.toolsMenuButton && - button != self.view.omniboxButton) { + button != self.view.searchButton) { [button addTarget:self.dispatcher action:@selector(cancelOmniboxEdit) forControlEvents:UIControlEventTouchUpInside]; @@ -376,7 +376,7 @@ base::RecordAction(base::UserMetricsAction("MobileToolbarShowStackView")); } else if (sender == self.view.shareButton) { base::RecordAction(base::UserMetricsAction("MobileToolbarShareMenu")); - } else if (sender == self.view.omniboxButton) { + } else if (sender == self.view.searchButton) { base::RecordAction(base::UserMetricsAction("MobileToolbarOmniboxShortcut")); } else { NOTREACHED(); @@ -400,7 +400,7 @@ [self.dispatcher showNavigationHistoryBackPopupMenu]; } else if (gesture.view == self.view.forwardButton) { [self.dispatcher showNavigationHistoryForwardPopupMenu]; - } else if (gesture.view == self.view.omniboxButton) { + } else if (gesture.view == self.view.searchButton) { [self.dispatcher showSearchButtonPopup]; } else if (gesture.view == self.view.tabGridButton) { [self.dispatcher showTabGridButtonPopup];
diff --git a/ios/chrome/browser/ui/toolbar/buttons/BUILD.gn b/ios/chrome/browser/ui/toolbar/buttons/BUILD.gn index 3883d92..7090b0e 100644 --- a/ios/chrome/browser/ui/toolbar/buttons/BUILD.gn +++ b/ios/chrome/browser/ui/toolbar/buttons/BUILD.gn
@@ -6,6 +6,8 @@ sources = [ "toolbar_button.h", "toolbar_button.mm", + "toolbar_button_actions_handler.h", + "toolbar_button_actions_handler.mm", "toolbar_button_factory.h", "toolbar_button_factory.mm", "toolbar_button_visibility_configuration.h",
diff --git a/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_actions_handler.h b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_actions_handler.h new file mode 100644 index 0000000..a201ceb --- /dev/null +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_actions_handler.h
@@ -0,0 +1,57 @@ +// 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. + +#ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_BUTTON_ACTIONS_HANDLER_H_ +#define IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_BUTTON_ACTIONS_HANDLER_H_ + +#import <Foundation/Foundation.h> + +@protocol ApplicationCommands; +@protocol BrowserCommands; +@protocol OmniboxFocuser; + +// Handler for the actions associated with the different toolbar buttons. +@interface ToolbarButtonActionsHandler : NSObject + +// Dispatcher for the actions. +@property(nonatomic, weak) + id<ApplicationCommands, BrowserCommands, OmniboxFocuser> + dispatcher; + +// Action when the back button is tapped. +- (void)backAction; + +// Action when the forward button is tapped. +- (void)forwardAction; + +// Action when there is a touch down on the tab grid button. +- (void)tabGridTouchDown; + +// Action when there is a touch up on the tab grid button. +- (void)tabGridTouchUp; + +// Action when the tools menu button is tapped. +- (void)toolsMenuAction; + +// Action when the share button is tapped. +- (void)shareAction; + +// Action when the reload button is tapped. +- (void)reloadAction; + +// Action when the stop button is tapped. +- (void)stopAction; + +// Action when the bookmark button is tapped. +- (void)bookmarkAction; + +// Action when the search button is tapped. +- (void)searchAction; + +// Action when the button to cancel the omnibox focus is tapped. +- (void)cancelOmniboxFocusAction; + +@end + +#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_BUTTON_ACTIONS_HANDLER_H_
diff --git a/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_actions_handler.mm b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_actions_handler.mm new file mode 100644 index 0000000..3b38b97 --- /dev/null +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_actions_handler.mm
@@ -0,0 +1,62 @@ +// 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 "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_actions_handler.h" + +#import "ios/chrome/browser/ui/commands/application_commands.h" +#import "ios/chrome/browser/ui/commands/browser_commands.h" +#import "ios/chrome/browser/ui/toolbar/public/omnibox_focuser.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@implementation ToolbarButtonActionsHandler + +- (void)backAction { + [self.dispatcher goBack]; +} + +- (void)forwardAction { + [self.dispatcher goForward]; +} + +- (void)tabGridTouchDown { + [self.dispatcher prepareTabSwitcher]; +} + +- (void)tabGridTouchUp { + [self.dispatcher displayTabSwitcher]; +} + +- (void)toolsMenuAction { + [self.dispatcher showToolsMenuPopup]; +} + +- (void)shareAction { + [self.dispatcher sharePage]; +} + +- (void)reloadAction { + [self.dispatcher reload]; +} + +- (void)stopAction { + [self.dispatcher stopLoading]; +} + +- (void)bookmarkAction { + [self.dispatcher bookmarkPage]; +} + +- (void)searchAction { + [self.dispatcher closeFindInPage]; + [self.dispatcher focusOmniboxFromSearchButton]; +} + +- (void)cancelOmniboxFocusAction { + [self.dispatcher cancelOmniboxEdit]; +} + +@end
diff --git a/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h index e5148211..1958371d 100644 --- a/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h
@@ -9,10 +9,8 @@ #import "ios/chrome/browser/ui/toolbar/buttons/toolbar_style.h" -@protocol ApplicationCommands; -@protocol BrowserCommands; -@protocol OmniboxFocuser; @class ToolbarButton; +@class ToolbarButtonActionsHandler; @class ToolbarButtonVisibilityConfiguration; @class ToolbarTabGridButton; @class ToolbarToolsMenuButton; @@ -31,10 +29,8 @@ // of the buttons title. @property(nonatomic, strong, readonly) ToolbarConfiguration* toolbarConfiguration; -// Dispatcher used to initialize targets for the buttons. -@property(nonatomic, weak) - id<ApplicationCommands, BrowserCommands, OmniboxFocuser> - dispatcher; +// Handler for the actions. +@property(nonatomic, weak) ToolbarButtonActionsHandler* actionHandler; // Configuration object for the visibility of the buttons. @property(nonatomic, strong) ToolbarButtonVisibilityConfiguration* visibilityConfiguration; @@ -56,7 +52,7 @@ // Bookmark ToolbarButton. - (ToolbarButton*)bookmarkButton; // ToolbarButton to focus the omnibox. -- (ToolbarButton*)omniboxButton; +- (ToolbarButton*)searchButton; // Button to cancel the edit of the location bar. - (UIButton*)cancelButton;
diff --git a/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.mm b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.mm index 4443f4f..7c2b5d1 100644 --- a/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.mm +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.mm
@@ -5,15 +5,13 @@ #import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_factory.h" #include "components/strings/grit/components_strings.h" -#import "ios/chrome/browser/ui/commands/application_commands.h" -#import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button.h" +#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_actions_handler.h" #import "ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.h" #import "ios/chrome/browser/ui/toolbar/buttons/toolbar_configuration.h" #import "ios/chrome/browser/ui/toolbar/buttons/toolbar_search_button.h" #import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tab_grid_button.h" #import "ios/chrome/browser/ui/toolbar/buttons/toolbar_tools_menu_button.h" -#import "ios/chrome/browser/ui/toolbar/public/omnibox_focuser.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_constants.h" #import "ios/chrome/browser/ui/util/rtl_geometry.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h" @@ -30,11 +28,6 @@ @implementation ToolbarButtonFactory -@synthesize toolbarConfiguration = _toolbarConfiguration; -@synthesize style = _style; -@synthesize dispatcher = _dispatcher; -@synthesize visibilityConfiguration = _visibilityConfiguration; - - (instancetype)initWithStyle:(ToolbarStyle)style { self = [super init]; if (self) { @@ -52,8 +45,8 @@ imageFlippedForRightToLeftLayoutDirection]]; [self configureButton:backButton width:kAdaptiveToolbarButtonWidth]; backButton.accessibilityLabel = l10n_util::GetNSString(IDS_ACCNAME_BACK); - [backButton addTarget:self.dispatcher - action:@selector(goBack) + [backButton addTarget:self.actionHandler + action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside]; backButton.visibilityMask = self.visibilityConfiguration.backButtonVisibility; return backButton; @@ -69,8 +62,8 @@ self.visibilityConfiguration.forwardButtonVisibility; forwardButton.accessibilityLabel = l10n_util::GetNSString(IDS_ACCNAME_FORWARD); - [forwardButton addTarget:self.dispatcher - action:@selector(goForward) + [forwardButton addTarget:self.actionHandler + action:@selector(forwardAction) forControlEvents:UIControlEventTouchUpInside]; return forwardButton; } @@ -81,11 +74,11 @@ [self configureButton:tabGridButton width:kAdaptiveToolbarButtonWidth]; SetA11yLabelAndUiAutomationName(tabGridButton, IDS_IOS_TOOLBAR_SHOW_TABS, kToolbarStackButtonIdentifier); - [tabGridButton addTarget:self.dispatcher - action:@selector(prepareTabSwitcher) + [tabGridButton addTarget:self.actionHandler + action:@selector(tabGridTouchDown) forControlEvents:UIControlEventTouchDown]; - [tabGridButton addTarget:self.dispatcher - action:@selector(displayTabSwitcher) + [tabGridButton addTarget:self.actionHandler + action:@selector(tabGridTouchUp) forControlEvents:UIControlEventTouchUpInside]; tabGridButton.visibilityMask = self.visibilityConfiguration.tabGridButtonVisibility; @@ -102,8 +95,8 @@ [toolsMenuButton.heightAnchor constraintEqualToConstant:kAdaptiveToolbarButtonWidth] .active = YES; - [toolsMenuButton addTarget:self.dispatcher - action:@selector(showToolsMenuPopup) + [toolsMenuButton addTarget:self.actionHandler + action:@selector(toolsMenuAction) forControlEvents:UIControlEventTouchUpInside]; toolsMenuButton.visibilityMask = self.visibilityConfiguration.toolsMenuButtonVisibility; @@ -117,8 +110,8 @@ SetA11yLabelAndUiAutomationName(shareButton, IDS_IOS_TOOLS_MENU_SHARE, kToolbarShareButtonIdentifier); shareButton.titleLabel.text = @"Share"; - [shareButton addTarget:self.dispatcher - action:@selector(sharePage) + [shareButton addTarget:self.actionHandler + action:@selector(shareAction) forControlEvents:UIControlEventTouchUpInside]; shareButton.visibilityMask = self.visibilityConfiguration.shareButtonVisibility; @@ -132,8 +125,8 @@ [self configureButton:reloadButton width:kAdaptiveToolbarButtonWidth]; reloadButton.accessibilityLabel = l10n_util::GetNSString(IDS_IOS_ACCNAME_RELOAD); - [reloadButton addTarget:self.dispatcher - action:@selector(reload) + [reloadButton addTarget:self.actionHandler + action:@selector(reloadAction) forControlEvents:UIControlEventTouchUpInside]; reloadButton.visibilityMask = self.visibilityConfiguration.reloadButtonVisibility; @@ -145,8 +138,8 @@ toolbarButtonWithImage:[UIImage imageNamed:@"toolbar_stop"]]; [self configureButton:stopButton width:kAdaptiveToolbarButtonWidth]; stopButton.accessibilityLabel = l10n_util::GetNSString(IDS_IOS_ACCNAME_STOP); - [stopButton addTarget:self.dispatcher - action:@selector(stopLoading) + [stopButton addTarget:self.actionHandler + action:@selector(stopAction) forControlEvents:UIControlEventTouchUpInside]; stopButton.visibilityMask = self.visibilityConfiguration.stopButtonVisibility; return stopButton; @@ -163,8 +156,8 @@ setImage:[bookmarkButton imageForState:UIControlStateHighlighted] forState:UIControlStateSelected]; bookmarkButton.accessibilityLabel = l10n_util::GetNSString(IDS_TOOLTIP_STAR); - [bookmarkButton addTarget:self.dispatcher - action:@selector(bookmarkPage) + [bookmarkButton addTarget:self.actionHandler + action:@selector(bookmarkAction) forControlEvents:UIControlEventTouchUpInside]; bookmarkButton.visibilityMask = @@ -172,25 +165,22 @@ return bookmarkButton; } -- (ToolbarButton*)omniboxButton { - ToolbarSearchButton* omniboxButton = [ToolbarSearchButton +- (ToolbarButton*)searchButton { + ToolbarSearchButton* searchButton = [ToolbarSearchButton toolbarButtonWithImage:[UIImage imageNamed:@"toolbar_search"]]; - [self configureButton:omniboxButton width:kOmniboxButtonWidth]; - [omniboxButton addTarget:self.dispatcher - action:@selector(closeFindInPage) - forControlEvents:UIControlEventTouchUpInside]; - [omniboxButton addTarget:self.dispatcher - action:@selector(focusOmniboxFromSearchButton) - forControlEvents:UIControlEventTouchUpInside]; + [self configureButton:searchButton width:kSearchButtonWidth]; + [searchButton addTarget:self.actionHandler + action:@selector(searchAction) + forControlEvents:UIControlEventTouchUpInside]; - omniboxButton.accessibilityLabel = + searchButton.accessibilityLabel = l10n_util::GetNSString(IDS_IOS_TOOLBAR_SEARCH); - omniboxButton.accessibilityIdentifier = kToolbarOmniboxButtonIdentifier; + searchButton.accessibilityIdentifier = kToolbarSearchButtonIdentifier; - omniboxButton.visibilityMask = - self.visibilityConfiguration.omniboxButtonVisibility; - return omniboxButton; + searchButton.visibilityMask = + self.visibilityConfiguration.searchButtonVisibility; + return searchButton; } - (UIButton*)cancelButton { @@ -209,8 +199,8 @@ cancelButton.contentEdgeInsets = UIEdgeInsetsMake( 0, kCancelButtonHorizontalInset, 0, kCancelButtonHorizontalInset); cancelButton.hidden = YES; - [cancelButton addTarget:self.dispatcher - action:@selector(cancelOmniboxEdit) + [cancelButton addTarget:self.actionHandler + action:@selector(cancelOmniboxFocusAction) forControlEvents:UIControlEventTouchUpInside]; cancelButton.accessibilityIdentifier = kToolbarCancelOmniboxEditButtonIdentifier;
diff --git a/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.h b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.h index a2a8207c..e10edcc 100644 --- a/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.h +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.h
@@ -42,7 +42,7 @@ @property(nonatomic, readonly) ToolbarComponentVisibility contractButtonVisibility; @property(nonatomic, readonly) - ToolbarComponentVisibility omniboxButtonVisibility; + ToolbarComponentVisibility searchButtonVisibility; @property(nonatomic, readonly) ToolbarComponentVisibility locationBarLeadingButtonVisibility;
diff --git a/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.mm b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.mm index 4325d7f..6fd91093 100644 --- a/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.mm +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_button_visibility_configuration.mm
@@ -119,7 +119,7 @@ } } -- (ToolbarComponentVisibility)omniboxButtonVisibility { +- (ToolbarComponentVisibility)searchButtonVisibility { switch (self.type) { case PRIMARY: return ToolbarComponentVisibilityNone;
diff --git a/ios/chrome/browser/ui/toolbar/primary_toolbar_view.mm b/ios/chrome/browser/ui/toolbar/primary_toolbar_view.mm index d22304e..df771b57 100644 --- a/ios/chrome/browser/ui/toolbar/primary_toolbar_view.mm +++ b/ios/chrome/browser/ui/toolbar/primary_toolbar_view.mm
@@ -467,7 +467,7 @@ #pragma mark - AdaptiveToolbarView -- (ToolbarButton*)omniboxButton { +- (ToolbarButton*)searchButton { return nil; }
diff --git a/ios/chrome/browser/ui/toolbar/public/toolbar_constants.h b/ios/chrome/browser/ui/toolbar/public/toolbar_constants.h index fe74a88..ee608bd 100644 --- a/ios/chrome/browser/ui/toolbar/public/toolbar_constants.h +++ b/ios/chrome/browser/ui/toolbar/public/toolbar_constants.h
@@ -38,7 +38,7 @@ // Toolbar Buttons. extern const CGFloat kAdaptiveToolbarButtonHeight; extern const CGFloat kAdaptiveToolbarButtonWidth; -extern const CGFloat kOmniboxButtonWidth; +extern const CGFloat kSearchButtonWidth; extern const CGFloat kCancelButtonHorizontalInset; extern const CGFloat kToolbarDimmedButtonAlpha; @@ -90,7 +90,7 @@ // Accessibility identifier of the share button. extern NSString* const kToolbarShareButtonIdentifier; // Accessibility identifier of the omnibox button. -extern NSString* const kToolbarOmniboxButtonIdentifier; +extern NSString* const kToolbarSearchButtonIdentifier; // Accessibility identifier of the cancel omnibox edit button. extern NSString* const kToolbarCancelOmniboxEditButtonIdentifier;
diff --git a/ios/chrome/browser/ui/toolbar/public/toolbar_constants.mm b/ios/chrome/browser/ui/toolbar/public/toolbar_constants.mm index 67bdbe83..ed1fe51 100644 --- a/ios/chrome/browser/ui/toolbar/public/toolbar_constants.mm +++ b/ios/chrome/browser/ui/toolbar/public/toolbar_constants.mm
@@ -24,7 +24,7 @@ const CGFloat kAdaptiveToolbarButtonHeight = 44.0f; const CGFloat kAdaptiveToolbarButtonWidth = 44.0f; -const CGFloat kOmniboxButtonWidth = 70.0f; +const CGFloat kSearchButtonWidth = 70.0f; const CGFloat kCancelButtonHorizontalInset = 8; const CGFloat kToolbarDimmedButtonAlpha = 0.5; @@ -59,8 +59,8 @@ @"kToolbarStackButtonIdentifier"; NSString* const kToolbarShareButtonIdentifier = @"kToolbarShareButtonIdentifier"; -NSString* const kToolbarOmniboxButtonIdentifier = - @"kToolbarOmniboxButtonIdentifier"; +NSString* const kToolbarSearchButtonIdentifier = + @"kToolbarSearchButtonIdentifier"; NSString* const kToolbarCancelOmniboxEditButtonIdentifier = @"kToolbarCancelOmniboxEditButtonIdentifier";
diff --git a/ios/chrome/browser/ui/toolbar/secondary_toolbar_view.mm b/ios/chrome/browser/ui/toolbar/secondary_toolbar_view.mm index 3eb253c8..109fd74 100644 --- a/ios/chrome/browser/ui/toolbar/secondary_toolbar_view.mm +++ b/ios/chrome/browser/ui/toolbar/secondary_toolbar_view.mm
@@ -49,7 +49,7 @@ // Button to display the tab grid, redefined as readwrite. @property(nonatomic, strong, readwrite) ToolbarTabGridButton* tabGridButton; // Button to focus the omnibox, redefined as readwrite. -@property(nonatomic, strong, readwrite) ToolbarButton* omniboxButton; +@property(nonatomic, strong, readwrite) ToolbarButton* searchButton; @end @@ -61,7 +61,7 @@ @synthesize backButton = _backButton; @synthesize forwardButton = _forwardButton; @synthesize toolsMenuButton = _toolsMenuButton; -@synthesize omniboxButton = _omniboxButton; +@synthesize searchButton = _searchButton; @synthesize tabGridButton = _tabGridButton; @synthesize blur = _blur; @@ -133,7 +133,7 @@ self.backButton = [self.buttonFactory backButton]; self.forwardButton = [self.buttonFactory forwardButton]; - self.omniboxButton = [self.buttonFactory omniboxButton]; + self.searchButton = [self.buttonFactory searchButton]; self.tabGridButton = [self.buttonFactory tabGridButton]; self.toolsMenuButton = [self.buttonFactory toolsMenuButton]; @@ -144,7 +144,7 @@ CGAffineTransformMakeTranslation(textDirection * kToolsMenuOffset, 0); self.allButtons = @[ - self.backButton, self.forwardButton, self.omniboxButton, self.tabGridButton, + self.backButton, self.forwardButton, self.searchButton, self.tabGridButton, self.toolsMenuButton ];
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_mediator.h b/ios/chrome/browser/ui/toolbar/toolbar_mediator.h index d636e71..35dde8d 100644 --- a/ios/chrome/browser/ui/toolbar/toolbar_mediator.h +++ b/ios/chrome/browser/ui/toolbar/toolbar_mediator.h
@@ -7,15 +7,15 @@ #import <Foundation/Foundation.h> -@protocol ToolbarConsumer; - namespace bookmarks { class BookmarkModel; } namespace web { class WebState; } + class TemplateURLService; +@protocol ToolbarConsumer; class WebStateList; // A mediator object that provides the relevant properties of a web state
diff --git a/ios/chrome/browser/ui/util/keyboard_observer_helper.h b/ios/chrome/browser/ui/util/keyboard_observer_helper.h index 53578e6..eb396c37 100644 --- a/ios/chrome/browser/ui/util/keyboard_observer_helper.h +++ b/ios/chrome/browser/ui/util/keyboard_observer_helper.h
@@ -7,7 +7,26 @@ #import <UIKit/UIKit.h> +// Struct to track the current keyboard state. +typedef struct { + // Is YES if the keyboard is visible or becoming visible. + BOOL isVisible; + // Is YES if keyboard is or becoming undocked from bottom of screen. + BOOL isUndocked; + // Is YES if keyboard is or becoming split in more than one piece. + BOOL isSplit; + // Is YES if a hardware keyboard is in use and only the top part of the + // software keyboard is showing. + BOOL isHardware; + // Is YES if a picker (iPhone only) is currently displayed instead of + // keyboard. + BOOL isPicker; +} KeyboardState; + // Delegate informed about the visible/hidden state of the keyboard. +// TODO(crbug.com/974226): look into deprecating +// keyboardWillShowWithHardwareKeyboardAttached and investigate +// keyboardDidStayOnScreen + keyboardDidHide. @protocol KeyboardObserverHelperConsumer <NSObject> // Indicates that |UIKeyboardWillShowNotification| was posted. And informs if a @@ -24,17 +43,28 @@ // was actually dismissed. - (void)keyboardDidHide; +@optional +// Indicates that the keyboard state changed, at least on one of the +// |KeyboardState| aspects. +- (void)keyboardWillChangeToState:(KeyboardState)keyboardState; + @end // Helper to observe the keyboard and report updates. @interface KeyboardObserverHelper : NSObject // Flag that indicates if the keyboard is on screen. +// TODO(crbug.com/974226): look into deprecating keyboardOnScreen for +// isKeyboardVisible. @property(nonatomic, readonly, getter=isKeyboardOnScreen) BOOL keyboardOnScreen; // The consumer to inform of the keyboard state changes. @property(nonatomic, weak) id<KeyboardObserverHelperConsumer> consumer; +// Current keyboard state. +@property(nonatomic, readonly, getter=getKeyboardState) + KeyboardState keyboardState; + @end #endif // IOS_CHROME_BROWSER_UI_UTIL_KEYBOARD_OBSERVER_HELPER_H_
diff --git a/ios/chrome/browser/ui/util/keyboard_observer_helper.mm b/ios/chrome/browser/ui/util/keyboard_observer_helper.mm index bbf637ac..dcb00dd 100644 --- a/ios/chrome/browser/ui/util/keyboard_observer_helper.mm +++ b/ios/chrome/browser/ui/util/keyboard_observer_helper.mm
@@ -4,16 +4,24 @@ #import "ios/chrome/browser/ui/util/keyboard_observer_helper.h" +#include "ios/chrome/browser/ui/util/ui_util.h" + #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +// TODO(crbug.com/974226): look into making this a singleton with multiple +// listeners. @interface KeyboardObserverHelper () // Flag that indicates if the keyboard is on screen. @property(nonatomic, readwrite, getter=isKeyboardOnScreen) BOOL keyboardOnScreen; +// Current keyboard state. +@property(nonatomic, readwrite, getter=getKeyboardState) + KeyboardState keyboardState; + // Flag that indicates if the next keyboard did hide notification should be // ignored. This happens when the keyboard is on screen and the device rotates. // Causing keyboard notifications to be sent, but the keyboard never leaves the @@ -50,6 +58,11 @@ object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(keyboardDidChangeFrame:) + name:UIKeyboardDidChangeFrameNotification + object:nil]; + [[NSNotificationCenter defaultCenter] + addObserver:self selector:@selector(orientationDidChange:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; @@ -58,6 +71,8 @@ } - (void)keyboardWillChangeFrame:(NSNotification*)notification { + [self updateKeyboardState]; + // Work around UIKeyboardWillShowNotification notification not being sent in // iPad on unmerged keyboards. CGRect keyboardFrame = [[notification.userInfo @@ -67,6 +82,10 @@ } } +- (void)keyboardDidChangeFrame:(NSNotification*)notification { + [self updateKeyboardState]; +} + - (void)keyboardWillShow:(NSNotification*)notification { self.keyboardOnScreen = YES; CGRect keyboardFrame = [[notification.userInfo @@ -107,4 +126,93 @@ } } +#pragma mark - keyboard state detection + +// Update keyboard state by looking at keyboard frame and the existence of some +// classes to detect split view or pickers. +- (void)updateKeyboardState { + UIView* keyboardView = [self keyboardView]; + + CGFloat windowHeight = [UIScreen mainScreen].bounds.size.height; + CGRect keyboardFrame = keyboardView.frame; + BOOL isVisible = CGRectGetMinY(keyboardFrame) < windowHeight; + BOOL isUndocked = CGRectGetMaxY(keyboardFrame) < windowHeight; + BOOL isHardware = isVisible && CGRectGetMaxY(keyboardFrame) > windowHeight; + BOOL isSplit = [self viewIsSplit:keyboardView]; + BOOL isPicker = [self containsPickerView:keyboardView]; + + // Only notify if a change is detected. + if (isVisible != self.keyboardState.isVisible || + isUndocked != self.keyboardState.isUndocked || + isSplit != self.keyboardState.isSplit || + isHardware != self.keyboardState.isHardware || + isPicker != self.keyboardState.isPicker) { + self.keyboardState = {isVisible, isUndocked, isSplit, isHardware, isPicker}; + if ([self.consumer + respondsToSelector:@selector(keyboardWillChangeToState:)]) { + [self.consumer keyboardWillChangeToState:self.keyboardState]; + } + } +} + +// Finds the keyboard UIView based on some known, undocumented classes. +// This can break on any iOS update to keyboard architecture. +- (UIView*)keyboardView { + NSArray* windows = [UIApplication sharedApplication].windows; + NSUInteger expectedMinWindows = IsIPadIdiom() ? 2 : 3; + if (windows.count < expectedMinWindows) + return nil; + + UIWindow* window = windows.lastObject; + + for (UIView* subview in window.subviews) { + if ([NSStringFromClass([subview class]) rangeOfString:@"PeripheralHost"] + .location != NSNotFound) { + return subview; + } + if ([NSStringFromClass([subview class]) rangeOfString:@"SetContainer"] + .location != NSNotFound) { + for (UIView* subsubview in subview.subviews) { + if ([NSStringFromClass([subsubview class]) rangeOfString:@"SetHost"] + .location != NSNotFound) { + return subsubview; + } + } + } + } + + return nil; +} + +// Checks for a picker UIView* under the given |view|. +- (BOOL)containsPickerView:(UIView*)view { + for (UIView* subview in view.subviews) { + if ([NSStringFromClass([subview class]) rangeOfString:@"Picker"].location != + NSNotFound) { + return YES; + } + } + return NO; +} + +// Checks for the presence of split image views under the given |view|. +- (BOOL)viewIsSplit:(UIView*)view { + // Don't waste time going through the accessory views. + if ([NSStringFromClass([view class]) rangeOfString:@"FormInputAccessoryView"] + .location != NSNotFound) { + return NO; + } + + for (UIView* subview in view.subviews) { + if ([NSStringFromClass([subview class]) rangeOfString:@"SplitImage"] + .location != NSNotFound) { + return subview.subviews.count > 1; + } + if ([self viewIsSplit:subview]) + return YES; + } + + return NO; +} + @end
diff --git a/ios/chrome/common/ui_util/BUILD.gn b/ios/chrome/common/ui_util/BUILD.gn index 5d6452b..0160b004 100644 --- a/ios/chrome/common/ui_util/BUILD.gn +++ b/ios/chrome/common/ui_util/BUILD.gn
@@ -15,3 +15,11 @@ ] configs += [ "//build/config/compiler:enable_arc" ] } + +source_set("semantic_colors") { + sources = [ + "UIColor+cr_semantic_colors.h", + "UIColor+cr_semantic_colors.mm", + ] + configs += [ "//build/config/compiler:enable_arc" ] +}
diff --git a/ios/chrome/common/ui_util/UIColor+cr_semantic_colors.h b/ios/chrome/common/ui_util/UIColor+cr_semantic_colors.h new file mode 100644 index 0000000..46c43e5a --- /dev/null +++ b/ios/chrome/common/ui_util/UIColor+cr_semantic_colors.h
@@ -0,0 +1,20 @@ +// 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. + +#ifndef IOS_CHROME_COMMON_UI_UTIL_UICOLOR_CR_SEMANTIC_COLORS_H_ +#define IOS_CHROME_COMMON_UI_UTIL_UICOLOR_CR_SEMANTIC_COLORS_H_ + +#import <UIKit/UIKit.h> + +// This category wraps the Apple-provided semantic colors because many of them +// are only available in iOS 13. Only these wrapper functions should be added +// to this file. Custom dynamic colors should go in ColorSets. +@interface UIColor (CRSemanticColors) + +@property(class, nonatomic, readonly) + UIColor* cr_secondarySystemGroupedBackgroundColor; + +@end + +#endif // IOS_CHROME_COMMON_UI_UTIL_UICOLOR_CR_SEMANTIC_COLORS_H_
diff --git a/ios/chrome/common/ui_util/UIColor+cr_semantic_colors.mm b/ios/chrome/common/ui_util/UIColor+cr_semantic_colors.mm new file mode 100644 index 0000000..4873198 --- /dev/null +++ b/ios/chrome/common/ui_util/UIColor+cr_semantic_colors.mm
@@ -0,0 +1,22 @@ +// 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 "ios/chrome/common/ui_util/UIColor+cr_semantic_colors.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@implementation UIColor (CRSemanticColors) + ++ (UIColor*)cr_secondarySystemGroupedBackgroundColor { +#if defined(__IPHONE_13_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0) + if (@available(iOS 13, *)) { + return UIColor.secondarySystemGroupedBackgroundColor; + } +#endif + return UIColor.whiteColor; +} + +@end
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm index 5f2e9077..c0d2a6d2 100644 --- a/ios/web/web_state/ui/crw_web_controller.mm +++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -6,47 +6,19 @@ #import <WebKit/WebKit.h> -#import <objc/runtime.h> -#include <stddef.h> - -#include <cmath> -#include <limits> -#include <memory> -#include <utility> -#include <vector> - #include "base/base64.h" -#include "base/bind.h" -#include "base/callback.h" -#include "base/containers/mru_cache.h" -#include "base/feature_list.h" -#include "base/i18n/i18n_constants.h" #import "base/ios/block_types.h" -#include "base/ios/ios_util.h" -#import "base/ios/ns_error_util.h" #include "base/json/string_escape.h" -#include "base/logging.h" -#include "base/mac/bundle_locations.h" #include "base/mac/foundation_util.h" -#include "base/mac/scoped_cftyperef.h" -#include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" -#include "base/strings/string_util.h" #include "base/strings/sys_string_conversions.h" -#include "base/strings/utf_string_conversions.h" -#include "base/time/time.h" -#include "base/timer/timer.h" -#include "base/values.h" #include "crypto/symmetric_key.h" -#import "ios/net/http_response_headers_util.h" #import "ios/web/browsing_data/browsing_data_remover.h" #import "ios/web/browsing_data/browsing_data_remover_observer.h" -#import "ios/web/common/crw_content_view.h" #import "ios/web/common/crw_web_view_content_view.h" #include "ios/web/common/features.h" -#include "ios/web/common/referrer_util.h" #include "ios/web/common/url_util.h" #import "ios/web/favicon/favicon_manager.h" #import "ios/web/find_in_page/find_in_page_manager_impl.h" @@ -55,60 +27,31 @@ #import "ios/web/js_messaging/crw_wk_script_message_router.h" #import "ios/web/js_messaging/web_frame_impl.h" #import "ios/web/js_messaging/web_frames_manager_impl.h" +#import "ios/web/js_messaging/web_view_js_utils.h" #import "ios/web/navigation/crw_js_navigation_handler.h" #import "ios/web/navigation/crw_navigation_item_holder.h" -#import "ios/web/navigation/crw_pending_navigation_info.h" #import "ios/web/navigation/crw_web_view_navigation_observer.h" #import "ios/web/navigation/crw_web_view_navigation_observer_delegate.h" #import "ios/web/navigation/crw_wk_navigation_handler.h" #import "ios/web/navigation/crw_wk_navigation_states.h" -#include "ios/web/navigation/error_retry_state_machine.h" #import "ios/web/navigation/navigation_context_impl.h" -#import "ios/web/navigation/navigation_item_impl.h" -#import "ios/web/navigation/navigation_manager_impl.h" -#include "ios/web/navigation/navigation_manager_util.h" -#include "ios/web/navigation/web_kit_constants.h" #import "ios/web/navigation/wk_back_forward_list_item_holder.h" -#import "ios/web/navigation/wk_navigation_action_policy_util.h" -#import "ios/web/navigation/wk_navigation_action_util.h" #import "ios/web/navigation/wk_navigation_util.h" -#include "ios/web/public/browser_state.h" #import "ios/web/public/deprecated/crw_context_menu_delegate.h" -#import "ios/web/public/deprecated/crw_native_content.h" #import "ios/web/public/deprecated/crw_native_content_provider.h" -#include "ios/web/public/deprecated/url_verification_constants.h" -#import "ios/web/public/download/download_controller.h" -#import "ios/web/public/java_script_dialog_presenter.h" -#include "ios/web/public/js_messaging/web_frame.h" #include "ios/web/public/js_messaging/web_frame_util.h" -#import "ios/web/public/navigation_item.h" -#import "ios/web/public/navigation_manager.h" -#include "ios/web/public/referrer.h" -#include "ios/web/public/security/ssl_status.h" -#import "ios/web/public/url_scheme_util.h" #import "ios/web/public/web_client.h" -#import "ios/web/public/web_state/context_menu_params.h" #import "ios/web/public/web_state/page_display_state.h" #import "ios/web/public/web_state/ui/crw_web_view_scroll_view_proxy.h" -#import "ios/web/public/web_state/web_state.h" -#import "ios/web/public/web_state/web_state_policy_decider.h" -#include "ios/web/public/webui/web_ui_ios.h" -#include "ios/web/security/cert_host_pair.h" -#include "ios/web/security/cert_verification_error.h" #import "ios/web/security/crw_cert_verification_controller.h" #import "ios/web/security/crw_ssl_status_updater.h" -#import "ios/web/security/web_interstitial_impl.h" -#import "ios/web/security/wk_web_view_security_util.h" -#import "ios/web/session/session_certificate_policy_cache_impl.h" #import "ios/web/web_state/page_viewport_state.h" #import "ios/web/web_state/ui/controller/crw_legacy_native_content_controller.h" #import "ios/web/web_state/ui/controller/crw_legacy_native_content_controller_delegate.h" #import "ios/web/web_state/ui/crw_context_menu_controller.h" #import "ios/web/web_state/ui/crw_swipe_recognizer_provider.h" -#import "ios/web/web_state/ui/crw_web_controller.h" #import "ios/web/web_state/ui/crw_web_controller_container_view.h" #import "ios/web/web_state/ui/crw_web_request_controller.h" -#import "ios/web/web_state/ui/crw_web_view_navigation_proxy.h" #import "ios/web/web_state/ui/crw_web_view_proxy_impl.h" #import "ios/web/web_state/ui/crw_wk_ui_handler.h" #import "ios/web/web_state/ui/crw_wk_ui_handler_delegate.h" @@ -118,16 +61,10 @@ #import "ios/web/web_state/web_state_impl.h" #import "ios/web/web_state/web_view_internal_creation_util.h" #import "ios/web/web_view/content_type_util.h" -#import "ios/web/web_view/error_translation_util.h" #import "ios/web/web_view/wk_web_view_util.h" #import "net/base/mac/url_conversions.h" -#include "net/base/net_errors.h" -#include "net/cert/x509_util_ios.h" -#include "net/ssl/ssl_info.h" #include "services/metrics/public/cpp/ukm_builders.h" -#include "ui/base/page_transition_types.h" #include "url/gurl.h" -#include "url/url_constants.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -139,12 +76,9 @@ using web::WebStateImpl; using web::wk_navigation_util::IsPlaceholderUrl; -using web::wk_navigation_util::CreatePlaceholderUrlForUrl; using web::wk_navigation_util::ExtractUrlFromPlaceholderUrl; using web::wk_navigation_util::IsRestoreSessionUrl; using web::wk_navigation_util::IsWKInternalUrl; -using web::wk_navigation_util::kReferrerHeaderName; -using web::wk_navigation_util::URLNeedsUserAgentType; namespace { @@ -311,13 +245,6 @@ // may be called multiple times and thus must be idempotent. - (void)loadCompleteWithSuccess:(BOOL)loadSuccess forContext:(web::NavigationContextImpl*)context; -// Called after URL is finished loading and -// self.navigationHandler.navigationState is set to FINISHED. |context| contains -// information about the navigation associated with the URL. It is nil if -// currentURL is invalid. -- (void)didFinishWithURL:(const GURL&)currentURL - loadSuccess:(BOOL)loadSuccess - context:(nullable const web::NavigationContextImpl*)context; // Acts on a single message from the JS object, parsed from JSON into a // DictionaryValue. Returns NO if the format for the message was invalid. - (BOOL)respondToMessage:(base::DictionaryValue*)crwMessage @@ -416,7 +343,6 @@ object:nil]; _navigationHandler = [[CRWWKNavigationHandler alloc] initWithDelegate:self]; - _requestController.navigationHandler = _navigationHandler; _JSNavigationHandler = [[CRWJSNavigationHandler alloc] initWithDelegate:self]; @@ -792,14 +718,15 @@ base::RecordAction(base::UserMetricsAction("Reload")); GURL URL = self.currentNavItem->GetURL(); if ([self.legacyNativeController shouldLoadURLInNativeView:URL]) { - std::unique_ptr<web::NavigationContextImpl> navigationContext = [self - registerLoadRequestForURL:URL - referrer:self.currentNavItemReferrer - transition:ui::PageTransition::PAGE_TRANSITION_RELOAD - sameDocumentNavigation:NO - hasUserGesture:YES - rendererInitiated:rendererInitiated - placeholderNavigation:NO]; + std::unique_ptr<web::NavigationContextImpl> navigationContext = + [_requestController + registerLoadRequestForURL:URL + referrer:self.currentNavItemReferrer + transition:ui::PageTransition::PAGE_TRANSITION_RELOAD + sameDocumentNavigation:NO + hasUserGesture:YES + rendererInitiated:rendererInitiated + placeholderNavigation:NO]; self.webStateImpl->OnNavigationStarted(navigationContext.get()); [self didStartLoading]; self.navigationManagerImpl->CommitPendingItem( @@ -832,14 +759,16 @@ [self.navigationHandler.navigationStates setState:web::WKNavigationState::REQUESTED forNavigation:navigation]; - std::unique_ptr<web::NavigationContextImpl> navigationContext = [self - registerLoadRequestForURL:URL - referrer:self.currentNavItemReferrer - transition:ui::PageTransition::PAGE_TRANSITION_RELOAD - sameDocumentNavigation:NO - hasUserGesture:YES - rendererInitiated:rendererInitiated - placeholderNavigation:NO]; + std::unique_ptr<web::NavigationContextImpl> navigationContext = + [_requestController + registerLoadRequestForURL:URL + referrer:self.currentNavItemReferrer + transition:ui::PageTransition:: + PAGE_TRANSITION_RELOAD + sameDocumentNavigation:NO + hasUserGesture:YES + rendererInitiated:rendererInitiated + placeholderNavigation:NO]; [self.navigationHandler.navigationStates setContext:std::move(navigationContext) forNavigation:navigation]; @@ -934,8 +863,9 @@ [self.legacyNativeController loadCurrentURLInNativeViewWithRendererInitiatedNavigation: rendererInitiated]; - } else { - [self loadCurrentURLInWebView]; + } else if ([_requestController maybeLoadRequestForCurrentNavigationItem]) { + [self ensureWebViewCreated]; + [_requestController loadRequestForCurrentNavigationItem]; } } @@ -959,10 +889,7 @@ - (void)loadData:(NSData*)data MIMEType:(NSString*)MIMEType forURL:(const GURL&)URL { - [_requestController loadData:data - webView:self.webView - MIMEType:MIMEType - forURL:URL]; + [_requestController loadData:data MIMEType:MIMEType forURL:URL]; } // Loads the HTML into the page at the given URL. Only for testing purpose. @@ -973,7 +900,7 @@ DCHECK(self.webView) << "self.webView null while trying to load HTML"; } - [_requestController loadHTML:HTML webView:self.webView forURL:URL]; + [_requestController loadHTML:HTML forURL:URL]; } - (void)requirePageReconstruction { @@ -1037,7 +964,9 @@ [self setDocumentURL:URL context:context.get()]; context->SetHasCommitted(true); self.webStateImpl->OnNavigationFinished(context.get()); - [self didFinishWithURL:URL loadSuccess:YES context:context.get()]; + [_requestController didFinishWithURL:URL + loadSuccess:YES + context:context.get()]; } - (void)goToBackForwardListItem:(WKBackForwardListItem*)wk_item @@ -1192,184 +1121,6 @@ return _userInteractionState.IsUserInteracting(self.webView); } -#pragma mark - Navigation Helpers - -// Registers load request with empty referrer and link or client redirect -// transition based on user interaction state. Returns navigation context for -// this request. -- (std::unique_ptr<web::NavigationContextImpl>) - registerLoadRequestForURL:(const GURL&)URL - sameDocumentNavigation:(BOOL)sameDocumentNavigation - hasUserGesture:(BOOL)hasUserGesture - rendererInitiated:(BOOL)rendererInitiated - placeholderNavigation:(BOOL)placeholderNavigation { - // Get the navigation type from the last main frame load request, and try to - // map that to a PageTransition. - WKNavigationType navigationType = - self.navigationHandler.pendingNavigationInfo - ? self.navigationHandler.pendingNavigationInfo.navigationType - : WKNavigationTypeOther; - ui::PageTransition transition = - [self.navigationHandler pageTransitionFromNavigationType:navigationType]; - - if (web::GetWebClient()->IsSlimNavigationManagerEnabled() && - navigationType == WKNavigationTypeBackForward && - self.webView.backForwardList.currentItem) { - web::NavigationItem* currentItem = [[CRWNavigationItemHolder - holderForBackForwardListItem:self.webView.backForwardList.currentItem] - navigationItem]; - if (currentItem) { - transition = ui::PageTransitionFromInt(transition | - currentItem->GetTransitionType()); - } - } - - // The referrer is not known yet, and will be updated later. - const web::Referrer emptyReferrer; - std::unique_ptr<web::NavigationContextImpl> context = - [self registerLoadRequestForURL:URL - referrer:emptyReferrer - transition:transition - sameDocumentNavigation:sameDocumentNavigation - hasUserGesture:hasUserGesture - rendererInitiated:rendererInitiated - placeholderNavigation:placeholderNavigation]; - context->SetWKNavigationType(navigationType); - return context; -} - -// Prepares web controller and delegates for anticipated page change. -// Allows several methods to invoke webWill/DidAddPendingURL on anticipated page -// change, using the same cached request and calculated transition types. -// Returns navigation context for this request. -- (std::unique_ptr<web::NavigationContextImpl>) - registerLoadRequestForURL:(const GURL&)requestURL - referrer:(const web::Referrer&)referrer - transition:(ui::PageTransition)transition - sameDocumentNavigation:(BOOL)sameDocumentNavigation - hasUserGesture:(BOOL)hasUserGesture - rendererInitiated:(BOOL)rendererInitiated - placeholderNavigation:(BOOL)placeholderNavigation { - // Transfer time is registered so that further transitions within the time - // envelope are not also registered as links. - _userInteractionState.ResetLastTransferTime(); - - // Add or update pending item before any WebStateObserver callbacks. - // See https://crbug.com/842151 for a scenario where this is important. - web::NavigationItem* item = - self.navigationManagerImpl->GetPendingItemInCurrentOrRestoredSession(); - if (item) { - // Update the existing pending entry. - // Typically on PAGE_TRANSITION_CLIENT_REDIRECT. - // Don't update if request is a placeholder entry because the pending item - // should have the original target URL. - // Don't update if pending URL has a different origin, because client - // redirects can not change the origin. It is possible to have more than one - // pending navigations, so the redirect does not necesserily belong to the - // pending navigation item. - if (!placeholderNavigation && - item->GetURL().GetOrigin() == requestURL.GetOrigin()) { - self.navigationManagerImpl->UpdatePendingItemUrl(requestURL); - } - } else { - self.navigationManagerImpl->AddPendingItem( - requestURL, referrer, transition, - rendererInitiated ? web::NavigationInitiationType::RENDERER_INITIATED - : web::NavigationInitiationType::BROWSER_INITIATED, - NavigationManager::UserAgentOverrideOption::INHERIT); - item = - self.navigationManagerImpl->GetPendingItemInCurrentOrRestoredSession(); - } - - bool redirect = transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK; - if (!redirect) { - // Before changing navigation state, the delegate should be informed that - // any existing request is being cancelled before completion. - [self.navigationHandler loadCancelled]; - DCHECK_EQ(web::WKNavigationState::FINISHED, - self.navigationHandler.navigationState); - } - - self.navigationHandler.navigationState = web::WKNavigationState::REQUESTED; - - // Record the state of outgoing web view. Do nothing if native controller - // exists, because in that case recordStateInHistory will record the state - // of incoming page as native controller is already inserted. - // TODO(crbug.com/811770) Don't record state under WKBasedNavigationManager - // because it may incorrectly clobber the incoming page if this is a - // back/forward navigation. WKWebView restores page scroll state for web view - // pages anyways so this only impacts user if WKWebView is deleted. - if (!redirect && ![self.legacyNativeController hasController] && - !web::GetWebClient()->IsSlimNavigationManagerEnabled()) { - [self recordStateInHistory]; - } - - std::unique_ptr<web::NavigationContextImpl> context = - web::NavigationContextImpl::CreateNavigationContext( - self.webStateImpl, requestURL, hasUserGesture, transition, - rendererInitiated); - context->SetPlaceholderNavigation(placeholderNavigation); - - // TODO(crbug.com/676129): LegacyNavigationManagerImpl::AddPendingItem does - // not create a pending item in case of reload. Remove this workaround once - // the bug is fixed or WKBasedNavigationManager is fully adopted. - if (!item) { - DCHECK(!web::GetWebClient()->IsSlimNavigationManagerEnabled()); - item = self.navigationManagerImpl->GetLastCommittedItem(); - } - - context->SetNavigationItemUniqueID(item->GetUniqueID()); - context->SetIsPost([self.navigationHandler isCurrentNavigationItemPOST]); - context->SetIsSameDocument(sameDocumentNavigation); - - if (!IsWKInternalUrl(requestURL) && !placeholderNavigation) { - self.webStateImpl->SetIsLoading(true); - } - - // WKWebView may have multiple pending items. Move pending item ownership from - // NavigationManager to NavigationContext. NavigationManager owns pending item - // after navigation was requested and until NavigationContext is created. - if (web::features::StorePendingItemInContext()) { - // No need to transfer the ownership for NativeContent URLs, because the - // load of NativeContent is synchronous. No need to transfer the ownership - // for WebUI navigations, because those navigation do not have access to - // NavigationContext. - if (![self.legacyNativeController - shouldLoadURLInNativeView:context->GetUrl()]) { - if (self.navigationManagerImpl->GetPendingItemIndex() == -1) { - context->SetItem(self.navigationManagerImpl->ReleasePendingItem()); - } - } - } - - return context; -} - -// Loads the current URL in a web view, first ensuring the web view is visible. -- (void)loadCurrentURLInWebView { - web::NavigationItem* item = self.currentNavItem; - GURL targetURL = item ? item->GetVirtualURL() : GURL::EmptyGURL(); - // Load the url. The UIWebView delegate callbacks take care of updating the - // session history and UI. - if (!targetURL.is_valid()) { - [self didFinishWithURL:targetURL loadSuccess:NO context:nullptr]; - self.webStateImpl->SetIsLoading(false); - self.webStateImpl->OnPageLoaded(targetURL, NO); - return; - } - - // JavaScript should never be evaluated here. User-entered JS should be - // evaluated via stringByEvaluatingUserJavaScriptFromString. - DCHECK(!targetURL.SchemeIs(url::kJavaScriptScheme)); - - [self ensureWebViewCreated]; - - web::WKBackForwardListItemHolder* holder = - self.navigationHandler.currentBackForwardListItemHolder; - [_requestController loadRequestForCurrentNavigationItemInWebView:self.webView - itemHolder:holder]; -} - #pragma mark - End of loading - (void)didFinishNavigation:(web::NavigationContextImpl*)context { @@ -1413,7 +1164,9 @@ [self optOutScrollsToTopForSubviews]; // Perform post-load-finished updates. - [self didFinishWithURL:currentURL loadSuccess:loadSuccess context:context]; + [_requestController didFinishWithURL:currentURL + loadSuccess:loadSuccess + context:context]; // Execute the pending LoadCompleteActions. for (ProceduralBlock action in _pendingLoadCompleteActions) { @@ -1422,48 +1175,6 @@ [_pendingLoadCompleteActions removeAllObjects]; } -- (void)didFinishWithURL:(const GURL&)currentURL - loadSuccess:(BOOL)loadSuccess - context:(nullable const web::NavigationContextImpl*)context { - DCHECK_EQ(web::WKNavigationState::FINISHED, - self.navigationHandler.navigationState); - - [self restoreStateFromHistory]; - - // Placeholder and restore session URLs are implementation details so should - // not notify WebStateObservers. If |context| is nullptr, don't skip - // placeholder URLs because this may be the only opportunity to update - // |isLoading| for native view reload. - - if (context && context->IsPlaceholderNavigation()) - return; - - if (context && IsRestoreSessionUrl(context->GetUrl())) - return; - - if (IsRestoreSessionUrl(net::GURLWithNSURL(self.webView.URL))) - return; - - if (context && context->IsLoadingErrorPage()) - return; - - if (!loadSuccess) { - // WebStateObserver callbacks will be called for load failure after - // loading placeholder URL. - return; - } - - if (![self.navigationHandler.navigationStates - lastNavigationWithPendingItemInNavigationContext] || - !web::features::StorePendingItemInContext()) { - self.webStateImpl->SetIsLoading(false); - } else { - // There is another pending navigation, so the state is still loading. - } - self.webStateImpl->OnPageLoaded(currentURL, YES); -} - - #pragma mark - BrowsingDataRemoverObserver - (void)willRemoveBrowsingData:(web::BrowsingDataRemover*)dataRemover { @@ -1626,13 +1337,13 @@ hasUserGesture:(BOOL)hasUserGesture rendererInitiated:(BOOL)rendererInitiated placeholderNavigation:(BOOL)placeholderNavigation { - return [self registerLoadRequestForURL:requestURL - referrer:referrer - transition:transition - sameDocumentNavigation:sameDocumentNavigation - hasUserGesture:hasUserGesture - rendererInitiated:rendererInitiated - placeholderNavigation:placeholderNavigation]; + return [_requestController registerLoadRequestForURL:requestURL + referrer:referrer + transition:transition + sameDocumentNavigation:sameDocumentNavigation + hasUserGesture:hasUserGesture + rendererInitiated:rendererInitiated + placeholderNavigation:placeholderNavigation]; } - (void)legacyNativeContentController: @@ -1653,7 +1364,9 @@ nativeContentLoadDidFinishWithURL:(const GURL&)targetURL context:(web::NavigationContextImpl*)context { self.navigationHandler.navigationState = web::WKNavigationState::FINISHED; - [self didFinishWithURL:targetURL loadSuccess:YES context:context]; + [_requestController didFinishWithURL:targetURL + loadSuccess:YES + context:context]; } #pragma mark - CRWWebControllerContainerViewDelegate @@ -2522,12 +2235,12 @@ - (void)navigationObserver:(CRWWebViewNavigationObserver*)navigationObserver didLoadNewURL:(const GURL&)webViewURL forSameDocumentNavigation:(BOOL)isSameDocumentNavigation { - std::unique_ptr<web::NavigationContextImpl> newContext = - [self registerLoadRequestForURL:webViewURL - sameDocumentNavigation:isSameDocumentNavigation - hasUserGesture:NO - rendererInitiated:YES - placeholderNavigation:IsPlaceholderUrl(webViewURL)]; + std::unique_ptr<web::NavigationContextImpl> newContext = [_requestController + registerLoadRequestForURL:webViewURL + sameDocumentNavigation:isSameDocumentNavigation + hasUserGesture:NO + rendererInitiated:YES + placeholderNavigation:IsPlaceholderUrl(webViewURL)]; [self.navigationHandler webPageChangedWithContext:newContext.get() webView:self.webView]; newContext->SetHasCommitted(!isSameDocumentNavigation); @@ -2591,11 +2304,12 @@ // 2.) Assigning same-origin URL to window.location // 3.) Incorrectly handled window.location.replace (crbug.com/307072) // 4.) Back-forward same document navigation - newNavigationContext = [self registerLoadRequestForURL:newURL - sameDocumentNavigation:YES - hasUserGesture:NO - rendererInitiated:YES - placeholderNavigation:NO]; + newNavigationContext = + [_requestController registerLoadRequestForURL:newURL + sameDocumentNavigation:YES + hasUserGesture:NO + rendererInitiated:YES + placeholderNavigation:NO]; // With slim nav, the web page title is stored in WKBackForwardListItem // and synced to Navigationitem when the web view title changes. @@ -2706,11 +2420,11 @@ hasUserGesture:(BOOL)hasUserGesture rendererInitiated:(BOOL)renderedInitiated placeholderNavigation:(BOOL)placeholderNavigation { - return [self registerLoadRequestForURL:URL - sameDocumentNavigation:sameDocumentNavigation - hasUserGesture:hasUserGesture - rendererInitiated:renderedInitiated - placeholderNavigation:placeholderNavigation]; + return [_requestController registerLoadRequestForURL:URL + sameDocumentNavigation:sameDocumentNavigation + hasUserGesture:hasUserGesture + rendererInitiated:renderedInitiated + placeholderNavigation:placeholderNavigation]; } - (void)navigationHandlerDisplayWebView: @@ -2778,24 +2492,6 @@ [self stopLoading]; } -- (std::unique_ptr<web::NavigationContextImpl>) - webRequestController:(CRWWebRequestController*)requestController - registerLoadRequestForURL:(const GURL&)requestURL - referrer:(const web::Referrer&)referrer - transition:(ui::PageTransition)transition - sameDocumentNavigation:(BOOL)sameDocumentNavigation - hasUserGesture:(BOOL)hasUserGesture - rendererInitiated:(BOOL)rendererInitiated - placeholderNavigation:(BOOL)placeholderNavigation { - return [self registerLoadRequestForURL:requestURL - referrer:referrer - transition:transition - sameDocumentNavigation:sameDocumentNavigation - hasUserGesture:hasUserGesture - rendererInitiated:rendererInitiated - placeholderNavigation:placeholderNavigation]; -} - - (void)webRequestControllerDisconnectScrollViewProxy: (CRWWebRequestController*)requestController { // Disable |allowsBackForwardNavigationGestures| during restore. Otherwise, @@ -2809,6 +2505,37 @@ } } +- (web::UserInteractionState*)webRequestControllerUserInteractionState: + (CRWWebRequestController*)requestController { + return &_userInteractionState; +} + +- (CRWLegacyNativeContentController*) + webRequestControllerLegacyNativeContentController: + (CRWWebRequestController*)requestController { + return self.legacyNativeController; +} + +- (void)webRequestControllerRecordStateInHistory: + (CRWWebRequestController*)requestController { + [self recordStateInHistory]; +} + +- (void)webRequestControllerRestoreStateFromHistory: + (CRWWebRequestController*)requestController { + [self restoreStateFromHistory]; +} + +- (WKWebView*)webRequestControllerWebView: + (CRWWebRequestController*)requestController { + return self.webView; +} + +- (CRWWKNavigationHandler*)webRequestControllerNavigationHandler: + (CRWWebRequestController*)requestController { + return self.navigationHandler; +} + #pragma mark - CRWJSNavigationHandlerDelegate - (web::WebStateImpl*)webStateImplForJSNavigationHandler:
diff --git a/ios/web/web_state/ui/crw_web_request_controller.h b/ios/web/web_state/ui/crw_web_request_controller.h index ef132a4..5895958 100644 --- a/ios/web/web_state/ui/crw_web_request_controller.h +++ b/ios/web/web_state/ui/crw_web_request_controller.h
@@ -14,11 +14,12 @@ @class WKWebView; @class CRWWebRequestController; @class CRWWKNavigationHandler; +@class CRWLegacyNativeContentController; namespace web { class NavigationContextImpl; class WebStateImpl; -class WKBackForwardListItemHolder; +class UserInteractionState; } // namespace web @protocol CRWWebRequestControllerDelegate <NSObject> @@ -31,24 +32,36 @@ - (BOOL)webRequestControllerIsBeingDestroyed: (CRWWebRequestController*)requestController; -// Prepares web controller and delegates for anticipated page change. -// Allows several methods to invoke webWill/DidAddPendingURL on anticipated page -// change, using the same cached request and calculated transition types. -// Returns navigation context for this request. -- (std::unique_ptr<web::NavigationContextImpl>) - webRequestController:(CRWWebRequestController*)requestController - registerLoadRequestForURL:(const GURL&)requestURL - referrer:(const web::Referrer&)referrer - transition:(ui::PageTransition)transition - sameDocumentNavigation:(BOOL)sameDocumentNavigation - hasUserGesture:(BOOL)hasUserGesture - rendererInitiated:(BOOL)rendererInitiated - placeholderNavigation:(BOOL)placeholderNavigation; - // Asks proxy to disconnect scroll proxy if needed. - (void)webRequestControllerDisconnectScrollViewProxy: (CRWWebRequestController*)requestController; +// Asks the delegate for the associated |UserInteractionState|. +- (web::UserInteractionState*)webRequestControllerUserInteractionState: + (CRWWebRequestController*)requestController; + +// Asks the delegate for the associated |CRWLegacyNativeContentController|. +- (CRWLegacyNativeContentController*) + webRequestControllerLegacyNativeContentController: + (CRWWebRequestController*)requestController; + +// Tells the delegate to record the state (scroll position, form values, +// whatever can be harvested) from the current page into the current session +// entry. +- (void)webRequestControllerRecordStateInHistory: + (CRWWebRequestController*)requestController; + +// Tells the delegate to restores the state for current page from session +// history. +- (void)webRequestControllerRestoreStateFromHistory: + (CRWWebRequestController*)requestController; + +- (WKWebView*)webRequestControllerWebView: + (CRWWebRequestController*)requestController; + +- (CRWWKNavigationHandler*)webRequestControllerNavigationHandler: + (CRWWebRequestController*)requestController; + @end // Controller in charge of preparing and handling web requests for the delegate, @@ -57,33 +70,62 @@ @property(nonatomic, weak) id<CRWWebRequestControllerDelegate> delegate; -// The WKNavigationDelegate handler class. -@property(nonatomic, weak) CRWWKNavigationHandler* navigationHandler; - - (instancetype)initWithWebState:(web::WebStateImpl*)webState NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; -// Loads request for the URL of the current navigation item. -- (void) - loadRequestForCurrentNavigationItemInWebView:(WKWebView*)webView - itemHolder: - (web::WKBackForwardListItemHolder*) - holder; +// Checks if a load request of the current navigation item should proceed. If +// this returns |YES|, caller should create a webView and call +// |loadRequestForCurrentNavigationItem|. Otherwise this will set the request +// state to finished and call |didFinishWithURL| with failure. +- (BOOL)maybeLoadRequestForCurrentNavigationItem; + +// Loads request for the URL of the current navigation item. Subclasses may +// choose to build a new NSURLRequest and call +// |loadRequestForCurrentNavigationItem| on the underlying web view, or use +// native web view navigation where possible (for example, going back and +// forward through the history stack). +- (void)loadRequestForCurrentNavigationItem; + +// Should be called by owner component after URL is finished loading and +// self.navigationHandler.navigationState is set to FINISHED. |context| contains +// information about the navigation associated with the URL. It is nil if +// currentURL is invalid. +- (void)didFinishWithURL:(const GURL&)currentURL + loadSuccess:(BOOL)loadSuccess + context:(const web::NavigationContextImpl*)context; + +// Calls |registerLoadRequestForURL| with empty referrer and link or client +// redirect transition based on user interaction state. Returns navigation +// context for this request. +- (std::unique_ptr<web::NavigationContextImpl>) + registerLoadRequestForURL:(const GURL&)URL + sameDocumentNavigation:(BOOL)sameDocumentNavigation + hasUserGesture:(BOOL)hasUserGesture + rendererInitiated:(BOOL)rendererInitiated + placeholderNavigation:(BOOL)placeholderNavigation; + +// Creates a page change request and registers it with the navigation handler. +// Returns navigation context for this request. +- (std::unique_ptr<web::NavigationContextImpl>) + registerLoadRequestForURL:(const GURL&)requestURL + referrer:(const web::Referrer&)referrer + transition:(ui::PageTransition)transition + sameDocumentNavigation:(BOOL)sameDocumentNavigation + hasUserGesture:(BOOL)hasUserGesture + rendererInitiated:(BOOL)rendererInitiated + placeholderNavigation:(BOOL)placeholderNavigation; // Loads |data| of type |MIMEType| and replaces last committed URL with the // given |URL|. - (void)loadData:(NSData*)data - webView:(WKWebView*)webView MIMEType:(NSString*)MIMEType forURL:(const GURL&)URL; // Loads |HTML| into the page and use |URL| to resolve relative URLs within the // document. -- (void)loadHTML:(NSString*)HTML - webView:(WKWebView*)webView - forURL:(const GURL&)URL; +- (void)loadHTML:(NSString*)HTML forURL:(const GURL&)URL; @end
diff --git a/ios/web/web_state/ui/crw_web_request_controller.mm b/ios/web/web_state/ui/crw_web_request_controller.mm index d88ba4c..4d4f9bd 100644 --- a/ios/web/web_state/ui/crw_web_request_controller.mm +++ b/ios/web/web_state/ui/crw_web_request_controller.mm
@@ -14,6 +14,8 @@ #include "base/strings/sys_string_conversions.h" #include "ios/web/common/features.h" #include "ios/web/common/referrer_util.h" +#import "ios/web/navigation/crw_navigation_item_holder.h" +#import "ios/web/navigation/crw_pending_navigation_info.h" #import "ios/web/navigation/crw_wk_navigation_handler.h" #import "ios/web/navigation/crw_wk_navigation_states.h" #import "ios/web/navigation/navigation_context_impl.h" @@ -23,6 +25,8 @@ #import "ios/web/navigation/wk_navigation_util.h" #import "ios/web/public/web_client.h" #import "ios/web/public/web_state/web_state.h" +#import "ios/web/web_state/ui/controller/crw_legacy_native_content_controller.h" +#import "ios/web/web_state/user_interaction_state.h" #import "ios/web/web_state/web_state_impl.h" #import "net/base/mac/url_conversions.h" @@ -32,6 +36,8 @@ using web::wk_navigation_util::ExtractUrlFromPlaceholderUrl; using web::wk_navigation_util::IsPlaceholderUrl; +using web::wk_navigation_util::IsRestoreSessionUrl; +using web::wk_navigation_util::IsWKInternalUrl; using web::wk_navigation_util::kReferrerHeaderName; using web::wk_navigation_util::URLNeedsUserAgentType; @@ -54,6 +60,12 @@ @property(nonatomic, readonly) web::WebStateImpl* webState; +// Returns a web view, if one is associated from delegate. +@property(nonatomic, readonly) WKWebView* webView; + +// Returns The WKNavigationDelegate handler class from delegate. +@property(nonatomic, readonly) CRWWKNavigationHandler* navigationHandler; + @end @implementation CRWWebRequestController @@ -66,19 +78,34 @@ return self; } -- (void) - loadRequestForCurrentNavigationItemInWebView:(WKWebView*)webView - itemHolder: - (web::WKBackForwardListItemHolder*) - holder { - DCHECK(webView); +- (BOOL)maybeLoadRequestForCurrentNavigationItem { + web::NavigationItem* item = self.currentNavItem; + GURL targetURL = item ? item->GetVirtualURL() : GURL::EmptyGURL(); + // Load the url. The UIWebView delegate callbacks take care of updating the + // session history and UI. + if (!targetURL.is_valid()) { + [self didFinishWithURL:targetURL loadSuccess:NO context:nullptr]; + self.webState->SetIsLoading(false); + self.webState->OnPageLoaded(targetURL, NO); + return NO; + } + + // JavaScript should never be evaluated here. User-entered JS should be + // evaluated via stringByEvaluatingUserJavaScriptFromString. + DCHECK(!targetURL.SchemeIs(url::kJavaScriptScheme)); + + return YES; +} + +- (void)loadRequestForCurrentNavigationItem { + DCHECK(self.webView); DCHECK(self.currentNavItem); // If a load is kicked off on a WKWebView with a frame whose size is {0, 0} or // that has a negative dimension for a size, rendering issues occur that // manifest in erroneous scrolling and tap handling (crbug.com/574996, // crbug.com/577793). - DCHECK_GT(CGRectGetWidth(webView.frame), 0.0); - DCHECK_GT(CGRectGetHeight(webView.frame), 0.0); + DCHECK_GT(CGRectGetWidth(self.webView.frame), 0.0); + DCHECK_GT(CGRectGetHeight(self.webView.frame), 0.0); // If the current item uses a different user agent from that is currently used // in the web view, update |customUserAgent| property, which will be used by @@ -88,11 +115,14 @@ if (itemUserAgentType != web::UserAgentType::NONE) { NSString* userAgentString = base::SysUTF8ToNSString( web::GetWebClient()->GetUserAgent(itemUserAgentType)); - if (![webView.customUserAgent isEqualToString:userAgentString]) { - webView.customUserAgent = userAgentString; + if (![self.webView.customUserAgent isEqualToString:userAgentString]) { + self.webView.customUserAgent = userAgentString; } } + web::WKBackForwardListItemHolder* holder = + self.navigationHandler.currentBackForwardListItemHolder; + BOOL repostedForm = [holder->http_method() isEqual:@"POST"] && (holder->navigation_type() == WKNavigationTypeFormResubmitted || @@ -139,8 +169,7 @@ ? ExtractUrlFromPlaceholderUrl(navigationURL) : navigationURL; std::unique_ptr<web::NavigationContextImpl> navigationContext = - [_delegate webRequestController:self - registerLoadRequestForURL:contextURL + [self registerLoadRequestForURL:contextURL referrer:self.currentNavItemReferrer transition:self.currentTransition sameDocumentNavigation:sameDocumentNavigation @@ -159,10 +188,10 @@ // file:// URL navigations are allowed for app-specific URLs, which // already have elevated privileges. NSURL* navigationNSURL = net::NSURLWithGURL(navigationURL); - navigation = [webView loadFileURL:navigationNSURL - allowingReadAccessToURL:navigationNSURL]; + navigation = [self.webView loadFileURL:navigationNSURL + allowingReadAccessToURL:navigationNSURL]; } else { - navigation = [webView loadRequest:request]; + navigation = [self.webView loadRequest:request]; } [self.navigationHandler.navigationStates setState:web::WKNavigationState::REQUESTED @@ -191,8 +220,7 @@ // is not possible. In this case, fall back to the default navigation // mechanism. if (!holder->back_forward_list_item() || - ![self isBackForwardListItemValid:holder->back_forward_list_item() - webView:webView]) { + ![self isBackForwardListItemValid:holder->back_forward_list_item()]) { defaultNavigationBlock(); return; } @@ -205,8 +233,7 @@ web::NavigationItem* item = self.currentNavItem; GURL navigationURL = item ? item->GetURL() : GURL::EmptyGURL(); std::unique_ptr<web::NavigationContextImpl> navigationContext = - [_delegate webRequestController:self - registerLoadRequestForURL:navigationURL + [self registerLoadRequestForURL:navigationURL referrer:self.currentNavItemReferrer transition:self.currentTransition sameDocumentNavigation:sameDocumentNavigation @@ -214,16 +241,16 @@ rendererInitiated:NO placeholderNavigation:NO]; WKNavigation* navigation = nil; - if (navigationURL == net::GURLWithNSURL(webView.URL)) { - navigation = [webView reload]; + if (navigationURL == net::GURLWithNSURL(self.webView.URL)) { + navigation = [self.webView reload]; } else { // |didCommitNavigation:| may not be called for fast navigation, so update // the navigation type now as it is already known. navigationContext->SetWKNavigationType(WKNavigationTypeBackForward); navigationContext->SetMimeType(holder->mime_type()); holder->set_navigation_type(WKNavigationTypeBackForward); - navigation = - [webView goToBackForwardListItem:holder->back_forward_list_item()]; + navigation = [self.webView + goToBackForwardListItem:holder->back_forward_list_item()]; [self reportBackForwardNavigationTypeForFastNavigation:YES]; } [self.navigationHandler.navigationStates @@ -259,7 +286,6 @@ } - (void)loadData:(NSData*)data - webView:(WKWebView*)webView MIMEType:(NSString*)MIMEType forURL:(const GURL&)URL { [_delegate webRequestControllerStopLoading:self]; @@ -291,7 +317,7 @@ } WKNavigation* navigation = - [webView loadData:data + [self.webView loadData:data MIMEType:MIMEType characterEncodingName:base::SysUTF8ToNSString(base::kCodepageUTF8) baseURL:net::NSURLWithGURL(URL)]; @@ -304,17 +330,15 @@ forNavigation:navigation]; } -- (void)loadHTML:(NSString*)HTML - webView:(WKWebView*)webView - forURL:(const GURL&)URL { +- (void)loadHTML:(NSString*)HTML forURL:(const GURL&)URL { DCHECK(HTML.length); // Remove the transient content view. self.webState->ClearTransientContent(); self.navigationHandler.navigationState = web::WKNavigationState::REQUESTED; - WKNavigation* navigation = [webView loadHTMLString:HTML - baseURL:net::NSURLWithGURL(URL)]; + WKNavigation* navigation = + [self.webView loadHTMLString:HTML baseURL:net::NSURLWithGURL(URL)]; [self.navigationHandler.navigationStates setState:web::WKNavigationState::REQUESTED forNavigation:navigation]; @@ -336,8 +360,7 @@ context->SetItem(self.navigationManagerImpl->ReleasePendingItem()); } } else { - context = [_delegate webRequestController:self - registerLoadRequestForURL:URL + context = [self registerLoadRequestForURL:URL referrer:web::Referrer() transition:loadHTMLTransition sameDocumentNavigation:NO @@ -351,6 +374,194 @@ forNavigation:navigation]; } +- (std::unique_ptr<web::NavigationContextImpl>) + registerLoadRequestForURL:(const GURL&)URL + sameDocumentNavigation:(BOOL)sameDocumentNavigation + hasUserGesture:(BOOL)hasUserGesture + rendererInitiated:(BOOL)rendererInitiated + placeholderNavigation:(BOOL)placeholderNavigation { + // Get the navigation type from the last main frame load request, and try to + // map that to a PageTransition. + WKNavigationType navigationType = + self.navigationHandler.pendingNavigationInfo + ? self.navigationHandler.pendingNavigationInfo.navigationType + : WKNavigationTypeOther; + ui::PageTransition transition = + [self.navigationHandler pageTransitionFromNavigationType:navigationType]; + + if (web::GetWebClient()->IsSlimNavigationManagerEnabled() && + navigationType == WKNavigationTypeBackForward && + self.webView.backForwardList.currentItem) { + web::NavigationItem* currentItem = [[CRWNavigationItemHolder + holderForBackForwardListItem:self.webView.backForwardList.currentItem] + navigationItem]; + if (currentItem) { + transition = ui::PageTransitionFromInt(transition | + currentItem->GetTransitionType()); + } + } + + // The referrer is not known yet, and will be updated later. + const web::Referrer emptyReferrer; + std::unique_ptr<web::NavigationContextImpl> context = + [self registerLoadRequestForURL:URL + referrer:emptyReferrer + transition:transition + sameDocumentNavigation:sameDocumentNavigation + hasUserGesture:hasUserGesture + rendererInitiated:rendererInitiated + placeholderNavigation:placeholderNavigation]; + context->SetWKNavigationType(navigationType); + return context; +} + +- (std::unique_ptr<web::NavigationContextImpl>) + registerLoadRequestForURL:(const GURL&)requestURL + referrer:(const web::Referrer&)referrer + transition:(ui::PageTransition)transition + sameDocumentNavigation:(BOOL)sameDocumentNavigation + hasUserGesture:(BOOL)hasUserGesture + rendererInitiated:(BOOL)rendererInitiated + placeholderNavigation:(BOOL)placeholderNavigation { + // Transfer time is registered so that further transitions within the time + // envelope are not also registered as links. + [_delegate + webRequestControllerUserInteractionState:self] -> ResetLastTransferTime(); + + // Add or update pending item before any WebStateObserver callbacks. + // See https://crbug.com/842151 for a scenario where this is important. + web::NavigationItem* item = + self.navigationManagerImpl->GetPendingItemInCurrentOrRestoredSession(); + if (item) { + // Update the existing pending entry. + // Typically on PAGE_TRANSITION_CLIENT_REDIRECT. + // Don't update if request is a placeholder entry because the pending item + // should have the original target URL. + // Don't update if pending URL has a different origin, because client + // redirects can not change the origin. It is possible to have more than one + // pending navigations, so the redirect does not necesserily belong to the + // pending navigation item. + if (!placeholderNavigation && + item->GetURL().GetOrigin() == requestURL.GetOrigin()) { + self.navigationManagerImpl->UpdatePendingItemUrl(requestURL); + } + } else { + self.navigationManagerImpl->AddPendingItem( + requestURL, referrer, transition, + rendererInitiated ? web::NavigationInitiationType::RENDERER_INITIATED + : web::NavigationInitiationType::BROWSER_INITIATED, + web::NavigationManager::UserAgentOverrideOption::INHERIT); + item = + self.navigationManagerImpl->GetPendingItemInCurrentOrRestoredSession(); + } + + bool redirect = transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK; + if (!redirect) { + // Before changing navigation state, the delegate should be informed that + // any existing request is being cancelled before completion. + [self.navigationHandler loadCancelled]; + DCHECK_EQ(web::WKNavigationState::FINISHED, + self.navigationHandler.navigationState); + } + + self.navigationHandler.navigationState = web::WKNavigationState::REQUESTED; + + // Record the state of outgoing web view. Do nothing if native controller + // exists, because in that case recordStateInHistory will record the state + // of incoming page as native controller is already inserted. + // TODO(crbug.com/811770) Don't record state under WKBasedNavigationManager + // because it may incorrectly clobber the incoming page if this is a + // back/forward navigation. WKWebView restores page scroll state for web view + // pages anyways so this only impacts user if WKWebView is deleted. + if (!redirect && + ![[_delegate webRequestControllerLegacyNativeContentController:self] + hasController] && + !web::GetWebClient()->IsSlimNavigationManagerEnabled()) { + [_delegate webRequestControllerRecordStateInHistory:self]; + } + + std::unique_ptr<web::NavigationContextImpl> context = + web::NavigationContextImpl::CreateNavigationContext( + self.webState, requestURL, hasUserGesture, transition, + rendererInitiated); + context->SetPlaceholderNavigation(placeholderNavigation); + + // TODO(crbug.com/676129): LegacyNavigationManagerImpl::AddPendingItem does + // not create a pending item in case of reload. Remove this workaround once + // the bug is fixed or WKBasedNavigationManager is fully adopted. + if (!item) { + DCHECK(!web::GetWebClient()->IsSlimNavigationManagerEnabled()); + item = self.navigationManagerImpl->GetLastCommittedItem(); + } + + context->SetNavigationItemUniqueID(item->GetUniqueID()); + context->SetIsPost([self.navigationHandler isCurrentNavigationItemPOST]); + context->SetIsSameDocument(sameDocumentNavigation); + + if (!IsWKInternalUrl(requestURL) && !placeholderNavigation) { + self.webState->SetIsLoading(true); + } + + // WKWebView may have multiple pending items. Move pending item ownership from + // NavigationManager to NavigationContext. NavigationManager owns pending item + // after navigation was requested and until NavigationContext is created. + if (web::features::StorePendingItemInContext()) { + // No need to transfer the ownership for NativeContent URLs, because the + // load of NativeContent is synchronous. No need to transfer the ownership + // for WebUI navigations, because those navigation do not have access to + // NavigationContext. + if (![[_delegate webRequestControllerLegacyNativeContentController:self] + shouldLoadURLInNativeView:context->GetUrl()]) { + if (self.navigationManagerImpl->GetPendingItemIndex() == -1) { + context->SetItem(self.navigationManagerImpl->ReleasePendingItem()); + } + } + } + + return context; +} + +- (void)didFinishWithURL:(const GURL&)currentURL + loadSuccess:(BOOL)loadSuccess + context:(nullable const web::NavigationContextImpl*)context { + DCHECK_EQ(web::WKNavigationState::FINISHED, + self.navigationHandler.navigationState); + + [_delegate webRequestControllerRestoreStateFromHistory:self]; + + // Placeholder and restore session URLs are implementation details so should + // not notify WebStateObservers. If |context| is nullptr, don't skip + // placeholder URLs because this may be the only opportunity to update + // |isLoading| for native view reload. + + if (context && context->IsPlaceholderNavigation()) + return; + + if (context && IsRestoreSessionUrl(context->GetUrl())) + return; + + if (IsRestoreSessionUrl(net::GURLWithNSURL(self.webView.URL))) + return; + + if (context && context->IsLoadingErrorPage()) + return; + + if (!loadSuccess) { + // WebStateObserver callbacks will be called for load failure after + // loading placeholder URL. + return; + } + + if (![self.navigationHandler.navigationStates + lastNavigationWithPendingItemInNavigationContext] || + !web::features::StorePendingItemInContext()) { + self.webState->SetIsLoading(false); + } else { + // There is another pending navigation, so the state is still loading. + } + self.webState->OnPageLoaded(currentURL, YES); +} + // Reports Navigation.IOSWKWebViewSlowFastBackForward UMA. No-op if pending // navigation is not back forward navigation. - (void)reportBackForwardNavigationTypeForFastNavigation:(BOOL)isFast { @@ -408,11 +619,10 @@ // Returns YES if the given WKBackForwardListItem is valid to use for // navigation. -- (BOOL)isBackForwardListItemValid:(WKBackForwardListItem*)item - webView:(WKWebView*)webView { +- (BOOL)isBackForwardListItemValid:(WKBackForwardListItem*)item { // The current back-forward list item MUST be in the WKWebView's back-forward // list to be valid. - WKBackForwardList* list = webView.backForwardList; + WKBackForwardList* list = self.webView.backForwardList; return list.currentItem == item || [list.forwardList indexOfObject:item] != NSNotFound || [list.backList indexOfObject:item] != NSNotFound; @@ -453,4 +663,14 @@ return currentItem ? currentItem->GetHttpRequestHeaders() : nil; } +#pragma mark - Private methods + +- (WKWebView*)webView { + return [_delegate webRequestControllerWebView:self]; +} + +- (CRWWKNavigationHandler*)navigationHandler { + return [_delegate webRequestControllerNavigationHandler:self]; +} + @end
diff --git a/net/quic/bidirectional_stream_quic_impl_unittest.cc b/net/quic/bidirectional_stream_quic_impl_unittest.cc index 44a6697..d2d046b 100644 --- a/net/quic/bidirectional_stream_quic_impl_unittest.cc +++ b/net/quic/bidirectional_stream_quic_impl_unittest.cc
@@ -414,8 +414,8 @@ BidirectionalStreamQuicImplTest() : version_(std::get<0>(GetParam())), client_headers_include_h2_stream_dependency_(std::get<1>(GetParam())), - crypto_config_(quic::test::crypto_test_utils::ProofVerifierForTesting(), - quic::TlsClientHandshaker::CreateSslCtx()), + crypto_config_( + quic::test::crypto_test_utils::ProofVerifierForTesting()), read_buffer_(base::MakeRefCounted<IOBufferWithSize>(4096)), connection_id_(quic::test::TestConnectionId(2)), stream_id_(GetNthClientInitiatedBidirectionalStreamId(0)),
diff --git a/net/quic/quic_chromium_client_session_test.cc b/net/quic/quic_chromium_client_session_test.cc index 69111374..744f462 100644 --- a/net/quic/quic_chromium_client_session_test.cc +++ b/net/quic/quic_chromium_client_session_test.cc
@@ -93,8 +93,8 @@ QuicChromiumClientSessionTest() : version_(std::get<0>(GetParam())), client_headers_include_h2_stream_dependency_(std::get<1>(GetParam())), - crypto_config_(quic::test::crypto_test_utils::ProofVerifierForTesting(), - quic::TlsClientHandshaker::CreateSslCtx()), + crypto_config_( + quic::test::crypto_test_utils::ProofVerifierForTesting()), default_read_(new MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)), socket_data_( new SequencedSocketData(base::make_span(default_read_.get(), 1),
diff --git a/net/quic/quic_chromium_client_stream_test.cc b/net/quic/quic_chromium_client_stream_test.cc index 97a65559..7dac6426 100644 --- a/net/quic/quic_chromium_client_stream_test.cc +++ b/net/quic/quic_chromium_client_stream_test.cc
@@ -161,8 +161,8 @@ public WithScopedTaskEnvironment { public: QuicChromiumClientStreamTest() - : crypto_config_(quic::test::crypto_test_utils::ProofVerifierForTesting(), - quic::TlsClientHandshaker::CreateSslCtx()), + : crypto_config_( + quic::test::crypto_test_utils::ProofVerifierForTesting()), session_(new quic::test::MockQuicConnection( &helper_, &alarm_factory_,
diff --git a/net/quic/quic_http_stream_test.cc b/net/quic/quic_http_stream_test.cc index 7205e90..f70c2c1 100644 --- a/net/quic/quic_http_stream_test.cc +++ b/net/quic/quic_http_stream_test.cc
@@ -196,8 +196,8 @@ QuicHttpStreamTest() : version_(std::get<0>(GetParam())), client_headers_include_h2_stream_dependency_(std::get<1>(GetParam())), - crypto_config_(quic::test::crypto_test_utils::ProofVerifierForTesting(), - quic::TlsClientHandshaker::CreateSslCtx()), + crypto_config_( + quic::test::crypto_test_utils::ProofVerifierForTesting()), read_buffer_(base::MakeRefCounted<IOBufferWithSize>(4096)), promise_id_(GetNthServerInitiatedUnidirectionalStreamId(0)), stream_id_(GetNthClientInitiatedBidirectionalStreamId(0)),
diff --git a/net/quic/quic_proxy_client_socket_unittest.cc b/net/quic/quic_proxy_client_socket_unittest.cc index ad8a08c..6e5dcf1 100644 --- a/net/quic/quic_proxy_client_socket_unittest.cc +++ b/net/quic/quic_proxy_client_socket_unittest.cc
@@ -129,8 +129,8 @@ quic::QuicUtils::StreamIdDelta(version_.transport_version)), client_headers_include_h2_stream_dependency_(std::get<1>(GetParam())), mock_quic_data_(version_), - crypto_config_(quic::test::crypto_test_utils::ProofVerifierForTesting(), - quic::TlsClientHandshaker::CreateSslCtx()), + crypto_config_( + quic::test::crypto_test_utils::ProofVerifierForTesting()), connection_id_(quic::test::TestConnectionId(2)), client_maker_(version_, connection_id_,
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc index 45f6e1e..40fedcd 100644 --- a/net/quic/quic_stream_factory.cc +++ b/net/quic/quic_stream_factory.cc
@@ -204,11 +204,6 @@ return config; } -bssl::UniquePtr<SSL_CTX> QuicStreamFactoryCreateSslCtx() { - crypto::EnsureOpenSSLInit(); - return quic::TlsClientHandshaker::CreateSslCtx(); -} - // An implementation of quic::QuicCryptoClientConfig::ServerIdFilter that wraps // an |origin_filter|. class ServerIdOriginFilter @@ -1102,8 +1097,7 @@ std::make_unique<ProofVerifierChromium>(cert_verifier, ct_policy_enforcer, transport_security_state, - cert_transparency_verifier), - QuicStreamFactoryCreateSslCtx()), + cert_transparency_verifier)), mark_quic_broken_when_network_blackholes_( mark_quic_broken_when_network_blackholes), store_server_configs_in_properties_(store_server_configs_in_properties),
diff --git a/net/tools/quic/quic_simple_server.cc b/net/tools/quic/quic_simple_server.cc index c5ad9cf..35748907d 100644 --- a/net/tools/quic/quic_simple_server.cc +++ b/net/tools/quic/quic_simple_server.cc
@@ -56,8 +56,7 @@ crypto_config_(kSourceAddressTokenSecret, quic::QuicRandom::GetInstance(), std::move(proof_source), - quic::KeyExchangeSource::Default(), - quic::TlsServerHandshaker::CreateSslCtx()), + quic::KeyExchangeSource::Default()), read_pending_(false), synchronous_read_count_(0), read_buffer_(base::MakeRefCounted<IOBufferWithSize>(kReadBufferSize)),
diff --git a/net/tools/quic/quic_simple_server_test.cc b/net/tools/quic/quic_simple_server_test.cc index 1a9cf12b..83f0f2cc 100644 --- a/net/tools/quic/quic_simple_server_test.cc +++ b/net/tools/quic/quic_simple_server_test.cc
@@ -30,8 +30,7 @@ : crypto_config_("blah", quic::QuicRandom::GetInstance(), quic::test::crypto_test_utils::ProofSourceForTesting(), - quic::KeyExchangeSource::Default(), - quic::TlsServerHandshaker::CreateSslCtx()), + quic::KeyExchangeSource::Default()), version_manager_(quic::AllSupportedVersions()), dispatcher_(&config_, &crypto_config_,
diff --git a/services/identity/public/cpp/DEPS b/services/identity/public/cpp/DEPS index 322304f..794a290 100644 --- a/services/identity/public/cpp/DEPS +++ b/services/identity/public/cpp/DEPS
@@ -10,6 +10,7 @@ "+components/signin/core/browser/list_accounts_test_utils.h", "+components/signin/core/browser/oauth2_token_service_delegate_android.h", "+components/signin/core/browser/signin_buildflags.h", + "+components/signin/core/browser/signin_client.h", "+components/signin/core/browser/signin_metrics.h", "+components/signin/core/browser/signin_pref_names.h", "+components/signin/core/browser/signin_switches.h",
diff --git a/services/identity/public/cpp/identity_manager.cc b/services/identity/public/cpp/identity_manager.cc index 0588de90..a8133ec0 100644 --- a/services/identity/public/cpp/identity_manager.cc +++ b/services/identity/public/cpp/identity_manager.cc
@@ -6,10 +6,12 @@ #include <string> +#include "base/bind.h" #include "build/build_config.h" #include "components/signin/core/browser/account_fetcher_service.h" #include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/gaia_cookie_manager_service.h" +#include "components/signin/core/browser/primary_account_manager.h" #include "components/signin/core/browser/profile_oauth2_token_service.h" #include "components/signin/core/browser/ubertoken_fetcher_impl.h" #include "google_apis/gaia/gaia_auth_util.h" @@ -64,13 +66,28 @@ DCHECK(account_fetcher_service_); DCHECK(accounts_cookie_mutator_); DCHECK(diagnostics_provider_); - primary_account_manager_->SetObserver(this); - token_service_->AddDiagnosticsObserver(this); + + // IdentityManager will outlive the PrimaryAccountManager, so base::Unretained + // is safe. + primary_account_manager_->SetGoogleSigninSucceededCallback( + base::BindRepeating(&IdentityManager::GoogleSigninSucceeded, + base::Unretained(this))); + primary_account_manager_->SetAuthenticatedAccountSetCallback( + base::BindRepeating(&IdentityManager::AuthenticatedAccountSet, + base::Unretained(this))); + primary_account_manager_->SetAuthenticatedAccountClearedCallback( + base::BindRepeating(&IdentityManager::AuthenticatedAccountCleared, + base::Unretained(this))); +#if !defined(OS_CHROMEOS) + primary_account_manager_->SetGoogleSignedOutCallback(base::BindRepeating( + &IdentityManager::GoogleSignedOut, base::Unretained(this))); +#endif + token_service_->AddObserver(this); token_service_->AddAccessTokenDiagnosticsObserver(this); - // IdentityManager owns the ATS and GCMS instances and will outlive them, so - // base::Unretained is safe. + // IdentityManager owns the ATS, GCMS and PO2TS instances and will outlive + // them, so base::Unretained is safe. account_tracker_service_->SetOnAccountUpdatedCallback(base::BindRepeating( &IdentityManager::OnAccountUpdated, base::Unretained(this))); account_tracker_service_->SetOnAccountRemovedCallback(base::BindRepeating( @@ -81,6 +98,12 @@ gaia_cookie_manager_service_->SetGaiaCookieDeletedByUserActionCallback( base::BindRepeating(&IdentityManager::OnGaiaCookieDeletedByUserAction, base::Unretained(this))); + token_service_->SetRefreshTokenAvailableFromSourceCallback( + base::BindRepeating(&IdentityManager::OnRefreshTokenAvailableFromSource, + base::Unretained(this))); + token_service_->SetRefreshTokenRevokedFromSourceCallback( + base::BindRepeating(&IdentityManager::OnRefreshTokenRevokedFromSource, + base::Unretained(this))); // Seed the primary account with any state that |primary_account_manager_| // loaded from prefs. @@ -98,9 +121,7 @@ token_service_->Shutdown(); account_tracker_service_->Shutdown(); - primary_account_manager_->ClearObserver(); token_service_->RemoveObserver(this); - token_service_->RemoveDiagnosticsObserver(this); token_service_->RemoveAccessTokenDiagnosticsObserver(this); }
diff --git a/services/identity/public/cpp/identity_manager.h b/services/identity/public/cpp/identity_manager.h index 8514908..4dbc919 100644 --- a/services/identity/public/cpp/identity_manager.h +++ b/services/identity/public/cpp/identity_manager.h
@@ -12,9 +12,9 @@ #include "base/observer_list.h" #include "build/build_config.h" #include "components/signin/core/browser/account_info.h" -#include "components/signin/core/browser/primary_account_manager.h" #include "components/signin/core/browser/signin_metrics.h" #include "components/signin/core/browser/ubertoken_fetcher.h" +#include "google_apis/gaia/gaia_auth_fetcher.h" #include "google_apis/gaia/oauth2_token_service_observer.h" #include "services/identity/public/cpp/access_token_fetcher.h" #include "services/identity/public/cpp/accounts_in_cookie_jar_info.h" @@ -36,6 +36,7 @@ class AccountFetcherService; class AccountTrackerService; class GaiaCookieManagerService; +class PrimaryAccountManager; class ProfileOAuth2TokenService; namespace identity { @@ -51,9 +52,7 @@ // Gives access to information about the user's Google identities. See // ./README.md for detailed documentation. -class IdentityManager : public PrimaryAccountManager::Observer, - public OAuth2TokenService::DiagnosticsObserver, - public AccessTokenDiagnosticsObserver, +class IdentityManager : public AccessTokenDiagnosticsObserver, public OAuth2TokenServiceObserver { public: class Observer { @@ -576,11 +575,11 @@ AccountInfo GetAccountInfoForAccountWithRefreshToken( const CoreAccountId& account_id) const; - // PrimaryAccountManager::Observer: - void GoogleSigninSucceeded(const AccountInfo& account_info) override; - void GoogleSignedOut(const AccountInfo& account_info) override; - void AuthenticatedAccountSet(const AccountInfo& account_info) override; - void AuthenticatedAccountCleared() override; + // PrimaryAccountManager callbacks: + void GoogleSigninSucceeded(const AccountInfo& account_info); + void GoogleSignedOut(const AccountInfo& account_info); + void AuthenticatedAccountSet(const AccountInfo& account_info); + void AuthenticatedAccountCleared(); // OAuth2TokenServiceObserver: void OnRefreshTokenAvailable(const CoreAccountId& account_id) override; @@ -608,12 +607,13 @@ base::Time expiration_time) override; void OnAccessTokenRemoved(const CoreAccountId& account_id, const ScopeSet& scopes) override; - // OAuth2TokenService::DiagnosticsObserver: + + // ProfileOAuth2TokenService callbacks: void OnRefreshTokenAvailableFromSource(const CoreAccountId& account_id, bool is_refresh_token_valid, - const std::string& source) override; + const std::string& source); void OnRefreshTokenRevokedFromSource(const CoreAccountId& account_id, - const std::string& source) override; + const std::string& source); // AccountTrackerService callbacks: void OnAccountUpdated(const AccountInfo& info);
diff --git a/services/identity/public/cpp/identity_test_environment.h b/services/identity/public/cpp/identity_test_environment.h index c1dbeb0..ffbedbab 100644 --- a/services/identity/public/cpp/identity_test_environment.h +++ b/services/identity/public/cpp/identity_test_environment.h
@@ -8,6 +8,7 @@ #include "base/optional.h" #include "build/build_config.h" #include "components/signin/core/browser/account_consistency_method.h" +#include "components/signin/core/browser/signin_client.h" #include "services/identity/public/cpp/accounts_cookie_mutator_impl.h" #include "services/identity/public/cpp/diagnostics_provider_impl.h" #include "services/identity/public/cpp/identity_manager.h"
diff --git a/services/identity/public/cpp/identity_test_utils.cc b/services/identity/public/cpp/identity_test_utils.cc index 349dfcf..988326bc 100644 --- a/services/identity/public/cpp/identity_test_utils.cc +++ b/services/identity/public/cpp/identity_test_utils.cc
@@ -12,6 +12,7 @@ #include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/gaia_cookie_manager_service.h" #include "components/signin/core/browser/list_accounts_test_utils.h" +#include "components/signin/core/browser/primary_account_manager.h" #include "components/signin/core/browser/profile_oauth2_token_service.h" #include "google_apis/gaia/gaia_auth_util.h" #include "services/identity/public/cpp/identity_manager.h"
diff --git a/services/tracing/public/cpp/trace_startup.cc b/services/tracing/public/cpp/trace_startup.cc index f11df22..cc7b9814 100644 --- a/services/tracing/public/cpp/trace_startup.cc +++ b/services/tracing/public/cpp/trace_startup.cc
@@ -38,7 +38,8 @@ if (startup_config->IsEnabled()) { if (TracingUsesPerfettoBackend()) { TraceEventDataSource::GetInstance()->SetupStartupTracing( - startup_config->GetBackgroundStartupTracingEnabled()); + startup_config->GetSessionOwner() == + TraceStartupConfig::SessionOwner::kBackgroundTracing); } const TraceConfig& trace_config = startup_config->GetTraceConfig();
diff --git a/third_party/blink/public/mojom/worker/shared_worker_host.mojom b/third_party/blink/public/mojom/worker/shared_worker_host.mojom index 01434ba..5daf8c43 100644 --- a/third_party/blink/public/mojom/worker/shared_worker_host.mojom +++ b/third_party/blink/public/mojom/worker/shared_worker_host.mojom
@@ -21,9 +21,6 @@ // Indicates that the shared worker is ready for inspection. OnReadyForInspection(); - // Indicates that the script successfully loaded. - OnScriptLoaded(); - // Indicates that the script failed to load. OnScriptLoadFailed();
diff --git a/third_party/blink/public/web/web_shared_worker_client.h b/third_party/blink/public/web/web_shared_worker_client.h index 49ab604..c6724ab4 100644 --- a/third_party/blink/public/web/web_shared_worker_client.h +++ b/third_party/blink/public/web/web_shared_worker_client.h
@@ -51,7 +51,6 @@ virtual void WorkerContextClosed() = 0; virtual void WorkerContextDestroyed() = 0; virtual void WorkerReadyForInspection() {} - virtual void WorkerScriptLoaded() = 0; virtual void WorkerScriptLoadFailed() = 0; virtual void WorkerScriptEvaluated(bool success) = 0; // Called on the main thread during initialization, before requesting the main
diff --git a/third_party/blink/renderer/bindings/templates/callback_function.cc.tmpl b/third_party/blink/renderer/bindings/templates/callback_function.cc.tmpl index c4e1ea8b..42fa4af 100644 --- a/third_party/blink/renderer/bindings/templates/callback_function.cc.tmpl +++ b/third_party/blink/renderer/bindings/templates/callback_function.cc.tmpl
@@ -85,26 +85,6 @@ } {% endif %} -v8::Maybe<{{return_cpp_type}}> V8PersistentCallbackFunction<{{cpp_class}}>::Invoke({{argument_declarations | join(', ')}}) { - return Proxy()->Invoke( - {{ - (['callback_this_value'] + - (arguments|map(attribute='name')|list) - )|join(', ') - }}); -} - -{% if idl_type == 'void' or callback_function_name == 'Function' %} -void V8PersistentCallbackFunction<{{cpp_class}}>::InvokeAndReportException({{argument_declarations | join(', ')}}) { - Proxy()->InvokeAndReportException( - {{ - (['callback_this_value'] + - (arguments|map(attribute='name')|list) - )|join(', ') - }}); -} -{% endif %} - } // namespace blink {% endfilter %}{# format_blink_cpp_source_code #}
diff --git a/third_party/blink/renderer/bindings/templates/callback_function.h.tmpl b/third_party/blink/renderer/bindings/templates/callback_function.h.tmpl index 0d2f1562..d32ed1b 100644 --- a/third_party/blink/renderer/bindings/templates/callback_function.h.tmpl +++ b/third_party/blink/renderer/bindings/templates/callback_function.h.tmpl
@@ -67,33 +67,6 @@ {% endif %} }; -template <> -class V8PersistentCallbackFunction<{{cpp_class}}> final : public V8PersistentCallbackFunctionBase { - using V8CallbackFunction = {{cpp_class}}; - - public: - explicit V8PersistentCallbackFunction(V8CallbackFunction* callback_function) - : V8PersistentCallbackFunctionBase(callback_function) {} - ~V8PersistentCallbackFunction() override = default; - - // Returns a wrapper-tracing version of this callback function. - V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - - v8::Maybe<{{return_cpp_type}}> Invoke({{argument_declarations | join(', ')}}) WARN_UNUSED_RESULT; -{% if idl_type == 'void' or callback_function_name == 'Function' %} - {{exported}}void InvokeAndReportException({{argument_declarations | join(', ')}}); -{% endif %} - - private: - V8CallbackFunction* Proxy() { - return As<V8CallbackFunction>(); - } - - template <typename V8CallbackFunction> - friend V8PersistentCallbackFunction<V8CallbackFunction>* - ToV8PersistentCallbackFunction(V8CallbackFunction*); -}; - } // namespace blink #endif // {{header_guard}}
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_optional_any_arg.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_optional_any_arg.cc index 094489bf..6c778ca 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_optional_any_arg.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_optional_any_arg.cc
@@ -228,9 +228,4 @@ } } -v8::Maybe<ScriptValue> V8PersistentCallbackFunction<V8AnyCallbackFunctionOptionalAnyArg>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, ScriptValue optionalAnyArg) { - return Proxy()->Invoke( - callback_this_value, optionalAnyArg); -} - } // namespace blink
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_optional_any_arg.h b/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_optional_any_arg.h index a491c7e1..b7bebe8e0 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_optional_any_arg.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_optional_any_arg.h
@@ -40,30 +40,6 @@ v8::Maybe<ScriptValue> Construct(ScriptValue optionalAnyArg) WARN_UNUSED_RESULT; }; -template <> -class V8PersistentCallbackFunction<V8AnyCallbackFunctionOptionalAnyArg> final : public V8PersistentCallbackFunctionBase { - using V8CallbackFunction = V8AnyCallbackFunctionOptionalAnyArg; - - public: - explicit V8PersistentCallbackFunction(V8CallbackFunction* callback_function) - : V8PersistentCallbackFunctionBase(callback_function) {} - ~V8PersistentCallbackFunction() override = default; - - // Returns a wrapper-tracing version of this callback function. - V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - - v8::Maybe<ScriptValue> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, ScriptValue optionalAnyArg) WARN_UNUSED_RESULT; - - private: - V8CallbackFunction* Proxy() { - return As<V8CallbackFunction>(); - } - - template <typename V8CallbackFunction> - friend V8PersistentCallbackFunction<V8CallbackFunction>* - ToV8PersistentCallbackFunction(V8CallbackFunction*); -}; - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_TESTS_RESULTS_CORE_V8_ANY_CALLBACK_FUNCTION_OPTIONAL_ANY_ARG_H_
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_variadic_any_args.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_variadic_any_args.cc index ffec84e..2221532 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_variadic_any_args.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_variadic_any_args.cc
@@ -242,9 +242,4 @@ } } -v8::Maybe<ScriptValue> V8PersistentCallbackFunction<V8AnyCallbackFunctionVariadicAnyArgs>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const Vector<ScriptValue>& arguments) { - return Proxy()->Invoke( - callback_this_value, arguments); -} - } // namespace blink
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_variadic_any_args.h b/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_variadic_any_args.h index c5a3279..0d90338 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_variadic_any_args.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_variadic_any_args.h
@@ -40,30 +40,6 @@ v8::Maybe<ScriptValue> Construct(const Vector<ScriptValue>& arguments) WARN_UNUSED_RESULT; }; -template <> -class V8PersistentCallbackFunction<V8AnyCallbackFunctionVariadicAnyArgs> final : public V8PersistentCallbackFunctionBase { - using V8CallbackFunction = V8AnyCallbackFunctionVariadicAnyArgs; - - public: - explicit V8PersistentCallbackFunction(V8CallbackFunction* callback_function) - : V8PersistentCallbackFunctionBase(callback_function) {} - ~V8PersistentCallbackFunction() override = default; - - // Returns a wrapper-tracing version of this callback function. - V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - - v8::Maybe<ScriptValue> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const Vector<ScriptValue>& arguments) WARN_UNUSED_RESULT; - - private: - V8CallbackFunction* Proxy() { - return As<V8CallbackFunction>(); - } - - template <typename V8CallbackFunction> - friend V8PersistentCallbackFunction<V8CallbackFunction>* - ToV8PersistentCallbackFunction(V8CallbackFunction*); -}; - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_TESTS_RESULTS_CORE_V8_ANY_CALLBACK_FUNCTION_VARIADIC_ANY_ARGS_H_
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_for_each_iterator_callback.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_for_each_iterator_callback.cc index 93766eb8..876f3b4a 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_for_each_iterator_callback.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_for_each_iterator_callback.cc
@@ -125,14 +125,4 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8ForEachIteratorCallback>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, ScriptValue value, ScriptValue key, ScriptValue obj) { - return Proxy()->Invoke( - callback_this_value, value, key, obj); -} - -void V8PersistentCallbackFunction<V8ForEachIteratorCallback>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, ScriptValue value, ScriptValue key, ScriptValue obj) { - Proxy()->InvokeAndReportException( - callback_this_value, value, key, obj); -} - } // namespace blink
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_for_each_iterator_callback.h b/third_party/blink/renderer/bindings/tests/results/core/v8_for_each_iterator_callback.h index 42e5e76..464e02b1 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_for_each_iterator_callback.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_for_each_iterator_callback.h
@@ -40,31 +40,6 @@ void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, ScriptValue value, ScriptValue key, ScriptValue obj); }; -template <> -class V8PersistentCallbackFunction<V8ForEachIteratorCallback> final : public V8PersistentCallbackFunctionBase { - using V8CallbackFunction = V8ForEachIteratorCallback; - - public: - explicit V8PersistentCallbackFunction(V8CallbackFunction* callback_function) - : V8PersistentCallbackFunctionBase(callback_function) {} - ~V8PersistentCallbackFunction() override = default; - - // Returns a wrapper-tracing version of this callback function. - V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - - v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, ScriptValue value, ScriptValue key, ScriptValue obj) WARN_UNUSED_RESULT; - CORE_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, ScriptValue value, ScriptValue key, ScriptValue obj); - - private: - V8CallbackFunction* Proxy() { - return As<V8CallbackFunction>(); - } - - template <typename V8CallbackFunction> - friend V8PersistentCallbackFunction<V8CallbackFunction>* - ToV8PersistentCallbackFunction(V8CallbackFunction*); -}; - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_TESTS_RESULTS_CORE_V8_FOR_EACH_ITERATOR_CALLBACK_H_
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_long_callback_function.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_long_callback_function.cc index a1df6c2..6e4b5c14 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_long_callback_function.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_long_callback_function.cc
@@ -126,9 +126,4 @@ } } -v8::Maybe<int32_t> V8PersistentCallbackFunction<V8LongCallbackFunction>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, int32_t num1, int32_t num2) { - return Proxy()->Invoke( - callback_this_value, num1, num2); -} - } // namespace blink
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_long_callback_function.h b/third_party/blink/renderer/bindings/tests/results/core/v8_long_callback_function.h index d6ca091..08b70331 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_long_callback_function.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_long_callback_function.h
@@ -36,30 +36,6 @@ v8::Maybe<int32_t> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, int32_t num1, int32_t num2) WARN_UNUSED_RESULT; }; -template <> -class V8PersistentCallbackFunction<V8LongCallbackFunction> final : public V8PersistentCallbackFunctionBase { - using V8CallbackFunction = V8LongCallbackFunction; - - public: - explicit V8PersistentCallbackFunction(V8CallbackFunction* callback_function) - : V8PersistentCallbackFunctionBase(callback_function) {} - ~V8PersistentCallbackFunction() override = default; - - // Returns a wrapper-tracing version of this callback function. - V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - - v8::Maybe<int32_t> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, int32_t num1, int32_t num2) WARN_UNUSED_RESULT; - - private: - V8CallbackFunction* Proxy() { - return As<V8CallbackFunction>(); - } - - template <typename V8CallbackFunction> - friend V8PersistentCallbackFunction<V8CallbackFunction>* - ToV8PersistentCallbackFunction(V8CallbackFunction*); -}; - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_TESTS_RESULTS_CORE_V8_LONG_CALLBACK_FUNCTION_H_
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_string_sequence_callback_function_long_sequence_arg.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_string_sequence_callback_function_long_sequence_arg.cc index f086f959..9964d41 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_string_sequence_callback_function_long_sequence_arg.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_string_sequence_callback_function_long_sequence_arg.cc
@@ -125,9 +125,4 @@ } } -v8::Maybe<Vector<String>> V8PersistentCallbackFunction<V8StringSequenceCallbackFunctionLongSequenceArg>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const Vector<int32_t>& arg) { - return Proxy()->Invoke( - callback_this_value, arg); -} - } // namespace blink
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_string_sequence_callback_function_long_sequence_arg.h b/third_party/blink/renderer/bindings/tests/results/core/v8_string_sequence_callback_function_long_sequence_arg.h index 292ca81..581506e 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_string_sequence_callback_function_long_sequence_arg.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_string_sequence_callback_function_long_sequence_arg.h
@@ -36,30 +36,6 @@ v8::Maybe<Vector<String>> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const Vector<int32_t>& arg) WARN_UNUSED_RESULT; }; -template <> -class V8PersistentCallbackFunction<V8StringSequenceCallbackFunctionLongSequenceArg> final : public V8PersistentCallbackFunctionBase { - using V8CallbackFunction = V8StringSequenceCallbackFunctionLongSequenceArg; - - public: - explicit V8PersistentCallbackFunction(V8CallbackFunction* callback_function) - : V8PersistentCallbackFunctionBase(callback_function) {} - ~V8PersistentCallbackFunction() override = default; - - // Returns a wrapper-tracing version of this callback function. - V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - - v8::Maybe<Vector<String>> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const Vector<int32_t>& arg) WARN_UNUSED_RESULT; - - private: - V8CallbackFunction* Proxy() { - return As<V8CallbackFunction>(); - } - - template <typename V8CallbackFunction> - friend V8PersistentCallbackFunction<V8CallbackFunction>* - ToV8PersistentCallbackFunction(V8CallbackFunction*); -}; - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_TESTS_RESULTS_CORE_V8_STRING_SEQUENCE_CALLBACK_FUNCTION_LONG_SEQUENCE_ARG_H_
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_boolean_function.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_boolean_function.cc index 977b2fcc..12c2d4ea 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_boolean_function.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_boolean_function.cc
@@ -133,9 +133,4 @@ } } -v8::Maybe<bool> V8PersistentCallbackFunction<V8TreatNonObjectAsNullBooleanFunction>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { - return Proxy()->Invoke( - callback_this_value); -} - } // namespace blink
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_boolean_function.h b/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_boolean_function.h index 274e13b..14da73fe 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_boolean_function.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_boolean_function.h
@@ -36,30 +36,6 @@ v8::Maybe<bool> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; }; -template <> -class V8PersistentCallbackFunction<V8TreatNonObjectAsNullBooleanFunction> final : public V8PersistentCallbackFunctionBase { - using V8CallbackFunction = V8TreatNonObjectAsNullBooleanFunction; - - public: - explicit V8PersistentCallbackFunction(V8CallbackFunction* callback_function) - : V8PersistentCallbackFunctionBase(callback_function) {} - ~V8PersistentCallbackFunction() override = default; - - // Returns a wrapper-tracing version of this callback function. - V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - - v8::Maybe<bool> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; - - private: - V8CallbackFunction* Proxy() { - return As<V8CallbackFunction>(); - } - - template <typename V8CallbackFunction> - friend V8PersistentCallbackFunction<V8CallbackFunction>* - ToV8PersistentCallbackFunction(V8CallbackFunction*); -}; - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_TESTS_RESULTS_CORE_V8_TREAT_NON_OBJECT_AS_NULL_BOOLEAN_FUNCTION_H_
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_void_function.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_void_function.cc index 7f312cb0..b619b0c2 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_void_function.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_void_function.cc
@@ -120,14 +120,4 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8TreatNonObjectAsNullVoidFunction>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { - return Proxy()->Invoke( - callback_this_value); -} - -void V8PersistentCallbackFunction<V8TreatNonObjectAsNullVoidFunction>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { - Proxy()->InvokeAndReportException( - callback_this_value); -} - } // namespace blink
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_void_function.h b/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_void_function.h index ebc5b19..bb05acc 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_void_function.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_void_function.h
@@ -40,31 +40,6 @@ void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value); }; -template <> -class V8PersistentCallbackFunction<V8TreatNonObjectAsNullVoidFunction> final : public V8PersistentCallbackFunctionBase { - using V8CallbackFunction = V8TreatNonObjectAsNullVoidFunction; - - public: - explicit V8PersistentCallbackFunction(V8CallbackFunction* callback_function) - : V8PersistentCallbackFunctionBase(callback_function) {} - ~V8PersistentCallbackFunction() override = default; - - // Returns a wrapper-tracing version of this callback function. - V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - - v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; - CORE_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value); - - private: - V8CallbackFunction* Proxy() { - return As<V8CallbackFunction>(); - } - - template <typename V8CallbackFunction> - friend V8PersistentCallbackFunction<V8CallbackFunction>* - ToV8PersistentCallbackFunction(V8CallbackFunction*); -}; - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_TESTS_RESULTS_CORE_V8_TREAT_NON_OBJECT_AS_NULL_VOID_FUNCTION_H_
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function.cc index 396e4a7..9b439c9a 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function.cc
@@ -117,14 +117,4 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunction>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { - return Proxy()->Invoke( - callback_this_value); -} - -void V8PersistentCallbackFunction<V8VoidCallbackFunction>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { - Proxy()->InvokeAndReportException( - callback_this_value); -} - } // namespace blink
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function.h b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function.h index 45a27d2d..24aaf04 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function.h
@@ -40,31 +40,6 @@ void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value); }; -template <> -class V8PersistentCallbackFunction<V8VoidCallbackFunction> final : public V8PersistentCallbackFunctionBase { - using V8CallbackFunction = V8VoidCallbackFunction; - - public: - explicit V8PersistentCallbackFunction(V8CallbackFunction* callback_function) - : V8PersistentCallbackFunctionBase(callback_function) {} - ~V8PersistentCallbackFunction() override = default; - - // Returns a wrapper-tracing version of this callback function. - V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - - v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; - CORE_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value); - - private: - V8CallbackFunction* Proxy() { - return As<V8CallbackFunction>(); - } - - template <typename V8CallbackFunction> - friend V8PersistentCallbackFunction<V8CallbackFunction>* - ToV8PersistentCallbackFunction(V8CallbackFunction*); -}; - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_TESTS_RESULTS_CORE_V8_VOID_CALLBACK_FUNCTION_H_
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_dictionary_arg.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_dictionary_arg.cc index 94d6db7..873c964b 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_dictionary_arg.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_dictionary_arg.cc
@@ -123,14 +123,4 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionDictionaryArg>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const TestDictionary*& arg) { - return Proxy()->Invoke( - callback_this_value, arg); -} - -void V8PersistentCallbackFunction<V8VoidCallbackFunctionDictionaryArg>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const TestDictionary*& arg) { - Proxy()->InvokeAndReportException( - callback_this_value, arg); -} - } // namespace blink
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_dictionary_arg.h b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_dictionary_arg.h index 887a48c1..cbd13dde 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_dictionary_arg.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_dictionary_arg.h
@@ -42,31 +42,6 @@ void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const TestDictionary*& arg); }; -template <> -class V8PersistentCallbackFunction<V8VoidCallbackFunctionDictionaryArg> final : public V8PersistentCallbackFunctionBase { - using V8CallbackFunction = V8VoidCallbackFunctionDictionaryArg; - - public: - explicit V8PersistentCallbackFunction(V8CallbackFunction* callback_function) - : V8PersistentCallbackFunctionBase(callback_function) {} - ~V8PersistentCallbackFunction() override = default; - - // Returns a wrapper-tracing version of this callback function. - V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - - v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const TestDictionary*& arg) WARN_UNUSED_RESULT; - CORE_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const TestDictionary*& arg); - - private: - V8CallbackFunction* Proxy() { - return As<V8CallbackFunction>(); - } - - template <typename V8CallbackFunction> - friend V8PersistentCallbackFunction<V8CallbackFunction>* - ToV8PersistentCallbackFunction(V8CallbackFunction*); -}; - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_TESTS_RESULTS_CORE_V8_VOID_CALLBACK_FUNCTION_DICTIONARY_ARG_H_
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_enum_arg.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_enum_arg.cc index c30e9abe..6db5c2e 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_enum_arg.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_enum_arg.cc
@@ -143,14 +143,4 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionEnumArg>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) { - return Proxy()->Invoke( - callback_this_value, arg); -} - -void V8PersistentCallbackFunction<V8VoidCallbackFunctionEnumArg>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) { - Proxy()->InvokeAndReportException( - callback_this_value, arg); -} - } // namespace blink
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_enum_arg.h b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_enum_arg.h index 4bc6d50..497784e 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_enum_arg.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_enum_arg.h
@@ -40,31 +40,6 @@ void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg); }; -template <> -class V8PersistentCallbackFunction<V8VoidCallbackFunctionEnumArg> final : public V8PersistentCallbackFunctionBase { - using V8CallbackFunction = V8VoidCallbackFunctionEnumArg; - - public: - explicit V8PersistentCallbackFunction(V8CallbackFunction* callback_function) - : V8PersistentCallbackFunctionBase(callback_function) {} - ~V8PersistentCallbackFunction() override = default; - - // Returns a wrapper-tracing version of this callback function. - V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - - v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) WARN_UNUSED_RESULT; - CORE_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg); - - private: - V8CallbackFunction* Proxy() { - return As<V8CallbackFunction>(); - } - - template <typename V8CallbackFunction> - friend V8PersistentCallbackFunction<V8CallbackFunction>* - ToV8PersistentCallbackFunction(V8CallbackFunction*); -}; - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_TESTS_RESULTS_CORE_V8_VOID_CALLBACK_FUNCTION_ENUM_ARG_H_
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_interface_arg.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_interface_arg.cc index 9906ff30..f10462f 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_interface_arg.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_interface_arg.cc
@@ -123,14 +123,4 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionInterfaceArg>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, HTMLDivElement* divElement) { - return Proxy()->Invoke( - callback_this_value, divElement); -} - -void V8PersistentCallbackFunction<V8VoidCallbackFunctionInterfaceArg>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, HTMLDivElement* divElement) { - Proxy()->InvokeAndReportException( - callback_this_value, divElement); -} - } // namespace blink
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_interface_arg.h b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_interface_arg.h index 5f53dfb75..5c013279 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_interface_arg.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_interface_arg.h
@@ -42,31 +42,6 @@ void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, HTMLDivElement* divElement); }; -template <> -class V8PersistentCallbackFunction<V8VoidCallbackFunctionInterfaceArg> final : public V8PersistentCallbackFunctionBase { - using V8CallbackFunction = V8VoidCallbackFunctionInterfaceArg; - - public: - explicit V8PersistentCallbackFunction(V8CallbackFunction* callback_function) - : V8PersistentCallbackFunctionBase(callback_function) {} - ~V8PersistentCallbackFunction() override = default; - - // Returns a wrapper-tracing version of this callback function. - V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - - v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, HTMLDivElement* divElement) WARN_UNUSED_RESULT; - CORE_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, HTMLDivElement* divElement); - - private: - V8CallbackFunction* Proxy() { - return As<V8CallbackFunction>(); - } - - template <typename V8CallbackFunction> - friend V8PersistentCallbackFunction<V8CallbackFunction>* - ToV8PersistentCallbackFunction(V8CallbackFunction*); -}; - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_TESTS_RESULTS_CORE_V8_VOID_CALLBACK_FUNCTION_INTERFACE_ARG_H_
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_test_interface_sequence_arg.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_test_interface_sequence_arg.cc index 58c64a0c..05013a0 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_test_interface_sequence_arg.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_test_interface_sequence_arg.cc
@@ -124,14 +124,4 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionTestInterfaceSequenceArg>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg) { - return Proxy()->Invoke( - callback_this_value, arg); -} - -void V8PersistentCallbackFunction<V8VoidCallbackFunctionTestInterfaceSequenceArg>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg) { - Proxy()->InvokeAndReportException( - callback_this_value, arg); -} - } // namespace blink
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_test_interface_sequence_arg.h b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_test_interface_sequence_arg.h index 94fb791..6c23f2aa 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_test_interface_sequence_arg.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_test_interface_sequence_arg.h
@@ -42,31 +42,6 @@ void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg); }; -template <> -class V8PersistentCallbackFunction<V8VoidCallbackFunctionTestInterfaceSequenceArg> final : public V8PersistentCallbackFunctionBase { - using V8CallbackFunction = V8VoidCallbackFunctionTestInterfaceSequenceArg; - - public: - explicit V8PersistentCallbackFunction(V8CallbackFunction* callback_function) - : V8PersistentCallbackFunctionBase(callback_function) {} - ~V8PersistentCallbackFunction() override = default; - - // Returns a wrapper-tracing version of this callback function. - V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - - v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg) WARN_UNUSED_RESULT; - CORE_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg); - - private: - V8CallbackFunction* Proxy() { - return As<V8CallbackFunction>(); - } - - template <typename V8CallbackFunction> - friend V8PersistentCallbackFunction<V8CallbackFunction>* - ToV8PersistentCallbackFunction(V8CallbackFunction*); -}; - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_TESTS_RESULTS_CORE_V8_VOID_CALLBACK_FUNCTION_TEST_INTERFACE_SEQUENCE_ARG_H_
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_typedef.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_typedef.cc index 819a9c97..4cfc4961 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_typedef.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_typedef.cc
@@ -123,14 +123,4 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionTypedef>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) { - return Proxy()->Invoke( - callback_this_value, arg); -} - -void V8PersistentCallbackFunction<V8VoidCallbackFunctionTypedef>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) { - Proxy()->InvokeAndReportException( - callback_this_value, arg); -} - } // namespace blink
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_typedef.h b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_typedef.h index 260fe67..5bf65bda 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_typedef.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_typedef.h
@@ -40,31 +40,6 @@ void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg); }; -template <> -class V8PersistentCallbackFunction<V8VoidCallbackFunctionTypedef> final : public V8PersistentCallbackFunctionBase { - using V8CallbackFunction = V8VoidCallbackFunctionTypedef; - - public: - explicit V8PersistentCallbackFunction(V8CallbackFunction* callback_function) - : V8PersistentCallbackFunctionBase(callback_function) {} - ~V8PersistentCallbackFunction() override = default; - - // Returns a wrapper-tracing version of this callback function. - V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - - v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) WARN_UNUSED_RESULT; - CORE_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg); - - private: - V8CallbackFunction* Proxy() { - return As<V8CallbackFunction>(); - } - - template <typename V8CallbackFunction> - friend V8PersistentCallbackFunction<V8CallbackFunction>* - ToV8PersistentCallbackFunction(V8CallbackFunction*); -}; - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_TESTS_RESULTS_CORE_V8_VOID_CALLBACK_FUNCTION_TYPEDEF_H_
diff --git a/third_party/blink/renderer/bindings/tests/results/modules/v8_void_callback_function_modules.cc b/third_party/blink/renderer/bindings/tests/results/modules/v8_void_callback_function_modules.cc index f65a3f6..7296c5f 100644 --- a/third_party/blink/renderer/bindings/tests/results/modules/v8_void_callback_function_modules.cc +++ b/third_party/blink/renderer/bindings/tests/results/modules/v8_void_callback_function_modules.cc
@@ -117,14 +117,4 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionModules>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { - return Proxy()->Invoke( - callback_this_value); -} - -void V8PersistentCallbackFunction<V8VoidCallbackFunctionModules>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { - Proxy()->InvokeAndReportException( - callback_this_value); -} - } // namespace blink
diff --git a/third_party/blink/renderer/bindings/tests/results/modules/v8_void_callback_function_modules.h b/third_party/blink/renderer/bindings/tests/results/modules/v8_void_callback_function_modules.h index 081ea4b6..ac40abf 100644 --- a/third_party/blink/renderer/bindings/tests/results/modules/v8_void_callback_function_modules.h +++ b/third_party/blink/renderer/bindings/tests/results/modules/v8_void_callback_function_modules.h
@@ -40,31 +40,6 @@ void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value); }; -template <> -class V8PersistentCallbackFunction<V8VoidCallbackFunctionModules> final : public V8PersistentCallbackFunctionBase { - using V8CallbackFunction = V8VoidCallbackFunctionModules; - - public: - explicit V8PersistentCallbackFunction(V8CallbackFunction* callback_function) - : V8PersistentCallbackFunctionBase(callback_function) {} - ~V8PersistentCallbackFunction() override = default; - - // Returns a wrapper-tracing version of this callback function. - V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - - v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; - MODULES_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value); - - private: - V8CallbackFunction* Proxy() { - return As<V8CallbackFunction>(); - } - - template <typename V8CallbackFunction> - friend V8PersistentCallbackFunction<V8CallbackFunction>* - ToV8PersistentCallbackFunction(V8CallbackFunction*); -}; - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_TESTS_RESULTS_MODULES_V8_VOID_CALLBACK_FUNCTION_MODULES_H_
diff --git a/third_party/blink/renderer/core/clipboard/data_transfer_item.cc b/third_party/blink/renderer/core/clipboard/data_transfer_item.cc index 76e02205..111da3f 100644 --- a/third_party/blink/renderer/core/clipboard/data_transfer_item.cc +++ b/third_party/blink/renderer/core/clipboard/data_transfer_item.cc
@@ -71,16 +71,13 @@ if (!callback || item_->Kind() != DataObjectItem::kStringKind) return; - auto* v8persistent_callback = ToV8PersistentCallbackFunction(callback); ExecutionContext* context = ExecutionContext::From(script_state); - probe::AsyncTaskScheduled(context, "DataTransferItem.getAsString", - v8persistent_callback); + probe::AsyncTaskScheduled(context, "DataTransferItem.getAsString", callback); context->GetTaskRunner(TaskType::kUserInteraction) ->PostTask(FROM_HERE, WTF::Bind(&DataTransferItem::RunGetAsStringTask, WrapPersistent(this), WrapPersistent(context), - WrapPersistent(v8persistent_callback), - item_->GetAsString())); + WrapPersistent(callback), item_->GetAsString())); } File* DataTransferItem::getAsFile() const { @@ -94,10 +91,9 @@ DataObjectItem* item) : data_transfer_(data_transfer), item_(item) {} -void DataTransferItem::RunGetAsStringTask( - ExecutionContext* context, - V8PersistentCallbackFunction<V8FunctionStringCallback>* callback, - const String& data) { +void DataTransferItem::RunGetAsStringTask(ExecutionContext* context, + V8FunctionStringCallback* callback, + const String& data) { DCHECK(callback); probe::AsyncTask async_task(context, callback); if (context)
diff --git a/third_party/blink/renderer/core/clipboard/data_transfer_item.h b/third_party/blink/renderer/core/clipboard/data_transfer_item.h index c930a457..230098e 100644 --- a/third_party/blink/renderer/core/clipboard/data_transfer_item.h +++ b/third_party/blink/renderer/core/clipboard/data_transfer_item.h
@@ -64,10 +64,9 @@ void Trace(blink::Visitor*) override; private: - void RunGetAsStringTask( - ExecutionContext*, - V8PersistentCallbackFunction<V8FunctionStringCallback>*, - const String& data); + void RunGetAsStringTask(ExecutionContext*, + V8FunctionStringCallback*, + const String& data); Member<DataTransfer> data_transfer_; Member<DataObjectItem> item_;
diff --git a/third_party/blink/renderer/core/dom/document_test.cc b/third_party/blink/renderer/core/dom/document_test.cc index e5c17b3..9c022cef 100644 --- a/third_party/blink/renderer/core/dom/document_test.cc +++ b/third_party/blink/renderer/core/dom/document_test.cc
@@ -55,7 +55,6 @@ #include "third_party/blink/renderer/core/html/html_head_element.h" #include "third_party/blink/renderer/core/html/html_link_element.h" #include "third_party/blink/renderer/core/loader/appcache/application_cache_host.h" -#include "third_party/blink/renderer/core/loader/appcache/application_cache_host_helper.h" #include "third_party/blink/renderer/core/loader/document_loader.h" #include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/page/validation_message_client.h" @@ -330,21 +329,16 @@ // ValidationMessageClient::trace(visitor); } }; -class MockApplicationCacheHostHelper - : public blink::ApplicationCacheHostHelper { +class MockApplicationCacheHost : public blink::ApplicationCacheHost { public: - MockApplicationCacheHostHelper() {} - ~MockApplicationCacheHostHelper() override = default; + MockApplicationCacheHost(DocumentLoader* loader) + : blink::ApplicationCacheHost(loader, nullptr, nullptr) {} + ~MockApplicationCacheHost() override = default; void SelectCacheWithoutManifest() override { without_manifest_was_called_ = true; } - bool SelectCacheWithManifest(const blink::KURL& manifestURL) override { - with_manifest_was_called_ = true; - return true; - } - bool with_manifest_was_called_ = false; bool without_manifest_was_called_ = false; }; @@ -883,16 +877,14 @@ TEST_F(DocumentTest, SandboxDisablesAppCache) { NavigateTo(KURL("https://test.com/foobar/document"), "", "sandbox"); + GetDocument().Loader()->SetApplicationCacheHostForTesting( + MakeGarbageCollected<MockApplicationCacheHost>(GetDocument().Loader())); ApplicationCacheHost* appcache_host = GetDocument().Loader()->GetApplicationCacheHost(); - appcache_host->helper_ = - MakeGarbageCollected<MockApplicationCacheHostHelper>(); appcache_host->SelectCacheWithManifest( KURL("https://test.com/foobar/manifest")); - auto* mock_host_helper = static_cast<MockApplicationCacheHostHelper*>( - appcache_host->helper_.Get()); - EXPECT_FALSE(mock_host_helper->with_manifest_was_called_); - EXPECT_TRUE(mock_host_helper->without_manifest_was_called_); + auto* mock_host = static_cast<MockApplicationCacheHost*>(appcache_host); + EXPECT_TRUE(mock_host->without_manifest_was_called_); } // Verifies that calling EnsurePaintLocationDataValidForNode cleans compositor
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc index 15474ea..545617d9 100644 --- a/third_party/blink/renderer/core/dom/element.cc +++ b/third_party/blink/renderer/core/dom/element.cc
@@ -2266,6 +2266,7 @@ children_context.previous_in_flow = nullptr; children_context.parent = layout_object; children_context.next_sibling = nullptr; + children_context.next_sibling_valid = true; } else if (style->Display() != EDisplay::kContents) { // The layout object creation was suppressed for other reasons than // being display:none or display:contents (E.g. @@ -2684,7 +2685,8 @@ if (NeedsReattachLayoutTree()) { AttachContext reattach_context; - InitAttachContextParentAndSibling(reattach_context, *this); + reattach_context.parent = + LayoutTreeBuilderTraversal::ParentLayoutObject(*this); if (reattach_context.parent && reattach_context.parent->ForceLegacyLayout()) reattach_context.force_legacy_layout = true; ReattachLayoutTree(reattach_context);
diff --git a/third_party/blink/renderer/core/dom/first_letter_pseudo_element.cc b/third_party/blink/renderer/core/dom/first_letter_pseudo_element.cc index ee8ff9b..de00395c 100644 --- a/third_party/blink/renderer/core/dom/first_letter_pseudo_element.cc +++ b/third_party/blink/renderer/core/dom/first_letter_pseudo_element.cc
@@ -263,6 +263,7 @@ FirstLetterPseudoElement::FirstLetterTextLayoutObject(*this); AttachContext first_letter_context(context); first_letter_context.next_sibling = first_letter_text; + first_letter_context.next_sibling_valid = true; first_letter_context.parent = first_letter_text->Parent(); if (first_letter_context.parent->ForceLegacyLayout()) first_letter_context.force_legacy_layout = true;
diff --git a/third_party/blink/renderer/core/dom/layout_tree_builder.cc b/third_party/blink/renderer/core/dom/layout_tree_builder.cc index 3f5ad1e..b15d317 100644 --- a/third_party/blink/renderer/core/dom/layout_tree_builder.cc +++ b/third_party/blink/renderer/core/dom/layout_tree_builder.cc
@@ -47,7 +47,7 @@ LayoutTreeBuilderForElement::LayoutTreeBuilderForElement( Element& element, - const Node::AttachContext& context, + Node::AttachContext& context, const ComputedStyle* style, LegacyLayout legacy) : LayoutTreeBuilder(element, context, style), legacy_(legacy) {
diff --git a/third_party/blink/renderer/core/dom/layout_tree_builder.h b/third_party/blink/renderer/core/dom/layout_tree_builder.h index 294c69b..97047f1 100644 --- a/third_party/blink/renderer/core/dom/layout_tree_builder.h +++ b/third_party/blink/renderer/core/dom/layout_tree_builder.h
@@ -30,7 +30,6 @@ #include "base/memory/scoped_refptr.h" #include "third_party/blink/renderer/core/dom/document.h" -#include "third_party/blink/renderer/core/dom/layout_tree_builder_traversal.h" #include "third_party/blink/renderer/core/dom/node.h" #include "third_party/blink/renderer/core/dom/text.h" #include "third_party/blink/renderer/core/layout/layout_inline.h" @@ -40,13 +39,6 @@ class ComputedStyle; -inline void InitAttachContextParentAndSibling(Node::AttachContext& context, - const Node& node) { - context.parent = LayoutTreeBuilderTraversal::ParentLayoutObject(node); - context.next_sibling = - LayoutTreeBuilderTraversal::NextSiblingLayoutObject(node); -} - // The LayoutTreeBuilder class uses the DOM tree and CSS style rules as input to // form a LayoutObject Tree which is then used for layout computations in a // later stage. @@ -67,7 +59,7 @@ protected: LayoutTreeBuilder(NodeType& node, - const Node::AttachContext& context, + Node::AttachContext& context, const ComputedStyle* style) : node_(node), context_(context), style_(style) { DCHECK(!node.GetLayoutObject()); @@ -77,6 +69,11 @@ } LayoutObject* NextLayoutObject() const { + if (!context_.next_sibling_valid) { + context_.next_sibling = + LayoutTreeBuilderTraversal::NextSiblingLayoutObject(*node_); + context_.next_sibling_valid = true; + } LayoutObject* next = context_.next_sibling; // If a text node is wrapped in an anonymous inline for display:contents // (see CreateInlineWrapperForDisplayContents()), use the wrapper as the @@ -91,14 +88,14 @@ } Member<NodeType> node_; - const Node::AttachContext& context_; + Node::AttachContext& context_; const ComputedStyle* style_; }; class LayoutTreeBuilderForElement : public LayoutTreeBuilder<Element> { public: LayoutTreeBuilderForElement(Element&, - const Node::AttachContext&, + Node::AttachContext&, const ComputedStyle*, LegacyLayout legacy); @@ -114,7 +111,7 @@ class LayoutTreeBuilderForText : public LayoutTreeBuilder<Text> { public: LayoutTreeBuilderForText(Text& text, - const Node::AttachContext& context, + Node::AttachContext& context, const ComputedStyle* style_from_parent) : LayoutTreeBuilder(text, context, style_from_parent) {}
diff --git a/third_party/blink/renderer/core/dom/node.h b/third_party/blink/renderer/core/dom/node.h index 73408abe..18af7ed 100644 --- a/third_party/blink/renderer/core/dom/node.h +++ b/third_party/blink/renderer/core/dom/node.h
@@ -684,6 +684,8 @@ bool performing_reattach = false; // True if the previous_in_flow member is up-to-date, even if it is nullptr. bool use_previous_in_flow = false; + // True if the next_sibling member is up-to-date, even if it is nullptr. + bool next_sibling_valid = false; // True if we need to force legacy layout objects for the entire subtree. bool force_legacy_layout = false;
diff --git a/third_party/blink/renderer/core/dom/node_test.cc b/third_party/blink/renderer/core/dom/node_test.cc index eecfe8d..06e48e5 100644 --- a/third_party/blink/renderer/core/dom/node_test.cc +++ b/third_party/blink/renderer/core/dom/node_test.cc
@@ -41,7 +41,7 @@ GetDocument().Lifecycle().AdvanceTo(DocumentLifecycle::kInStyleRecalc); GetDocument().GetStyleEngine().RecalcStyle({}); Node::AttachContext context; - InitAttachContextParentAndSibling(context, node); + context.parent = LayoutTreeBuilderTraversal::ParentLayoutObject(node); GetDocument().GetStyleEngine().in_layout_tree_rebuild_ = true; node.ReattachLayoutTree(context); return context.previous_in_flow;
diff --git a/third_party/blink/renderer/core/dom/text.cc b/third_party/blink/renderer/core/dom/text.cc index 0ca2947..faa0d1e 100644 --- a/third_party/blink/renderer/core/dom/text.cc +++ b/third_party/blink/renderer/core/dom/text.cc
@@ -352,7 +352,7 @@ CharacterData::AttachLayoutTree(context); } -void Text::ReattachLayoutTreeIfNeeded(const AttachContext& context) { +void Text::ReattachLayoutTreeIfNeeded(AttachContext& context) { bool layout_object_is_needed = false; ContainerNode* style_parent = LayoutTreeBuilderTraversal::Parent(*this); if (style_parent && context.parent) { @@ -416,7 +416,7 @@ DCHECK(parentNode()); AttachContext context; - InitAttachContextParentAndSibling(context, *this); + context.parent = LayoutTreeBuilderTraversal::ParentLayoutObject(*this); ReattachLayoutTree(context); whitespace_attacher.DidReattachText(this); ClearNeedsReattachLayoutTree();
diff --git a/third_party/blink/renderer/core/dom/text.h b/third_party/blink/renderer/core/dom/text.h index 73293d6..519f535 100644 --- a/third_party/blink/renderer/core/dom/text.h +++ b/third_party/blink/renderer/core/dom/text.h
@@ -68,7 +68,7 @@ unsigned length_of_replaced_data); void AttachLayoutTree(AttachContext&) final; - void ReattachLayoutTreeIfNeeded(const AttachContext&); + void ReattachLayoutTreeIfNeeded(AttachContext&); bool CanContainRangeEndPoint() const final { return true; } NodeType getNodeType() const override;
diff --git a/third_party/blink/renderer/core/dom/whitespace_attacher.cc b/third_party/blink/renderer/core/dom/whitespace_attacher.cc index ce986d77..d267323 100644 --- a/third_party/blink/renderer/core/dom/whitespace_attacher.cc +++ b/third_party/blink/renderer/core/dom/whitespace_attacher.cc
@@ -77,7 +77,7 @@ } else { if (last_text_node_->ContainsOnlyWhitespaceOrEmpty()) { Node::AttachContext context; - InitAttachContextParentAndSibling(context, *text); + context.parent = LayoutTreeBuilderTraversal::ParentLayoutObject(*text); last_text_node_->ReattachLayoutTreeIfNeeded(context); } } @@ -117,7 +117,8 @@ Node::AttachContext context; context.previous_in_flow = previous_in_flow; context.use_previous_in_flow = true; - InitAttachContextParentAndSibling(context, *last_text_node_); + context.parent = + LayoutTreeBuilderTraversal::ParentLayoutObject(*last_text_node_); for (Node* sibling = last_text_node_; sibling; sibling = LayoutTreeBuilderTraversal::NextLayoutSibling(*sibling)) {
diff --git a/third_party/blink/renderer/core/editing/selection_controller.cc b/third_party/blink/renderer/core/editing/selection_controller.cc index 2bd366b2..4ef5096 100644 --- a/third_party/blink/renderer/core/editing/selection_controller.cc +++ b/third_party/blink/renderer/core/editing/selection_controller.cc
@@ -598,15 +598,6 @@ return true; } -static bool IsEmptyWordRange(const EphemeralRangeInFlatTree range) { - const String& str = PlainText( - range, TextIteratorBehavior::Builder() - .SetEmitsObjectReplacementCharacter( - HasEditableStyle(*range.StartPosition().AnchorNode())) - .Build()); - return str.SimplifyWhiteSpace().ContainsOnlyWhitespaceOrEmpty(); -} - bool SelectionController::SelectClosestWordFromHitTestResult( const HitTestResult& result, AppendTrailingWhitespace append_trailing_whitespace, @@ -651,7 +642,17 @@ // If node doesn't have text except space, tab or line break, do not // select that 'empty' area. EphemeralRangeInFlatTree range = new_selection.ComputeRange(); - if (IsEmptyWordRange(range)) + const String word = PlainText( + range, TextIteratorBehavior::Builder() + .SetEmitsObjectReplacementCharacter( + HasEditableStyle(*range.StartPosition().AnchorNode())) + .Build()); + if (word.length() >= 1 && word[0] == '\n') { + // We should not select word from end of line, e.g. + // "(1)|\n(2)" => "(1)^\n(|2)". See http://crbug.com/974569 + return false; + } + if (word.SimplifyWhiteSpace().ContainsOnlyWhitespaceOrEmpty()) return false; Element* const editable =
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 64a15750..2804bec 100644 --- a/third_party/blink/renderer/core/editing/selection_controller_test.cc +++ b/third_party/blink/renderer/core/editing/selection_controller_test.cc
@@ -11,13 +11,28 @@ #include "third_party/blink/renderer/core/frame/local_frame_view.h" #include "third_party/blink/renderer/core/frame/settings.h" #include "third_party/blink/renderer/core/input/event_handler.h" +#include "third_party/blink/renderer/core/layout/layout_object.h" namespace blink { class SelectionControllerTest : public EditingTestBase { protected: + using AppendTrailingWhitespace = + SelectionController::AppendTrailingWhitespace; + using SelectInputEventType = SelectionController::SelectInputEventType; + SelectionControllerTest() = default; + SelectionController& Controller() { + return GetFrame().GetEventHandler().GetSelectionController(); + } + + static PositionWithAffinity GetPositionFromHitTestResult( + const HitTestResult& hit_test_result) { + return hit_test_result.InnerNode()->GetLayoutObject()->PositionForPoint( + hit_test_result.LocalPoint()); + } + VisibleSelection VisibleSelectionInDOMTree() const { return Selection().ComputeVisibleSelectionInDOMTree(); } @@ -26,6 +41,10 @@ return Selection().GetSelectionInFlatTree(); } + bool SelectClosestWordFromHitTestResult( + const HitTestResult& result, + AppendTrailingWhitespace append_trailing_whitespace, + SelectInputEventType select_input_event_type); void SetCaretAtHitTestResult(const HitTestResult&); void SetNonDirectionalSelectionIfNeeded(const SelectionInFlatTree&, TextGranularity); @@ -34,6 +53,14 @@ DISALLOW_COPY_AND_ASSIGN(SelectionControllerTest); }; +bool SelectionControllerTest::SelectClosestWordFromHitTestResult( + const HitTestResult& result, + AppendTrailingWhitespace append_trailing_whitespace, + SelectInputEventType select_input_event_type) { + return Controller().SelectClosestWordFromHitTestResult( + result, append_trailing_whitespace, select_input_event_type); +} + void SelectionControllerTest::SetCaretAtHitTestResult( const HitTestResult& hit_test_result) { GetFrame().GetEventHandler().GetSelectionController().SetCaretAtHitTestResult( @@ -205,4 +232,64 @@ EXPECT_EQ(PositionInFlatTree::AfterNode(*input), result.ComputeEndPosition()); } +// For http://crbug.com/974569 +TEST_F(SelectionControllerTest, + SelectClosestWordFromHitTestResultAtEndOfLine1) { + InsertStyleElement("body { margin: 0; padding: 0; font: 10px monospace; }"); + SetBodyContent("<pre>(1)\n(2)</pre>"); + + // Click/Tap after "(1)" + HitTestLocation location(IntPoint(40, 10)); + HitTestResult result = + GetFrame().GetEventHandler().HitTestResultAtLocation(location); + ASSERT_EQ("<pre>(1)|\n(2)</pre>", + GetSelectionTextFromBody( + SelectionInDOMTree::Builder() + .Collapse(GetPositionFromHitTestResult(result)) + .Build())); + + // Select word by mouse + EXPECT_TRUE(SelectClosestWordFromHitTestResult( + result, AppendTrailingWhitespace::kDontAppend, + SelectInputEventType::kMouse)); + EXPECT_EQ("<pre>(1)^\n(|2)</pre>", GetSelectionTextFromBody()); + + // Select word by tap + EXPECT_FALSE(SelectClosestWordFromHitTestResult( + result, AppendTrailingWhitespace::kDontAppend, + SelectInputEventType::kTouch)); + EXPECT_EQ("<pre>(1)^\n(|2)</pre>", GetSelectionTextFromBody()) + << "selection isn't changed"; +} + +TEST_F(SelectionControllerTest, + SelectClosestWordFromHitTestResultAtEndOfLine2) { + InsertStyleElement("body { margin: 0; padding: 0; font: 10px monospace; }"); + SetBodyContent("<pre>ab:\ncd</pre>"); + + // Click/Tap after "(1)" + HitTestLocation location(IntPoint(40, 10)); + HitTestResult result = + GetFrame().GetEventHandler().HitTestResultAtLocation(location); + ASSERT_EQ("<pre>ab:|\ncd</pre>", + GetSelectionTextFromBody( + SelectionInDOMTree::Builder() + .Collapse(GetPositionFromHitTestResult(result)) + .Build())); + + // Select word by mouse + EXPECT_TRUE(SelectClosestWordFromHitTestResult( + result, AppendTrailingWhitespace::kDontAppend, + SelectInputEventType::kMouse)); + // TODO(yosin): This should be "<pre>ab:^\ncd|</pre>" + EXPECT_EQ("<pre>ab:^\nc|d</pre>", GetSelectionTextFromBody()); + + // Select word by tap + EXPECT_FALSE(SelectClosestWordFromHitTestResult( + result, AppendTrailingWhitespace::kDontAppend, + SelectInputEventType::kTouch)); + EXPECT_EQ("<pre>ab:^\nc|d</pre>", GetSelectionTextFromBody()) + << "selection isn't changed"; +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/exported/web_remote_frame_impl.cc b/third_party/blink/renderer/core/exported/web_remote_frame_impl.cc index 117d29c..9c666af 100644 --- a/third_party/blink/renderer/core/exported/web_remote_frame_impl.cc +++ b/third_party/blink/renderer/core/exported/web_remote_frame_impl.cc
@@ -161,9 +161,10 @@ InsertAfter(child, previous_sibling); auto* owner = MakeGarbageCollected<RemoteFrameOwner>( frame_policy, frame_owner_properties, frame_owner_element_type); - child->InitializeCoreFrame( - *GetFrame()->GetPage(), owner, name, - opener ? &ToCoreFrame(*opener)->window_agent_factory() : nullptr); + child->InitializeCoreFrame(*GetFrame()->GetPage(), owner, name, + opener + ? &ToCoreFrame(*opener)->window_agent_factory() + : &GetFrame()->window_agent_factory()); DCHECK(child->GetFrame()); return child; } @@ -191,9 +192,10 @@ AppendChild(child); auto* owner = MakeGarbageCollected<RemoteFrameOwner>( frame_policy, WebFrameOwnerProperties(), frame_owner_element_type); - child->InitializeCoreFrame( - *GetFrame()->GetPage(), owner, name, - opener ? &ToCoreFrame(*opener)->window_agent_factory() : nullptr); + child->InitializeCoreFrame(*GetFrame()->GetPage(), owner, name, + opener + ? &ToCoreFrame(*opener)->window_agent_factory() + : &GetFrame()->window_agent_factory()); return child; }
diff --git a/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc b/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc index b820697e..0b31406 100644 --- a/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc +++ b/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc
@@ -187,8 +187,6 @@ } else { OnAppCacheSelected(); } - - client_->WorkerScriptLoaded(); } void WebSharedWorkerImpl::DidFailToFetchClassicScript() {
diff --git a/third_party/blink/renderer/core/frame/frame_test_helpers.cc b/third_party/blink/renderer/core/frame/frame_test_helpers.cc index 86accd22b..fb9e286 100644 --- a/third_party/blink/renderer/core/frame/frame_test_helpers.cc +++ b/third_party/blink/renderer/core/frame/frame_test_helpers.cc
@@ -663,9 +663,9 @@ ScrollGranularity granularity, cc::ElementId scrollable_area_element_id, WebInputEvent::Type injected_type) { - if (injected_type == WebInputEvent::kGestureScrollUpdate) { - injected_gesture_scroll_update_count_++; - } + InjectedScrollGestureData data{delta, granularity, scrollable_area_element_id, + injected_type}; + injected_scroll_gesture_data_.push_back(data); } void TestWebWidgetClient::RegisterViewportLayers(
diff --git a/third_party/blink/renderer/core/frame/frame_test_helpers.h b/third_party/blink/renderer/core/frame/frame_test_helpers.h index 5d11d83d..7bae591 100644 --- a/third_party/blink/renderer/core/frame/frame_test_helpers.h +++ b/third_party/blink/renderer/core/frame/frame_test_helpers.h
@@ -197,6 +197,13 @@ std::unique_ptr<content::LayerTreeView> layer_tree_view_; }; +struct InjectedScrollGestureData { + WebFloatSize delta; + ScrollGranularity granularity; + CompositorElementId scrollable_area_element_id; + WebInputEvent::Type type; +}; + class TestWebWidgetClient : public WebWidgetClient { public: // If no delegate is given, a stub is used. @@ -240,19 +247,20 @@ int FinishedLoadingLayoutCount() const { return finished_loading_layout_count_; } - int InjectedGestureScrollCount() const { - return injected_gesture_scroll_update_count_; + const Vector<InjectedScrollGestureData>& GetInjectedScrollGestureData() + const { + return injected_scroll_gesture_data_; } private: content::LayerTreeView* layer_tree_view_ = nullptr; cc::AnimationHost* animation_host_ = nullptr; LayerTreeViewFactory layer_tree_view_factory_; + Vector<InjectedScrollGestureData> injected_scroll_gesture_data_; bool animation_scheduled_ = false; int visually_non_empty_layout_count_ = 0; int finished_parsing_layout_count_ = 0; int finished_loading_layout_count_ = 0; - int injected_gesture_scroll_update_count_ = 0; }; class TestWebViewClient : public WebViewClient {
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc index f8549598..693be68 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
@@ -1221,9 +1221,9 @@ } void LocalDOMWindow::queueMicrotask(V8VoidFunction* callback) { - Microtask::EnqueueMicrotask(WTF::Bind( - &V8PersistentCallbackFunction<V8VoidFunction>::InvokeAndReportException, - WrapPersistent(ToV8PersistentCallbackFunction(callback)), nullptr)); + Microtask::EnqueueMicrotask( + WTF::Bind(&V8VoidFunction::InvokeAndReportException, + WrapPersistent(callback), nullptr)); } int LocalDOMWindow::requestIdleCallback(V8IdleRequestCallback* callback,
diff --git a/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc b/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc index 9a65f3a..4838ac5c 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc +++ b/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc
@@ -161,7 +161,7 @@ function_type_(function_type), start_time_(start_time), static_bitmap_image_loaded_(false), - callback_(ToV8PersistentCallbackFunction(callback)), + callback_(callback), script_promise_resolver_(resolver) { DCHECK(image); @@ -439,8 +439,7 @@ if (function_type_ == kHTMLCanvasToBlobCallback) { context_->GetTaskRunner(TaskType::kCanvasBlobSerialization) ->PostTask(FROM_HERE, - WTF::Bind(&V8PersistentCallbackFunction< - V8BlobCallback>::InvokeAndReportException, + WTF::Bind(&V8BlobCallback::InvokeAndReportException, WrapPersistent(callback_.Get()), nullptr, WrapPersistent(result_blob))); } else { @@ -466,8 +465,7 @@ context_->GetTaskRunner(TaskType::kCanvasBlobSerialization) ->PostTask( FROM_HERE, - WTF::Bind(&V8PersistentCallbackFunction< - V8BlobCallback>::InvokeAndReportException, + WTF::Bind(&V8BlobCallback::InvokeAndReportException, WrapPersistent(callback_.Get()), nullptr, nullptr)); } else { context_->GetTaskRunner(TaskType::kCanvasBlobSerialization)
diff --git a/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.h b/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.h index ab32d861..e90ba9a 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.h +++ b/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.h
@@ -131,12 +131,7 @@ scoped_refptr<base::SingleThreadTaskRunner> parent_frame_task_runner_; // Used for HTMLCanvasElement only - // - // Note: CanvasAsyncBlobCreator is never held by other objects. As soon as - // an instance gets created, ScheduleAsyncBlobCreation is invoked, and then - // the instance is only held by a task runner (via PostTask). Thus the - // instance has only limited lifetime. Hence, Persistent here is okay. - Member<V8PersistentCallbackFunction<V8BlobCallback>> callback_; + Member<V8BlobCallback> callback_; // Used for OffscreenCanvas only Member<ScriptPromiseResolver> script_promise_resolver_;
diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc index cc47277..3df825d5 100644 --- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc +++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc
@@ -942,12 +942,9 @@ // If the canvas element's bitmap has no pixels GetDocument() .GetTaskRunner(TaskType::kCanvasBlobSerialization) - ->PostTask( - FROM_HERE, - WTF::Bind(&V8PersistentCallbackFunction< - V8BlobCallback>::InvokeAndReportException, - WrapPersistent(ToV8PersistentCallbackFunction(callback)), - nullptr, nullptr)); + ->PostTask(FROM_HERE, + WTF::Bind(&V8BlobCallback::InvokeAndReportException, + WrapPersistent(callback), nullptr, nullptr)); return; } @@ -980,12 +977,9 @@ } else { GetDocument() .GetTaskRunner(TaskType::kCanvasBlobSerialization) - ->PostTask( - FROM_HERE, - WTF::Bind(&V8PersistentCallbackFunction< - V8BlobCallback>::InvokeAndReportException, - WrapPersistent(ToV8PersistentCallbackFunction(callback)), - nullptr, nullptr)); + ->PostTask(FROM_HERE, + WTF::Bind(&V8BlobCallback::InvokeAndReportException, + WrapPersistent(callback), nullptr, nullptr)); } }
diff --git a/third_party/blink/renderer/core/html/forms/html_select_element.cc b/third_party/blink/renderer/core/html/forms/html_select_element.cc index 025ccb51..d31e5eee 100644 --- a/third_party/blink/renderer/core/html/forms/html_select_element.cc +++ b/third_party/blink/renderer/core/html/forms/html_select_element.cc
@@ -106,6 +106,9 @@ // static bool HTMLSelectElement::CanAssignToSelectSlot(const Node& node) { + // Even if options/optgroups are not rendered as children of LayoutMenuList, + // we still need to add them to the flat tree through slotting since we need + // their ComputedStyle for popup rendering. return node.HasTagName(kOptionTag) || node.HasTagName(kOptgroupTag) || node.HasTagName(kHrTag); }
diff --git a/third_party/blink/renderer/core/html/html_slot_element.cc b/third_party/blink/renderer/core/html/html_slot_element.cc index 01a7fab4..f64b6595 100644 --- a/third_party/blink/renderer/core/html/html_slot_element.cc +++ b/third_party/blink/renderer/core/html/html_slot_element.cc
@@ -260,6 +260,7 @@ children_context.previous_in_flow = nullptr; children_context.parent = layout_object; children_context.next_sibling = nullptr; + children_context.next_sibling_valid = true; } for (auto& node : AssignedNodes())
diff --git a/third_party/blink/renderer/core/html/media/html_media_element.cc b/third_party/blink/renderer/core/html/media/html_media_element.cc index 436394c..2922fecd 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.cc +++ b/third_party/blink/renderer/core/html/media/html_media_element.cc
@@ -2693,7 +2693,9 @@ // Per spec, consult current playback position to check for changing time. double media_time = CurrentPlaybackPosition(); bool media_time_has_progressed = - media_time != last_time_update_event_media_time_; + std::isnan(last_time_update_event_media_time_) + ? media_time != 0 + : media_time != last_time_update_event_media_time_; if (periodic_event && !media_time_has_progressed) return;
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 93980af..b7c258d 100644 --- a/third_party/blink/renderer/core/input/event_handler_test.cc +++ b/third_party/blink/renderer/core/input/event_handler_test.cc
@@ -6,7 +6,9 @@ #include <memory> +#include "base/test/bind_test_util.h" #include "base/test/scoped_feature_list.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/platform/web_keyboard_event.h" @@ -35,6 +37,7 @@ #include "third_party/blink/renderer/core/page/autoscroll_controller.h" #include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" +#include "third_party/blink/renderer/core/scroll/scroll_animator_base.h" #include "third_party/blink/renderer/core/testing/core_unit_test_helper.h" #include "third_party/blink/renderer/core/testing/page_test_base.h" #include "third_party/blink/renderer/core/testing/sim/sim_request.h" @@ -1086,67 +1089,33 @@ EXPECT_EQ(0, Offset()); } -class InjectedGestureCapturingChromeClient : public EmptyChromeClient { - public: - InjectedGestureCapturingChromeClient() = default; - - struct InjectedGestureData { - WebFloatSize delta; - ScrollGranularity granularity; - CompositorElementId scrollable_area_element_id; - WebInputEvent::Type type; - }; - - void InjectGestureScrollEvent(LocalFrame& local_frame, - WebGestureDevice device, - const WebFloatSize& delta, - ScrollGranularity granularity, - CompositorElementId scrollable_area_element_id, - WebInputEvent::Type type) override { - InjectedGestureData data{delta, granularity, scrollable_area_element_id, - type}; - injected_data_.push_back(data); - } - - const std::vector<InjectedGestureData>& GetInjectedData() const { - return injected_data_; - } - - private: - std::vector<InjectedGestureData> injected_data_; -}; - -class EventHandlerScrollbarGestureInjectionTest : public EventHandlerTest { +class EventHandlerScrollbarGestureInjectionTest : public SimTest { public: EventHandlerScrollbarGestureInjectionTest() = default; void SetUp() override { scoped_feature_list_.InitAndEnableFeature( features::kScrollbarInjectScrollGestures); - chrome_client_ = - MakeGarbageCollected<InjectedGestureCapturingChromeClient>(); - Page::PageClients clients; - FillWithEmptyClients(clients); - clients.chrome_client = chrome_client_.Get(); - SetupPageWithClients(&clients); - } - - const std::vector<InjectedGestureCapturingChromeClient::InjectedGestureData>& - GetInjectedData() { - return chrome_client_->GetInjectedData(); + SimTest::SetUp(); } private: - Persistent<InjectedGestureCapturingChromeClient> chrome_client_; base::test::ScopedFeatureList scoped_feature_list_; }; TEST_F(EventHandlerScrollbarGestureInjectionTest, MouseUpOffScrollbarGeneratesScrollEnd) { - SetHtmlInnerHTML( - "<div style=\"height:1000px\">" - "Tall text to create viewport scrollbar</div>"); - EXPECT_EQ(GetInjectedData().size(), 0ULL); + WebView().MainFrameWidget()->Resize(WebSize(800, 600)); + SimRequest request("https://example.com/test.html", "text/html"); + LoadURL("https://example.com/test.html"); + request.Complete(R"HTML( + <!DOCTYPE html> + <div style='height:1000px'> + Tall text to create viewport scrollbar</div> + )HTML"); + + Compositor().BeginFrame(); + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData().size(), 0u); // PageTestBase sizes the page to 800x600. Click on the scrollbar // track, move off, then release the mouse and verify that GestureScrollEnd @@ -1156,7 +1125,7 @@ // any injected gesture events. Mobile overlay scrollbar theme does not // allow hit testing. bool scrollbar_theme_allows_hit_test = - GetPage().GetScrollbarTheme().AllowsHitTest(); + GetDocument().GetPage()->GetScrollbarTheme().AllowsHitTest(); const WebFloatPoint scrollbar_forward_track(795, 560); WebMouseEvent mouse_down(WebInputEvent::kMouseDown, scrollbar_forward_track, @@ -1168,11 +1137,13 @@ // Mouse down on the scrollbar track should have generated GSB/GSU. if (scrollbar_theme_allows_hit_test) { - EXPECT_EQ(GetInjectedData().size(), 2ULL); - EXPECT_EQ(GetInjectedData()[0].type, WebInputEvent::kGestureScrollBegin); - EXPECT_EQ(GetInjectedData()[1].type, WebInputEvent::kGestureScrollUpdate); + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData().size(), 2u); + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData()[0].type, + WebInputEvent::kGestureScrollBegin); + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData()[1].type, + WebInputEvent::kGestureScrollUpdate); } else { - EXPECT_EQ(GetInjectedData().size(), 0ULL); + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData().size(), 0u); } const WebFloatPoint middle_of_page(100, 100); @@ -1185,9 +1156,9 @@ // Mouse move should not have generated any gestures. if (scrollbar_theme_allows_hit_test) { - EXPECT_EQ(GetInjectedData().size(), 2ULL); + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData().size(), 2u); } else { - EXPECT_EQ(GetInjectedData().size(), 0ULL); + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData().size(), 0u); } WebMouseEvent mouse_up(WebInputEvent::kMouseUp, middle_of_page, @@ -1198,18 +1169,27 @@ // Mouse up must generate GestureScrollEnd. if (scrollbar_theme_allows_hit_test) { - EXPECT_EQ(GetInjectedData().size(), 3ULL); - EXPECT_EQ(GetInjectedData()[2].type, WebInputEvent::kGestureScrollEnd); + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData().size(), 3u); + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData()[2].type, + WebInputEvent::kGestureScrollEnd); } else { - EXPECT_EQ(GetInjectedData().size(), 0ULL); + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData().size(), 0u); } } TEST_F(EventHandlerScrollbarGestureInjectionTest, MouseUpOnlyOnScrollbar) { - SetHtmlInnerHTML( - "<div style=\"height:1000px\">" - "Tall text to create viewport scrollbar</div>"); - EXPECT_EQ(GetInjectedData().size(), 0ULL); + WebView().MainFrameWidget()->Resize(WebSize(800, 600)); + SimRequest request("https://example.com/test.html", "text/html"); + LoadURL("https://example.com/test.html"); + request.Complete(R"HTML( + <!DOCTYPE html> + <div style='height:1000px'> + Tall text to create viewport scrollbar</div> + )HTML"); + + Compositor().BeginFrame(); + + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData().size(), 0u); // Mouse down on the page, the move the mouse to the scrollbar and release. // Validate that we don't inject a ScrollEnd (since no ScrollBegin was @@ -1223,7 +1203,7 @@ GetDocument().GetFrame()->GetEventHandler().HandleMousePressEvent(mouse_down); // Mouse down on the page should not generate scroll gestures. - EXPECT_EQ(GetInjectedData().size(), 0ULL); + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData().size(), 0u); const WebFloatPoint scrollbar_forward_track(795, 560); WebMouseEvent mouse_move(WebInputEvent::kMouseMove, scrollbar_forward_track, @@ -1235,7 +1215,7 @@ mouse_move, Vector<WebMouseEvent>(), Vector<WebMouseEvent>()); // Mouse move should not have generated any gestures. - EXPECT_EQ(GetInjectedData().size(), 0ULL); + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData().size(), 0u); WebMouseEvent mouse_up(WebInputEvent::kMouseUp, scrollbar_forward_track, scrollbar_forward_track, @@ -1245,14 +1225,22 @@ GetDocument().GetFrame()->GetEventHandler().HandleMouseReleaseEvent(mouse_up); // Mouse up should not have generated any gestures. - EXPECT_EQ(GetInjectedData().size(), 0ULL); + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData().size(), 0u); } TEST_F(EventHandlerScrollbarGestureInjectionTest, RightClickNoGestures) { - SetHtmlInnerHTML( - "<div style=\"height:1000px\">" - "Tall text to create viewport scrollbar</div>"); - EXPECT_EQ(GetInjectedData().size(), 0ULL); + WebView().MainFrameWidget()->Resize(WebSize(800, 600)); + SimRequest request("https://example.com/test.html", "text/html"); + LoadURL("https://example.com/test.html"); + request.Complete(R"HTML( + <!DOCTYPE html> + <div style='height:1000px'> + Tall text to create viewport scrollbar</div> + )HTML"); + + Compositor().BeginFrame(); + + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData().size(), 0u); // PageTestBase sizes the page to 800x600. Right click on the scrollbar // track, and release the mouse and verify that no gesture events are @@ -1266,7 +1254,7 @@ mouse_down.SetFrameScale(1); GetDocument().GetFrame()->GetEventHandler().HandleMousePressEvent(mouse_down); - EXPECT_EQ(GetInjectedData().size(), 0ULL); + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData().size(), 0u); WebMouseEvent mouse_up(WebInputEvent::kMouseUp, scrollbar_forward_track, scrollbar_forward_track, @@ -1275,7 +1263,136 @@ mouse_up.SetFrameScale(1); GetDocument().GetFrame()->GetEventHandler().HandleMouseReleaseEvent(mouse_up); - EXPECT_EQ(GetInjectedData().size(), 0ULL); + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData().size(), 0u); +} + +// https://crbug.com/976557 tracks the fix for re-enabling this test on Mac. +#ifdef OS_MACOSX +#define MAYBE_GestureTapWithScrollSnaps DISABLED_GestureTapWithScrollSnaps +#else +#define MAYBE_GestureTapWithScrollSnaps GestureTapWithScrollSnaps +#endif + +TEST_F(EventHandlerScrollbarGestureInjectionTest, + MAYBE_GestureTapWithScrollSnaps) { + // Create a page that has scroll snaps enabled for a scroller. Tap on the + // scrollbar and verify that the SnapController does not immediately cancel + // the resulting animation during the handling of GestureScrollEnd - this + // should be deferred until the animation completes or is cancelled. + + // Enable scroll animations - this test relies on animations being + // queued up in response to GestureScrollUpdate events. + GetDocument().GetSettings()->SetScrollAnimatorEnabled(true); + + // Enable accelerated compositing in order to ensure the Page's + // ScrollingCoordinator is initialized. + GetDocument().GetSettings()->SetAcceleratedCompositingEnabled(true); + + WebView().MainFrameWidget()->Resize(WebSize(800, 600)); + SimRequest request("https://example.com/test.html", "text/html"); + LoadURL("https://example.com/test.html"); + request.Complete(R"HTML( + <!DOCTYPE html> + <style> + body { margin:0 } + #container { + overflow: scroll; + width:500px; + height:500px; + scroll-snap-type: y mandatory; + } + div { + height:400px; + scroll-snap-align: start + } + </style> + <body> + <div id='container'> + <div></div><div></div><div></div> + </div> + )HTML"); + + Compositor().BeginFrame(); + + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData().size(), 0u); + + // Only run this test if scrollbars are hit-testable (they are not on + // Android). + bool scrollbar_theme_allows_hit_test = + GetDocument().GetPage()->GetScrollbarTheme().AllowsHitTest(); + if (!scrollbar_theme_allows_hit_test) + return; + + // kGestureTapDown sets the pressed parts which is a pre-requisite for + // kGestureTap performing a scroll. + const WebFloatPoint scrollbar_forward_track(495, 450); + TapDownEventBuilder tap_down(scrollbar_forward_track); + GetDocument().GetFrame()->GetEventHandler().HandleGestureEvent(tap_down); + + TapEventBuilder tap(scrollbar_forward_track, 1); + GetDocument().GetFrame()->GetEventHandler().HandleGestureEvent(tap); + EXPECT_EQ(WebWidgetClient().GetInjectedScrollGestureData().size(), 3u); + + const Vector<frame_test_helpers::InjectedScrollGestureData>& data = + WebWidgetClient().GetInjectedScrollGestureData(); + const frame_test_helpers::InjectedScrollGestureData gsb_data = data[0]; + const frame_test_helpers::InjectedScrollGestureData gsu_data = data[1]; + const frame_test_helpers::InjectedScrollGestureData gse_data = data[2]; + EXPECT_EQ(gsb_data.type, WebInputEvent::Type::kGestureScrollBegin); + EXPECT_EQ(gsu_data.type, WebInputEvent::Type::kGestureScrollUpdate); + EXPECT_EQ(gse_data.type, WebInputEvent::Type::kGestureScrollEnd); + + // Inject the gesture sequence based on the injected data. + WebGestureEvent gsb{WebInputEvent::kGestureScrollBegin, + WebInputEvent::kNoModifiers, + WebInputEvent::GetStaticTimeStampForTests()}; + gsb.SetFrameScale(1); + gsb.SetSourceDevice(WebGestureDevice::kScrollbar); + gsb.data.scroll_begin.delta_x_hint = -gsb_data.delta.width; + gsb.data.scroll_begin.delta_y_hint = -gsb_data.delta.height; + gsb.data.scroll_begin.scrollable_area_element_id = + gsb_data.scrollable_area_element_id.GetInternalValue(); + GetDocument().GetFrame()->GetEventHandler().HandleGestureEvent(gsb); + WebGestureEvent gsu{WebInputEvent::kGestureScrollUpdate, + WebInputEvent::kNoModifiers, + WebInputEvent::GetStaticTimeStampForTests()}; + gsu.SetSourceDevice(WebGestureDevice::kScrollbar); + gsu.SetFrameScale(1); + gsu.data.scroll_update.delta_x = -gsu_data.delta.width; + gsu.data.scroll_update.delta_y = -gsu_data.delta.height; + gsu.data.scroll_update.delta_units = gsu_data.granularity; + GetDocument().GetFrame()->GetEventHandler().HandleGestureEvent(gsu); + WebGestureEvent gse{WebInputEvent::kGestureScrollEnd, + WebInputEvent::kNoModifiers, + WebInputEvent::GetStaticTimeStampForTests()}; + gse.SetSourceDevice(WebGestureDevice::kScrollbar); + gse.SetFrameScale(1); + GetDocument().GetFrame()->GetEventHandler().HandleGestureEvent(gse); + + // Ensure that there is an active animation on the scrollable area event + // though GSE was handled. The actual handling should be deferred. + Element* scrollable_div = GetDocument().getElementById("container"); + ScrollableArea* scrollable_area = + scrollable_div->GetLayoutBox()->GetScrollableArea(); + EXPECT_TRUE(scrollable_area->ExistingScrollAnimator()); + EXPECT_TRUE(scrollable_area->ExistingScrollAnimator()->HasRunningAnimation()); + + // Run the animation for a few frames to ensure that snapping did not + // immediately happen. + // One frame to update run_state_, one to set start_time = now, then advance + // two frames into the animation. + const int kFramesToRun = 4; + for (int i = 0; i < kFramesToRun; i++) + Compositor().BeginFrame(); + + EXPECT_NE(scrollable_area->GetScrollOffset().Height(), 0); + + // Finish the animation, verify that we're back at 0 and not animating. + Compositor().BeginFrame(0.3); + + EXPECT_EQ(scrollable_area->GetScrollOffset().Height(), 0); + EXPECT_FALSE( + scrollable_area->ExistingScrollAnimator()->HasRunningAnimation()); } // Test that leaving a window leaves mouse position unknown.
diff --git a/third_party/blink/renderer/core/input/scroll_manager.cc b/third_party/blink/renderer/core/input/scroll_manager.cc index 39143b8..e5398c6 100644 --- a/third_party/blink/renderer/core/input/scroll_manager.cc +++ b/third_party/blink/renderer/core/input/scroll_manager.cc
@@ -32,6 +32,7 @@ #include "third_party/blink/renderer/core/page/scrolling/snap_coordinator.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" +#include "third_party/blink/renderer/core/scroll/scroll_animator_base.h" #include "third_party/blink/renderer/core/scroll/scroll_customization.h" #include "third_party/blink/renderer/platform/histogram.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" @@ -640,12 +641,35 @@ return WebInputEventResult::kNotHandled; } +// This method is used as a ScrollCallback which requires a void return. Since +// this call to HandleGestureScrollEnd is async, we can just ignore the return +// value. +void ScrollManager::HandleDeferredGestureScrollEnd( + const WebGestureEvent& gesture_event) { + HandleGestureScrollEnd(gesture_event); +} + WebInputEventResult ScrollManager::HandleGestureScrollEnd( const WebGestureEvent& gesture_event) { TRACE_EVENT0("input", "ScrollManager::handleGestureScrollEnd"); Node* node = scroll_gesture_handling_node_; if (node && node->GetLayoutObject()) { + // If the GSE is for a scrollable area that has an in-progress animation, + // defer the handling of the gesture event until the scroll animation is + // complete. This will allow things like scroll snapping to be deferred so + // that users can see the result of their scroll before the snap is applied. + LayoutBox* layout_box = node->GetLayoutBox(); + ScrollableArea* scrollable_area = + layout_box ? layout_box->GetScrollableArea() : nullptr; + if (scrollable_area && scrollable_area->ExistingScrollAnimator() && + scrollable_area->ExistingScrollAnimator()->HasRunningAnimation()) { + scrollable_area->RegisterScrollCompleteCallback( + WTF::Bind(&ScrollManager::HandleDeferredGestureScrollEnd, + WrapWeakPersistent(this), gesture_event)); + return WebInputEventResult::kNotHandled; + } + PassScrollGestureEvent(gesture_event, node->GetLayoutObject()); if (current_scroll_chain_.empty()) { ClearGestureScrollState();
diff --git a/third_party/blink/renderer/core/input/scroll_manager.h b/third_party/blink/renderer/core/input/scroll_manager.h index 028bb3b3..4522b72 100644 --- a/third_party/blink/renderer/core/input/scroll_manager.h +++ b/third_party/blink/renderer/core/input/scroll_manager.h
@@ -112,6 +112,10 @@ WebInputEventResult HandleGestureScrollUpdate(const WebGestureEvent&); WebInputEventResult HandleGestureScrollBegin(const WebGestureEvent&); + // Handling of GestureScrollEnd may be deferred if there's an outstanding + // scroll animation. This is the callback that invokes the deferred operation. + void HandleDeferredGestureScrollEnd(const WebGestureEvent& gesture_event); + WebInputEventResult PassScrollGestureEvent(const WebGestureEvent&, LayoutObject*);
diff --git a/third_party/blink/renderer/core/inspector/inspector_network_agent.cc b/third_party/blink/renderer/core/inspector/inspector_network_agent.cc index 7f029b4..d5c6b982 100644 --- a/third_party/blink/renderer/core/inspector/inspector_network_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_network_agent.cc
@@ -1296,15 +1296,25 @@ CurrentTimeTicksInSeconds()); } -void InspectorNetworkAgent::DidReceiveWebSocketMessage(uint64_t identifier, - int op_code, - bool masked, - const char* payload, - size_t payload_length) { +void InspectorNetworkAgent::DidReceiveWebSocketMessage( + uint64_t identifier, + int op_code, + bool masked, + const Vector<base::span<const char>>& data) { + size_t size = 0; + for (const auto& span : data) { + size += span.size(); + } + Vector<char> flatten; + flatten.ReserveCapacity(SafeCast<wtf_size_t>(size)); + for (const auto& span : data) { + flatten.Append(span.data(), SafeCast<wtf_size_t>(span.size())); + } GetFrontend()->webSocketFrameReceived( IdentifiersFactory::SubresourceRequestId(identifier), CurrentTimeTicksInSeconds(), - WebSocketMessageToProtocol(op_code, masked, payload, payload_length)); + WebSocketMessageToProtocol(op_code, masked, flatten.data(), + flatten.size())); } void InspectorNetworkAgent::DidSendWebSocketMessage(uint64_t identifier,
diff --git a/third_party/blink/renderer/core/inspector/inspector_network_agent.h b/third_party/blink/renderer/core/inspector/inspector_network_agent.h index df0f5327..3b916fdb 100644 --- a/third_party/blink/renderer/core/inspector/inspector_network_agent.h +++ b/third_party/blink/renderer/core/inspector/inspector_network_agent.h
@@ -31,6 +31,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_INSPECTOR_NETWORK_AGENT_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_INSPECTOR_NETWORK_AGENT_H_ +#include "base/containers/span.h" #include "base/optional.h" #include "base/unguessable_token.h" #include "third_party/blink/renderer/core/core_export.h" @@ -185,8 +186,7 @@ void DidReceiveWebSocketMessage(uint64_t identifier, int op_code, bool masked, - const char* payload, - size_t payload_length); + const Vector<base::span<const char>>& data); void DidSendWebSocketMessage(uint64_t identifier, int op_code, bool masked,
diff --git a/third_party/blink/renderer/core/layout/layout_menu_list.cc b/third_party/blink/renderer/core/layout/layout_menu_list.cc index fa4f05a..7153991 100644 --- a/third_party/blink/renderer/core/layout/layout_menu_list.cc +++ b/third_party/blink/renderer/core/layout/layout_menu_list.cc
@@ -54,10 +54,11 @@ LayoutMenuList::~LayoutMenuList() = default; -// FIXME: Instead of this hack we should add a ShadowRoot to <select> with no -// insertion point to prevent children from rendering. bool LayoutMenuList::IsChildAllowed(LayoutObject* object, const ComputedStyle&) const { + // For a size=1 <select>, we only render the active option through the + // anonymous inner_block_ plus button_text_. We do not allow adding layout + // objects for options or optgroups. return object->IsAnonymous(); }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.cc b/third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.cc index 21b54f6c..648a6fc3 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.cc
@@ -212,10 +212,13 @@ return NGPhysicalFragment::NGBoxType::kFloating; if (layout_object_->IsOutOfFlowPositioned()) return NGPhysicalFragment::NGBoxType::kOutOfFlowPositioned; - if (layout_object_->IsAtomicInlineLevel()) - return NGPhysicalFragment::NGBoxType::kAtomicInline; - if (layout_object_->IsInline()) + if (layout_object_->IsInline()) { + // Check |IsAtomicInlineLevel()| after |IsInline()| because |LayoutReplaced| + // sets |IsAtomicInlineLevel()| even when it's block-level. crbug.com/567964 + if (layout_object_->IsAtomicInlineLevel()) + return NGPhysicalFragment::NGBoxType::kAtomicInline; return NGPhysicalFragment::NGBoxType::kInlineBox; + } DCHECK(node_) << "Must call SetBoxType if there is no node"; DCHECK_EQ(is_new_fc_, node_.CreatesNewFormattingContext()) << "Forgot to call builder.SetIsNewFormattingContext";
diff --git a/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment_test.cc b/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment_test.cc index aee3643..71829d70 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment_test.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment_test.cc
@@ -148,4 +148,17 @@ EXPECT_TRUE(fragment->IsBlockFormattingContextRoot()); } +TEST_F(NGPhysicalBoxFragmentTest, ReplacedBlock) { + SetBodyInnerHTML(R"HTML( + <img id="target" style="display: block"> + )HTML"); + const NGPhysicalBoxFragment& body = GetBodyFragment(); + const NGPhysicalFragment& fragment = *body.Children().front(); + EXPECT_EQ(fragment.Type(), NGPhysicalFragment::kFragmentBox); + // |LayoutReplaced| sets |IsAtomicInlineLevel()| even when it is block-level. + // crbug.com/567964 + EXPECT_FALSE(fragment.IsAtomicInline()); + EXPECT_EQ(fragment.BoxType(), NGPhysicalFragment::kBlockFlowRoot); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/scrollbars_test.cc b/third_party/blink/renderer/core/layout/scrollbars_test.cc index 01e0a4c8..4409bb67 100644 --- a/third_party/blink/renderer/core/layout/scrollbars_test.cc +++ b/third_party/blink/renderer/core/layout/scrollbars_test.cc
@@ -2541,7 +2541,7 @@ // Verify that the scrollbar autopress timer requested some scrolls via // gestures. The button was pressed for 2 seconds and the timer fires // every 250ms - we should have at least 7 injected gesture updates. - EXPECT_GT(WebWidgetClient().InjectedGestureScrollCount(), 6); + EXPECT_GT(WebWidgetClient().GetInjectedScrollGestureData().size(), 6u); } class ScrollbarTrackMarginsTest : public ScrollbarsTest {
diff --git a/third_party/blink/renderer/core/loader/BUILD.gn b/third_party/blink/renderer/core/loader/BUILD.gn index 67be642..95aa8ade 100644 --- a/third_party/blink/renderer/core/loader/BUILD.gn +++ b/third_party/blink/renderer/core/loader/BUILD.gn
@@ -12,13 +12,10 @@ "appcache/application_cache.h", "appcache/application_cache_host.cc", "appcache/application_cache_host.h", - "appcache/application_cache_host_client.h", "appcache/application_cache_host_for_frame.cc", "appcache/application_cache_host_for_frame.h", "appcache/application_cache_host_for_shared_worker.cc", "appcache/application_cache_host_for_shared_worker.h", - "appcache/application_cache_host_helper.cc", - "appcache/application_cache_host_helper.h", "base_fetch_context.cc", "base_fetch_context.h", "cookie_jar.cc",
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache_host.cc b/third_party/blink/renderer/core/loader/appcache/application_cache_host.cc index 2c42658..66ef408 100644 --- a/third_party/blink/renderer/core/loader/appcache/application_cache_host.cc +++ b/third_party/blink/renderer/core/loader/appcache/application_cache_host.cc
@@ -32,6 +32,8 @@ #include "third_party/blink/public/mojom/appcache/appcache.mojom-blink.h" #include "third_party/blink/public/mojom/appcache/appcache_info.mojom-blink.h" +#include "third_party/blink/public/platform/interface_provider.h" +#include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/core/events/application_cache_error_event.h" #include "third_party/blink/renderer/core/events/progress_event.h" #include "third_party/blink/renderer/core/frame/deprecation.h" @@ -47,34 +49,70 @@ #include "third_party/blink/renderer/core/loader/frame_load_request.h" #include "third_party/blink/renderer/core/loader/frame_loader.h" #include "third_party/blink/renderer/core/page/frame_tree.h" -#include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" -#include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" namespace blink { +namespace { + +// Note: the order of the elements in this array must match those +// of the EventID enum in appcache_interfaces.h. +const char* const kEventNames[] = {"Checking", "Error", "NoUpdate", + "Downloading", "Progress", "UpdateReady", + "Cached", "Obsolete"}; + +mojom::blink::DocumentInterfaceBroker* GetDocumentInterfaceBroker( + LocalFrame* local_frame) { + return local_frame->Client()->GetDocumentInterfaceBroker(); +} + +} // namespace + +ApplicationCacheHost* ApplicationCacheHost::Create( + DocumentLoader* document_loader) { + DCHECK(document_loader); + DCHECK(document_loader->GetFrame()); + LocalFrame* local_frame = document_loader->GetFrame(); + + DCHECK(local_frame->Client()); + WebLocalFrameClient::AppCacheType type = + local_frame->Client()->GetAppCacheType(); + switch (type) { + case WebLocalFrameClient::AppCacheType::kAppCacheForFrame: + return MakeGarbageCollected<ApplicationCacheHostForFrame>( + document_loader, GetDocumentInterfaceBroker(local_frame), + local_frame->GetTaskRunner(TaskType::kNetworking)); + case WebLocalFrameClient::AppCacheType::kAppCacheForSharedWorker: + return MakeGarbageCollected<ApplicationCacheHostForSharedWorker>( + document_loader, Thread::Current()->GetTaskRunner()); + default: + return MakeGarbageCollected<ApplicationCacheHost>(document_loader, + nullptr, nullptr); + } + return nullptr; +} + // We provide a custom implementation of this class that calls out to the // embedding application instead of using WebCore's built in appcache system. // This file replaces webcore/appcache/ApplicationCacheHost.cpp in our build. -ApplicationCacheHost::ApplicationCacheHost(DocumentLoader* document_loader) - : dom_application_cache_(nullptr), - document_loader_(document_loader), - defers_events_(true) { - DCHECK(document_loader_); -} +ApplicationCacheHost::ApplicationCacheHost( + DocumentLoader* document_loader, + mojom::blink::DocumentInterfaceBroker* interface_broker, + scoped_refptr<base::SingleThreadTaskRunner> task_runner) + : document_loader_(document_loader), + binding_(this), + task_runner_(std::move(task_runner)), + interface_broker_(interface_broker) {} -ApplicationCacheHost::~ApplicationCacheHost() { - // Verify that detachFromDocumentLoader() has been performed already. - DCHECK(!helper_); -} +ApplicationCacheHost::~ApplicationCacheHost() = default; void ApplicationCacheHost::WillStartLoading(ResourceRequest& request) { - if (!IsApplicationCacheEnabled() || !helper_) + if (!IsApplicationCacheEnabled() || !backend_host_.is_bound()) return; - const base::UnguessableToken& host_id = helper_->GetHostID(); + const base::UnguessableToken& host_id = GetHostID(); if (!host_id.is_empty()) request.SetAppCacheHostID(host_id); } @@ -84,84 +122,11 @@ const String& method) { if (!IsApplicationCacheEnabled()) return; - // We defer creating the outer host object to avoid spurious - // creation/destruction around creating empty documents. At this point, we're - // initiating a main resource load for the document, so its for real. - DCHECK(document_loader_->GetFrame()); - LocalFrame& frame = *document_loader_->GetFrame(); - - helper_ = ApplicationCacheHostHelper::Create(&frame, this, - loader->AppcacheHostId()); - if (!helper_) - return; - - const ApplicationCacheHostHelper* spawning_host_helper = nullptr; - Frame* spawning_frame = frame.Tree().Parent(); - if (!spawning_frame || !IsA<LocalFrame>(spawning_frame)) - spawning_frame = frame.Loader().Opener(); - if (!spawning_frame || !IsA<LocalFrame>(spawning_frame)) - spawning_frame = &frame; - if (DocumentLoader* spawning_doc_loader = - To<LocalFrame>(spawning_frame)->Loader().GetDocumentLoader()) { - spawning_host_helper = - spawning_doc_loader->GetApplicationCacheHost() - ? spawning_doc_loader->GetApplicationCacheHost()->helper_.Get() - : nullptr; - } - - helper_->WillStartMainResourceRequest(url, method, spawning_host_helper); - - // NOTE: The semantics of this method, and others in this interface, are - // subtly different than the method names would suggest. For example, in this - // method never returns an appcached response in the SubstituteData out - // argument, instead we return the appcached response thru the usual resource - // loading pipeline. -} - -void ApplicationCacheHost::SelectCacheWithoutManifest() { - if (helper_) - helper_->SelectCacheWithoutManifest(); -} - -void ApplicationCacheHost::SelectCacheWithManifest(const KURL& manifest_url) { - DCHECK(document_loader_); - - LocalFrame* frame = document_loader_->GetFrame(); - Document* document = frame->GetDocument(); - if (document->IsSandboxed(WebSandboxFlags::kOrigin)) { - // Prevent sandboxes from establishing application caches. - SelectCacheWithoutManifest(); - return; - } - if (document->IsSecureContext()) { - UseCounter::Count(document, - WebFeature::kApplicationCacheManifestSelectSecureOrigin); - } else { - Deprecation::CountDeprecation( - document, WebFeature::kApplicationCacheManifestSelectInsecureOrigin); - Deprecation::CountDeprecationCrossOriginIframe( - *document, WebFeature::kApplicationCacheManifestSelectInsecureOrigin); - HostsUsingFeatures::CountAnyWorld( - *document, HostsUsingFeatures::Feature:: - kApplicationCacheManifestSelectInsecureHost); - } - if (helper_ && !helper_->SelectCacheWithManifest(manifest_url)) { - // It's a foreign entry, restart the current navigation from the top of the - // navigation algorithm. The navigation will not result in the same resource - // being loaded, because "foreign" entries are never picked during - // navigation. see ApplicationCacheGroup::selectCache() - FrameLoadRequest request(document, ResourceRequest(document->Url())); - request.SetClientRedirectReason(ClientNavigationReason::kReload); - frame->Navigate(request, WebFrameLoadType::kReplaceCurrentItem); - } -} - -void ApplicationCacheHost::DidReceiveResponseForMainResource( - const ResourceResponse& response) { - if (helper_) { - helper_->DidReceiveResponseForMainResource(response); - } + // We defer binding to backend to avoid unnecessary binding around creating + // empty documents. At this point, we're initiating a main resource load for + // the document, so its for real. + BindBackend(); } void ApplicationCacheHost::SetApplicationCache( @@ -171,13 +136,10 @@ } void ApplicationCacheHost::DetachFromDocumentLoader() { - // Detach from the owning DocumentLoader and let go of - // ApplicationCacheHostHelper. + // Detach from the owning DocumentLoader and close mojo pipes. SetApplicationCache(nullptr); - if (helper_) { - helper_->DetachFromDocumentLoader(); - helper_.Clear(); - } + binding_.Close(); + backend_host_ = nullptr; document_loader_ = nullptr; } @@ -205,36 +167,43 @@ } ApplicationCacheHost::CacheInfo ApplicationCacheHost::ApplicationCacheInfo() { - if (!helper_) - return CacheInfo(NullURL(), 0, 0, 0, 0); + if (!backend_host_.is_bound()) + return CacheInfo(); - ApplicationCacheHostHelper::CacheInfo cache_info; - helper_->GetAssociatedCacheInfo(&cache_info); - return CacheInfo(cache_info.manifest_url, cache_info.creation_time, - cache_info.update_time, cache_info.response_sizes, - cache_info.padding_sizes); + ApplicationCacheHost::CacheInfo cache_info; + GetAssociatedCacheInfo(&cache_info); + return cache_info; } const base::UnguessableToken& ApplicationCacheHost::GetHostID() const { - if (!helper_) + if (!backend_host_.is_bound()) return base::UnguessableToken::Null(); - return helper_->GetHostID(); + return host_id_; } void ApplicationCacheHost::SelectCacheForSharedWorker( int64_t app_cache_id, base::OnceClosure completion_callback) { - helper_->SelectCacheForSharedWorker(app_cache_id, - std::move(completion_callback)); + if (!backend_host_.is_bound()) + return; + + select_cache_for_shared_worker_completion_callback_ = + std::move(completion_callback); + backend_host_->SelectCacheForSharedWorker(app_cache_id); } void ApplicationCacheHost::FillResourceList( Vector<mojom::blink::AppCacheResourceInfo>* resources) { DCHECK(resources); - if (!helper_) + if (!backend_host_.is_bound()) return; - helper_->GetResourceList(resources); + if (!cache_info_.is_complete) + return; + Vector<mojom::blink::AppCacheResourceInfoPtr> boxed_infos; + backend_host_->GetResourceList(&boxed_infos); + for (auto& b : boxed_infos) + resources->emplace_back(std::move(*b)); } void ApplicationCacheHost::StopDeferringEvents() { @@ -278,20 +247,40 @@ } mojom::AppCacheStatus ApplicationCacheHost::GetStatus() const { - return helper_ ? helper_->GetStatus() - : mojom::AppCacheStatus::APPCACHE_STATUS_UNCACHED; + if (!backend_host_.is_bound()) + return mojom::AppCacheStatus::APPCACHE_STATUS_UNCACHED; + return status_; } bool ApplicationCacheHost::Update() { - return helper_ ? helper_->StartUpdate() : false; + if (!backend_host_.is_bound()) + return false; + + bool result = false; + backend_host_->StartUpdate(&result); + if (!result) + return false; + if (status_ == mojom::blink::AppCacheStatus::APPCACHE_STATUS_IDLE || + status_ == mojom::blink::AppCacheStatus::APPCACHE_STATUS_UPDATE_READY) { + status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_CHECKING; + } else { + status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_UNCACHED; + backend_host_->GetStatus(&status_); + } + return true; } bool ApplicationCacheHost::SwapCache() { - bool success = helper_ ? helper_->SwapCache() : false; - if (success) { - probe::UpdateApplicationCacheStatus(document_loader_->GetFrame()); - } - return success; + if (!backend_host_.is_bound()) + return false; + + bool success = false; + backend_host_->SwapCache(&success); + if (!success) + return false; + backend_host_->GetStatus(&status_); + probe::UpdateApplicationCacheStatus(document_loader_->GetFrame()); + return true; } void ApplicationCacheHost::Abort() { @@ -305,40 +294,187 @@ ->GetOfflineWebApplicationCacheEnabled(); } -void ApplicationCacheHost::DidChangeCacheAssociation() { +void ApplicationCacheHost::CacheSelected(mojom::blink::AppCacheInfoPtr info) { + if (!backend_host_.is_bound()) + return; + + cache_info_ = *info; // FIXME: Prod the inspector to update its notion of what cache the page is // using. + if (select_cache_for_shared_worker_completion_callback_) + std::move(select_cache_for_shared_worker_completion_callback_).Run(); } -void ApplicationCacheHost::NotifyEventListener( - mojom::AppCacheEventID event_id) { +void ApplicationCacheHost::EventRaised(mojom::blink::AppCacheEventID event_id) { + if (!backend_host_.is_bound()) + return; + + DCHECK_NE(event_id, + mojom::blink::AppCacheEventID:: + APPCACHE_PROGRESS_EVENT); // See OnProgressEventRaised. + DCHECK_NE(event_id, + mojom::blink::AppCacheEventID:: + APPCACHE_ERROR_EVENT); // See OnErrorEventRaised. + + // Emit logging output prior to calling out to script as we can get + // deleted within the script event handler. + const char kFormatString[] = "Application Cache %s event"; + String message = + String::Format(kFormatString, kEventNames[static_cast<int>(event_id)]); + LogMessage(mojom::blink::ConsoleMessageLevel::kInfo, message); + + switch (event_id) { + case mojom::blink::AppCacheEventID::APPCACHE_CHECKING_EVENT: + status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_CHECKING; + break; + case mojom::blink::AppCacheEventID::APPCACHE_DOWNLOADING_EVENT: + status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_DOWNLOADING; + break; + case mojom::blink::AppCacheEventID::APPCACHE_UPDATE_READY_EVENT: + status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_UPDATE_READY; + break; + case mojom::blink::AppCacheEventID::APPCACHE_CACHED_EVENT: + case mojom::blink::AppCacheEventID::APPCACHE_NO_UPDATE_EVENT: + status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_IDLE; + break; + case mojom::blink::AppCacheEventID::APPCACHE_OBSOLETE_EVENT: + status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_OBSOLETE; + break; + default: + NOTREACHED(); + break; + } + NotifyApplicationCache(event_id, 0, 0, mojom::AppCacheErrorReason::APPCACHE_UNKNOWN_ERROR, String(), 0, String()); } -void ApplicationCacheHost::NotifyProgressEventListener(const KURL&, - int progress_total, - int progress_done) { +void ApplicationCacheHost::ProgressEventRaised(const KURL& url, + int num_total, + int num_complete) { + if (!backend_host_.is_bound()) + return; + + // Emit logging output prior to calling out to script as we can get + // deleted within the script event handler. + const char kFormatString[] = "Application Cache Progress event (%d of %d) %s"; + String message = String::Format(kFormatString, num_complete, num_total, + url.GetString().Utf8().c_str()); + LogMessage(mojom::blink::ConsoleMessageLevel::kInfo, message); + status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_DOWNLOADING; NotifyApplicationCache(mojom::AppCacheEventID::APPCACHE_PROGRESS_EVENT, - progress_total, progress_done, + num_total, num_complete, mojom::AppCacheErrorReason::APPCACHE_UNKNOWN_ERROR, String(), 0, String()); } -void ApplicationCacheHost::NotifyErrorEventListener( - mojom::AppCacheErrorReason reason, - const KURL& url, - int status, - const String& message) { - NotifyApplicationCache(mojom::AppCacheEventID::APPCACHE_ERROR_EVENT, 0, 0, - reason, url.GetString(), status, message); +void ApplicationCacheHost::ErrorEventRaised( + mojom::blink::AppCacheErrorDetailsPtr details) { + if (!backend_host_.is_bound()) + return; + + // Emit logging output prior to calling out to script as we can get + // deleted within the script event handler. + const char kFormatString[] = "Application Cache Error event: %s"; + String full_message = + String::Format(kFormatString, details->message.Utf8().c_str()); + LogMessage(mojom::blink::ConsoleMessageLevel::kError, full_message); + + status_ = cache_info_.is_complete + ? mojom::blink::AppCacheStatus::APPCACHE_STATUS_IDLE + : mojom::blink::AppCacheStatus::APPCACHE_STATUS_UNCACHED; + if (details->is_cross_origin) { + // Don't leak detailed information to script for cross-origin resources. + DCHECK_EQ(mojom::blink::AppCacheErrorReason::APPCACHE_RESOURCE_ERROR, + details->reason); + NotifyApplicationCache(mojom::AppCacheEventID::APPCACHE_ERROR_EVENT, 0, 0, + details->reason, details->url.GetString(), 0, + String()); + } else { + NotifyApplicationCache(mojom::AppCacheEventID::APPCACHE_ERROR_EVENT, 0, 0, + details->reason, details->url.GetString(), + details->status, details->message); + } +} + +void ApplicationCacheHost::SelectCacheWithManifest(const KURL& manifest_url) { + DCHECK(document_loader_); + LocalFrame* frame = document_loader_->GetFrame(); + Document* document = frame->GetDocument(); + if (document->IsSandboxed(WebSandboxFlags::kOrigin)) { + // Prevent sandboxes from establishing application caches. + SelectCacheWithoutManifest(); + return; + } + if (document->IsSecureContext()) { + UseCounter::Count(document, + WebFeature::kApplicationCacheManifestSelectSecureOrigin); + } else { + Deprecation::CountDeprecation( + document, WebFeature::kApplicationCacheManifestSelectInsecureOrigin); + Deprecation::CountDeprecationCrossOriginIframe( + *document, WebFeature::kApplicationCacheManifestSelectInsecureOrigin); + HostsUsingFeatures::CountAnyWorld( + *document, HostsUsingFeatures::Feature:: + kApplicationCacheManifestSelectInsecureHost); + } +} + +void ApplicationCacheHost::GetAssociatedCacheInfo( + ApplicationCacheHost::CacheInfo* info) { + if (!backend_host_.is_bound()) + return; + + info->manifest_ = cache_info_.manifest_url; + if (!cache_info_.is_complete) + return; + info->creation_time_ = cache_info_.creation_time.ToDoubleT(); + info->update_time_ = cache_info_.last_update_time.ToDoubleT(); + info->response_sizes_ = cache_info_.response_sizes; + info->padding_sizes_ = cache_info_.padding_sizes; +} + +bool ApplicationCacheHost::BindBackend() { + if (!task_runner_) + return false; + + // PlzNavigate: The browser passes the ID to be used. + if (!document_loader_->AppcacheHostId().is_empty()) + host_id_ = document_loader_->AppcacheHostId(); + else + host_id_ = base::UnguessableToken::Create(); + + mojom::blink::AppCacheFrontendPtr frontend_ptr; + binding_.Bind(mojo::MakeRequest(&frontend_ptr, task_runner_), task_runner_); + + if (interface_broker_) { + interface_broker_->RegisterAppCacheHost( + mojo::MakeRequest(&backend_host_, std::move(task_runner_)), + std::move(frontend_ptr), host_id_); + return true; + } + + DEFINE_STATIC_LOCAL( + const mojom::blink::AppCacheBackendPtr, backend_ptr, ([] { + mojom::blink::AppCacheBackendPtr result; + Platform::Current()->GetInterfaceProvider()->GetInterface( + mojo::MakeRequest(&result)); + return result; + }())); + + // Once we have 'WebContextInterfaceBroker', we can call this function through + // it like render frame. + // Refer to the design document, 'https://bit.ly/2GT0rZv'. + backend_ptr.get()->RegisterHost( + mojo::MakeRequest(&backend_host_, std::move(task_runner_)), + std::move(frontend_ptr), host_id_); + return true; } void ApplicationCacheHost::Trace(blink::Visitor* visitor) { visitor->Trace(dom_application_cache_); visitor->Trace(document_loader_); - visitor->Trace(helper_); } } // namespace blink
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache_host.h b/third_party/blink/renderer/core/loader/appcache/application_cache_host.h index 98845bf..1bbdcd19 100644 --- a/third_party/blink/renderer/core/loader/appcache/application_cache_host.h +++ b/third_party/blink/renderer/core/loader/appcache/application_cache_host.h
@@ -35,10 +35,14 @@ #include "base/gtest_prod_util.h" #include "base/macros.h" +#include "mojo/public/cpp/bindings/binding.h" #include "third_party/blink/public/mojom/appcache/appcache.mojom-blink.h" +#include "third_party/blink/public/mojom/appcache/appcache_info.mojom-blink.h" +#include "third_party/blink/public/mojom/devtools/console_message.mojom-blink.h" +#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom-blink.h" #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/core/loader/appcache/application_cache_host_client.h" #include "third_party/blink/renderer/platform/heap/handle.h" +#include "third_party/blink/renderer/platform/loader/fetch/resource_response.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -47,14 +51,18 @@ class ApplicationCache; class DocumentLoader; class ResourceRequest; -class ResourceResponse; -class ApplicationCacheHostHelper; -class CORE_EXPORT ApplicationCacheHost final +class CORE_EXPORT ApplicationCacheHost : public GarbageCollectedFinalized<ApplicationCacheHost>, - public ApplicationCacheHostClient { + public mojom::blink::AppCacheFrontend { public: - explicit ApplicationCacheHost(DocumentLoader*); + static ApplicationCacheHost* Create(DocumentLoader* document_loader); + // |interface_broker| can be null for workers and |task_runner| is null for + // kAppCacheForNone. + explicit ApplicationCacheHost( + DocumentLoader* document_loader, + mojom::blink::DocumentInterfaceBroker* interface_broker, + scoped_refptr<base::SingleThreadTaskRunner> task_runner); ~ApplicationCacheHost() override; void DetachFromDocumentLoader(); @@ -72,40 +80,23 @@ update_time_(update_time), response_sizes_(response_sizes), padding_sizes_(padding_sizes) {} + CacheInfo() = default; KURL manifest_; - double creation_time_; - double update_time_; - int64_t response_sizes_; - int64_t padding_sizes_; + double creation_time_ = 0; + double update_time_ = 0; + int64_t response_sizes_ = 0; + int64_t padding_sizes_ = 0; }; - void SelectCacheWithoutManifest(); - void SelectCacheWithManifest(const KURL& manifest_url); - - // Annotate request for ApplicationCache. This internally calls - // willStartLoadingMainResource if it's for frame resource or - // willStartLoadingResource for subresource requests. + // Annotate request for ApplicationCache. void WillStartLoading(ResourceRequest&); - void WillStartLoadingMainResource(DocumentLoader*, - const KURL&, - const String& method); - void DidReceiveResponseForMainResource(const ResourceResponse&); - void MainResourceDataReceived(const char* data, size_t length); - - mojom::AppCacheStatus GetStatus() const; + mojom::blink::AppCacheStatus GetStatus() const; bool Update(); bool SwapCache(); void Abort(); void SetApplicationCache(ApplicationCache*); - void NotifyApplicationCache(mojom::AppCacheEventID, - int progress_total, - int progress_done, - mojom::AppCacheErrorReason, - const String& error_url, - int error_status, - const String& error_message); void StopDeferringEvents(); // Also raises the events that have been queued up. @@ -116,22 +107,51 @@ void SelectCacheForSharedWorker(int64_t app_cache_id, base::OnceClosure completion_callback); - void Trace(blink::Visitor*); + // mojom::blink::AppCacheFrontend + void CacheSelected(mojom::blink::AppCacheInfoPtr info) override; + void EventRaised(mojom::blink::AppCacheEventID event_id) override; + void ProgressEventRaised(const KURL& url, + int32_t num_total, + int32_t num_complete) override; + void ErrorEventRaised(mojom::blink::AppCacheErrorDetailsPtr details) override; + void LogMessage(mojom::blink::ConsoleMessageLevel log_level, + const String& message) override {} + void SetSubresourceFactory( + network::mojom::blink::URLLoaderFactoryPtr url_loader_factory) override {} + + virtual void WillStartLoadingMainResource(DocumentLoader* loader, + const KURL& url, + const String& method); + virtual void SelectCacheWithoutManifest() {} + virtual void SelectCacheWithManifest(const KURL& manifest_url); + virtual void DidReceiveResponseForMainResource(const ResourceResponse&) {} + virtual void Trace(blink::Visitor*); + + protected: + mojom::blink::AppCacheHostPtr backend_host_; + mojom::blink::AppCacheStatus status_ = + mojom::blink::AppCacheStatus::APPCACHE_STATUS_UNCACHED; private: - // WebApplicationCacheHostClient implementation - void DidChangeCacheAssociation() final; - void NotifyEventListener(mojom::AppCacheEventID) final; - void NotifyProgressEventListener(const KURL&, - int progress_total, - int progress_done) final; - void NotifyErrorEventListener(mojom::AppCacheErrorReason, - const KURL&, - int status, - const String& message) final; + void NotifyApplicationCache(mojom::AppCacheEventID, + int progress_total, + int progress_done, + mojom::AppCacheErrorReason, + const String& error_url, + int error_status, + const String& error_message); + void GetAssociatedCacheInfo(CacheInfo* info); bool IsApplicationCacheEnabled(); DocumentLoader* GetDocumentLoader() const { return document_loader_; } + bool BindBackend(); + void DispatchDOMEvent(mojom::AppCacheEventID, + int progress_total, + int progress_done, + mojom::AppCacheErrorReason, + const String& error_url, + int error_status, + const String& error_message); struct DeferredEvent { mojom::AppCacheEventID event_id; @@ -157,20 +177,18 @@ error_message(error_message) {} }; - WeakMember<ApplicationCache> dom_application_cache_; + WeakMember<ApplicationCache> dom_application_cache_ = nullptr; Member<DocumentLoader> document_loader_; - bool defers_events_; // Events are deferred until after document onload. + bool defers_events_ = + true; // Events are deferred until after document onload. Vector<DeferredEvent> deferred_events_; - - void DispatchDOMEvent(mojom::AppCacheEventID, - int progress_total, - int progress_done, - mojom::AppCacheErrorReason, - const String& error_url, - int error_status, - const String& error_message); - - Member<ApplicationCacheHostHelper> helper_; + mojo::Binding<mojom::blink::AppCacheFrontend> binding_; + base::UnguessableToken host_id_; + mojom::blink::AppCacheInfo cache_info_; + scoped_refptr<base::SingleThreadTaskRunner> task_runner_; + mojom::blink::DocumentInterfaceBroker* interface_broker_; + // Invoked when CacheSelected() is called. + base::OnceClosure select_cache_for_shared_worker_completion_callback_; FRIEND_TEST_ALL_PREFIXES(DocumentTest, SandboxDisablesAppCache);
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache_host_client.h b/third_party/blink/renderer/core/loader/appcache/application_cache_host_client.h deleted file mode 100644 index ff79962..0000000 --- a/third_party/blink/renderer/core/loader/appcache/application_cache_host_client.h +++ /dev/null
@@ -1,64 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_APPCACHE_APPLICATION_CACHE_HOST_CLIENT_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_APPCACHE_APPLICATION_CACHE_HOST_CLIENT_H_ - -#include "third_party/blink/public/mojom/appcache/appcache.mojom-blink.h" - -namespace blink { - -// This interface is used by the embedder to call into webkit. -// TODO(https://crbug.com/950159): Remove ApplicationCacheHostClient as the -// communications happen in Blink. -class ApplicationCacheHostClient { - public: - // Called when a different cache, including possibly no cache, is associated - // with the host. - virtual void DidChangeCacheAssociation() = 0; - - // Called to fire events in the scriptable interface. - virtual void NotifyEventListener(mojom::AppCacheEventID) = 0; - virtual void NotifyProgressEventListener(const KURL&, - int num_total, - int num_complete) = 0; - virtual void NotifyErrorEventListener(mojom::AppCacheErrorReason, - const KURL&, - int status, - const String& message) = 0; - - protected: - // Should not be deleted by the embedder. - virtual ~ApplicationCacheHostClient() = default; -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_APPCACHE_APPLICATION_CACHE_HOST_CLIENT_H_
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.cc b/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.cc index e94b000..ef8bd06 100644 --- a/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.cc +++ b/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.cc
@@ -5,6 +5,7 @@ #include "third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.h" #include "third_party/blink/public/common/loader/url_loader_factory_bundle.h" +#include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/frame/local_frame_client.h" #include "third_party/blink/renderer/core/inspector/console_message.h" @@ -13,16 +14,35 @@ namespace blink { +namespace { + +const char kHttpGETMethod[] = "GET"; + +KURL ClearUrlRef(const KURL& input_url) { + KURL url(input_url); + if (!url.HasFragmentIdentifier()) + return url; + url.RemoveFragmentIdentifier(); + return url; +} + +void RestartNavigation(LocalFrame* frame) { + Document* document = frame->GetDocument(); + FrameLoadRequest request(document, ResourceRequest(document->Url())); + request.SetClientRedirectReason(ClientNavigationReason::kReload); + frame->Navigate(request, WebFrameLoadType::kReplaceCurrentItem); +} + +} // namespace + ApplicationCacheHostForFrame::ApplicationCacheHostForFrame( - LocalFrame* local_frame, - ApplicationCacheHostClient* client, - const base::UnguessableToken& appcache_host_id, + DocumentLoader* document_loader, + mojom::blink::DocumentInterfaceBroker* interface_broker, scoped_refptr<base::SingleThreadTaskRunner> task_runner) - : ApplicationCacheHostHelper(local_frame, - client, - appcache_host_id, - std::move(task_runner)), - local_frame_(local_frame) {} + : ApplicationCacheHost(document_loader, + interface_broker, + std::move(task_runner)), + local_frame_(document_loader->GetFrame()) {} void ApplicationCacheHostForFrame::LogMessage( mojom::blink::ConsoleMessageLevel log_level, @@ -51,9 +71,131 @@ local_frame_->Client()->UpdateSubresourceFactory(std::move(info)); } +void ApplicationCacheHostForFrame::WillStartLoadingMainResource( + DocumentLoader* loader, + const KURL& url, + const String& method) { + ApplicationCacheHost::WillStartLoadingMainResource(loader, url, method); + if (!backend_host_.is_bound()) + return; + + original_main_resource_url_ = ClearUrlRef(url); + is_get_method_ = (method == kHttpGETMethod); + DCHECK(method == method.UpperASCII()); + + const ApplicationCacheHost* spawning_host = nullptr; + + DCHECK(loader->GetFrame()); + LocalFrame* frame = loader->GetFrame(); + Frame* spawning_frame = frame->Tree().Parent(); + if (!spawning_frame || !IsA<LocalFrame>(spawning_frame)) + spawning_frame = frame->Loader().Opener(); + if (!spawning_frame || !IsA<LocalFrame>(spawning_frame)) + spawning_frame = frame; + if (DocumentLoader* spawning_doc_loader = + To<LocalFrame>(spawning_frame)->Loader().GetDocumentLoader()) { + spawning_host = spawning_doc_loader->GetApplicationCacheHost(); + } + + if (spawning_host && (spawning_host != this) && + (spawning_host->GetStatus() != + mojom::blink::AppCacheStatus::APPCACHE_STATUS_UNCACHED)) { + backend_host_->SetSpawningHostId(spawning_host->GetHostID()); + } +} + +void ApplicationCacheHostForFrame::SelectCacheWithoutManifest() { + if (!backend_host_.is_bound()) + return; + + if (was_select_cache_called_) + return; + was_select_cache_called_ = true; + + status_ = + (document_response_.AppCacheID() == mojom::blink::kAppCacheNoCacheId) + ? mojom::blink::AppCacheStatus::APPCACHE_STATUS_UNCACHED + : mojom::blink::AppCacheStatus::APPCACHE_STATUS_CHECKING; + is_new_master_entry_ = OLD_ENTRY; + backend_host_->SelectCache(document_url_, document_response_.AppCacheID(), + KURL()); +} + +void ApplicationCacheHostForFrame::SelectCacheWithManifest( + const KURL& manifest_url) { + ApplicationCacheHost::SelectCacheWithManifest(manifest_url); + + if (!backend_host_.is_bound()) + return; + + if (was_select_cache_called_) + return; + was_select_cache_called_ = true; + + KURL manifest_kurl(ClearUrlRef(manifest_url)); + + // 6.9.6 The application cache selection algorithm + // Check for new 'master' entries. + if (document_response_.AppCacheID() == mojom::blink::kAppCacheNoCacheId) { + if (is_scheme_supported_ && is_get_method_ && + SecurityOrigin::AreSameSchemeHostPort(manifest_kurl, document_url_)) { + status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_CHECKING; + is_new_master_entry_ = NEW_ENTRY; + } else { + status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_UNCACHED; + is_new_master_entry_ = OLD_ENTRY; + manifest_kurl = KURL(); + } + backend_host_->SelectCache(document_url_, mojom::blink::kAppCacheNoCacheId, + manifest_kurl); + return; + } + + DCHECK_EQ(OLD_ENTRY, is_new_master_entry_); + + // 6.9.6 The application cache selection algorithm + // Check for 'foreign' entries. + KURL document_manifest_kurl(document_response_.AppCacheManifestURL()); + if (document_manifest_kurl != manifest_kurl) { + backend_host_->MarkAsForeignEntry(document_url_, + document_response_.AppCacheID()); + status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_UNCACHED; + // It's a foreign entry, restart the current navigation from the top of the + // navigation algorithm. The navigation will not result in the same resource + // being loaded, because "foreign" entries are never picked during + // navigation. see ApplicationCacheGroup::selectCache() + RestartNavigation(local_frame_); // the navigation will be restarted + return; + } + + status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_CHECKING; + + // It's a 'master' entry that's already in the cache. + backend_host_->SelectCache(document_url_, document_response_.AppCacheID(), + manifest_kurl); +} + +void ApplicationCacheHostForFrame::DidReceiveResponseForMainResource( + const ResourceResponse& response) { + if (!backend_host_.is_bound()) + return; + + document_response_ = response; + document_url_ = ClearUrlRef(document_response_.CurrentRequestUrl()); + if (document_url_ != original_main_resource_url_) + is_get_method_ = true; // A redirect was involved. + original_main_resource_url_ = KURL(); + + is_scheme_supported_ = + Platform::Current()->IsURLSupportedForAppCache(document_url_); + if ((document_response_.AppCacheID() != mojom::blink::kAppCacheNoCacheId) || + !is_scheme_supported_ || !is_get_method_) + is_new_master_entry_ = OLD_ENTRY; +} + void ApplicationCacheHostForFrame::Trace(blink::Visitor* visitor) { visitor->Trace(local_frame_); - ApplicationCacheHostHelper::Trace(visitor); + ApplicationCacheHost::Trace(visitor); } } // namespace blink
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.h b/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.h index a75fc219..1b3d4c0 100644 --- a/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.h +++ b/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.h
@@ -5,28 +5,46 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_APPCACHE_APPLICATION_CACHE_HOST_FOR_FRAME_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_APPCACHE_APPLICATION_CACHE_HOST_FOR_FRAME_H_ -#include "third_party/blink/renderer/core/loader/appcache/application_cache_host_helper.h" +#include "third_party/blink/renderer/core/loader/appcache/application_cache_host.h" namespace blink { -class ApplicationCacheHostForFrame final : public ApplicationCacheHostHelper { + +class LocalFrame; + +class ApplicationCacheHostForFrame final : public ApplicationCacheHost { public: ApplicationCacheHostForFrame( - LocalFrame* local_frame, - ApplicationCacheHostClient* client, - const base::UnguessableToken& appcache_host_id, + DocumentLoader* document_loader, + mojom::blink::DocumentInterfaceBroker* interface_broker, scoped_refptr<base::SingleThreadTaskRunner> task_runner); - // mojom::blink::AppCacheHostFrontend: + // ApplicationCacheHost: void LogMessage(mojom::blink::ConsoleMessageLevel log_level, const String& message) override; void SetSubresourceFactory( network::mojom::blink::URLLoaderFactoryPtr url_loader_factory) override; + void WillStartLoadingMainResource(DocumentLoader* loader, + const KURL& url, + const String& method) override; + void SelectCacheWithoutManifest() override; + void SelectCacheWithManifest(const KURL& manifest_url) override; + void DidReceiveResponseForMainResource(const ResourceResponse&) override; + void Trace(blink::Visitor*) override; private: + enum IsNewMasterEntry { MAYBE_NEW_ENTRY, NEW_ENTRY, OLD_ENTRY }; + Member<LocalFrame> local_frame_; + bool is_get_method_ = false; + bool was_select_cache_called_ = false; + IsNewMasterEntry is_new_master_entry_ = MAYBE_NEW_ENTRY; + bool is_scheme_supported_ = false; + ResourceResponse document_response_; + KURL document_url_; + KURL original_main_resource_url_; // Used to detect redirection. }; } // namespace blink
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.cc b/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.cc index a90586b..fb167e0b 100644 --- a/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.cc +++ b/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.cc
@@ -7,32 +7,15 @@ namespace blink { ApplicationCacheHostForSharedWorker::ApplicationCacheHostForSharedWorker( - ApplicationCacheHostClient* client, - const base::UnguessableToken& appcache_host_id, + DocumentLoader* document_loader, scoped_refptr<base::SingleThreadTaskRunner> task_runner) - : ApplicationCacheHostHelper(nullptr /* LocalFrame* */, - client, - appcache_host_id, - std::move(task_runner)) {} + : ApplicationCacheHost(document_loader, + nullptr, /* interface_broker */ + std::move(task_runner)) {} ApplicationCacheHostForSharedWorker::~ApplicationCacheHostForSharedWorker() = default; -void ApplicationCacheHostForSharedWorker::WillStartMainResourceRequest( - const KURL& url, - const String& method, - const ApplicationCacheHostHelper* spawning_host) {} - -void ApplicationCacheHostForSharedWorker::DidReceiveResponseForMainResource( - const ResourceResponse&) {} - -void ApplicationCacheHostForSharedWorker::SelectCacheWithoutManifest() {} - -bool ApplicationCacheHostForSharedWorker::SelectCacheWithManifest( - const KURL& manifestURL) { - return true; -} - void ApplicationCacheHostForSharedWorker::LogMessage( mojom::blink::ConsoleMessageLevel log_level, const String& message) {}
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.h b/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.h index aaf17fe8..73b0c90 100644 --- a/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.h +++ b/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.h
@@ -5,36 +5,18 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_APPCACHE_APPLICATION_CACHE_HOST_FOR_SHARED_WORKER_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_APPCACHE_APPLICATION_CACHE_HOST_FOR_SHARED_WORKER_H_ -#include "base/unguessable_token.h" -#include "third_party/blink/renderer/core/loader/appcache/application_cache_host_helper.h" +#include "third_party/blink/renderer/core/loader/appcache/application_cache_host.h" namespace blink { -class ApplicationCacheHostForSharedWorker final - : public ApplicationCacheHostHelper { +class ApplicationCacheHostForSharedWorker final : public ApplicationCacheHost { public: ApplicationCacheHostForSharedWorker( - ApplicationCacheHostClient* client, - const base::UnguessableToken& appcache_host_id, + DocumentLoader* document_loader, scoped_refptr<base::SingleThreadTaskRunner> task_runner); ~ApplicationCacheHostForSharedWorker() override; - // Main resource loading is different for workers. The main resource is - // loaded by the worker using WorkerClassicScriptLoader. - // These overrides are stubbed out. - void WillStartMainResourceRequest( - const KURL& url, - const String& method, - const ApplicationCacheHostHelper* spawning_host) override; - void DidReceiveResponseForMainResource(const ResourceResponse&) override; - - // Cache selection is also different for workers. We know at construction - // time what cache to select and do so then. - // These overrides are stubbed out. - void SelectCacheWithoutManifest() override; - bool SelectCacheWithManifest(const KURL& manifestURL) override; - - // mojom::blink::AppCacheFrontend: + // ApplicationCacheHost: void LogMessage(mojom::blink::ConsoleMessageLevel log_level, const String& message) override; void SetSubresourceFactory(
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache_host_helper.cc b/third_party/blink/renderer/core/loader/appcache/application_cache_host_helper.cc deleted file mode 100644 index 0a097ea6..0000000 --- a/third_party/blink/renderer/core/loader/appcache/application_cache_host_helper.cc +++ /dev/null
@@ -1,361 +0,0 @@ -// 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 "third_party/blink/renderer/core/loader/appcache/application_cache_host_helper.h" - -#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom-blink.h" -#include "third_party/blink/public/platform/interface_provider.h" -#include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/core/frame/local_frame_client.h" -#include "third_party/blink/renderer/core/loader/appcache/application_cache_host_client.h" -#include "third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.h" -#include "third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.h" - -namespace blink { - -namespace { - -const char kHttpGETMethod[] = "GET"; - -// Note: the order of the elements in this array must match those -// of the EventID enum in appcache_interfaces.h. -const char* const kEventNames[] = {"Checking", "Error", "NoUpdate", - "Downloading", "Progress", "UpdateReady", - "Cached", "Obsolete"}; - -KURL ClearUrlRef(const KURL& input_url) { - KURL url(input_url); - if (!url.HasFragmentIdentifier()) - return url; - url.RemoveFragmentIdentifier(); - return url; -} - -mojom::blink::DocumentInterfaceBroker* GetDocumentInterfaceBroker( - LocalFrame* local_frame) { - if (!local_frame) - return nullptr; - return local_frame->Client()->GetDocumentInterfaceBroker(); -} - -} // namespace - -ApplicationCacheHostHelper* ApplicationCacheHostHelper::Create( - LocalFrame* local_frame, - ApplicationCacheHostClient* client, - const base::UnguessableToken& appcache_host_id) { - WebLocalFrameClient::AppCacheType type = - local_frame->Client()->GetAppCacheType(); - switch (type) { - case WebLocalFrameClient::AppCacheType::kAppCacheForFrame: - return MakeGarbageCollected<ApplicationCacheHostForFrame>( - local_frame, client, appcache_host_id, - local_frame->GetTaskRunner(TaskType::kNetworking)); - case WebLocalFrameClient::AppCacheType::kAppCacheForSharedWorker: - return MakeGarbageCollected<ApplicationCacheHostForSharedWorker>( - client, appcache_host_id, Thread::Current()->GetTaskRunner()); - default: - break; - } - return nullptr; -} - -ApplicationCacheHostHelper::ApplicationCacheHostHelper() : binding_(this) {} - -ApplicationCacheHostHelper::ApplicationCacheHostHelper( - LocalFrame* local_frame, - ApplicationCacheHostClient* client, - const base::UnguessableToken& appcache_host_id, - scoped_refptr<base::SingleThreadTaskRunner> task_runner) - : binding_(this), - client_(client), - status_(mojom::blink::AppCacheStatus::APPCACHE_STATUS_UNCACHED), - is_scheme_supported_(false), - is_get_method_(false), - is_new_master_entry_(MAYBE_NEW_ENTRY), - was_select_cache_called_(false) { - DCHECK(client); - // PlzNavigate: The browser passes the ID to be used. - if (!appcache_host_id.is_empty()) - host_id_ = appcache_host_id; - else - host_id_ = base::UnguessableToken::Create(); - - mojom::blink::AppCacheFrontendPtr frontend_ptr; - binding_.Bind(mojo::MakeRequest(&frontend_ptr, task_runner), task_runner); - - mojom::blink::DocumentInterfaceBroker* interface_broker = - GetDocumentInterfaceBroker(local_frame); - if (interface_broker) { - interface_broker->RegisterAppCacheHost( - mojo::MakeRequest(&backend_host_, std::move(task_runner)), - std::move(frontend_ptr), host_id_); - return; - } - - DEFINE_STATIC_LOCAL( - const mojom::blink::AppCacheBackendPtr, backend_ptr, ([] { - mojom::blink::AppCacheBackendPtr result; - Platform::Current()->GetInterfaceProvider()->GetInterface( - mojo::MakeRequest(&result)); - return result; - }())); - - // Once we have 'WebContextInterfaceBroker', we can call this function through - // it like render frame. - // Refer to the design document, 'https://bit.ly/2GT0rZv'. - backend_ptr.get()->RegisterHost( - mojo::MakeRequest(&backend_host_, std::move(task_runner)), - std::move(frontend_ptr), host_id_); -} - -ApplicationCacheHostHelper::~ApplicationCacheHostHelper() = default; - -void ApplicationCacheHostHelper::CacheSelected( - mojom::blink::AppCacheInfoPtr info) { - cache_info_ = *info; - client_->DidChangeCacheAssociation(); - if (select_cache_for_shared_worker_completion_callback_) - std::move(select_cache_for_shared_worker_completion_callback_).Run(); -} - -void ApplicationCacheHostHelper::EventRaised( - mojom::blink::AppCacheEventID event_id) { - DCHECK_NE(event_id, - mojom::blink::AppCacheEventID:: - APPCACHE_PROGRESS_EVENT); // See OnProgressEventRaised. - DCHECK_NE(event_id, - mojom::blink::AppCacheEventID:: - APPCACHE_ERROR_EVENT); // See OnErrorEventRaised. - - // Emit logging output prior to calling out to script as we can get - // deleted within the script event handler. - const char kFormatString[] = "Application Cache %s event"; - String message = - String::Format(kFormatString, kEventNames[static_cast<int>(event_id)]); - LogMessage(mojom::blink::ConsoleMessageLevel::kInfo, message); - - switch (event_id) { - case mojom::blink::AppCacheEventID::APPCACHE_CHECKING_EVENT: - status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_CHECKING; - break; - case mojom::blink::AppCacheEventID::APPCACHE_DOWNLOADING_EVENT: - status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_DOWNLOADING; - break; - case mojom::blink::AppCacheEventID::APPCACHE_UPDATE_READY_EVENT: - status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_UPDATE_READY; - break; - case mojom::blink::AppCacheEventID::APPCACHE_CACHED_EVENT: - case mojom::blink::AppCacheEventID::APPCACHE_NO_UPDATE_EVENT: - status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_IDLE; - break; - case mojom::blink::AppCacheEventID::APPCACHE_OBSOLETE_EVENT: - status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_OBSOLETE; - break; - default: - NOTREACHED(); - break; - } - - client_->NotifyEventListener(event_id); -} - -void ApplicationCacheHostHelper::ProgressEventRaised(const KURL& url, - int num_total, - int num_complete) { - // Emit logging output prior to calling out to script as we can get - // deleted within the script event handler. - const char kFormatString[] = "Application Cache Progress event (%d of %d) %s"; - String message = String::Format(kFormatString, num_complete, num_total, - url.GetString().Utf8().c_str()); - LogMessage(mojom::blink::ConsoleMessageLevel::kInfo, message); - status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_DOWNLOADING; - client_->NotifyProgressEventListener(url, num_total, num_complete); -} - -void ApplicationCacheHostHelper::ErrorEventRaised( - mojom::blink::AppCacheErrorDetailsPtr details) { - // Emit logging output prior to calling out to script as we can get - // deleted within the script event handler. - const char kFormatString[] = "Application Cache Error event: %s"; - String full_message = - String::Format(kFormatString, details->message.Utf8().c_str()); - LogMessage(mojom::blink::ConsoleMessageLevel::kError, full_message); - - status_ = cache_info_.is_complete - ? mojom::blink::AppCacheStatus::APPCACHE_STATUS_IDLE - : mojom::blink::AppCacheStatus::APPCACHE_STATUS_UNCACHED; - if (details->is_cross_origin) { - // Don't leak detailed information to script for cross-origin resources. - DCHECK_EQ(mojom::blink::AppCacheErrorReason::APPCACHE_RESOURCE_ERROR, - details->reason); - client_->NotifyErrorEventListener(details->reason, details->url, 0, - String()); - } else { - client_->NotifyErrorEventListener(details->reason, details->url, - details->status, details->message); - } -} - -void ApplicationCacheHostHelper::WillStartMainResourceRequest( - const KURL& url, - const String& method, - const ApplicationCacheHostHelper* spawning_host) { - original_main_resource_url_ = ClearUrlRef(url); - - is_get_method_ = (method == kHttpGETMethod); - DCHECK(method == method.UpperASCII()); - - const ApplicationCacheHostHelper* spawning_host_impl = - static_cast<const ApplicationCacheHostHelper*>(spawning_host); - if (spawning_host_impl && (spawning_host_impl != this) && - (spawning_host_impl->status_ != - mojom::blink::AppCacheStatus::APPCACHE_STATUS_UNCACHED)) { - backend_host_->SetSpawningHostId(spawning_host_impl->host_id()); - } -} - -void ApplicationCacheHostHelper::SelectCacheWithoutManifest() { - if (was_select_cache_called_) - return; - was_select_cache_called_ = true; - - status_ = - (document_response_.AppCacheID() == mojom::blink::kAppCacheNoCacheId) - ? mojom::blink::AppCacheStatus::APPCACHE_STATUS_UNCACHED - : mojom::blink::AppCacheStatus::APPCACHE_STATUS_CHECKING; - is_new_master_entry_ = OLD_ENTRY; - backend_host_->SelectCache(document_url_, document_response_.AppCacheID(), - KURL()); -} - -bool ApplicationCacheHostHelper::SelectCacheWithManifest( - const KURL& manifest_url) { - if (was_select_cache_called_) - return true; - was_select_cache_called_ = true; - - KURL manifest_kurl(ClearUrlRef(manifest_url)); - - // 6.9.6 The application cache selection algorithm - // Check for new 'master' entries. - if (document_response_.AppCacheID() == mojom::blink::kAppCacheNoCacheId) { - if (is_scheme_supported_ && is_get_method_ && - SecurityOrigin::AreSameSchemeHostPort(manifest_kurl, document_url_)) { - status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_CHECKING; - is_new_master_entry_ = NEW_ENTRY; - } else { - status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_UNCACHED; - is_new_master_entry_ = OLD_ENTRY; - manifest_kurl = KURL(); - } - backend_host_->SelectCache(document_url_, mojom::blink::kAppCacheNoCacheId, - manifest_kurl); - return true; - } - - DCHECK_EQ(OLD_ENTRY, is_new_master_entry_); - - // 6.9.6 The application cache selection algorithm - // Check for 'foreign' entries. - KURL document_manifest_kurl(document_response_.AppCacheManifestURL()); - if (document_manifest_kurl != manifest_kurl) { - backend_host_->MarkAsForeignEntry(document_url_, - document_response_.AppCacheID()); - status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_UNCACHED; - return false; // the navigation will be restarted - } - - status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_CHECKING; - - // It's a 'master' entry that's already in the cache. - backend_host_->SelectCache(document_url_, document_response_.AppCacheID(), - manifest_kurl); - return true; -} - -void ApplicationCacheHostHelper::DidReceiveResponseForMainResource( - const ResourceResponse& response) { - document_response_ = response; - document_url_ = ClearUrlRef(document_response_.CurrentRequestUrl()); - if (document_url_ != original_main_resource_url_) - is_get_method_ = true; // A redirect was involved. - original_main_resource_url_ = KURL(); - - is_scheme_supported_ = - Platform::Current()->IsURLSupportedForAppCache(document_url_); - if ((document_response_.AppCacheID() != mojom::blink::kAppCacheNoCacheId) || - !is_scheme_supported_ || !is_get_method_) - is_new_master_entry_ = OLD_ENTRY; -} - -mojom::blink::AppCacheStatus ApplicationCacheHostHelper::GetStatus() { - return status_; -} - -bool ApplicationCacheHostHelper::StartUpdate() { - bool result = false; - backend_host_->StartUpdate(&result); - if (!result) - return false; - if (status_ == mojom::blink::AppCacheStatus::APPCACHE_STATUS_IDLE || - status_ == mojom::blink::AppCacheStatus::APPCACHE_STATUS_UPDATE_READY) { - status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_CHECKING; - } else { - status_ = mojom::blink::AppCacheStatus::APPCACHE_STATUS_UNCACHED; - backend_host_->GetStatus(&status_); - } - return true; -} - -bool ApplicationCacheHostHelper::SwapCache() { - bool result = false; - backend_host_->SwapCache(&result); - if (!result) - return false; - backend_host_->GetStatus(&status_); - return true; -} - -void ApplicationCacheHostHelper::GetAssociatedCacheInfo( - ApplicationCacheHostHelper::CacheInfo* info) { - info->manifest_url = cache_info_.manifest_url; - if (!cache_info_.is_complete) - return; - info->creation_time = cache_info_.creation_time.ToDoubleT(); - info->update_time = cache_info_.last_update_time.ToDoubleT(); - info->response_sizes = cache_info_.response_sizes; - info->padding_sizes = cache_info_.padding_sizes; -} - -const base::UnguessableToken& ApplicationCacheHostHelper::GetHostID() const { - return host_id_; -} - -void ApplicationCacheHostHelper::GetResourceList( - Vector<mojom::blink::AppCacheResourceInfo>* resources) { - DCHECK(resources); - if (!cache_info_.is_complete) - return; - Vector<mojom::blink::AppCacheResourceInfoPtr> boxed_infos; - backend_host_->GetResourceList(&boxed_infos); - for (auto& b : boxed_infos) { - resources->emplace_back(std::move(*b)); - } -} - -void ApplicationCacheHostHelper::SelectCacheForSharedWorker( - int64_t app_cache_id, - base::OnceClosure completion_callback) { - select_cache_for_shared_worker_completion_callback_ = - std::move(completion_callback); - backend_host_->SelectCacheForSharedWorker(app_cache_id); -} - -void ApplicationCacheHostHelper::DetachFromDocumentLoader() { - binding_.Close(); - client_ = nullptr; -} - -} // namespace blink
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache_host_helper.h b/third_party/blink/renderer/core/loader/appcache/application_cache_host_helper.h deleted file mode 100644 index a79d2b0..0000000 --- a/third_party/blink/renderer/core/loader/appcache/application_cache_host_helper.h +++ /dev/null
@@ -1,115 +0,0 @@ -// 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. - -#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_APPCACHE_APPLICATION_CACHE_HOST_HELPER_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_APPCACHE_APPLICATION_CACHE_HOST_HELPER_H_ - -#include "mojo/public/cpp/bindings/binding.h" -#include "third_party/blink/public/mojom/appcache/appcache.mojom-blink.h" -#include "third_party/blink/public/mojom/appcache/appcache_info.mojom-blink.h" -#include "third_party/blink/public/mojom/devtools/console_message.mojom-blink.h" -#include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/core/frame/local_frame.h" -#include "third_party/blink/renderer/platform/loader/fetch/resource_response.h" -#include "third_party/blink/renderer/platform/weborigin/kurl.h" - -namespace blink { - -class ApplicationCacheHostClient; - -// TODO(https://crbug.com/950159): Combine ApplicationCacheHostHelper and -// ApplicationCacheHost and make ApplicationCacheHostForFrame and -// ApplicationCacheHostForSharedWorker inherited from ApplicationCacheHost. -class CORE_EXPORT ApplicationCacheHostHelper - : public GarbageCollectedFinalized<ApplicationCacheHostHelper>, - public mojom::blink::AppCacheFrontend { - public: - static ApplicationCacheHostHelper* Create( - LocalFrame* local_frame, - ApplicationCacheHostClient* client, - const base::UnguessableToken& appcache_host_id); - - // This is only for testing in order to create it without any arguments. - ApplicationCacheHostHelper(); - - ApplicationCacheHostHelper( - // |local_frame| is used for accessing to DocumentInterfaceBroker. As it's - // not used for workers, |local_frame| is null for workers. - LocalFrame* local_frame, - ApplicationCacheHostClient* client, - const base::UnguessableToken& appcache_host_id, - scoped_refptr<base::SingleThreadTaskRunner> task_runner); - ~ApplicationCacheHostHelper() override; - - const base::UnguessableToken& host_id() const { return host_id_; } - - // mojom::blink::AppCacheFrontend - void CacheSelected(mojom::blink::AppCacheInfoPtr info) override; - void EventRaised(mojom::blink::AppCacheEventID event_id) override; - void ProgressEventRaised(const KURL& url, - int32_t num_total, - int32_t num_complete) override; - void ErrorEventRaised(mojom::blink::AppCacheErrorDetailsPtr details) override; - void LogMessage(mojom::blink::ConsoleMessageLevel log_level, - const String& message) override {} - void SetSubresourceFactory( - network::mojom::blink::URLLoaderFactoryPtr url_loader_factory) override {} - - virtual void WillStartMainResourceRequest( - const KURL& url, - const String& method, - const ApplicationCacheHostHelper* spawning_host); - virtual void SelectCacheWithoutManifest(); - virtual bool SelectCacheWithManifest(const KURL& manifestURL); - virtual void DidReceiveResponseForMainResource(const ResourceResponse&); - - mojom::blink::AppCacheStatus GetStatus(); - bool StartUpdate(); - bool SwapCache(); - void GetResourceList(Vector<mojom::blink::AppCacheResourceInfo>* resources); - // Structures and methods to support inspecting Application Caches. - struct CacheInfo { - KURL manifest_url; // Empty if there is no associated cache. - double creation_time; - double update_time; - // Sums up the sizes of all the responses in this cache. - int64_t response_sizes; - // Sums up the padding sizes for all opaque responses in the cache. - int64_t padding_sizes; - CacheInfo() - : creation_time(0), - update_time(0), - response_sizes(0), - padding_sizes(0) {} - }; - void GetAssociatedCacheInfo(CacheInfo* info); - const base::UnguessableToken& GetHostID() const; - void SelectCacheForSharedWorker(int64_t app_cache_id, - base::OnceClosure completion_callback); - void DetachFromDocumentLoader(); - virtual void Trace(blink::Visitor*) {} - - private: - enum IsNewMasterEntry { MAYBE_NEW_ENTRY, NEW_ENTRY, OLD_ENTRY }; - - mojo::Binding<mojom::blink::AppCacheFrontend> binding_; - ApplicationCacheHostClient* client_; - mojom::blink::AppCacheHostPtr backend_host_; - base::UnguessableToken host_id_; - mojom::blink::AppCacheStatus status_; - ResourceResponse document_response_; - KURL document_url_; - bool is_scheme_supported_; - bool is_get_method_; - IsNewMasterEntry is_new_master_entry_; - mojom::blink::AppCacheInfo cache_info_; - KURL original_main_resource_url_; // Used to detect redirection. - bool was_select_cache_called_; - // Invoked when CacheSelected() is called. - base::OnceClosure select_cache_for_shared_worker_completion_callback_; -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_APPCACHE_APPLICATION_CACHE_HOST_HELPER_H_
diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc index ee3c4eb..c4b55a5 100644 --- a/third_party/blink/renderer/core/loader/document_loader.cc +++ b/third_party/blink/renderer/core/loader/document_loader.cc
@@ -1139,7 +1139,7 @@ DCHECK_EQ(state_, kNotStarted); DCHECK(params_); state_ = kProvisional; - application_cache_host_ = MakeGarbageCollected<ApplicationCacheHost>(this); + application_cache_host_ = ApplicationCacheHost::Create(this); if (url_.IsEmpty() && !GetFrameLoader().StateMachine()->CreatingInitialEmptyDocument()) {
diff --git a/third_party/blink/renderer/core/loader/document_loader.h b/third_party/blink/renderer/core/loader/document_loader.h index 02f29915..be60065c 100644 --- a/third_party/blink/renderer/core/loader/document_loader.h +++ b/third_party/blink/renderer/core/loader/document_loader.h
@@ -282,6 +282,9 @@ // The caller owns the |clock| which must outlive the DocumentLoader. void SetTickClockForTesting(const base::TickClock* clock) { clock_ = clock; } + void SetApplicationCacheHostForTesting(ApplicationCacheHost* host) { + application_cache_host_ = host; + } void SetLoadingJavaScriptUrl() { loading_url_as_javascript_ = true; }
diff --git a/third_party/blink/renderer/core/mojo/mojo_watcher.cc b/third_party/blink/renderer/core/mojo/mojo_watcher.cc index 3fcfebc..d4e0652b 100644 --- a/third_party/blink/renderer/core/mojo/mojo_watcher.cc +++ b/third_party/blink/renderer/core/mojo/mojo_watcher.cc
@@ -25,17 +25,15 @@ // Current clients expect to recieve the initial error returned by MojoWatch // via watch callback. // - // Note that the usage of wrapPersistent is intentional so that the intial + // Note that the usage of WrapPersistent is intentional so that the initial // error is guaranteed to be reported to the client in case where the given // handle is invalid and garbage collection happens before the callback // is scheduled. if (result != MOJO_RESULT_OK) { watcher->task_runner_->PostTask( FROM_HERE, - WTF::Bind(&V8PersistentCallbackFunction< - V8MojoWatchCallback>::InvokeAndReportException, - WrapPersistent(ToV8PersistentCallbackFunction(callback)), - WrapPersistent(watcher), result)); + WTF::Bind(&V8MojoWatchCallback::InvokeAndReportException, + WrapPersistent(callback), WrapPersistent(watcher), result)); } return watcher; }
diff --git a/third_party/blink/renderer/core/page/scrolling/scroll_state_callback.h b/third_party/blink/renderer/core/page/scrolling/scroll_state_callback.h index daca9a2..840f0459 100644 --- a/third_party/blink/renderer/core/page/scrolling/scroll_state_callback.h +++ b/third_party/blink/renderer/core/page/scrolling/scroll_state_callback.h
@@ -49,8 +49,7 @@ explicit ScrollStateCallbackV8Impl( V8ScrollStateCallback* callback, WebNativeScrollBehavior native_scroll_behavior) - : ScrollStateCallback(native_scroll_behavior), - callback_(ToV8PersistentCallbackFunction(callback)) {} + : ScrollStateCallback(native_scroll_behavior), callback_(callback) {} ~ScrollStateCallbackV8Impl() override = default; void Trace(blink::Visitor*) override; @@ -61,7 +60,7 @@ static WebNativeScrollBehavior ParseNativeScrollBehavior( const String& native_scroll_behavior); - Member<V8PersistentCallbackFunction<V8ScrollStateCallback>> callback_; + Member<V8ScrollStateCallback> callback_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/probe/core_probes.pidl b/third_party/blink/renderer/core/probe/core_probes.pidl index da978b1..ae60ed0 100644 --- a/third_party/blink/renderer/core/probe/core_probes.pidl +++ b/third_party/blink/renderer/core/probe/core_probes.pidl
@@ -127,7 +127,7 @@ void WillSendWebSocketHandshakeRequest([Keep] ExecutionContext*, uint64_t identifier, network::mojom::blink::WebSocketHandshakeRequest* request); void DidReceiveWebSocketHandshakeResponse([Keep] ExecutionContext*, uint64_t identifier, network::mojom::blink::WebSocketHandshakeRequest* request, network::mojom::blink::WebSocketHandshakeResponse* response); void DidCloseWebSocket([Keep] ExecutionContext*, uint64_t identifier); - void DidReceiveWebSocketMessage(ExecutionContext*, uint64_t identifier, int opcode, bool masked, const char* payload, size_t payload_length); + void DidReceiveWebSocketMessage(ExecutionContext*, uint64_t identifier, int opcode, bool masked, const Vector<base::span<const char>>& data); void DidSendWebSocketMessage(ExecutionContext*, uint64_t identifier, int opcode, bool masked, const char* payload, size_t payload_length); void DidReceiveWebSocketMessageError(ExecutionContext*, uint64_t identifier, const String& error_message); void NetworkStateChanged([Keep] LocalFrame*, bool online);
diff --git a/third_party/blink/renderer/core/scroll/scroll_animator.cc b/third_party/blink/renderer/core/scroll/scroll_animator.cc index 45c0dae..053cd8d9 100644 --- a/third_party/blink/renderer/core/scroll/scroll_animator.cc +++ b/third_party/blink/renderer/core/scroll/scroll_animator.cc
@@ -61,7 +61,7 @@ } ScrollAnimator::ScrollAnimator(ScrollableArea* scrollable_area, - WTF::TimeFunction time_function) + TimeFunction time_function) : ScrollAnimatorBase(scrollable_area), time_function_(time_function), last_granularity_(ScrollGranularity::kScrollByPixel) {}
diff --git a/third_party/blink/renderer/core/scroll/scroll_animator.h b/third_party/blink/renderer/core/scroll/scroll_animator.h index 9cf36afa..269affe9 100644 --- a/third_party/blink/renderer/core/scroll/scroll_animator.h +++ b/third_party/blink/renderer/core/scroll/scroll_animator.h
@@ -99,8 +99,9 @@ class CORE_EXPORT ScrollAnimator : public ScrollAnimatorBase { public: + using TimeFunction = double (*)(); explicit ScrollAnimator(ScrollableArea*, - WTF::TimeFunction = WTF::CurrentTimeTicksInSeconds); + TimeFunction = WTF::CurrentTimeTicksInSeconds); ~ScrollAnimator() override; bool HasRunningAnimation() const override; @@ -140,7 +141,7 @@ std::unique_ptr<CompositorScrollOffsetAnimationCurve> animation_curve_; double start_time_; - WTF::TimeFunction time_function_; + TimeFunction time_function_; private: // Returns true if the animation was scheduled successfully. If animation
diff --git a/third_party/blink/renderer/core/scroll/scroll_animator_test.cc b/third_party/blink/renderer/core/scroll/scroll_animator_test.cc index 4679cb9..4d9ab8c5 100644 --- a/third_party/blink/renderer/core/scroll/scroll_animator_test.cc +++ b/third_party/blink/renderer/core/scroll/scroll_animator_test.cc
@@ -150,7 +150,7 @@ class TestScrollAnimator : public ScrollAnimator { public: TestScrollAnimator(ScrollableArea* scrollable_area, - WTF::TimeFunction timing_function) + TimeFunction timing_function) : ScrollAnimator(scrollable_area, timing_function) {} ~TestScrollAnimator() override = default;
diff --git a/third_party/blink/renderer/core/scroll/scrollable_area.cc b/third_party/blink/renderer/core/scroll/scrollable_area.cc index fef4876a..d84a3db5 100644 --- a/third_party/blink/renderer/core/scroll/scrollable_area.cc +++ b/third_party/blink/renderer/core/scroll/scrollable_area.cc
@@ -94,7 +94,9 @@ needs_show_scrollbar_layers_(false), uses_composited_scrolling_(false) {} -ScrollableArea::~ScrollableArea() = default; +ScrollableArea::~ScrollableArea() { + RunScrollCompleteCallbacks(); +} void ScrollableArea::ClearScrollableArea() { #if defined(OS_MACOSX) @@ -161,7 +163,11 @@ TRACE_EVENT2("input", "ScrollableArea::UserScroll", "x", delta.Width(), "y", delta.Height()); - base::ScopedClosureRunner run_on_return(std::move(on_finish)); + if (on_finish) + RegisterScrollCompleteCallback(std::move(on_finish)); + + base::ScopedClosureRunner run_on_return(WTF::Bind( + &ScrollableArea::RunScrollCompleteCallbacks, WrapWeakPersistent(this))); float step_x = ScrollStep(granularity, kHorizontalScrollbar); float step_y = ScrollStep(granularity, kVerticalScrollbar); @@ -198,7 +204,12 @@ ScrollType scroll_type, ScrollBehavior behavior, ScrollCallback on_finish) { - base::ScopedClosureRunner run_on_return(std::move(on_finish)); + if (on_finish) + RegisterScrollCompleteCallback(std::move(on_finish)); + + base::ScopedClosureRunner run_on_return(WTF::Bind( + &ScrollableArea::RunScrollCompleteCallbacks, WrapWeakPersistent(this))); + if (SmoothScrollSequencer* sequencer = GetSmoothScrollSequencer()) { if (sequencer->FilterNewScrollOrAbortCurrent(scroll_type)) { return; @@ -284,7 +295,7 @@ ScrollCallback callback = std::move(on_finish); if (RuntimeEnabledFeatures::UpdateHoverFromScrollAtBeginFrameEnabled()) { - callback = ScrollCallback(base::BindOnce( + callback = ScrollCallback(WTF::Bind( [](ScrollCallback original_callback, WeakPersistent<ScrollableArea> area) { if (area) @@ -410,6 +421,17 @@ ScrollOffsetChanged(ScrollOffset(offset), kProgrammaticScroll); } +void ScrollableArea::RegisterScrollCompleteCallback(ScrollCallback callback) { + pending_scroll_complete_callbacks_.push_back(std::move(callback)); +} + +void ScrollableArea::RunScrollCompleteCallbacks() { + Vector<ScrollCallback> callbacks( + std::move(pending_scroll_complete_callbacks_)); + for (auto& callback : callbacks) + std::move(callback).Run(); +} + void ScrollableArea::ContentAreaWillPaint() const { if (ScrollAnimatorBase* scroll_animator = ExistingScrollAnimator()) scroll_animator->ContentAreaWillPaint();
diff --git a/third_party/blink/renderer/core/scroll/scrollable_area.h b/third_party/blink/renderer/core/scroll/scrollable_area.h index ce628940..e5c354c 100644 --- a/third_party/blink/renderer/core/scroll/scrollable_area.h +++ b/third_party/blink/renderer/core/scroll/scrollable_area.h
@@ -114,6 +114,11 @@ static bool ScrollBehaviorFromString(const String&, ScrollBehavior&); + // Register a callback that will be invoked when the next scroll completes - + // this includes the scroll animation time. + void RegisterScrollCompleteCallback(ScrollCallback callback); + void RunScrollCompleteCallbacks(); + void ContentAreaWillPaint() const; void MouseEnteredContentArea() const; void MouseExitedContentArea() const; @@ -487,6 +492,8 @@ std::unique_ptr<TaskRunnerTimer<ScrollableArea>> fade_overlay_scrollbars_timer_; + Vector<ScrollCallback> pending_scroll_complete_callbacks_; + unsigned scrollbar_overlay_color_theme_ : 2; unsigned horizontal_scrollbar_needs_paint_invalidation_ : 1;
diff --git a/third_party/blink/renderer/core/scroll/scrollbar.cc b/third_party/blink/renderer/core/scroll/scrollbar.cc index 5ed8c6d..251927c 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar.cc +++ b/third_party/blink/renderer/core/scroll/scrollbar.cc
@@ -436,15 +436,6 @@ // Taps perform a single scroll begin/update/end sequence of gesture // events. There's no autoscroll timer since long press is not treated // the same as holding a mouse down. - // TODO(dlibby): Injecting GSE immediately after GSU causes scroll snap - // to be applied immediately when the GSE is handled, which makes it - // look like an instant scroll to the snap position (and if this is the - // button part, most likely doesn't give the user any visual indication - // as button scrolls are small enough that they don't exceed thresholds - // needed to advance to the next snap point). - // The GSE should probably be queued up as a delayed task - // (proportional to the tap gesture timeout?). At that point we should - // also clear state related to pressed_part_, etc. InjectScrollGestureForPressedPart(WebInputEvent::kGestureScrollBegin); InjectScrollGestureForPressedPart(WebInputEvent::kGestureScrollUpdate); InjectScrollGestureForPressedPart(WebInputEvent::kGestureScrollEnd);
diff --git a/third_party/blink/renderer/core/streams/readable_stream_operations_test.cc b/third_party/blink/renderer/core/streams/readable_stream_operations_test.cc index cca17f36..8f77a2b 100644 --- a/third_party/blink/renderer/core/streams/readable_stream_operations_test.cc +++ b/third_party/blink/renderer/core/streams/readable_stream_operations_test.cc
@@ -132,6 +132,8 @@ } TEST(ReadableStreamOperationsTest, IsReadableStream) { + ScopedStreamsNativeForTest enabled(false); + V8TestingScope scope; TryCatchScope try_catch_scope(scope.GetIsolate()); EXPECT_FALSE(ReadableStreamOperations::IsReadableStream( @@ -168,6 +170,8 @@ } TEST(ReadableStreamOperationsTest, IsReadableStreamDefaultReaderInvalid) { + ScopedStreamsNativeForTest enabled(false); + V8TestingScope scope; TryCatchScope try_catch_scope(scope.GetIsolate()); EXPECT_FALSE(ReadableStreamOperations::IsReadableStreamDefaultReader( @@ -196,6 +200,8 @@ } TEST(ReadableStreamOperationsTest, GetReader) { + ScopedStreamsNativeForTest enabled(false); + V8TestingScope scope; TryCatchScope try_catch_scope(scope.GetIsolate()); auto* stream = @@ -233,6 +239,8 @@ } TEST(ReadableStreamOperationsTest, IsDisturbed) { + ScopedStreamsNativeForTest enabled(false); + V8TestingScope scope; TryCatchScope try_catch_scope(scope.GetIsolate()); auto* stream = @@ -253,6 +261,8 @@ } TEST(ReadableStreamOperationsTest, Read) { + ScopedStreamsNativeForTest enabled(false); + V8TestingScope scope; TryCatchScope try_catch_scope(scope.GetIsolate()); ScriptValue reader = @@ -302,6 +312,8 @@ TEST(ReadableStreamOperationsTest, CreateReadableStreamWithCustomUnderlyingSourceAndStrategy) { + ScopedStreamsNativeForTest enabled(false); + V8TestingScope scope; TryCatchScope try_catch_scope(scope.GetIsolate()); auto* underlying_source = @@ -369,6 +381,8 @@ } TEST(ReadableStreamOperationsTest, IsReadable) { + ScopedStreamsNativeForTest enabled(false); + V8TestingScope scope; TryCatchScope try_catch_scope(scope.GetIsolate()); @@ -409,6 +423,8 @@ } TEST(ReadableStreamOperationsTest, IsClosed) { + ScopedStreamsNativeForTest enabled(false); + V8TestingScope scope; TryCatchScope try_catch_scope(scope.GetIsolate()); @@ -449,6 +465,8 @@ } TEST(ReadableStreamOperationsTest, IsErrored) { + ScopedStreamsNativeForTest enabled(false); + V8TestingScope scope; TryCatchScope try_catch_scope(scope.GetIsolate()); @@ -489,6 +507,8 @@ } TEST(ReadableStreamOperationsTest, Tee) { + ScopedStreamsNativeForTest enabled(false); + V8TestingScope scope; TryCatchScope try_catch_scope(scope.GetIsolate()); v8::Local<v8::Context> context = scope.GetScriptState()->GetContext(); @@ -560,7 +580,8 @@ } TEST(ReadableStreamOperationsTest, Serialize) { - ScopedTransferableStreamsForTest enabled(true); + ScopedStreamsNativeForTest streams_native_enabled(false); + ScopedTransferableStreamsForTest transferable_streams_enabled(true); V8TestingScope scope; TryCatchScope try_catch_scope(scope.GetIsolate());
diff --git a/third_party/blink/renderer/core/timing/performance_navigation_timing.cc b/third_party/blink/renderer/core/timing/performance_navigation_timing.cc index 07534734..70d78e48 100644 --- a/third_party/blink/renderer/core/timing/performance_navigation_timing.cc +++ b/third_party/blink/renderer/core/timing/performance_navigation_timing.cc
@@ -13,9 +13,38 @@ #include "third_party/blink/renderer/core/performance_entry_names.h" #include "third_party/blink/renderer/core/timing/performance.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_timing_info.h" +#include "third_party/blink/renderer/platform/weborigin/kurl.h" namespace blink { +namespace { + +bool PassesSameOriginCheck(const ResourceResponse& response, + const SecurityOrigin& initiator_security_origin) { + const KURL& response_url = response.ResponseUrl(); + scoped_refptr<const SecurityOrigin> resource_origin = + SecurityOrigin::Create(response_url); + return resource_origin->IsSameSchemeHostPort(&initiator_security_origin); +} + +bool AllowNavigationTimingRedirect( + const Vector<ResourceResponse>& redirect_chain, + const ResourceResponse& final_response, + const SecurityOrigin& initiator_security_origin) { + if (!PassesSameOriginCheck(final_response, initiator_security_origin)) { + return false; + } + + for (const ResourceResponse& response : redirect_chain) { + if (!PassesSameOriginCheck(response, initiator_security_origin)) + return false; + } + + return true; +} + +} // namespace + PerformanceNavigationTiming::PerformanceNavigationTiming( LocalFrame* frame, ResourceTimingInfo* info, @@ -119,17 +148,18 @@ } bool PerformanceNavigationTiming::GetAllowRedirectDetails() const { - ExecutionContext* context = GetFrame() ? GetFrame()->GetDocument() : nullptr; - const SecurityOrigin* security_origin = nullptr; + blink::ExecutionContext* context = + GetFrame() ? GetFrame()->GetDocument() : nullptr; + const blink::SecurityOrigin* security_origin = nullptr; if (context) security_origin = context->GetSecurityOrigin(); if (!security_origin) return false; // TODO(sunjian): Think about how to make this flag deterministic. // crbug/693183. - return Performance::AllowsTimingRedirect( - resource_timing_info_->RedirectChain(), - resource_timing_info_->FinalResponse(), *security_origin, context); + return AllowNavigationTimingRedirect(resource_timing_info_->RedirectChain(), + resource_timing_info_->FinalResponse(), + *security_origin); } AtomicString PerformanceNavigationTiming::AlpnNegotiatedProtocol() const {
diff --git a/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.cc b/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.cc index 769b4271..dd38aed 100644 --- a/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.cc +++ b/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.cc
@@ -102,4 +102,25 @@ return Create(ArrayBuffer::Create(contents)); } +DOMArrayBuffer* DOMArrayBuffer::Create( + const Vector<base::span<const char>>& data) { + size_t size = 0; + for (const auto& span : data) { + size += span.size(); + } + WTF::ArrayBufferContents contents(size, 1, + WTF::ArrayBufferContents::kNotShared, + WTF::ArrayBufferContents::kDontInitialize); + uint8_t* ptr = static_cast<uint8_t*>(contents.Data()); + if (UNLIKELY(!ptr)) + OOM_CRASH(); + + for (const auto& span : data) { + memcpy(ptr, span.data(), span.size()); + ptr += span.size(); + } + + return Create(ArrayBuffer::Create(contents)); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h b/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h index 975463ec..6d579076 100644 --- a/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h +++ b/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h
@@ -5,9 +5,11 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_TYPED_ARRAYS_DOM_ARRAY_BUFFER_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_TYPED_ARRAYS_DOM_ARRAY_BUFFER_H_ +#include "base/containers/span.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer_base.h" #include "third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer.h" +#include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink { @@ -31,6 +33,7 @@ return Create(WTF::ArrayBuffer::Create(contents)); } static DOMArrayBuffer* Create(scoped_refptr<SharedBuffer>); + static DOMArrayBuffer* Create(const Vector<base::span<const char>>&); // Only for use by XMLHttpRequest::responseArrayBuffer and // Internals::serializeObject.
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 6522bf3..64853c1 100644 --- a/third_party/blink/renderer/core/workers/worker_global_scope.cc +++ b/third_party/blink/renderer/core/workers/worker_global_scope.cc
@@ -538,9 +538,9 @@ } void WorkerGlobalScope::queueMicrotask(V8VoidFunction* callback) { - GetAgent()->event_loop()->EnqueueMicrotask(WTF::Bind( - &V8PersistentCallbackFunction<V8VoidFunction>::InvokeAndReportException, - WrapPersistent(ToV8PersistentCallbackFunction(callback)), nullptr)); + GetAgent()->event_loop()->EnqueueMicrotask( + WTF::Bind(&V8VoidFunction::InvokeAndReportException, + WrapPersistent(callback), nullptr)); } int WorkerGlobalScope::requestAnimationFrame(V8FrameRequestCallback* callback,
diff --git a/third_party/blink/renderer/modules/background_sync/OWNERS b/third_party/blink/renderer/modules/background_sync/OWNERS index 7f3d55ba..e5a0714 100644 --- a/third_party/blink/renderer/modules/background_sync/OWNERS +++ b/third_party/blink/renderer/modules/background_sync/OWNERS
@@ -1,5 +1,2 @@ -iclelland@chromium.org -jkarlin@chromium.org -peter@chromium.org - +file://chrome/browser/background_sync/OWNERS # COMPONENT: Blink>BackgroundSync
diff --git a/third_party/blink/renderer/modules/locks/lock_manager.cc b/third_party/blink/renderer/modules/locks/lock_manager.cc index c9a1c96..2ee7e0ab 100644 --- a/third_party/blink/renderer/modules/locks/lock_manager.cc +++ b/third_party/blink/renderer/modules/locks/lock_manager.cc
@@ -108,9 +108,7 @@ } void Failed() override { - // Ensure a local reference to the callback's wrapper is retained, as it - // can no longer be traced once removed from |manager_|'s list. - auto* callback = ToV8PersistentCallbackFunction(callback_.Release()); + auto* callback = callback_.Release(); manager_->RemovePendingRequest(this); binding_.Close(); @@ -137,9 +135,7 @@ mojom::blink::LockHandleAssociatedPtr handle; handle.Bind(std::move(handle_info)); - // Ensure a local reference to the callback's wrapper is retained, as it - // can no longer be traced once removed from |manager_|'s list. - auto* callback = ToV8PersistentCallbackFunction(callback_.Release()); + auto* callback = callback_.Release(); manager_->RemovePendingRequest(this); binding_.Close();
diff --git a/third_party/blink/renderer/modules/mediarecorder/DEPS b/third_party/blink/renderer/modules/mediarecorder/DEPS index 2e96f7b..2343749c 100644 --- a/third_party/blink/renderer/modules/mediarecorder/DEPS +++ b/third_party/blink/renderer/modules/mediarecorder/DEPS
@@ -1,5 +1,4 @@ include_rules = [ - "+base/containers/queue.h", "+base/strings/string_piece.h", "+base/task_runner_util.h", "+base/threading/thread_task_runner_handle.h",
diff --git a/third_party/blink/renderer/modules/mediarecorder/vea_encoder.cc b/third_party/blink/renderer/modules/mediarecorder/vea_encoder.cc index 43af22cbf..b94567f6 100644 --- a/third_party/blink/renderer/modules/mediarecorder/vea_encoder.cc +++ b/third_party/blink/renderer/modules/mediarecorder/vea_encoder.cc
@@ -107,7 +107,7 @@ vea_requested_input_coded_size_ = input_coded_size; output_buffers_.clear(); - base::queue<std::unique_ptr<base::SharedMemory>>().swap(input_buffers_); + Deque<std::unique_ptr<base::SharedMemory>>().Swap(input_buffers_); for (int i = 0; i < kVEAEncoderOutputBufferCount; ++i) { std::unique_ptr<base::SharedMemory> shm = @@ -139,9 +139,7 @@ data->append(static_cast<char*>(output_buffer->memory()), metadata.payload_size_bytes); - const auto front_frame = frames_in_encode_.front(); - frames_in_encode_.pop(); - + const auto front_frame = frames_in_encode_.TakeFirst(); PostCrossThreadTask( *origin_task_runner_.get(), FROM_HERE, CrossThreadBindOnce( @@ -175,7 +173,7 @@ void VEAEncoder::FrameFinished(std::unique_ptr<base::SharedMemory> shm) { DVLOG(3) << __func__; DCHECK(encoding_task_runner_->BelongsToCurrentThread()); - input_buffers_.push(std::move(shm)); + input_buffers_.push_back(std::move(shm)); } void VEAEncoder::EncodeOnEncodingTaskRunner(scoped_refptr<VideoFrame> frame, @@ -228,8 +226,7 @@ input_buffer = gpu_factories_->CreateSharedMemory(desired_mapped_size); } else { do { - input_buffer = std::move(input_buffers_.front()); - input_buffers_.pop(); + input_buffer = input_buffers_.TakeFirst(); } while (!input_buffers_.empty() && input_buffer->mapped_size() < desired_mapped_size); if (!input_buffer || input_buffer->mapped_size() < desired_mapped_size) @@ -263,7 +260,7 @@ video_frame->stride(media::VideoFrame::kVPlane), input_visible_size_.width(), input_visible_size_.height()); } - frames_in_encode_.push(std::make_pair( + frames_in_encode_.push_back(std::make_pair( media::WebmMuxer::VideoParameters(frame), capture_timestamp)); video_encoder_->Encode(video_frame, force_next_frame_to_be_keyframe_);
diff --git a/third_party/blink/renderer/modules/mediarecorder/vea_encoder.h b/third_party/blink/renderer/modules/mediarecorder/vea_encoder.h index 7b17147..9f751a0 100644 --- a/third_party/blink/renderer/modules/mediarecorder/vea_encoder.h +++ b/third_party/blink/renderer/modules/mediarecorder/vea_encoder.h
@@ -5,10 +5,10 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIARECORDER_VEA_ENCODER_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIARECORDER_VEA_ENCODER_H_ -#include "base/containers/queue.h" #include "base/single_thread_task_runner.h" #include "media/video/video_encode_accelerator.h" #include "third_party/blink/renderer/modules/mediarecorder/video_track_recorder.h" +#include "third_party/blink/renderer/platform/wtf/deque.h" #include "third_party/blink/renderer/platform/wtf/time.h" #include "third_party/blink/renderer/platform/wtf/vector.h" #include "ui/gfx/geometry/size.h" @@ -83,8 +83,7 @@ Vector<std::unique_ptr<base::SharedMemory>> output_buffers_; // Shared memory buffers for output with the VEA as FIFO. - // TODO(crbug.com/960665): Replace with a WTF equivalent. - base::queue<std::unique_ptr<base::SharedMemory>> input_buffers_; + Deque<std::unique_ptr<base::SharedMemory>> input_buffers_; // Tracks error status. bool error_notified_; @@ -99,8 +98,7 @@ gfx::Size vea_requested_input_coded_size_; // Frames and corresponding timestamps in encode as FIFO. - // TODO(crbug.com/960665): Replace with a WTF equivalent. - base::queue<VideoParamsAndTimestamp> frames_in_encode_; + Deque<VideoParamsAndTimestamp> frames_in_encode_; // Number of encoded frames produced consecutively without a keyframe. uint32_t num_frames_after_keyframe_;
diff --git a/third_party/blink/renderer/modules/mediastream/user_media_request.cc b/third_party/blink/renderer/modules/mediastream/user_media_request.cc index 8e01c44..75a3b72 100644 --- a/third_party/blink/renderer/modules/mediastream/user_media_request.cc +++ b/third_party/blink/renderer/modules/mediastream/user_media_request.cc
@@ -293,8 +293,7 @@ public: V8Callbacks(V8NavigatorUserMediaSuccessCallback* success_callback, V8NavigatorUserMediaErrorCallback* error_callback) - : success_callback_(ToV8PersistentCallbackFunction(success_callback)), - error_callback_(ToV8PersistentCallbackFunction(error_callback)) {} + : success_callback_(success_callback), error_callback_(error_callback) {} ~V8Callbacks() override = default; void Trace(blink::Visitor* visitor) override { @@ -313,15 +312,8 @@ } private: - // As Blink does not hold a UserMediaRequest and lets content/ hold it, - // we cannot use wrapper-tracing to keep the underlying callback functions. - // Plus, it's guaranteed that the callbacks are one-shot type (not repeated - // type) and the owner UserMediaRequest will be discarded in a limited - // timeframe. Thus these persistent handles are okay. - Member<V8PersistentCallbackFunction<V8NavigatorUserMediaSuccessCallback>> - success_callback_; - Member<V8PersistentCallbackFunction<V8NavigatorUserMediaErrorCallback>> - error_callback_; + Member<V8NavigatorUserMediaSuccessCallback> success_callback_; + Member<V8NavigatorUserMediaErrorCallback> error_callback_; }; UserMediaRequest* UserMediaRequest::Create(
diff --git a/third_party/blink/renderer/modules/nfc/nfc.cc b/third_party/blink/renderer/modules/nfc/nfc.cc index 7579c66..0c5e3b2 100644 --- a/third_party/blink/renderer/modules/nfc/nfc.cc +++ b/third_party/blink/renderer/modules/nfc/nfc.cc
@@ -168,8 +168,7 @@ requests_.insert(resolver); auto watch_callback = WTF::Bind(&NFC::OnWatchRegistered, WrapPersistent(this), - WrapPersistent(ToV8PersistentCallbackFunction(callback)), - WrapPersistent(resolver)); + WrapPersistent(callback), WrapPersistent(resolver)); nfc_->Watch(device::mojom::blink::NFCReaderOptions::From(options), std::move(watch_callback)); return resolver->Promise(); @@ -305,11 +304,10 @@ return ScriptPromise(); } -void NFC::OnWatchRegistered( - V8PersistentCallbackFunction<V8MessageCallback>* callback, - ScriptPromiseResolver* resolver, - uint32_t id, - device::mojom::blink::NFCErrorPtr error) { +void NFC::OnWatchRegistered(V8MessageCallback* callback, + ScriptPromiseResolver* resolver, + uint32_t id, + device::mojom::blink::NFCErrorPtr error) { requests_.erase(resolver); // Invalid id was returned. @@ -323,7 +321,7 @@ } if (error.is_null()) { - callbacks_.insert(id, callback->ToNonV8Persistent()); + callbacks_.insert(id, callback); resolver->Resolve(id); } else { resolver->Reject(NFCError::Take(resolver, error->error_type));
diff --git a/third_party/blink/renderer/modules/nfc/nfc.h b/third_party/blink/renderer/modules/nfc/nfc.h index 3da3aba..3c90fec 100644 --- a/third_party/blink/renderer/modules/nfc/nfc.h +++ b/third_party/blink/renderer/modules/nfc/nfc.h
@@ -77,7 +77,7 @@ void OnRequestCompleted(ScriptPromiseResolver*, device::mojom::blink::NFCErrorPtr); void OnConnectionError(); - void OnWatchRegistered(V8PersistentCallbackFunction<V8MessageCallback>*, + void OnWatchRegistered(V8MessageCallback*, ScriptPromiseResolver*, uint32_t id, device::mojom::blink::NFCErrorPtr);
diff --git a/third_party/blink/renderer/modules/notifications/notification_manager.cc b/third_party/blink/renderer/modules/notifications/notification_manager.cc index fa6ba1c5..2e0a282 100644 --- a/third_party/blink/renderer/modules/notifications/notification_manager.cc +++ b/third_party/blink/renderer/modules/notifications/notification_manager.cc
@@ -87,18 +87,16 @@ permission_service_->RequestPermission( CreatePermissionDescriptor(mojom::blink::PermissionName::NOTIFICATIONS), LocalFrame::HasTransientUserActivation(doc ? doc->GetFrame() : nullptr), - WTF::Bind( - &NotificationManager::OnPermissionRequestComplete, - WrapPersistent(this), WrapPersistent(resolver), - WrapPersistent(ToV8PersistentCallbackFunction(deprecated_callback)))); + WTF::Bind(&NotificationManager::OnPermissionRequestComplete, + WrapPersistent(this), WrapPersistent(resolver), + WrapPersistent(deprecated_callback))); return promise; } void NotificationManager::OnPermissionRequestComplete( ScriptPromiseResolver* resolver, - V8PersistentCallbackFunction<V8NotificationPermissionCallback>* - deprecated_callback, + V8NotificationPermissionCallback* deprecated_callback, mojom::blink::PermissionStatus status) { String status_string = Notification::PermissionString(status); if (deprecated_callback)
diff --git a/third_party/blink/renderer/modules/notifications/notification_manager.h b/third_party/blink/renderer/modules/notifications/notification_manager.h index 920a5c1..b0f90bc 100644 --- a/third_party/blink/renderer/modules/notifications/notification_manager.h +++ b/third_party/blink/renderer/modules/notifications/notification_manager.h
@@ -95,8 +95,7 @@ void OnPermissionRequestComplete( ScriptPromiseResolver* resolver, - V8PersistentCallbackFunction<V8NotificationPermissionCallback>* - deprecated_callback, + V8NotificationPermissionCallback* deprecated_callback, mojom::blink::PermissionStatus status); void OnNotificationServiceConnectionError();
diff --git a/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_crypto_config_factory_impl.cc b/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_crypto_config_factory_impl.cc index bb5a4ce..5f06990 100644 --- a/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_crypto_config_factory_impl.cc +++ b/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_crypto_config_factory_impl.cc
@@ -116,7 +116,7 @@ std::unique_ptr<quic::ProofVerifier> proof_verifier( new InsecureProofVerifier); return std::make_unique<quic::QuicCryptoClientConfig>( - std::move(proof_verifier), quic::TlsClientHandshaker::CreateSslCtx()); + std::move(proof_verifier)); } std::unique_ptr<quic::QuicCryptoServerConfig> @@ -130,8 +130,7 @@ return std::make_unique<quic::QuicCryptoServerConfig>( std::string(source_address_token_secret, kInputKeyingMaterialLength), random_generator_, std::move(proof_source), - quic::KeyExchangeSource::Default(), - quic::TlsServerHandshaker::CreateSslCtx()); + quic::KeyExchangeSource::Default()); } } // namespace blink
diff --git a/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_transport_test.cc b/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_transport_test.cc index 0fca01d..3a14de1 100644 --- a/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_transport_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_transport_test.cc
@@ -428,16 +428,15 @@ std::unique_ptr<quic::QuicCryptoClientConfig> CreateClientCryptoConfig() override { return std::make_unique<quic::QuicCryptoClientConfig>( - std::make_unique<FailingProofVerifierStub>(), - quic::TlsClientHandshaker::CreateSslCtx()); + std::make_unique<FailingProofVerifierStub>()); } std::unique_ptr<quic::QuicCryptoServerConfig> CreateServerCryptoConfig() override { return std::make_unique<quic::QuicCryptoServerConfig>( quic::QuicCryptoServerConfig::TESTING, quic_random_, - std::make_unique<ProofSourceStub>(), quic::KeyExchangeSource::Default(), - quic::TlsServerHandshaker::CreateSslCtx()); + std::make_unique<ProofSourceStub>(), + quic::KeyExchangeSource::Default()); } private:
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc index 1fb1fe2..8ff06c7 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc
@@ -153,11 +153,9 @@ void AsyncCallErrorCallback(V8RTCPeerConnectionErrorCallback* error_callback, DOMException* exception) { DCHECK(error_callback); - Microtask::EnqueueMicrotask( - WTF::Bind(&V8PersistentCallbackFunction< - V8RTCPeerConnectionErrorCallback>::InvokeAndReportException, - WrapPersistent(ToV8PersistentCallbackFunction(error_callback)), - nullptr, WrapPersistent(exception))); + Microtask::EnqueueMicrotask(WTF::Bind( + &V8RTCPeerConnectionErrorCallback::InvokeAndReportException, + WrapPersistent(error_callback), nullptr, WrapPersistent(exception))); } bool CallErrorCallbackIfSignalingStateClosed(
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_session_description_request_impl.cc b/third_party/blink/renderer/modules/peerconnection/rtc_session_description_request_impl.cc index e056b92..8bf803a 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_session_description_request_impl.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_session_description_request_impl.cc
@@ -57,8 +57,8 @@ V8RTCPeerConnectionErrorCallback* error_callback) : ContextLifecycleObserver(context), operation_(operation), - success_callback_(ToV8PersistentCallbackFunction(success_callback)), - error_callback_(ToV8PersistentCallbackFunction(error_callback)), + success_callback_(success_callback), + error_callback_(error_callback), requester_(requester) { DCHECK(requester_); }
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_session_description_request_impl.h b/third_party/blink/renderer/modules/peerconnection/rtc_session_description_request_impl.h index ef577814..28d69e0 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_session_description_request_impl.h +++ b/third_party/blink/renderer/modules/peerconnection/rtc_session_description_request_impl.h
@@ -79,15 +79,8 @@ void Clear(); RTCCreateSessionDescriptionOperation operation_; - // This request object is held by WebRTCPeerConnectionHandler, which doesn't - // support wrapper-tracing. Thus, this object holds the underlying callback - // functions as persistent handles. This is acceptable because the request - // object will be discarded in a limited time due to success, failure, or - // destruction of the execution context. - Member<V8PersistentCallbackFunction<V8RTCSessionDescriptionCallback>> - success_callback_; - Member<V8PersistentCallbackFunction<V8RTCPeerConnectionErrorCallback>> - error_callback_; + Member<V8RTCSessionDescriptionCallback> success_callback_; + Member<V8RTCPeerConnectionErrorCallback> error_callback_; Member<RTCPeerConnection> requester_; };
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_stats_request_impl.cc b/third_party/blink/renderer/modules/peerconnection/rtc_stats_request_impl.cc index d3d6601..42cab2fe4 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_stats_request_impl.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_stats_request_impl.cc
@@ -34,7 +34,7 @@ V8RTCStatsCallback* callback, MediaStreamTrack* selector) : ContextLifecycleObserver(context), - success_callback_(ToV8PersistentCallbackFunction(callback)), + success_callback_(callback), component_(selector ? selector->Component() : nullptr), requester_(requester) { DCHECK(requester_);
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_stats_request_impl.h b/third_party/blink/renderer/modules/peerconnection/rtc_stats_request_impl.h index 3f3b7304..12132d4 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_stats_request_impl.h +++ b/third_party/blink/renderer/modules/peerconnection/rtc_stats_request_impl.h
@@ -63,12 +63,7 @@ private: void Clear(); - // This request object is held by WebRTCPeerConnectionHandler, which doesn't - // support wrapper-tracing. Thus, this object holds the underlying callback - // functions as persistent handles. This is acceptable because the request - // object will be discarded in a limited time due to success, failure, or - // destruction of the execution context. - Member<V8PersistentCallbackFunction<V8RTCStatsCallback>> success_callback_; + Member<V8RTCStatsCallback> success_callback_; Member<MediaStreamComponent> component_; Member<RTCPeerConnection> requester_;
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_void_request_impl.cc b/third_party/blink/renderer/modules/peerconnection/rtc_void_request_impl.cc index 6607e58d..13a8144 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_void_request_impl.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_void_request_impl.cc
@@ -44,8 +44,8 @@ V8RTCPeerConnectionErrorCallback* error_callback) : ContextLifecycleObserver(context), operation_(std::move(operation)), - success_callback_(ToV8PersistentCallbackFunction(success_callback)), - error_callback_(ToV8PersistentCallbackFunction(error_callback)), + success_callback_(success_callback), + error_callback_(error_callback), requester_(requester) { DCHECK(requester_); }
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_void_request_impl.h b/third_party/blink/renderer/modules/peerconnection/rtc_void_request_impl.h index 18ac9c64..96af311 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_void_request_impl.h +++ b/third_party/blink/renderer/modules/peerconnection/rtc_void_request_impl.h
@@ -71,14 +71,8 @@ void Clear(); base::Optional<RTCSetSessionDescriptionOperation> operation_; - // This request object is held by WebRTCPeerConnectionHandler, which doesn't - // support wrapper-tracing. Thus, this object holds the underlying callback - // functions as persistent handles. This is acceptable because the request - // object will be discarded in a limited time due to success, failure, or - // destruction of the execution context. - Member<V8PersistentCallbackFunction<V8VoidFunction>> success_callback_; - Member<V8PersistentCallbackFunction<V8RTCPeerConnectionErrorCallback>> - error_callback_; + Member<V8VoidFunction> success_callback_; + Member<V8RTCPeerConnectionErrorCallback> error_callback_; Member<RTCPeerConnection> requester_; };
diff --git a/third_party/blink/renderer/modules/quota/deprecated_storage_quota.cc b/third_party/blink/renderer/modules/quota/deprecated_storage_quota.cc index 33be07a..e422eaf 100644 --- a/third_party/blink/renderer/modules/quota/deprecated_storage_quota.cc +++ b/third_party/blink/renderer/modules/quota/deprecated_storage_quota.cc
@@ -67,8 +67,8 @@ } void DeprecatedQueryStorageUsageAndQuotaCallback( - V8PersistentCallbackFunction<V8StorageUsageCallback>* success_callback, - V8PersistentCallbackFunction<V8StorageErrorCallback>* error_callback, + V8StorageUsageCallback* success_callback, + V8StorageErrorCallback* error_callback, mojom::QuotaStatusCode status_code, int64_t usage_in_bytes, int64_t quota_in_bytes, @@ -87,12 +87,11 @@ } } -void RequestStorageQuotaCallback( - V8PersistentCallbackFunction<V8StorageQuotaCallback>* success_callback, - V8PersistentCallbackFunction<V8StorageErrorCallback>* error_callback, - mojom::QuotaStatusCode status_code, - int64_t usage_in_bytes, - int64_t granted_quota_in_bytes) { +void RequestStorageQuotaCallback(V8StorageQuotaCallback* success_callback, + V8StorageErrorCallback* error_callback, + mojom::QuotaStatusCode status_code, + int64_t usage_in_bytes, + int64_t granted_quota_in_bytes) { if (status_code != mojom::QuotaStatusCode::kOk) { if (error_callback) { error_callback->InvokeAndReportException(nullptr, @@ -117,13 +116,10 @@ ExecutionContext::From(script_state) ->GetTaskRunner(TaskType::kMiscPlatformAPI) - ->PostTask( - FROM_HERE, - WTF::Bind( - &V8PersistentCallbackFunction< - V8StorageErrorCallback>::InvokeAndReportException, - WrapPersistent(ToV8PersistentCallbackFunction(error_callback)), - nullptr, WrapPersistent(DOMError::Create(exception_code)))); + ->PostTask(FROM_HERE, + WTF::Bind(&V8StorageErrorCallback::InvokeAndReportException, + WrapPersistent(error_callback), nullptr, + WrapPersistent(DOMError::Create(exception_code)))); } DeprecatedStorageQuota::DeprecatedStorageQuota(Type type) : type_(type) {} @@ -152,10 +148,9 @@ return; } - auto callback = WTF::Bind( - &DeprecatedQueryStorageUsageAndQuotaCallback, - WrapPersistent(ToV8PersistentCallbackFunction(success_callback)), - WrapPersistent(ToV8PersistentCallbackFunction(error_callback))); + auto callback = WTF::Bind(&DeprecatedQueryStorageUsageAndQuotaCallback, + WrapPersistent(success_callback), + WrapPersistent(error_callback)); GetQuotaHost(execution_context) .QueryStorageUsageAndQuota( WrapRefCounted(security_origin), storage_type, @@ -180,10 +175,9 @@ return; } - auto callback = WTF::Bind( - &RequestStorageQuotaCallback, - WrapPersistent(ToV8PersistentCallbackFunction(success_callback)), - WrapPersistent(ToV8PersistentCallbackFunction(error_callback))); + auto callback = + WTF::Bind(&RequestStorageQuotaCallback, WrapPersistent(success_callback), + WrapPersistent(error_callback)); Document& document = To<Document>(execution_context); const SecurityOrigin* security_origin = document.GetSecurityOrigin();
diff --git a/third_party/blink/renderer/modules/webaudio/async_audio_decoder.cc b/third_party/blink/renderer/modules/webaudio/async_audio_decoder.cc index d55bf08..0072cd3 100644 --- a/third_party/blink/renderer/modules/webaudio/async_audio_decoder.cc +++ b/third_party/blink/renderer/modules/webaudio/async_audio_decoder.cc
@@ -39,13 +39,12 @@ namespace blink { -void AsyncAudioDecoder::DecodeAsync( - DOMArrayBuffer* audio_data, - float sample_rate, - V8PersistentCallbackFunction<V8DecodeSuccessCallback>* success_callback, - V8PersistentCallbackFunction<V8DecodeErrorCallback>* error_callback, - ScriptPromiseResolver* resolver, - BaseAudioContext* context) { +void AsyncAudioDecoder::DecodeAsync(DOMArrayBuffer* audio_data, + float sample_rate, + V8DecodeSuccessCallback* success_callback, + V8DecodeErrorCallback* error_callback, + ScriptPromiseResolver* resolver, + BaseAudioContext* context) { DCHECK(IsMainThread()); DCHECK(audio_data); if (!audio_data) @@ -69,8 +68,8 @@ void AsyncAudioDecoder::DecodeOnBackgroundThread( DOMArrayBuffer* audio_data, float sample_rate, - V8PersistentCallbackFunction<V8DecodeSuccessCallback>* success_callback, - V8PersistentCallbackFunction<V8DecodeErrorCallback>* error_callback, + V8DecodeSuccessCallback* success_callback, + V8DecodeErrorCallback* error_callback, ScriptPromiseResolver* resolver, BaseAudioContext* context, scoped_refptr<base::SingleThreadTaskRunner> task_runner) { @@ -99,8 +98,8 @@ void AsyncAudioDecoder::NotifyComplete( DOMArrayBuffer*, - V8PersistentCallbackFunction<V8DecodeSuccessCallback>* success_callback, - V8PersistentCallbackFunction<V8DecodeErrorCallback>* error_callback, + V8DecodeSuccessCallback* success_callback, + V8DecodeErrorCallback* error_callback, AudioBus* audio_bus, ScriptPromiseResolver* resolver, BaseAudioContext* context) {
diff --git a/third_party/blink/renderer/modules/webaudio/async_audio_decoder.h b/third_party/blink/renderer/modules/webaudio/async_audio_decoder.h index 5783e169..1b77380 100644 --- a/third_party/blink/renderer/modules/webaudio/async_audio_decoder.h +++ b/third_party/blink/renderer/modules/webaudio/async_audio_decoder.h
@@ -62,8 +62,8 @@ // appropriately when finished. void DecodeAsync(DOMArrayBuffer* audio_data, float sample_rate, - V8PersistentCallbackFunction<V8DecodeSuccessCallback>*, - V8PersistentCallbackFunction<V8DecodeErrorCallback>*, + V8DecodeSuccessCallback*, + V8DecodeErrorCallback*, ScriptPromiseResolver*, BaseAudioContext*); @@ -72,18 +72,17 @@ static void DecodeOnBackgroundThread( DOMArrayBuffer* audio_data, float sample_rate, - V8PersistentCallbackFunction<V8DecodeSuccessCallback>*, - V8PersistentCallbackFunction<V8DecodeErrorCallback>*, + V8DecodeSuccessCallback*, + V8DecodeErrorCallback*, ScriptPromiseResolver*, BaseAudioContext*, scoped_refptr<base::SingleThreadTaskRunner>); - static void NotifyComplete( - DOMArrayBuffer* audio_data, - V8PersistentCallbackFunction<V8DecodeSuccessCallback>*, - V8PersistentCallbackFunction<V8DecodeErrorCallback>*, - AudioBus*, - ScriptPromiseResolver*, - BaseAudioContext*); + static void NotifyComplete(DOMArrayBuffer* audio_data, + V8DecodeSuccessCallback*, + V8DecodeErrorCallback*, + AudioBus*, + ScriptPromiseResolver*, + BaseAudioContext*); DISALLOW_COPY_AND_ASSIGN(AsyncAudioDecoder); };
diff --git a/third_party/blink/renderer/modules/webaudio/base_audio_context.cc b/third_party/blink/renderer/modules/webaudio/base_audio_context.cc index af419ba..60407bad 100644 --- a/third_party/blink/renderer/modules/webaudio/base_audio_context.cc +++ b/third_party/blink/renderer/modules/webaudio/base_audio_context.cc
@@ -337,9 +337,8 @@ decode_audio_resolvers_.insert(resolver); - audio_decoder_.DecodeAsync( - audio, sampleRate(), ToV8PersistentCallbackFunction(success_callback), - ToV8PersistentCallbackFunction(error_callback), resolver, this); + audio_decoder_.DecodeAsync(audio, sampleRate(), success_callback, + error_callback, resolver, this); } else { // If audioData is already detached (neutered) we need to reject the // promise with an error. @@ -358,8 +357,8 @@ void BaseAudioContext::HandleDecodeAudioData( AudioBuffer* audio_buffer, ScriptPromiseResolver* resolver, - V8PersistentCallbackFunction<V8DecodeSuccessCallback>* success_callback, - V8PersistentCallbackFunction<V8DecodeErrorCallback>* error_callback) { + V8DecodeSuccessCallback* success_callback, + V8DecodeErrorCallback* error_callback) { DCHECK(IsMainThread()); if (!GetExecutionContext()) {
diff --git a/third_party/blink/renderer/modules/webaudio/base_audio_context.h b/third_party/blink/renderer/modules/webaudio/base_audio_context.h index 2b0ae32..0309ad88 100644 --- a/third_party/blink/renderer/modules/webaudio/base_audio_context.h +++ b/third_party/blink/renderer/modules/webaudio/base_audio_context.h
@@ -170,11 +170,10 @@ // Handles the promise and callbacks when |decodeAudioData| is finished // decoding. - void HandleDecodeAudioData( - AudioBuffer*, - ScriptPromiseResolver*, - V8PersistentCallbackFunction<V8DecodeSuccessCallback>*, - V8PersistentCallbackFunction<V8DecodeErrorCallback>*); + void HandleDecodeAudioData(AudioBuffer*, + ScriptPromiseResolver*, + V8DecodeSuccessCallback*, + V8DecodeErrorCallback*); AudioListener* listener() { return listener_; }
diff --git a/third_party/blink/renderer/modules/webdatabase/database.cc b/third_party/blink/renderer/modules/webdatabase/database.cc index c413db01..7eb9c786 100644 --- a/third_party/blink/renderer/modules/webdatabase/database.cc +++ b/third_party/blink/renderer/modules/webdatabase/database.cc
@@ -292,24 +292,20 @@ if (success && IsNew()) { STORAGE_DVLOG(1) << "Scheduling DatabaseCreationCallbackTask for database " << this; - auto* v8persistent_callback = - ToV8PersistentCallbackFunction(creation_callback); probe::AsyncTaskScheduled(GetExecutionContext(), "openDatabase", - v8persistent_callback); + creation_callback); GetExecutionContext() ->GetTaskRunner(TaskType::kDatabaseAccess) - ->PostTask( - FROM_HERE, - WTF::Bind(&Database::RunCreationCallback, WrapPersistent(this), - WrapPersistent(v8persistent_callback))); + ->PostTask(FROM_HERE, WTF::Bind(&Database::RunCreationCallback, + WrapPersistent(this), + WrapPersistent(creation_callback))); } } return success; } -void Database::RunCreationCallback( - V8PersistentCallbackFunction<V8DatabaseCallback>* creation_callback) { +void Database::RunCreationCallback(V8DatabaseCallback* creation_callback) { probe::AsyncTask async_task(GetExecutionContext(), creation_callback); creation_callback->InvokeAndReportException(nullptr, this); }
diff --git a/third_party/blink/renderer/modules/webdatabase/database.h b/third_party/blink/renderer/modules/webdatabase/database.h index d8c509f..04f40d6 100644 --- a/third_party/blink/renderer/modules/webdatabase/database.h +++ b/third_party/blink/renderer/modules/webdatabase/database.h
@@ -137,8 +137,7 @@ bool PerformOpenAndVerify(bool set_version_in_new_database, DatabaseError&, String& error_message); - void RunCreationCallback( - V8PersistentCallbackFunction<V8DatabaseCallback>* creation_callback); + void RunCreationCallback(V8DatabaseCallback* creation_callback); void ScheduleTransaction();
diff --git a/third_party/blink/renderer/modules/websockets/dom_websocket.cc b/third_party/blink/renderer/modules/websockets/dom_websocket.cc index c76da3fa..bbf03d1 100644 --- a/third_party/blink/renderer/modules/websockets/dom_websocket.cc +++ b/third_party/blink/renderer/modules/websockets/dom_websocket.cc
@@ -733,9 +733,13 @@ } void DOMWebSocket::DidReceiveBinaryMessage( - std::unique_ptr<Vector<char>> binary_data) { + const Vector<base::span<const char>>& data) { + size_t size = 0; + for (const auto& span : data) { + size += span.size(); + } NETWORK_DVLOG(1) << "WebSocket " << this << " DidReceiveBinaryMessage() " - << binary_data->size() << " byte binary message"; + << size << " byte binary message"; ReflectBufferedAmountConsumption(); DCHECK(!origin_string_.IsNull()); @@ -745,11 +749,10 @@ switch (binary_type_) { case kBinaryTypeBlob: { - size_t size = binary_data->size(); - scoped_refptr<RawData> raw_data = RawData::Create(); - binary_data->swap(*raw_data->MutableData()); auto blob_data = std::make_unique<BlobData>(); - blob_data->AppendData(std::move(raw_data)); + for (const auto& span : data) { + blob_data->AppendBytes(span.data(), span.size()); + } Blob* blob = Blob::Create(BlobDataHandle::Create(std::move(blob_data), size)); RecordReceiveTypeHistogram(kWebSocketReceiveTypeBlob); @@ -759,11 +762,9 @@ } case kBinaryTypeArrayBuffer: - DOMArrayBuffer* array_buffer = - DOMArrayBuffer::Create(binary_data->data(), binary_data->size()); + DOMArrayBuffer* array_buffer = DOMArrayBuffer::Create(data); RecordReceiveTypeHistogram(kWebSocketReceiveTypeArrayBuffer); - RecordReceiveMessageSizeHistogram(kWebSocketReceiveTypeArrayBuffer, - binary_data->size()); + RecordReceiveMessageSizeHistogram(kWebSocketReceiveTypeArrayBuffer, size); event_queue_->Dispatch( MessageEvent::Create(array_buffer, origin_string_)); break;
diff --git a/third_party/blink/renderer/modules/websockets/dom_websocket.h b/third_party/blink/renderer/modules/websockets/dom_websocket.h index 0716096..adf6dd3 100644 --- a/third_party/blink/renderer/modules/websockets/dom_websocket.h +++ b/third_party/blink/renderer/modules/websockets/dom_websocket.h
@@ -134,7 +134,8 @@ // WebSocketChannelClient functions. void DidConnect(const String& subprotocol, const String& extensions) override; void DidReceiveTextMessage(const String& message) override; - void DidReceiveBinaryMessage(std::unique_ptr<Vector<char>>) override; + void DidReceiveBinaryMessage( + const Vector<base::span<const char>>& data) override; void DidError() override; void DidConsumeBufferedAmount(uint64_t) override; void DidStartClosingHandshake() override;
diff --git a/third_party/blink/renderer/modules/websockets/web_pepper_socket_channel_client_proxy.h b/third_party/blink/renderer/modules/websockets/web_pepper_socket_channel_client_proxy.h index 030161b2..80159e0 100644 --- a/third_party/blink/renderer/modules/websockets/web_pepper_socket_channel_client_proxy.h +++ b/third_party/blink/renderer/modules/websockets/web_pepper_socket_channel_client_proxy.h
@@ -40,8 +40,14 @@ void DidReceiveTextMessage(const String& payload) override { impl_->DidReceiveTextMessage(payload); } - void DidReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload) override { - impl_->DidReceiveBinaryMessage(std::move(payload)); + void DidReceiveBinaryMessage( + const Vector<base::span<const char>>& data) override { + std::unique_ptr<Vector<char>> data_to_pass = + std::make_unique<Vector<char>>(); + for (const auto& span : data) { + data_to_pass->Append(span.data(), static_cast<wtf_size_t>(span.size())); + } + impl_->DidReceiveBinaryMessage(std::move(data_to_pass)); } void DidError() override { impl_->DidError(); } void DidConsumeBufferedAmount(uint64_t consumed) override {
diff --git a/third_party/blink/renderer/modules/websockets/websocket_channel_client.h b/third_party/blink/renderer/modules/websockets/websocket_channel_client.h index 1dff814..08f12d7 100644 --- a/third_party/blink/renderer/modules/websockets/websocket_channel_client.h +++ b/third_party/blink/renderer/modules/websockets/websocket_channel_client.h
@@ -33,6 +33,7 @@ #include <stdint.h> #include <memory> +#include "base/containers/span.h" #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/forward.h" @@ -46,7 +47,8 @@ virtual void DidConnect(const String& subprotocol, const String& extensions) { } virtual void DidReceiveTextMessage(const String&) {} - virtual void DidReceiveBinaryMessage(std::unique_ptr<Vector<char>>) {} + virtual void DidReceiveBinaryMessage( + const Vector<base::span<const char>>& data) {} virtual void DidError() {} virtual void DidConsumeBufferedAmount(uint64_t consumed) {} virtual void DidStartClosingHandshake() {}
diff --git a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc index ca2d2d0..1cfe066d 100644 --- a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc +++ b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc
@@ -61,6 +61,7 @@ #include "third_party/blink/renderer/platform/loader/fetch/unique_identifier.h" #include "third_party/blink/renderer/platform/network/network_log.h" #include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h" +#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" @@ -657,47 +658,76 @@ switch (type) { case WebSocketHandle::kMessageTypeText: - DCHECK(receiving_message_data_.IsEmpty()); + DCHECK(!receiving_message_data_); receiving_message_type_is_text_ = true; break; case WebSocketHandle::kMessageTypeBinary: - DCHECK(receiving_message_data_.IsEmpty()); + DCHECK(!receiving_message_data_); receiving_message_type_is_text_ = false; break; case WebSocketHandle::kMessageTypeContinuation: - DCHECK(!receiving_message_data_.IsEmpty()); + DCHECK(receiving_message_data_); break; } - receiving_message_data_.Append(data, SafeCast<uint32_t>(size)); received_data_size_for_flow_control_ += size; AddReceiveFlowControlIfNecessary(); - if (!fin) { + + const size_t message_size_so_far = + (receiving_message_data_ ? receiving_message_data_->size() : 0) + size; + if (message_size_so_far > std::numeric_limits<wtf_size_t>::max()) { + receiving_message_data_ = nullptr; + FailAsError("Message size is too large."); return; } + + if (!fin) { + if (!receiving_message_data_) { + receiving_message_data_ = SharedBuffer::Create(); + } + receiving_message_data_->Append(data, size); + return; + } + + const wtf_size_t message_size = static_cast<wtf_size_t>(message_size_so_far); + Vector<base::span<const char>> chunks; + if (receiving_message_data_) { + chunks.AppendRange(receiving_message_data_->begin(), + receiving_message_data_->end()); + } + if (size > 0) { + chunks.push_back(base::make_span(data, size)); + } auto opcode = receiving_message_type_is_text_ ? WebSocketOpCode::kOpCodeText : WebSocketOpCode::kOpCodeBinary; probe::DidReceiveWebSocketMessage(execution_context_, identifier_, opcode, - false, receiving_message_data_.data(), - receiving_message_data_.size()); + false, chunks); + if (receiving_message_type_is_text_) { - String message = receiving_message_data_.IsEmpty() - ? g_empty_string - : String::FromUTF8(receiving_message_data_.data(), - receiving_message_data_.size()); - receiving_message_data_.clear(); + Vector<char> flatten; + base::span<const char> span; + if (chunks.size() > 1) { + flatten.ReserveCapacity(message_size); + for (const auto& chunk : chunks) { + flatten.Append(chunk.data(), static_cast<wtf_size_t>(chunk.size())); + } + span = base::make_span(flatten.data(), flatten.size()); + } else if (chunks.size() == 1) { + span = chunks[0]; + } + String message = span.size() > 0 + ? String::FromUTF8(span.data(), span.size()) + : g_empty_string; if (message.IsNull()) { FailAsError("Could not decode a text frame as UTF-8."); } else { client_->DidReceiveTextMessage(message); } } else { - std::unique_ptr<Vector<char>> binary_data = - std::make_unique<Vector<char>>(); - binary_data->swap(receiving_message_data_); - client_->DidReceiveBinaryMessage(std::move(binary_data)); + client_->DidReceiveBinaryMessage(chunks); } + receiving_message_data_ = nullptr; } void WebSocketChannelImpl::DidClose(WebSocketHandle* handle,
diff --git a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h index d96d12e..5524df8 100644 --- a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h +++ b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h
@@ -54,6 +54,7 @@ class BaseFetchContext; enum class FileErrorCode; +class SharedBuffer; class WebSocketChannelClient; class WebSocketHandshakeThrottle; @@ -200,7 +201,7 @@ uint64_t identifier_; Member<BlobLoader> blob_loader_; HeapDeque<Member<Message>> messages_; - Vector<char> receiving_message_data_; + scoped_refptr<SharedBuffer> receiving_message_data_; Member<ExecutionContext> execution_context_; bool receiving_message_type_is_text_;
diff --git a/third_party/blink/renderer/modules/websockets/websocket_channel_impl_test.cc b/third_party/blink/renderer/modules/websockets/websocket_channel_impl_test.cc index de03ade..af7ed16 100644 --- a/third_party/blink/renderer/modules/websockets/websocket_channel_impl_test.cc +++ b/third_party/blink/renderer/modules/websockets/websocket_channel_impl_test.cc
@@ -53,8 +53,13 @@ MOCK_METHOD2(DidConnect, void(const String&, const String&)); MOCK_METHOD1(DidReceiveTextMessage, void(const String&)); - void DidReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload) override { - DidReceiveBinaryMessageMock(*payload); + void DidReceiveBinaryMessage( + const Vector<base::span<const char>>& data) override { + Vector<char> flatten; + for (const auto& span : data) { + flatten.Append(span.data(), static_cast<wtf_size_t>(span.size())); + } + DidReceiveBinaryMessageMock(flatten); } MOCK_METHOD1(DidReceiveBinaryMessageMock, void(const Vector<char>&)); MOCK_METHOD0(DidError, void());
diff --git a/third_party/blink/renderer/platform/bindings/callback_function_base.cc b/third_party/blink/renderer/platform/bindings/callback_function_base.cc index 2ece7d5..108a35d 100644 --- a/third_party/blink/renderer/platform/bindings/callback_function_base.cc +++ b/third_party/blink/renderer/platform/bindings/callback_function_base.cc
@@ -86,8 +86,4 @@ std::move(closure).Run(); } -void V8PersistentCallbackFunctionBase::Trace(blink::Visitor* visitor) { - visitor->Trace(callback_function_); -} - } // namespace blink
diff --git a/third_party/blink/renderer/platform/bindings/callback_function_base.h b/third_party/blink/renderer/platform/bindings/callback_function_base.h index 935e74c..19054ad 100644 --- a/third_party/blink/renderer/platform/bindings/callback_function_base.h +++ b/third_party/blink/renderer/platform/bindings/callback_function_base.h
@@ -13,8 +13,6 @@ namespace blink { -class V8PersistentCallbackFunctionBase; - // CallbackFunctionBase is the common base class of all the callback function // classes. Most importantly this class provides a way of type dispatching (e.g. // overload resolutions, SFINAE technique, etc.) so that it's possible to @@ -108,69 +106,8 @@ // converted to an IDL value. // https://heycam.github.io/webidl/#dfn-callback-context Member<ScriptState> incumbent_script_state_; - - friend class V8PersistentCallbackFunctionBase; }; -// CAUTION: THIS CLASS IS OBSOLETE AFTER THE UNIFIED HEAP AND WILL BE REMOVED. -// -// V8PersistentCallbackFunctionBase retains the underlying v8::Function of a -// CallbackFunctionBase without wrapper-tracing. This class is necessary and -// useful where wrapper-tracing is not suitable. Remember that, as a nature of -// v8::Persistent, abuse of V8PersistentCallbackFunctionBase would result in -// memory leak, so the use of V8PersistentCallbackFunctionBase should be limited -// to those which are guaranteed to release the persistents in a finite time -// period. -class PLATFORM_EXPORT V8PersistentCallbackFunctionBase - : public GarbageCollectedFinalized<V8PersistentCallbackFunctionBase> { - public: - virtual ~V8PersistentCallbackFunctionBase() = default; - - virtual void Trace(blink::Visitor*); - - protected: - explicit V8PersistentCallbackFunctionBase( - CallbackFunctionBase* callback_function) - : callback_function_(callback_function) {} - - template <typename V8CallbackFunction> - V8CallbackFunction* As() { - static_assert( - std::is_base_of<CallbackFunctionBase, V8CallbackFunction>::value, - "V8CallbackFunction must be a subclass of CallbackFunctionBase."); - return static_cast<V8CallbackFunction*>(callback_function_.Get()); - } - - private: - Member<CallbackFunctionBase> callback_function_; -}; - -// V8PersistentCallbackFunction<V8CallbackFunction> is a counter-part of -// V8CallbackFunction. While V8CallbackFunction uses wrapper-tracing, -// V8PersistentCallbackFunction<V8CallbackFunction> uses v8::Persistent to make -// the underlying v8::Function alive. -// -// Since the signature of |Invoke| varies depending on the IDL definition, -// the class definition is specialized and generated by the bindings code -// generator. -template <typename V8CallbackFunction> -class V8PersistentCallbackFunction; - -// Converts the wrapper-tracing version of a callback function to the -// v8::Persistent version of it. -template <typename V8CallbackFunction> -inline V8PersistentCallbackFunction<V8CallbackFunction>* -ToV8PersistentCallbackFunction(V8CallbackFunction* callback_function) { - static_assert( - std::is_base_of<CallbackFunctionBase, V8CallbackFunction>::value, - "V8CallbackFunction must be a subclass of CallbackFunctionBase."); - return callback_function - ? MakeGarbageCollected< - V8PersistentCallbackFunction<V8CallbackFunction>>( - callback_function) - : nullptr; -} - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_CALLBACK_FUNCTION_BASE_H_
diff --git a/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.cc b/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.cc index be561a3..9e558346 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.cc +++ b/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.cc
@@ -13,9 +13,8 @@ namespace blink { +// Note: We allocate |RunInfoPart| in flexible array in |ShapeResultView|. struct ShapeResultView::RunInfoPart { - USING_FAST_MALLOC(RunInfoPart); - public: RunInfoPart(scoped_refptr<const ShapeResult::RunInfo> run, ShapeResult::RunInfo::GlyphDataRange range, @@ -79,6 +78,11 @@ } unsigned OffsetToRunStartIndex() const { return offset_; } + // The helper function for implementing |CreateViewsForResult()| for + // handling iterating over |Vector<scoped_refptr<RunInfo>>| and + // |base::span<RunInfoPart>|. + const RunInfoPart* get() const { return this; } + scoped_refptr<const ShapeResult::RunInfo> run_; ShapeResult::RunInfo::GlyphDataRange range_; @@ -129,26 +133,29 @@ has_vertical_offsets_(other->has_vertical_offsets_), width_(0) {} -ShapeResultView::~ShapeResultView() = default; +ShapeResultView::~ShapeResultView() { + for (auto& part : Parts()) + part.~RunInfoPart(); +} scoped_refptr<ShapeResult> ShapeResultView::CreateShapeResult() const { ShapeResult* new_result = new ShapeResult(primary_font_, start_index_ + char_index_offset_, num_characters_, Direction()); - new_result->runs_.ReserveCapacity(parts_.size()); - for (const auto& part : parts_) { + new_result->runs_.ReserveCapacity(num_parts_); + for (const auto& part : RunsOrParts()) { auto new_run = ShapeResult::RunInfo::Create( - part->run_->font_data_.get(), part->run_->direction_, - part->run_->canvas_rotation_, part->run_->script_, part->start_index_, - part->NumGlyphs(), part->num_characters_); - new_run->glyph_data_.CopyFromRange(part->range_); + part.run_->font_data_.get(), part.run_->direction_, + part.run_->canvas_rotation_, part.run_->script_, part.start_index_, + part.NumGlyphs(), part.num_characters_); + new_run->glyph_data_.CopyFromRange(part.range_); for (HarfBuzzRunGlyphData& glyph_data : new_run->glyph_data_) { - glyph_data.character_index -= part->offset_; + glyph_data.character_index -= part.offset_; } new_run->start_index_ += char_index_offset_; - new_run->width_ = part->width_; - new_run->num_characters_ = part->num_characters_; + new_run->width_ = part.width_; + new_run->num_characters_ = part.num_characters_; new_result->runs_.push_back(std::move(new_run)); } @@ -171,7 +178,9 @@ num_characters_ += std::min(end_index, other->EndIndex()) - std::max(start_index, other->StartIndex()); - for (const auto& run : other->RunsOrParts()) { + RunInfoPart* part = Parts().data() + num_parts_; + for (const auto& run_or_part : other->RunsOrParts()) { + auto* const run = run_or_part.get(); if (!run->GetRunInfo()) continue; // Compute start/end of the run, or of the part if ShapeResultView. @@ -205,14 +214,15 @@ // Adjust start_index for runs to be continuous. unsigned part_start_index = run_start + adjusted_start + index_diff; unsigned part_offset = adjusted_start; - parts_.push_back(std::make_unique<RunInfoPart>( - run->GetRunInfo(), range, part_start_index, part_offset, - part_characters, part_width)); + new (part) RunInfoPart(run->GetRunInfo(), range, part_start_index, + part_offset, part_characters, part_width); + ++part; num_glyphs_ += range.end - range.begin; width_ += part_width; } } + num_parts_ = static_cast<wtf_size_t>(std::distance(Parts().data(), part)); } scoped_refptr<ShapeResultView> ShapeResultView::Create(const Segment* segments, @@ -224,9 +234,20 @@ (!segments[i].result || !segments[i].view)); } #endif + wtf_size_t num_parts = 0; + for (auto& segment : base::span<const Segment>(segments, segment_count)) { + num_parts += segment.result ? segment.result->RunsOrParts().size() + : segment.view->RunsOrParts().size(); + } + static_assert(sizeof(ShapeResultView) % alignof(RunInfoPart) == 0, + "We have RunInfoPart as flexible array in ShapeResultView"); + const size_t byte_size = + sizeof(ShapeResultView) + sizeof(RunInfoPart) * num_parts; + void* buffer = ::WTF::Partitions::FastMalloc( + byte_size, ::WTF::GetStringWithTypeName<ShapeResultView>()); ShapeResultView* out = segments[0].result - ? new ShapeResultView(segments[0].result) - : new ShapeResultView(segments[0].view); + ? new (buffer) ShapeResultView(segments[0].result) + : new (buffer) ShapeResultView(segments[0].view); out->AddSegments(segments, segment_count); return base::AdoptRef(out); } @@ -251,7 +272,14 @@ const ShapeResult* result) { // This specialization is an optimization to allow the bounding box to be // re-used. - ShapeResultView* out = new ShapeResultView(result); + const wtf_size_t num_parts = result->RunsOrParts().size(); + static_assert(sizeof(ShapeResultView) % alignof(RunInfoPart) == 0, + "We have RunInfoPart as flexible array in ShapeResultView"); + const size_t byte_size = + sizeof(ShapeResultView) + sizeof(RunInfoPart) * num_parts; + void* buffer = ::WTF::Partitions::FastMalloc( + byte_size, ::WTF::GetStringWithTypeName<ShapeResultView>()); + ShapeResultView* out = new (buffer) ShapeResultView(result); out->char_index_offset_ = result->StartIndex(); if (!out->Rtl()) { out->start_index_ = 0; @@ -267,7 +295,7 @@ void ShapeResultView::AddSegments(const Segment* segments, size_t segment_count) { // This method assumes that no parts have been added yet. - DCHECK_EQ(parts_.size(), 0u); + DCHECK_EQ(num_parts_, 0u); // Segments are in logical order, runs and parts are in visual order. Iterate // over segments back-to-front for RTL. @@ -305,25 +333,22 @@ } unsigned ShapeResultView::PreviousSafeToBreakOffset(unsigned index) const { - for (auto it = parts_.rbegin(); it != parts_.rend(); ++it) { + for (auto it = RunsOrParts().rbegin(); it != RunsOrParts().rend(); ++it) { const auto& part = *it; - if (!part) - continue; - - unsigned run_start = part->start_index_; + unsigned run_start = part.start_index_; if (index >= run_start) { unsigned offset = index - run_start; - if (offset <= part->num_characters_) { - return part->PreviousSafeToBreakOffset(offset) + run_start; + if (offset <= part.num_characters_) { + return part.PreviousSafeToBreakOffset(offset) + run_start; } if (!Rtl()) { - return run_start + part->num_characters_; + return run_start + part.num_characters_; } } else if (Rtl()) { - if (it == parts_.rbegin()) - return part->start_index_; + if (it == RunsOrParts().rbegin()) + return part.start_index_; const auto& previous_run = *--it; - return previous_run->start_index_ + previous_run->num_characters_; + return previous_run.start_index_ + previous_run.num_characters_; } } @@ -332,9 +357,9 @@ void ShapeResultView::GetRunFontData( Vector<ShapeResult::RunFontData>* font_data) const { - for (const auto& part : parts_) { + for (const auto& part : RunsOrParts()) { font_data->push_back(ShapeResult::RunFontData( - {part->run_->font_data_.get(), part->end() - part->begin()})); + {part.run_->font_data_.get(), part.end() - part.begin()})); } } @@ -342,9 +367,9 @@ HashSet<const SimpleFontData*>* fallback) const { DCHECK(fallback); DCHECK(primary_font_); - for (const auto& part : parts_) { - if (part->run_->font_data_ && part->run_->font_data_ != primary_font_) { - fallback->insert(part->run_->font_data_.get()); + for (const auto& part : RunsOrParts()) { + if (part.run_->font_data_ && part.run_->font_data_ != primary_font_) { + fallback->insert(part.run_->font_data_.get()); } } } @@ -377,13 +402,13 @@ GlyphCallback glyph_callback, void* context) const { auto total_advance = initial_advance; - for (const auto& part : parts_) { - if (part->HasGlyphOffsets()) { + for (const auto& part : RunsOrParts()) { + if (part.HasGlyphOffsets()) { total_advance = - ForEachGlyphImpl<true>(total_advance, glyph_callback, context, *part); + ForEachGlyphImpl<true>(total_advance, glyph_callback, context, part); } else { - total_advance = ForEachGlyphImpl<false>(total_advance, glyph_callback, - context, *part); + total_advance = + ForEachGlyphImpl<false>(total_advance, glyph_callback, context, part); } } return total_advance; @@ -445,15 +470,13 @@ void* context) const { auto total_advance = initial_advance; - for (const auto& part : parts_) { - if (part->HasGlyphOffsets()) { - total_advance = - ForEachGlyphImpl<true>(total_advance, from, to, index_offset, - glyph_callback, context, *part); + for (const auto& part : Parts()) { + if (part.HasGlyphOffsets()) { + total_advance = ForEachGlyphImpl<true>( + total_advance, from, to, index_offset, glyph_callback, context, part); } else { - total_advance = - ForEachGlyphImpl<false>(total_advance, from, to, index_offset, - glyph_callback, context, *part); + total_advance = ForEachGlyphImpl<false>( + total_advance, from, to, index_offset, glyph_callback, context, part); } } return total_advance; @@ -469,11 +492,11 @@ unsigned run_offset = index_offset; float advance_so_far = initial_advance; - for (const auto& part : parts_) { - if (!part->NumGlyphs()) + for (const auto& part : RunsOrParts()) { + if (!part.NumGlyphs()) continue; - const auto& run = part->run_; + const auto& run = part.run_; unsigned graphemes_in_cluster = 1; float cluster_advance = 0; bool rtl = Direction() == TextDirection::kRtl; @@ -484,22 +507,22 @@ // contain multiple glyphs and grapheme clusters, with mutually overlapping // boundaries. const unsigned character_index_offset_for_glyph_data = - CharacterIndexOffsetForGlyphData(*part) + run_offset; + CharacterIndexOffsetForGlyphData(part) + run_offset; uint16_t cluster_start = - static_cast<uint16_t>(rtl ? part->CharacterIndexOfEndGlyph() + + static_cast<uint16_t>(rtl ? part.CharacterIndexOfEndGlyph() + character_index_offset_for_glyph_data - : part->GlyphAt(0).character_index + + : part.GlyphAt(0).character_index + character_index_offset_for_glyph_data); - const unsigned num_glyphs = part->NumGlyphs(); + const unsigned num_glyphs = part.NumGlyphs(); for (unsigned i = 0; i < num_glyphs; ++i) { - const HarfBuzzRunGlyphData& glyph_data = part->GlyphAt(i); + const HarfBuzzRunGlyphData& glyph_data = part.GlyphAt(i); uint16_t current_character_index = glyph_data.character_index + character_index_offset_for_glyph_data; bool is_run_end = (i + 1 == num_glyphs); bool is_cluster_end = - is_run_end || (part->GlyphAt(i + 1).character_index + + is_run_end || (part.GlyphAt(i + 1).character_index + character_index_offset_for_glyph_data != current_character_index); @@ -523,9 +546,9 @@ cluster_end = current_character_index; } else { cluster_end = static_cast<uint16_t>( - is_run_end ? part->CharacterIndexOfEndGlyph() + + is_run_end ? part.CharacterIndexOfEndGlyph() + character_index_offset_for_glyph_data - : part->GlyphAt(i + 1).character_index + + : part.GlyphAt(i + 1).character_index + character_index_offset_for_glyph_data); } graphemes_in_cluster = ShapeResult::CountGraphemesInCluster( @@ -590,24 +613,21 @@ FloatRect ink_bounds; float run_advance = 0.0f; - for (const auto& part : parts_) { - if (part->HasGlyphOffsets()) { - if (part->IsHorizontal()) { - ComputePartInkBounds<true, true>(*part.get(), run_advance, &ink_bounds); + for (const auto& part : Parts()) { + if (part.HasGlyphOffsets()) { + if (part.IsHorizontal()) { + ComputePartInkBounds<true, true>(part, run_advance, &ink_bounds); } else { - ComputePartInkBounds<false, true>(*part.get(), run_advance, - &ink_bounds); + ComputePartInkBounds<false, true>(part, run_advance, &ink_bounds); } } else { - if (part->IsHorizontal()) { - ComputePartInkBounds<true, false>(*part.get(), run_advance, - &ink_bounds); + if (part.IsHorizontal()) { + ComputePartInkBounds<true, false>(part, run_advance, &ink_bounds); } else { - ComputePartInkBounds<false, false>(*part.get(), run_advance, - &ink_bounds); + ComputePartInkBounds<false, false>(part, run_advance, &ink_bounds); } } - run_advance += part->Width(); + run_advance += part.Width(); } return ink_bounds;
diff --git a/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.h b/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.h index 484e33ab..591dff4 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.h +++ b/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.h
@@ -6,6 +6,7 @@ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_SHAPING_SHAPE_RESULT_VIEW_H_ #include <memory> +#include "base/containers/span.h" #include "third_party/blink/renderer/platform/fonts/shaping/shape_result.h" #include "third_party/blink/renderer/platform/fonts/simple_font_data.h" #include "third_party/blink/renderer/platform/geometry/layout_unit.h" @@ -163,8 +164,13 @@ FloatRect* ink_bounds) const; // Common signatures with ShapeResult, to templatize algorithms. - const Vector<std::unique_ptr<RunInfoPart>, 4>& RunsOrParts() const { - return parts_; + base::span<const RunInfoPart> RunsOrParts() const { return Parts(); } + + base::span<RunInfoPart> Parts() { + return {reinterpret_cast<RunInfoPart*>(parts_), num_parts_}; + } + base::span<const RunInfoPart> Parts() const { + return {reinterpret_cast<const RunInfoPart*>(parts_), num_parts_}; } unsigned StartIndexOffsetForRun() const { return char_index_offset_; } @@ -187,7 +193,14 @@ unsigned char_index_offset_; float width_; - Vector<std::unique_ptr<RunInfoPart>, 4> parts_; + wtf_size_t num_parts_ = 0; + + // TODO(yosin): We should declare |RunInoPart| in this file to avoid using + // dummy struct. + // Note: To avoid declaring |RunInfoPart| here, we use dummy struct. + struct { + void* alignment; + } parts_[]; private: friend class ShapeResult; @@ -206,6 +219,8 @@ GlyphCallback, void* context, const RunInfoPart& part) const; + + DISALLOW_COPY_AND_ASSIGN(ShapeResultView); }; } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/picture_snapshot.h b/third_party/blink/renderer/platform/graphics/picture_snapshot.h index ea0edc8..04bd3c6 100644 --- a/third_party/blink/renderer/platform/graphics/picture_snapshot.h +++ b/third_party/blink/renderer/platform/graphics/picture_snapshot.h
@@ -65,9 +65,9 @@ Vector<uint8_t> Replay(unsigned from_step = 0, unsigned to_step = 0, double scale = 1.0) const; - Vector<Vector<TimeDelta>> Profile(unsigned min_iterations, - base::TimeDelta min_duration, - const FloatRect* clip_rect) const; + Vector<Vector<base::TimeDelta>> Profile(unsigned min_iterations, + base::TimeDelta min_duration, + const FloatRect* clip_rect) const; std::unique_ptr<JSONArray> SnapshotCommandLog() const; bool IsEmpty() const;
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 3b9d538..07b3e4e 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -423,7 +423,7 @@ }, { name: "CSSVariables2", - status: "stable", + status: "experimental", }, // Support for registered custom properties with <image> syntax. { @@ -1475,6 +1475,7 @@ }, { name: "StreamsNative", + status: "experimental", }, { name: "TextFragmentIdentifiers",
diff --git a/third_party/blink/renderer/platform/wtf/time.h b/third_party/blink/renderer/platform/wtf/time.h index b69059d..f3f34394 100644 --- a/third_party/blink/renderer/platform/wtf/time.h +++ b/third_party/blink/renderer/platform/wtf/time.h
@@ -35,8 +35,6 @@ return CurrentTime() * 1000.0; } -using TimeFunction = double (*)(); - // Monotonically increasing clock time since an arbitrary and unspecified origin // time. Mockable using SetTimeFunctionsForTesting(). WTF_EXPORT TimeTicks CurrentTimeTicks();
diff --git a/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py b/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py index d1d490a..b8e22867 100755 --- a/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py +++ b/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py
@@ -53,6 +53,7 @@ 'base::SequencedTaskRunner', 'base::SingleThreadTaskRunner', 'base::ScopedFD', + 'base::ScopedClosureRunner', 'base::SupportsWeakPtr', 'base::SysInfo', 'base::ThreadChecker', @@ -603,9 +604,6 @@ ], 'allowed': [ 'base::data', - # TODO(crbug.com/960665): Remove it once it is replaced with a WTF equivalent. - 'base::queue', - 'base::SharedMemory', 'base::StringPiece', 'base::ThreadTaskRunnerHandle',
diff --git a/third_party/blink/web_tests/MSANExpectations b/third_party/blink/web_tests/MSANExpectations index a5a3581..fe66d14 100644 --- a/third_party/blink/web_tests/MSANExpectations +++ b/third_party/blink/web_tests/MSANExpectations
@@ -178,7 +178,6 @@ crbug.com/856601 [ Linux ] virtual/webrtc-wpt-unified-plan/external/wpt/webrtc/idlharness.https.window.html [ Timeout Pass ] crbug.com/856601 [ Linux ] external/wpt/css/filter-effects/interfaces.any.html [ Timeout Pass ] crbug.com/856601 [ Linux ] external/wpt/webxr/idlharness.https.window.html [ Timeout Pass ] -crbug.com/856601 [ Linux ] virtual/streams-native/external/wpt/fetch/api/idl.any.sharedworker.html [ Pass Timeout ] crbug.com/856601 [ Linux ] virtual/webrtc-wpt-plan-b/external/wpt/webrtc/idlharness.https.window.html [ Pass Timeout ] crbug.com/856601 [ Linux ] fast/js/toString-stack-overflow.html [ Pass Timeout ] crbug.com/856601 [ Linux ] external/wpt/css/css-masking/idlharness.html [ Pass Timeout ]
diff --git a/third_party/blink/web_tests/SlowTests b/third_party/blink/web_tests/SlowTests index b10b3ba1..ec8daf6 100644 --- a/third_party/blink/web_tests/SlowTests +++ b/third_party/blink/web_tests/SlowTests
@@ -267,13 +267,6 @@ crbug.com/853977 [ Linux ] virtual/blink-cors/http/tests/fetch/chromium/response-text-gc-crash.html [ Slow ] crbug.com/853977 [ Linux ] virtual/streaming-preload/http/tests/fetch/chromium/call-extra-crash-tee.html [ Slow ] crbug.com/853977 [ Linux ] virtual/streaming-preload/http/tests/fetch/chromium/release-handle-crash.html [ Slow ] -crbug.com/853977 [ Linux ] virtual/streams-native/http/tests/fetch/chromium/call-extra-crash-tee.html [ Slow ] -crbug.com/853977 [ Linux ] virtual/streams-native/http/tests/fetch/chromium/release-handle-crash.html [ Slow ] -crbug.com/853977 [ Linux ] virtual/streams-native/http/tests/fetch/chromium/response-array-buffer-gc-crash.html [ Slow ] -crbug.com/853977 [ Linux ] virtual/streams-native/http/tests/fetch/chromium/response-blob-gc-crash.html [ Slow ] -crbug.com/853977 [ Linux ] virtual/streams-native/http/tests/fetch/chromium/response-form-data-gc-crash.html [ Slow ] -crbug.com/853977 [ Linux ] virtual/streams-native/http/tests/fetch/chromium/response-json-gc-crash.html [ Slow ] -crbug.com/853977 [ Linux ] virtual/streams-native/http/tests/fetch/chromium/response-text-gc-crash.html [ Slow ] crbug.com/864887 [ Mac ] fast/scroll-snap/snaps-after-scrollbar-scrolling.html [ Slow ] @@ -618,23 +611,6 @@ crbug.com/951895 [ Mac Debug ] transforms/2d/transform-2d.html [ Slow ] -crbug.com/874695 virtual/streams-native/http/tests/fetch/serviceworker/body-mixin-base-https-other-https.html [ Slow ] -crbug.com/874695 virtual/streams-native/http/tests/fetch/serviceworker/body-mixin.html [ Slow ] -crbug.com/874695 virtual/streams-native/http/tests/fetch/serviceworker/stream-reader-base-https-other-https.html [ Slow ] -crbug.com/874695 virtual/streams-native/http/tests/fetch/serviceworker/stream-reader.html [ Slow ] -crbug.com/874695 virtual/streams-native/http/tests/fetch/serviceworker/thorough/ [ Slow ] -crbug.com/874695 virtual/streams-native/http/tests/fetch/serviceworker-proxied/thorough/ [ Slow ] -crbug.com/874695 virtual/streams-native/http/tests/fetch/window/body-mixin-base-https-other-https.html [ Slow ] -crbug.com/874695 virtual/streams-native/http/tests/fetch/window/body-mixin.html [ Slow ] -crbug.com/874695 virtual/streams-native/http/tests/fetch/window/stream-reader-base-https-other-https.html [ Slow ] -crbug.com/874695 virtual/streams-native/http/tests/fetch/window/stream-reader.html [ Slow ] -crbug.com/874695 virtual/streams-native/http/tests/fetch/window/thorough/ [ Slow ] -crbug.com/874695 virtual/streams-native/http/tests/fetch/workers/body-mixin-base-https-other-https.html [ Slow ] -crbug.com/874695 virtual/streams-native/http/tests/fetch/workers/body-mixin.html [ Slow ] -crbug.com/874695 virtual/streams-native/http/tests/fetch/workers/stream-reader-base-https-other-https.html [ Slow ] -crbug.com/874695 virtual/streams-native/http/tests/fetch/workers/stream-reader.html [ Slow ] -crbug.com/874695 virtual/streams-native/http/tests/fetch/workers/thorough/ [ Slow ] - crbug.com/962831 [ Release ] http/tests/devtools/network/preview-searchable.js [ Slow ] crbug.com/967526 http/tests/devtools/console/console-uncaught-promise.js [ Slow ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 0ea0a91..9c1314cd 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -3536,7 +3536,6 @@ crbug.com/626703 external/wpt/fetch/content-type/response.window.html [ Timeout ] crbug.com/626703 virtual/blink-cors/external/wpt/fetch/content-type/response.window.html [ Timeout ] crbug.com/626703 virtual/omt-worker-fetch/external/wpt/fetch/content-type/response.window.html [ Timeout ] -crbug.com/626703 virtual/streams-native/external/wpt/fetch/content-type/response.window.html [ Timeout ] crbug.com/626703 virtual/streaming-preload/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/no-active-script-manual-module.html [ Timeout ] crbug.com/626703 virtual/streaming-preload/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/no-active-script-manual-classic.html [ Timeout ] crbug.com/626703 external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/no-active-script-manual-classic.html [ Timeout ] @@ -3842,7 +3841,6 @@ crbug.com/626703 external/wpt/fetch/security/redirect-to-url-with-credentials.https.html [ Timeout ] crbug.com/626703 virtual/blink-cors/external/wpt/fetch/security/redirect-to-url-with-credentials.https.html [ Timeout ] crbug.com/626703 virtual/omt-worker-fetch/external/wpt/fetch/security/redirect-to-url-with-credentials.https.html [ Timeout ] -crbug.com/626703 virtual/streams-native/external/wpt/fetch/security/redirect-to-url-with-credentials.https.html [ Timeout ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-polygon-024.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-048.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-026.html [ Failure ] @@ -3917,7 +3915,6 @@ crbug.com/626703 external/wpt/fetch/http-cache/basic-auth-cache-test.html [ Timeout ] crbug.com/626703 virtual/blink-cors/external/wpt/fetch/http-cache/basic-auth-cache-test.html [ Timeout ] crbug.com/626703 virtual/omt-worker-fetch/external/wpt/fetch/http-cache/basic-auth-cache-test.html [ Timeout ] -crbug.com/626703 virtual/streams-native/external/wpt/fetch/http-cache/basic-auth-cache-test.html [ Timeout ] crbug.com/626703 external/wpt/css/css-fonts/font-feature-settings-descriptor-01.html [ Failure ] crbug.com/626703 [ Win10 ] external/wpt/fetch/api/redirect/redirect-count.any.worker.html [ Timeout ] crbug.com/626703 [ Win10 ] external/wpt/fetch/api/redirect/redirect-count.any.html [ Timeout ] @@ -5817,7 +5814,6 @@ # Sheriff 2019-02-26 crbug.com/936083 external/wpt/import-maps/builtin-import-scheme.tentative.html [ Failure Pass ] crbug.com/936165 media/autoplay-muted.html [ Timeout Pass ] -crbug.com/936108 virtual/streams-native/http/tests/streams/transferable/readable-stream.html [ Failure Pass ] # Sheriff 2019-02-27 crbug.com/936279 external/wpt/import-maps/fallback-disallowed.sub.tentative.html [ Failure Pass Timeout ] @@ -6139,19 +6135,11 @@ crbug.com/974334 [ Mac ] external/wpt/html/cross-origin/usecredentials.tentative.html [ Failure ] # Flaky on Linux -crbug.com/973769 [ Linux ] http/tests/media/video-seek-to-duration.html [ Pass Failure ] -crbug.com/973769 [ Linux ] http/tests/media/video-seek-to-middle.html [ Pass Failure ] crbug.com/973769 [ Linux ] media/controls/controls-cast-do-not-fade-out.html [ Pass Timeout ] -crbug.com/973769 [ Linux ] media/video-pause-immediately.html [ Pass Failure ] -crbug.com/973769 [ Linux ] media/W3C/audio/events/event_timeupdate_manual.html [ Pass Failure ] # Flaky on Linux crbug.com/974660 [ Linux ] http/tests/devtools/elements/highlight/highlight-node-vertical-rl.js [ Pass Failure ] -# Failing with lazy-feedback-allocation feature in V8. See the bug for more -# details. -crbug.com/976587 netinfo/gc-unused-listeners.html [ Pass Failure ] - # Sheriff 2019-06-19 crbug.com/959129 [ Linux ] virtual/threaded/http/tests/devtools/tracing/timeline-script-parse.js [ Pass Failure ] @@ -6162,3 +6150,7 @@ crbug.com/976045 [ Win ] virtual/fractional_scrolling/fast/scrolling/unscrollable-layer-subpixel-size-with-negative-overflow.html [ Pass Failure ] crbug.com/976157 inspector-protocol/runtime/runtime-console-basic-functions.js [ Pass Failure ] crbug.com/977379 [ Mac10.10 ] fast/events/before-unload-return-value-from-listener.html [ Pass Timeout Failure ] + +crbug.com/974710 [ Win7 ] http/tests/security/isolatedWorld/bypass-main-world-csp-iframes.html [ Pass Failure ] +crbug.com/974710 [ Win7 ] virtual/blink-cors/http/tests/security/isolatedWorld/bypass-main-world-csp-iframes.html [ Pass Failure ] +crbug.com/974710 [ Win7 ] virtual/isolated_world_csp/http/tests/security/isolatedWorld/bypass-main-world-csp-iframes.html [ Pass Failure ]
diff --git a/third_party/blink/web_tests/VirtualTestSuites b/third_party/blink/web_tests/VirtualTestSuites index 2240ced0..f02b2d6 100644 --- a/third_party/blink/web_tests/VirtualTestSuites +++ b/third_party/blink/web_tests/VirtualTestSuites
@@ -943,31 +943,6 @@ "args": ["--enable-features=ScriptStreamingOnPreload"] }, { - "prefix": "streams-native", - "base": "external/wpt/streams", - "args": ["--enable-blink-features=StreamsNative"] - }, - { - "prefix": "streams-native", - "base": "http/tests/streams", - "args": ["--enable-blink-features=StreamsNative"] - }, - { - "prefix": "streams-native", - "base": "http/tests/fetch", - "args": ["--enable-blink-features=StreamsNative"] - }, - { - "prefix": "streams-native", - "base": "external/wpt/fetch", - "args": ["--enable-blink-features=StreamsNative"] - }, - { - "prefix": "streams-native", - "base": "external/wpt/encoding/streams", - "args": ["--enable-blink-features=StreamsNative"] - }, - { "prefix": "focusless-spat-nav", "base": "fast/spatial-navigation/focusless", "args": ["--enable-blink-features=FocuslessSpatialNavigation",
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json index 473ab86..6412849e 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json
@@ -165023,6 +165023,9 @@ "service-workers/service-worker/fetch-request-xhr.https-expected.txt": [ [] ], + "service-workers/service-worker/global-serviceworker.https.any.serviceworker-expected.txt": [ + [] + ], "service-workers/service-worker/import-module-scripts.https-expected.txt": [ [] ], @@ -165260,12 +165263,6 @@ "service-workers/service-worker/resources/cors-denied.txt": [ [] ], - "service-workers/service-worker/resources/dummy-shared-worker-interceptor.js": [ - [] - ], - "service-workers/service-worker/resources/dummy-shared-worker-interceptor.js.headers": [ - [] - ], "service-workers/service-worker/resources/dummy-worker-interceptor.js": [ [] ], @@ -165881,12 +165878,6 @@ "service-workers/service-worker/resources/service-worker-interception-static-import-worker.js": [ [] ], - "service-workers/service-worker/resources/shared-worker-controlled.js": [ - [] - ], - "service-workers/service-worker/resources/shared-worker-import.js": [ - [] - ], "service-workers/service-worker/resources/silence.oga": [ [] ], @@ -166532,6 +166523,18 @@ "streams/readable-streams/brand-checks.any.worker-expected.txt": [ [] ], + "streams/readable-streams/default-reader.any-expected.txt": [ + [] + ], + "streams/readable-streams/default-reader.any.serviceworker-expected.txt": [ + [] + ], + "streams/readable-streams/default-reader.any.sharedworker-expected.txt": [ + [] + ], + "streams/readable-streams/default-reader.any.worker-expected.txt": [ + [] + ], "streams/readable-streams/general.any-expected.txt": [ [] ], @@ -166583,6 +166586,30 @@ "streams/resources/test-utils.js": [ [] ], + "streams/transform-streams/properties.any-expected.txt": [ + [] + ], + "streams/transform-streams/properties.any.serviceworker-expected.txt": [ + [] + ], + "streams/transform-streams/properties.any.sharedworker-expected.txt": [ + [] + ], + "streams/transform-streams/properties.any.worker-expected.txt": [ + [] + ], + "streams/writable-streams/constructor.any-expected.txt": [ + [] + ], + "streams/writable-streams/constructor.any.serviceworker-expected.txt": [ + [] + ], + "streams/writable-streams/constructor.any.sharedworker-expected.txt": [ + [] + ], + "streams/writable-streams/constructor.any.worker-expected.txt": [ + [] + ], "streams/writable-streams/properties.any-expected.txt": [ [] ], @@ -174617,9 +174644,15 @@ "workers/semantics/interface-objects/001.worker-expected.txt": [ [] ], + "workers/semantics/interface-objects/002.worker-expected.txt": [ + [] + ], "workers/semantics/interface-objects/003-expected.txt": [ [] ], + "workers/semantics/interface-objects/004-expected.txt": [ + [] + ], "workers/semantics/multiple-workers/003-expected.txt": [ [] ], @@ -249791,54 +249824,12 @@ {} ] ], - "navigation-timing/nav2_test_redirect_xserver_opt_in.html": [ - [ - "navigation-timing/nav2_test_redirect_xserver_opt_in.html", - {} - ] - ], "navigation-timing/nav2_test_unique_nav_instances.html": [ [ "navigation-timing/nav2_test_unique_nav_instances.html", {} ] ], - "navigation-timing/nav2_test_unloadEvents_no_previous_document.html": [ - [ - "navigation-timing/nav2_test_unloadEvents_no_previous_document.html", - {} - ] - ], - "navigation-timing/nav2_test_unloadEvents_previous_document_cross_origin.sub.html": [ - [ - "navigation-timing/nav2_test_unloadEvents_previous_document_cross_origin.sub.html", - {} - ] - ], - "navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirect_chain_partial_opt_in.html": [ - [ - "navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirect_chain_partial_opt_in.html", - {} - ] - ], - "navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirect_opt_in.html": [ - [ - "navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirect_opt_in.html", - {} - ] - ], - "navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirects.html": [ - [ - "navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirects.html", - {} - ] - ], - "navigation-timing/nav2_test_unloadEvents_with_previous_document.html": [ - [ - "navigation-timing/nav2_test_unloadEvents_with_previous_document.html", - {} - ] - ], "navigation-timing/po-navigation.html": [ [ "navigation-timing/po-navigation.html", @@ -249971,6 +249962,12 @@ {} ] ], + "navigation-timing/unload-event-same-origin-check.html": [ + [ + "navigation-timing/unload-event-same-origin-check.html", + {} + ] + ], "netinfo/idlharness.any.js": [ [ "netinfo/idlharness.any.html", @@ -274192,6 +274189,23 @@ {} ] ], + "service-workers/service-worker/global-serviceworker.https.any.js": [ + [ + "service-workers/service-worker/global-serviceworker.https.any.serviceworker.html", + { + "script_metadata": [ + [ + "title", + "serviceWorker on service worker global" + ], + [ + "global", + "!default,serviceworker" + ] + ] + } + ] + ], "service-workers/service-worker/http-to-https-redirect-and-register.https.html": [ [ "service-workers/service-worker/http-to-https-redirect-and-register.https.html", @@ -274672,12 +274686,6 @@ {} ] ], - "service-workers/service-worker/shared-worker-controlled.https.html": [ - [ - "service-workers/service-worker/shared-worker-controlled.https.html", - {} - ] - ], "service-workers/service-worker/skip-waiting-installed.https.html": [ [ "service-workers/service-worker/skip-waiting-installed.https.html", @@ -440943,38 +440951,10 @@ "06c9b7f3b678a22751a1e8e1a57028216ab21879", "testharness" ], - "navigation-timing/nav2_test_redirect_xserver_opt_in.html": [ - "11dc5b7df0a4871114c3e4c4f4a2dd142708d26e", - "testharness" - ], "navigation-timing/nav2_test_unique_nav_instances.html": [ "1d77ab6bae101b704d1267e8b03416011f28d676", "testharness" ], - "navigation-timing/nav2_test_unloadEvents_no_previous_document.html": [ - "3e7b0721d277e5b8fb6a2c1deb56226ed3eaa9d1", - "testharness" - ], - "navigation-timing/nav2_test_unloadEvents_previous_document_cross_origin.sub.html": [ - "fb7247d10b7566a93b955e0b9145e3089f329cf4", - "testharness" - ], - "navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirect_chain_partial_opt_in.html": [ - "0b3978641b9a74f7f9d85c50cefe48210a8f1473", - "testharness" - ], - "navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirect_opt_in.html": [ - "d3ff55087a1715f14a6b089b7bf80e8037ae8a1a", - "testharness" - ], - "navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirects.html": [ - "8a7f57d746009367d099d141620bcfdfd88acc7d", - "testharness" - ], - "navigation-timing/nav2_test_unloadEvents_with_previous_document.html": [ - "90f336d134054ae9cb563ad874cb57c5c1064ae9", - "testharness" - ], "navigation-timing/po-navigation.html": [ "a54fb2aff8eab74e59c5a84fc2bcf487f122ec49", "testharness" @@ -441095,6 +441075,10 @@ "a8f7e6002d2179a2888da14bea23fcce42db19d7", "testharness" ], + "navigation-timing/unload-event-same-origin-check.html": [ + "319d04462deba82b548d44291042d296afaf36a7", + "testharness" + ], "netinfo/META.yml": [ "220c5d6d32b6c31dfd71e3267360b71001465b41", "support" @@ -462215,6 +462199,14 @@ "11da27036d092c2f2c6d58df576b29e9bfb99537", "testharness" ], + "service-workers/service-worker/global-serviceworker.https.any.js": [ + "489b37f83e1c21809e9b0b63d0f0e59db23d197c", + "testharness" + ], + "service-workers/service-worker/global-serviceworker.https.any.serviceworker-expected.txt": [ + "b4d350321e00ef0645f343b1472ae46043f797b5", + "support" + ], "service-workers/service-worker/http-to-https-redirect-and-register.https.html": [ "5626237dcccbf279029ca072b8a0bc9e845fbb1c", "testharness" @@ -462803,14 +462795,6 @@ "ff333bd97da4c6949a3142ac8789cb2e45d41b86", "support" ], - "service-workers/service-worker/resources/dummy-shared-worker-interceptor.js": [ - "e996da6b2b7f491820ddab168e9d2f2d6f6cea35", - "support" - ], - "service-workers/service-worker/resources/dummy-shared-worker-interceptor.js.headers": [ - "a17a9a3a12cefe883a5d4dee4d5a45bef120d050", - "support" - ], "service-workers/service-worker/resources/dummy-worker-interceptor.js": [ "1c381fd180e2b3d3b7a11394926096141b0a3c76", "support" @@ -463631,14 +463615,6 @@ "e570958701db47250cf6d87a16f4722a84e626b2", "support" ], - "service-workers/service-worker/resources/shared-worker-controlled.js": [ - "1ccc2fe3bdbe68ad200f7037fd5c68d768931834", - "support" - ], - "service-workers/service-worker/resources/shared-worker-import.js": [ - "7c554bd7415209b266fffceb90185a79ebd756c5", - "support" - ], "service-workers/service-worker/resources/silence.oga": [ "af591880436af43abb4cee59fde320081bcac7ed", "support" @@ -463887,10 +463863,6 @@ "6004985a34608132825086dab0c0777f3f0fdf1e", "testharness" ], - "service-workers/service-worker/shared-worker-controlled.https.html": [ - "0320c02a4fa2b8066bc6f603bf7abc3eefe1c3b3", - "testharness" - ], "service-workers/service-worker/skip-waiting-installed.https.html": [ "b604f651b3c1deb38d891c77394a8f175a19c34e", "testharness" @@ -465480,15 +465452,15 @@ "testharness" ], "std-toast/options.html": [ - "65d3a3ae37394bc137ce1baf570226b0b7cde098", + "74470e35998b537304538b3fab96bf37a0702ecc", "testharness" ], "std-toast/resources/helpers.js": [ - "60068bb2089f957c26174e625b9e6424b59de494", + "41b7672ab1bb60d0a2345a6debb880db756940f6", "support" ], "std-toast/show-toast.html": [ - "07331818df0926f44d5c829a0060e87f0c4d1384", + "50cdc2c06ddbf34b16119f9c42e3a7cbaf5ec258", "testharness" ], "storage/META.yml": [ @@ -465680,7 +465652,7 @@ "testharness" ], "streams/readable-byte-streams/brand-checks.any-expected.txt": [ - "6a71eee5e76abc5e919d5d7be8f5a4f54d11665d", + "13d86ff94d2afa1a5c6c53fd5657d8d91c1cb129", "support" ], "streams/readable-byte-streams/brand-checks.any.js": [ @@ -465688,19 +465660,19 @@ "testharness" ], "streams/readable-byte-streams/brand-checks.any.serviceworker-expected.txt": [ - "6a71eee5e76abc5e919d5d7be8f5a4f54d11665d", + "13d86ff94d2afa1a5c6c53fd5657d8d91c1cb129", "support" ], "streams/readable-byte-streams/brand-checks.any.sharedworker-expected.txt": [ - "6a71eee5e76abc5e919d5d7be8f5a4f54d11665d", + "13d86ff94d2afa1a5c6c53fd5657d8d91c1cb129", "support" ], "streams/readable-byte-streams/brand-checks.any.worker-expected.txt": [ - "6a71eee5e76abc5e919d5d7be8f5a4f54d11665d", + "13d86ff94d2afa1a5c6c53fd5657d8d91c1cb129", "support" ], "streams/readable-byte-streams/construct-byob-request.any-expected.txt": [ - "c640a4fbd293b00c538aad36bacbe2bef7e00550", + "8ec519e10cc02b3a8cbb0374726eebd34a701441", "support" ], "streams/readable-byte-streams/construct-byob-request.any.js": [ @@ -465712,11 +465684,11 @@ "support" ], "streams/readable-byte-streams/construct-byob-request.any.sharedworker-expected.txt": [ - "c640a4fbd293b00c538aad36bacbe2bef7e00550", + "8ec519e10cc02b3a8cbb0374726eebd34a701441", "support" ], "streams/readable-byte-streams/construct-byob-request.any.worker-expected.txt": [ - "c640a4fbd293b00c538aad36bacbe2bef7e00550", + "8ec519e10cc02b3a8cbb0374726eebd34a701441", "support" ], "streams/readable-byte-streams/constructor.any-expected.txt": [ @@ -465740,7 +465712,7 @@ "support" ], "streams/readable-byte-streams/detached-buffers.any-expected.txt": [ - "6a3e32b47785d530c0ca984c89b2b46283b2f8cc", + "76867b4809a25d912e2d230cb717988bfa34e18f", "support" ], "streams/readable-byte-streams/detached-buffers.any.js": [ @@ -465748,19 +465720,19 @@ "testharness" ], "streams/readable-byte-streams/detached-buffers.any.serviceworker-expected.txt": [ - "6a3e32b47785d530c0ca984c89b2b46283b2f8cc", + "76867b4809a25d912e2d230cb717988bfa34e18f", "support" ], "streams/readable-byte-streams/detached-buffers.any.sharedworker-expected.txt": [ - "6a3e32b47785d530c0ca984c89b2b46283b2f8cc", + "76867b4809a25d912e2d230cb717988bfa34e18f", "support" ], "streams/readable-byte-streams/detached-buffers.any.worker-expected.txt": [ - "6a3e32b47785d530c0ca984c89b2b46283b2f8cc", + "76867b4809a25d912e2d230cb717988bfa34e18f", "support" ], "streams/readable-byte-streams/general.any-expected.txt": [ - "3644dc004fa47db958411e161dad89cda64237cb", + "1ccd08ad1c2ad69925b87ab9e26f6359904c49ea", "support" ], "streams/readable-byte-streams/general.any.js": [ @@ -465768,19 +465740,19 @@ "testharness" ], "streams/readable-byte-streams/general.any.serviceworker-expected.txt": [ - "3644dc004fa47db958411e161dad89cda64237cb", + "1ccd08ad1c2ad69925b87ab9e26f6359904c49ea", "support" ], "streams/readable-byte-streams/general.any.sharedworker-expected.txt": [ - "3644dc004fa47db958411e161dad89cda64237cb", + "1ccd08ad1c2ad69925b87ab9e26f6359904c49ea", "support" ], "streams/readable-byte-streams/general.any.worker-expected.txt": [ - "3644dc004fa47db958411e161dad89cda64237cb", + "1ccd08ad1c2ad69925b87ab9e26f6359904c49ea", "support" ], "streams/readable-byte-streams/properties.any-expected.txt": [ - "83c737bef4a9018ba1b6298fe7eb0e3c3dc38119", + "46b375460c88cf63a59aa45ea52a54411cc0d7a8", "support" ], "streams/readable-byte-streams/properties.any.js": [ @@ -465788,15 +465760,15 @@ "testharness" ], "streams/readable-byte-streams/properties.any.serviceworker-expected.txt": [ - "83c737bef4a9018ba1b6298fe7eb0e3c3dc38119", + "46b375460c88cf63a59aa45ea52a54411cc0d7a8", "support" ], "streams/readable-byte-streams/properties.any.sharedworker-expected.txt": [ - "83c737bef4a9018ba1b6298fe7eb0e3c3dc38119", + "46b375460c88cf63a59aa45ea52a54411cc0d7a8", "support" ], "streams/readable-byte-streams/properties.any.worker-expected.txt": [ - "83c737bef4a9018ba1b6298fe7eb0e3c3dc38119", + "46b375460c88cf63a59aa45ea52a54411cc0d7a8", "support" ], "streams/readable-streams/async-iterator.any-expected.txt": [ @@ -465859,10 +465831,26 @@ "a60e70d4baecbe7154098ee6a4df8b1910fed5d8", "testharness" ], + "streams/readable-streams/default-reader.any-expected.txt": [ + "f1581e3f30bfd94e22d181d0cca1693b32265909", + "support" + ], "streams/readable-streams/default-reader.any.js": [ "224cd834b31f86174da9cd7d28048b7ab8689b2a", "testharness" ], + "streams/readable-streams/default-reader.any.serviceworker-expected.txt": [ + "f1581e3f30bfd94e22d181d0cca1693b32265909", + "support" + ], + "streams/readable-streams/default-reader.any.sharedworker-expected.txt": [ + "f1581e3f30bfd94e22d181d0cca1693b32265909", + "support" + ], + "streams/readable-streams/default-reader.any.worker-expected.txt": [ + "f1581e3f30bfd94e22d181d0cca1693b32265909", + "support" + ], "streams/readable-streams/floating-point-total-queue-size.any.js": [ "9e4e54c1ff33fe43372841973d28dbc48cc90686", "testharness" @@ -465872,7 +465860,7 @@ "testharness" ], "streams/readable-streams/general.any-expected.txt": [ - "41a7590e863fd11382c6b13cf767968221a74ede", + "0d1c378978b2ba8a48877c4107a6613b5615a322", "support" ], "streams/readable-streams/general.any.js": [ @@ -465880,15 +465868,15 @@ "testharness" ], "streams/readable-streams/general.any.serviceworker-expected.txt": [ - "41a7590e863fd11382c6b13cf767968221a74ede", + "0d1c378978b2ba8a48877c4107a6613b5615a322", "support" ], "streams/readable-streams/general.any.sharedworker-expected.txt": [ - "41a7590e863fd11382c6b13cf767968221a74ede", + "0d1c378978b2ba8a48877c4107a6613b5615a322", "support" ], "streams/readable-streams/general.any.worker-expected.txt": [ - "41a7590e863fd11382c6b13cf767968221a74ede", + "0d1c378978b2ba8a48877c4107a6613b5615a322", "support" ], "streams/readable-streams/patched-global.any-expected.txt": [ @@ -465991,10 +465979,26 @@ "52d44a347ae0005de95ab43a06ac1d0adddc757e", "testharness" ], + "streams/transform-streams/properties.any-expected.txt": [ + "927b2d9b9c500fe8505a145315da679bf9e2cfdc", + "support" + ], "streams/transform-streams/properties.any.js": [ "892d66169284237f967b33ec5c87a4b74b79a508", "testharness" ], + "streams/transform-streams/properties.any.serviceworker-expected.txt": [ + "927b2d9b9c500fe8505a145315da679bf9e2cfdc", + "support" + ], + "streams/transform-streams/properties.any.sharedworker-expected.txt": [ + "927b2d9b9c500fe8505a145315da679bf9e2cfdc", + "support" + ], + "streams/transform-streams/properties.any.worker-expected.txt": [ + "927b2d9b9c500fe8505a145315da679bf9e2cfdc", + "support" + ], "streams/transform-streams/reentrant-strategies.any.js": [ "c18d6d102d5299a4aac628fcb47973f6cb6be58a", "testharness" @@ -466031,10 +466035,26 @@ "284bb16e1f5c6dca8e3657b85c42193f52ef3ac2", "testharness" ], + "streams/writable-streams/constructor.any-expected.txt": [ + "408fdc9f5c05ed1571438cc6197bc5e34a7a7992", + "support" + ], "streams/writable-streams/constructor.any.js": [ "97cda9cedac9aaae87cfa23e63c7667b15955734", "testharness" ], + "streams/writable-streams/constructor.any.serviceworker-expected.txt": [ + "408fdc9f5c05ed1571438cc6197bc5e34a7a7992", + "support" + ], + "streams/writable-streams/constructor.any.sharedworker-expected.txt": [ + "408fdc9f5c05ed1571438cc6197bc5e34a7a7992", + "support" + ], + "streams/writable-streams/constructor.any.worker-expected.txt": [ + "408fdc9f5c05ed1571438cc6197bc5e34a7a7992", + "support" + ], "streams/writable-streams/count-queuing-strategy.any.js": [ "e8d9ca8a98dcc449ca6bd9cdbb515b16761460b7", "testharness" @@ -466052,7 +466072,7 @@ "testharness" ], "streams/writable-streams/properties.any-expected.txt": [ - "3628bffe0d657c9dfeb41d38e91179b85206acbd", + "7f3b4464c2000503bb6ff4ebc75ffc4cf8dc330b", "support" ], "streams/writable-streams/properties.any.js": [ @@ -466060,15 +466080,15 @@ "testharness" ], "streams/writable-streams/properties.any.serviceworker-expected.txt": [ - "3628bffe0d657c9dfeb41d38e91179b85206acbd", + "7f3b4464c2000503bb6ff4ebc75ffc4cf8dc330b", "support" ], "streams/writable-streams/properties.any.sharedworker-expected.txt": [ - "3628bffe0d657c9dfeb41d38e91179b85206acbd", + "7f3b4464c2000503bb6ff4ebc75ffc4cf8dc330b", "support" ], "streams/writable-streams/properties.any.worker-expected.txt": [ - "3628bffe0d657c9dfeb41d38e91179b85206acbd", + "7f3b4464c2000503bb6ff4ebc75ffc4cf8dc330b", "support" ], "streams/writable-streams/reentrant-strategy.any.js": [ @@ -473160,7 +473180,7 @@ "support" ], "tools/wptserve/wptserve/response.py": [ - "6a2410396bee8040a42551be87312be37acb6c9b", + "3a60c2babb39d8d77999022a7fb4d184cb019aa8", "support" ], "tools/wptserve/wptserve/router.py": [ @@ -475848,15 +475868,15 @@ "support" ], "web-nfc/NFCReadingEvent_constructor.https.html": [ - "da3e4c071d1e48a43be5ee27d775721d2af88e07", + "3c4242943d6c44540676c6e12acb83a51e2d11f0", "testharness" ], "web-nfc/NFCWriter_push.https-expected.txt": [ - "7a09ebcb62e4c26135dcf3f7006bf14e7b69c328", + "abf8d15019abb2708db843eaaf9829196f31c05d", "support" ], "web-nfc/NFCWriter_push.https.html": [ - "b1559b30fec513aaa5b8fa46f104c98388fcf166", + "f5bbfcd6194d02330ac25fddb09d89bfd0e54b57", "testharness" ], "web-nfc/NFCWriter_push_signal-manual.https-expected.txt": [ @@ -485395,6 +485415,10 @@ "a2b09fd1a16994494d3b0764cb694933efcb0249", "testharness" ], + "workers/semantics/interface-objects/002.worker-expected.txt": [ + "e0a8825f51698f884b9088cc0a1c381abb312308", + "support" + ], "workers/semantics/interface-objects/002.worker.js": [ "27be44396f57837bd2950f0c5e231e6e5f1b288a", "testharness" @@ -485407,6 +485431,10 @@ "1ed257ff880c5cfdd080537bd3290b1b4b8f088b", "testharness" ], + "workers/semantics/interface-objects/004-expected.txt": [ + "76ab3d8ea42c4e128de6e15ece83e156cb8175dd", + "support" + ], "workers/semantics/interface-objects/004.html": [ "0c3a3d824c93da03aa28ab54781e8bb78f43dabe", "testharness"
diff --git a/third_party/blink/web_tests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/actionsWithKeyPressed.html.ini b/third_party/blink/web_tests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/actionsWithKeyPressed.html.ini index 38f8431..c83e8ff 100644 --- a/third_party/blink/web_tests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/actionsWithKeyPressed.html.ini +++ b/third_party/blink/web_tests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/actionsWithKeyPressed.html.ini
@@ -2,8 +2,7 @@ expected: if product == "safari": ERROR - [TestDriver actions: actions with key pressed] expected: if product == "firefox": FAIL - + if os == "mac" and product == "chrome": FAIL
diff --git a/third_party/blink/web_tests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/elementPosition.html.ini b/third_party/blink/web_tests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/elementPosition.html.ini index 9ae71a6..49e4a40 100644 --- a/third_party/blink/web_tests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/elementPosition.html.ini +++ b/third_party/blink/web_tests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/elementPosition.html.ini
@@ -1,4 +1,7 @@ [elementPosition.html] + expected: + if os == "mac" and product == "chrome": TIMEOUT + [TestDriver actions: element position] expected: if product == "safari": FAIL
diff --git a/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_redirect_xserver_opt_in.html b/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_redirect_xserver_opt_in.html deleted file mode 100644 index 11dc5b7d..0000000 --- a/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_redirect_xserver_opt_in.html +++ /dev/null
@@ -1,57 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script src="/common/utils.js"></script> - <script> - - function verifyTimingEventOrder(eventOrder, timingEntry) { - for (var i = 0; i < eventOrder.length - 1; i++) { - assert_true(timingEntry[eventOrder[i]] < timingEntry[eventOrder[i + 1]], - "Expected " + eventOrder[i] + " to be no greater than " + eventOrder[i + 1] + "."); - } - } - - function onload_test() - { - var frame_performance = document.getElementById("frameContext").contentWindow.performance; - assert_equals(frame_performance.getEntriesByType("navigation")[0].type, - "navigate", - "Expected navigation type to be navigate."); - assert_equals(frame_performance.getEntriesByType("navigation")[0].redirectCount, 1, "Expected redirectCount to be 1."); - - var timgingEvents = [ - 'startTime', - 'redirectStart', - 'redirectEnd', - ]; - verifyTimingEventOrder(timgingEvents, frame_performance.getEntriesByType("navigation")[0]); - done(); - } - </script> - - </head> - <body> - <h1>Description</h1> - <p>This test validates the values of the window.performance.getEntriesByType("navigation")[0].redirectCount and the - window.performance.getEntriesByType("navigation")[0].redirectStart/End times for a cross-origin server side redirect navigation when the redirect chooses to opt-in.</p> - - <iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe> - <script> - // combine the page origin and redirect origin into the IFRAME's src URL - var destUrl = make_absolute_url({subdomain: "www", - path: "/common/redirect-opt-in.py", - query: "location=" + make_absolute_url( - {path: "/navigation-timing/resources/blank_page_green.html"}) - }); - var frameContext = document.getElementById("frameContext"); - frameContext.onload = onload_test; - frameContext.src = destUrl; - </script> - </body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_no_previous_document.html b/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_no_previous_document.html deleted file mode 100644 index 3e7b072..0000000 --- a/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_no_previous_document.html +++ /dev/null
@@ -1,36 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - - <script> - - function onload_test() - { - var frame = document.getElementById("frameContext"); - - assert_equals(frame.contentWindow.performance.getEntriesByType("navigation")[0].type, - "navigate", - "Expected navigation type to be navigate."); - - assert_equals(frame.contentWindow.performance.getEntriesByType("navigation")[0].unloadEventStart, 0, - "Expected unloadEventStart to be 0."); - assert_equals(frame.contentWindow.performance.getEntriesByType("navigation")[0].unloadEventEnd, 0, - "Expected unloadEventEnd to be 0."); - done(); - } - </script> - - </head> - <body> - <h1>Description</h1> - <p>This test validates the unload event times are 0 when there is no previous document.</p> - - <iframe id="frameContext" onload="onload_test();" src="resources/blank_page_green.html" style="width: 250px; height: 250px;"></iframe> - </body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_previous_document_cross_origin.sub.html b/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_previous_document_cross_origin.sub.html deleted file mode 100644 index fb7247d..0000000 --- a/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_previous_document_cross_origin.sub.html +++ /dev/null
@@ -1,45 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script src="/common/utils.js"></script> - <script> - - function onload_test() - { - var reload_frame = document.getElementById("frameContext"); - reload_frame.onload = do_test; - reload_frame.contentWindow.location.href = "resources/blank_page_green.html"; - } - - function do_test() - { - var newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0]; - assert_equals(newNavTiming.type, "navigate", "Expected navigation type to be navigate."); - assert_equals(newNavTiming.unloadEventStart, 0, "Expected unloadEventStart to be 0."); - assert_equals(newNavTiming.unloadEventEnd, 0, "Expected unloadEventEnd to be 0."); - done(); - } - </script> - </head> - <body> - <h1>Description</h1> - <p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a navigation on top of a cross-origin document.</p> - - <p>This page should be loaded with a green background frame below. The frame will be automatically reloaded - and then verified that - <ul> - <li>The window.performance.getEntriesByType("navigation").type = "navigate"</li> - <li>The window.performance.getEntriesByType("navigation").unloadEventStart = 0</li> - <li>The window.performance.getEntriesByType("navigation").unloadEventEnd = 0</li> - </ul> - </p> - - <iframe id="frameContext" onload="onload_test();" src="{{location[scheme]}}://{{domains[www2]}}:{{ports[http][0]}}/common/blank.html" style="width: 250px; height: 250px;"></iframe> - </body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirect_chain_partial_opt_in.html b/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirect_chain_partial_opt_in.html deleted file mode 100644 index 0b39786..0000000 --- a/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirect_chain_partial_opt_in.html +++ /dev/null
@@ -1,61 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script src="/common/utils.js"></script> - <script> - - let reload_frame; - - function onload_test() - { - reload_frame = document.getElementById("frameContext"); - reload_frame.onload = do_test; - setTimeout("reload_the_frame();", 100); - } - - function reload_the_frame() - { - const destUrl_first = make_absolute_url({subdomain: "www", - path: "/common/redirect-opt-in.py", - query: "location=" + make_absolute_url( - {path: "/navigation-timing/resources/blank_page_yellow.html"}) - }); - const destUrl = make_absolute_url({subdomain: "www", - path: "/common/redirect.py", - query: "location=" + destUrl_first - }); - reload_frame.contentWindow.location.href = destUrl; - } - - function do_test() - { - const newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0]; - assert_equals(newNavTiming.type, "navigate", "Expected navigation type to be navigate."); - assert_equals(newNavTiming.unloadEventStart, 0, "Expected unloadEventStart to be 0."); - assert_equals(newNavTiming.unloadEventEnd, 0, "Expected unloadEventEnd to be 0."); - done(); - } - </script> - </head> - <body> - <h1>Description</h1> - <p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a reloaded navigation.</p> - - <p>This page should be loaded with a green background frame below. The frame will be automatically reloaded - and then verified that - <ul> - <li>The window.performance.getEntriesByType("navigation").type = "navigate"</li> - <li>The window.performance.getEntriesByType("navigation").unloadEventStart == 0</li> - <li>The window.performance.getEntriesByType("navigation").unloadEventEnd == 0</li> - </ul> - </p> - - <iframe id="frameContext" onload="onload_test();" src="resources/blank_page_green.html" style="width: 250px; height: 250px;"></iframe> - </body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirect_opt_in.html b/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirect_opt_in.html deleted file mode 100644 index d3ff5508..0000000 --- a/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirect_opt_in.html +++ /dev/null
@@ -1,57 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script src="/common/utils.js"></script> - <script> - - let reload_frame; - - function onload_test() - { - reload_frame = document.getElementById("frameContext"); - reload_frame.onload = do_test; - setTimeout("reload_the_frame();", 100); - } - - function reload_the_frame() - { - const destUrl = make_absolute_url({subdomain: "www", - path: "/common/redirect-opt-in.py", - query: "location=" + make_absolute_url( - {path: "/navigation-timing/resources/blank_page_yellow.html"}) - }); - reload_frame.contentWindow.location.href = destUrl; - } - - function do_test() - { - const newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0]; - assert_equals(newNavTiming.type, "navigate", "Expected navigation type to be navigate."); - assert_not_equals(newNavTiming.unloadEventStart, 0, "Expected unloadEventStart to not be 0."); - assert_not_equals(newNavTiming.unloadEventEnd, 0, "Expected unloadEventEnd to not be 0."); - done(); - } - </script> - </head> - <body> - <h1>Description</h1> - <p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a reloaded navigation.</p> - - <p>This page should be loaded with a green background frame below. The frame will be automatically reloaded - and then verified that - <ul> - <li>The window.performance.getEntriesByType("navigation").type = "navigate"</li> - <li>The window.performance.getEntriesByType("navigation").unloadEventStart == 0</li> - <li>The window.performance.getEntriesByType("navigation").unloadEventEnd == 0</li> - </ul> - </p> - - <iframe id="frameContext" onload="onload_test();" src="resources/blank_page_green.html" style="width: 250px; height: 250px;"></iframe> - </body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirects.html b/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirects.html deleted file mode 100644 index 8a7f57d7..0000000 --- a/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirects.html +++ /dev/null
@@ -1,57 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script src="/common/utils.js"></script> - <script> - - var reload_frame; - - function onload_test() - { - reload_frame = document.getElementById("frameContext"); - reload_frame.onload = do_test; - setTimeout("reload_the_frame();", 100); - } - - function reload_the_frame() - { - var destUrl = make_absolute_url({subdomain: "www", - path: "/common/redirect.py", - query: "location=" + make_absolute_url( - {path: "/navigation-timing/resources/blank_page_yellow.html"}) - }); - reload_frame.contentWindow.location.href = destUrl; - } - - function do_test() - { - var newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0]; - assert_equals(newNavTiming.type, "navigate", "Expected navigation type to be navigate."); - assert_equals(newNavTiming.unloadEventStart, 0, "Expected unloadEventStart to be 0."); - assert_equals(newNavTiming.unloadEventEnd, 0, "Expected unloadEventEnd to be 0."); - done(); - } - </script> - </head> - <body> - <h1>Description</h1> - <p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a reloaded navigation.</p> - - <p>This page should be loaded with a green background frame below. The frame will be automatically reloaded - and then verified that - <ul> - <li>The window.performance.getEntriesByType("navigation").type = "navigate"</li> - <li>The window.performance.getEntriesByType("navigation").unloadEventStart == 0</li> - <li>The window.performance.getEntriesByType("navigation").unloadEventEnd == 0</li> - </ul> - </p> - - <iframe id="frameContext" onload="onload_test();" src="resources/blank_page_green.html" style="width: 250px; height: 250px;"></iframe> - </body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_with_previous_document.html b/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_with_previous_document.html deleted file mode 100644 index 90f336d1..0000000 --- a/third_party/blink/web_tests/external/wpt/navigation-timing/nav2_test_unloadEvents_with_previous_document.html +++ /dev/null
@@ -1,42 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <title>Navigation Timing 2 WPT</title> - <link rel="author" title="Google" href="http://www.google.com/" /> - <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script> - - function onload_test() - { - var reload_frame = document.getElementById("frameContext"); - reload_frame.onload = do_test; - reload_frame.contentWindow.location.reload(true); - } - - function do_test() - { - var newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0]; - assert_true(newNavTiming.unloadEventStart > 0, "Expected unloadEventStart to be greater than 0."); - assert_true(newNavTiming.unloadEventEnd > 0, "Expected unloadEventEnd to be greater than 0."); - done(); - } - </script> - </head> - <body> - <h1>Description</h1> - <p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a reloaded navigation.</p> - - <p>This page should be loaded with a green background frame below. The frame will be automatically reloaded - and then verified that - <ul> - <li>The window.performance.getEntriesByType("navigation").unloadEventStart > 0 after reload</li> - <li>The window.performance.getEntriesByType("navigation").unloadEventEnd > 0 after reload</li> - </ul> - </p> - - <iframe id="frameContext" onload="onload_test();" src="resources/blank_page_green.html" style="width: 250px; height: 250px;"></iframe> - </body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/navigation-timing/unload-event-same-origin-check.html b/third_party/blink/web_tests/external/wpt/navigation-timing/unload-event-same-origin-check.html new file mode 100644 index 0000000..319d04462 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/navigation-timing/unload-event-same-origin-check.html
@@ -0,0 +1,125 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8" /> + <title>Navigation Timing 2 WPT</title> + <link rel="author" title="Google" href="http://www.google.com/" /> + <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/common/get-host-info.sub.js"></script> + </head> + <body> + <script> + + const start_page = "/navigation-timing/resources/blank_page_green.html"; + const end_page = "/navigation-timing/resources/blank_page_yellow.html"; + const host_info = get_host_info(); + const redirect_chain_partial_tao = () => { + let url = host_info["HTTP_REMOTE_ORIGIN"]; + url += "/common/redirect.py"; + url += "?location="; + url += host_info["HTTP_REMOTE_ORIGIN"]; + url += "/common/redirect-opt-in.py"; + url += "?location="; + url += host_info["ORIGIN"]; + url += end_page; + return url; + }; + const redirect_chain_full_tao = () => { + let url = host_info["HTTP_REMOTE_ORIGIN"]; + url += "/common/redirect-opt-in.py"; + url += "?location="; + url += host_info["ORIGIN"]; + url += end_page; + return url; + }; + const redirect_chain_no_tao = () => { + let url = host_info["HTTP_REMOTE_ORIGIN"]; + url += "/common/redirect.py"; + url += "?location="; + url += host_info["ORIGIN"]; + url += end_page; + return url; + }; + const same_origin_redirect_chain = () => { + let url = host_info["ORIGIN"]; + url += "/common/redirect.py"; + url += "?location="; + url += host_info["ORIGIN"]; + url += end_page; + return url; + }; + const cross_origin_start = host_info["HTTP_REMOTE_ORIGIN"] + start_page; + const test_cases = [ + { start_url : start_page, end_url: redirect_chain_partial_tao(), unload_exposed: false, redirects: 0, name: "Redirect chain with a partial TAO opt-in" }, + { start_url : start_page, end_url: redirect_chain_full_tao(), unload_exposed: false, redirects: 0, name: "Redirect chain with full TAO opt-in" }, + { start_url : start_page, end_url: redirect_chain_no_tao(), unload_exposed: false, redirects: 0, name: "Same-cross-same redirect chain with no TAO opt-in" }, + { start_url : cross_origin_start, end_url: redirect_chain_no_tao(), unload_exposed: false, redirects: 0, name: "cross-cross-same Redirect chain with no TAO opt-in" }, + { start_url : cross_origin_start, end_url: end_page, unload_exposed: false, redirects: 0, name: "Previous document cross origin" }, + { start_url : start_page, end_url: end_page, unload_exposed: true, redirects: 0, name: "Previous document same origin" }, + { start_url : start_page, end_url: null, unload_exposed: false, redirects: 0, name: "No previous document" }, + { start_url : start_page, end_url: same_origin_redirect_chain(), unload_exposed: true, redirects: 1, name: "Same origin previous document with same origin redirect" }, + { start_url : same_origin_redirect_chain(), end_url: null, unload_exposed: false, redirects: 1, name: "No previous document with same origin redirect" }, + { start_url : redirect_chain_no_tao(), end_url: null, unload_exposed: false, redirects: 0, name: "No previous document with cross origin redirect" }, + { start_url : redirect_chain_full_tao(), end_url: null, unload_exposed: false, redirects: 0, name: "No previous document with cross origin redirect with partial TAO" }, + { start_url : redirect_chain_partial_tao(), end_url: null, unload_exposed: false, redirects: 0, name: "No previous document with cross origin redirect with TAO" }, + ]; + + const frame_id = "frameContext"; + const create_frame = (start_url, end_url) => { + return new Promise(resolve => { + let frame = document.getElementById("frameContext"); + if (frame) { + document.body.removeChild(frame); + } + frame = document.createElement("iframe"); + frame.onload = () => { + if (end_url) { + frame.onload = resolve; + step_timeout(() => {frame.contentWindow.location.href = end_url;}, 10); + } else { + resolve(); + } + }; + frame.id = "frameContext"; + frame.src = start_url; + document.body.appendChild(frame); + }); + }; + + const run_test = (unload_exposed, redirects) => { + const entry = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0]; + assert_equals(entry.type, "navigate", "Expected navigation type to be navigate."); + if (!unload_exposed) { + assert_equals(entry.unloadEventStart, 0, "Expected unloadEventStart to be 0."); + assert_equals(entry.unloadEventEnd, 0, "Expected unloadEventEnd to be 0."); + } else { + assert_greater_than(entry.unloadEventStart, 0, "Expected unloadEventStart to not be 0."); + assert_greater_than(entry.unloadEventEnd, 0, "Expected unloadEventEnd to not be 0."); + } + assert_equals(entry.redirectCount, redirects, "Expected redirectCount to be " + redirects); + }; + + const create_test = async test_case => { + return new Promise(async (resolve, reject) => { + await create_frame(test_case.start_url, test_case.end_url); + try { + run_test(test_case.unload_exposed, test_case.redirects); + resolve(); + } catch (e) { + reject(e); + } + }); + }; + + for (const test_case of test_cases) { + promise_test(() => { return create_test(test_case)}, test_case.name); + } + + + </script> + <h1>Description</h1> + <p>This test validates that the values of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) are only exposed when the same-origin test passes.</p> + </body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/global-serviceworker.https.any.js b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/global-serviceworker.https.any.js new file mode 100644 index 0000000..489b37f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/global-serviceworker.https.any.js
@@ -0,0 +1,53 @@ +// META: title=serviceWorker on service worker global +// META: global=!default,serviceworker + +test(() => { + assert_equals(registration.installing, null, 'registration.installing'); + assert_equals(registration.waiting, null, 'registration.waiting'); + assert_equals(registration.active, null, 'registration.active'); + assert_true('serviceWorker' in self, 'self.serviceWorker exists'); + assert_equals(serviceWorker.state, 'parsed', 'serviceWorker.state'); + assert_readonly(self, 'serviceWorker', `self.serviceWorker is read only`); +}, 'First run'); + +// Cache this for later tests. +const initialServiceWorker = self.serviceWorker; + +async_test((t) => { + assert_true('serviceWorker' in self, 'self.serviceWorker exists'); + serviceWorker.postMessage({ messageTest: true }); + + // The rest of the rest runs once we receive the above message. + addEventListener('message', t.step_func((event) => { + // Ignore unrelated messages. + if (!event.data.messageTest) return; + assert_equals(event.source, serviceWorker, 'event.source'); + t.done(); + })); +}, 'Can post message to self during startup'); + +// The test is registered now so there isn't a race condition when collecting tests, but the asserts +// don't happen until the 'install' event fires. +async_test((t) => { + addEventListener('install', t.step_func_done(() => { + assert_true('serviceWorker' in self, 'self.serviceWorker exists'); + assert_equals(serviceWorker, initialServiceWorker, `self.serviceWorker hasn't changed`); + assert_equals(registration.installing, serviceWorker, 'registration.installing'); + assert_equals(registration.waiting, null, 'registration.waiting'); + assert_equals(registration.active, null, 'registration.active'); + assert_equals(serviceWorker.state, 'installing', 'serviceWorker.state'); + })); +}, 'During install'); + +// The test is registered now so there isn't a race condition when collecting tests, but the asserts +// don't happen until the 'activate' event fires. +async_test((t) => { + addEventListener('activate', t.step_func_done(() => { + assert_true('serviceWorker' in self, 'self.serviceWorker exists'); + assert_equals(serviceWorker, initialServiceWorker, `self.serviceWorker hasn't changed`); + assert_equals(registration.installing, null, 'registration.installing'); + assert_equals(registration.waiting, null, 'registration.waiting'); + assert_equals(registration.active, serviceWorker, 'registration.active'); + assert_equals(serviceWorker.state, 'activating', 'serviceWorker.state'); + })); +}, 'During activate');
diff --git a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/global-serviceworker.https.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/global-serviceworker.https.any.serviceworker-expected.txt new file mode 100644 index 0000000..b4d3503 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/global-serviceworker.https.any.serviceworker-expected.txt
@@ -0,0 +1,7 @@ +This is a testharness.js-based test. +FAIL First run assert_true: self.serviceWorker exists expected true got false +FAIL Can post message to self during startup assert_true: self.serviceWorker exists expected true got false +FAIL During install assert_true: self.serviceWorker exists expected true got false +FAIL During activate assert_true: self.serviceWorker exists expected true got false +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/brand-checks.any-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/brand-checks.any-expected.txt index 6a71eee..13d86ff9 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/brand-checks.any-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/brand-checks.any-expected.txt
@@ -1,6 +1,6 @@ This is a testharness.js-based test. -FAIL Can get the ReadableStreamBYOBReader constructor indirectly bytes type is not yet implemented -FAIL Can get the ReadableByteStreamController constructor indirectly bytes type is not yet implemented +FAIL Can get the ReadableStreamBYOBReader constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL Can get the ReadableByteStreamController constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented PASS ReadableStreamBYOBReader enforces a brand check on its argument FAIL ReadableStreamBYOBReader.prototype.closed enforces a brand check Cannot read property 'prototype' of undefined FAIL ReadableStreamBYOBReader.prototype.cancel enforces a brand check Cannot read property 'prototype' of undefined @@ -12,6 +12,6 @@ FAIL ReadableByteStreamController.prototype.close enforces a brand check Cannot read property 'prototype' of undefined FAIL ReadableByteStreamController.prototype.enqueue enforces a brand check Cannot read property 'prototype' of undefined FAIL ReadableByteStreamController.prototype.error enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBRequest enforces brand checks bytes type is not yet implemented +FAIL ReadableStreamBYOBRequest enforces brand checks Failed to construct 'ReadableStream': bytes type is not yet implemented Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/brand-checks.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/brand-checks.any.serviceworker-expected.txt index 6a71eee..13d86ff9 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/brand-checks.any.serviceworker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/brand-checks.any.serviceworker-expected.txt
@@ -1,6 +1,6 @@ This is a testharness.js-based test. -FAIL Can get the ReadableStreamBYOBReader constructor indirectly bytes type is not yet implemented -FAIL Can get the ReadableByteStreamController constructor indirectly bytes type is not yet implemented +FAIL Can get the ReadableStreamBYOBReader constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL Can get the ReadableByteStreamController constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented PASS ReadableStreamBYOBReader enforces a brand check on its argument FAIL ReadableStreamBYOBReader.prototype.closed enforces a brand check Cannot read property 'prototype' of undefined FAIL ReadableStreamBYOBReader.prototype.cancel enforces a brand check Cannot read property 'prototype' of undefined @@ -12,6 +12,6 @@ FAIL ReadableByteStreamController.prototype.close enforces a brand check Cannot read property 'prototype' of undefined FAIL ReadableByteStreamController.prototype.enqueue enforces a brand check Cannot read property 'prototype' of undefined FAIL ReadableByteStreamController.prototype.error enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBRequest enforces brand checks bytes type is not yet implemented +FAIL ReadableStreamBYOBRequest enforces brand checks Failed to construct 'ReadableStream': bytes type is not yet implemented Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/brand-checks.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/brand-checks.any.sharedworker-expected.txt index 6a71eee..13d86ff9 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/brand-checks.any.sharedworker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/brand-checks.any.sharedworker-expected.txt
@@ -1,6 +1,6 @@ This is a testharness.js-based test. -FAIL Can get the ReadableStreamBYOBReader constructor indirectly bytes type is not yet implemented -FAIL Can get the ReadableByteStreamController constructor indirectly bytes type is not yet implemented +FAIL Can get the ReadableStreamBYOBReader constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL Can get the ReadableByteStreamController constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented PASS ReadableStreamBYOBReader enforces a brand check on its argument FAIL ReadableStreamBYOBReader.prototype.closed enforces a brand check Cannot read property 'prototype' of undefined FAIL ReadableStreamBYOBReader.prototype.cancel enforces a brand check Cannot read property 'prototype' of undefined @@ -12,6 +12,6 @@ FAIL ReadableByteStreamController.prototype.close enforces a brand check Cannot read property 'prototype' of undefined FAIL ReadableByteStreamController.prototype.enqueue enforces a brand check Cannot read property 'prototype' of undefined FAIL ReadableByteStreamController.prototype.error enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBRequest enforces brand checks bytes type is not yet implemented +FAIL ReadableStreamBYOBRequest enforces brand checks Failed to construct 'ReadableStream': bytes type is not yet implemented Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/brand-checks.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/brand-checks.any.worker-expected.txt index 6a71eee..13d86ff9 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/brand-checks.any.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/brand-checks.any.worker-expected.txt
@@ -1,6 +1,6 @@ This is a testharness.js-based test. -FAIL Can get the ReadableStreamBYOBReader constructor indirectly bytes type is not yet implemented -FAIL Can get the ReadableByteStreamController constructor indirectly bytes type is not yet implemented +FAIL Can get the ReadableStreamBYOBReader constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL Can get the ReadableByteStreamController constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented PASS ReadableStreamBYOBReader enforces a brand check on its argument FAIL ReadableStreamBYOBReader.prototype.closed enforces a brand check Cannot read property 'prototype' of undefined FAIL ReadableStreamBYOBReader.prototype.cancel enforces a brand check Cannot read property 'prototype' of undefined @@ -12,6 +12,6 @@ FAIL ReadableByteStreamController.prototype.close enforces a brand check Cannot read property 'prototype' of undefined FAIL ReadableByteStreamController.prototype.enqueue enforces a brand check Cannot read property 'prototype' of undefined FAIL ReadableByteStreamController.prototype.error enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBRequest enforces brand checks bytes type is not yet implemented +FAIL ReadableStreamBYOBRequest enforces brand checks Failed to construct 'ReadableStream': bytes type is not yet implemented Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/construct-byob-request.any-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/construct-byob-request.any-expected.txt index c640a4fbd..8ec519e1 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/construct-byob-request.any-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/construct-byob-request.any-expected.txt
@@ -1,4 +1,4 @@ This is a testharness.js-based test. -FAIL construct-byob-request Uncaught RangeError: bytes type is not yet implemented +FAIL construct-byob-request Uncaught RangeError: Failed to construct 'ReadableStream': bytes type is not yet implemented Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/construct-byob-request.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/construct-byob-request.any.sharedworker-expected.txt index c640a4fbd..8ec519e1 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/construct-byob-request.any.sharedworker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/construct-byob-request.any.sharedworker-expected.txt
@@ -1,4 +1,4 @@ This is a testharness.js-based test. -FAIL construct-byob-request Uncaught RangeError: bytes type is not yet implemented +FAIL construct-byob-request Uncaught RangeError: Failed to construct 'ReadableStream': bytes type is not yet implemented Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/construct-byob-request.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/construct-byob-request.any.worker-expected.txt index c640a4fbd..8ec519e1 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/construct-byob-request.any.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/construct-byob-request.any.worker-expected.txt
@@ -1,4 +1,4 @@ This is a testharness.js-based test. -FAIL construct-byob-request Uncaught RangeError: bytes type is not yet implemented +FAIL construct-byob-request Uncaught RangeError: Failed to construct 'ReadableStream': bytes type is not yet implemented Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/detached-buffers.any-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/detached-buffers.any-expected.txt index 6a3e32b4..76867b4 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/detached-buffers.any-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/detached-buffers.any-expected.txt
@@ -1,11 +1,11 @@ This is a testharness.js-based test. -FAIL ReadableStream with byte source: read()ing from a closed stream still transfers the buffer bytes type is not yet implemented -FAIL ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueuing an already-detached buffer throws bytes type is not yet implemented -FAIL ReadableStream with byte source: reading into an already-detached buffer rejects bytes type is not yet implemented -FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state) bytes type is not yet implemented -FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the closed state) bytes type is not yet implemented -FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the readable state) bytes type is not yet implemented -FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state) bytes type is not yet implemented +FAIL ReadableStream with byte source: read()ing from a closed stream still transfers the buffer Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueuing an already-detached buffer throws Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: reading into an already-detached buffer rejects Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the closed state) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the readable state) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state) Failed to construct 'ReadableStream': bytes type is not yet implemented Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/detached-buffers.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/detached-buffers.any.serviceworker-expected.txt index 6a3e32b4..76867b4 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/detached-buffers.any.serviceworker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/detached-buffers.any.serviceworker-expected.txt
@@ -1,11 +1,11 @@ This is a testharness.js-based test. -FAIL ReadableStream with byte source: read()ing from a closed stream still transfers the buffer bytes type is not yet implemented -FAIL ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueuing an already-detached buffer throws bytes type is not yet implemented -FAIL ReadableStream with byte source: reading into an already-detached buffer rejects bytes type is not yet implemented -FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state) bytes type is not yet implemented -FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the closed state) bytes type is not yet implemented -FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the readable state) bytes type is not yet implemented -FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state) bytes type is not yet implemented +FAIL ReadableStream with byte source: read()ing from a closed stream still transfers the buffer Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueuing an already-detached buffer throws Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: reading into an already-detached buffer rejects Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the closed state) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the readable state) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state) Failed to construct 'ReadableStream': bytes type is not yet implemented Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/detached-buffers.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/detached-buffers.any.sharedworker-expected.txt index 6a3e32b4..76867b4 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/detached-buffers.any.sharedworker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/detached-buffers.any.sharedworker-expected.txt
@@ -1,11 +1,11 @@ This is a testharness.js-based test. -FAIL ReadableStream with byte source: read()ing from a closed stream still transfers the buffer bytes type is not yet implemented -FAIL ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueuing an already-detached buffer throws bytes type is not yet implemented -FAIL ReadableStream with byte source: reading into an already-detached buffer rejects bytes type is not yet implemented -FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state) bytes type is not yet implemented -FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the closed state) bytes type is not yet implemented -FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the readable state) bytes type is not yet implemented -FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state) bytes type is not yet implemented +FAIL ReadableStream with byte source: read()ing from a closed stream still transfers the buffer Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueuing an already-detached buffer throws Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: reading into an already-detached buffer rejects Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the closed state) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the readable state) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state) Failed to construct 'ReadableStream': bytes type is not yet implemented Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/detached-buffers.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/detached-buffers.any.worker-expected.txt index 6a3e32b4..76867b4 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/detached-buffers.any.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/detached-buffers.any.worker-expected.txt
@@ -1,11 +1,11 @@ This is a testharness.js-based test. -FAIL ReadableStream with byte source: read()ing from a closed stream still transfers the buffer bytes type is not yet implemented -FAIL ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueuing an already-detached buffer throws bytes type is not yet implemented -FAIL ReadableStream with byte source: reading into an already-detached buffer rejects bytes type is not yet implemented -FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state) bytes type is not yet implemented -FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the closed state) bytes type is not yet implemented -FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the readable state) bytes type is not yet implemented -FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state) bytes type is not yet implemented +FAIL ReadableStream with byte source: read()ing from a closed stream still transfers the buffer Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueuing an already-detached buffer throws Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: reading into an already-detached buffer rejects Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the closed state) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the readable state) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state) Failed to construct 'ReadableStream': bytes type is not yet implemented Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/general.any-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/general.any-expected.txt index 3644dc00..1ccd08a 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/general.any-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/general.any-expected.txt
@@ -1,84 +1,84 @@ This is a testharness.js-based test. Found 77 tests; 2 PASS, 75 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS getReader({mode: "byob"}) throws on non-bytes streams -FAIL ReadableStream with byte source can be constructed with no errors bytes type is not yet implemented -FAIL getReader({mode}) must perform ToString() bytes type is not yet implemented -FAIL ReadableStream with byte source: Construct and expect start and pull being called bytes type is not yet implemented -FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish bytes type is not yet implemented -FAIL ReadableStream with byte source: Construct with highWaterMark of 0 bytes type is not yet implemented -FAIL ReadableStream with byte source: desiredSize when closed bytes type is not yet implemented -FAIL ReadableStream with byte source: desiredSize when errored bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), then releaseLock() bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically bytes type is not yet implemented -FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() and read() bytes type is not yet implemented -FAIL ReadableStream with byte source: autoAllocateChunkSize bytes type is not yet implemented -FAIL ReadableStream with byte source: Mix of auto allocate and BYOB bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: Push source that doesn't understand pull signal bytes type is not yet implemented +FAIL ReadableStream with byte source can be constructed with no errors Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL getReader({mode}) must perform ToString() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct and expect start and pull being called Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct with highWaterMark of 0 Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when closed Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when errored Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), then releaseLock() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: autoAllocateChunkSize Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Mix of auto allocate and BYOB Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Push source that doesn't understand pull signal Failed to construct 'ReadableStream': bytes type is not yet implemented FAIL ReadableStream with byte source: pull() function is not callable assert_throws: constructor should throw function "() => new ReadableStream({ pull: 'foo', type: 'bytes' - })" threw object "RangeError: bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") -FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to pull() by enqueue() bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to multiple pull() by separate enqueue() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() with too big value bytes type is not yet implemented -FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), read(view), then cancel() bytes type is not yet implemented -FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array bytes type is not yet implemented -FAIL ReadableStream with byte source: Throw if close()-ed more than once bytes type is not yet implemented -FAIL ReadableStream with byte source: Throw on enqueue() after close() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls bytes type is not yet implemented -FAIL ReadableStream with byte source: read() twice, then enqueue() twice bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view), close() and respond() bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view), big enqueue() bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with zero-length view must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: read() on an errored stream bytes type is not yet implemented -FAIL ReadableStream with byte source: read(), then error() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) on an errored stream bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then error() bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull function must error the stream bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it bytes type is not yet implemented -FAIL calling respond() twice on the same byobRequest should throw bytes type is not yet implemented -FAIL calling respondWithNewView() twice on the same byobRequest should throw bytes type is not yet implemented -FAIL calling respond(0) twice on the same byobRequest should throw even when closed bytes type is not yet implemented -FAIL pull() resolving should not make releaseLock() possible bytes type is not yet implemented -FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction bytes type is not yet implemented -FAIL ReadableStreamBYOBReader can be constructed directly bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" bytes type is not yet implemented + })" threw object "RangeError: Failed to construct 'ReadableStream': bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") +FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to multiple pull() by separate enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with too big value Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), read(view), then cancel() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw if close()-ed more than once Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw on enqueue() after close() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read() twice, then enqueue() twice Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), close() and respond() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), big enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with zero-length view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read() on an errored stream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(), then error() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) on an errored stream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then error() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull function must error the stream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL calling respond() twice on the same byobRequest should throw Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL calling respondWithNewView() twice on the same byobRequest should throw Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL calling respond(0) twice on the same byobRequest should throw even when closed Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL pull() resolving should not make releaseLock() possible Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBReader can be constructed directly Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" Failed to construct 'ReadableStream': bytes type is not yet implemented PASS ReadableStream constructor should not accept a strategy with a size defined if type is "bytes" Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/general.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/general.any.serviceworker-expected.txt index 3644dc00..1ccd08a 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/general.any.serviceworker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/general.any.serviceworker-expected.txt
@@ -1,84 +1,84 @@ This is a testharness.js-based test. Found 77 tests; 2 PASS, 75 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS getReader({mode: "byob"}) throws on non-bytes streams -FAIL ReadableStream with byte source can be constructed with no errors bytes type is not yet implemented -FAIL getReader({mode}) must perform ToString() bytes type is not yet implemented -FAIL ReadableStream with byte source: Construct and expect start and pull being called bytes type is not yet implemented -FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish bytes type is not yet implemented -FAIL ReadableStream with byte source: Construct with highWaterMark of 0 bytes type is not yet implemented -FAIL ReadableStream with byte source: desiredSize when closed bytes type is not yet implemented -FAIL ReadableStream with byte source: desiredSize when errored bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), then releaseLock() bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically bytes type is not yet implemented -FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() and read() bytes type is not yet implemented -FAIL ReadableStream with byte source: autoAllocateChunkSize bytes type is not yet implemented -FAIL ReadableStream with byte source: Mix of auto allocate and BYOB bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: Push source that doesn't understand pull signal bytes type is not yet implemented +FAIL ReadableStream with byte source can be constructed with no errors Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL getReader({mode}) must perform ToString() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct and expect start and pull being called Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct with highWaterMark of 0 Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when closed Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when errored Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), then releaseLock() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: autoAllocateChunkSize Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Mix of auto allocate and BYOB Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Push source that doesn't understand pull signal Failed to construct 'ReadableStream': bytes type is not yet implemented FAIL ReadableStream with byte source: pull() function is not callable assert_throws: constructor should throw function "() => new ReadableStream({ pull: 'foo', type: 'bytes' - })" threw object "RangeError: bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") -FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to pull() by enqueue() bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to multiple pull() by separate enqueue() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() with too big value bytes type is not yet implemented -FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), read(view), then cancel() bytes type is not yet implemented -FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array bytes type is not yet implemented -FAIL ReadableStream with byte source: Throw if close()-ed more than once bytes type is not yet implemented -FAIL ReadableStream with byte source: Throw on enqueue() after close() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls bytes type is not yet implemented -FAIL ReadableStream with byte source: read() twice, then enqueue() twice bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view), close() and respond() bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view), big enqueue() bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with zero-length view must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: read() on an errored stream bytes type is not yet implemented -FAIL ReadableStream with byte source: read(), then error() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) on an errored stream bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then error() bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull function must error the stream bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it bytes type is not yet implemented -FAIL calling respond() twice on the same byobRequest should throw bytes type is not yet implemented -FAIL calling respondWithNewView() twice on the same byobRequest should throw bytes type is not yet implemented -FAIL calling respond(0) twice on the same byobRequest should throw even when closed bytes type is not yet implemented -FAIL pull() resolving should not make releaseLock() possible bytes type is not yet implemented -FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction bytes type is not yet implemented -FAIL ReadableStreamBYOBReader can be constructed directly bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" bytes type is not yet implemented + })" threw object "RangeError: Failed to construct 'ReadableStream': bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") +FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to multiple pull() by separate enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with too big value Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), read(view), then cancel() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw if close()-ed more than once Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw on enqueue() after close() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read() twice, then enqueue() twice Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), close() and respond() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), big enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with zero-length view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read() on an errored stream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(), then error() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) on an errored stream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then error() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull function must error the stream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL calling respond() twice on the same byobRequest should throw Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL calling respondWithNewView() twice on the same byobRequest should throw Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL calling respond(0) twice on the same byobRequest should throw even when closed Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL pull() resolving should not make releaseLock() possible Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBReader can be constructed directly Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" Failed to construct 'ReadableStream': bytes type is not yet implemented PASS ReadableStream constructor should not accept a strategy with a size defined if type is "bytes" Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/general.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/general.any.sharedworker-expected.txt index 3644dc00..1ccd08a 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/general.any.sharedworker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/general.any.sharedworker-expected.txt
@@ -1,84 +1,84 @@ This is a testharness.js-based test. Found 77 tests; 2 PASS, 75 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS getReader({mode: "byob"}) throws on non-bytes streams -FAIL ReadableStream with byte source can be constructed with no errors bytes type is not yet implemented -FAIL getReader({mode}) must perform ToString() bytes type is not yet implemented -FAIL ReadableStream with byte source: Construct and expect start and pull being called bytes type is not yet implemented -FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish bytes type is not yet implemented -FAIL ReadableStream with byte source: Construct with highWaterMark of 0 bytes type is not yet implemented -FAIL ReadableStream with byte source: desiredSize when closed bytes type is not yet implemented -FAIL ReadableStream with byte source: desiredSize when errored bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), then releaseLock() bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically bytes type is not yet implemented -FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() and read() bytes type is not yet implemented -FAIL ReadableStream with byte source: autoAllocateChunkSize bytes type is not yet implemented -FAIL ReadableStream with byte source: Mix of auto allocate and BYOB bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: Push source that doesn't understand pull signal bytes type is not yet implemented +FAIL ReadableStream with byte source can be constructed with no errors Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL getReader({mode}) must perform ToString() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct and expect start and pull being called Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct with highWaterMark of 0 Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when closed Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when errored Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), then releaseLock() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: autoAllocateChunkSize Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Mix of auto allocate and BYOB Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Push source that doesn't understand pull signal Failed to construct 'ReadableStream': bytes type is not yet implemented FAIL ReadableStream with byte source: pull() function is not callable assert_throws: constructor should throw function "() => new ReadableStream({ pull: 'foo', type: 'bytes' - })" threw object "RangeError: bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") -FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to pull() by enqueue() bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to multiple pull() by separate enqueue() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() with too big value bytes type is not yet implemented -FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), read(view), then cancel() bytes type is not yet implemented -FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array bytes type is not yet implemented -FAIL ReadableStream with byte source: Throw if close()-ed more than once bytes type is not yet implemented -FAIL ReadableStream with byte source: Throw on enqueue() after close() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls bytes type is not yet implemented -FAIL ReadableStream with byte source: read() twice, then enqueue() twice bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view), close() and respond() bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view), big enqueue() bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with zero-length view must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: read() on an errored stream bytes type is not yet implemented -FAIL ReadableStream with byte source: read(), then error() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) on an errored stream bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then error() bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull function must error the stream bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it bytes type is not yet implemented -FAIL calling respond() twice on the same byobRequest should throw bytes type is not yet implemented -FAIL calling respondWithNewView() twice on the same byobRequest should throw bytes type is not yet implemented -FAIL calling respond(0) twice on the same byobRequest should throw even when closed bytes type is not yet implemented -FAIL pull() resolving should not make releaseLock() possible bytes type is not yet implemented -FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction bytes type is not yet implemented -FAIL ReadableStreamBYOBReader can be constructed directly bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" bytes type is not yet implemented + })" threw object "RangeError: Failed to construct 'ReadableStream': bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") +FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to multiple pull() by separate enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with too big value Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), read(view), then cancel() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw if close()-ed more than once Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw on enqueue() after close() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read() twice, then enqueue() twice Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), close() and respond() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), big enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with zero-length view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read() on an errored stream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(), then error() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) on an errored stream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then error() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull function must error the stream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL calling respond() twice on the same byobRequest should throw Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL calling respondWithNewView() twice on the same byobRequest should throw Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL calling respond(0) twice on the same byobRequest should throw even when closed Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL pull() resolving should not make releaseLock() possible Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBReader can be constructed directly Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" Failed to construct 'ReadableStream': bytes type is not yet implemented PASS ReadableStream constructor should not accept a strategy with a size defined if type is "bytes" Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/general.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/general.any.worker-expected.txt index 3644dc00..1ccd08a 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/general.any.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/general.any.worker-expected.txt
@@ -1,84 +1,84 @@ This is a testharness.js-based test. Found 77 tests; 2 PASS, 75 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS getReader({mode: "byob"}) throws on non-bytes streams -FAIL ReadableStream with byte source can be constructed with no errors bytes type is not yet implemented -FAIL getReader({mode}) must perform ToString() bytes type is not yet implemented -FAIL ReadableStream with byte source: Construct and expect start and pull being called bytes type is not yet implemented -FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish bytes type is not yet implemented -FAIL ReadableStream with byte source: Construct with highWaterMark of 0 bytes type is not yet implemented -FAIL ReadableStream with byte source: desiredSize when closed bytes type is not yet implemented -FAIL ReadableStream with byte source: desiredSize when errored bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), then releaseLock() bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically bytes type is not yet implemented -FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() and read() bytes type is not yet implemented -FAIL ReadableStream with byte source: autoAllocateChunkSize bytes type is not yet implemented -FAIL ReadableStream with byte source: Mix of auto allocate and BYOB bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: Push source that doesn't understand pull signal bytes type is not yet implemented +FAIL ReadableStream with byte source can be constructed with no errors Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL getReader({mode}) must perform ToString() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct and expect start and pull being called Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Construct with highWaterMark of 0 Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when closed Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: desiredSize when errored Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), then releaseLock() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: autoAllocateChunkSize Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Mix of auto allocate and BYOB Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Push source that doesn't understand pull signal Failed to construct 'ReadableStream': bytes type is not yet implemented FAIL ReadableStream with byte source: pull() function is not callable assert_throws: constructor should throw function "() => new ReadableStream({ pull: 'foo', type: 'bytes' - })" threw object "RangeError: bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") -FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to pull() by enqueue() bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to multiple pull() by separate enqueue() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() with too big value bytes type is not yet implemented -FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), read(view), then cancel() bytes type is not yet implemented -FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array bytes type is not yet implemented -FAIL ReadableStream with byte source: Throw if close()-ed more than once bytes type is not yet implemented -FAIL ReadableStream with byte source: Throw on enqueue() after close() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls bytes type is not yet implemented -FAIL ReadableStream with byte source: read() twice, then enqueue() twice bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view), close() and respond() bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view), big enqueue() bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with zero-length view must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail bytes type is not yet implemented -FAIL ReadableStream with byte source: read() on an errored stream bytes type is not yet implemented -FAIL ReadableStream with byte source: read(), then error() bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) on an errored stream bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then error() bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull function must error the stream bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it bytes type is not yet implemented -FAIL calling respond() twice on the same byobRequest should throw bytes type is not yet implemented -FAIL calling respondWithNewView() twice on the same byobRequest should throw bytes type is not yet implemented -FAIL calling respond(0) twice on the same byobRequest should throw even when closed bytes type is not yet implemented -FAIL pull() resolving should not make releaseLock() possible bytes type is not yet implemented -FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction bytes type is not yet implemented -FAIL ReadableStreamBYOBReader can be constructed directly bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" bytes type is not yet implemented + })" threw object "RangeError: Failed to construct 'ReadableStream': bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") +FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Respond to multiple pull() by separate enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() with too big value Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: getReader(), read(view), then cancel() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw if close()-ed more than once Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throw on enqueue() after close() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read() twice, then enqueue() twice Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), close() and respond() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view), big enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with zero-length view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read() on an errored stream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(), then error() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view) on an errored stream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: read(view), then error() Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull function must error the stream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL calling respond() twice on the same byobRequest should throw Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL calling respondWithNewView() twice on the same byobRequest should throw Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL calling respond(0) twice on the same byobRequest should throw even when closed Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL pull() resolving should not make releaseLock() possible Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBReader can be constructed directly Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" Failed to construct 'ReadableStream': bytes type is not yet implemented PASS ReadableStream constructor should not accept a strategy with a size defined if type is "bytes" Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/properties.any-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/properties.any-expected.txt index 83c737b..46b3754 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/properties.any-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/properties.any-expected.txt
@@ -1,8 +1,8 @@ This is a testharness.js-based test. -FAIL Can get the ReadableStreamBYOBReader constructor indirectly bytes type is not yet implemented +FAIL Can get the ReadableStreamBYOBReader constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented PASS ReadableStreamBYOBReader constructor should get a ReadableStream object as argument -FAIL ReadableStreamBYOBReader instances should have the correct list of properties bytes type is not yet implemented -FAIL ReadableStreamBYOBRequest instances should have the correct list of properties bytes type is not yet implemented -FAIL ReadableByteStreamController instances should have the correct list of properties bytes type is not yet implemented +FAIL ReadableStreamBYOBReader instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBRequest instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableByteStreamController instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/properties.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/properties.any.serviceworker-expected.txt index 83c737b..46b3754 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/properties.any.serviceworker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/properties.any.serviceworker-expected.txt
@@ -1,8 +1,8 @@ This is a testharness.js-based test. -FAIL Can get the ReadableStreamBYOBReader constructor indirectly bytes type is not yet implemented +FAIL Can get the ReadableStreamBYOBReader constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented PASS ReadableStreamBYOBReader constructor should get a ReadableStream object as argument -FAIL ReadableStreamBYOBReader instances should have the correct list of properties bytes type is not yet implemented -FAIL ReadableStreamBYOBRequest instances should have the correct list of properties bytes type is not yet implemented -FAIL ReadableByteStreamController instances should have the correct list of properties bytes type is not yet implemented +FAIL ReadableStreamBYOBReader instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBRequest instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableByteStreamController instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/properties.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/properties.any.sharedworker-expected.txt index 83c737b..46b3754 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/properties.any.sharedworker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/properties.any.sharedworker-expected.txt
@@ -1,8 +1,8 @@ This is a testharness.js-based test. -FAIL Can get the ReadableStreamBYOBReader constructor indirectly bytes type is not yet implemented +FAIL Can get the ReadableStreamBYOBReader constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented PASS ReadableStreamBYOBReader constructor should get a ReadableStream object as argument -FAIL ReadableStreamBYOBReader instances should have the correct list of properties bytes type is not yet implemented -FAIL ReadableStreamBYOBRequest instances should have the correct list of properties bytes type is not yet implemented -FAIL ReadableByteStreamController instances should have the correct list of properties bytes type is not yet implemented +FAIL ReadableStreamBYOBReader instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBRequest instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableByteStreamController instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/properties.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/properties.any.worker-expected.txt index 83c737b..46b3754 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/properties.any.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-byte-streams/properties.any.worker-expected.txt
@@ -1,8 +1,8 @@ This is a testharness.js-based test. -FAIL Can get the ReadableStreamBYOBReader constructor indirectly bytes type is not yet implemented +FAIL Can get the ReadableStreamBYOBReader constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented PASS ReadableStreamBYOBReader constructor should get a ReadableStream object as argument -FAIL ReadableStreamBYOBReader instances should have the correct list of properties bytes type is not yet implemented -FAIL ReadableStreamBYOBRequest instances should have the correct list of properties bytes type is not yet implemented -FAIL ReadableByteStreamController instances should have the correct list of properties bytes type is not yet implemented +FAIL ReadableStreamBYOBReader instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableStreamBYOBRequest instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented +FAIL ReadableByteStreamController instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/default-reader.any-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-streams/default-reader.any-expected.txt similarity index 100% rename from third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/default-reader.any-expected.txt rename to third_party/blink/web_tests/external/wpt/streams/readable-streams/default-reader.any-expected.txt
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/default-reader.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-streams/default-reader.any.serviceworker-expected.txt similarity index 100% rename from third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/default-reader.any.serviceworker-expected.txt rename to third_party/blink/web_tests/external/wpt/streams/readable-streams/default-reader.any.serviceworker-expected.txt
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/default-reader.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-streams/default-reader.any.sharedworker-expected.txt similarity index 100% rename from third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/default-reader.any.sharedworker-expected.txt rename to third_party/blink/web_tests/external/wpt/streams/readable-streams/default-reader.any.sharedworker-expected.txt
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/default-reader.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-streams/default-reader.any.worker-expected.txt similarity index 100% rename from third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/default-reader.any.worker-expected.txt rename to third_party/blink/web_tests/external/wpt/streams/readable-streams/default-reader.any.worker-expected.txt
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-streams/general.any-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-streams/general.any-expected.txt index 41a7590..0d1c378 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-streams/general.any-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-streams/general.any-expected.txt
@@ -6,7 +6,7 @@ PASS ReadableStream constructor should throw for non-function start arguments PASS ReadableStream constructor will not tolerate initial garbage as cancel argument PASS ReadableStream constructor will not tolerate initial garbage as pull argument -PASS ReadableStream start should be called with the proper parameters +FAIL ReadableStream start should be called with the proper parameters assert_equals: enqueue should have 1 parameter expected 1 but got 0 PASS ReadableStream start controller parameter should be extensible PASS default ReadableStream getReader() should only accept mode:undefined PASS ReadableStream should be able to call start method within prototype chain of its source
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-streams/general.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-streams/general.any.serviceworker-expected.txt index 41a7590..0d1c378 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-streams/general.any.serviceworker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-streams/general.any.serviceworker-expected.txt
@@ -6,7 +6,7 @@ PASS ReadableStream constructor should throw for non-function start arguments PASS ReadableStream constructor will not tolerate initial garbage as cancel argument PASS ReadableStream constructor will not tolerate initial garbage as pull argument -PASS ReadableStream start should be called with the proper parameters +FAIL ReadableStream start should be called with the proper parameters assert_equals: enqueue should have 1 parameter expected 1 but got 0 PASS ReadableStream start controller parameter should be extensible PASS default ReadableStream getReader() should only accept mode:undefined PASS ReadableStream should be able to call start method within prototype chain of its source
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-streams/general.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-streams/general.any.sharedworker-expected.txt index 41a7590..0d1c378 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-streams/general.any.sharedworker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-streams/general.any.sharedworker-expected.txt
@@ -6,7 +6,7 @@ PASS ReadableStream constructor should throw for non-function start arguments PASS ReadableStream constructor will not tolerate initial garbage as cancel argument PASS ReadableStream constructor will not tolerate initial garbage as pull argument -PASS ReadableStream start should be called with the proper parameters +FAIL ReadableStream start should be called with the proper parameters assert_equals: enqueue should have 1 parameter expected 1 but got 0 PASS ReadableStream start controller parameter should be extensible PASS default ReadableStream getReader() should only accept mode:undefined PASS ReadableStream should be able to call start method within prototype chain of its source
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-streams/general.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-streams/general.any.worker-expected.txt index 41a7590..0d1c378 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-streams/general.any.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/readable-streams/general.any.worker-expected.txt
@@ -6,7 +6,7 @@ PASS ReadableStream constructor should throw for non-function start arguments PASS ReadableStream constructor will not tolerate initial garbage as cancel argument PASS ReadableStream constructor will not tolerate initial garbage as pull argument -PASS ReadableStream start should be called with the proper parameters +FAIL ReadableStream start should be called with the proper parameters assert_equals: enqueue should have 1 parameter expected 1 but got 0 PASS ReadableStream start controller parameter should be extensible PASS default ReadableStream getReader() should only accept mode:undefined PASS ReadableStream should be able to call start method within prototype chain of its source
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/transform-streams/properties.any-expected.txt b/third_party/blink/web_tests/external/wpt/streams/transform-streams/properties.any-expected.txt similarity index 100% rename from third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/transform-streams/properties.any-expected.txt rename to third_party/blink/web_tests/external/wpt/streams/transform-streams/properties.any-expected.txt
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/transform-streams/properties.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/transform-streams/properties.any.serviceworker-expected.txt similarity index 100% rename from third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/transform-streams/properties.any.serviceworker-expected.txt rename to third_party/blink/web_tests/external/wpt/streams/transform-streams/properties.any.serviceworker-expected.txt
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/transform-streams/properties.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/transform-streams/properties.any.sharedworker-expected.txt similarity index 100% rename from third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/transform-streams/properties.any.sharedworker-expected.txt rename to third_party/blink/web_tests/external/wpt/streams/transform-streams/properties.any.sharedworker-expected.txt
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/transform-streams/properties.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/transform-streams/properties.any.worker-expected.txt similarity index 100% rename from third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/transform-streams/properties.any.worker-expected.txt rename to third_party/blink/web_tests/external/wpt/streams/transform-streams/properties.any.worker-expected.txt
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/constructor.any-expected.txt b/third_party/blink/web_tests/external/wpt/streams/writable-streams/constructor.any-expected.txt similarity index 100% rename from third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/constructor.any-expected.txt rename to third_party/blink/web_tests/external/wpt/streams/writable-streams/constructor.any-expected.txt
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/constructor.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/writable-streams/constructor.any.serviceworker-expected.txt similarity index 100% rename from third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/constructor.any.serviceworker-expected.txt rename to third_party/blink/web_tests/external/wpt/streams/writable-streams/constructor.any.serviceworker-expected.txt
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/constructor.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/writable-streams/constructor.any.sharedworker-expected.txt similarity index 100% rename from third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/constructor.any.sharedworker-expected.txt rename to third_party/blink/web_tests/external/wpt/streams/writable-streams/constructor.any.sharedworker-expected.txt
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/constructor.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/writable-streams/constructor.any.worker-expected.txt similarity index 100% rename from third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/constructor.any.worker-expected.txt rename to third_party/blink/web_tests/external/wpt/streams/writable-streams/constructor.any.worker-expected.txt
diff --git a/third_party/blink/web_tests/external/wpt/streams/writable-streams/properties.any-expected.txt b/third_party/blink/web_tests/external/wpt/streams/writable-streams/properties.any-expected.txt index 3628bff..7f3b446 100644 --- a/third_party/blink/web_tests/external/wpt/streams/writable-streams/properties.any-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/writable-streams/properties.any-expected.txt
@@ -1,6 +1,6 @@ This is a testharness.js-based test. PASS WritableStreamDefaultController should not be exported on the global object -PASS WritableStreamDefaultWriter should not be exported on the global object +FAIL WritableStreamDefaultWriter should not be exported on the global object assert_equals: WritableStreamDefaultWriter should not be defined expected (undefined) undefined but got (function) function "function WritableStreamDefaultWriter() { [native code] }" PASS WritableStream.prototype.constructor should have standard properties PASS WritableStream.prototype.constructor should be a constructor PASS WritableStream.prototype.locked should have standard properties @@ -13,7 +13,7 @@ PASS WritableStreamDefaultController.prototype.constructor should have standard properties PASS WritableStreamDefaultController.prototype.constructor should be a constructor PASS WritableStreamDefaultController.prototype.error should have standard properties -PASS WritableStreamDefaultController.prototype.error should be a method +FAIL WritableStreamDefaultController.prototype.error should be a method assert_equals: error should take 1 arguments expected 1 but got 0 PASS WritableStreamDefaultController.prototype should have exactly the expected properties PASS WritableStreamDefaultWriter.prototype.constructor should have standard properties PASS WritableStreamDefaultWriter.prototype.constructor should be a constructor @@ -24,13 +24,13 @@ PASS WritableStreamDefaultWriter.prototype.ready should have standard properties PASS WritableStreamDefaultWriter.prototype.ready should be a getter PASS WritableStreamDefaultWriter.prototype.abort should have standard properties -PASS WritableStreamDefaultWriter.prototype.abort should be a method +FAIL WritableStreamDefaultWriter.prototype.abort should be a method assert_equals: abort should take 1 arguments expected 1 but got 0 PASS WritableStreamDefaultWriter.prototype.close should have standard properties PASS WritableStreamDefaultWriter.prototype.close should be a method PASS WritableStreamDefaultWriter.prototype.releaseLock should have standard properties PASS WritableStreamDefaultWriter.prototype.releaseLock should be a method PASS WritableStreamDefaultWriter.prototype.write should have standard properties -PASS WritableStreamDefaultWriter.prototype.write should be a method +FAIL WritableStreamDefaultWriter.prototype.write should be a method assert_equals: write should take 1 arguments expected 1 but got 0 PASS WritableStreamDefaultWriter.prototype should have exactly the expected properties PASS sink method start should be called with the right number of arguments PASS sink method start should be called even when it's located on the prototype chain
diff --git a/third_party/blink/web_tests/external/wpt/streams/writable-streams/properties.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/writable-streams/properties.any.serviceworker-expected.txt index 3628bff..7f3b446 100644 --- a/third_party/blink/web_tests/external/wpt/streams/writable-streams/properties.any.serviceworker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/writable-streams/properties.any.serviceworker-expected.txt
@@ -1,6 +1,6 @@ This is a testharness.js-based test. PASS WritableStreamDefaultController should not be exported on the global object -PASS WritableStreamDefaultWriter should not be exported on the global object +FAIL WritableStreamDefaultWriter should not be exported on the global object assert_equals: WritableStreamDefaultWriter should not be defined expected (undefined) undefined but got (function) function "function WritableStreamDefaultWriter() { [native code] }" PASS WritableStream.prototype.constructor should have standard properties PASS WritableStream.prototype.constructor should be a constructor PASS WritableStream.prototype.locked should have standard properties @@ -13,7 +13,7 @@ PASS WritableStreamDefaultController.prototype.constructor should have standard properties PASS WritableStreamDefaultController.prototype.constructor should be a constructor PASS WritableStreamDefaultController.prototype.error should have standard properties -PASS WritableStreamDefaultController.prototype.error should be a method +FAIL WritableStreamDefaultController.prototype.error should be a method assert_equals: error should take 1 arguments expected 1 but got 0 PASS WritableStreamDefaultController.prototype should have exactly the expected properties PASS WritableStreamDefaultWriter.prototype.constructor should have standard properties PASS WritableStreamDefaultWriter.prototype.constructor should be a constructor @@ -24,13 +24,13 @@ PASS WritableStreamDefaultWriter.prototype.ready should have standard properties PASS WritableStreamDefaultWriter.prototype.ready should be a getter PASS WritableStreamDefaultWriter.prototype.abort should have standard properties -PASS WritableStreamDefaultWriter.prototype.abort should be a method +FAIL WritableStreamDefaultWriter.prototype.abort should be a method assert_equals: abort should take 1 arguments expected 1 but got 0 PASS WritableStreamDefaultWriter.prototype.close should have standard properties PASS WritableStreamDefaultWriter.prototype.close should be a method PASS WritableStreamDefaultWriter.prototype.releaseLock should have standard properties PASS WritableStreamDefaultWriter.prototype.releaseLock should be a method PASS WritableStreamDefaultWriter.prototype.write should have standard properties -PASS WritableStreamDefaultWriter.prototype.write should be a method +FAIL WritableStreamDefaultWriter.prototype.write should be a method assert_equals: write should take 1 arguments expected 1 but got 0 PASS WritableStreamDefaultWriter.prototype should have exactly the expected properties PASS sink method start should be called with the right number of arguments PASS sink method start should be called even when it's located on the prototype chain
diff --git a/third_party/blink/web_tests/external/wpt/streams/writable-streams/properties.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/writable-streams/properties.any.sharedworker-expected.txt index 3628bff..7f3b446 100644 --- a/third_party/blink/web_tests/external/wpt/streams/writable-streams/properties.any.sharedworker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/writable-streams/properties.any.sharedworker-expected.txt
@@ -1,6 +1,6 @@ This is a testharness.js-based test. PASS WritableStreamDefaultController should not be exported on the global object -PASS WritableStreamDefaultWriter should not be exported on the global object +FAIL WritableStreamDefaultWriter should not be exported on the global object assert_equals: WritableStreamDefaultWriter should not be defined expected (undefined) undefined but got (function) function "function WritableStreamDefaultWriter() { [native code] }" PASS WritableStream.prototype.constructor should have standard properties PASS WritableStream.prototype.constructor should be a constructor PASS WritableStream.prototype.locked should have standard properties @@ -13,7 +13,7 @@ PASS WritableStreamDefaultController.prototype.constructor should have standard properties PASS WritableStreamDefaultController.prototype.constructor should be a constructor PASS WritableStreamDefaultController.prototype.error should have standard properties -PASS WritableStreamDefaultController.prototype.error should be a method +FAIL WritableStreamDefaultController.prototype.error should be a method assert_equals: error should take 1 arguments expected 1 but got 0 PASS WritableStreamDefaultController.prototype should have exactly the expected properties PASS WritableStreamDefaultWriter.prototype.constructor should have standard properties PASS WritableStreamDefaultWriter.prototype.constructor should be a constructor @@ -24,13 +24,13 @@ PASS WritableStreamDefaultWriter.prototype.ready should have standard properties PASS WritableStreamDefaultWriter.prototype.ready should be a getter PASS WritableStreamDefaultWriter.prototype.abort should have standard properties -PASS WritableStreamDefaultWriter.prototype.abort should be a method +FAIL WritableStreamDefaultWriter.prototype.abort should be a method assert_equals: abort should take 1 arguments expected 1 but got 0 PASS WritableStreamDefaultWriter.prototype.close should have standard properties PASS WritableStreamDefaultWriter.prototype.close should be a method PASS WritableStreamDefaultWriter.prototype.releaseLock should have standard properties PASS WritableStreamDefaultWriter.prototype.releaseLock should be a method PASS WritableStreamDefaultWriter.prototype.write should have standard properties -PASS WritableStreamDefaultWriter.prototype.write should be a method +FAIL WritableStreamDefaultWriter.prototype.write should be a method assert_equals: write should take 1 arguments expected 1 but got 0 PASS WritableStreamDefaultWriter.prototype should have exactly the expected properties PASS sink method start should be called with the right number of arguments PASS sink method start should be called even when it's located on the prototype chain
diff --git a/third_party/blink/web_tests/external/wpt/streams/writable-streams/properties.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/writable-streams/properties.any.worker-expected.txt index 3628bff..7f3b446 100644 --- a/third_party/blink/web_tests/external/wpt/streams/writable-streams/properties.any.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/writable-streams/properties.any.worker-expected.txt
@@ -1,6 +1,6 @@ This is a testharness.js-based test. PASS WritableStreamDefaultController should not be exported on the global object -PASS WritableStreamDefaultWriter should not be exported on the global object +FAIL WritableStreamDefaultWriter should not be exported on the global object assert_equals: WritableStreamDefaultWriter should not be defined expected (undefined) undefined but got (function) function "function WritableStreamDefaultWriter() { [native code] }" PASS WritableStream.prototype.constructor should have standard properties PASS WritableStream.prototype.constructor should be a constructor PASS WritableStream.prototype.locked should have standard properties @@ -13,7 +13,7 @@ PASS WritableStreamDefaultController.prototype.constructor should have standard properties PASS WritableStreamDefaultController.prototype.constructor should be a constructor PASS WritableStreamDefaultController.prototype.error should have standard properties -PASS WritableStreamDefaultController.prototype.error should be a method +FAIL WritableStreamDefaultController.prototype.error should be a method assert_equals: error should take 1 arguments expected 1 but got 0 PASS WritableStreamDefaultController.prototype should have exactly the expected properties PASS WritableStreamDefaultWriter.prototype.constructor should have standard properties PASS WritableStreamDefaultWriter.prototype.constructor should be a constructor @@ -24,13 +24,13 @@ PASS WritableStreamDefaultWriter.prototype.ready should have standard properties PASS WritableStreamDefaultWriter.prototype.ready should be a getter PASS WritableStreamDefaultWriter.prototype.abort should have standard properties -PASS WritableStreamDefaultWriter.prototype.abort should be a method +FAIL WritableStreamDefaultWriter.prototype.abort should be a method assert_equals: abort should take 1 arguments expected 1 but got 0 PASS WritableStreamDefaultWriter.prototype.close should have standard properties PASS WritableStreamDefaultWriter.prototype.close should be a method PASS WritableStreamDefaultWriter.prototype.releaseLock should have standard properties PASS WritableStreamDefaultWriter.prototype.releaseLock should be a method PASS WritableStreamDefaultWriter.prototype.write should have standard properties -PASS WritableStreamDefaultWriter.prototype.write should be a method +FAIL WritableStreamDefaultWriter.prototype.write should be a method assert_equals: write should take 1 arguments expected 1 but got 0 PASS WritableStreamDefaultWriter.prototype should have exactly the expected properties PASS sink method start should be called with the right number of arguments PASS sink method start should be called even when it's located on the prototype chain
diff --git a/third_party/blink/web_tests/external/wpt/tools/requirements_mypy.txt b/third_party/blink/web_tests/external/wpt/tools/requirements_mypy.txt index 8caf51e..742ebbb 100644 --- a/third_party/blink/web_tests/external/wpt/tools/requirements_mypy.txt +++ b/third_party/blink/web_tests/external/wpt/tools/requirements_mypy.txt
@@ -1,3 +1,3 @@ -mypy==0.701 +mypy==0.710 mypy-extensions==0.4.1 typed-ast==1.3.5
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NFCReadingEvent_constructor.https.html b/third_party/blink/web_tests/external/wpt/web-nfc/NFCReadingEvent_constructor.https.html index da3e4c07..3c424294 100644 --- a/third_party/blink/web_tests/external/wpt/web-nfc/NFCReadingEvent_constructor.https.html +++ b/third_party/blink/web_tests/external/wpt/web-nfc/NFCReadingEvent_constructor.https.html
@@ -6,32 +6,12 @@ <script src="resources/nfc_help.js"></script> <script> - const non_strings = [ - 123, - {}, - true, - Symbol(), - () => {}, - self - ] - test(() => { assert_equals(NFCReadingEvent.length, 2); assert_throws(new TypeError, () => new NFCReadingEvent('message')); }, 'NFCReadingEvent constructor without init dict'); test(() => { - assert_equals(NFCReadingEvent.length, 2); - const message = createMessage([createJsonRecord(test_json_data)]); - non_strings.forEach(invalid_serialNumber => { - assert_throws(new TypeError, () => new NFCReadingEvent( - 'message', - {serialNumber: invalid_serialNumber, message: message} - )); - }); - }, 'NFCReadingEvent constructor with invalid serialNumber'); - - test(() => { const message = createMessage([createJsonRecord(test_json_data)]); const event = new NFCReadingEvent('type', {serialNumber: '', message: message}); assert_equals(event.type, 'type', 'type');
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter_push.https-expected.txt b/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter_push.https-expected.txt index 7a09ebcb..abf8d150 100644 --- a/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter_push.https-expected.txt +++ b/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter_push.https-expected.txt
@@ -12,6 +12,5 @@ FAIL Reject promise with SyntaxError if 'json' record cannot be serialized. NFCWriter is not defined FAIL NFCWriter.push should fail with TypeError when invalid target value is provided. NFCWriter is not defined FAIL Test that WebNFC API is not accessible from iframe context. promise_test: Unhandled rejection with value: undefined -FAIL Test that promise is rejected with TypeError if NDEFMessageSource contains non-string url. NFCWriter is not defined Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter_push.https.html b/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter_push.https.html index b1559b3..f5bbfcd 100644 --- a/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter_push.https.html +++ b/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter_push.https.html
@@ -82,16 +82,7 @@ Symbol(), () => {}, self -] - -const non_strings = [ - 123, - {}, - true, - Symbol(), - () => {}, - self -] +]; promise_test(t => { const writer = new NFCWriter(); @@ -220,17 +211,4 @@ }); }, 'Test that WebNFC API is not accessible from iframe context.'); -promise_test(t => { - const writer = new NFCWriter(); - const promises = []; - non_strings.forEach(invalid_url => { - promises.push( - promise_rejects(t, new TypeError(), writer.push({ - url: invalid_url, - records: [{ recordType: "text", data: 'Hello World' }] - }))); - }); - return Promise.all(promises); -}, "Test that promise is rejected with TypeError if NDEFMessageSource contains non-string url."); - </script>
diff --git a/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/002.worker-expected.txt b/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/002.worker-expected.txt new file mode 100644 index 0000000..e0a8825 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/002.worker-expected.txt
@@ -0,0 +1,38 @@ +This is a testharness.js-based test. +PASS The SharedWorkerGlobalScope interface object should not be exposed. +PASS The AbstractView interface object should not be exposed. +PASS The AbstractWorker interface object should not be exposed. +PASS The ApplicationCache interface object should not be exposed. +PASS The Location interface object should not be exposed. +PASS The Navigator interface object should not be exposed. +PASS The Audio interface object should not be exposed. +PASS The HTMLCanvasElement interface object should not be exposed. +PASS The Path interface object should not be exposed. +PASS The TextMetrics interface object should not be exposed. +PASS The CanvasProxy interface object should not be exposed. +PASS The CanvasRenderingContext2D interface object should not be exposed. +PASS The DrawingStyle interface object should not be exposed. +PASS The BeforeUnloadEvent interface object should not be exposed. +PASS The PopStateEvent interface object should not be exposed. +PASS The HashChangeEvent interface object should not be exposed. +PASS The PageTransitionEvent interface object should not be exposed. +PASS The DOMImplementation interface object should not be exposed. +FAIL The ReadableStreamDefaultReader interface object should not be exposed. assert_false: expected false got true +PASS The ReadableStreamBYOBReader interface object should not be exposed. +PASS The ReadableStreamDefaultController interface object should not be exposed. +PASS The ReadableByteStreamController interface object should not be exposed. +FAIL The WritableStreamDefaultWriter interface object should not be exposed. assert_false: expected false got true +PASS The WritableStreamDefaultController interface object should not be exposed. +PASS The IDBEnvironment interface object should not be exposed. +PASS The Database interface object should not be exposed. +PASS The UIEvent interface object should not be exposed. +PASS The FocusEvent interface object should not be exposed. +PASS The MouseEvent interface object should not be exposed. +PASS The WheelEvent interface object should not be exposed. +PASS The InputEvent interface object should not be exposed. +PASS The KeyboardEvent interface object should not be exposed. +PASS The CompositionEvent interface object should not be exposed. +PASS The VTTCue interface object should not be exposed. +PASS The VTTRegion interface object should not be exposed. +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/004-expected.txt b/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/004-expected.txt new file mode 100644 index 0000000..76ab3d8 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/004-expected.txt
@@ -0,0 +1,34 @@ +This is a testharness.js-based test. +PASS The DedicatedWorkerGlobalScope interface object should not be exposed +PASS The AbstractView interface object should not be exposed +PASS The AbstractWorker interface object should not be exposed +PASS The Location interface object should not be exposed +PASS The Navigator interface object should not be exposed +PASS The DOMImplementation interface object should not be exposed +PASS The Audio interface object should not be exposed +PASS The HTMLCanvasElement interface object should not be exposed +PASS The Path interface object should not be exposed +PASS The TextMetrics interface object should not be exposed +PASS The CanvasProxy interface object should not be exposed +PASS The CanvasRenderingContext2D interface object should not be exposed +PASS The DrawingStyle interface object should not be exposed +PASS The PopStateEvent interface object should not be exposed +PASS The HashChangeEvent interface object should not be exposed +PASS The PageTransitionEvent interface object should not be exposed +FAIL The ReadableStreamDefaultReader interface object should not be exposed assert_false: expected false got true +PASS The ReadableStreamBYOBReader interface object should not be exposed +PASS The ReadableStreamDefaultController interface object should not be exposed +PASS The ReadableByteStreamController interface object should not be exposed +FAIL The WritableStreamDefaultWriter interface object should not be exposed assert_false: expected false got true +PASS The WritableStreamDefaultController interface object should not be exposed +PASS The IDBEnvironment interface object should not be exposed +PASS The Database interface object should not be exposed +PASS The UIEvent interface object should not be exposed +PASS The FocusEvent interface object should not be exposed +PASS The MouseEvent interface object should not be exposed +PASS The WheelEvent interface object should not be exposed +PASS The InputEvent interface object should not be exposed +PASS The KeyboardEvent interface object should not be exposed +PASS The CompositionEvent interface object should not be exposed +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/fast/scroll-snap/snaps-after-scrollbar-scrolling.html b/third_party/blink/web_tests/fast/scroll-snap/snaps-after-scrollbar-scrolling.html index d0727f2..6788ce9 100644 --- a/third_party/blink/web_tests/fast/scroll-snap/snaps-after-scrollbar-scrolling.html +++ b/third_party/blink/web_tests/fast/scroll-snap/snaps-after-scrollbar-scrolling.html
@@ -59,4 +59,22 @@ }); }, "Snaps after clicking the horizontal scrollbar."); -</script> \ No newline at end of file +promise_test (async () => { + scroller.scrollTo(0, 0); + await touchTapOn(398, 350, 1000); + await waitForAnimationEnd(scrollTop, 500, 5); + await waitFor( () => { + return scroller.scrollTop == 400; + }); +}, "Snaps after tapping the vertical scrollbar."); + +promise_test (async () => { + scroller.scrollTo(0, 0); + await touchTapOn(350, 398, 1000); + await waitForAnimationEnd(scrollLeft, 500, 5); + await waitFor( () => { + return scroller.scrollLeft == 400; + }); +}, "Snaps after tapping the horizontal scrollbar."); + +</script>
diff --git a/third_party/blink/web_tests/http/tests/origin_trials/webexposed/animationworklet-origin-trial-interfaces-worklet-scope-expected.txt b/third_party/blink/web_tests/http/tests/origin_trials/webexposed/animationworklet-origin-trial-interfaces-worklet-scope-expected.txt index 4eda1ba6..511b92d 100644 --- a/third_party/blink/web_tests/http/tests/origin_trials/webexposed/animationworklet-origin-trial-interfaces-worklet-scope-expected.txt +++ b/third_party/blink/web_tests/http/tests/origin_trials/webexposed/animationworklet-origin-trial-interfaces-worklet-scope-expected.txt
@@ -15,6 +15,12 @@ CONSOLE MESSAGE: line 153: method pipeThrough CONSOLE MESSAGE: line 153: method pipeTo CONSOLE MESSAGE: line 153: method tee +CONSOLE MESSAGE: line 153: interface ReadableStreamDefaultReader +CONSOLE MESSAGE: line 153: getter closed +CONSOLE MESSAGE: line 153: method cancel +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method read +CONSOLE MESSAGE: line 153: method releaseLock CONSOLE MESSAGE: line 153: interface TransformStream CONSOLE MESSAGE: line 153: getter readable CONSOLE MESSAGE: line 153: getter writable @@ -34,6 +40,15 @@ CONSOLE MESSAGE: line 153: method abort CONSOLE MESSAGE: line 153: method constructor CONSOLE MESSAGE: line 153: method getWriter +CONSOLE MESSAGE: line 153: interface WritableStreamDefaultWriter +CONSOLE MESSAGE: line 153: getter closed +CONSOLE MESSAGE: line 153: getter desiredSize +CONSOLE MESSAGE: line 153: getter ready +CONSOLE MESSAGE: line 153: method abort +CONSOLE MESSAGE: line 153: method close +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method releaseLock +CONSOLE MESSAGE: line 153: method write CONSOLE MESSAGE: line 153: global object CONSOLE MESSAGE: line 153: attribute console CONSOLE MESSAGE: line 153: attribute globalThis @@ -55,6 +70,12 @@ CONSOLE MESSAGE: line 153: method pipeThrough CONSOLE MESSAGE: line 153: method pipeTo CONSOLE MESSAGE: line 153: method tee +CONSOLE MESSAGE: line 153: interface ReadableStreamDefaultReader +CONSOLE MESSAGE: line 153: getter closed +CONSOLE MESSAGE: line 153: method cancel +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method read +CONSOLE MESSAGE: line 153: method releaseLock CONSOLE MESSAGE: line 153: interface TransformStream CONSOLE MESSAGE: line 153: getter readable CONSOLE MESSAGE: line 153: getter writable @@ -74,6 +95,15 @@ CONSOLE MESSAGE: line 153: method abort CONSOLE MESSAGE: line 153: method constructor CONSOLE MESSAGE: line 153: method getWriter +CONSOLE MESSAGE: line 153: interface WritableStreamDefaultWriter +CONSOLE MESSAGE: line 153: getter closed +CONSOLE MESSAGE: line 153: getter desiredSize +CONSOLE MESSAGE: line 153: getter ready +CONSOLE MESSAGE: line 153: method abort +CONSOLE MESSAGE: line 153: method close +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method releaseLock +CONSOLE MESSAGE: line 153: method write CONSOLE MESSAGE: line 153: global object CONSOLE MESSAGE: line 153: attribute console CONSOLE MESSAGE: line 153: attribute globalThis
diff --git a/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index 1ae3824..6d7b920 100644 --- a/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -1156,6 +1156,13 @@ method pipeThrough method pipeTo method tee +interface ReadableStreamDefaultReader + attribute @@toStringTag + getter closed + method cancel + method constructor + method read + method releaseLock interface Request attribute @@toStringTag getter bodyUsed @@ -3629,6 +3636,16 @@ method abort method constructor method getWriter +interface WritableStreamDefaultWriter + attribute @@toStringTag + getter closed + getter desiredSize + getter ready + method abort + method close + method constructor + method releaseLock + method write [GLOBAL OBJECT] attribute console attribute globalThis
diff --git a/third_party/blink/web_tests/http/tests/streams/chromium/err-invalid-hwm.html b/third_party/blink/web_tests/http/tests/streams/chromium/err-invalid-hwm.html index 07dd7652..9b0566b 100644 --- a/third_party/blink/web_tests/http/tests/streams/chromium/err-invalid-hwm.html +++ b/third_party/blink/web_tests/http/tests/streams/chromium/err-invalid-hwm.html
@@ -15,7 +15,8 @@ } catch (e) { assert_equals( e.message, - 'A queueing strategy\'s highWaterMark property must be a nonnegative,' + + 'Failed to construct \'ReadableStream\': ' + + 'A queuing strategy\'s highWaterMark property must be a nonnegative,' + ' non-NaN number', 'message should be relevant'); } @@ -29,7 +30,8 @@ } catch (e) { assert_equals( e.message, - 'A queueing strategy\'s highWaterMark property must be a nonnegative,' + + 'Failed to construct \'WritableStream\': ' + + 'A queuing strategy\'s highWaterMark property must be a nonnegative,' + ' non-NaN number', 'message should be relevant'); }
diff --git a/third_party/blink/web_tests/http/tests/worklet/webexposed/global-interface-listing-paint-worklet-expected.txt b/third_party/blink/web_tests/http/tests/worklet/webexposed/global-interface-listing-paint-worklet-expected.txt index 02dec236..140ad123 100644 --- a/third_party/blink/web_tests/http/tests/worklet/webexposed/global-interface-listing-paint-worklet-expected.txt +++ b/third_party/blink/web_tests/http/tests/worklet/webexposed/global-interface-listing-paint-worklet-expected.txt
@@ -233,6 +233,12 @@ CONSOLE MESSAGE: line 153: method pipeThrough CONSOLE MESSAGE: line 153: method pipeTo CONSOLE MESSAGE: line 153: method tee +CONSOLE MESSAGE: line 153: interface ReadableStreamDefaultReader +CONSOLE MESSAGE: line 153: getter closed +CONSOLE MESSAGE: line 153: method cancel +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method read +CONSOLE MESSAGE: line 153: method releaseLock CONSOLE MESSAGE: line 153: interface StylePropertyMapReadOnly CONSOLE MESSAGE: line 153: getter size CONSOLE MESSAGE: line 153: method constructor @@ -254,6 +260,15 @@ CONSOLE MESSAGE: line 153: method abort CONSOLE MESSAGE: line 153: method constructor CONSOLE MESSAGE: line 153: method getWriter +CONSOLE MESSAGE: line 153: interface WritableStreamDefaultWriter +CONSOLE MESSAGE: line 153: getter closed +CONSOLE MESSAGE: line 153: getter desiredSize +CONSOLE MESSAGE: line 153: getter ready +CONSOLE MESSAGE: line 153: method abort +CONSOLE MESSAGE: line 153: method close +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method releaseLock +CONSOLE MESSAGE: line 153: method write CONSOLE MESSAGE: line 153: global object CONSOLE MESSAGE: line 153: attribute console CONSOLE MESSAGE: line 153: attribute globalThis @@ -494,6 +509,12 @@ CONSOLE MESSAGE: line 153: method pipeThrough CONSOLE MESSAGE: line 153: method pipeTo CONSOLE MESSAGE: line 153: method tee +CONSOLE MESSAGE: line 153: interface ReadableStreamDefaultReader +CONSOLE MESSAGE: line 153: getter closed +CONSOLE MESSAGE: line 153: method cancel +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method read +CONSOLE MESSAGE: line 153: method releaseLock CONSOLE MESSAGE: line 153: interface StylePropertyMapReadOnly CONSOLE MESSAGE: line 153: getter size CONSOLE MESSAGE: line 153: method constructor @@ -515,6 +536,15 @@ CONSOLE MESSAGE: line 153: method abort CONSOLE MESSAGE: line 153: method constructor CONSOLE MESSAGE: line 153: method getWriter +CONSOLE MESSAGE: line 153: interface WritableStreamDefaultWriter +CONSOLE MESSAGE: line 153: getter closed +CONSOLE MESSAGE: line 153: getter desiredSize +CONSOLE MESSAGE: line 153: getter ready +CONSOLE MESSAGE: line 153: method abort +CONSOLE MESSAGE: line 153: method close +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method releaseLock +CONSOLE MESSAGE: line 153: method write CONSOLE MESSAGE: line 153: global object CONSOLE MESSAGE: line 153: attribute console CONSOLE MESSAGE: line 153: attribute globalThis
diff --git a/third_party/blink/web_tests/netinfo/gc-unused-listeners.html b/third_party/blink/web_tests/netinfo/gc-unused-listeners.html index 669bca53..83876e2 100644 --- a/third_party/blink/web_tests/netinfo/gc-unused-listeners.html +++ b/third_party/blink/web_tests/netinfo/gc-unused-listeners.html
@@ -1,5 +1,6 @@ <!DOCTYPE html> <head> +<script src="../resources/gc.js"></script> <script src="../resources/js-test.js"></script> <script src="resources/netinfo_common.js"></script> </head> @@ -26,17 +27,18 @@ connection.addEventListener('typechange', callback); })(); -gc(); -shouldBeFalse('callbackObserver.wasCollected'); - -// Remove the listener and its callback reference. -// Access objects in an inner function to avoid references to objects -// remaining live on this function's stack frame (http://crbug.com/595672/). -(() => {connection.removeEventListener('typechange', callback);})(); -callback = null; -gc(); -shouldBeTrue('callbackObserver.wasCollected'); -finishJSTest(); +asyncGC().then( () => { + shouldBeFalse('callbackObserver.wasCollected'); + // Remove the listener and its callback reference. + // Access objects in an inner function to avoid references to objects + // remaining live on this function's stack frame (http://crbug.com/595672/). + (() => {connection.removeEventListener('typechange', callback);})(); + callback = null; + return asyncGC(); +}).then(() => { + shouldBeTrue('callbackObserver.wasCollected'); + finishJSTest(); +}); </script> </body>
diff --git a/third_party/blink/web_tests/platform/linux/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt b/third_party/blink/web_tests/platform/linux/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt new file mode 100644 index 0000000..023d6be --- /dev/null +++ b/third_party/blink/web_tests/platform/linux/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +FAIL NFCReadingEvent constructor without init dict NFCReadingEvent is not defined +FAIL NFCReadingEvent constructor with valid parameters NFCReadingEvent is not defined +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.10/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.10/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt new file mode 100644 index 0000000..023d6be --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.10/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +FAIL NFCReadingEvent constructor without init dict NFCReadingEvent is not defined +FAIL NFCReadingEvent constructor with valid parameters NFCReadingEvent is not defined +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.11/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.11/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt new file mode 100644 index 0000000..023d6be --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.11/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +FAIL NFCReadingEvent constructor without init dict NFCReadingEvent is not defined +FAIL NFCReadingEvent constructor with valid parameters NFCReadingEvent is not defined +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.12/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt new file mode 100644 index 0000000..023d6be --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.12/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +FAIL NFCReadingEvent constructor without init dict NFCReadingEvent is not defined +FAIL NFCReadingEvent constructor with valid parameters NFCReadingEvent is not defined +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/mac-retina/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt b/third_party/blink/web_tests/platform/mac-retina/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt new file mode 100644 index 0000000..023d6be --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-retina/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +FAIL NFCReadingEvent constructor without init dict NFCReadingEvent is not defined +FAIL NFCReadingEvent constructor with valid parameters NFCReadingEvent is not defined +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/mac/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt b/third_party/blink/web_tests/platform/mac/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt new file mode 100644 index 0000000..023d6be --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +FAIL NFCReadingEvent constructor without init dict NFCReadingEvent is not defined +FAIL NFCReadingEvent constructor with valid parameters NFCReadingEvent is not defined +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/win/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt b/third_party/blink/web_tests/platform/win/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt new file mode 100644 index 0000000..023d6be --- /dev/null +++ b/third_party/blink/web_tests/platform/win/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +FAIL NFCReadingEvent constructor without init dict NFCReadingEvent is not defined +FAIL NFCReadingEvent constructor with valid parameters NFCReadingEvent is not defined +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/win7/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt b/third_party/blink/web_tests/platform/win7/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt new file mode 100644 index 0000000..023d6be --- /dev/null +++ b/third_party/blink/web_tests/platform/win7/external/wpt/web-nfc/NFCReadingEvent_constructor.https-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +FAIL NFCReadingEvent constructor without init dict NFCReadingEvent is not defined +FAIL NFCReadingEvent constructor with valid parameters NFCReadingEvent is not defined +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/security/resources/script.js b/third_party/blink/web_tests/security/resources/script.js new file mode 100644 index 0000000..96cefad --- /dev/null +++ b/third_party/blink/web_tests/security/resources/script.js
@@ -0,0 +1 @@ +// An empty script.
diff --git a/third_party/blink/web_tests/security/srcdoc-include-file-sandboxed.html b/third_party/blink/web_tests/security/srcdoc-include-file-sandboxed.html new file mode 100644 index 0000000..1dfbee9 --- /dev/null +++ b/third_party/blink/web_tests/security/srcdoc-include-file-sandboxed.html
@@ -0,0 +1,58 @@ +<!-- + Test whether or not an iframe can load file subresources when: + - The main frame can load files. + - The iframe is sandboxed. + - The navigation is to about:srcdoc. + + See https://crbug.com/977186 +--> +<script src="../resources/testharness.js"></script> +<script src="../resources/testharnessreport.js"></script> + +<iframe sandbox="allow-scripts" name="theiframe" srcdoc=" + <script src='./resources/script.js' + onload='parent.postMessage("loaded","*")' + onerror='parent.postMessage("error","*")' + ></script> +"></iframe> + +<a target="theiframe" href="../resources/back.html"></a> + +<script> + let button = document.querySelector("a"); + let iframe = document.querySelector("iframe"); + + let message = function() { + return new Promise(resolve => + window.addEventListener('message', event => resolve(event.data)) + ); + }; + + async_test(async function(t) { + // 1. During the initial navigation to about:srcdoc. The file is + // successfully loaded. + // TODO(https://crbug.com/977186): This should probably be blocked. + assert_equals("loaded", await message()); + + // 2. Repeating the same navigation, by setting the srcdoc attribute. + // TODO(https://crbug.com/977186): This should probably be blocked. + iframe.srcdoc = iframe.srcdoc + assert_equals("loaded", await message()); + + // 3. History navigation to about:srcdoc. This time, it fails, probably + // because of https://crbug.com/949510. + // + // button.click() navigates to back.html which will execute + // history.back() and navigate back to the about:srcdoc page. + button.click(); + assert_equals("error", await message()); + + // 4. Same as (2). This time its fails, because (3) removed the defaults + // loaders. + iframe.srcdoc = iframe.srcdoc + assert_equals("error", await message()); + + t.done(); + }); +</script> +
diff --git a/third_party/blink/web_tests/virtual/origin-trials-runtimeflags-disabled/http/tests/origin_trials/webexposed/animationworklet-origin-trial-interfaces-worklet-scope-expected.txt b/third_party/blink/web_tests/virtual/origin-trials-runtimeflags-disabled/http/tests/origin_trials/webexposed/animationworklet-origin-trial-interfaces-worklet-scope-expected.txt new file mode 100644 index 0000000..4eda1ba6 --- /dev/null +++ b/third_party/blink/web_tests/virtual/origin-trials-runtimeflags-disabled/http/tests/origin_trials/webexposed/animationworklet-origin-trial-interfaces-worklet-scope-expected.txt
@@ -0,0 +1,82 @@ +CONSOLE MESSAGE: line 13: List all interfaces in the animation worklet global scope. +CONSOLE MESSAGE: line 153: interface AnimationWorkletGlobalScope : WorkletGlobalScope +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: interface ByteLengthQueuingStrategy +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method size +CONSOLE MESSAGE: line 153: interface CountQueuingStrategy +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method size +CONSOLE MESSAGE: line 153: interface ReadableStream +CONSOLE MESSAGE: line 153: getter locked +CONSOLE MESSAGE: line 153: method cancel +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method getReader +CONSOLE MESSAGE: line 153: method pipeThrough +CONSOLE MESSAGE: line 153: method pipeTo +CONSOLE MESSAGE: line 153: method tee +CONSOLE MESSAGE: line 153: interface TransformStream +CONSOLE MESSAGE: line 153: getter readable +CONSOLE MESSAGE: line 153: getter writable +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: interface WorkletAnimationEffect +CONSOLE MESSAGE: line 153: getter localTime +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method getTiming +CONSOLE MESSAGE: line 153: setter localTime +CONSOLE MESSAGE: line 153: interface WorkletGlobalScope +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: interface WorkletGroupEffect +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method getChildren +CONSOLE MESSAGE: line 153: interface WritableStream +CONSOLE MESSAGE: line 153: getter locked +CONSOLE MESSAGE: line 153: method abort +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method getWriter +CONSOLE MESSAGE: line 153: global object +CONSOLE MESSAGE: line 153: attribute console +CONSOLE MESSAGE: line 153: attribute globalThis +CONSOLE MESSAGE: line 153: method gc +CONSOLE MESSAGE: line 153: method registerAnimator +CONSOLE MESSAGE: line 153: interface AnimationWorkletGlobalScope : WorkletGlobalScope +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: interface ByteLengthQueuingStrategy +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method size +CONSOLE MESSAGE: line 153: interface CountQueuingStrategy +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method size +CONSOLE MESSAGE: line 153: interface ReadableStream +CONSOLE MESSAGE: line 153: getter locked +CONSOLE MESSAGE: line 153: method cancel +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method getReader +CONSOLE MESSAGE: line 153: method pipeThrough +CONSOLE MESSAGE: line 153: method pipeTo +CONSOLE MESSAGE: line 153: method tee +CONSOLE MESSAGE: line 153: interface TransformStream +CONSOLE MESSAGE: line 153: getter readable +CONSOLE MESSAGE: line 153: getter writable +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: interface WorkletAnimationEffect +CONSOLE MESSAGE: line 153: getter localTime +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method getTiming +CONSOLE MESSAGE: line 153: setter localTime +CONSOLE MESSAGE: line 153: interface WorkletGlobalScope +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: interface WorkletGroupEffect +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method getChildren +CONSOLE MESSAGE: line 153: interface WritableStream +CONSOLE MESSAGE: line 153: getter locked +CONSOLE MESSAGE: line 153: method abort +CONSOLE MESSAGE: line 153: method constructor +CONSOLE MESSAGE: line 153: method getWriter +CONSOLE MESSAGE: line 153: global object +CONSOLE MESSAGE: line 153: attribute console +CONSOLE MESSAGE: line 153: attribute globalThis +CONSOLE MESSAGE: line 153: method gc +CONSOLE MESSAGE: line 153: method registerAnimator +
diff --git a/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-expected.txt index 0b8d2e66..a794aa3d 100644 --- a/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-expected.txt +++ b/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -411,7 +411,6 @@ static method pt static method px static method rad - static method registerProperty static method rem static method s static method supports
diff --git a/third_party/blink/web_tests/virtual/streams-native/README.md b/third_party/blink/web_tests/virtual/streams-native/README.md deleted file mode 100644 index 7abc810..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/README.md +++ /dev/null
@@ -1,5 +0,0 @@ -Streams tests run with the new C++ native implementation. As this is a -work-in-progress, there are a number of known failures. - -See issue https://crbug.com/902633 and design doc -https://docs.google.com/document/d/1n0IIRmJb0R-DFc2IhhJfS2-LUwl6iKSBNaR0klr3o40/edit.
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/brand-checks.any-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/brand-checks.any-expected.txt deleted file mode 100644 index 13d86ff9..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/brand-checks.any-expected.txt +++ /dev/null
@@ -1,17 +0,0 @@ -This is a testharness.js-based test. -FAIL Can get the ReadableStreamBYOBReader constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL Can get the ReadableByteStreamController constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented -PASS ReadableStreamBYOBReader enforces a brand check on its argument -FAIL ReadableStreamBYOBReader.prototype.closed enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBReader.prototype.cancel enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBReader.prototype.read enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBReader.prototype.releaseLock enforces a brand check Cannot read property 'prototype' of undefined -PASS ReadableByteStreamController enforces a brand check on its arguments -PASS ReadableByteStreamController can't be given a fully-constructed ReadableStream -FAIL ReadableByteStreamController.prototype.byobRequest enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableByteStreamController.prototype.close enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableByteStreamController.prototype.enqueue enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableByteStreamController.prototype.error enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBRequest enforces brand checks Failed to construct 'ReadableStream': bytes type is not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/brand-checks.any.serviceworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/brand-checks.any.serviceworker-expected.txt deleted file mode 100644 index 13d86ff9..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/brand-checks.any.serviceworker-expected.txt +++ /dev/null
@@ -1,17 +0,0 @@ -This is a testharness.js-based test. -FAIL Can get the ReadableStreamBYOBReader constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL Can get the ReadableByteStreamController constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented -PASS ReadableStreamBYOBReader enforces a brand check on its argument -FAIL ReadableStreamBYOBReader.prototype.closed enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBReader.prototype.cancel enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBReader.prototype.read enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBReader.prototype.releaseLock enforces a brand check Cannot read property 'prototype' of undefined -PASS ReadableByteStreamController enforces a brand check on its arguments -PASS ReadableByteStreamController can't be given a fully-constructed ReadableStream -FAIL ReadableByteStreamController.prototype.byobRequest enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableByteStreamController.prototype.close enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableByteStreamController.prototype.enqueue enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableByteStreamController.prototype.error enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBRequest enforces brand checks Failed to construct 'ReadableStream': bytes type is not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/brand-checks.any.sharedworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/brand-checks.any.sharedworker-expected.txt deleted file mode 100644 index 13d86ff9..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/brand-checks.any.sharedworker-expected.txt +++ /dev/null
@@ -1,17 +0,0 @@ -This is a testharness.js-based test. -FAIL Can get the ReadableStreamBYOBReader constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL Can get the ReadableByteStreamController constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented -PASS ReadableStreamBYOBReader enforces a brand check on its argument -FAIL ReadableStreamBYOBReader.prototype.closed enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBReader.prototype.cancel enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBReader.prototype.read enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBReader.prototype.releaseLock enforces a brand check Cannot read property 'prototype' of undefined -PASS ReadableByteStreamController enforces a brand check on its arguments -PASS ReadableByteStreamController can't be given a fully-constructed ReadableStream -FAIL ReadableByteStreamController.prototype.byobRequest enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableByteStreamController.prototype.close enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableByteStreamController.prototype.enqueue enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableByteStreamController.prototype.error enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBRequest enforces brand checks Failed to construct 'ReadableStream': bytes type is not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/brand-checks.any.worker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/brand-checks.any.worker-expected.txt deleted file mode 100644 index 13d86ff9..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/brand-checks.any.worker-expected.txt +++ /dev/null
@@ -1,17 +0,0 @@ -This is a testharness.js-based test. -FAIL Can get the ReadableStreamBYOBReader constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL Can get the ReadableByteStreamController constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented -PASS ReadableStreamBYOBReader enforces a brand check on its argument -FAIL ReadableStreamBYOBReader.prototype.closed enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBReader.prototype.cancel enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBReader.prototype.read enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBReader.prototype.releaseLock enforces a brand check Cannot read property 'prototype' of undefined -PASS ReadableByteStreamController enforces a brand check on its arguments -PASS ReadableByteStreamController can't be given a fully-constructed ReadableStream -FAIL ReadableByteStreamController.prototype.byobRequest enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableByteStreamController.prototype.close enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableByteStreamController.prototype.enqueue enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableByteStreamController.prototype.error enforces a brand check Cannot read property 'prototype' of undefined -FAIL ReadableStreamBYOBRequest enforces brand checks Failed to construct 'ReadableStream': bytes type is not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/construct-byob-request.any-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/construct-byob-request.any-expected.txt deleted file mode 100644 index 8ec519e1..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/construct-byob-request.any-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL construct-byob-request Uncaught RangeError: Failed to construct 'ReadableStream': bytes type is not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/construct-byob-request.any.sharedworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/construct-byob-request.any.sharedworker-expected.txt deleted file mode 100644 index 8ec519e1..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/construct-byob-request.any.sharedworker-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL construct-byob-request Uncaught RangeError: Failed to construct 'ReadableStream': bytes type is not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/construct-byob-request.any.worker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/construct-byob-request.any.worker-expected.txt deleted file mode 100644 index 8ec519e1..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/construct-byob-request.any.worker-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL construct-byob-request Uncaught RangeError: Failed to construct 'ReadableStream': bytes type is not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/detached-buffers.any-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/detached-buffers.any-expected.txt deleted file mode 100644 index 76867b4..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/detached-buffers.any-expected.txt +++ /dev/null
@@ -1,11 +0,0 @@ -This is a testharness.js-based test. -FAIL ReadableStream with byte source: read()ing from a closed stream still transfers the buffer Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueuing an already-detached buffer throws Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: reading into an already-detached buffer rejects Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the closed state) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the readable state) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state) Failed to construct 'ReadableStream': bytes type is not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/detached-buffers.any.serviceworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/detached-buffers.any.serviceworker-expected.txt deleted file mode 100644 index 76867b4..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/detached-buffers.any.serviceworker-expected.txt +++ /dev/null
@@ -1,11 +0,0 @@ -This is a testharness.js-based test. -FAIL ReadableStream with byte source: read()ing from a closed stream still transfers the buffer Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueuing an already-detached buffer throws Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: reading into an already-detached buffer rejects Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the closed state) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the readable state) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state) Failed to construct 'ReadableStream': bytes type is not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/detached-buffers.any.sharedworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/detached-buffers.any.sharedworker-expected.txt deleted file mode 100644 index 76867b4..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/detached-buffers.any.sharedworker-expected.txt +++ /dev/null
@@ -1,11 +0,0 @@ -This is a testharness.js-based test. -FAIL ReadableStream with byte source: read()ing from a closed stream still transfers the buffer Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueuing an already-detached buffer throws Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: reading into an already-detached buffer rejects Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the closed state) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the readable state) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state) Failed to construct 'ReadableStream': bytes type is not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/detached-buffers.any.worker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/detached-buffers.any.worker-expected.txt deleted file mode 100644 index 76867b4..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/detached-buffers.any.worker-expected.txt +++ /dev/null
@@ -1,11 +0,0 @@ -This is a testharness.js-based test. -FAIL ReadableStream with byte source: read()ing from a closed stream still transfers the buffer Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueuing an already-detached buffer throws Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: reading into an already-detached buffer rejects Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the closed state) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the readable state) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state) Failed to construct 'ReadableStream': bytes type is not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/general.any-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/general.any-expected.txt deleted file mode 100644 index 1ccd08a..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/general.any-expected.txt +++ /dev/null
@@ -1,84 +0,0 @@ -This is a testharness.js-based test. -Found 77 tests; 2 PASS, 75 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS getReader({mode: "byob"}) throws on non-bytes streams -FAIL ReadableStream with byte source can be constructed with no errors Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL getReader({mode}) must perform ToString() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Construct and expect start and pull being called Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Construct with highWaterMark of 0 Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: desiredSize when closed Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: desiredSize when errored Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), then releaseLock() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() and read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: autoAllocateChunkSize Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Mix of auto allocate and BYOB Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Push source that doesn't understand pull signal Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: pull() function is not callable assert_throws: constructor should throw function "() => new ReadableStream({ - pull: 'foo', - type: 'bytes' - })" threw object "RangeError: Failed to construct 'ReadableStream': bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") -FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to pull() by enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to multiple pull() by separate enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() with too big value Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), read(view), then cancel() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throw if close()-ed more than once Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throw on enqueue() after close() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read() twice, then enqueue() twice Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view), close() and respond() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view), big enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with zero-length view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read() on an errored stream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(), then error() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) on an errored stream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then error() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull function must error the stream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL calling respond() twice on the same byobRequest should throw Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL calling respondWithNewView() twice on the same byobRequest should throw Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL calling respond(0) twice on the same byobRequest should throw even when closed Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL pull() resolving should not make releaseLock() possible Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBReader can be constructed directly Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" Failed to construct 'ReadableStream': bytes type is not yet implemented -PASS ReadableStream constructor should not accept a strategy with a size defined if type is "bytes" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/general.any.serviceworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/general.any.serviceworker-expected.txt deleted file mode 100644 index 1ccd08a..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/general.any.serviceworker-expected.txt +++ /dev/null
@@ -1,84 +0,0 @@ -This is a testharness.js-based test. -Found 77 tests; 2 PASS, 75 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS getReader({mode: "byob"}) throws on non-bytes streams -FAIL ReadableStream with byte source can be constructed with no errors Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL getReader({mode}) must perform ToString() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Construct and expect start and pull being called Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Construct with highWaterMark of 0 Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: desiredSize when closed Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: desiredSize when errored Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), then releaseLock() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() and read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: autoAllocateChunkSize Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Mix of auto allocate and BYOB Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Push source that doesn't understand pull signal Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: pull() function is not callable assert_throws: constructor should throw function "() => new ReadableStream({ - pull: 'foo', - type: 'bytes' - })" threw object "RangeError: Failed to construct 'ReadableStream': bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") -FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to pull() by enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to multiple pull() by separate enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() with too big value Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), read(view), then cancel() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throw if close()-ed more than once Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throw on enqueue() after close() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read() twice, then enqueue() twice Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view), close() and respond() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view), big enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with zero-length view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read() on an errored stream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(), then error() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) on an errored stream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then error() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull function must error the stream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL calling respond() twice on the same byobRequest should throw Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL calling respondWithNewView() twice on the same byobRequest should throw Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL calling respond(0) twice on the same byobRequest should throw even when closed Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL pull() resolving should not make releaseLock() possible Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBReader can be constructed directly Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" Failed to construct 'ReadableStream': bytes type is not yet implemented -PASS ReadableStream constructor should not accept a strategy with a size defined if type is "bytes" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/general.any.sharedworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/general.any.sharedworker-expected.txt deleted file mode 100644 index 1ccd08a..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/general.any.sharedworker-expected.txt +++ /dev/null
@@ -1,84 +0,0 @@ -This is a testharness.js-based test. -Found 77 tests; 2 PASS, 75 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS getReader({mode: "byob"}) throws on non-bytes streams -FAIL ReadableStream with byte source can be constructed with no errors Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL getReader({mode}) must perform ToString() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Construct and expect start and pull being called Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Construct with highWaterMark of 0 Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: desiredSize when closed Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: desiredSize when errored Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), then releaseLock() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() and read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: autoAllocateChunkSize Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Mix of auto allocate and BYOB Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Push source that doesn't understand pull signal Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: pull() function is not callable assert_throws: constructor should throw function "() => new ReadableStream({ - pull: 'foo', - type: 'bytes' - })" threw object "RangeError: Failed to construct 'ReadableStream': bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") -FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to pull() by enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to multiple pull() by separate enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() with too big value Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), read(view), then cancel() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throw if close()-ed more than once Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throw on enqueue() after close() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read() twice, then enqueue() twice Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view), close() and respond() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view), big enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with zero-length view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read() on an errored stream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(), then error() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) on an errored stream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then error() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull function must error the stream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL calling respond() twice on the same byobRequest should throw Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL calling respondWithNewView() twice on the same byobRequest should throw Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL calling respond(0) twice on the same byobRequest should throw even when closed Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL pull() resolving should not make releaseLock() possible Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBReader can be constructed directly Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" Failed to construct 'ReadableStream': bytes type is not yet implemented -PASS ReadableStream constructor should not accept a strategy with a size defined if type is "bytes" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/general.any.worker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/general.any.worker-expected.txt deleted file mode 100644 index 1ccd08a..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/general.any.worker-expected.txt +++ /dev/null
@@ -1,84 +0,0 @@ -This is a testharness.js-based test. -Found 77 tests; 2 PASS, 75 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS getReader({mode: "byob"}) throws on non-bytes streams -FAIL ReadableStream with byte source can be constructed with no errors Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL getReader({mode}) must perform ToString() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Construct and expect start and pull being called Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: No automatic pull call if start doesn't finish Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Construct with highWaterMark of 0 Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: desiredSize when closed Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: desiredSize when errored Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), then releaseLock() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader() with mode set to byob, then releaseLock() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that closing a stream does not release a reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that erroring a stream does not release a reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() and read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: autoAllocateChunkSize Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Mix of auto allocate and BYOB Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Automatic pull() after start() and read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Push source that doesn't understand pull signal Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: pull() function is not callable assert_throws: constructor should throw function "() => new ReadableStream({ - pull: 'foo', - type: 'bytes' - })" threw object "RangeError: Failed to construct 'ReadableStream': bytes type is not yet implemented" ("RangeError") expected object "TypeError" ("TypeError") -FAIL ReadableStream with byte source: enqueue() with Uint16Array, getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), read(view) partially, then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), enqueue(), close(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), close(), getReader(), then read() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to pull() by enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to pull() by enqueue() asynchronously Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Respond to multiple pull() by separate enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() with a transferred ArrayBuffer Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() with too big value Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: respond(3) to read(view) with 2 element Uint16Array enqueues the 1 byte remainder Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = not BYOB) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then cancel() (mode = BYOB) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: getReader(), read(view), then cancel() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: cancel() with partially filled pending pull() request Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) where view.buffer is not fully covered by view Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple enqueue(), getReader(), then read(view) Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a bigger view Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue(), getReader(), then read(view) with a smaller views Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue() 1 byte, getReader(), then read(view) with Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: enqueue() 3 byte, getReader(), then read(view) with 2-element Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with Uint16Array on close()-d stream with 1 byte enqueue()-d must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: A stream must be errored if close()-d before fulfilling read(view) with Uint16Array Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throw if close()-ed more than once Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throw on enqueue() after close() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then respond() and close() in pull() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with Uint32Array, then fill it by multiple respond() calls Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read() twice, then enqueue() twice Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view), close() and respond() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view), big enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Multiple read(view) and multiple enqueue() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with passing undefined as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with zero-length view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) with passing an empty object as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Even read(view) with passing ArrayBufferView like object as view must fail Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read() on an errored stream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(), then error() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view) on an errored stream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: read(view), then error() Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull function must error the stream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read() must be ignored if the stream is errored in it Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read(view) function must error the stream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: Throwing in pull in response to read(view) must be ignored if the stream is errored in it Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL calling respond() twice on the same byobRequest should throw Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL calling respondWithNewView() twice on the same byobRequest should throw Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL calling respond(0) twice on the same byobRequest should throw even when closed Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL pull() resolving should not make releaseLock() possible Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBReader can be constructed directly Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires a ReadableStream argument Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires an unlocked ReadableStream Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes" Failed to construct 'ReadableStream': bytes type is not yet implemented -PASS ReadableStream constructor should not accept a strategy with a size defined if type is "bytes" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/properties.any-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/properties.any-expected.txt deleted file mode 100644 index 46b3754..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/properties.any-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -This is a testharness.js-based test. -FAIL Can get the ReadableStreamBYOBReader constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented -PASS ReadableStreamBYOBReader constructor should get a ReadableStream object as argument -FAIL ReadableStreamBYOBReader instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBRequest instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableByteStreamController instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/properties.any.serviceworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/properties.any.serviceworker-expected.txt deleted file mode 100644 index 46b3754..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/properties.any.serviceworker-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -This is a testharness.js-based test. -FAIL Can get the ReadableStreamBYOBReader constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented -PASS ReadableStreamBYOBReader constructor should get a ReadableStream object as argument -FAIL ReadableStreamBYOBReader instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBRequest instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableByteStreamController instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/properties.any.sharedworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/properties.any.sharedworker-expected.txt deleted file mode 100644 index 46b3754..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/properties.any.sharedworker-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -This is a testharness.js-based test. -FAIL Can get the ReadableStreamBYOBReader constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented -PASS ReadableStreamBYOBReader constructor should get a ReadableStream object as argument -FAIL ReadableStreamBYOBReader instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBRequest instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableByteStreamController instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/properties.any.worker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/properties.any.worker-expected.txt deleted file mode 100644 index 46b3754..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-byte-streams/properties.any.worker-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -This is a testharness.js-based test. -FAIL Can get the ReadableStreamBYOBReader constructor indirectly Failed to construct 'ReadableStream': bytes type is not yet implemented -PASS ReadableStreamBYOBReader constructor should get a ReadableStream object as argument -FAIL ReadableStreamBYOBReader instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableStreamBYOBRequest instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented -FAIL ReadableByteStreamController instances should have the correct list of properties Failed to construct 'ReadableStream': bytes type is not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/general.any-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/general.any-expected.txt deleted file mode 100644 index 0d1c378..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/general.any-expected.txt +++ /dev/null
@@ -1,42 +0,0 @@ -This is a testharness.js-based test. -PASS ReadableStream can be constructed with no errors -PASS ReadableStream can't be constructed with garbage -PASS ReadableStream can't be constructed with an invalid type -FAIL ReadableStream instances should have the correct list of properties assert_array_equals: should have all the correct properties lengths differ, expected 8 got 7 -PASS ReadableStream constructor should throw for non-function start arguments -PASS ReadableStream constructor will not tolerate initial garbage as cancel argument -PASS ReadableStream constructor will not tolerate initial garbage as pull argument -FAIL ReadableStream start should be called with the proper parameters assert_equals: enqueue should have 1 parameter expected 1 but got 0 -PASS ReadableStream start controller parameter should be extensible -PASS default ReadableStream getReader() should only accept mode:undefined -PASS ReadableStream should be able to call start method within prototype chain of its source -PASS ReadableStream start should be able to return a promise -PASS ReadableStream start should be able to return a promise and reject it -PASS ReadableStream should be able to enqueue different objects. -PASS ReadableStream: if pull rejects, it should error the stream -PASS ReadableStream: should only call pull once upon starting the stream -PASS ReadableStream: should call pull when trying to read from a started, empty stream -PASS ReadableStream: should only call pull once on a non-empty stream read from before start fulfills -PASS ReadableStream: should only call pull once on a non-empty stream read from after start fulfills -PASS ReadableStream: should call pull in reaction to read()ing the last chunk, if not draining -PASS ReadableStream: should not call pull() in reaction to read()ing the last chunk, if draining -PASS ReadableStream: should not call pull until the previous pull call's promise fulfills -PASS ReadableStream: should pull after start, and after every read -PASS ReadableStream: should not call pull after start if the stream is now closed -PASS ReadableStream: should call pull after enqueueing from inside pull (with no read requests), if strategy allows -PASS ReadableStream pull should be able to close a stream. -PASS ReadableStream pull should be able to error a stream. -PASS ReadableStream pull should be able to error a stream and throw. -PASS ReadableStream: enqueue should throw when the stream is readable but draining -PASS ReadableStream: enqueue should throw when the stream is closed -PASS ReadableStream: should call underlying source methods as methods -PASS ReadableStream: desiredSize when closed -PASS ReadableStream: desiredSize when errored -PASS Subclassing ReadableStream should work -PASS ReadableStream strategies: the default strategy should give desiredSize of 1 to start, decreasing by 1 per enqueue -PASS ReadableStream strategies: the default strategy should continue giving desiredSize of 1 if the chunks are read immediately -PASS ReadableStream integration test: adapting a random push source -PASS ReadableStream integration test: adapting a sync pull source -PASS ReadableStream integration test: adapting an async pull source -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/general.any.serviceworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/general.any.serviceworker-expected.txt deleted file mode 100644 index 0d1c378..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/general.any.serviceworker-expected.txt +++ /dev/null
@@ -1,42 +0,0 @@ -This is a testharness.js-based test. -PASS ReadableStream can be constructed with no errors -PASS ReadableStream can't be constructed with garbage -PASS ReadableStream can't be constructed with an invalid type -FAIL ReadableStream instances should have the correct list of properties assert_array_equals: should have all the correct properties lengths differ, expected 8 got 7 -PASS ReadableStream constructor should throw for non-function start arguments -PASS ReadableStream constructor will not tolerate initial garbage as cancel argument -PASS ReadableStream constructor will not tolerate initial garbage as pull argument -FAIL ReadableStream start should be called with the proper parameters assert_equals: enqueue should have 1 parameter expected 1 but got 0 -PASS ReadableStream start controller parameter should be extensible -PASS default ReadableStream getReader() should only accept mode:undefined -PASS ReadableStream should be able to call start method within prototype chain of its source -PASS ReadableStream start should be able to return a promise -PASS ReadableStream start should be able to return a promise and reject it -PASS ReadableStream should be able to enqueue different objects. -PASS ReadableStream: if pull rejects, it should error the stream -PASS ReadableStream: should only call pull once upon starting the stream -PASS ReadableStream: should call pull when trying to read from a started, empty stream -PASS ReadableStream: should only call pull once on a non-empty stream read from before start fulfills -PASS ReadableStream: should only call pull once on a non-empty stream read from after start fulfills -PASS ReadableStream: should call pull in reaction to read()ing the last chunk, if not draining -PASS ReadableStream: should not call pull() in reaction to read()ing the last chunk, if draining -PASS ReadableStream: should not call pull until the previous pull call's promise fulfills -PASS ReadableStream: should pull after start, and after every read -PASS ReadableStream: should not call pull after start if the stream is now closed -PASS ReadableStream: should call pull after enqueueing from inside pull (with no read requests), if strategy allows -PASS ReadableStream pull should be able to close a stream. -PASS ReadableStream pull should be able to error a stream. -PASS ReadableStream pull should be able to error a stream and throw. -PASS ReadableStream: enqueue should throw when the stream is readable but draining -PASS ReadableStream: enqueue should throw when the stream is closed -PASS ReadableStream: should call underlying source methods as methods -PASS ReadableStream: desiredSize when closed -PASS ReadableStream: desiredSize when errored -PASS Subclassing ReadableStream should work -PASS ReadableStream strategies: the default strategy should give desiredSize of 1 to start, decreasing by 1 per enqueue -PASS ReadableStream strategies: the default strategy should continue giving desiredSize of 1 if the chunks are read immediately -PASS ReadableStream integration test: adapting a random push source -PASS ReadableStream integration test: adapting a sync pull source -PASS ReadableStream integration test: adapting an async pull source -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/general.any.sharedworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/general.any.sharedworker-expected.txt deleted file mode 100644 index 0d1c378..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/general.any.sharedworker-expected.txt +++ /dev/null
@@ -1,42 +0,0 @@ -This is a testharness.js-based test. -PASS ReadableStream can be constructed with no errors -PASS ReadableStream can't be constructed with garbage -PASS ReadableStream can't be constructed with an invalid type -FAIL ReadableStream instances should have the correct list of properties assert_array_equals: should have all the correct properties lengths differ, expected 8 got 7 -PASS ReadableStream constructor should throw for non-function start arguments -PASS ReadableStream constructor will not tolerate initial garbage as cancel argument -PASS ReadableStream constructor will not tolerate initial garbage as pull argument -FAIL ReadableStream start should be called with the proper parameters assert_equals: enqueue should have 1 parameter expected 1 but got 0 -PASS ReadableStream start controller parameter should be extensible -PASS default ReadableStream getReader() should only accept mode:undefined -PASS ReadableStream should be able to call start method within prototype chain of its source -PASS ReadableStream start should be able to return a promise -PASS ReadableStream start should be able to return a promise and reject it -PASS ReadableStream should be able to enqueue different objects. -PASS ReadableStream: if pull rejects, it should error the stream -PASS ReadableStream: should only call pull once upon starting the stream -PASS ReadableStream: should call pull when trying to read from a started, empty stream -PASS ReadableStream: should only call pull once on a non-empty stream read from before start fulfills -PASS ReadableStream: should only call pull once on a non-empty stream read from after start fulfills -PASS ReadableStream: should call pull in reaction to read()ing the last chunk, if not draining -PASS ReadableStream: should not call pull() in reaction to read()ing the last chunk, if draining -PASS ReadableStream: should not call pull until the previous pull call's promise fulfills -PASS ReadableStream: should pull after start, and after every read -PASS ReadableStream: should not call pull after start if the stream is now closed -PASS ReadableStream: should call pull after enqueueing from inside pull (with no read requests), if strategy allows -PASS ReadableStream pull should be able to close a stream. -PASS ReadableStream pull should be able to error a stream. -PASS ReadableStream pull should be able to error a stream and throw. -PASS ReadableStream: enqueue should throw when the stream is readable but draining -PASS ReadableStream: enqueue should throw when the stream is closed -PASS ReadableStream: should call underlying source methods as methods -PASS ReadableStream: desiredSize when closed -PASS ReadableStream: desiredSize when errored -PASS Subclassing ReadableStream should work -PASS ReadableStream strategies: the default strategy should give desiredSize of 1 to start, decreasing by 1 per enqueue -PASS ReadableStream strategies: the default strategy should continue giving desiredSize of 1 if the chunks are read immediately -PASS ReadableStream integration test: adapting a random push source -PASS ReadableStream integration test: adapting a sync pull source -PASS ReadableStream integration test: adapting an async pull source -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/general.any.worker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/general.any.worker-expected.txt deleted file mode 100644 index 0d1c378..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/general.any.worker-expected.txt +++ /dev/null
@@ -1,42 +0,0 @@ -This is a testharness.js-based test. -PASS ReadableStream can be constructed with no errors -PASS ReadableStream can't be constructed with garbage -PASS ReadableStream can't be constructed with an invalid type -FAIL ReadableStream instances should have the correct list of properties assert_array_equals: should have all the correct properties lengths differ, expected 8 got 7 -PASS ReadableStream constructor should throw for non-function start arguments -PASS ReadableStream constructor will not tolerate initial garbage as cancel argument -PASS ReadableStream constructor will not tolerate initial garbage as pull argument -FAIL ReadableStream start should be called with the proper parameters assert_equals: enqueue should have 1 parameter expected 1 but got 0 -PASS ReadableStream start controller parameter should be extensible -PASS default ReadableStream getReader() should only accept mode:undefined -PASS ReadableStream should be able to call start method within prototype chain of its source -PASS ReadableStream start should be able to return a promise -PASS ReadableStream start should be able to return a promise and reject it -PASS ReadableStream should be able to enqueue different objects. -PASS ReadableStream: if pull rejects, it should error the stream -PASS ReadableStream: should only call pull once upon starting the stream -PASS ReadableStream: should call pull when trying to read from a started, empty stream -PASS ReadableStream: should only call pull once on a non-empty stream read from before start fulfills -PASS ReadableStream: should only call pull once on a non-empty stream read from after start fulfills -PASS ReadableStream: should call pull in reaction to read()ing the last chunk, if not draining -PASS ReadableStream: should not call pull() in reaction to read()ing the last chunk, if draining -PASS ReadableStream: should not call pull until the previous pull call's promise fulfills -PASS ReadableStream: should pull after start, and after every read -PASS ReadableStream: should not call pull after start if the stream is now closed -PASS ReadableStream: should call pull after enqueueing from inside pull (with no read requests), if strategy allows -PASS ReadableStream pull should be able to close a stream. -PASS ReadableStream pull should be able to error a stream. -PASS ReadableStream pull should be able to error a stream and throw. -PASS ReadableStream: enqueue should throw when the stream is readable but draining -PASS ReadableStream: enqueue should throw when the stream is closed -PASS ReadableStream: should call underlying source methods as methods -PASS ReadableStream: desiredSize when closed -PASS ReadableStream: desiredSize when errored -PASS Subclassing ReadableStream should work -PASS ReadableStream strategies: the default strategy should give desiredSize of 1 to start, decreasing by 1 per enqueue -PASS ReadableStream strategies: the default strategy should continue giving desiredSize of 1 if the chunks are read immediately -PASS ReadableStream integration test: adapting a random push source -PASS ReadableStream integration test: adapting a sync pull source -PASS ReadableStream integration test: adapting an async pull source -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/properties.any-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/properties.any-expected.txt deleted file mode 100644 index 7f3b446..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/properties.any-expected.txt +++ /dev/null
@@ -1,48 +0,0 @@ -This is a testharness.js-based test. -PASS WritableStreamDefaultController should not be exported on the global object -FAIL WritableStreamDefaultWriter should not be exported on the global object assert_equals: WritableStreamDefaultWriter should not be defined expected (undefined) undefined but got (function) function "function WritableStreamDefaultWriter() { [native code] }" -PASS WritableStream.prototype.constructor should have standard properties -PASS WritableStream.prototype.constructor should be a constructor -PASS WritableStream.prototype.locked should have standard properties -PASS WritableStream.prototype.locked should be a getter -PASS WritableStream.prototype.abort should have standard properties -FAIL WritableStream.prototype.abort should be a method assert_equals: abort should take 1 arguments expected 1 but got 0 -PASS WritableStream.prototype.getWriter should have standard properties -PASS WritableStream.prototype.getWriter should be a method -PASS WritableStream.prototype should have exactly the expected properties -PASS WritableStreamDefaultController.prototype.constructor should have standard properties -PASS WritableStreamDefaultController.prototype.constructor should be a constructor -PASS WritableStreamDefaultController.prototype.error should have standard properties -FAIL WritableStreamDefaultController.prototype.error should be a method assert_equals: error should take 1 arguments expected 1 but got 0 -PASS WritableStreamDefaultController.prototype should have exactly the expected properties -PASS WritableStreamDefaultWriter.prototype.constructor should have standard properties -PASS WritableStreamDefaultWriter.prototype.constructor should be a constructor -PASS WritableStreamDefaultWriter.prototype.closed should have standard properties -PASS WritableStreamDefaultWriter.prototype.closed should be a getter -PASS WritableStreamDefaultWriter.prototype.desiredSize should have standard properties -PASS WritableStreamDefaultWriter.prototype.desiredSize should be a getter -PASS WritableStreamDefaultWriter.prototype.ready should have standard properties -PASS WritableStreamDefaultWriter.prototype.ready should be a getter -PASS WritableStreamDefaultWriter.prototype.abort should have standard properties -FAIL WritableStreamDefaultWriter.prototype.abort should be a method assert_equals: abort should take 1 arguments expected 1 but got 0 -PASS WritableStreamDefaultWriter.prototype.close should have standard properties -PASS WritableStreamDefaultWriter.prototype.close should be a method -PASS WritableStreamDefaultWriter.prototype.releaseLock should have standard properties -PASS WritableStreamDefaultWriter.prototype.releaseLock should be a method -PASS WritableStreamDefaultWriter.prototype.write should have standard properties -FAIL WritableStreamDefaultWriter.prototype.write should be a method assert_equals: write should take 1 arguments expected 1 but got 0 -PASS WritableStreamDefaultWriter.prototype should have exactly the expected properties -PASS sink method start should be called with the right number of arguments -PASS sink method start should be called even when it's located on the prototype chain -PASS unexpected properties should not be accessed when calling sink method start -PASS sink method write should be called with the right number of arguments -PASS sink method write should be called even when it's located on the prototype chain -PASS unexpected properties should not be accessed when calling sink method write -PASS sink method close should be called with the right number of arguments -PASS sink method close should be called even when it's located on the prototype chain -PASS unexpected properties should not be accessed when calling sink method close -PASS sink method abort should be called with the right number of arguments -PASS sink method abort should be called even when it's located on the prototype chain -PASS unexpected properties should not be accessed when calling sink method abort -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/properties.any.serviceworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/properties.any.serviceworker-expected.txt deleted file mode 100644 index 7f3b446..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/properties.any.serviceworker-expected.txt +++ /dev/null
@@ -1,48 +0,0 @@ -This is a testharness.js-based test. -PASS WritableStreamDefaultController should not be exported on the global object -FAIL WritableStreamDefaultWriter should not be exported on the global object assert_equals: WritableStreamDefaultWriter should not be defined expected (undefined) undefined but got (function) function "function WritableStreamDefaultWriter() { [native code] }" -PASS WritableStream.prototype.constructor should have standard properties -PASS WritableStream.prototype.constructor should be a constructor -PASS WritableStream.prototype.locked should have standard properties -PASS WritableStream.prototype.locked should be a getter -PASS WritableStream.prototype.abort should have standard properties -FAIL WritableStream.prototype.abort should be a method assert_equals: abort should take 1 arguments expected 1 but got 0 -PASS WritableStream.prototype.getWriter should have standard properties -PASS WritableStream.prototype.getWriter should be a method -PASS WritableStream.prototype should have exactly the expected properties -PASS WritableStreamDefaultController.prototype.constructor should have standard properties -PASS WritableStreamDefaultController.prototype.constructor should be a constructor -PASS WritableStreamDefaultController.prototype.error should have standard properties -FAIL WritableStreamDefaultController.prototype.error should be a method assert_equals: error should take 1 arguments expected 1 but got 0 -PASS WritableStreamDefaultController.prototype should have exactly the expected properties -PASS WritableStreamDefaultWriter.prototype.constructor should have standard properties -PASS WritableStreamDefaultWriter.prototype.constructor should be a constructor -PASS WritableStreamDefaultWriter.prototype.closed should have standard properties -PASS WritableStreamDefaultWriter.prototype.closed should be a getter -PASS WritableStreamDefaultWriter.prototype.desiredSize should have standard properties -PASS WritableStreamDefaultWriter.prototype.desiredSize should be a getter -PASS WritableStreamDefaultWriter.prototype.ready should have standard properties -PASS WritableStreamDefaultWriter.prototype.ready should be a getter -PASS WritableStreamDefaultWriter.prototype.abort should have standard properties -FAIL WritableStreamDefaultWriter.prototype.abort should be a method assert_equals: abort should take 1 arguments expected 1 but got 0 -PASS WritableStreamDefaultWriter.prototype.close should have standard properties -PASS WritableStreamDefaultWriter.prototype.close should be a method -PASS WritableStreamDefaultWriter.prototype.releaseLock should have standard properties -PASS WritableStreamDefaultWriter.prototype.releaseLock should be a method -PASS WritableStreamDefaultWriter.prototype.write should have standard properties -FAIL WritableStreamDefaultWriter.prototype.write should be a method assert_equals: write should take 1 arguments expected 1 but got 0 -PASS WritableStreamDefaultWriter.prototype should have exactly the expected properties -PASS sink method start should be called with the right number of arguments -PASS sink method start should be called even when it's located on the prototype chain -PASS unexpected properties should not be accessed when calling sink method start -PASS sink method write should be called with the right number of arguments -PASS sink method write should be called even when it's located on the prototype chain -PASS unexpected properties should not be accessed when calling sink method write -PASS sink method close should be called with the right number of arguments -PASS sink method close should be called even when it's located on the prototype chain -PASS unexpected properties should not be accessed when calling sink method close -PASS sink method abort should be called with the right number of arguments -PASS sink method abort should be called even when it's located on the prototype chain -PASS unexpected properties should not be accessed when calling sink method abort -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/properties.any.sharedworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/properties.any.sharedworker-expected.txt deleted file mode 100644 index 7f3b446..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/properties.any.sharedworker-expected.txt +++ /dev/null
@@ -1,48 +0,0 @@ -This is a testharness.js-based test. -PASS WritableStreamDefaultController should not be exported on the global object -FAIL WritableStreamDefaultWriter should not be exported on the global object assert_equals: WritableStreamDefaultWriter should not be defined expected (undefined) undefined but got (function) function "function WritableStreamDefaultWriter() { [native code] }" -PASS WritableStream.prototype.constructor should have standard properties -PASS WritableStream.prototype.constructor should be a constructor -PASS WritableStream.prototype.locked should have standard properties -PASS WritableStream.prototype.locked should be a getter -PASS WritableStream.prototype.abort should have standard properties -FAIL WritableStream.prototype.abort should be a method assert_equals: abort should take 1 arguments expected 1 but got 0 -PASS WritableStream.prototype.getWriter should have standard properties -PASS WritableStream.prototype.getWriter should be a method -PASS WritableStream.prototype should have exactly the expected properties -PASS WritableStreamDefaultController.prototype.constructor should have standard properties -PASS WritableStreamDefaultController.prototype.constructor should be a constructor -PASS WritableStreamDefaultController.prototype.error should have standard properties -FAIL WritableStreamDefaultController.prototype.error should be a method assert_equals: error should take 1 arguments expected 1 but got 0 -PASS WritableStreamDefaultController.prototype should have exactly the expected properties -PASS WritableStreamDefaultWriter.prototype.constructor should have standard properties -PASS WritableStreamDefaultWriter.prototype.constructor should be a constructor -PASS WritableStreamDefaultWriter.prototype.closed should have standard properties -PASS WritableStreamDefaultWriter.prototype.closed should be a getter -PASS WritableStreamDefaultWriter.prototype.desiredSize should have standard properties -PASS WritableStreamDefaultWriter.prototype.desiredSize should be a getter -PASS WritableStreamDefaultWriter.prototype.ready should have standard properties -PASS WritableStreamDefaultWriter.prototype.ready should be a getter -PASS WritableStreamDefaultWriter.prototype.abort should have standard properties -FAIL WritableStreamDefaultWriter.prototype.abort should be a method assert_equals: abort should take 1 arguments expected 1 but got 0 -PASS WritableStreamDefaultWriter.prototype.close should have standard properties -PASS WritableStreamDefaultWriter.prototype.close should be a method -PASS WritableStreamDefaultWriter.prototype.releaseLock should have standard properties -PASS WritableStreamDefaultWriter.prototype.releaseLock should be a method -PASS WritableStreamDefaultWriter.prototype.write should have standard properties -FAIL WritableStreamDefaultWriter.prototype.write should be a method assert_equals: write should take 1 arguments expected 1 but got 0 -PASS WritableStreamDefaultWriter.prototype should have exactly the expected properties -PASS sink method start should be called with the right number of arguments -PASS sink method start should be called even when it's located on the prototype chain -PASS unexpected properties should not be accessed when calling sink method start -PASS sink method write should be called with the right number of arguments -PASS sink method write should be called even when it's located on the prototype chain -PASS unexpected properties should not be accessed when calling sink method write -PASS sink method close should be called with the right number of arguments -PASS sink method close should be called even when it's located on the prototype chain -PASS unexpected properties should not be accessed when calling sink method close -PASS sink method abort should be called with the right number of arguments -PASS sink method abort should be called even when it's located on the prototype chain -PASS unexpected properties should not be accessed when calling sink method abort -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/properties.any.worker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/properties.any.worker-expected.txt deleted file mode 100644 index 7f3b446..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/writable-streams/properties.any.worker-expected.txt +++ /dev/null
@@ -1,48 +0,0 @@ -This is a testharness.js-based test. -PASS WritableStreamDefaultController should not be exported on the global object -FAIL WritableStreamDefaultWriter should not be exported on the global object assert_equals: WritableStreamDefaultWriter should not be defined expected (undefined) undefined but got (function) function "function WritableStreamDefaultWriter() { [native code] }" -PASS WritableStream.prototype.constructor should have standard properties -PASS WritableStream.prototype.constructor should be a constructor -PASS WritableStream.prototype.locked should have standard properties -PASS WritableStream.prototype.locked should be a getter -PASS WritableStream.prototype.abort should have standard properties -FAIL WritableStream.prototype.abort should be a method assert_equals: abort should take 1 arguments expected 1 but got 0 -PASS WritableStream.prototype.getWriter should have standard properties -PASS WritableStream.prototype.getWriter should be a method -PASS WritableStream.prototype should have exactly the expected properties -PASS WritableStreamDefaultController.prototype.constructor should have standard properties -PASS WritableStreamDefaultController.prototype.constructor should be a constructor -PASS WritableStreamDefaultController.prototype.error should have standard properties -FAIL WritableStreamDefaultController.prototype.error should be a method assert_equals: error should take 1 arguments expected 1 but got 0 -PASS WritableStreamDefaultController.prototype should have exactly the expected properties -PASS WritableStreamDefaultWriter.prototype.constructor should have standard properties -PASS WritableStreamDefaultWriter.prototype.constructor should be a constructor -PASS WritableStreamDefaultWriter.prototype.closed should have standard properties -PASS WritableStreamDefaultWriter.prototype.closed should be a getter -PASS WritableStreamDefaultWriter.prototype.desiredSize should have standard properties -PASS WritableStreamDefaultWriter.prototype.desiredSize should be a getter -PASS WritableStreamDefaultWriter.prototype.ready should have standard properties -PASS WritableStreamDefaultWriter.prototype.ready should be a getter -PASS WritableStreamDefaultWriter.prototype.abort should have standard properties -FAIL WritableStreamDefaultWriter.prototype.abort should be a method assert_equals: abort should take 1 arguments expected 1 but got 0 -PASS WritableStreamDefaultWriter.prototype.close should have standard properties -PASS WritableStreamDefaultWriter.prototype.close should be a method -PASS WritableStreamDefaultWriter.prototype.releaseLock should have standard properties -PASS WritableStreamDefaultWriter.prototype.releaseLock should be a method -PASS WritableStreamDefaultWriter.prototype.write should have standard properties -FAIL WritableStreamDefaultWriter.prototype.write should be a method assert_equals: write should take 1 arguments expected 1 but got 0 -PASS WritableStreamDefaultWriter.prototype should have exactly the expected properties -PASS sink method start should be called with the right number of arguments -PASS sink method start should be called even when it's located on the prototype chain -PASS unexpected properties should not be accessed when calling sink method start -PASS sink method write should be called with the right number of arguments -PASS sink method write should be called even when it's located on the prototype chain -PASS unexpected properties should not be accessed when calling sink method write -PASS sink method close should be called with the right number of arguments -PASS sink method close should be called even when it's located on the prototype chain -PASS unexpected properties should not be accessed when calling sink method close -PASS sink method abort should be called with the right number of arguments -PASS sink method abort should be called even when it's located on the prototype chain -PASS unexpected properties should not be accessed when calling sink method abort -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/http/tests/streams/chromium/err-invalid-hwm-expected.txt b/third_party/blink/web_tests/virtual/streams-native/http/tests/streams/chromium/err-invalid-hwm-expected.txt deleted file mode 100644 index 7597481..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/http/tests/streams/chromium/err-invalid-hwm-expected.txt +++ /dev/null
@@ -1,5 +0,0 @@ -This is a testharness.js-based test. -FAIL ReadableStream RangeError on invalid highWaterMark should have an appropriate message assert_equals: message should be relevant expected "A queueing strategy's highWaterMark property must be a nonnegative, non-NaN number" but got "Failed to construct 'ReadableStream': A queuing strategy's highWaterMark property must be a nonnegative, non-NaN number" -FAIL WritableStream RangeError on invalid highWaterMark should have an appropriate message assert_equals: message should be relevant expected "A queueing strategy's highWaterMark property must be a nonnegative, non-NaN number" but got "Failed to construct 'WritableStream': A queuing strategy's highWaterMark property must be a nonnegative, non-NaN number" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt index cb0882f..608b4ca5 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -1084,6 +1084,13 @@ [Worker] method pipeThrough [Worker] method pipeTo [Worker] method tee +[Worker] interface ReadableStreamDefaultReader +[Worker] attribute @@toStringTag +[Worker] getter closed +[Worker] method cancel +[Worker] method constructor +[Worker] method read +[Worker] method releaseLock [Worker] interface Request [Worker] attribute @@toStringTag [Worker] getter bodyUsed @@ -3676,6 +3683,16 @@ [Worker] method abort [Worker] method constructor [Worker] method getWriter +[Worker] interface WritableStreamDefaultWriter +[Worker] attribute @@toStringTag +[Worker] getter closed +[Worker] getter desiredSize +[Worker] getter ready +[Worker] method abort +[Worker] method close +[Worker] method constructor +[Worker] method releaseLock +[Worker] method write [Worker] interface XMLHttpRequest : XMLHttpRequestEventTarget [Worker] attribute @@toStringTag [Worker] attribute DONE
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt index 0aa449a5..7b41786 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt
@@ -6048,6 +6048,13 @@ method pipeThrough method pipeTo method tee +interface ReadableStreamDefaultReader + attribute @@toStringTag + getter closed + method cancel + method constructor + method read + method releaseLock interface RelativeOrientationSensor : OrientationSensor attribute @@toStringTag method constructor @@ -10483,6 +10490,16 @@ method abort method constructor method getWriter +interface WritableStreamDefaultWriter + attribute @@toStringTag + getter closed + getter desiredSize + getter ready + method abort + method close + method constructor + method releaseLock + method write interface XMLDocument : Document attribute @@toStringTag method constructor
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt index 8575d5f..e367e63f 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -1066,6 +1066,13 @@ [Worker] method pipeThrough [Worker] method pipeTo [Worker] method tee +[Worker] interface ReadableStreamDefaultReader +[Worker] attribute @@toStringTag +[Worker] getter closed +[Worker] method cancel +[Worker] method constructor +[Worker] method read +[Worker] method releaseLock [Worker] interface Request [Worker] attribute @@toStringTag [Worker] getter bodyUsed @@ -3531,6 +3538,16 @@ [Worker] method abort [Worker] method constructor [Worker] method getWriter +[Worker] interface WritableStreamDefaultWriter +[Worker] attribute @@toStringTag +[Worker] getter closed +[Worker] getter desiredSize +[Worker] getter ready +[Worker] method abort +[Worker] method close +[Worker] method constructor +[Worker] method releaseLock +[Worker] method write [Worker] interface XMLHttpRequest : XMLHttpRequestEventTarget [Worker] attribute @@toStringTag [Worker] attribute DONE
diff --git a/tools/clang/scripts/build.py b/tools/clang/scripts/build.py index cde67bd9..23b7610a 100755 --- a/tools/clang/scripts/build.py +++ b/tools/clang/scripts/build.py
@@ -24,9 +24,9 @@ from update import (CDS_URL, CHROMIUM_DIR, CLANG_REVISION, LLVM_BUILD_DIR, FORCE_HEAD_REVISION_FILE, PACKAGE_VERSION, RELEASE_VERSION, - STAMP_FILE, CopyFile, CopyDiaDllTo, DownloadAndUnpack, - EnsureDirExists, GetWinSDKDir, ReadStampFile, RmTree, - WriteStampFile) + STAMP_FILE, CopyFile, CopyDiaDllTo, DownloadUrl, + DownloadAndUnpack, EnsureDirExists, GetWinSDKDir, + ReadStampFile, RmTree, WriteStampFile) # Path constants. (All of these should be absolute paths.) @@ -36,6 +36,8 @@ LLVM_BOOTSTRAP_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-bootstrap') LLVM_BOOTSTRAP_INSTALL_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-bootstrap-install') +LLVM_INSTRUMENTED_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-instrumented') +LLVM_PROFDATA_FILE = os.path.join(LLVM_INSTRUMENTED_DIR, 'profdata.prof') CHROME_TOOLS_SHIM_DIR = os.path.join(LLVM_DIR, 'llvm', 'tools', 'chrometools') THREADS_ENABLED_BUILD_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-threads-enabled') @@ -277,6 +279,7 @@ parser.add_argument('--gcc-toolchain', help='(no longer used)') 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') parser.add_argument('--run-tests', action='store_true', @@ -309,6 +312,9 @@ # 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 if args.with_android and not os.path.exists(ANDROID_NDK_DIR): print('Android NDK not found at ' + ANDROID_NDK_DIR) print('The Android NDK is needed to build a Clang whose -fsanitize=address') @@ -396,6 +402,8 @@ '-DBUG_REPORT_URL=' + BUG_REPORT_URL, # See PR41956: Don't link libcxx into libfuzzer. '-DCOMPILER_RT_USE_LIBCXX=NO', + # Don't run Go bindings tests; PGO makes them confused. + '-DLLVM_INCLUDE_GO_TESTS=OFF', ] if sys.platform == 'win32': @@ -419,7 +427,12 @@ os.chdir(LLVM_BOOTSTRAP_DIR) projects = 'clang' - if args.lto_lld: + if args.pgo: + # Need libclang_rt.profile + projects += ';compiler-rt' + if (sys.platform.startswith('linux') and args.pgo) or args.lto_lld: + # Old gnu ld doesn't handle libclang_rt.profile well. + # TODO(crbug.com/958852): Always use lld for later stages. projects += ';lld' if sys.platform == 'darwin': # Need libc++ and compiler-rt for the bootstrap compiler on mac. @@ -448,7 +461,6 @@ "-DCOMPILER_RT_BUILD_BUILTINS=ON", "-DCOMPILER_RT_BUILD_CRT=OFF", "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF", - "-DCOMPILER_RT_BUILD_PROFILE=OFF", "-DCOMPILER_RT_BUILD_SANITIZERS=OFF", "-DCOMPILER_RT_BUILD_XRAY=OFF", "-DCOMPILER_RT_ENABLE_IOS=OFF", @@ -477,7 +489,74 @@ cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang') cxx = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang++') - print('Bootstrap compiler installed; building final compiler.') + print('Bootstrap compiler installed.') + + if args.pgo: + print('Building instrumented compiler') + if os.path.exists(LLVM_INSTRUMENTED_DIR): + RmTree(LLVM_INSTRUMENTED_DIR) + EnsureDirExists(LLVM_INSTRUMENTED_DIR) + os.chdir(LLVM_INSTRUMENTED_DIR) + + projects = 'clang' + if sys.platform == 'darwin': + projects += ';libcxx;compiler-rt' + + instrument_args = base_cmake_args + [ + '-DLLVM_ENABLE_THREADS=OFF', + '-DLLVM_ENABLE_PROJECTS=' + projects, + '-DCMAKE_C_FLAGS=' + ' '.join(cflags), + '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags), + # Build with the bootstrap compiler. + '-DCMAKE_C_COMPILER=' + cc, + '-DCMAKE_CXX_COMPILER=' + cxx, + # Build with instrumentation. + '-DLLVM_BUILD_INSTRUMENTED=IR', + ] + + if sys.platform.startswith('linux'): + # Ubuntu 16's ld doesn't generate __start__ section, so link with lld. + instrument_args.append('-DLLVM_ENABLE_LLD=ON') + + RunCommand(['cmake'] + instrument_args + [os.path.join(LLVM_DIR, 'llvm')], + msvc_arch='x64') + RunCommand(['ninja'], msvc_arch='x64') + print('Instrumented compiler built.') + + # Train by building some C++ code. + # + # pgo_training-1.ii is a preprocessed (on Linux) version of + # src/third_party/blink/renderer/core/layout/layout_object.cc, selected + # because it's a large translation unit in Blink, which is normally the + # slowest part of Chromium to compile. Using this, we get ~20% shorter + # build times for Linux, Android, and Mac, which is also what we got when + # training by actually building a target in Chromium. (For comparison, a + # C++-y "Hello World" program only resulted in 14% faster builds.) + # See https://crbug.com/966403#c16 for all numbers. + # + # TODO(hans): Enhance the training, perhaps by including preprocessed code + # from more platforms, and by doing some linking so that lld can benefit + # from PGO as well. Perhaps the training could be done asynchronously by + # dedicated buildbots that upload profiles to the cloud. + training_source = 'pgo_training-1.ii' + with open(training_source, 'w') as f: + DownloadUrl(CDS_URL + '/' + training_source, f) + train_cmd = [os.path.join(LLVM_INSTRUMENTED_DIR, 'bin', 'clang++'), + '-target', 'x86_64-unknown-unknown', '-O2', '-g', '-std=c++14', + '-fno-exceptions', '-fno-rtti', '-w', '-c', training_source] + if sys.platform == 'darwin': + train_cmd.extend(['-stdlib=libc++', '-isysroot', + subprocess.check_output(['xcrun', + '--show-sdk-path']).rstrip()]) + RunCommand(train_cmd, msvc_arch='x64') + + # Merge profiles. + profdata = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'llvm-profdata') + RunCommand([profdata, 'merge', '-output=' + LLVM_PROFDATA_FILE] + + glob.glob(os.path.join(LLVM_INSTRUMENTED_DIR, 'profiles', + '*.profraw')), msvc_arch='x64') + print('Profile generated.') + compiler_rt_args = [ @@ -539,6 +618,7 @@ # Build lld and code coverage tools. This is done separately from the rest of # the build because these tools require threading support. + print('Building thread-enabled tools.') tools_with_threading = [ 'dsymutil', 'lld', 'llvm-cov', 'llvm-profdata' ] print('Building the following tools with threading support: %s' % str(tools_with_threading)) @@ -580,6 +660,8 @@ msvc_arch='x64', env=deployment_env) RunCommand(['ninja'] + tools_with_threading, msvc_arch='x64') + print('Building final compiler.') + default_tools = ['plugins', 'blink_gc_plugin', 'translation_unit'] chrome_tools = list(set(default_tools + args.extra_tools)) if cc is not None: base_cmake_args.append('-DCMAKE_C_COMPILER=' + cc) @@ -594,6 +676,8 @@ '-DCMAKE_INSTALL_PREFIX=' + LLVM_BUILD_DIR, '-DCHROMIUM_TOOLS_SRC=%s' % os.path.join(CHROMIUM_DIR, 'tools', 'clang'), '-DCHROMIUM_TOOLS=%s' % ';'.join(chrome_tools)] + if args.pgo: + cmake_args.append('-DLLVM_PROFDATA_FILE=' + LLVM_PROFDATA_FILE) if sys.platform == 'darwin': cmake_args += ['-DCOMPILER_RT_ENABLE_IOS=ON', '-DSANITIZER_MIN_OSX_VERSION=10.7']
diff --git a/tools/clang/scripts/package.py b/tools/clang/scripts/package.py index d12e632d..551ab81 100755 --- a/tools/clang/scripts/package.py +++ b/tools/clang/scripts/package.py
@@ -192,12 +192,14 @@ shutil.rmtree(LLVM_BOOTSTRAP_INSTALL_DIR, ignore_errors=True) shutil.rmtree(LLVM_BUILD_DIR, ignore_errors=True) - opt_flags = [] - if sys.platform.startswith('linux'): - opt_flags += ['--lto-lld'] build_cmd = [sys.executable, os.path.join(THIS_DIR, 'build.py'), '--bootstrap', '--disable-asserts', - '--run-tests'] + opt_flags + '--run-tests'] + if sys.platform != 'win32': + # TODO(hans): Use --pgo for the Windows package too. + build_cmd.append('--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 fd0dd559..8aa83b1 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py
@@ -39,7 +39,7 @@ # Reverting problematic clang rolls is safe, though. CLANG_REVISION = 'd874c057bc2361da5157553e1e2178f43c3ade1a' CLANG_SVN_REVISION = '363790' -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/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 00866c10..02f9746 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -45696,6 +45696,7 @@ <enum name="PasswordSuggestionType"> <int value="0" label="Credential"/> <int value="1" label="Show All"/> + <int value="2" label="Generate password"/> </enum> <enum name="PasswordSyncState">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 978fe64..db5f658 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -9059,7 +9059,7 @@ </histogram> <histogram name="Autofill.DaysSinceLastUse.Profile" units="days" - expires_after="M77"> + expires_after="M83"> <owner>sebsg@chromium.org</owner> <summary> Logged at the time of autofill address use, this histogram captures the @@ -9069,7 +9069,7 @@ </histogram> <histogram name="Autofill.DaysSinceLastUse.StoredCreditCard" units="days" - expires_after="M77"> + expires_after="M83"> <owner>rogerm@chromium.org</owner> <!-- Name completed by histogram_suffixes name="AutofillCreditCardType" --> @@ -9081,7 +9081,7 @@ </histogram> <histogram name="Autofill.DaysSinceLastUse.StoredProfile" units="days" - expires_after="M77"> + expires_after="M83"> <owner>rogerm@chromium.org</owner> <summary> This histogram captures the number of days that have passed since each @@ -9092,7 +9092,7 @@ </histogram> <histogram name="Autofill.DaysSincePreviousUseAtSubmission.Profile" - units="days" expires_after="M77"> + units="days" expires_after="M83"> <owner>csashi@google.com</owner> <owner>jsaul@google.com</owner> <owner>sebsg@chromium.org</owner> @@ -9671,7 +9671,7 @@ </histogram> <histogram name="Autofill.ProfileActionOnFormSubmitted" - enum="AutofillProfileAction" expires_after="M77"> + enum="AutofillProfileAction" expires_after="M83"> <owner>sebsg@chromium.org</owner> <summary> The profile action that took place when a form was submitted. @@ -9848,7 +9848,7 @@ </histogram> <histogram name="Autofill.RationalizationQuality.PhoneNumber" - enum="AutofillRationalizationQualityMetric" expires_after="M77"> + enum="AutofillRationalizationQualityMetric" expires_after="M83"> <owner>wuandy@chromium.org</owner> <summary> The quality of fields rationalization, putting rationalization result into @@ -10102,7 +10102,7 @@ </summary> </histogram> -<histogram name="Autofill.StoredProfileDisusedCount" expires_after="M77"> +<histogram name="Autofill.StoredProfileDisusedCount" expires_after="M83"> <owner>rogerm@chromium.org</owner> <summary> The number of stored Autofill address profiles which have not been used in a @@ -47887,7 +47887,7 @@ </histogram> <histogram name="ImageAnnotationService.AccessibilityV1.CacheHit" - enum="BooleanCacheHit" expires_after="2019-07-30"> + enum="BooleanCacheHit" expires_after="M78"> <owner>amoylan@chromium.org</owner> <owner>martis@chromium.org</owner> <summary> @@ -47898,7 +47898,7 @@ </histogram> <histogram name="ImageAnnotationService.AccessibilityV1.ClientResult" - enum="ImageAnnotationServiceClientResult" expires_after="2019-07-30"> + enum="ImageAnnotationServiceClientResult" expires_after="M78"> <owner>amoylan@chromium.org</owner> <owner>martis@chromium.org</owner> <summary> @@ -47908,7 +47908,7 @@ </histogram> <histogram base="true" name="ImageAnnotationService.AccessibilityV1.Confidence" - units="%" expires_after="2019-07-30"> + units="%" expires_after="M78"> <!-- Name completed by histogram_suffixes name="ImageAnnotationServiceAnnotationType" --> <owner>amoylan@chromium.org</owner> @@ -47921,7 +47921,7 @@ </histogram> <histogram name="ImageAnnotationService.AccessibilityV1.DescType" - enum="ImageAnnotationServiceDescType" expires_after="2019-07-30"> + enum="ImageAnnotationServiceDescType" expires_after="M78"> <owner>amoylan@chromium.org</owner> <owner>martis@chromium.org</owner> <summary> @@ -47931,7 +47931,7 @@ </histogram> <histogram base="true" name="ImageAnnotationService.AccessibilityV1.Empty" - enum="BooleanEmpty" expires_after="2019-07-30"> + enum="BooleanEmpty" expires_after="M78"> <!-- Name completed by histogram_suffixes name="ImageAnnotationServiceAnnotationType" --> <owner>amoylan@chromium.org</owner> @@ -47945,7 +47945,7 @@ </histogram> <histogram name="ImageAnnotationService.AccessibilityV1.EncodedJpegSizeKB" - units="KB" expires_after="2019-07-30"> + units="KB" expires_after="M78"> <owner>amoylan@chromium.org</owner> <owner>martis@chromium.org</owner> <summary> @@ -47955,7 +47955,7 @@ </histogram> <histogram name="ImageAnnotationService.AccessibilityV1.EngineKnown" - enum="BooleanKnown" expires_after="2019-07-30"> + enum="BooleanKnown" expires_after="M78"> <owner>amoylan@chromium.org</owner> <owner>martis@chromium.org</owner> <summary> @@ -47966,7 +47966,7 @@ <histogram name="ImageAnnotationService.AccessibilityV1.ImageRequestIncludesDesc" - enum="BooleanIncluded" expires_after="2019-07-30"> + enum="BooleanIncluded" expires_after="M78"> <owner>amoylan@chromium.org</owner> <owner>martis@chromium.org</owner> <summary> @@ -47980,7 +47980,7 @@ </histogram> <histogram name="ImageAnnotationService.AccessibilityV1.JsonParseSuccess" - enum="BooleanSuccess" expires_after="2019-07-30"> + enum="BooleanSuccess" expires_after="M78"> <owner>amoylan@chromium.org</owner> <owner>martis@chromium.org</owner> <summary> @@ -47990,7 +47990,7 @@ </histogram> <histogram name="ImageAnnotationService.AccessibilityV1.PixelFetchSuccess" - enum="BooleanSuccess" expires_after="2019-07-30"> + enum="BooleanSuccess" expires_after="M78"> <owner>amoylan@chromium.org</owner> <owner>martis@chromium.org</owner> <summary> @@ -48001,7 +48001,7 @@ </histogram> <histogram name="ImageAnnotationService.AccessibilityV1.ServerHttpResponseCode" - enum="HttpResponseCode" expires_after="2019-07-30"> + enum="HttpResponseCode" expires_after="M78"> <owner>amoylan@chromium.org</owner> <owner>martis@chromium.org</owner> <summary> @@ -48011,7 +48011,7 @@ </histogram> <histogram name="ImageAnnotationService.AccessibilityV1.ServerLatencyMs" - units="ms" expires_after="2019-07-30"> + units="ms" expires_after="M78"> <owner>amoylan@chromium.org</owner> <owner>martis@chromium.org</owner> <summary> @@ -48021,7 +48021,7 @@ </histogram> <histogram name="ImageAnnotationService.AccessibilityV1.ServerNetError" - enum="NetErrorCodes" expires_after="2019-07-30"> + enum="NetErrorCodes" expires_after="M78"> <owner>amoylan@chromium.org</owner> <owner>martis@chromium.org</owner> <summary> @@ -48031,7 +48031,7 @@ </histogram> <histogram name="ImageAnnotationService.AccessibilityV1.ServerRequestSizeKB" - units="KB" expires_after="2019-07-30"> + units="KB" expires_after="M78"> <owner>amoylan@chromium.org</owner> <owner>martis@chromium.org</owner> <summary> @@ -48043,7 +48043,7 @@ <histogram name="ImageAnnotationService.AccessibilityV1.ServerResponseSizeBytes" - units="bytes" expires_after="2019-07-30"> + units="bytes" expires_after="M78"> <owner>amoylan@chromium.org</owner> <owner>martis@chromium.org</owner> <summary> @@ -48053,7 +48053,7 @@ </histogram> <histogram name="ImageAnnotationService.AccessibilityV1.SourcePixelCount" - units="pixels" expires_after="2019-07-30"> + units="pixels" expires_after="M78"> <owner>amoylan@chromium.org</owner> <owner>martis@chromium.org</owner> <summary> @@ -48064,7 +48064,7 @@ </histogram> <histogram base="true" name="ImageAnnotationService.AccessibilityV1.Status" - enum="GoogleRpcCode" expires_after="2019-07-30"> + enum="GoogleRpcCode" expires_after="M78"> <!-- Name completed by histogram_suffixes name="ImageAnnotationServiceAnnotationType" --> <owner>amoylan@chromium.org</owner> @@ -91106,7 +91106,7 @@ </histogram> <histogram name="PasswordManager.AbleToSavePasswordsOnSuccessfulLogin" - enum="BooleanSuccess" expires_after="M77"> + enum="BooleanSuccess" expires_after="M85"> <owner>vasilii@chromium.org</owner> <summary> Records attempts to prompt user to save a password when password store is @@ -91156,12 +91156,18 @@ <histogram name="PasswordManager.AccountChooserDialogAccounts" units="accounts" expires_after="M77"> + <obsolete> + Deprecated as of 06/19. + </obsolete> <owner>vasilii@chromium.org</owner> <summary>The number of accounts displayed in the account chooser.</summary> </histogram> <histogram name="PasswordManager.AccountChooserDialogEmptyAvatars" units="avatars" expires_after="M77"> + <obsolete> + Deprecated as of 06/19. + </obsolete> <owner>vasilii@chromium.org</owner> <summary> The count of the placeholder avatars shown in the account chooser. @@ -91169,7 +91175,7 @@ </histogram> <histogram name="PasswordManager.AccountChooserDialogMultipleAccounts" - enum="AccountChooserDismissalReason" expires_after="M77"> + enum="AccountChooserDismissalReason" expires_after="M82"> <owner>vasilii@chromium.org</owner> <summary> The dismissal reason of the account chooser with multiple accounts. @@ -91177,7 +91183,7 @@ </histogram> <histogram name="PasswordManager.AccountChooserDialogOneAccount" - enum="AccountChooserDismissalReason" expires_after="M77"> + enum="AccountChooserDismissalReason" expires_after="M82"> <owner>vasilii@chromium.org</owner> <summary> The dismissal reason of the account chooser with one account. @@ -91186,6 +91192,9 @@ <histogram name="PasswordManager.AccountChooserDialogUsability" enum="AccountChooserUsabilityState" expires_after="M77"> + <obsolete> + Deprecated as of 06/19. + </obsolete> <owner>vasilii@chromium.org</owner> <summary> Whether the account chooser includes an empty username or any duplicates @@ -91477,7 +91486,7 @@ </histogram> <histogram name="PasswordManager.AutoSigninFirstRunDialog" - enum="AutoSigninFirstRun" expires_after="M77"> + enum="AutoSigninFirstRun" expires_after="M82"> <owner>vasilii@chromium.org</owner> <summary> The dismissal reason of the auto-signin first run experience. @@ -92217,6 +92226,9 @@ <histogram name="PasswordManager.LoginDatabaseFailedVersion" expires_after="M77"> + <obsolete> + Deprecated 06/2019. + </obsolete> <owner>vasilii@chromium.org</owner> <summary> The version of LoginDatabase if the migration to a new one failed. @@ -92755,6 +92767,9 @@ <histogram name="PasswordManager.ShouldShowAutoSignInFirstRunExperience" enum="BooleanPending" expires_after="M77"> + <obsolete> + Deprecated 06/2019 + </obsolete> <owner>vasilii@chromium.org</owner> <summary> Records if the user still has to click through the first run experience to @@ -92808,6 +92823,9 @@ <histogram name="PasswordManager.SignInPromo" enum="PasswordBubbleSignInPromoDismissalReason" expires_after="M77"> + <obsolete> + Deprecated as of 06/19. + </obsolete> <owner>vasilii@chromium.org</owner> <summary> User action on the Chrome Sync promo that appears in the password bubble. @@ -92829,6 +92847,9 @@ </histogram> <histogram name="PasswordManager.SignInPromoCountTilNoThanks"> + <obsolete> + Deprecated as of 06/19. + </obsolete> <owner>vasilii@chromium.org</owner> <summary> The number of times the Sign In promo in the password bubble was shown @@ -92837,6 +92858,9 @@ </histogram> <histogram name="PasswordManager.SignInPromoCountTilSignIn" expires_after="M77"> + <obsolete> + Deprecated as of 06/19. + </obsolete> <owner>vasilii@chromium.org</owner> <summary> The number of times the Sign In promo in the password bubble was shown @@ -92845,6 +92869,9 @@ </histogram> <histogram name="PasswordManager.SignInPromoDismissalCount" expires_after="M77"> + <obsolete> + Deprecated as of 06/19. + </obsolete> <owner>vasilii@chromium.org</owner> <summary> The number of times the Sign In promo in the password bubble was implcitly @@ -92998,7 +93025,7 @@ </histogram> <histogram name="PasswordManager.SuggestionClicked" - enum="PasswordSuggestionType" expires_after="M77"> + enum="PasswordSuggestionType" expires_after="M80"> <owner>vasilii@chromium.org</owner> <summary> The type of password suggestion on iOS displayed in the keyboard accessory. @@ -116948,7 +116975,7 @@ </histogram> <histogram name="ServiceWorker.Database.DestroyDatabaseResult" - enum="ServiceWorkerDatabaseStatus" expires_after="M77"> + enum="ServiceWorkerDatabaseStatus" expires_after="2020-06-30"> <owner>nhiroki@chromium.org</owner> <summary> Records result of destroy database operations in ServiceWorkerDatabase. @@ -116956,7 +116983,7 @@ </histogram> <histogram name="ServiceWorker.Database.OpenResult" - enum="ServiceWorkerDatabaseStatus" expires_after="M77"> + enum="ServiceWorkerDatabaseStatus" expires_after="2020-06-30"> <owner>nhiroki@chromium.org</owner> <summary> Records result of opening a database for ServiceWorkerDatabase. @@ -116964,20 +116991,20 @@ </histogram> <histogram name="ServiceWorker.Database.ReadResult" - enum="ServiceWorkerDatabaseStatus" expires_after="M77"> + enum="ServiceWorkerDatabaseStatus" expires_after="2020-06-30"> <owner>nhiroki@chromium.org</owner> <summary>Records result of read operations in ServiceWorkerDatabase.</summary> </histogram> <histogram name="ServiceWorker.Database.WriteResult" - enum="ServiceWorkerDatabaseStatus" expires_after="M77"> + enum="ServiceWorkerDatabaseStatus" expires_after="2020-06-30"> <owner>nhiroki@chromium.org</owner> <summary> Records result of write operations in ServiceWorkerDatabase. </summary> </histogram> -<histogram name="ServiceWorker.DiskCache.InitResult" expires_after="M77"> +<histogram name="ServiceWorker.DiskCache.InitResult" expires_after="2020-06-30"> <owner>nhiroki@chromium.org</owner> <summary> Records result of opening a disk cache for ServiceWorkerDiskCache. @@ -116985,7 +117012,7 @@ </histogram> <histogram name="ServiceWorker.DiskCache.ReadResponseResult" - enum="ServiceWorkerReadResponseResult" expires_after="M77"> + enum="ServiceWorkerReadResponseResult" expires_after="2020-06-30"> <owner>nhiroki@chromium.org</owner> <summary> Records result of reading response from ServiceWorkerDiskCache. @@ -116993,7 +117020,7 @@ </histogram> <histogram name="ServiceWorker.DiskCache.WriteResponseResult" - enum="ServiceWorkerWriteResponseResult" expires_after="M77"> + enum="ServiceWorkerWriteResponseResult" expires_after="2020-06-30"> <owner>bashi@chromium.org</owner> <owner>nhiroki@chromium.org</owner> <summary> @@ -118334,7 +118361,7 @@ </histogram> <histogram name="ServiceWorker.Storage.PurgeResourceResult" - enum="NetErrorCodes" expires_after="M77"> + enum="NetErrorCodes" expires_after="2020-06-30"> <owner>nhiroki@chromium.org</owner> <summary> Records successes and failures of purging a stale resource in @@ -120511,6 +120538,9 @@ </histogram> <histogram name="SharedWorker.TimeToDeleted" units="ms" expires_after="M77"> + <obsolete> + Removed June 2019. + </obsolete> <owner>horo@chromium.org</owner> <summary> The lifetime of a SharedWorkerHost. This roughly corresponds to the lifetime @@ -120520,6 +120550,9 @@ <histogram name="SharedWorker.TimeToScriptLoaded" units="ms" expires_after="M77"> + <obsolete> + Removed June 2019. + </obsolete> <owner>horo@chromium.org</owner> <summary> The time from the creation of SharedWorkerHost until when WorkerScriptLoaded @@ -120529,6 +120562,9 @@ <histogram name="SharedWorker.TimeToScriptLoadFailed" units="ms" expires_after="M77"> + <obsolete> + Removed June 2019. + </obsolete> <owner>horo@chromium.org</owner> <summary> The time from the creation of SharedWorkerHost until when @@ -121672,7 +121708,11 @@ </histogram> <histogram name="Signin.TokenTable.GetAllTokensSqlStatementValidity" - enum="BooleanValid" expires_after="M77"> + enum="BooleanValid" expires_after="never"> +<!-- expires-never: This reports SQL validity statements for loading +authentication refresh tokens from the database and therefore should be kept +for as long as we store refresh tokens in an SQLite DB. --> + <owner>msarda@chromium.org</owner> <summary> Counts how many times the SQL statements to get all tokens is valid. @@ -121680,7 +121720,11 @@ </histogram> <histogram name="Signin.TokenTable.ReadTokenFromDBResult" - enum="SigninTokenTableReadTokenFromDBResult" expires_after="M77"> + enum="SigninTokenTableReadTokenFromDBResult" expires_after="never"> +<!-- expires-never: This reports health status for loading authentication +refresh tokens from the database and decrypting them and therefore +should be kept for as long as we store refresh tokens in an SQLite DB. --> + <owner>msarda@chromium.org</owner> <summary> Counts the results of loading a refresh token from the token database. @@ -148603,7 +148647,7 @@ </histogram> <histogram name="WorkerThread.ExitCode" enum="WorkerThreadExitCode" - expires_after="M77"> + expires_after="2020-06-30"> <owner>nhiroki@chromium.org</owner> <summary>Records the exit code of WorkerThread.</summary> </histogram>
diff --git a/tools/metrics/ukm/ukm.xml b/tools/metrics/ukm/ukm.xml index 80ecbf0f..b57a329b 100644 --- a/tools/metrics/ukm/ukm.xml +++ b/tools/metrics/ukm/ukm.xml
@@ -2955,6 +2955,45 @@ </metric> </event> +<event name="IOS.RendererGone"> + <owner>olivierrobin@chromium.org</owner> + <summary> + Logged when WKWebView process is reported gone. Metrics will give + information of the context in which some website present sad tabs. It will + help debug some renderer issues either in Chrome or in WebKit. + </summary> + <metric name="AliveRecentlyRendererCount"> + <summary> + The number of WKWebView alive in the last 2 seconds. + </summary> + </metric> + <metric name="AliveRendererCount"> + <summary> + The number of WKWebView alive at the moment this renderer is gone. + </summary> + </metric> + <metric name="InForeground" enum="TabForegroundState"> + <summary> + Whether the app/tab was in foregound or background. 0: tab in foreground, + app in foreground, 1: tab in background, app in foreground, 2: tab in + foreground, app in background, 3: tab in background, app in background. + </summary> + <aggregation> + <history> + <statistics> + <enumeration/> + </statistics> + </history> + </aggregation> + </metric> + <metric name="SawMemoryWarning" enum="Boolean"> + <summary> + Whether a memory warning was received less than 5 seconds before the + renderer process is gone. + </summary> + </metric> +</event> + <event name="IOS.URLMismatchInLegacyAndSlimNavigationManager"> <owner>eugenebut@chromium.org</owner> <owner>danyao@chromium.org</owner>
diff --git a/tools/perf/contrib/oilpan/oilpan_gc_times_unittest.py b/tools/perf/contrib/oilpan/oilpan_gc_times_unittest.py index 22f7d129..19f65e5 100644 --- a/tools/perf/contrib/oilpan/oilpan_gc_times_unittest.py +++ b/tools/perf/contrib/oilpan/oilpan_gc_times_unittest.py
@@ -34,9 +34,6 @@ self._renderer_thread = self._renderer_process.GetOrCreateThread(2) self._renderer_thread.name = thread_name self._results = page_test_results.PageTestResults() - self._results.telemetry_info.benchmark_name = 'benchmark' - self._results.telemetry_info.benchmark_start_epoch = 123 - self._results.telemetry_info.benchmark_descriptions = 'foo' @property def results(self):
diff --git a/tools/traffic_annotation/bin/linux64/traffic_annotation_auditor.sha1 b/tools/traffic_annotation/bin/linux64/traffic_annotation_auditor.sha1 index e2ec441b..1b43dcba 100644 --- a/tools/traffic_annotation/bin/linux64/traffic_annotation_auditor.sha1 +++ b/tools/traffic_annotation/bin/linux64/traffic_annotation_auditor.sha1
@@ -1 +1 @@ -198682969f5828ec0081960c973c97b11269b8c1 \ No newline at end of file +b7c7913c62ac2423106fe2f35e45d3f5dcdff190 \ No newline at end of file
diff --git a/tools/traffic_annotation/bin/win32/traffic_annotation_auditor.exe.sha1 b/tools/traffic_annotation/bin/win32/traffic_annotation_auditor.exe.sha1 index 0c16c44..f784177 100644 --- a/tools/traffic_annotation/bin/win32/traffic_annotation_auditor.exe.sha1 +++ b/tools/traffic_annotation/bin/win32/traffic_annotation_auditor.exe.sha1
@@ -1 +1 @@ -9cfcdb168b14e3d7252207cafb9f5c4794311b6a \ No newline at end of file +e37f10baabd3f87f6d7236e0dc32b100af415f0d \ No newline at end of file
diff --git a/ui/accessibility/platform/ax_platform_node_auralinux.cc b/ui/accessibility/platform/ax_platform_node_auralinux.cc index 86b8519..d076722 100644 --- a/ui/accessibility/platform/ax_platform_node_auralinux.cc +++ b/ui/accessibility/platform/ax_platform_node_auralinux.cc
@@ -2045,8 +2045,10 @@ } if (atk_object_) { + // We explicitly clear g_current_focused and g_current_active_descendant + // just in case there is another reference to atk_object_ somewhere. if (atk_object_ == g_current_focused) - g_current_focused = nullptr; + SetWeakGPtrToAtkObject(&g_current_focused, nullptr); if (atk_object_ == g_current_active_descendant) SetWeakGPtrToAtkObject(&g_current_active_descendant, nullptr); atk_object::Detach(AX_PLATFORM_NODE_AURALINUX(atk_object_)); @@ -2950,7 +2952,7 @@ ATK_STATE_FOCUSED, false); } - g_current_focused = atk_object_; + SetWeakGPtrToAtkObject(&g_current_focused, atk_object_); g_signal_emit_by_name(atk_object_, "focus-event", true); atk_object_notify_state_change(ATK_OBJECT(atk_object_), ATK_STATE_FOCUSED, true);
diff --git a/ui/chromeos/file_manager_strings.grdp b/ui/chromeos/file_manager_strings.grdp index a32f0f1..e2702b1 100644 --- a/ui/chromeos/file_manager_strings.grdp +++ b/ui/chromeos/file_manager_strings.grdp
@@ -864,6 +864,25 @@ Formatting the removable media is going to erase all data. Do you wish to continue? </message> + <message name="IDS_FILE_BROWSER_FORMAT_DIALOG_TITLE" desc="Title of the format USB drive dialog."> + Format <ph name="DRIVE_NAME">$1<ex>Untitled USB</ex></ph> + </message> + <message name="IDS_FILE_BROWSER_FORMAT_DIALOG_MESSAGE" desc="Advisory message shown before formatting a USB drive."> + Formatting a drive will delete all data stored on it. This action cannot be undone. + </message> + <message name="IDS_FILE_BROWSER_FORMAT_DIALOG_DELETE_WARNING" desc="Advisory message shown before formatting a USB drive that contains files."> + <ph name="TOTAL_FILE_SIZE">$1<ex>38.3 MB</ex></ph> of files will be deleted + </message> + <message name="IDS_FILE_BROWSER_FORMAT_DIALOG_DRIVE_NAME_LABEL" desc="Label for the USB drive name input field"> + Drive name + </message> + <message name="IDS_FILE_BROWSER_FORMAT_DIALOG_FORMAT_LABEL" desc="Label for the format filesystem selector"> + Format + </message> + <message name="IDS_FILE_BROWSER_FORMAT_DIALOG_CONFIRM_LABEL" desc="Label for the confirm button"> + Erase and Format + </message> + <message name="IDS_FILE_BROWSER_SUGGEST_DIALOG_TITLE" desc="Title of the suggest app dialog, which shows the list of the apps which supports the selected file."> Select an app to open this file </message>
diff --git a/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_CONFIRM_LABEL.png.sha1 b/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_CONFIRM_LABEL.png.sha1 new file mode 100644 index 0000000..1d6097b --- /dev/null +++ b/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_CONFIRM_LABEL.png.sha1
@@ -0,0 +1 @@ +070260115fda41c05b64dcea52c341efd82e316b \ No newline at end of file
diff --git a/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_DELETE_WARNING.png.sha1 b/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_DELETE_WARNING.png.sha1 new file mode 100644 index 0000000..1d6097b --- /dev/null +++ b/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_DELETE_WARNING.png.sha1
@@ -0,0 +1 @@ +070260115fda41c05b64dcea52c341efd82e316b \ No newline at end of file
diff --git a/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_DRIVE_NAME_LABEL.png.sha1 b/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_DRIVE_NAME_LABEL.png.sha1 new file mode 100644 index 0000000..1d6097b --- /dev/null +++ b/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_DRIVE_NAME_LABEL.png.sha1
@@ -0,0 +1 @@ +070260115fda41c05b64dcea52c341efd82e316b \ No newline at end of file
diff --git a/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_FORMAT_LABEL.png.sha1 b/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_FORMAT_LABEL.png.sha1 new file mode 100644 index 0000000..fc3c091 --- /dev/null +++ b/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_FORMAT_LABEL.png.sha1
@@ -0,0 +1 @@ +c1b335c47f944f107679742b06765d2a5a9a3b42 \ No newline at end of file
diff --git a/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_MESSAGE.png.sha1 b/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_MESSAGE.png.sha1 new file mode 100644 index 0000000..1d6097b --- /dev/null +++ b/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_MESSAGE.png.sha1
@@ -0,0 +1 @@ +070260115fda41c05b64dcea52c341efd82e316b \ No newline at end of file
diff --git a/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_TITLE.png.sha1 b/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_TITLE.png.sha1 new file mode 100644 index 0000000..1d6097b --- /dev/null +++ b/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_FORMAT_DIALOG_TITLE.png.sha1
@@ -0,0 +1 @@ +070260115fda41c05b64dcea52c341efd82e316b \ No newline at end of file
diff --git a/ui/file_manager/file_manager/foreground/elements/BUILD.gn b/ui/file_manager/file_manager/foreground/elements/BUILD.gn index 6af4b055..6f23a25 100644 --- a/ui/file_manager/file_manager/foreground/elements/BUILD.gn +++ b/ui/file_manager/file_manager/foreground/elements/BUILD.gn
@@ -18,6 +18,7 @@ js_type_check("closure_compile_module") { deps = [ + ":files_format_dialog", ":files_icon_button", ":files_metadata_box", ":files_metadata_entry", @@ -31,6 +32,16 @@ ] } +js_library("files_format_dialog") { + deps = [ + "../../common/js:util", + "//ui/webui/resources/cr_elements/cr_button:cr_button", + "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog", + "//ui/webui/resources/cr_elements/cr_input:cr_input", + "//ui/webui/resources/js:i18n_behavior", + ] +} + js_library("files_icon_button") { deps = [ "//third_party/polymer/v1_0/components-chromium/iron-behaviors:iron-button-state-extracted",
diff --git a/ui/file_manager/file_manager/foreground/elements/elements_bundle.html b/ui/file_manager/file_manager/foreground/elements/elements_bundle.html index f34d700..06f32715 100644 --- a/ui/file_manager/file_manager/foreground/elements/elements_bundle.html +++ b/ui/file_manager/file_manager/foreground/elements/elements_bundle.html
@@ -8,6 +8,7 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-progress/paper-progress.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-ripple/paper-ripple.html"> +<link rel="import" href="files_format_dialog.html"> <link rel="import" href="files_ripple.html"> <link rel="import" href="files_toast.html"> <link rel="import" href="files_toggle_ripple.html">
diff --git a/ui/file_manager/file_manager/foreground/elements/files_format_dialog.html b/ui/file_manager/file_manager/foreground/elements/files_format_dialog.html new file mode 100644 index 0000000..961f91b4 --- /dev/null +++ b/ui/file_manager/file_manager/foreground/elements/files_format_dialog.html
@@ -0,0 +1,87 @@ +<!-- 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. + --> + +<link rel="import" href="chrome://resources/html/polymer.html"> + +<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html"> +<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html"> +<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html"> +<link rel="import" href="chrome://resources/cr_elements/icons.html"> +<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> +<link rel="import" href="chrome://resources/html/i18n_behavior.html"> +<link rel="import" href="chrome://resources/html/md_select_css.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> + +<dom-module id="files-format-dialog"> + <template> + <style include="md-select"> + .md-select { + width: 100%; + } + + .label { + @apply --cr-form-field-label; + } + + [slot='body'] > * { + margin-bottom: var(--cr-form-field-bottom-spacing); + } + + cr-input { + --cr-input-error-display: none; + } + + #warning-icon { + --iron-icon-fill-color: var(--google-red-600); + } + + #warning-message { + color: var(--google-red-600); + display: inline-block; + margin-inline-start: 8px; + } + </style> + + <cr-dialog id="dialog" show-close-button> + <div slot="title"> + [[i18n('FORMAT_DIALOG_TITLE', volumeInfo_.label)]] + </div> + <div slot="body"> + <div>[[i18n('FORMAT_DIALOG_MESSAGE')]]</div> + <div id="warning-container" hidden="[[!space_used_]]"> + <iron-icon id="warning-icon" icon="cr:warning"></iron-icon> + <div id="warning-message"> + [[i18n('FORMAT_DIALOG_DELETE_WARNING', space_used_)]] + </div> + </div> + <cr-input label="[[i18n('FORMAT_DIALOG_DRIVE_NAME_LABEL')]]" + id="label" value="{{label_}}"> + </cr-input> + <div id="disk-format"> + <div id="format-type-label" class="label"> + [[i18n('FORMAT_DIALOG_FORMAT_LABEL')]] + </div> + <select class="md-select" aria-labelledby="format-type-label" + value="{{formatType_::change}}"> + <option value="vfat">FAT32</option> + <option value="exfat">exFAT</option> + <option value="ntfs">NTFS</option> + </select> + </div> + </div> + <div slot="button-container"> + <cr-button class="cancel-button" on-click="cancel_" id="cancel"> + [[i18n('CANCEL_LABEL')]] + </cr-button> + <cr-button class="action-button" on-click="format_" + id="format-button"> + [[i18n('FORMAT_DIALOG_CONFIRM_LABEL')]] + </cr-button> + </div> + </cr-dialog> + </template> + + <script src="files_format_dialog.js"></script> +</dom-module>
diff --git a/ui/file_manager/file_manager/foreground/elements/files_format_dialog.js b/ui/file_manager/file_manager/foreground/elements/files_format_dialog.js new file mode 100644 index 0000000..0ea1c9ed --- /dev/null +++ b/ui/file_manager/file_manager/foreground/elements/files_format_dialog.js
@@ -0,0 +1,62 @@ +// 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. + +Polymer({ + is: 'files-format-dialog', + + behaviors: [I18nBehavior], + + properties: { + label_: { + type: String, + value: '', + }, + + formatType_: { + type: String, + value: 'vfat', + }, + + space_used_: { + type: String, + value: '', + } + }, + + /** @private */ + cancel_: function() { + this.$.dialog.cancel(); + }, + + /** @private */ + format_: function() { + // TODO(austinct): add file manager private call + this.$.dialog.close(); + }, + + /** + * Shows the dialog for drive represented by |volumeInfo|. + * @param {!VolumeInfo} volumeInfo + */ + showModal: function(volumeInfo) { + this.label_ = ''; + this.formatType_ = 'vfat'; + this.space_used_ = ''; + + this.volumeInfo_ = volumeInfo; + if (volumeInfo.displayRoot) { + chrome.fileManagerPrivate.getDirectorySize( + volumeInfo.displayRoot, space_used_ => { + if (space_used_ > 0 && volumeInfo === this.volumeInfo_) { + this.space_used_ = util.bytesToString(space_used_); + } + if (window.IN_TEST) { + this.$['warning-container'].setAttribute('fully-initialized', ''); + } + }); + } + + this.$.dialog.showModal(); + }, +});
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js index e87f4f14..1dfc73b7 100644 --- a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js +++ b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
@@ -641,11 +641,15 @@ const volumeInfo = fileManager.volumeManager.getVolumeInfo(assert(root)); if (volumeInfo) { - fileManager.ui.confirmDialog.show( - loadTimeData.getString('FORMATTING_WARNING'), - chrome.fileManagerPrivate.formatVolume.bind( - null, volumeInfo.volumeId), - null, null); + if (loadTimeData.getBoolean('FORMAT_DIALOG_ENABLED')) { + fileManager.ui.formatDialog.showModal(volumeInfo); + } else { + fileManager.ui.confirmDialog.show( + loadTimeData.getString('FORMATTING_WARNING'), + chrome.fileManagerPrivate.formatVolume.bind( + null, volumeInfo.volumeId), + null, null); + } } }
diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js b/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js index 739d1f4..a44a209 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js +++ b/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js
@@ -111,6 +111,12 @@ new cr.filebrowser.InstallLinuxPackageDialog(this.element); /** + * Dialog for formatting + * @const {!HTMLElement} + */ + this.formatDialog = queryRequiredElement('#format-dialog'); + + /** * The container element of the dialog. * @type {!HTMLElement} */
diff --git a/ui/file_manager/file_manager/main.html b/ui/file_manager/file_manager/main.html index e99192250..53fb04a6 100644 --- a/ui/file_manager/file_manager/main.html +++ b/ui/file_manager/file_manager/main.html
@@ -88,6 +88,12 @@ background-color: black; } } + + files-format-dialog { + --cr-dialog-native: { + border-radius: 2px; + } + } </style> </custom-style> @@ -596,5 +602,6 @@ <iframe id="command-dispatcher" hidden aria-hidden="true"></iframe> <div id="drop-label"></div> <files-toast id="toast"></files-toast> + <files-format-dialog id="format-dialog"></files-format-dialog> </body> </html>
diff --git a/ui/file_manager/file_manager/manifest.json b/ui/file_manager/file_manager/manifest.json index 73a01ff..207ad4e 100644 --- a/ui/file_manager/file_manager/manifest.json +++ b/ui/file_manager/file_manager/manifest.json
@@ -135,6 +135,8 @@ // enough that anything is passed to web_accessible_resources. If there is // at least any file, then all files are allowed. http://crbug.com/179127. "web_accessible_resources": [ + "foreground/elements/files_format_dialog.html", + "foreground/elements/files_format_dialog.js", "foreground/elements/files_icon_button.html", "foreground/elements/files_icon_button.js", "foreground/elements/files_ripple.html",
diff --git a/ui/file_manager/file_manager/test/scripts/create_test_main.py b/ui/file_manager/file_manager/test/scripts/create_test_main.py index 5f66f6bb..c2360e1 100755 --- a/ui/file_manager/file_manager/test/scripts/create_test_main.py +++ b/ui/file_manager/file_manager/test/scripts/create_test_main.py
@@ -247,6 +247,9 @@ buf = buf.replace('<link rel="import" href="chrome://resources/cr_elements/' 'cr_button/cr_button.html">', '') buf = buf.replace('src="files_', 'src="' + elements_path('files_')) + # The format dialog imports a bunch of files not available in a ui test, so + # just ignore it completely. + buf = buf.replace('<link rel="import" href="files_format_dialog.html">', '') for old, new in substitutions: buf = buf.replace(old, new) write('test/gen/' + filename, buf)
diff --git a/ui/file_manager/file_manager_resources.grd b/ui/file_manager/file_manager_resources.grd index 9f93a3d7..d1d4f7f 100644 --- a/ui/file_manager/file_manager_resources.grd +++ b/ui/file_manager/file_manager_resources.grd
@@ -24,6 +24,8 @@ <!-- Polymer elements --> <include name="IDR_FILE_MANAGER_ELEMENTS_ELEMENTS_BUNDLE_HTML" file="file_manager/foreground/elements/elements_bundle.html" type="BINDATA" compress="gzip" /> + <include name="IDR_FILE_MANAGER_ELEMENTS_FILES_FORMAT_DIALOG_HTML" file="file_manager/foreground/elements/files_format_dialog.html" type="BINDATA" /> + <include name="IDR_FILE_MANAGER_ELEMENTS_FILES_FORMAT_DIALOG_JS" file="file_manager/foreground/elements/files_format_dialog.js" type="BINDATA" /> <include name="IDR_FILE_MANAGER_ELEMENTS_FILES_ICON_BUTTON_HTML" file="file_manager/foreground/elements/files_icon_button.html" type="BINDATA" /> <include name="IDR_FILE_MANAGER_ELEMENTS_FILES_ICON_BUTTON_JS" file="file_manager/foreground/elements/files_icon_button.js" type="BINDATA" /> <include name="IDR_FILE_MANAGER_ELEMENTS_FILES_METADATA_BOX_HTML" file="file_manager/foreground/elements/files_metadata_box.html" type="BINDATA" />
diff --git a/ui/file_manager/integration_tests/file_manager/format_dialog.js b/ui/file_manager/integration_tests/file_manager/format_dialog.js new file mode 100644 index 0000000..8daeac0d --- /dev/null +++ b/ui/file_manager/integration_tests/file_manager/format_dialog.js
@@ -0,0 +1,99 @@ +// 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. +'use strict'; + +/** + * Launches the file manager and opens a format dialog for the USB with label + * |usbLabel|. + */ +async function openFormatDialog(usbLabel) { + const appId = await setupAndWaitUntilReady(RootPath.DOWNLOADS); + + // Focus the directory tree. + chrome.test.assertTrue( + !!await remoteCall.callRemoteTestUtil( + 'focus', appId, ['#directory-tree']), + 'focus failed: #directory-tree'); + + // Right click on the USB's directory tree entry. + const treeQuery = `#directory-tree [entry-label="${usbLabel}"]`; + await remoteCall.waitForElement(appId, treeQuery); + chrome.test.assertTrue( + !!await remoteCall.callRemoteTestUtil( + 'fakeMouseRightClick', appId, [treeQuery]), + 'fakeMouseRightClick failed'); + + // Click on the format menu item. + const formatItemQuery = '#roots-context-menu:not([hidden])' + + ' cr-menu-item[command="#format"]:not([hidden]):not([disabled])'; + await remoteCall.waitAndClickElement(appId, formatItemQuery); + + // Check the dialog is open. + await remoteCall.waitForElement( + appId, ['files-format-dialog', 'cr-dialog[open]']); + return appId; +} + +/** + * Tests the format dialog for a sample USB with files on it. + */ +testcase.formatDialog = async () => { + await sendTestMessage({name: 'mountFakeUsb'}); + await sendTestMessage({name: 'mountUsbWithPartitions'}); + + const appId = await openFormatDialog('fake-usb'); + + // Check the correct size is displayed. + const msg = await remoteCall.waitForElement(appId, [ + 'files-format-dialog', '#warning-container:not([hidden]) #warning-message' + ]); + chrome.test.assertEq('51 bytes of files will be deleted', msg.text.trim()); + + // Click format button. + const formatButtonQuery = ['files-format-dialog', 'cr-button#format-button']; + await remoteCall.waitAndClickElement(appId, formatButtonQuery); + + // Check the dialog is closed. + remoteCall.waitForElement( + appId, ['files-format-dialog', 'cr-dialog:not([open])']); +}; + +/** + * Tests the format dialog for an empty USB. + */ +testcase.formatDialogEmpty = async () => { + await sendTestMessage({name: 'mountFakeUsbEmpty'}); + + const appId = await openFormatDialog('fake-usb'); + + // Check the warning message is hidden. + const warning = await remoteCall.waitForElement( + appId, ['files-format-dialog', '#warning-container[fully-initialized]']); + chrome.test.assertTrue(warning.hidden); + + // Click format button. + const formatButtonQuery = ['files-format-dialog', 'cr-button#format-button']; + await remoteCall.waitAndClickElement(appId, formatButtonQuery); + + // Check the dialog is closed. + remoteCall.waitForElement( + appId, ['files-format-dialog', 'cr-dialog:not([open])']); +}; + +/** + * Tests cancelling out of the format dialog. + */ +testcase.formatDialogCancel = async () => { + await sendTestMessage({name: 'mountFakeUsb'}); + + const appId = await openFormatDialog('fake-usb'); + + // Click cancel button. + const formatButtonQuery = ['files-format-dialog', 'cr-button#cancel']; + await remoteCall.waitAndClickElement(appId, formatButtonQuery); + + // Check the dialog is closed. + remoteCall.waitForElement( + appId, ['files-format-dialog', 'cr-dialog:not([open])']); +};
diff --git a/ui/file_manager/integration_tests/file_manager_test_manifest.json b/ui/file_manager/integration_tests/file_manager_test_manifest.json index 2c8da1a..451cee9 100644 --- a/ui/file_manager/integration_tests/file_manager_test_manifest.json +++ b/ui/file_manager/integration_tests/file_manager_test_manifest.json
@@ -26,6 +26,7 @@ "file_manager/file_list.js", "file_manager/files_tooltip.js", "file_manager/folder_shortcuts.js", + "file_manager/format_dialog.js", "file_manager/gear_menu.js", "file_manager/grid_view.js", "file_manager/install_linux_package_dialog.js",
diff --git a/ui/gfx/platform_font_skia.cc b/ui/gfx/platform_font_skia.cc index da9a78d..dbdf1a7 100644 --- a/ui/gfx/platform_font_skia.cc +++ b/ui/gfx/platform_font_skia.cc
@@ -323,7 +323,16 @@ metrics_need_computation_ = false; SkFont font(typeface_, font_size_pixels_); - font.setEdging(SkFont::Edging::kAlias); + const FontRenderParams& params = GetFontRenderParams(); + if (!params.antialiasing) { + font.setEdging(SkFont::Edging::kAlias); + } else if (params.subpixel_rendering == + FontRenderParams::SUBPIXEL_RENDERING_NONE) { + font.setEdging(SkFont::Edging::kAntiAlias); + } else { + font.setEdging(SkFont::Edging::kSubpixelAntiAlias); + } + font.setEmbolden(weight_ >= Font::Weight::BOLD && !typeface_->isBold()); font.setSkewX((Font::ITALIC & style_) && !typeface_->isItalic() ? -SK_Scalar1 / 4