diff --git a/android_webview/browser/aw_safe_browsing_blocking_page.cc b/android_webview/browser/aw_safe_browsing_blocking_page.cc index 391eb21..80ebf77 100644 --- a/android_webview/browser/aw_safe_browsing_blocking_page.cc +++ b/android_webview/browser/aw_safe_browsing_blocking_page.cc
@@ -98,6 +98,7 @@ pref_service->GetBoolean( ::prefs::kSafeBrowsingProceedAnywayDisabled), false, // should_open_links_in_new_tab + false, // always_show_back_to_safety "cpn_safe_browsing_wv"); // help_center_article_link ErrorUiType errorType =
diff --git a/ash/resources/vector_icons/BUILD.gn b/ash/resources/vector_icons/BUILD.gn index 68506d0..5578817 100644 --- a/ash/resources/vector_icons/BUILD.gn +++ b/ash/resources/vector_icons/BUILD.gn
@@ -70,6 +70,8 @@ "notification_battery_critical.icon", "notification_battery_fluctuating.icon", "notification_battery_low.icon", + "notification_bluetooth_battery_warning.1x.icon", + "notification_bluetooth_battery_warning.icon", "notification_bluetooth.icon", "notification_capslock.1x.icon", "notification_capslock.icon",
diff --git a/ash/resources/vector_icons/notification_bluetooth_battery_warning.1x.icon b/ash/resources/vector_icons/notification_bluetooth_battery_warning.1x.icon new file mode 100644 index 0000000..ec23efb --- /dev/null +++ b/ash/resources/vector_icons/notification_bluetooth_battery_warning.1x.icon
@@ -0,0 +1,67 @@ +// 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. + +CANVAS_DIMENSIONS, 18, +PATH_COLOR_ARGB, 0x4C, 0xC5, 0x39, 0x29, +MOVE_TO, 6, 2, +R_H_LINE_TO, 6, +R_CUBIC_TO, 0.55f, 0, 1, 0.45f, 1, 1, +R_V_LINE_TO, 13, +R_CUBIC_TO, 0, 0.55f, -0.45f, 1, -1, 1, +H_LINE_TO, 6, +R_CUBIC_TO, -0.55f, 0, -1, -0.45f, -1, -1, +V_LINE_TO, 3, +R_CUBIC_TO, 0, -0.55f, 0.45f, -1, 1, -1, +CLOSE, +R_MOVE_TO, 1, -1, +R_H_LINE_TO, 4, +R_V_LINE_TO, 1, +H_LINE_TO, 7, +V_LINE_TO, 1, +CLOSE, +NEW_PATH, +PATH_COLOR_ARGB, 0xFF, 0xC5, 0x39, 0x29, +MOVE_TO, 13, 15, +R_CUBIC_TO, 0, 1.11f, -0.89f, 2, -2, 2, +H_LINE_TO, 7, +CUBIC_TO, 5.9f, 17, 5, 16.1f, 5, 15, +R_H_LINE_TO, 8, +CLOSE, +MOVE_TO, 8, 4, +R_H_LINE_TO, 2, +R_V_LINE_TO, 5, +H_LINE_TO, 8, +CLOSE, +MOVE_TO, 8, 11, +R_H_LINE_TO, 2, +R_V_LINE_TO, 2, +H_LINE_TO, 8, +CLOSE, +MOVE_TO, 0, 5.65f, +LINE_TO, 0.78f, 4.8f, +R_LINE_TO, 2.53f, 2.75f, +V_LINE_TO, 3, +R_H_LINE_TO, 0.55f, +LINE_TO, 7, 6.43f, +LINE_TO, 4.63f, 9, +LINE_TO, 7, 11.57f, +LINE_TO, 3.86f, 15, +R_H_LINE_TO, -0.55f, +R_V_LINE_TO, -4.55f, +LINE_TO, 0.77f, 13.2f, +LINE_TO, 0, 12.35f, +LINE_TO, 3.08f, 9, +LINE_TO, 0, 5.65f, +CLOSE, +R_MOVE_TO, 4.2f, -0.4f, +R_V_LINE_TO, 2.63f, +R_LINE_TO, 1.4f, -1.5f, +LINE_TO, 4.2f, 5.25f, +CLOSE, +R_MOVE_TO, 0, 4.5f, +R_V_LINE_TO, 2.63f, +R_LINE_TO, 1.4f, -1.12f, +R_LINE_TO, -1.4f, -1.5f, +CLOSE, +END
diff --git a/ash/resources/vector_icons/notification_bluetooth_battery_warning.icon b/ash/resources/vector_icons/notification_bluetooth_battery_warning.icon new file mode 100644 index 0000000..a4f9a74 --- /dev/null +++ b/ash/resources/vector_icons/notification_bluetooth_battery_warning.icon
@@ -0,0 +1,67 @@ +// 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. + +CANVAS_DIMENSIONS, 36, +PATH_COLOR_ARGB, 0x4C, 0xC5, 0x39, 0x29, +MOVE_TO, 12, 4, +R_H_LINE_TO, 12, +R_CUBIC_TO, 1.11f, 0, 2, 0.9f, 2, 2, +R_V_LINE_TO, 26, +R_CUBIC_TO, 0, 1.11f, -0.89f, 2, -2, 2, +H_LINE_TO, 12, +R_CUBIC_TO, -1.1f, 0, -2, -0.89f, -2, -2, +V_LINE_TO, 6, +R_CUBIC_TO, 0, -1.1f, 0.9f, -2, 2, -2, +CLOSE, +R_MOVE_TO, 2, -2, +R_H_LINE_TO, 8, +R_V_LINE_TO, 2, +R_H_LINE_TO, -8, +V_LINE_TO, 2, +CLOSE, +NEW_PATH, +PATH_COLOR_ARGB, 0xFF, 0xC5, 0x39, 0x29, +MOVE_TO, 26, 30, +R_CUBIC_TO, 0, 2.21f, -1.79f, 4, -4, 4, +R_H_LINE_TO, -8, +R_CUBIC_TO, -2.21f, 0, -4, -1.79f, -4, -4, +R_H_LINE_TO, 16, +CLOSE, +MOVE_TO, 16, 8, +R_H_LINE_TO, 4, +R_V_LINE_TO, 10, +R_H_LINE_TO, -4, +CLOSE, +MOVE_TO, 16, 22, +R_H_LINE_TO, 4, +R_V_LINE_TO, 4, +R_H_LINE_TO, -4, +CLOSE, +MOVE_TO, 0, 11.29f, +R_LINE_TO, 1.55f, -1.69f, +R_LINE_TO, 5.06f, 5.51f, +V_LINE_TO, 6, +R_H_LINE_TO, 1.1f, +LINE_TO, 14, 12.85f, +LINE_TO, 9.26f, 18, +LINE_TO, 14, 23.15f, +LINE_TO, 7.71f, 30, +R_H_LINE_TO, -1.1f, +R_V_LINE_TO, -9.11f, +LINE_TO, 1.55f, 26.4f, +LINE_TO, 0, 24.71f, +LINE_TO, 6.16f, 18, +LINE_TO, 0, 11.29f, +CLOSE, +R_MOVE_TO, 8.4f, -0.79f, +R_V_LINE_TO, 5.25f, +R_LINE_TO, 2.8f, -3, +R_LINE_TO, -2.8f, -2.25f, +CLOSE, +R_MOVE_TO, 0, 9, +R_V_LINE_TO, 5.25f, +R_LINE_TO, 2.8f, -2.25f, +R_LINE_TO, -2.8f, -3, +CLOSE, +END
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/ChromeFullscreenManager.java b/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/ChromeFullscreenManager.java index dcecebd..8079e8eb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/ChromeFullscreenManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/ChromeFullscreenManager.java
@@ -5,13 +5,12 @@ package org.chromium.chrome.browser.fullscreen; import android.app.Activity; -import android.content.res.Resources; +import android.support.annotation.Nullable; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; -import android.view.Window; import android.widget.FrameLayout; import org.chromium.base.ActivityState; @@ -47,7 +46,6 @@ private static final long ACTIVITY_RETURN_SHOW_REQUEST_DELAY_MS = 100; private final Activity mActivity; - private final Window mWindow; private final BrowserStateBrowserControlsVisibilityDelegate mBrowserVisibilityDelegate; private final boolean mIsBottomControls; private final boolean mExitFullscreenOnStop; @@ -55,7 +53,6 @@ private ControlContainer mControlContainer; private int mTopControlContainerHeight; private int mBottomControlContainerHeight; - private TabModelSelector mTabModelSelector; private TabModelSelectorTabModelObserver mTabModelObserver; private float mRendererTopControlOffset = Float.NaN; @@ -139,7 +136,6 @@ super(activity.getWindow()); mActivity = activity; - mWindow = activity.getWindow(); mIsBottomControls = isBottomControls; mExitFullscreenOnStop = exitFullscreenOnStop; mBrowserVisibilityDelegate = new BrowserStateBrowserControlsVisibilityDelegate( @@ -162,52 +158,47 @@ * @param modelSelector The tab model selector that will be monitored for tab changes. * @param resControlContainerHeight The dimension resource ID for the control container height. */ - public void initialize(ControlContainer controlContainer, TabModelSelector modelSelector, + public void initialize(ControlContainer controlContainer, final TabModelSelector modelSelector, int resControlContainerHeight) { ApplicationStatus.registerStateListenerForActivity(this, mActivity); ((BaseChromiumApplication) mActivity.getApplication()) .registerWindowFocusChangedListener(this); - mTabModelSelector = modelSelector; - mTabModelObserver = new TabModelSelectorTabModelObserver(mTabModelSelector) { + mTabModelObserver = new TabModelSelectorTabModelObserver(modelSelector) { @Override public void tabClosureCommitted(Tab tab) { - setTab(mTabModelSelector.getCurrentTab()); + setTab(modelSelector.getCurrentTab()); } @Override public void allTabsClosureCommitted() { - setTab(mTabModelSelector.getCurrentTab()); + setTab(modelSelector.getCurrentTab()); } @Override public void tabRemoved(Tab tab) { - setTab(mTabModelSelector.getCurrentTab()); + setTab(modelSelector.getCurrentTab()); } @Override public void didSelectTab(Tab tab, TabSelectionType type, int lastId) { - setTab(mTabModelSelector.getCurrentTab()); + setTab(modelSelector.getCurrentTab()); } @Override public void didCloseTab(int tabId, boolean incognito) { - setTab(mTabModelSelector.getCurrentTab()); + setTab(modelSelector.getCurrentTab()); } }; assert controlContainer != null; mControlContainer = controlContainer; - Resources resources = mWindow.getContext().getResources(); - int controlContainerHeight = resources.getDimensionPixelSize(resControlContainerHeight); - if (mIsBottomControls) { - mTopControlContainerHeight = 0; - mBottomControlContainerHeight = controlContainerHeight; - } else { - mTopControlContainerHeight = controlContainerHeight; - mBottomControlContainerHeight = 0; - } + int controlContainerHeight = + mActivity.getResources().getDimensionPixelSize(resControlContainerHeight); + + mTopControlContainerHeight = mIsBottomControls ? 0 : controlContainerHeight; + mBottomControlContainerHeight = mIsBottomControls ? controlContainerHeight : 0; mRendererTopContentOffset = mTopControlContainerHeight; updateControlOffset(); @@ -227,7 +218,7 @@ } @Override - public void setTab(Tab tab) { + public void setTab(@Nullable Tab tab) { Tab previousTab = getTab(); super.setTab(tab); if (tab != null && previousTab != getTab()) { @@ -254,7 +245,7 @@ }, ACTIVITY_RETURN_SHOW_REQUEST_DELAY_MS); } else if (newState == ActivityState.DESTROYED) { ApplicationStatus.unregisterActivityStateListener(this); - ((BaseChromiumApplication) mWindow.getContext().getApplicationContext()) + ((BaseChromiumApplication) mActivity.getApplicationContext()) .unregisterWindowFocusChangedListener(this); mTabModelObserver.destroy();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/FullscreenHtmlApiHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/FullscreenHtmlApiHandler.java index 54fb5a7a..aac8ebe 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/FullscreenHtmlApiHandler.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/FullscreenHtmlApiHandler.java
@@ -11,6 +11,7 @@ import android.os.Build; import android.os.Handler; import android.os.Message; +import android.support.annotation.Nullable; import android.view.Gravity; import android.view.View; import android.view.View.OnLayoutChangeListener; @@ -43,11 +44,11 @@ private final Handler mHandler; private final FullscreenHtmlApiDelegate mDelegate; - // We still need this since we are setting fullscreen UI state on the contentviewcore's - // container view, and a tab can have null content view core, i.e., if you navigate + // We still need this since we are setting fullscreen UI state on the ContentViewCore's + // container view, and a Tab can change to have null content view core, i.e., if you navigate // to a native page. - private ContentViewCore mContentViewCoreInFullscreen; - private Tab mTabInFullscreen; + @Nullable private ContentViewCore mContentViewCoreInFullscreen; + @Nullable private Tab mTabInFullscreen; private boolean mIsPersistentMode; // Toast at the top of the screen that is shown when user enters fullscreen for the @@ -105,15 +106,18 @@ if (msg == null) return; FullscreenHtmlApiHandler fullscreenHtmlApiHandler = mFullscreenHtmlApiHandler.get(); if (fullscreenHtmlApiHandler == null) return; + + final ContentViewCore cvc = fullscreenHtmlApiHandler.mContentViewCoreInFullscreen; + if (cvc == null) return; + + final View contentView = cvc.getContainerView(); + int systemUiVisibility = contentView.getSystemUiVisibility(); + switch (msg.what) { case MSG_ID_SET_FULLSCREEN_SYSTEM_UI_FLAGS: { assert fullscreenHtmlApiHandler.getPersistentFullscreenMode() : "Calling after we exited fullscreen"; - final ContentViewCore contentViewCore = - fullscreenHtmlApiHandler.mContentViewCoreInFullscreen; - if (contentViewCore == null) return; - final View contentView = contentViewCore.getContainerView(); - int systemUiVisibility = contentView.getSystemUiVisibility(); + if ((systemUiVisibility & SYSTEM_UI_FLAG_FULLSCREEN) == SYSTEM_UI_FLAG_FULLSCREEN) { return; @@ -144,20 +148,16 @@ } case MSG_ID_CLEAR_LAYOUT_FULLSCREEN_FLAG: { // Change this assert to simply ignoring the message to work around - // http://crbug/365638 + // https://crbug/365638 // TODO(aberent): Fix bug // assert mIsPersistentMode : "Calling after we exited fullscreen"; if (!fullscreenHtmlApiHandler.getPersistentFullscreenMode()) return; - final ContentViewCore contentViewCore = - fullscreenHtmlApiHandler.mContentViewCoreInFullscreen; - if (contentViewCore == null) return; - final View view = contentViewCore.getContainerView(); - int systemUiVisibility = view.getSystemUiVisibility(); + if ((systemUiVisibility & SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) == 0) { return; } systemUiVisibility &= ~SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; - view.setSystemUiVisibility(systemUiVisibility); + contentView.setSystemUiVisibility(systemUiVisibility); break; } default:
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/FullscreenManager.java b/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/FullscreenManager.java index 9849a5cd..dde92c34 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/FullscreenManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/fullscreen/FullscreenManager.java
@@ -4,6 +4,7 @@ package org.chromium.chrome.browser.fullscreen; +import android.support.annotation.Nullable; import android.view.View; import android.view.Window; @@ -20,7 +21,7 @@ private final FullscreenHtmlApiHandler mHtmlApiHandler; private boolean mOverlayVideoMode; - private Tab mTab; + @Nullable private Tab mTab; /** * Constructs the basic ChromeTab oriented FullscreenManager. @@ -106,7 +107,7 @@ /** * Sets the currently selected tab for fullscreen. */ - public void setTab(Tab tab) { + public void setTab(@Nullable Tab tab) { if (mTab == tab) return; // Remove the fullscreen manager from the old tab before setting the new tab. @@ -121,7 +122,7 @@ /** * @return The currently selected tab for fullscreen. */ - public Tab getTab() { + @Nullable public Tab getTab() { return mTab; }
diff --git a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc index aa468237..d3c6903 100644 --- a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc +++ b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc
@@ -97,10 +97,18 @@ extensions::ExtensionSystem::Get(profile); ExtensionService* extension_service = extension_system->extension_service(); DCHECK(extension_service); - if (extension_service->GetExtensionById(extension_id, false)) + if (extension_service->GetExtensionById(extension_id, false)) { + VLOG(1) << "the IME extension(id=\"" << extension_id + << "\") is already enabled"; return; + } const std::string loaded_extension_id = GetComponentLoader(profile)->Add(manifest, file_path); + if (loaded_extension_id.empty()) { + LOG(ERROR) << "Failed to add an IME extension(id=\"" << extension_id + << ", path=\"" << file_path << "\") to ComponentLoader"; + return; + } // Register IME extension with ExtensionPrefValueMap. ExtensionPrefValueMapFactory::GetForBrowserContext(profile) ->RegisterExtension(extension_id, @@ -108,6 +116,10 @@ true, // is_enabled. true); // is_incognito_enabled. DCHECK_EQ(loaded_extension_id, extension_id); + if (!extension_service->IsExtensionEnabled(loaded_extension_id)) { + LOG(ERROR) << "An IME extension(id=\"" << loaded_extension_id + << "\") is not enabled after loading"; + } } bool CheckFilePath(const base::FilePath* file_path) { @@ -301,18 +313,29 @@ rb.GetRawDataResource( whitelisted_component_extension[i].manifest_resource_id) .as_string(); - if (component_ime.manifest.empty()) + + if (component_ime.manifest.empty()) { + LOG(ERROR) << "Couldn't get manifest from resource_id(" + << whitelisted_component_extension[i].manifest_resource_id + << ")"; continue; + } std::unique_ptr<base::DictionaryValue> manifest = GetManifest(component_ime.manifest); - if (!manifest.get()) + if (!manifest.get()) { + LOG(ERROR) << "Failed to load invalid manifest: " + << component_ime.manifest; continue; + } if (!ReadExtensionInfo(*manifest.get(), whitelisted_component_extension[i].id, - &component_ime)) + &component_ime)) { + LOG(ERROR) << "manifest doesn't have needed information for IME."; continue; + } + component_ime.id = whitelisted_component_extension[i].id; if (!component_ime.path.IsAbsolute()) { @@ -324,8 +347,10 @@ const base::ListValue* component_list; if (!manifest->GetList(extensions::manifest_keys::kInputComponents, - &component_list)) + &component_list)) { + LOG(ERROR) << "No input_components is found in manifest."; continue; + } for (size_t i = 0; i < component_list->GetSize(); ++i) { const base::DictionaryValue* dictionary;
diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc index 4f8295a6..fd0e6ee 100644 --- a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
@@ -476,8 +476,11 @@ if (!descriptor) { descriptor = manager_->LookupInputMethod( manager_->util_.MigrateInputMethod(input_method_id), this); - if (!descriptor) + if (!descriptor) { + LOG(ERROR) << "Can't find InputMethodDescriptor for \"" << input_method_id + << "\""; return; + } } // For 3rd party IME, when the user just logged in, SetEnabledExtensionImes @@ -521,6 +524,7 @@ DCHECK(engine); manager_->engine_map_[profile][extension_id] = engine; + VLOG(1) << "Add an engine for \"" << extension_id << "\""; bool contain = false; for (size_t i = 0; i < descriptors.size(); i++) { @@ -986,8 +990,10 @@ bool show_message, bool notify_menu) { // No need to switch input method when terminating. - if (ui_session_ == STATE_TERMINATING) + if (ui_session_ == STATE_TERMINATING) { + VLOG(1) << "No need to switch input method when terminating."; return; + } if (candidate_window_controller_.get()) candidate_window_controller_->Hide(); @@ -1017,6 +1023,10 @@ extension_ime_util::GetExtensionIDFromInputMethodID(descriptor.id()); const std::string& component_id = extension_ime_util::GetComponentIDByInputMethodID(descriptor.id()); + if (engine_map_.find(profile) == engine_map_.end() || + engine_map_[profile].find(extension_id) == engine_map_[profile].end()) { + LOG(ERROR) << "IMEEngine for \"" << extension_id << "\" is not registered"; + } engine = engine_map_[profile][extension_id]; ui::IMEBridge::Get()->SetCurrentEngineHandler(engine);
diff --git a/chrome/browser/chromeos/power/peripheral_battery_notifier.cc b/chrome/browser/chromeos/power/peripheral_battery_notifier.cc index c9f6ba79..42084f6 100644 --- a/chrome/browser/chromeos/power/peripheral_battery_notifier.cc +++ b/chrome/browser/chromeos/power/peripheral_battery_notifier.cc
@@ -6,6 +6,7 @@ #include <vector> +#include "ash/resources/vector_icons/vector_icons.h" #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" #include "ash/system/system_notifier.h" @@ -128,11 +129,13 @@ int image_id; std::string notifier_name; GURL url; + const gfx::VectorIcon* icon; }; NotificationParams GetNonStylusNotificationParams(const std::string& address, const std::string& name, - int battery_level) { + int battery_level, + bool is_bluetooth) { return NotificationParams{ address, base::ASCIIToUTF16(name), @@ -140,7 +143,9 @@ IDS_ASH_LOW_PERIPHERAL_BATTERY_NOTIFICATION_TEXT, battery_level), IDR_NOTIFICATION_PERIPHERAL_BATTERY_LOW, kNotifierId, - GURL(kNotificationOriginUrl)}; + GURL(kNotificationOriginUrl), + is_bluetooth ? &ash::kNotificationBluetoothBatteryWarningIcon + : &ash::kNotificationBatteryCriticalIcon}; } NotificationParams GetStylusNotificationParams() { @@ -150,7 +155,8 @@ l10n_util::GetStringUTF16(IDS_ASH_LOW_STYLUS_BATTERY_NOTIFICATION_BODY), IDR_NOTIFICATION_STYLUS_BATTERY_LOW, ash::system_notifier::kNotifierStylusBattery, - GURL()}; + GURL(), + &ash::kNotificationBatteryCriticalIcon}; } } // namespace @@ -274,16 +280,18 @@ NotificationParams params = battery.is_stylus ? GetStylusNotificationParams() - : GetNonStylusNotificationParams(path, battery.name, battery.level); + : GetNonStylusNotificationParams(path, battery.name, battery.level, + !battery.bluetooth_address.empty()); - auto notification = base::MakeUnique<message_center::Notification>( + auto notification = ash::system_notifier::CreateSystemNotification( message_center::NOTIFICATION_TYPE_SIMPLE, params.id, params.title, params.message, ui::ResourceBundle::GetSharedInstance().GetImageNamed(params.image_id), base::string16(), params.url, message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, params.notifier_name), - message_center::RichNotificationData(), nullptr); + message_center::RichNotificationData(), nullptr, *params.icon, + message_center::SystemNotificationWarningLevel::CRITICAL_WARNING); notification->SetSystemPriority(); message_center::MessageCenter::Get()->AddNotification(
diff --git a/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc b/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc index b01ac06..2e5263c 100644 --- a/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc +++ b/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc
@@ -85,7 +85,14 @@ } }; -IN_PROC_BROWSER_TEST_F(FeedbackTest, ShowFeedback) { +// Disabled for ASan due to flakiness on Mac ASan 64 Tests (1). +// See crbug.com/757243. +#if defined(ADDRESS_SANITIZER) +#define MAYBE_ShowFeedback DISABLED_ShowFeedback +#else +#define MAYBE_ShowFeedback ShowFeedback +#endif +IN_PROC_BROWSER_TEST_F(FeedbackTest, MAYBE_ShowFeedback) { WaitForExtensionViewsToLoad(); ASSERT_TRUE(IsFeedbackAppAvailable());
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.cc b/chrome/browser/extensions/api/input_ime/input_ime_api.cc index 70a01b6..cbc8907 100644 --- a/chrome/browser/extensions/api/input_ime/input_ime_api.cc +++ b/chrome/browser/extensions/api/input_ime/input_ime_api.cc
@@ -34,8 +34,11 @@ : extension_id_(extension_id), profile_(profile) {} void ImeObserver::OnActivate(const std::string& component_id) { - if (extension_id_.empty() || !HasListener(input_ime::OnActivate::kEventName)) + if (extension_id_.empty() || + !HasListener(input_ime::OnActivate::kEventName)) { + LOG(ERROR) << "Can't send onActivate event to \"" << extension_id_ << "\""; return; + } std::unique_ptr<base::ListValue> args(input_ime::OnActivate::Create( component_id, input_ime::ParseScreenType(GetCurrentScreenType())));
diff --git a/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json b/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json index ed509c9..6034ed5 100644 --- a/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json +++ b/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json
@@ -25,7 +25,8 @@ ], "background": { "page": "background.html", - "persistent": false + // TODO(yhanada): Change to false after fixing crbug.com/761714. + "persistent": true }, "content_scripts": [ {
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc index 7529f52..5b50863 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
@@ -79,6 +79,7 @@ IsExtendedReportingEnabled(*prefs), IsScout(*prefs), is_proceed_anyway_disabled, true, // should_open_links_in_new_tab + true, // always_show_back_to_safety kHelpCenterLink); return new SafeBrowsingBlockingPage(ui_manager, web_contents,
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc index a3d493a..f1c8231 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
@@ -328,7 +328,8 @@ web_contents->GetBrowserContext()->IsOffTheRecord(), IsExtendedReportingEnabled(*prefs), IsScout(*prefs), is_proceed_anyway_disabled, - true, // should_open_links_in_new_tab + true, // should_open_links_in_new_tab + false, // check_can_go_back_to_safety "cpn_safe_browsing" /* help_center_article_link */); return new TestSafeBrowsingBlockingPage(delegate, web_contents, main_frame_url, unsafe_resources,
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc index 4e559121..d2778485 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
@@ -95,6 +95,7 @@ IsExtendedReportingEnabled(*prefs), IsScout(*prefs), is_proceed_anyway_disabled, true, // should_open_links_in_new_tab + true, // always_show_back_to_safety "cpn_safe_browsing" /* help_center_article_link */); return new TestSafeBrowsingBlockingPage(manager, web_contents, main_frame_url, unsafe_resources, @@ -177,6 +178,7 @@ IsExtendedReportingEnabled(*prefs), IsScout(*prefs), is_proceed_anyway_disabled, true, // should_open_links_in_new_tab + true, // always_show_back_to_safety "cpn_safe_browsing" /* help_center_article_link */); return new TestSafeBrowsingBlockingPageQuiet( manager, web_contents, main_frame_url, unsafe_resources,
diff --git a/chrome/browser/safe_browsing/ui_manager_unittest.cc b/chrome/browser/safe_browsing/ui_manager_unittest.cc index 3eef07f..03e6d27 100644 --- a/chrome/browser/safe_browsing/ui_manager_unittest.cc +++ b/chrome/browser/safe_browsing/ui_manager_unittest.cc
@@ -437,6 +437,7 @@ false, // is_scout_reporting_enabled false, // is_proceed_anyway_disabled true, // should_open_links_in_new_tab + true, // always_show_back_to_safety "cpn_safe_browsing")) { // help_center_article_link // Don't delay details at all for the unittest. SetThreatDetailsProceedDelayForTesting(0);
diff --git a/components/exo/test/run_all_unittests.cc b/components/exo/test/run_all_unittests.cc index ca8fbdf..ffa9439 100644 --- a/components/exo/test/run_all_unittests.cc +++ b/components/exo/test/run_all_unittests.cc
@@ -17,7 +17,7 @@ mojo::edk::Init(); #endif - return base::LaunchUnitTests( + return base::LaunchUnitTestsSerially( argc, argv, base::Bind(&ash::AshTestSuite::Run, base::Unretained(&test_suite))); }
diff --git a/components/safe_browsing/base_blocking_page.cc b/components/safe_browsing/base_blocking_page.cc index 78de24b..70470d6 100644 --- a/components/safe_browsing/base_blocking_page.cc +++ b/components/safe_browsing/base_blocking_page.cc
@@ -80,6 +80,7 @@ false, // is_scout false, // kSafeBrowsingProceedAnywayDisabled false, // should_open_links_in_new_tab + true, // always_show_back_to_safety "cpn_safe_browsing"); // help_center_article_link }
diff --git a/components/safe_browsing/triggers/trigger_manager.cc b/components/safe_browsing/triggers/trigger_manager.cc index 9514994d..10e0c12 100644 --- a/components/safe_browsing/triggers/trigger_manager.cc +++ b/components/safe_browsing/triggers/trigger_manager.cc
@@ -84,6 +84,7 @@ IsScout(pref_service), /*is_proceed_anyway_disabled=*/false, /*should_open_links_in_new_tab=*/false, + /*show_back_to_safety_button=*/true, /*help_center_article_link=*/std::string()); }
diff --git a/components/security_interstitials/core/base_safe_browsing_error_ui.cc b/components/security_interstitials/core/base_safe_browsing_error_ui.cc index 7a7ca52..c584234 100644 --- a/components/security_interstitials/core/base_safe_browsing_error_ui.cc +++ b/components/security_interstitials/core/base_safe_browsing_error_ui.cc
@@ -32,6 +32,7 @@ bool is_scout_reporting_enabled, bool is_proceed_anyway_disabled, bool should_open_links_in_new_tab, + bool always_show_back_to_safety, const std::string& help_center_article_link) : is_main_frame_load_blocked(is_main_frame_load_blocked), is_extended_reporting_opt_in_allowed( @@ -41,6 +42,7 @@ is_scout_reporting_enabled(is_scout_reporting_enabled), is_proceed_anyway_disabled(is_proceed_anyway_disabled), should_open_links_in_new_tab(should_open_links_in_new_tab), + always_show_back_to_safety(always_show_back_to_safety), help_center_article_link(help_center_article_link) {} BaseSafeBrowsingErrorUI::SBErrorDisplayOptions::SBErrorDisplayOptions( @@ -53,6 +55,7 @@ is_scout_reporting_enabled(other.is_scout_reporting_enabled), is_proceed_anyway_disabled(other.is_proceed_anyway_disabled), should_open_links_in_new_tab(other.should_open_links_in_new_tab), + always_show_back_to_safety(other.always_show_back_to_safety), help_center_article_link(other.help_center_article_link) {} } // security_interstitials
diff --git a/components/security_interstitials/core/base_safe_browsing_error_ui.h b/components/security_interstitials/core/base_safe_browsing_error_ui.h index b4af393..1e60eaf 100644 --- a/components/security_interstitials/core/base_safe_browsing_error_ui.h +++ b/components/security_interstitials/core/base_safe_browsing_error_ui.h
@@ -33,6 +33,7 @@ bool is_scout_reporting_enabled, bool is_proceed_anyway_disabled, bool should_open_links_in_new_tab, + bool always_show_back_to_safety, const std::string& help_center_article_link); SBErrorDisplayOptions(const SBErrorDisplayOptions& other); @@ -64,6 +65,12 @@ // Indicates if links should use a new foreground tab or the current tab. bool should_open_links_in_new_tab; + // Indicates if the 'Back to safety' primary action button should always be + // shown. If the option is false, this button is shown only when there is + // a proper page to navigate back to. Chrome and Chromium builds should + // always set this option to true, + bool always_show_back_to_safety; + // The p= query parameter used when visiting the Help Center. If this is // nullptr, then a default value will be used for the SafeBrowsing article. std::string help_center_article_link; @@ -109,6 +116,10 @@ return display_options_.should_open_links_in_new_tab; } + bool always_show_back_to_safety() const { + return display_options_.always_show_back_to_safety; + } + const std::string& get_help_center_article_link() const { return display_options_.help_center_article_link; }
diff --git a/components/security_interstitials/core/safe_browsing_loud_error_ui.cc b/components/security_interstitials/core/safe_browsing_loud_error_ui.cc index f34abee..1f924864c 100644 --- a/components/security_interstitials/core/safe_browsing_loud_error_ui.cc +++ b/components/security_interstitials/core/safe_browsing_loud_error_ui.cc
@@ -94,7 +94,10 @@ "primaryButtonText", l10n_util::GetStringUTF16(IDS_SAFEBROWSING_OVERRIDABLE_SAFETY_BUTTON)); load_time_data->SetBoolean("overridable", !is_proceed_anyway_disabled()); - load_time_data->SetBoolean("hide_primary_button", !controller()->CanGoBack()); + + load_time_data->SetBoolean( + "hide_primary_button", + always_show_back_to_safety() ? false : !controller()->CanGoBack()); switch (interstitial_reason()) { case BaseSafeBrowsingErrorUI::SB_REASON_MALWARE:
diff --git a/content/browser/DEPS b/content/browser/DEPS index 670e7255..be26b86 100644 --- a/content/browser/DEPS +++ b/content/browser/DEPS
@@ -120,6 +120,7 @@ "+third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerState.h", "+third_party/WebKit/public/platform/modules/serviceworker/service_worker_error_type.mojom.h", "+third_party/WebKit/public/platform/modules/serviceworker/service_worker_event_status.mojom.h", + "+third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h", "+third_party/WebKit/public/platform/modules/serviceworker/service_worker_stream_handle.mojom.h", "+third_party/WebKit/public/platform/modules/webauth/authenticator.mojom.h", "+third_party/WebKit/public/platform/modules/websockets/websocket.mojom.h",
diff --git a/content/browser/background_fetch/background_fetch_context.cc b/content/browser/background_fetch/background_fetch_context.cc index f1eb331..02a24e07 100644 --- a/content/browser/background_fetch/background_fetch_context.cc +++ b/content/browser/background_fetch/background_fetch_context.cc
@@ -61,20 +61,6 @@ BackgroundFetchContext::~BackgroundFetchContext() { DCHECK_CURRENTLY_ON(BrowserThread::IO); - - // TODO(crbug.com/762960): Keep a reference to the request_context_ on the UI - // thread so it can be deref'd and destroyed there until the referenced bug is - // fixed. - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::BindOnce( - [](scoped_refptr<net::URLRequestContextGetter> request_context) {}, - std::move(request_context_getter_))); -} - -void BackgroundFetchContext::InitializeOnIOThread( - scoped_refptr<net::URLRequestContextGetter> request_context_getter) { - request_context_getter_ = request_context_getter; } void BackgroundFetchContext::StartFetch(
diff --git a/content/browser/background_fetch/background_fetch_context.h b/content/browser/background_fetch/background_fetch_context.h index 076a1e4..236db7f9 100644 --- a/content/browser/background_fetch/background_fetch_context.h +++ b/content/browser/background_fetch/background_fetch_context.h
@@ -17,10 +17,6 @@ #include "content/public/browser/browser_thread.h" #include "third_party/WebKit/public/platform/modules/background_fetch/background_fetch.mojom.h" -namespace net { -class URLRequestContextGetter; -} - namespace url { class Origin; } @@ -53,11 +49,6 @@ BrowserContext* browser_context, const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context); - // Finishes initializing the Background Fetch context on the IO thread by - // setting the |request_context_getter|. - void InitializeOnIOThread( - scoped_refptr<net::URLRequestContextGetter> request_context_getter); - // Starts a Background Fetch for the |registration_id|. The |requests| will be // asynchronously fetched. The |callback| will be invoked when the fetch has // been registered, or an error occurred that avoids it from doing so. @@ -118,8 +109,6 @@ // |this| is owned, indirectly, by the BrowserContext. BrowserContext* browser_context_; - scoped_refptr<net::URLRequestContextGetter> request_context_getter_; - std::unique_ptr<BackgroundFetchDataManager> data_manager_; std::unique_ptr<BackgroundFetchEventDispatcher> event_dispatcher_; std::unique_ptr<BackgroundFetchDelegate, BrowserThread::DeleteOnUIThread>
diff --git a/content/browser/background_fetch/background_fetch_test_base.cc b/content/browser/background_fetch/background_fetch_test_base.cc index dc637b26..96a0305 100644 --- a/content/browser/background_fetch/background_fetch_test_base.cc +++ b/content/browser/background_fetch/background_fetch_test_base.cc
@@ -29,6 +29,7 @@ #include "content/public/browser/download_url_parameters.h" #include "content/public/test/fake_download_item.h" #include "content/public/test/mock_download_manager.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" #include "url/gurl.h" namespace content { @@ -245,7 +246,8 @@ { base::RunLoop run_loop; embedded_worker_test_helper_.context()->RegisterServiceWorker( - script_url, ServiceWorkerRegistrationOptions(origin_.GetURL()), + script_url, + blink::mojom::ServiceWorkerRegistrationOptions(origin_.GetURL()), nullptr /* provider_host */, base::Bind(&DidRegisterServiceWorker, &service_worker_registration_id, run_loop.QuitClosure()));
diff --git a/content/browser/background_sync/background_sync_manager_unittest.cc b/content/browser/background_sync/background_sync_manager_unittest.cc index b74b824..e63aa5e 100644 --- a/content/browser/background_sync/background_sync_manager_unittest.cc +++ b/content/browser/background_sync/background_sync_manager_unittest.cc
@@ -44,6 +44,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/public/platform/modules/permissions/permission_status.mojom.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -161,14 +162,16 @@ bool called_1 = false; bool called_2 = false; helper_->context()->RegisterServiceWorker( - GURL(kScript1), ServiceWorkerRegistrationOptions(GURL(kPattern1)), + GURL(kScript1), + blink::mojom::ServiceWorkerRegistrationOptions(GURL(kPattern1)), nullptr, base::AdaptCallbackForRepeating( base::BindOnce(&RegisterServiceWorkerCallback, &called_1, &sw_registration_id_1_))); helper_->context()->RegisterServiceWorker( - GURL(kScript2), ServiceWorkerRegistrationOptions(GURL(kPattern2)), + GURL(kScript2), + blink::mojom::ServiceWorkerRegistrationOptions(GURL(kPattern2)), nullptr, base::AdaptCallbackForRepeating( base::BindOnce(&RegisterServiceWorkerCallback, &called_2,
diff --git a/content/browser/background_sync/background_sync_service_impl_unittest.cc b/content/browser/background_sync/background_sync_service_impl_unittest.cc index 0c1bedb..2f53953b 100644 --- a/content/browser/background_sync/background_sync_service_impl_unittest.cc +++ b/content/browser/background_sync/background_sync_service_impl_unittest.cc
@@ -27,6 +27,7 @@ #include "mojo/public/cpp/bindings/interface_ptr.h" #include "net/base/network_change_notifier.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -163,7 +164,9 @@ bool called = false; embedded_worker_helper_->context()->RegisterServiceWorker( GURL(kServiceWorkerScript), - ServiceWorkerRegistrationOptions(GURL(kServiceWorkerPattern)), nullptr, + blink::mojom::ServiceWorkerRegistrationOptions( + GURL(kServiceWorkerPattern)), + nullptr, base::AdaptCallbackForRepeating(base::BindOnce( &RegisterServiceWorkerCallback, &called, &sw_registration_id_))); base::RunLoop().RunUntilIdle();
diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc index 42b00290..8cfe16c 100644 --- a/content/browser/browser_context.cc +++ b/content/browser/browser_context.cc
@@ -118,14 +118,16 @@ BrowserContext* browser_context, const std::string& partition_domain, const std::string& partition_name, - bool in_memory) { + bool in_memory, + bool can_create) { StoragePartitionImplMap* partition_map = GetStoragePartitionMap(browser_context); if (browser_context->IsOffTheRecord()) in_memory = true; - return partition_map->Get(partition_domain, partition_name, in_memory); + return partition_map->Get(partition_domain, partition_name, in_memory, + can_create); } void SaveSessionStateOnIOThread( @@ -257,7 +259,8 @@ StoragePartition* BrowserContext::GetStoragePartition( BrowserContext* browser_context, - SiteInstance* site_instance) { + SiteInstance* site_instance, + bool can_create) { std::string partition_domain; std::string partition_name; bool in_memory = false; @@ -268,13 +271,14 @@ &partition_domain, &partition_name, &in_memory); } - return GetStoragePartitionFromConfig( - browser_context, partition_domain, partition_name, in_memory); + return GetStoragePartitionFromConfig(browser_context, partition_domain, + partition_name, in_memory, can_create); } StoragePartition* BrowserContext::GetStoragePartitionForSite( BrowserContext* browser_context, - const GURL& site) { + const GURL& site, + bool can_create) { std::string partition_domain; std::string partition_name; bool in_memory; @@ -283,8 +287,8 @@ browser_context, site, true, &partition_domain, &partition_name, &in_memory); - return GetStoragePartitionFromConfig( - browser_context, partition_domain, partition_name, in_memory); + return GetStoragePartitionFromConfig(browser_context, partition_domain, + partition_name, in_memory, can_create); } void BrowserContext::ForEachStoragePartition(
diff --git a/content/browser/notifications/platform_notification_context_unittest.cc b/content/browser/notifications/platform_notification_context_unittest.cc index c1938fc..c548bcf 100644 --- a/content/browser/notifications/platform_notification_context_unittest.cc +++ b/content/browser/notifications/platform_notification_context_unittest.cc
@@ -21,6 +21,7 @@ #include "content/test/mock_platform_notification_service.h" #include "content/test/test_content_browser_client.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" #include "url/gurl.h" namespace content { @@ -328,7 +329,7 @@ // Register a Service Worker to get a valid registration id. embedded_worker_test_helper->context()->RegisterServiceWorker( - script_url, ServiceWorkerRegistrationOptions(origin), + script_url, blink::mojom::ServiceWorkerRegistrationOptions(origin), nullptr /* provider_host */, base::Bind(&PlatformNotificationContextTest::DidRegisterServiceWorker, base::Unretained(this), &service_worker_registration_id));
diff --git a/content/browser/payments/payment_app_content_unittest_base.cc b/content/browser/payments/payment_app_content_unittest_base.cc index e28ae7c..d24d5bd 100644 --- a/content/browser/payments/payment_app_content_unittest_base.cc +++ b/content/browser/payments/payment_app_content_unittest_base.cc
@@ -21,6 +21,7 @@ #include "content/public/test/test_browser_thread_bundle.h" #include "mojo/public/cpp/bindings/associated_interface_ptr.h" #include "mojo/public/cpp/bindings/interface_request.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -139,7 +140,7 @@ // Register service worker for payment manager. bool called = false; int64_t registration_id; - ServiceWorkerRegistrationOptions registration_opt(scope_url); + blink::mojom::ServiceWorkerRegistrationOptions registration_opt(scope_url); worker_helper_->context()->RegisterServiceWorker( sw_script_url, registration_opt, nullptr, base::Bind(&RegisterServiceWorkerCallback, &called, ®istration_id));
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index cca5ba1d..b0aad8f4 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -871,9 +871,6 @@ bool ShouldUseSiteProcessTracking(BrowserContext* browser_context, StoragePartition* dest_partition, const GURL& site_url) { - if (site_url.is_empty()) - return false; - // TODO(alexmos): Sites should be tracked separately for each // StoragePartition. For now, track them only in the default one. StoragePartition* default_partition = @@ -887,12 +884,18 @@ bool ShouldTrackProcessForSite(BrowserContext* browser_context, RenderProcessHost* render_process_host, const GURL& site_url) { + if (site_url.is_empty()) + return false; + return ShouldUseSiteProcessTracking( browser_context, render_process_host->GetStoragePartition(), site_url); } bool ShouldFindReusableProcessHostForSite(BrowserContext* browser_context, const GURL& site_url) { + if (site_url.is_empty()) + return false; + return ShouldUseSiteProcessTracking( browser_context, BrowserContext::GetStoragePartitionForSite(browser_context, site_url), @@ -3586,7 +3589,8 @@ // Make sure the chosen process is in the correct StoragePartition for the // SiteInstance. CHECK(render_process_host->InSameStoragePartition( - BrowserContext::GetStoragePartition(browser_context, site_instance))); + BrowserContext::GetStoragePartition(browser_context, site_instance, + false /* can_create */))); return render_process_host; }
diff --git a/content/browser/service_worker/embedded_worker_instance_unittest.cc b/content/browser/service_worker/embedded_worker_instance_unittest.cc index fd61944..c3e93b28 100644 --- a/content/browser/service_worker/embedded_worker_instance_unittest.cc +++ b/content/browser/service_worker/embedded_worker_instance_unittest.cc
@@ -30,6 +30,7 @@ #include "mojo/public/cpp/bindings/strong_binding.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -64,7 +65,7 @@ private: // Implements mojom::ServiceWorkerContainerHost. void Register(const GURL& script_url, - const ServiceWorkerRegistrationOptions& options, + blink::mojom::ServiceWorkerRegistrationOptionsPtr options, RegisterCallback callback) override { NOTIMPLEMENTED(); }
diff --git a/content/browser/service_worker/foreign_fetch_request_handler_unittest.cc b/content/browser/service_worker/foreign_fetch_request_handler_unittest.cc index ef7f7bf..7f55a3c 100644 --- a/content/browser/service_worker/foreign_fetch_request_handler_unittest.cc +++ b/content/browser/service_worker/foreign_fetch_request_handler_unittest.cc
@@ -28,6 +28,7 @@ #include "net/url_request/url_request_test_util.h" #include "storage/browser/blob/blob_storage_context.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -76,9 +77,9 @@ // Create a registration for the worker which has foreign fetch event // handler. - registration_ = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope), - kRegistrationId, context()->AsWeakPtr()); + registration_ = new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope), kRegistrationId, + context()->AsWeakPtr()); version_ = new ServiceWorkerVersion(registration_.get(), kResource1, kVersionId, context()->AsWeakPtr()); version_->set_foreign_fetch_scopes({kScope}); @@ -187,8 +188,9 @@ // fetch event handler. scoped_refptr<ServiceWorkerRegistration> registration = new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(GURL("https://host/scope")), 1L, - context()->AsWeakPtr()); + blink::mojom::ServiceWorkerRegistrationOptions( + GURL("https://host/scope")), + 1L, context()->AsWeakPtr()); scoped_refptr<ServiceWorkerVersion> version = new ServiceWorkerVersion( registration.get(), GURL("https://host/script.js"), 1L, context()->AsWeakPtr());
diff --git a/content/browser/service_worker/link_header_support_unittest.cc b/content/browser/service_worker/link_header_support_unittest.cc index 3213df6..37ffb73 100644 --- a/content/browser/service_worker/link_header_support_unittest.cc +++ b/content/browser/service_worker/link_header_support_unittest.cc
@@ -24,6 +24,7 @@ #include "net/url_request/url_request_test_util.h" #include "storage/browser/blob/blob_storage_context.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -108,8 +109,9 @@ void CreateServiceWorkerProviderHost() { scoped_refptr<ServiceWorkerRegistration> registration = new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(GURL("https://host/scope")), 1L, - context()->AsWeakPtr()); + blink::mojom::ServiceWorkerRegistrationOptions( + GURL("https://host/scope")), + 1L, context()->AsWeakPtr()); scoped_refptr<ServiceWorkerVersion> version = new ServiceWorkerVersion( registration.get(), GURL("https://host/script.js"), 1L, context()->AsWeakPtr());
diff --git a/content/browser/service_worker/service_worker_browsertest.cc b/content/browser/service_worker/service_worker_browsertest.cc index 0efabf8..b0077e6c 100644 --- a/content/browser/service_worker/service_worker_browsertest.cc +++ b/content/browser/service_worker/service_worker_browsertest.cc
@@ -83,6 +83,7 @@ #include "storage/browser/blob/blob_data_snapshot.h" #include "storage/browser/blob/blob_reader.h" #include "storage/browser/blob/blob_storage_context.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -642,7 +643,7 @@ ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); const GURL pattern = embedded_test_server()->GetURL("/service_worker/"); registration_ = new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(pattern), + blink::mojom::ServiceWorkerRegistrationOptions(pattern), wrapper()->context()->storage()->NewRegistrationId(), wrapper()->context()->AsWeakPtr()); // Set the update check time to avoid triggering updates in the middle of
diff --git a/content/browser/service_worker/service_worker_context_core.cc b/content/browser/service_worker/service_worker_context_core.cc index 82093de5..b1beed5 100644 --- a/content/browser/service_worker/service_worker_context_core.cc +++ b/content/browser/service_worker/service_worker_context_core.cc
@@ -39,6 +39,7 @@ #include "net/http/http_response_headers.h" #include "net/http/http_response_info.h" #include "storage/browser/quota/quota_manager_proxy.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" #include "url/gurl.h" namespace content { @@ -425,7 +426,7 @@ void ServiceWorkerContextCore::RegisterServiceWorker( const GURL& script_url, - const ServiceWorkerRegistrationOptions& options, + const blink::mojom::ServiceWorkerRegistrationOptions& options, ServiceWorkerProviderHost* provider_host, const RegistrationCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO);
diff --git a/content/browser/service_worker/service_worker_context_core.h b/content/browser/service_worker/service_worker_context_core.h index 07a4119..194f7c4 100644 --- a/content/browser/service_worker/service_worker_context_core.h +++ b/content/browser/service_worker/service_worker_context_core.h
@@ -25,6 +25,7 @@ #include "content/browser/service_worker/service_worker_storage.h" #include "content/common/content_export.h" #include "content/public/browser/service_worker_context.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" class GURL; @@ -195,10 +196,11 @@ const std::string& client_uuid); // Non-null |provider_host| must be given if this is called from a document. - void RegisterServiceWorker(const GURL& script_url, - const ServiceWorkerRegistrationOptions& options, - ServiceWorkerProviderHost* provider_host, - const RegistrationCallback& callback); + void RegisterServiceWorker( + const GURL& script_url, + const blink::mojom::ServiceWorkerRegistrationOptions& options, + ServiceWorkerProviderHost* provider_host, + const RegistrationCallback& callback); void UnregisterServiceWorker(const GURL& pattern, const UnregistrationCallback& callback);
diff --git a/content/browser/service_worker/service_worker_context_request_handler_unittest.cc b/content/browser/service_worker/service_worker_context_request_handler_unittest.cc index 4377ab783..a5c14367 100644 --- a/content/browser/service_worker/service_worker_context_request_handler_unittest.cc +++ b/content/browser/service_worker/service_worker_context_request_handler_unittest.cc
@@ -29,6 +29,7 @@ #include "net/url_request/url_request_test_util.h" #include "storage/browser/blob/blob_storage_context.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -67,7 +68,8 @@ script_url_ = GURL("https://host/script.js"); import_script_url_ = GURL("https://host/import.js"); registration_ = new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(scope_), 1L, context()->AsWeakPtr()); + blink::mojom::ServiceWorkerRegistrationOptions(scope_), 1L, + context()->AsWeakPtr()); version_ = new ServiceWorkerVersion(registration_.get(), script_url_, context()->storage()->NewVersionId(), context()->AsWeakPtr());
diff --git a/content/browser/service_worker/service_worker_context_unittest.cc b/content/browser/service_worker/service_worker_context_unittest.cc index faf861b..fb53b8e 100644 --- a/content/browser/service_worker/service_worker_context_unittest.cc +++ b/content/browser/service_worker/service_worker_context_unittest.cc
@@ -28,6 +28,7 @@ #include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -218,8 +219,8 @@ int64_t registration_id = kInvalidServiceWorkerRegistrationId; bool called = false; context()->RegisterServiceWorker( - script_url, ServiceWorkerRegistrationOptions(pattern), nullptr, - MakeRegisteredCallback(&called, ®istration_id)); + script_url, blink::mojom::ServiceWorkerRegistrationOptions(pattern), + nullptr, MakeRegisteredCallback(&called, ®istration_id)); ASSERT_FALSE(called); base::RunLoop().RunUntilIdle(); @@ -269,8 +270,8 @@ int64_t registration_id = kInvalidServiceWorkerRegistrationId; bool called = false; context()->RegisterServiceWorker( - script_url, ServiceWorkerRegistrationOptions(pattern), nullptr, - MakeRegisteredCallback(&called, ®istration_id)); + script_url, blink::mojom::ServiceWorkerRegistrationOptions(pattern), + nullptr, MakeRegisteredCallback(&called, ®istration_id)); ASSERT_FALSE(called); base::RunLoop().RunUntilIdle(); @@ -319,8 +320,8 @@ int64_t registration_id = kInvalidServiceWorkerRegistrationId; bool called = false; context()->RegisterServiceWorker( - script_url, ServiceWorkerRegistrationOptions(pattern), nullptr, - MakeRegisteredCallback(&called, ®istration_id)); + script_url, blink::mojom::ServiceWorkerRegistrationOptions(pattern), + nullptr, MakeRegisteredCallback(&called, ®istration_id)); ASSERT_FALSE(called); base::RunLoop().RunUntilIdle(); @@ -357,7 +358,7 @@ int64_t registration_id = kInvalidServiceWorkerRegistrationId; context()->RegisterServiceWorker( GURL("http://www.example.com/service_worker.js"), - ServiceWorkerRegistrationOptions(pattern), nullptr, + blink::mojom::ServiceWorkerRegistrationOptions(pattern), nullptr, MakeRegisteredCallback(&called, ®istration_id)); ASSERT_FALSE(called); @@ -405,19 +406,19 @@ int64_t registration_id4 = kInvalidServiceWorkerRegistrationId; context()->RegisterServiceWorker( GURL("http://www.example.com/service_worker.js"), - ServiceWorkerRegistrationOptions(origin1_p1), nullptr, + blink::mojom::ServiceWorkerRegistrationOptions(origin1_p1), nullptr, MakeRegisteredCallback(&called, ®istration_id1)); context()->RegisterServiceWorker( GURL("http://www.example.com/service_worker2.js"), - ServiceWorkerRegistrationOptions(origin1_p2), nullptr, + blink::mojom::ServiceWorkerRegistrationOptions(origin1_p2), nullptr, MakeRegisteredCallback(&called, ®istration_id2)); context()->RegisterServiceWorker( GURL("http://www.example.com:8080/service_worker3.js"), - ServiceWorkerRegistrationOptions(origin2_p1), nullptr, + blink::mojom::ServiceWorkerRegistrationOptions(origin2_p1), nullptr, MakeRegisteredCallback(&called, ®istration_id3)); context()->RegisterServiceWorker( GURL("http://www.other.com/service_worker4.js"), - ServiceWorkerRegistrationOptions(origin3_p1), nullptr, + blink::mojom::ServiceWorkerRegistrationOptions(origin3_p1), nullptr, MakeRegisteredCallback(&called, ®istration_id4)); ASSERT_FALSE(called); @@ -498,7 +499,7 @@ int64_t old_registration_id = kInvalidServiceWorkerRegistrationId; context()->RegisterServiceWorker( GURL("http://www.example.com/service_worker.js"), - ServiceWorkerRegistrationOptions(pattern), nullptr, + blink::mojom::ServiceWorkerRegistrationOptions(pattern), nullptr, MakeRegisteredCallback(&called, &old_registration_id)); ASSERT_FALSE(called); @@ -510,7 +511,7 @@ int64_t new_registration_id = kInvalidServiceWorkerRegistrationId; context()->RegisterServiceWorker( GURL("http://www.example.com/service_worker_new.js"), - ServiceWorkerRegistrationOptions(pattern), nullptr, + blink::mojom::ServiceWorkerRegistrationOptions(pattern), nullptr, MakeRegisteredCallback(&called, &new_registration_id)); ASSERT_FALSE(called); @@ -538,8 +539,8 @@ bool called = false; int64_t old_registration_id = kInvalidServiceWorkerRegistrationId; context()->RegisterServiceWorker( - script_url, ServiceWorkerRegistrationOptions(pattern), nullptr, - MakeRegisteredCallback(&called, &old_registration_id)); + script_url, blink::mojom::ServiceWorkerRegistrationOptions(pattern), + nullptr, MakeRegisteredCallback(&called, &old_registration_id)); ASSERT_FALSE(called); base::RunLoop().RunUntilIdle(); @@ -549,8 +550,8 @@ called = false; int64_t new_registration_id = kInvalidServiceWorkerRegistrationId; context()->RegisterServiceWorker( - script_url, ServiceWorkerRegistrationOptions(pattern), nullptr, - MakeRegisteredCallback(&called, &new_registration_id)); + script_url, blink::mojom::ServiceWorkerRegistrationOptions(pattern), + nullptr, MakeRegisteredCallback(&called, &new_registration_id)); ASSERT_FALSE(called); base::RunLoop().RunUntilIdle(); @@ -602,7 +603,7 @@ // Since the provider host is created via // CreateProviderHostForServiceWorkerContext, the provider_id is not a fixed // number. - ServiceWorkerRegistrationOptions registration_opt( + blink::mojom::ServiceWorkerRegistrationOptions registration_opt( GURL("http://www.example.com/test/")); scoped_refptr<ServiceWorkerRegistration> registration = base::MakeRefCounted<ServiceWorkerRegistration>( @@ -696,8 +697,8 @@ int64_t registration_id = kInvalidServiceWorkerRegistrationId; bool called = false; context()->RegisterServiceWorker( - script_url, ServiceWorkerRegistrationOptions(pattern), nullptr, - MakeRegisteredCallback(&called, ®istration_id)); + script_url, blink::mojom::ServiceWorkerRegistrationOptions(pattern), + nullptr, MakeRegisteredCallback(&called, ®istration_id)); ASSERT_FALSE(called); content::RunAllBlockingPoolTasksUntilIdle(); @@ -740,8 +741,8 @@ called = false; context()->RegisterServiceWorker( - script_url, ServiceWorkerRegistrationOptions(pattern), nullptr, - MakeRegisteredCallback(&called, ®istration_id)); + script_url, blink::mojom::ServiceWorkerRegistrationOptions(pattern), + nullptr, MakeRegisteredCallback(&called, ®istration_id)); ASSERT_FALSE(called); content::RunAllBlockingPoolTasksUntilIdle();
diff --git a/content/browser/service_worker/service_worker_context_watcher_unittest.cc b/content/browser/service_worker/service_worker_context_watcher_unittest.cc index 67249fe..1166b3d 100644 --- a/content/browser/service_worker/service_worker_context_watcher_unittest.cc +++ b/content/browser/service_worker/service_worker_context_watcher_unittest.cc
@@ -11,6 +11,7 @@ #include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/public/test/test_browser_thread_bundle.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -142,7 +143,7 @@ int64_t RegisterServiceWorker(const GURL& scope, const GURL& script_url) { int64_t registration_id = kInvalidServiceWorkerRegistrationId; context()->RegisterServiceWorker( - script_url, ServiceWorkerRegistrationOptions(scope), + script_url, blink::mojom::ServiceWorkerRegistrationOptions(scope), nullptr /* provider_host */, base::Bind(&DidRegisterServiceWorker, ®istration_id)); base::RunLoop().RunUntilIdle();
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc index 3b3ed5c6..d507875 100644 --- a/content/browser/service_worker/service_worker_context_wrapper.cc +++ b/content/browser/service_worker/service_worker_context_wrapper.cc
@@ -33,6 +33,7 @@ #include "net/base/url_util.h" #include "storage/browser/quota/quota_manager_proxy.h" #include "storage/browser/quota/special_storage_policy.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -278,7 +279,8 @@ base::BindOnce(std::move(callback), false)); return; } - ServiceWorkerRegistrationOptions options(net::SimplifyUrlForRequest(pattern)); + blink::mojom::ServiceWorkerRegistrationOptions options( + net::SimplifyUrlForRequest(pattern)); context()->RegisterServiceWorker( net::SimplifyUrlForRequest(script_url), options, nullptr /* provider_host */,
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc b/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc index 9bc3a28..2bd21965 100644 --- a/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc +++ b/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc
@@ -35,6 +35,7 @@ #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_test_util.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -104,7 +105,8 @@ scope_ = GURL("https://host/scope/"); script_url_ = GURL("https://host/script.js"); registration_ = new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(scope_), 1L, context()->AsWeakPtr()); + blink::mojom::ServiceWorkerRegistrationOptions(scope_), 1L, + context()->AsWeakPtr()); version_ = new ServiceWorkerVersion( registration_.get(), script_url_, 1L, context()->AsWeakPtr());
diff --git a/content/browser/service_worker/service_worker_data_pipe_reader.cc b/content/browser/service_worker/service_worker_data_pipe_reader.cc index 99207bf..b0d9a98 100644 --- a/content/browser/service_worker/service_worker_data_pipe_reader.cc +++ b/content/browser/service_worker/service_worker_data_pipe_reader.cc
@@ -24,14 +24,14 @@ producer_state_(State::kStreaming) { TRACE_EVENT_ASYNC_BEGIN1("ServiceWorker", "ServiceWorkerDataPipeReader", this, "Url", owner->request()->url().spec()); - streaming_version_->AddStreamingURLRequestJob(owner_); + streaming_version_->OnStreamResponseStarted(); binding_.set_connection_error_handler(base::BindOnce( &ServiceWorkerDataPipeReader::OnAborted, base::Unretained(this))); } ServiceWorkerDataPipeReader::~ServiceWorkerDataPipeReader() { DCHECK(streaming_version_); - streaming_version_->RemoveStreamingURLRequestJob(owner_); + streaming_version_->OnStreamResponseFinished(); streaming_version_ = nullptr; TRACE_EVENT_ASYNC_END0("ServiceWorker", "ServiceWorkerDataPipeReader", this);
diff --git a/content/browser/service_worker/service_worker_data_pipe_reader_unittest.cc b/content/browser/service_worker/service_worker_data_pipe_reader_unittest.cc index a769dba..b26f614 100644 --- a/content/browser/service_worker/service_worker_data_pipe_reader_unittest.cc +++ b/content/browser/service_worker/service_worker_data_pipe_reader_unittest.cc
@@ -15,6 +15,7 @@ #include "content/public/test/test_browser_thread_bundle.h" #include "net/base/io_buffer.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -79,7 +80,8 @@ helper_ = base::MakeUnique<EmbeddedWorkerTestHelper>(base::FilePath()); mock_url_request_job_ = base::MakeUnique<MockServiceWorkerURLRequestJob>(this); - ServiceWorkerRegistrationOptions options(GURL("https://example.com/")); + blink::mojom::ServiceWorkerRegistrationOptions options( + GURL("https://example.com/")); registration_ = new ServiceWorkerRegistration( options, 1L, helper_->context()->AsWeakPtr()); version_ = new ServiceWorkerVersion(
diff --git a/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc b/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc index 9c5bacf..1d22e6d 100644 --- a/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc +++ b/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc
@@ -35,6 +35,7 @@ #include "content/test/test_content_browser_client.h" #include "mojo/edk/embedder/embedder.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -177,7 +178,8 @@ void SetUpRegistration(const GURL& scope, const GURL& script_url) { registration_ = new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(scope), 1L, context()->AsWeakPtr()); + blink::mojom::ServiceWorkerRegistrationOptions(scope), 1L, + context()->AsWeakPtr()); version_ = new ServiceWorkerVersion(registration_.get(), script_url, 1L, context()->AsWeakPtr()); std::vector<ServiceWorkerDatabase::ResourceRecord> records; @@ -234,9 +236,9 @@ void SendRegister(mojom::ServiceWorkerContainerHost* container_host, GURL pattern, GURL worker_url) { - ServiceWorkerRegistrationOptions options(pattern); + auto options = blink::mojom::ServiceWorkerRegistrationOptions::New(pattern); container_host->Register( - worker_url, options, + worker_url, std::move(options), base::BindOnce( [](blink::mojom::ServiceWorkerErrorType error, const base::Optional<std::string>& error_msg, @@ -252,9 +254,9 @@ GURL worker_url, blink::mojom::ServiceWorkerErrorType expected) { blink::mojom::ServiceWorkerErrorType error; - ServiceWorkerRegistrationOptions options(pattern); + auto options = blink::mojom::ServiceWorkerRegistrationOptions::New(pattern); container_host->Register( - worker_url, options, + worker_url, std::move(options), base::BindOnce( [](blink::mojom::ServiceWorkerErrorType* out_error, blink::mojom::ServiceWorkerErrorType error, @@ -427,7 +429,8 @@ const int64_t kRegistrationId = 999; // Dummy value scoped_refptr<ServiceWorkerRegistration> registration( new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(GURL("https://www.example.com/")), + blink::mojom::ServiceWorkerRegistrationOptions( + GURL("https://www.example.com/")), kRegistrationId, context()->AsWeakPtr())); Unregister(kProviderId, kRegistrationId, ServiceWorkerMsg_ServiceWorkerUnregistrationError::ID);
diff --git a/content/browser/service_worker/service_worker_handle_unittest.cc b/content/browser/service_worker/service_worker_handle_unittest.cc index 1bb961f6..6066d975 100644 --- a/content/browser/service_worker/service_worker_handle_unittest.cc +++ b/content/browser/service_worker/service_worker_handle_unittest.cc
@@ -24,6 +24,7 @@ #include "ipc/ipc_test_sink.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerState.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -79,9 +80,9 @@ dispatcher_host_->Init(helper_->context_wrapper()); const GURL pattern("http://www.example.com/"); - registration_ = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(pattern), - 1L, helper_->context()->AsWeakPtr()); + registration_ = new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(pattern), 1L, + helper_->context()->AsWeakPtr()); version_ = new ServiceWorkerVersion( registration_.get(), GURL("http://www.example.com/service_worker.js"),
diff --git a/content/browser/service_worker/service_worker_installed_scripts_sender_unittest.cc b/content/browser/service_worker/service_worker_installed_scripts_sender_unittest.cc index 42d2189..e208be27 100644 --- a/content/browser/service_worker/service_worker_installed_scripts_sender_unittest.cc +++ b/content/browser/service_worker/service_worker_installed_scripts_sender_unittest.cc
@@ -16,6 +16,7 @@ #include "net/base/io_buffer.h" #include "net/base/test_completion_callback.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -237,7 +238,8 @@ pattern_ = GURL("http://www.example.com/test/"); registration_ = base::MakeRefCounted<ServiceWorkerRegistration>( - ServiceWorkerRegistrationOptions(pattern_), 1L, context()->AsWeakPtr()); + blink::mojom::ServiceWorkerRegistrationOptions(pattern_), 1L, + context()->AsWeakPtr()); version_ = base::MakeRefCounted<ServiceWorkerVersion>( registration_.get(), GURL("http://www.example.com/test/service_worker.js"),
diff --git a/content/browser/service_worker/service_worker_job_coordinator.cc b/content/browser/service_worker/service_worker_job_coordinator.cc index 6577fa8..9ccc16f60 100644 --- a/content/browser/service_worker/service_worker_job_coordinator.cc +++ b/content/browser/service_worker/service_worker_job_coordinator.cc
@@ -11,6 +11,7 @@ #include "base/memory/ptr_util.h" #include "content/browser/service_worker/service_worker_register_job_base.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -78,7 +79,7 @@ void ServiceWorkerJobCoordinator::Register( const GURL& script_url, - const ServiceWorkerRegistrationOptions& options, + const blink::mojom::ServiceWorkerRegistrationOptions& options, ServiceWorkerProviderHost* provider_host, const ServiceWorkerRegisterJob::RegistrationCallback& callback) { auto job =
diff --git a/content/browser/service_worker/service_worker_job_coordinator.h b/content/browser/service_worker/service_worker_job_coordinator.h index 94d133a..ae8d525 100644 --- a/content/browser/service_worker/service_worker_job_coordinator.h +++ b/content/browser/service_worker/service_worker_job_coordinator.h
@@ -13,6 +13,7 @@ #include "content/browser/service_worker/service_worker_register_job.h" #include "content/browser/service_worker/service_worker_unregister_job.h" #include "content/common/content_export.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" #include "url/gurl.h" namespace content { @@ -28,7 +29,7 @@ ~ServiceWorkerJobCoordinator(); void Register(const GURL& script_url, - const ServiceWorkerRegistrationOptions& options, + const blink::mojom::ServiceWorkerRegistrationOptions& options, ServiceWorkerProviderHost* provider_host, const ServiceWorkerRegisterJob::RegistrationCallback& callback);
diff --git a/content/browser/service_worker/service_worker_job_unittest.cc b/content/browser/service_worker/service_worker_job_unittest.cc index ec12fdd8..deb8f5ef 100644 --- a/content/browser/service_worker/service_worker_job_unittest.cc +++ b/content/browser/service_worker/service_worker_job_unittest.cc
@@ -38,6 +38,7 @@ #include "net/base/test_completion_callback.h" #include "net/http/http_response_headers.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" using net::IOBuffer; using net::TestCompletionCallback; @@ -234,8 +235,8 @@ scoped_refptr<ServiceWorkerRegistration> registration; bool called; job_coordinator()->Register( - script_url, ServiceWorkerRegistrationOptions(pattern), nullptr, - SaveRegistration(expected_status, &called, ®istration)); + script_url, blink::mojom::ServiceWorkerRegistrationOptions(pattern), + nullptr, SaveRegistration(expected_status, &called, ®istration)); EXPECT_TRUE(is_job_timer_running()); EXPECT_FALSE(called); base::RunLoop().RunUntilIdle(); @@ -339,7 +340,8 @@ scoped_refptr<ServiceWorkerRegistration> original_registration1; job_coordinator()->Register( GURL("http://www.example.com/service_worker.js"), - ServiceWorkerRegistrationOptions(GURL("http://www.example.com/one/")), + blink::mojom::ServiceWorkerRegistrationOptions( + GURL("http://www.example.com/one/")), nullptr, SaveRegistration(SERVICE_WORKER_OK, &called1, &original_registration1)); @@ -347,7 +349,8 @@ scoped_refptr<ServiceWorkerRegistration> original_registration2; job_coordinator()->Register( GURL("http://www.example.com/service_worker.js"), - ServiceWorkerRegistrationOptions(GURL("http://www.example.com/two/")), + blink::mojom::ServiceWorkerRegistrationOptions( + GURL("http://www.example.com/two/")), nullptr, SaveRegistration(SERVICE_WORKER_OK, &called2, &original_registration2)); @@ -420,7 +423,8 @@ scoped_refptr<ServiceWorkerRegistration> registration1; job_coordinator()->Register( GURL("http://www.example.com/service_worker.js"), - ServiceWorkerRegistrationOptions(GURL("http://www.example.com/one/")), + blink::mojom::ServiceWorkerRegistrationOptions( + GURL("http://www.example.com/one/")), nullptr, SaveRegistration(SERVICE_WORKER_ERROR_ABORT, &called1, ®istration1)); @@ -428,7 +432,8 @@ scoped_refptr<ServiceWorkerRegistration> registration2; job_coordinator()->Register( GURL("http://www.example.com/service_worker.js"), - ServiceWorkerRegistrationOptions(GURL("http://www.example.com/two/")), + blink::mojom::ServiceWorkerRegistrationOptions( + GURL("http://www.example.com/two/")), nullptr, SaveRegistration(SERVICE_WORKER_ERROR_ABORT, &called2, ®istration2)); @@ -602,7 +607,8 @@ bool registration_called = false; scoped_refptr<ServiceWorkerRegistration> registration; job_coordinator()->Register( - script_url, ServiceWorkerRegistrationOptions(pattern), nullptr, + script_url, blink::mojom::ServiceWorkerRegistrationOptions(pattern), + nullptr, SaveRegistration(SERVICE_WORKER_OK, ®istration_called, ®istration)); bool unregistration_called = false; @@ -632,7 +638,8 @@ bool registration1_called = false; scoped_refptr<ServiceWorkerRegistration> registration1; job_coordinator()->Register( - script_url1, ServiceWorkerRegistrationOptions(pattern), nullptr, + script_url1, blink::mojom::ServiceWorkerRegistrationOptions(pattern), + nullptr, SaveRegistration(SERVICE_WORKER_OK, ®istration1_called, ®istration1)); @@ -640,7 +647,8 @@ bool registration2_called = false; scoped_refptr<ServiceWorkerRegistration> registration2; job_coordinator()->Register( - script_url2, ServiceWorkerRegistrationOptions(pattern), nullptr, + script_url2, blink::mojom::ServiceWorkerRegistrationOptions(pattern), + nullptr, SaveRegistration(SERVICE_WORKER_OK, ®istration2_called, ®istration2)); @@ -666,14 +674,16 @@ bool registration1_called = false; scoped_refptr<ServiceWorkerRegistration> registration1; job_coordinator()->Register( - script_url, ServiceWorkerRegistrationOptions(pattern), nullptr, + script_url, blink::mojom::ServiceWorkerRegistrationOptions(pattern), + nullptr, SaveRegistration(SERVICE_WORKER_OK, ®istration1_called, ®istration1)); bool registration2_called = false; scoped_refptr<ServiceWorkerRegistration> registration2; job_coordinator()->Register( - script_url, ServiceWorkerRegistrationOptions(pattern), nullptr, + script_url, blink::mojom::ServiceWorkerRegistrationOptions(pattern), + nullptr, SaveRegistration(SERVICE_WORKER_OK, ®istration2_called, ®istration2)); @@ -732,14 +742,16 @@ bool registration_called1 = false; scoped_refptr<ServiceWorkerRegistration> registration1; job_coordinator()->Register( - script_url1, ServiceWorkerRegistrationOptions(pattern1), nullptr, + script_url1, blink::mojom::ServiceWorkerRegistrationOptions(pattern1), + nullptr, SaveRegistration(SERVICE_WORKER_ERROR_ABORT, ®istration_called1, ®istration1)); bool registration_called2 = false; scoped_refptr<ServiceWorkerRegistration> registration2; job_coordinator()->Register( - script_url2, ServiceWorkerRegistrationOptions(pattern2), nullptr, + script_url2, blink::mojom::ServiceWorkerRegistrationOptions(pattern2), + nullptr, SaveRegistration(SERVICE_WORKER_ERROR_ABORT, ®istration_called2, ®istration2)); @@ -803,7 +815,8 @@ bool registration_called = false; scoped_refptr<ServiceWorkerRegistration> registration; job_coordinator()->Register( - script_url, ServiceWorkerRegistrationOptions(pattern), nullptr, + script_url, blink::mojom::ServiceWorkerRegistrationOptions(pattern), + nullptr, SaveRegistration(SERVICE_WORKER_ERROR_ABORT, ®istration_called, ®istration)); @@ -1003,8 +1016,9 @@ bool called = false; job_coordinator()->Register( test_origin.Resolve(kScript), - ServiceWorkerRegistrationOptions(test_origin.Resolve(kScope)), nullptr, - SaveRegistration(SERVICE_WORKER_OK, &called, ®istration)); + blink::mojom::ServiceWorkerRegistrationOptions( + test_origin.Resolve(kScope)), + nullptr, SaveRegistration(SERVICE_WORKER_OK, &called, ®istration)); base::RunLoop().RunUntilIdle(); EXPECT_TRUE(called); EXPECT_TRUE(registration.get());
diff --git a/content/browser/service_worker/service_worker_provider_host.cc b/content/browser/service_worker/service_worker_provider_host.cc index 2f40ba41..5cf4117 100644 --- a/content/browser/service_worker/service_worker_provider_host.cc +++ b/content/browser/service_worker/service_worker_provider_host.cc
@@ -38,6 +38,7 @@ #include "mojo/public/cpp/bindings/strong_associated_binding.h" #include "net/base/url_util.h" #include "storage/browser/blob/blob_storage_context.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -897,7 +898,7 @@ void ServiceWorkerProviderHost::Register( const GURL& script_url, - const ServiceWorkerRegistrationOptions& options, + blink::mojom::ServiceWorkerRegistrationOptionsPtr options, RegisterCallback callback) { if (!dispatcher_host_ || !IsContextAlive()) { std::move(callback).Run(blink::mojom::ServiceWorkerErrorType::kAbort, @@ -916,7 +917,7 @@ } std::string error_message; - if (!IsValidRegisterMessage(script_url, options, &error_message)) { + if (!IsValidRegisterMessage(script_url, *options, &error_message)) { mojo::ReportBadMessage(error_message); // ReportBadMessage() will kill the renderer process, but Mojo complains if // the callback is not run. Just run it with nonsense arguments. @@ -926,7 +927,7 @@ } if (!GetContentClient()->browser()->AllowServiceWorker( - options.scope, topmost_frame_url(), + options->scope, topmost_frame_url(), dispatcher_host_->resource_context(), base::Bind(&GetWebContents, render_process_id_, frame_id()))) { std::move(callback).Run(blink::mojom::ServiceWorkerErrorType::kDisabled, @@ -939,9 +940,9 @@ int64_t trace_id = base::TimeTicks::Now().since_origin().InMicroseconds(); TRACE_EVENT_ASYNC_BEGIN2( "ServiceWorker", "ServiceWorkerProviderHost::Register", trace_id, "Scope", - options.scope.spec(), "Script URL", script_url.spec()); + options->scope.spec(), "Script URL", script_url.spec()); context_->RegisterServiceWorker( - script_url, options, this, + script_url, *options, this, base::AdaptCallbackForRepeating( base::BindOnce(&ServiceWorkerProviderHost::RegistrationComplete, AsWeakPtr(), std::move(callback), trace_id))); @@ -1208,7 +1209,7 @@ bool ServiceWorkerProviderHost::IsValidRegisterMessage( const GURL& script_url, - const ServiceWorkerRegistrationOptions& options, + const blink::mojom::ServiceWorkerRegistrationOptions& options, std::string* out_error) const { if (client_type() != blink::kWebServiceWorkerClientTypeWindow) { *out_error = kBadMessageFromNonWindow;
diff --git a/content/browser/service_worker/service_worker_provider_host.h b/content/browser/service_worker/service_worker_provider_host.h index 69d6304c..0a5f4a1f 100644 --- a/content/browser/service_worker/service_worker_provider_host.h +++ b/content/browser/service_worker/service_worker_provider_host.h
@@ -30,6 +30,7 @@ #include "content/public/common/resource_type.h" #include "content/public/common/service_worker_modes.h" #include "mojo/public/cpp/bindings/associated_binding.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace storage { class BlobStorageContext; @@ -387,7 +388,7 @@ // Implements mojom::ServiceWorkerContainerHost. void Register(const GURL& script_url, - const ServiceWorkerRegistrationOptions& options, + blink::mojom::ServiceWorkerRegistrationOptionsPtr options, RegisterCallback callback) override; void GetRegistration(const GURL& client_url, GetRegistrationCallback callback) override; @@ -415,9 +416,10 @@ const std::vector<scoped_refptr<ServiceWorkerRegistration>>& registrations); - bool IsValidRegisterMessage(const GURL& script_url, - const ServiceWorkerRegistrationOptions& options, - std::string* out_error) const; + bool IsValidRegisterMessage( + const GURL& script_url, + const blink::mojom::ServiceWorkerRegistrationOptions& options, + std::string* out_error) const; bool IsValidGetRegistrationMessage(const GURL& client_url, std::string* out_error) const; bool IsValidGetRegistrationsMessage(std::string* out_error) const;
diff --git a/content/browser/service_worker/service_worker_provider_host_unittest.cc b/content/browser/service_worker/service_worker_provider_host_unittest.cc index df6f1cd..5c1fe62 100644 --- a/content/browser/service_worker/service_worker_provider_host_unittest.cc +++ b/content/browser/service_worker/service_worker_provider_host_unittest.cc
@@ -29,6 +29,7 @@ #include "content/test/test_content_browser_client.h" #include "content/test/test_content_client.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -74,14 +75,16 @@ context_ = helper_->context(); script_url_ = GURL("https://www.example.com/service_worker.js"); registration1_ = new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(GURL("https://www.example.com/")), 1L, - context_->AsWeakPtr()); + blink::mojom::ServiceWorkerRegistrationOptions( + GURL("https://www.example.com/")), + 1L, context_->AsWeakPtr()); registration2_ = new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions( + blink::mojom::ServiceWorkerRegistrationOptions( GURL("https://www.example.com/example")), 2L, context_->AsWeakPtr()); registration3_ = new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(GURL("https://other.example.com/")), + blink::mojom::ServiceWorkerRegistrationOptions( + GURL("https://other.example.com/")), 3L, context_->AsWeakPtr()); } @@ -268,9 +271,10 @@ class MockServiceWorkerRegistration : public ServiceWorkerRegistration { public: - MockServiceWorkerRegistration(const ServiceWorkerRegistrationOptions& options, - int64_t registration_id, - base::WeakPtr<ServiceWorkerContextCore> context) + MockServiceWorkerRegistration( + const blink::mojom::ServiceWorkerRegistrationOptions& options, + int64_t registration_id, + base::WeakPtr<ServiceWorkerContextCore> context) : ServiceWorkerRegistration(options, registration_id, context) {} void AddListener(ServiceWorkerRegistration::Listener* listener) override { @@ -298,7 +302,8 @@ // Create a mock registration before creating the provider host which is in // the scope. - ServiceWorkerRegistrationOptions options(GURL("https://cross.example.com/")); + blink::mojom::ServiceWorkerRegistrationOptions options( + GURL("https://cross.example.com/")); scoped_refptr<MockServiceWorkerRegistration> registration = new MockServiceWorkerRegistration(options, 4L, helper_->context()->AsWeakPtr());
diff --git a/content/browser/service_worker/service_worker_read_from_cache_job_unittest.cc b/content/browser/service_worker/service_worker_read_from_cache_job_unittest.cc index 9253aa41..7cdd704 100644 --- a/content/browser/service_worker/service_worker_read_from_cache_job_unittest.cc +++ b/content/browser/service_worker/service_worker_read_from_cache_job_unittest.cc
@@ -26,6 +26,7 @@ #include "net/url_request/url_request_status.h" #include "net/url_request/url_request_test_util.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -91,7 +92,8 @@ // Populate a registration in the storage. registration_ = new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(GURL("http://example.com/scope")), + blink::mojom::ServiceWorkerRegistrationOptions( + GURL("http://example.com/scope")), kRegistrationId, context()->AsWeakPtr()); version_ = new ServiceWorkerVersion(registration_.get(), main_script_.url, kVersionId, context()->AsWeakPtr());
diff --git a/content/browser/service_worker/service_worker_register_job.cc b/content/browser/service_worker/service_worker_register_job.cc index 5f14189..d576500 100644 --- a/content/browser/service_worker/service_worker_register_job.cc +++ b/content/browser/service_worker/service_worker_register_job.cc
@@ -24,6 +24,7 @@ #include "content/public/browser/browser_thread.h" #include "mojo/public/cpp/bindings/associated_binding.h" #include "net/base/net_errors.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -69,7 +70,7 @@ ServiceWorkerRegisterJob::ServiceWorkerRegisterJob( base::WeakPtr<ServiceWorkerContextCore> context, const GURL& script_url, - const ServiceWorkerRegistrationOptions& options) + const blink::mojom::ServiceWorkerRegistrationOptions& options) : context_(context), job_type_(REGISTRATION_JOB), pattern_(options.scope), @@ -317,7 +318,8 @@ } set_registration(new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(pattern_), registration_id, context_)); + blink::mojom::ServiceWorkerRegistrationOptions(pattern_), registration_id, + context_)); AddRegistrationToMatchingProviderHosts(registration()); UpdateAndContinue(); }
diff --git a/content/browser/service_worker/service_worker_register_job.h b/content/browser/service_worker/service_worker_register_job.h index 56a0e8c..ce5acd0 100644 --- a/content/browser/service_worker/service_worker_register_job.h +++ b/content/browser/service_worker/service_worker_register_job.h
@@ -15,6 +15,7 @@ #include "content/browser/service_worker/service_worker_register_job_base.h" #include "content/browser/service_worker/service_worker_registration.h" #include "content/common/service_worker/service_worker_status_code.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" #include "url/gurl.h" namespace content { @@ -49,7 +50,7 @@ CONTENT_EXPORT ServiceWorkerRegisterJob( base::WeakPtr<ServiceWorkerContextCore> context, const GURL& script_url, - const ServiceWorkerRegistrationOptions& options); + const blink::mojom::ServiceWorkerRegistrationOptions& options); // For update jobs. CONTENT_EXPORT ServiceWorkerRegisterJob(
diff --git a/content/browser/service_worker/service_worker_registration.cc b/content/browser/service_worker/service_worker_registration.cc index d5706a8..ab8cb76 100644 --- a/content/browser/service_worker/service_worker_registration.cc +++ b/content/browser/service_worker/service_worker_registration.cc
@@ -16,6 +16,7 @@ #include "content/common/service_worker/service_worker_messages.h" #include "content/common/service_worker/service_worker_utils.h" #include "content/public/browser/browser_thread.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -38,7 +39,7 @@ } // namespace ServiceWorkerRegistration::ServiceWorkerRegistration( - const ServiceWorkerRegistrationOptions& options, + const blink::mojom::ServiceWorkerRegistrationOptions& options, int64_t registration_id, base::WeakPtr<ServiceWorkerContextCore> context) : pattern_(options.scope),
diff --git a/content/browser/service_worker/service_worker_registration.h b/content/browser/service_worker/service_worker_registration.h index ecbe251..32f2df8 100644 --- a/content/browser/service_worker/service_worker_registration.h +++ b/content/browser/service_worker/service_worker_registration.h
@@ -18,6 +18,7 @@ #include "content/browser/service_worker/service_worker_version.h" #include "content/common/content_export.h" #include "content/common/service_worker/service_worker_types.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" #include "url/gurl.h" namespace content { @@ -50,9 +51,10 @@ virtual void OnSkippedWaiting(ServiceWorkerRegistration* registation) {} }; - ServiceWorkerRegistration(const ServiceWorkerRegistrationOptions& options, - int64_t registration_id, - base::WeakPtr<ServiceWorkerContextCore> context); + ServiceWorkerRegistration( + const blink::mojom::ServiceWorkerRegistrationOptions& options, + int64_t registration_id, + base::WeakPtr<ServiceWorkerContextCore> context); int64_t id() const { return registration_id_; } const GURL& pattern() const { return pattern_; }
diff --git a/content/browser/service_worker/service_worker_registration_unittest.cc b/content/browser/service_worker/service_worker_registration_unittest.cc index 1d165fc..607247c1 100644 --- a/content/browser/service_worker/service_worker_registration_unittest.cc +++ b/content/browser/service_worker/service_worker_registration_unittest.cc
@@ -21,6 +21,7 @@ #include "content/common/service_worker/service_worker_utils.h" #include "content/public/test/test_browser_thread_bundle.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" #include "url/gurl.h" namespace content { @@ -109,8 +110,9 @@ const GURL kScript("http://www.example.not/service_worker.js"); int64_t kRegistrationId = 1L; scoped_refptr<ServiceWorkerRegistration> registration = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope), - kRegistrationId, context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope), + kRegistrationId, context()->AsWeakPtr()); const int64_t version_1_id = 1L; const int64_t version_2_id = 2L; @@ -176,8 +178,9 @@ const GURL kScope("http://www.example.not/"); int64_t kRegistrationId = 1L; scoped_refptr<ServiceWorkerRegistration> registration = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope), - kRegistrationId, context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope), + kRegistrationId, context()->AsWeakPtr()); std::unique_ptr<ServiceWorkerRegistrationHandle> handle( new ServiceWorkerRegistrationHandle( context()->AsWeakPtr(), base::WeakPtr<ServiceWorkerProviderHost>(), @@ -191,9 +194,9 @@ const GURL kScript("https://www.example.not/service_worker.js"); // Setup. scoped_refptr<ServiceWorkerRegistration> registration = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope), - storage()->NewRegistrationId(), - context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope), + storage()->NewRegistrationId(), context()->AsWeakPtr()); scoped_refptr<ServiceWorkerVersion> version_1 = new ServiceWorkerVersion( registration.get(), kScript, storage()->NewVersionId(), context()->AsWeakPtr()); @@ -236,7 +239,7 @@ const GURL kScript("https://www.example.not/service_worker.js"); registration_ = new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(kScope), + blink::mojom::ServiceWorkerRegistrationOptions(kScope), storage()->NewRegistrationId(), context()->AsWeakPtr()); // Create an active version.
diff --git a/content/browser/service_worker/service_worker_script_url_loader_unittest.cc b/content/browser/service_worker/service_worker_script_url_loader_unittest.cc index 5976756..192b543 100644 --- a/content/browser/service_worker/service_worker_script_url_loader_unittest.cc +++ b/content/browser/service_worker/service_worker_script_url_loader_unittest.cc
@@ -16,6 +16,7 @@ #include "net/http/http_util.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -93,7 +94,7 @@ GURL scope("https://www.example.com/"); GURL script_url("https://example.com/sw.js"); registration_ = base::MakeRefCounted<ServiceWorkerRegistration>( - ServiceWorkerRegistrationOptions(scope), 1L, + blink::mojom::ServiceWorkerRegistrationOptions(scope), 1L, helper_->context()->AsWeakPtr()); version_ = base::MakeRefCounted<ServiceWorkerVersion>( registration_.get(), script_url, 1L, helper_->context()->AsWeakPtr());
diff --git a/content/browser/service_worker/service_worker_storage.cc b/content/browser/service_worker/service_worker_storage.cc index b08b4b8..37a7e1c 100644 --- a/content/browser/service_worker/service_worker_storage.cc +++ b/content/browser/service_worker/service_worker_storage.cc
@@ -28,6 +28,7 @@ #include "net/base/net_errors.h" #include "storage/browser/quota/quota_manager_proxy.h" #include "storage/browser/quota/special_storage_policy.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" using std::swap; @@ -1400,8 +1401,8 @@ return registration; registration = new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(data.scope), data.registration_id, - context_); + blink::mojom::ServiceWorkerRegistrationOptions(data.scope), + data.registration_id, context_); registration->set_resources_total_size_bytes(data.resources_total_size_bytes); registration->set_last_update_check(data.last_update_check); if (pending_deletions_.find(data.registration_id) !=
diff --git a/content/browser/service_worker/service_worker_storage_unittest.cc b/content/browser/service_worker/service_worker_storage_unittest.cc index dc9532c..bc269cf 100644 --- a/content/browser/service_worker/service_worker_storage_unittest.cc +++ b/content/browser/service_worker/service_worker_storage_unittest.cc
@@ -38,6 +38,7 @@ #include "net/test/cert_test_util.h" #include "net/test/test_data_directory.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" using net::IOBuffer; using net::TestCompletionCallback; @@ -611,8 +612,9 @@ GetAllRegistrationsInfos(&all_registrations)); scoped_refptr<ServiceWorkerRegistration> live_registration = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope), - kRegistrationId, context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope), + kRegistrationId, context()->AsWeakPtr()); scoped_refptr<ServiceWorkerVersion> live_version = new ServiceWorkerVersion( live_registration.get(), kScript, kVersionId, context()->AsWeakPtr()); EXPECT_EQ(SERVICE_WORKER_ERROR_ABORT, @@ -699,8 +701,9 @@ // Store something. scoped_refptr<ServiceWorkerRegistration> live_registration = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope), - kRegistrationId, context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope), + kRegistrationId, context()->AsWeakPtr()); scoped_refptr<ServiceWorkerVersion> live_version = new ServiceWorkerVersion( live_registration.get(), kResource1, kVersionId, context()->AsWeakPtr()); live_version->set_fetch_handler_existence( @@ -827,9 +830,9 @@ // Trying to update a unstored registration to active should fail. scoped_refptr<ServiceWorkerRegistration> unstored_registration = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope), - kRegistrationId + 1, - context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope), + kRegistrationId + 1, context()->AsWeakPtr()); EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, UpdateToActiveState(unstored_registration)); unstored_registration = NULL; @@ -878,8 +881,9 @@ // Create an unstored registration. scoped_refptr<ServiceWorkerRegistration> live_registration = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope), - kRegistrationId, context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope), + kRegistrationId, context()->AsWeakPtr()); scoped_refptr<ServiceWorkerVersion> live_version = new ServiceWorkerVersion( live_registration.get(), kScript, kVersionId, context()->AsWeakPtr()); live_version->SetStatus(ServiceWorkerVersion::INSTALLING); @@ -1006,8 +1010,9 @@ // Store a registration. scoped_refptr<ServiceWorkerRegistration> live_registration = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope), - kRegistrationId, context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope), + kRegistrationId, context()->AsWeakPtr()); scoped_refptr<ServiceWorkerVersion> live_version = new ServiceWorkerVersion( live_registration.get(), kScript, kVersionId, context()->AsWeakPtr()); std::vector<ServiceWorkerDatabase::ResourceRecord> records; @@ -1684,8 +1689,9 @@ const int64_t kRegistrationId1 = 1; const int64_t kVersionId1 = 1; scoped_refptr<ServiceWorkerRegistration> live_registration1 = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope1), - kRegistrationId1, context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope1), + kRegistrationId1, context()->AsWeakPtr()); scoped_refptr<ServiceWorkerVersion> live_version1 = new ServiceWorkerVersion( live_registration1.get(), kScript1, kVersionId1, context()->AsWeakPtr()); std::vector<ServiceWorkerDatabase::ResourceRecord> records1; @@ -1703,8 +1709,9 @@ const int64_t kRegistrationId2 = 2; const int64_t kVersionId2 = 2; scoped_refptr<ServiceWorkerRegistration> live_registration2 = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope2), - kRegistrationId2, context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope2), + kRegistrationId2, context()->AsWeakPtr()); scoped_refptr<ServiceWorkerVersion> live_version2 = new ServiceWorkerVersion( live_registration2.get(), kScript2, kVersionId2, context()->AsWeakPtr()); std::vector<ServiceWorkerDatabase::ResourceRecord> records2; @@ -1722,8 +1729,9 @@ const int64_t kRegistrationId3 = 3; const int64_t kVersionId3 = 3; scoped_refptr<ServiceWorkerRegistration> live_registration3 = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope3), - kRegistrationId3, context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope3), + kRegistrationId3, context()->AsWeakPtr()); scoped_refptr<ServiceWorkerVersion> live_version3 = new ServiceWorkerVersion( live_registration3.get(), kScript3, kVersionId3, context()->AsWeakPtr()); std::vector<ServiceWorkerDatabase::ResourceRecord> records3; @@ -1787,8 +1795,9 @@ const int64_t kRegistrationId1 = 1; const int64_t kVersionId1 = 1; scoped_refptr<ServiceWorkerRegistration> live_registration1 = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope1), - kRegistrationId1, context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope1), + kRegistrationId1, context()->AsWeakPtr()); scoped_refptr<ServiceWorkerVersion> live_version1 = new ServiceWorkerVersion( live_registration1.get(), kScript1, kVersionId1, context()->AsWeakPtr()); std::vector<ServiceWorkerDatabase::ResourceRecord> records1; @@ -1807,8 +1816,9 @@ const int64_t kRegistrationId2 = 2; const int64_t kVersionId2 = 2; scoped_refptr<ServiceWorkerRegistration> live_registration2 = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope2), - kRegistrationId2, context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope2), + kRegistrationId2, context()->AsWeakPtr()); scoped_refptr<ServiceWorkerVersion> live_version2 = new ServiceWorkerVersion( live_registration2.get(), kScript2, kVersionId2, context()->AsWeakPtr()); std::vector<ServiceWorkerDatabase::ResourceRecord> records2; @@ -1827,8 +1837,9 @@ const int64_t kRegistrationId3 = 3; const int64_t kVersionId3 = 3; scoped_refptr<ServiceWorkerRegistration> live_registration3 = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope3), - kRegistrationId3, context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope3), + kRegistrationId3, context()->AsWeakPtr()); scoped_refptr<ServiceWorkerVersion> live_version3 = new ServiceWorkerVersion( live_registration3.get(), kScript3, kVersionId3, context()->AsWeakPtr()); std::vector<ServiceWorkerDatabase::ResourceRecord> records3; @@ -1980,8 +1991,9 @@ const int64_t kRegistrationId = 1; const int64_t kVersionId = 1; scoped_refptr<ServiceWorkerRegistration> registration = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope), - kRegistrationId, context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope), + kRegistrationId, context()->AsWeakPtr()); scoped_refptr<ServiceWorkerVersion> version = new ServiceWorkerVersion( registration.get(), kScript, kVersionId, context()->AsWeakPtr()); @@ -2108,8 +2120,9 @@ const int64_t kRegistrationId = 1; const int64_t kVersionId = 1; scoped_refptr<ServiceWorkerRegistration> registration = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope), - kRegistrationId, context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope), + kRegistrationId, context()->AsWeakPtr()); scoped_refptr<ServiceWorkerVersion> version = new ServiceWorkerVersion( registration.get(), kScript, kVersionId, context()->AsWeakPtr()); @@ -2154,8 +2167,9 @@ const int64_t kRegistrationId = 1; const int64_t kVersionId = 1; scoped_refptr<ServiceWorkerRegistration> registration = - new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(kScope), - kRegistrationId, context()->AsWeakPtr()); + new ServiceWorkerRegistration( + blink::mojom::ServiceWorkerRegistrationOptions(kScope), + kRegistrationId, context()->AsWeakPtr()); scoped_refptr<ServiceWorkerVersion> version = new ServiceWorkerVersion( registration.get(), kScript, kVersionId, context()->AsWeakPtr());
diff --git a/content/browser/service_worker/service_worker_url_loader_job.cc b/content/browser/service_worker/service_worker_url_loader_job.cc index aed1f58..2e131b4 100644 --- a/content/browser/service_worker/service_worker_url_loader_job.cc +++ b/content/browser/service_worker/service_worker_url_loader_job.cc
@@ -31,13 +31,11 @@ : owner_(owner), streaming_version_(streaming_version), binding_(this, std::move(callback_request)) { - streaming_version_->AddStreamingURLLoaderJob(owner_); + streaming_version_->OnStreamResponseStarted(); binding_.set_connection_error_handler( base::BindOnce(&StreamWaiter::OnAborted, base::Unretained(this))); } - ~StreamWaiter() override { - streaming_version_->RemoveStreamingURLLoaderJob(owner_); - } + ~StreamWaiter() override { streaming_version_->OnStreamResponseFinished(); } // Implements mojom::ServiceWorkerStreamCallback. void OnCompleted() override {
diff --git a/content/browser/service_worker/service_worker_url_loader_job_unittest.cc b/content/browser/service_worker/service_worker_url_loader_job_unittest.cc index 5a2f093..26f641c 100644 --- a/content/browser/service_worker/service_worker_url_loader_job_unittest.cc +++ b/content/browser/service_worker/service_worker_url_loader_job_unittest.cc
@@ -23,6 +23,7 @@ #include "storage/browser/blob/blob_data_builder.h" #include "storage/browser/blob/blob_storage_context.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -409,7 +410,8 @@ storage()->LazyInitializeForTest(base::BindOnce(&base::DoNothing)); base::RunLoop().RunUntilIdle(); registration_ = new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(GURL("https://example.com/")), + blink::mojom::ServiceWorkerRegistrationOptions( + GURL("https://example.com/")), storage()->NewRegistrationId(), helper_->context()->AsWeakPtr()); version_ = new ServiceWorkerVersion( registration_.get(), GURL("https://example.com/service_worker.js"),
diff --git a/content/browser/service_worker/service_worker_url_request_job_unittest.cc b/content/browser/service_worker/service_worker_url_request_job_unittest.cc index 11a2a32..f784fcf0 100644 --- a/content/browser/service_worker/service_worker_url_request_job_unittest.cc +++ b/content/browser/service_worker/service_worker_url_request_job_unittest.cc
@@ -62,6 +62,7 @@ #include "storage/browser/blob/blob_url_request_job_factory.h" #include "storage/common/blob_storage/blob_handle.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -207,8 +208,9 @@ // Create a registration and service worker version. registration_ = new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(GURL("https://example.com/")), 1L, - helper_->context()->AsWeakPtr()); + blink::mojom::ServiceWorkerRegistrationOptions( + GURL("https://example.com/")), + 1L, helper_->context()->AsWeakPtr()); version_ = new ServiceWorkerVersion( registration_.get(), GURL("https://example.com/service_worker.js"), 1L, helper_->context()->AsWeakPtr());
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc index 5c7a74d4..c37823d 100644 --- a/content/browser/service_worker/service_worker_version.cc +++ b/content/browser/service_worker/service_worker_version.cc
@@ -701,32 +701,14 @@ } } -void ServiceWorkerVersion::AddStreamingURLRequestJob( - const ServiceWorkerURLRequestJob* request_job) { - DCHECK(streaming_url_request_jobs_.find(request_job) == - streaming_url_request_jobs_.end()); - streaming_url_request_jobs_.insert(request_job); +void ServiceWorkerVersion::OnStreamResponseStarted() { + CHECK_LT(pending_stream_response_count_, std::numeric_limits<int>::max()); + pending_stream_response_count_++; } -void ServiceWorkerVersion::AddStreamingURLLoaderJob( - const ServiceWorkerURLLoaderJob* loader_job) { - DCHECK(streaming_url_loader_jobs_.find(loader_job) == - streaming_url_loader_jobs_.end()); - streaming_url_loader_jobs_.insert(loader_job); -} - -void ServiceWorkerVersion::RemoveStreamingURLRequestJob( - const ServiceWorkerURLRequestJob* request_job) { - streaming_url_request_jobs_.erase(request_job); - if (!HasWork()) { - for (auto& observer : listeners_) - observer.OnNoWork(this); - } -} - -void ServiceWorkerVersion::RemoveStreamingURLLoaderJob( - const ServiceWorkerURLLoaderJob* loader_job) { - streaming_url_loader_jobs_.erase(loader_job); +void ServiceWorkerVersion::OnStreamResponseFinished() { + DCHECK_GT(pending_stream_response_count_, 0); + pending_stream_response_count_--; if (!HasWork()) { for (auto& observer : listeners_) observer.OnNoWork(this); @@ -1735,8 +1717,8 @@ } bool ServiceWorkerVersion::HasWork() const { - return !pending_requests_.IsEmpty() || !streaming_url_loader_jobs_.empty() || - !streaming_url_request_jobs_.empty() || !start_callbacks_.empty(); + return !pending_requests_.IsEmpty() || pending_stream_response_count_ > 0 || + !start_callbacks_.empty(); } void ServiceWorkerVersion::RecordStartWorkerResult( @@ -1934,10 +1916,6 @@ event_dispatcher_.reset(); installed_scripts_sender_.reset(); - // TODO(falken): Call SWURLRequestJob::ClearStream here? - streaming_url_request_jobs_.clear(); - streaming_url_loader_jobs_.clear(); - for (auto& observer : listeners_) observer.OnRunningStateChanged(this); if (should_restart) {
diff --git a/content/browser/service_worker/service_worker_version.h b/content/browser/service_worker/service_worker_version.h index 3e1f09f..e98d227 100644 --- a/content/browser/service_worker/service_worker_version.h +++ b/content/browser/service_worker/service_worker_version.h
@@ -57,8 +57,6 @@ class ServiceWorkerInstalledScriptsSender; class ServiceWorkerProviderHost; class ServiceWorkerRegistration; -class ServiceWorkerURLRequestJob; -class ServiceWorkerURLLoaderJob; struct ServiceWorkerClientInfo; struct ServiceWorkerVersionInfo; @@ -310,14 +308,11 @@ base::WeakPtr<ServiceWorkerContextCore> context() const { return context_; } - // Adds and removes |request_job| or |loader_job| as a dependent job not to - // stop the ServiceWorker while |request_job| or |loader_job| is reading the - // stream of the fetch event response from the ServiceWorker. - void AddStreamingURLRequestJob(const ServiceWorkerURLRequestJob* request_job); - void RemoveStreamingURLRequestJob( - const ServiceWorkerURLRequestJob* request_job); - void AddStreamingURLLoaderJob(const ServiceWorkerURLLoaderJob* loader_job); - void RemoveStreamingURLLoaderJob(const ServiceWorkerURLLoaderJob* loader_job); + // Called when the browser process starts/finishes reading a fetch event + // response via Mojo data pipe from the service worker. We try to not stop the + // service worker while there is an ongoing response. + void OnStreamResponseStarted(); + void OnStreamResponseFinished(); // Adds and removes Listeners. void AddListener(Listener* listener); @@ -720,8 +715,10 @@ std::unique_ptr<ServiceWorkerInstalledScriptsSender> installed_scripts_sender_; - std::set<const ServiceWorkerURLRequestJob*> streaming_url_request_jobs_; - std::set<const ServiceWorkerURLLoaderJob*> streaming_url_loader_jobs_; + // The number of fetch event responses that the service worker is streaming to + // the browser process. We try to not stop the service worker while there is + // an ongoing response. + int pending_stream_response_count_ = 0; // Keeps track of the provider hosting this running service worker for this // version. |provider_host_| is always valid as long as this version is
diff --git a/content/browser/service_worker/service_worker_version_unittest.cc b/content/browser/service_worker/service_worker_version_unittest.cc index 34281087..9858908b 100644 --- a/content/browser/service_worker/service_worker_version_unittest.cc +++ b/content/browser/service_worker/service_worker_version_unittest.cc
@@ -28,6 +28,7 @@ #include "content/public/test/test_utils.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" // IPC messages for testing --------------------------------------------------- @@ -171,7 +172,7 @@ pattern_ = GURL("http://www.example.com/test/"); registration_ = new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(pattern_), 1L, + blink::mojom::ServiceWorkerRegistrationOptions(pattern_), 1L, helper_->context()->AsWeakPtr()); version_ = new ServiceWorkerVersion( registration_.get(),
diff --git a/content/browser/service_worker/service_worker_write_to_cache_job_unittest.cc b/content/browser/service_worker/service_worker_write_to_cache_job_unittest.cc index 55266f0d..7fed775 100644 --- a/content/browser/service_worker/service_worker_write_to_cache_job_unittest.cc +++ b/content/browser/service_worker/service_worker_write_to_cache_job_unittest.cc
@@ -37,6 +37,7 @@ #include "net/url_request/url_request_test_util.h" #include "storage/browser/blob/blob_storage_context.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" namespace content { @@ -330,7 +331,8 @@ // A new unstored registration/version. registration_ = new ServiceWorkerRegistration( - ServiceWorkerRegistrationOptions(scope_), 1L, context()->AsWeakPtr()); + blink::mojom::ServiceWorkerRegistrationOptions(scope_), 1L, + context()->AsWeakPtr()); version_ = new ServiceWorkerVersion(registration_.get(), script_url_, NextVersionId(), context()->AsWeakPtr());
diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc index cccb9f0..c2ead6db 100644 --- a/content/browser/storage_partition_impl_map.cc +++ b/content/browser/storage_partition_impl_map.cc
@@ -380,7 +380,8 @@ StoragePartitionImpl* StoragePartitionImplMap::Get( const std::string& partition_domain, const std::string& partition_name, - bool in_memory) { + bool in_memory, + bool can_create) { // Find the previously created partition if it's available. StoragePartitionConfig partition_config( partition_domain, partition_name, in_memory); @@ -389,6 +390,9 @@ if (it != partitions_.end()) return it->second.get(); + if (!can_create) + return nullptr; + base::FilePath relative_partition_path = GetStoragePartitionPath(partition_domain, partition_name); @@ -580,12 +584,6 @@ partition->GetServiceWorkerContext(), browser_context_->GetResourceContext())); - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::BindOnce(&BackgroundFetchContext::InitializeOnIOThread, - partition->GetBackgroundFetchContext(), - base::RetainedRef(partition->GetURLRequestContext()))); - // We do not call InitializeURLRequestContext() for media contexts because, // other than the HTTP cache, the media contexts share the same backing // objects as their associated "normal" request context. Thus, the previous
diff --git a/content/browser/storage_partition_impl_map.h b/content/browser/storage_partition_impl_map.h index 55f1c303..ce0951b 100644 --- a/content/browser/storage_partition_impl_map.h +++ b/content/browser/storage_partition_impl_map.h
@@ -37,7 +37,8 @@ // This map retains ownership of the returned StoragePartition objects. StoragePartitionImpl* Get(const std::string& partition_domain, const std::string& partition_name, - bool in_memory); + bool in_memory, + bool can_create); // Starts an asynchronous best-effort attempt to delete all on-disk storage // related to |site|, avoiding any directories that are known to be in use.
diff --git a/content/child/BUILD.gn b/content/child/BUILD.gn index b662baa..62cedc17 100644 --- a/content/child/BUILD.gn +++ b/content/child/BUILD.gn
@@ -257,6 +257,7 @@ "//third_party/WebKit/common:blink_common", "//third_party/WebKit/public:blink_headers", "//third_party/WebKit/public:features", + "//third_party/WebKit/public:mojo_bindings", "//third_party/WebKit/public:resources", "//third_party/WebKit/public:scaled_resources", "//third_party/ced",
diff --git a/content/child/service_worker/web_service_worker_provider_impl.cc b/content/child/service_worker/web_service_worker_provider_impl.cc index 2a62df6..4d741499 100644 --- a/content/child/service_worker/web_service_worker_provider_impl.cc +++ b/content/child/service_worker/web_service_worker_provider_impl.cc
@@ -19,6 +19,7 @@ #include "content/common/service_worker/service_worker_utils.h" #include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerProviderClient.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" using blink::WebURL; @@ -106,9 +107,9 @@ TRACE_EVENT_ASYNC_BEGIN2( "ServiceWorker", "WebServiceWorkerProviderImpl::RegisterServiceWorker", this, "Scope", pattern.spec(), "Script URL", script_url.spec()); - ServiceWorkerRegistrationOptions options(pattern); + auto options = blink::mojom::ServiceWorkerRegistrationOptions::New(pattern); context_->container_host()->Register( - script_url, options, + script_url, std::move(options), base::BindOnce(&WebServiceWorkerProviderImpl::OnRegistered, weak_factory_.GetWeakPtr(), std::move(callbacks))); }
diff --git a/content/common/DEPS b/content/common/DEPS index 3f90093..6f43c97 100644 --- a/content/common/DEPS +++ b/content/common/DEPS
@@ -66,6 +66,7 @@ "+third_party/WebKit/public/platform/modules/serviceworker/service_worker_error_type.mojom.h", "+third_party/WebKit/public/platform/modules/serviceworker/service_worker_event_status.mojom.h", "+third_party/WebKit/public/platform/modules/serviceworker/service_worker_stream_handle.mojom.h", + "+third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h", "+third_party/WebKit/public/web/WebAXEnums.h", "+third_party/WebKit/public/web/WebDeviceEmulationParams.h", "+third_party/WebKit/public/web/WebDragStatus.h",
diff --git a/content/common/service_worker/service_worker_container.mojom b/content/common/service_worker/service_worker_container.mojom index 1af799aa..faeece01 100644 --- a/content/common/service_worker/service_worker_container.mojom +++ b/content/common/service_worker/service_worker_container.mojom
@@ -6,6 +6,7 @@ import "content/common/service_worker/service_worker_types.mojom"; import "third_party/WebKit/public/platform/modules/serviceworker/service_worker_error_type.mojom"; +import "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom"; import "url/mojo/url.mojom"; // mojom::ServiceWorkerContainerHost is a browser-side interface. The renderer @@ -16,7 +17,8 @@ // Registers a service worker from |script_url| with |options|. // On success, |error| is kNone with |registration| and |attributes| set. // Otherwise, |error| and |error_msg| describe the failure. - Register(url.mojom.Url script_url, ServiceWorkerRegistrationOptions options) + Register(url.mojom.Url script_url, + blink.mojom.ServiceWorkerRegistrationOptions options) => (blink.mojom.ServiceWorkerErrorType error, string? error_msg, ServiceWorkerRegistrationObjectInfo? registration,
diff --git a/content/common/service_worker/service_worker_messages.h b/content/common/service_worker/service_worker_messages.h index a36e2e0cb..b913203 100644 --- a/content/common/service_worker/service_worker_messages.h +++ b/content/common/service_worker/service_worker_messages.h
@@ -111,7 +111,7 @@ IPC_STRUCT_TRAITS_MEMBER(version_id) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerRegistrationOptions) +IPC_STRUCT_TRAITS_BEGIN(blink::mojom::ServiceWorkerRegistrationOptions) IPC_STRUCT_TRAITS_MEMBER(scope) IPC_STRUCT_TRAITS_END()
diff --git a/content/common/service_worker/service_worker_types.cc b/content/common/service_worker/service_worker_types.cc index 96999ef..f5146de 100644 --- a/content/common/service_worker/service_worker_types.cc +++ b/content/common/service_worker/service_worker_types.cc
@@ -143,10 +143,6 @@ version_id != kInvalidServiceWorkerVersionId; } -ServiceWorkerRegistrationOptions::ServiceWorkerRegistrationOptions( - const GURL& scope) - : scope(scope) {} - ServiceWorkerRegistrationObjectInfo::ServiceWorkerRegistrationObjectInfo() : handle_id(kInvalidServiceWorkerRegistrationHandleId), registration_id(kInvalidServiceWorkerRegistrationId) {
diff --git a/content/common/service_worker/service_worker_types.h b/content/common/service_worker/service_worker_types.h index 8129f9b4..fbcbc748 100644 --- a/content/common/service_worker/service_worker_types.h +++ b/content/common/service_worker/service_worker_types.h
@@ -24,6 +24,7 @@ #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerClientType.h" #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerResponseError.h" #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerState.h" +#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom.h" #include "url/gurl.h" // This file is to have common definitions that are to be shared by @@ -185,19 +186,10 @@ int64_t version_id; }; -// Represents options for register(): -// https://w3c.github.io/ServiceWorker/#dictdef-registrationoptions -struct CONTENT_EXPORT ServiceWorkerRegistrationOptions { - ServiceWorkerRegistrationOptions() = default; - explicit ServiceWorkerRegistrationOptions(const GURL& scope); - GURL scope; - // TODO(yuryu): Other values will be added as they are supported later. -}; - struct CONTENT_EXPORT ServiceWorkerRegistrationObjectInfo { ServiceWorkerRegistrationObjectInfo(); int handle_id; - ServiceWorkerRegistrationOptions options; + blink::mojom::ServiceWorkerRegistrationOptions options; int64_t registration_id; };
diff --git a/content/common/service_worker/service_worker_types.mojom b/content/common/service_worker/service_worker_types.mojom index c124c07..86bd60e 100644 --- a/content/common/service_worker/service_worker_types.mojom +++ b/content/common/service_worker/service_worker_types.mojom
@@ -29,7 +29,3 @@ // Defined in service_worker_types.h. [Native] struct ServiceWorkerVersionAttributes; - -// Defined in service_worker_types.h. -[Native] -struct ServiceWorkerRegistrationOptions;
diff --git a/content/common/service_worker/service_worker_types.typemap b/content/common/service_worker/service_worker_types.typemap index b836a25..e1122fb 100644 --- a/content/common/service_worker/service_worker_types.typemap +++ b/content/common/service_worker/service_worker_types.typemap
@@ -17,6 +17,5 @@ type_mappings = [ "content.mojom.ServiceWorkerProviderType=::content::ServiceWorkerProviderType", "content.mojom.ServiceWorkerRegistrationObjectInfo=::content::ServiceWorkerRegistrationObjectInfo", - "content.mojom.ServiceWorkerRegistrationOptions=::content::ServiceWorkerRegistrationOptions", "content.mojom.ServiceWorkerVersionAttributes=::content::ServiceWorkerVersionAttributes", ]
diff --git a/content/public/browser/browser_context.h b/content/public/browser/browser_context.h index 486eee8..4416a36 100644 --- a/content/public/browser/browser_context.h +++ b/content/public/browser/browser_context.h
@@ -97,11 +97,16 @@ // for this |context|. static BrowsingDataRemover* GetBrowsingDataRemover(BrowserContext* context); + // Returns a StoragePartition for the given SiteInstance. By default this will + // create a new StoragePartition if it doesn't exist, unless |can_create| is + // false. static StoragePartition* GetStoragePartition(BrowserContext* browser_context, - SiteInstance* site_instance); + SiteInstance* site_instance, + bool can_create = true); static StoragePartition* GetStoragePartitionForSite( BrowserContext* browser_context, - const GURL& site); + const GURL& site, + bool can_create = true); using StoragePartitionCallback = base::Callback<void(StoragePartition*)>; static void ForEachStoragePartition( BrowserContext* browser_context,
diff --git a/headless/public/util/generic_url_request_job.cc b/headless/public/util/generic_url_request_job.cc index db2d71b..094cf45 100644 --- a/headless/public/util/generic_url_request_job.cc +++ b/headless/public/util/generic_url_request_job.cc
@@ -189,7 +189,8 @@ } uint64_t GenericURLRequestJob::GenericURLRequestJob::GetRequestId() const { - return request_->identifier(); + return request_->identifier() + + (static_cast<uint64_t>(request_->url_chain().size()) << 32); } const net::URLRequest* GenericURLRequestJob::GetURLRequest() const {
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm index feff410..0935f80e 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm
@@ -1145,9 +1145,10 @@ break; case BookmarksContextBarMultipleURLSelection: // More clicked, show action sheet with context menu. - [self presentViewController:[self contextMenuForMultipleBookmarkURLs] - animated:YES - completion:nil]; + [self + presentViewController:[self contextMenuForMultipleBookmarkURLs:nodes] + animated:YES + completion:nil]; break; case BookmarksContextBarSingleFolderSelection: // Edit clicked, open the editor. @@ -1259,7 +1260,9 @@ #pragma mark - Context Menu -- (UIAlertController*)contextMenuForMultipleBookmarkURLs { +- (UIAlertController*)contextMenuForMultipleBookmarkURLs: + (const std::set<const bookmarks::BookmarkNode*>)nodes { + __weak BookmarkHomeViewController* weakSelf = self; UIAlertController* alert = [UIAlertController alertControllerWithTitle:nil message:nil @@ -1285,7 +1288,9 @@ UIAlertAction* moveAction = [UIAlertAction actionWithTitle:l10n_util::GetNSString(IDS_IOS_BOOKMARK_CONTEXT_MENU_MOVE) style:UIAlertActionStyleDefault - handler:nil]; + handler:^(UIAlertAction* _Nonnull action) { + [weakSelf moveNodes:nodes]; + }]; [alert addAction:openAllAction]; [alert addAction:openInIncognitoAction]; [alert addAction:moveAction]; @@ -1373,7 +1378,8 @@ } - (UIAlertController*)contextMenuForMixedAndMultiFolderSelection: - (const std::set<const bookmarks::BookmarkNode*>&)nodes { + (const std::set<const bookmarks::BookmarkNode*>)nodes { + __weak BookmarkHomeViewController* weakSelf = self; UIAlertController* alert = [UIAlertController alertControllerWithTitle:nil message:nil @@ -1388,7 +1394,9 @@ UIAlertAction* moveAction = [UIAlertAction actionWithTitle:l10n_util::GetNSString(IDS_IOS_BOOKMARK_CONTEXT_MENU_MOVE) style:UIAlertActionStyleDefault - handler:nil]; + handler:^(UIAlertAction* _Nonnull action) { + [weakSelf moveNodes:nodes]; + }]; [alert addAction:moveAction]; [alert addAction:cancelAction]; return alert;
diff --git a/ios/chrome/browser/ui/bookmarks/bookmarks_new_generation_egtest.mm b/ios/chrome/browser/ui/bookmarks/bookmarks_new_generation_egtest.mm index bbc2d62..1692b94 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmarks_new_generation_egtest.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmarks_new_generation_egtest.mm
@@ -393,10 +393,7 @@ assertWithMatcher:grey_allOf(grey_notNil(), grey_enabled(), nil)]; // Cancel edit mode - [[EarlGrey selectElementWithMatcher:ContextBarTrailingButtonWithLabel( - [BookmarksNewGenTestCase - contextBarCancelString])] - performAction:grey_tap()]; + [BookmarksNewGenTestCase closeContextBarEditMode]; [self verifyContextBarInDefaultState]; } @@ -842,12 +839,7 @@ performAction:grey_tap()]; // Verify all folder flow UI is now closed. - [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder Creator")] - assertWithMatcher:grey_notVisible()]; - [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder Picker")] - assertWithMatcher:grey_notVisible()]; - [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder Editor")] - assertWithMatcher:grey_notVisible()]; + [self verifyFolderFlowIsClosed]; // Verify new folder "Title For New Folder" has been created under Folder 2. [BookmarksNewGenTestCase assertChildCount:2 ofFolderWithName:@"Folder 2"]; @@ -868,6 +860,225 @@ assertWithMatcher:grey_sufficientlyVisible()]; } +// Verify Move functionality on multiple folder selection. +- (void)testMoveFunctionalityOnMultipleFolder { + if (IsIPadIdiom()) { + EARL_GREY_TEST_DISABLED(@"Test disabled on iPad."); + } + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature(kBookmarkNewGeneration); + + [BookmarksNewGenTestCase setupStandardBookmarks]; + [BookmarksNewGenTestCase openBookmarks]; + [BookmarksNewGenTestCase openMobileBookmarks]; + + // Change to edit mode, using context menu. + [[EarlGrey selectElementWithMatcher:grey_accessibilityID( + @"context_bar_trailing_button")] + performAction:grey_tap()]; + + // Select multiple folders. + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder 1.1")] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder 1")] + performAction:grey_tap()]; + + // Tap context menu. + [[EarlGrey selectElementWithMatcher:ContextBarCenterButtonWithLabel( + [BookmarksNewGenTestCase + contextBarMoreString])] + performAction:grey_tap()]; + + [[EarlGrey selectElementWithMatcher:ButtonWithAccessibilityLabelId( + IDS_IOS_BOOKMARK_CONTEXT_MENU_MOVE)] + performAction:grey_tap()]; + + // Choose to move into a new folder. + [[EarlGrey + selectElementWithMatcher:grey_accessibilityID(@"Create New Folder")] + performAction:grey_tap()]; + + // Enter custom new folder name. + [BookmarksNewGenTestCase + renameBookmarkFolderWithFolderTitle:@"Title For New Folder"]; + + // Verify current parent folder for "Title For New Folder" folder is "Mobile + // Bookmarks" folder. + [[EarlGrey + selectElementWithMatcher:grey_allOf( + grey_accessibilityID(@"Change Folder"), + grey_accessibilityLabel(@"Mobile Bookmarks"), + nil)] + assertWithMatcher:grey_sufficientlyVisible()]; + + // Tap Done (accessibilityID is 'Save') to close bookmark move flow. + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Save")] + performAction:grey_tap()]; + + // Verify all folder flow UI is now closed. + [self verifyFolderFlowIsClosed]; + + // Wait for Undo toast to go away from screen. + [BookmarksNewGenTestCase waitForUndoToastToGoAway]; + + // Close edit mode. + [BookmarksNewGenTestCase closeContextBarEditMode]; + + // Verify new folder "Title For New Folder" has two bookmark folder. + [BookmarksNewGenTestCase assertChildCount:2 + ofFolderWithName:@"Title For New Folder"]; + + // Drill down to where "Folder 1.1" and "Folder 1" have been moved and assert + // it's presence. + [[EarlGrey + selectElementWithMatcher:grey_accessibilityID(@"Title For New Folder")] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder 1.1")] + assertWithMatcher:grey_sufficientlyVisible()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder 1")] + assertWithMatcher:grey_sufficientlyVisible()]; +} + +// Verify Move functionality on mixed folder / url selection. +- (void)testMoveFunctionalityOnMixedSelection { + if (IsIPadIdiom()) { + EARL_GREY_TEST_DISABLED(@"Test disabled on iPad."); + } + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature(kBookmarkNewGeneration); + + [BookmarksNewGenTestCase setupStandardBookmarks]; + [BookmarksNewGenTestCase openBookmarks]; + [BookmarksNewGenTestCase openMobileBookmarks]; + + // Change to edit mode, using context menu. + [[EarlGrey selectElementWithMatcher:grey_accessibilityID( + @"context_bar_trailing_button")] + performAction:grey_tap()]; + + // Select URL and folder. + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Second URL")] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder 1")] + performAction:grey_tap()]; + + // Tap context menu. + [[EarlGrey selectElementWithMatcher:ContextBarCenterButtonWithLabel( + [BookmarksNewGenTestCase + contextBarMoreString])] + performAction:grey_tap()]; + + // Tap on move, from context menu. + [[EarlGrey selectElementWithMatcher:ButtonWithAccessibilityLabelId( + IDS_IOS_BOOKMARK_CONTEXT_MENU_MOVE)] + performAction:grey_tap()]; + + // Choose to move into a new folder. + [[EarlGrey + selectElementWithMatcher:grey_accessibilityID(@"Create New Folder")] + performAction:grey_tap()]; + + // Enter custom new folder name. + [BookmarksNewGenTestCase + renameBookmarkFolderWithFolderTitle:@"Title For New Folder"]; + + // Verify current parent folder for "Title For New Folder" folder is "Mobile + // Bookmarks" folder. + [[EarlGrey + selectElementWithMatcher:grey_allOf( + grey_accessibilityID(@"Change Folder"), + grey_accessibilityLabel(@"Mobile Bookmarks"), + nil)] + assertWithMatcher:grey_sufficientlyVisible()]; + + // Tap Done (accessibilityID is 'Save') to close bookmark move flow. + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Save")] + performAction:grey_tap()]; + + // Verify all folder flow UI is now closed. + [self verifyFolderFlowIsClosed]; + + // Wait for Undo toast to go away from screen. + [BookmarksNewGenTestCase waitForUndoToastToGoAway]; + + // Close edit mode. + [BookmarksNewGenTestCase closeContextBarEditMode]; + + // Verify new folder "Title For New Folder" has two bookmark nodes. + [BookmarksNewGenTestCase assertChildCount:2 + ofFolderWithName:@"Title For New Folder"]; + + // Drill down to where "Second URL" and "Folder 1" have been moved and assert + // it's presence. + [[EarlGrey + selectElementWithMatcher:grey_accessibilityID(@"Title For New Folder")] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Second URL")] + assertWithMatcher:grey_sufficientlyVisible()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder 1")] + assertWithMatcher:grey_sufficientlyVisible()]; +} + +// Verify Move functionality on multiple url selection. +- (void)testMoveFunctionalityOnMultipleUrlSelection { + if (IsIPadIdiom()) { + EARL_GREY_TEST_DISABLED(@"Test disabled on iPad."); + } + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature(kBookmarkNewGeneration); + + [BookmarksNewGenTestCase setupStandardBookmarks]; + [BookmarksNewGenTestCase openBookmarks]; + [BookmarksNewGenTestCase openMobileBookmarks]; + + // Change to edit mode, using context menu. + [[EarlGrey selectElementWithMatcher:grey_accessibilityID( + @"context_bar_trailing_button")] + performAction:grey_tap()]; + + // Select URL and folder. + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Second URL")] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"First URL")] + performAction:grey_tap()]; + + // Tap context menu. + [[EarlGrey selectElementWithMatcher:ContextBarCenterButtonWithLabel( + [BookmarksNewGenTestCase + contextBarMoreString])] + performAction:grey_tap()]; + + // Tap on move, from context menu. + [[EarlGrey selectElementWithMatcher:ButtonWithAccessibilityLabelId( + IDS_IOS_BOOKMARK_CONTEXT_MENU_MOVE)] + performAction:grey_tap()]; + + // Choose to move into Folder 1. + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder 1")] + performAction:grey_tap()]; + + // Verify all folder flow UI is now closed. + [self verifyFolderFlowIsClosed]; + + // Wait for Undo toast to go away from screen. + [BookmarksNewGenTestCase waitForUndoToastToGoAway]; + + // Close edit mode. + [BookmarksNewGenTestCase closeContextBarEditMode]; + + // Verify Folder 1 has three bookmark nodes. + [BookmarksNewGenTestCase assertChildCount:3 ofFolderWithName:@"Folder 1"]; + + // Drill down to where "Second URL" and "First URL" have been moved and assert + // it's presence. + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder 1")] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Second URL")] + assertWithMatcher:grey_sufficientlyVisible()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"First URL")] + assertWithMatcher:grey_sufficientlyVisible()]; +} + // Try deleting a bookmark from the edit screen, then undoing that delete. - (void)testUndoDeleteBookmarkFromEditScreen { if (IsIPadIdiom()) { @@ -976,10 +1187,7 @@ nil)]; // Cancel edit mode. - [[EarlGrey selectElementWithMatcher:ContextBarTrailingButtonWithLabel( - [BookmarksNewGenTestCase - contextBarCancelString])] - performAction:grey_tap()]; + [BookmarksNewGenTestCase closeContextBarEditMode]; } - (void)testDeleteSingleFolderNode { @@ -1029,10 +1237,7 @@ nil)]; // Cancel edit mode. - [[EarlGrey selectElementWithMatcher:ContextBarTrailingButtonWithLabel( - [BookmarksNewGenTestCase - contextBarCancelString])] - performAction:grey_tap()]; + [BookmarksNewGenTestCase closeContextBarEditMode]; } - (void)testDeleteMultipleNodes { @@ -1078,10 +1283,7 @@ assertWithMatcher:grey_notNil()]; // Cancel edit mode. - [[EarlGrey selectElementWithMatcher:ContextBarTrailingButtonWithLabel( - [BookmarksNewGenTestCase - contextBarCancelString])] - performAction:grey_tap()]; + [BookmarksNewGenTestCase closeContextBarEditMode]; } // Tests that the promo view is only seen at root level and not in any of the @@ -1468,6 +1670,20 @@ @"Waiting for bookmark to go away"); } +// Wait for Undo toast to go away. ++ (void)waitForUndoToastToGoAway { + // Wait until it's gone. + ConditionBlock condition = ^{ + NSError* error = nil; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Undo")] + assertWithMatcher:grey_notVisible() + error:&error]; + return error == nil; + }; + GREYAssert(testing::WaitUntilConditionOrTimeout(10, condition), + @"Waiting for undo toast to go away"); +} + // Waits for the bookmark model to be loaded in memory. + (void)waitForBookmarkModelLoaded:(BOOL)loaded { bookmarks::BookmarkModel* bookmarkModel = @@ -1505,6 +1721,14 @@ performAction:grey_tap()]; } +// Close edit mode. ++ (void)closeContextBarEditMode { + [[EarlGrey selectElementWithMatcher:ContextBarTrailingButtonWithLabel( + [BookmarksNewGenTestCase + contextBarCancelString])] + performAction:grey_tap()]; +} + // Verifies that there is |count| children on the bookmark folder with |name|. + (void)assertChildCount:(int)count ofFolderWithName:(NSString*)name { base::string16 name16(base::SysNSStringToUTF16(name)); @@ -1583,6 +1807,15 @@ assertWithMatcher:grey_allOf(grey_notNil(), grey_enabled(), nil)]; } +- (void)verifyFolderFlowIsClosed { + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder Creator")] + assertWithMatcher:grey_notVisible()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder Picker")] + assertWithMatcher:grey_notVisible()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Folder Editor")] + assertWithMatcher:grey_notVisible()]; +} + // Context bar strings. + (NSString*)contextBarNewFolderString { return l10n_util::GetNSString(IDS_IOS_BOOKMARK_CONTEXT_BAR_NEW_FOLDER);
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 039f764..86d826cf83 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -1395,6 +1395,25 @@ ] } ], + "KeepAliveRendererForKeepaliveRequests": [ + { + "platforms": [ + "android", + "chromeos", + "linux", + "mac", + "win" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "KeepAliveRendererForKeepaliveRequests" + ] + } + ] + } + ], "LazyParseCSS": [ { "platforms": [
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG index 31409186..3603901 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -13288,7 +13288,6 @@ crbug.com/591099 http/tests/xmlhttprequest/XMLHttpRequestException.html [ Failure Pass ] crbug.com/591099 http/tests/xmlhttprequest/abort-should-destroy-responseText.html [ Failure Pass ] crbug.com/591099 http/tests/xmlhttprequest/access-control-response-with-body-sync.html [ Failure Pass ] -crbug.com/591099 http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-without-wildcard.html [ Failure Pass Timeout ] crbug.com/591099 http/tests/xmlhttprequest/async-xhr-revalidate-after-sync-xhr.html [ Failure Pass ] crbug.com/591099 http/tests/xmlhttprequest/authorization-header.html [ Failure Pass ] crbug.com/591099 http/tests/xmlhttprequest/binary-x-user-defined.html [ Failure Pass ]
diff --git a/third_party/WebKit/LayoutTests/NeverFixTests b/third_party/WebKit/LayoutTests/NeverFixTests index ec750e9..98ff27b 100644 --- a/third_party/WebKit/LayoutTests/NeverFixTests +++ b/third_party/WebKit/LayoutTests/NeverFixTests
@@ -285,9 +285,8 @@ # WPT for CSS cascade crbug.com/763610 external/wpt/css/CSS2/cascade [ WontFix ] -crbug.com/763610 external/wpt/css/CSS2/cascade-import [ WontFix ] -crbug.com/763610 external/wpt/css/css-cascade-3 [ WontFix ] -crbug.com/763610 external/wpt/css/css-cascade-4 [ WontFix ] +# The revert keyword is not yet supported. +external/wpt/css/css-cascade-4/revert-val-001.html [ WontFix ] # WPT subdirectories without owners. external/wpt/accelerometer [ WontFix ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index fd0eaa08..cdc3ed4d 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -274,7 +274,7 @@ ### virtual/layout_ng Mac textarea. crbug.com/635619 [ Mac ] virtual/layout_ng/fast/block/float/overhanging-tall-block.html [ Failure ] -crbug.com/763494 [ Mac ] virtual/layout_ng/fast/block/float/editable-text-overlapping-float.html [ Failure ] +crbug.com/763494 [ Mac ] virtual/layout_ng/fast/block/float/editable-text-overlapping-float.html [ Crash Failure ] ### virtual/layout_ng Mac 1px glyph difference. crbug.com/635619 [ Mac ] virtual/layout_ng/fast/block/basic/015.html [ Failure ] @@ -2859,8 +2859,8 @@ crbug.com/718155 payments/payment-request-in-iframe-nested-not-allowed.html [ Failure ] # Feature Policy Header parsing is disabled in M60 - https://crbug.com/737643 -crbug.com/737643 external/wpt/payment-request/payment-allowed-by-feature-policy.https.sub.html [ Failure ] -crbug.com/737643 external/wpt/payment-request/payment-disabled-by-feature-policy.https.sub.html [ Failure ] +crbug.com/737643 external/wpt/feature-policy/payment-allowed-by-feature-policy.https.sub.html [ Failure ] +crbug.com/737643 external/wpt/feature-policy/payment-disabled-by-feature-policy.https.sub.html [ Failure ] crbug.com/737643 external/wpt/webusb/usb-allowed-by-feature-policy.https.sub.html [ Failure ] crbug.com/737643 external/wpt/webusb/usb-disabled-by-feature-policy.https.sub.html [ Failure ] crbug.com/737643 http/tests/feature-policy/fullscreen-disabled.php [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json index 4e746059..12819b3 100644 --- a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json +++ b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json
@@ -70639,6 +70639,11 @@ {} ] ], + "XMLHttpRequest/resources/access-control-sandboxed-iframe.html": [ + [ + {} + ] + ], "XMLHttpRequest/resources/auth1/auth.py": [ [ {} @@ -73434,6 +73439,11 @@ {} ] ], + "css-backgrounds/OWNERS": [ + [ + {} + ] + ], "css-backgrounds/background-clip-color-ref.html": [ [ {} @@ -73444,6 +73454,11 @@ {} ] ], + "css-cascade/OWNERS": [ + [ + {} + ] + ], "css-font-display/font-display-ref.html": [ [ {} @@ -73459,6 +73474,11 @@ {} ] ], + "css-fonts/OWNERS": [ + [ + {} + ] + ], "css-fonts/matching/README.md": [ [ {} @@ -73509,6 +73529,11 @@ {} ] ], + "css-paint-api/OWNERS": [ + [ + {} + ] + ], "css-paint-api/background-image-alpha-ref.html": [ [ {} @@ -73694,11 +73719,21 @@ {} ] ], + "css-scoping/OWNERS": [ + [ + {} + ] + ], "css-scoping/slotted-with-pseudo-element-ref.html": [ [ {} ] ], + "css-timing/OWNERS": [ + [ + {} + ] + ], "css-timing/cubic-bezier-timing-functions-output-expected.txt": [ [ {} @@ -73714,6 +73749,11 @@ {} ] ], + "css-typed-om/OWNERS": [ + [ + {} + ] + ], "css-typed-om/styleMap-update-function-expected.txt": [ [ {} @@ -78149,6 +78189,11 @@ {} ] ], + "css/css-conditional-3/OWNERS": [ + [ + {} + ] + ], "css/css-conditional-3/at-supports-001-ref.html": [ [ {} @@ -87879,6 +87924,11 @@ {} ] ], + "css/css-namespaces-3/OWNERS": [ + [ + {} + ] + ], "css/css-namespaces-3/README": [ [ {} @@ -88714,6 +88764,11 @@ {} ] ], + "css/css-text-3/OWNERS": [ + [ + {} + ] + ], "css/css-text-3/i18n/OWNERS": [ [ {} @@ -92619,6 +92674,11 @@ {} ] ], + "css/css-ui-4/OWNERS": [ + [ + {} + ] + ], "css/css-ui-4/support/nav-dir-target-001-frame.html": [ [ {} @@ -100179,6 +100239,16 @@ {} ] ], + "feature-policy/payment-allowed-by-feature-policy.https.sub.html.headers": [ + [ + {} + ] + ], + "feature-policy/payment-disabled-by-feature-policy.https.sub.html.headers": [ + [ + {} + ] + ], "feature-policy/resources/feature-policy-payment.html": [ [ {} @@ -115214,6 +115284,11 @@ {} ] ], + "payment-handler/OWNERS": [ + [ + {} + ] + ], "payment-handler/interfaces.https.any-expected.txt": [ [ {} @@ -115224,6 +115299,11 @@ {} ] ], + "payment-method-id/OWNERS": [ + [ + {} + ] + ], "payment-method-id/README.md": [ [ {} @@ -115259,16 +115339,6 @@ {} ] ], - "payment-request/payment-allowed-by-feature-policy.https.sub.html.headers": [ - [ - {} - ] - ], - "payment-request/payment-disabled-by-feature-policy.https.sub.html.headers": [ - [ - {} - ] - ], "payment-request/payment-request-abort-method.https-expected.txt": [ [ {} @@ -133456,6 +133526,12 @@ {} ] ], + "XMLHttpRequest/access-control-sandboxed-iframe-allow.htm": [ + [ + "/XMLHttpRequest/access-control-sandboxed-iframe-allow.htm", + {} + ] + ], "XMLHttpRequest/allow-lists-starting-with-comma.htm": [ [ "/XMLHttpRequest/allow-lists-starting-with-comma.htm", @@ -145490,6 +145566,36 @@ {} ] ], + "feature-policy/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html": [ + [ + "/feature-policy/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html", + {} + ] + ], + "feature-policy/payment-allowed-by-feature-policy-attribute.https.sub.html": [ + [ + "/feature-policy/payment-allowed-by-feature-policy-attribute.https.sub.html", + {} + ] + ], + "feature-policy/payment-allowed-by-feature-policy.https.sub.html": [ + [ + "/feature-policy/payment-allowed-by-feature-policy.https.sub.html", + {} + ] + ], + "feature-policy/payment-default-feature-policy.https.sub.html": [ + [ + "/feature-policy/payment-default-feature-policy.https.sub.html", + {} + ] + ], + "feature-policy/payment-disabled-by-feature-policy.https.sub.html": [ + [ + "/feature-policy/payment-disabled-by-feature-policy.https.sub.html", + {} + ] + ], "fetch/api/abort/cache.https.html": [ [ "/fetch/api/abort/cache.https.html", @@ -168224,36 +168330,6 @@ {} ] ], - "payment-request/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html": [ - [ - "/payment-request/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html", - {} - ] - ], - "payment-request/payment-allowed-by-feature-policy-attribute.https.sub.html": [ - [ - "/payment-request/payment-allowed-by-feature-policy-attribute.https.sub.html", - {} - ] - ], - "payment-request/payment-allowed-by-feature-policy.https.sub.html": [ - [ - "/payment-request/payment-allowed-by-feature-policy.https.sub.html", - {} - ] - ], - "payment-request/payment-default-feature-policy.https.sub.html": [ - [ - "/payment-request/payment-default-feature-policy.https.sub.html", - {} - ] - ], - "payment-request/payment-disabled-by-feature-policy.https.sub.html": [ - [ - "/payment-request/payment-disabled-by-feature-policy.https.sub.html", - {} - ] - ], "payment-request/payment-request-abort-method.https.html": [ [ "/payment-request/payment-request-abort-method.https.html", @@ -197545,6 +197621,10 @@ "9c4a5cf99e43f1315dfd73f543450e4056dcef36", "testharness" ], + "XMLHttpRequest/access-control-sandboxed-iframe-allow.htm": [ + "b1140eacc383af590578319b25ee803ba50c3fee", + "testharness" + ], "XMLHttpRequest/allow-lists-starting-with-comma.htm": [ "34a8d82f397f35902c73d9ced2f3cf900d04ae53", "testharness" @@ -198013,6 +198093,10 @@ "c572b1e3d79f66df0a40766e6e4c3cc785458d0e", "support" ], + "XMLHttpRequest/resources/access-control-sandboxed-iframe.html": [ + "3aa5a903afc03e167a88322db44c29b287509f47", + "support" + ], "XMLHttpRequest/resources/auth1/auth.py": [ "cbe9305740f7e0a9e8c7be9dbfcb606f8abb2758", "support" @@ -202445,6 +202529,10 @@ "e9a108beef51c52bbaaf2e53371aec57e69541c0", "testharness" ], + "css-backgrounds/OWNERS": [ + "adcf6f1311695d9cc8f490be1f7e411a1048d824", + "support" + ], "css-backgrounds/background-clip-color-ref.html": [ "82aaf4a4516534051621142b11a567b91dbc8a0d", "support" @@ -202461,6 +202549,10 @@ "9680097433363351d87f2b34da76108a3d33a5d9", "reftest" ], + "css-cascade/OWNERS": [ + "495f99b874611fd8f82f2e33bc4b7d930cc60fde", + "support" + ], "css-cascade/inherit-initial.html": [ "67ecb845c4bcdacc8185b0f78d36856f9a408342", "testharness" @@ -202485,6 +202577,10 @@ "ad355c3d5220c1b938182241a8e8abe030ace699", "testharness" ], + "css-fonts/OWNERS": [ + "9e80ce00e7e18fb9f37ece769507e08432f35cc7", + "support" + ], "css-fonts/matching/README.md": [ "194fbc4cdaf1ff4a43e1a4e6b7bc7fbc17eec6d8", "support" @@ -202553,6 +202649,10 @@ "2ae8392efc584c909f11ca04fb33a77f1b3c65ba", "reftest" ], + "css-paint-api/OWNERS": [ + "792b2c38ffef10de94931408f5cbf7fb2ee9cbc2", + "support" + ], "css-paint-api/background-image-alpha-ref.html": [ "45ef6e998e5f266741f5403df650cd9557dbe005", "support" @@ -202933,6 +203033,10 @@ "44266556969c01b5c6c65ade643141bbb1364658", "reftest" ], + "css-scoping/OWNERS": [ + "495f99b874611fd8f82f2e33bc4b7d930cc60fde", + "support" + ], "css-scoping/slotted-parsing.html": [ "6bac5b15011d7177a40f7ca3e3c5f7e410643920", "testharness" @@ -202945,6 +203049,10 @@ "27d36ba54623bbee2cdd09b7a9322873d5ab0011", "reftest" ], + "css-timing/OWNERS": [ + "495f99b874611fd8f82f2e33bc4b7d930cc60fde", + "support" + ], "css-timing/cubic-bezier-timing-functions-output-expected.txt": [ "55d3fc7b0d318a2cbf418f5b386b0fac8eae0023", "support" @@ -202977,6 +203085,10 @@ "f6056e2480829c7aa9885673d332496faf7777b5", "testharness" ], + "css-typed-om/OWNERS": [ + "495f99b874611fd8f82f2e33bc4b7d930cc60fde", + "support" + ], "css-typed-om/declared-styleMap-accepts-inherit.html": [ "31cb4e38d12d19c0b90aceed979fbbaedd00dadd", "testharness" @@ -216913,6 +217025,10 @@ "4f041c7bdf74642a33c3f453f1bb5254e62924a3", "reftest" ], + "css/css-conditional-3/OWNERS": [ + "f6528390d313cb18665c1f3d1584e809fa85ed17", + "support" + ], "css/css-conditional-3/at-media-whitespace-optional-001.html": [ "fad72cf5e38d05748c3d4fce222e4b81fcdab5fb", "reftest" @@ -228737,6 +228853,10 @@ "e633dc7584fbc7bfe99177aa5dd9fbd107a2d3f5", "support" ], + "css/css-namespaces-3/OWNERS": [ + "f6528390d313cb18665c1f3d1584e809fa85ed17", + "support" + ], "css/css-namespaces-3/README": [ "1e6602131246b9324691901a867aaf94d8e20b09", "support" @@ -230609,6 +230729,10 @@ "ac9f17dc7b4755d419318a62600fdc2df60b0e88", "testharness" ], + "css/css-text-3/OWNERS": [ + "adcf6f1311695d9cc8f490be1f7e411a1048d824", + "support" + ], "css/css-text-3/i18n/OWNERS": [ "5498c55b57270bb257281f8f2076a29a8af28fc4", "support" @@ -235718,7 +235842,7 @@ "reftest" ], "css/css-ui-3/OWNERS": [ - "6c9e0dd80aabd34d387ee9dd789b9e497bde238e", + "c9e05453fc137fdb2a4e99030acfbd06490384c2", "support" ], "css/css-ui-3/box-sizing-001.html": [ @@ -237549,6 +237673,10 @@ "d3a6c835c23b82a85398e7981461a0cd3a75b861", "manual" ], + "css/css-ui-4/OWNERS": [ + "c9e05453fc137fdb2a4e99030acfbd06490384c2", + "support" + ], "css/css-ui-4/nav-dir-001.html": [ "b9d172945ca5861bc050d920cef1dc0a9c7a6c78", "manual" @@ -252754,7 +252882,35 @@ "support" ], "feature-policy/README.md": [ - "b74968d23db1beb35015cb6d8934f92d60cd3a5b", + "711c323f1690b0dbe780461241ad825cdd3cf274", + "support" + ], + "feature-policy/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html": [ + "8595732f7794f10107ef234fe6e37cc12c80eeaa", + "testharness" + ], + "feature-policy/payment-allowed-by-feature-policy-attribute.https.sub.html": [ + "7f00979fb8e60e938bfa816786705c95e611d2f3", + "testharness" + ], + "feature-policy/payment-allowed-by-feature-policy.https.sub.html": [ + "762f4d517150b10438fca8571204caae79e00278", + "testharness" + ], + "feature-policy/payment-allowed-by-feature-policy.https.sub.html.headers": [ + "038c90f26cb5c16047c294aa35a0b0251324dbc6", + "support" + ], + "feature-policy/payment-default-feature-policy.https.sub.html": [ + "6980a706cca09eaeb2d63d6780a5e0a89ff52fa5", + "testharness" + ], + "feature-policy/payment-disabled-by-feature-policy.https.sub.html": [ + "942104579b3710532d35bab01f9f387d5ed04fe0", + "testharness" + ], + "feature-policy/payment-disabled-by-feature-policy.https.sub.html.headers": [ + "09f612159dc367bad5febc8e0a724f0a284517d5", "support" ], "feature-policy/resources/feature-policy-payment.html": [ @@ -280893,6 +281049,10 @@ "dda93e587da353e712ff9bc671ebcafa8dea222f", "support" ], + "payment-handler/OWNERS": [ + "87acefb0bc4335df69cf99836d88077f46f04889", + "support" + ], "payment-handler/interfaces.https.any-expected.txt": [ "32008f4d69caff72f5fa428a4116ee07f4a2af7d", "support" @@ -280905,12 +281065,16 @@ "0991c361a038b95fdc9e5a4bb28a9e0e3d912ceb", "support" ], + "payment-method-id/OWNERS": [ + "fbff9d3abd10076bc7ea110813b6e1e29317fc46", + "support" + ], "payment-method-id/README.md": [ "20d0e6d34a096a9e8c59a8e6ae7d0bfeaa0e6344", "support" ], "payment-request/OWNERS": [ - "347ab897e692741dd7e8bc48d280f648629ebf06", + "e07bb1479fb707767619278f070669d6b76ae950", "support" ], "payment-request/PaymentRequestUpdateEvent/updateWith-duplicate-shipping-options-manual.https.html": [ @@ -280989,34 +281153,6 @@ "e531c0ceda2fa798e5e6df3c7131e6b80f342884", "testharness" ], - "payment-request/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html": [ - "8595732f7794f10107ef234fe6e37cc12c80eeaa", - "testharness" - ], - "payment-request/payment-allowed-by-feature-policy-attribute.https.sub.html": [ - "7f00979fb8e60e938bfa816786705c95e611d2f3", - "testharness" - ], - "payment-request/payment-allowed-by-feature-policy.https.sub.html": [ - "762f4d517150b10438fca8571204caae79e00278", - "testharness" - ], - "payment-request/payment-allowed-by-feature-policy.https.sub.html.headers": [ - "038c90f26cb5c16047c294aa35a0b0251324dbc6", - "support" - ], - "payment-request/payment-default-feature-policy.https.sub.html": [ - "6980a706cca09eaeb2d63d6780a5e0a89ff52fa5", - "testharness" - ], - "payment-request/payment-disabled-by-feature-policy.https.sub.html": [ - "942104579b3710532d35bab01f9f387d5ed04fe0", - "testharness" - ], - "payment-request/payment-disabled-by-feature-policy.https.sub.html.headers": [ - "09f612159dc367bad5febc8e0a724f0a284517d5", - "support" - ], "payment-request/payment-request-abort-method.https-expected.txt": [ "f25bb3ce058098ac437f5307914011f315bcb7f3", "support"
diff --git a/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-sandboxed-iframe-denied-without-wildcard.htm b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-sandboxed-iframe-denied-without-wildcard.htm new file mode 100644 index 0000000..7c375f60 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/XMLHttpRequest/access-control-sandboxed-iframe-denied-without-wildcard.htm
@@ -0,0 +1,43 @@ +<!DOCTYPE html> +<html> + <head> + <title>Tests that sandboxed iframe does not have CORS XHR access to server with "Access-Control-Allow-Origin" set to the original origin</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/common/get-host-info.sub.js"></script> + </head> + <body> + <script type="text/javascript"> +const path = "/XMLHttpRequest/resources/pass.txt?pipe=" + + "header(Cache-Control,no-store)|" + + "header(Content-Type,text/plain)" + + "header(Access-Control-Allow-Credentials,true)|" + + "header(Access-Control-Allow-Origin," + get_host_info().HTTP_ORIGIN + ")"; + +async_test((test) => { + const xhr = new XMLHttpRequest; + xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN + path); + xhr.send(); + xhr.onerror = test.unreached_func("Unexpected error"); + xhr.onload = test.step_func_done(() => { + assert_equals(xhr.status, 200); + assert_equals(xhr.responseText.trim(), "PASS"); + }); +}, "Check that path exists and is accessible via CORS XHR request"); + +async_test((test) => { + window.addEventListener("message", test.step_func((evt) => { + if (evt.data === "ready") { + document.getElementById("frame").contentWindow.postMessage( + get_host_info().HTTP_REMOTE_ORIGIN + path, "*"); + } else { + assert_equals(evt.data, "Exception thrown. Sandboxed iframe XHR access was denied in 'send'."); + test.done(); + } + }), false); +}, "Sandboxed iframe is denied CORS access to server that allows parent origin"); + </script> + <iframe id="frame" sandbox="allow-scripts" src="/XMLHttpRequest/resources/access-control-sandboxed-iframe.html"> + </iframe> + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-cascade-3/OWNERS b/third_party/WebKit/LayoutTests/external/wpt/css/css-cascade-3/OWNERS new file mode 100644 index 0000000..02d41d82 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-cascade-3/OWNERS
@@ -0,0 +1,8 @@ +# TEAM: style-dev@chromium.org +# COMPONENT: Blink>CSS +bugsnash@chromium.org +ericwilligers@chromium.org +meade@chromium.org +nainar@chromium.org +rjwright@chromium.org +shend@chromium.org
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-cascade-4/OWNERS b/third_party/WebKit/LayoutTests/external/wpt/css/css-cascade-4/OWNERS new file mode 100644 index 0000000..02d41d82 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-cascade-4/OWNERS
@@ -0,0 +1,8 @@ +# TEAM: style-dev@chromium.org +# COMPONENT: Blink>CSS +bugsnash@chromium.org +ericwilligers@chromium.org +meade@chromium.org +nainar@chromium.org +rjwright@chromium.org +shend@chromium.org
diff --git a/third_party/WebKit/LayoutTests/external/wpt/feature-policy/README.md b/third_party/WebKit/LayoutTests/external/wpt/feature-policy/README.md index 775a354..a5276f0a 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/feature-policy/README.md +++ b/third_party/WebKit/LayoutTests/external/wpt/feature-policy/README.md
@@ -37,8 +37,8 @@ * test if feature is enabled / disabled in a cross-origin iframe. Examples: -`/payment-request/payment-disabled-by-feature-policy.https.sub.html` -`/payment-request/payment-disabled-by-feature-policy.https.sub.html.headers` +`/feature-policy/payment-disabled-by-feature-policy.https.sub.html` +`/feature-policy/payment-disabled-by-feature-policy.https.sub.html.headers` ### How to Write Container Policy Tests Simply use `test_feature_availability()` with the optional argument @@ -47,7 +47,7 @@ * feature is enabled / disabled in a cross-origin iframe. Example: -`/payment-request/payment-allowed-by-feature-policy-attribute.https.sub.html` +`/feature-policy/payment-allowed-by-feature-policy-attribute.https.sub.html` ### How to Write Container Policy Tests with Redirect Similar to the section above, append @@ -55,5 +55,5 @@ passed to `test_feature_availability()`. Example: -`/payment-request/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html` +`/feature-policy/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html`
diff --git a/third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html b/third_party/WebKit/LayoutTests/external/wpt/feature-policy/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html similarity index 100% rename from third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html rename to third_party/WebKit/LayoutTests/external/wpt/feature-policy/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-allowed-by-feature-policy-attribute.https.sub.html b/third_party/WebKit/LayoutTests/external/wpt/feature-policy/payment-allowed-by-feature-policy-attribute.https.sub.html similarity index 100% rename from third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-allowed-by-feature-policy-attribute.https.sub.html rename to third_party/WebKit/LayoutTests/external/wpt/feature-policy/payment-allowed-by-feature-policy-attribute.https.sub.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-allowed-by-feature-policy.https.sub.html b/third_party/WebKit/LayoutTests/external/wpt/feature-policy/payment-allowed-by-feature-policy.https.sub.html similarity index 100% rename from third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-allowed-by-feature-policy.https.sub.html rename to third_party/WebKit/LayoutTests/external/wpt/feature-policy/payment-allowed-by-feature-policy.https.sub.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-allowed-by-feature-policy.https.sub.html.headers b/third_party/WebKit/LayoutTests/external/wpt/feature-policy/payment-allowed-by-feature-policy.https.sub.html.headers similarity index 100% rename from third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-allowed-by-feature-policy.https.sub.html.headers rename to third_party/WebKit/LayoutTests/external/wpt/feature-policy/payment-allowed-by-feature-policy.https.sub.html.headers
diff --git a/third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-default-feature-policy.https.sub.html b/third_party/WebKit/LayoutTests/external/wpt/feature-policy/payment-default-feature-policy.https.sub.html similarity index 100% rename from third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-default-feature-policy.https.sub.html rename to third_party/WebKit/LayoutTests/external/wpt/feature-policy/payment-default-feature-policy.https.sub.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-disabled-by-feature-policy.https.sub.html b/third_party/WebKit/LayoutTests/external/wpt/feature-policy/payment-disabled-by-feature-policy.https.sub.html similarity index 100% rename from third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-disabled-by-feature-policy.https.sub.html rename to third_party/WebKit/LayoutTests/external/wpt/feature-policy/payment-disabled-by-feature-policy.https.sub.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-disabled-by-feature-policy.https.sub.html.headers b/third_party/WebKit/LayoutTests/external/wpt/feature-policy/payment-disabled-by-feature-policy.https.sub.html.headers similarity index 100% rename from third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-disabled-by-feature-policy.https.sub.html.headers rename to third_party/WebKit/LayoutTests/external/wpt/feature-policy/payment-disabled-by-feature-policy.https.sub.html.headers
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-without-wildcard-expected.txt b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-without-wildcard-expected.txt deleted file mode 100644 index f4e983b..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-without-wildcard-expected.txt +++ /dev/null
@@ -1,12 +0,0 @@ -CONSOLE WARNING: line 10: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. -CONSOLE ERROR: line 16: Failed to load http://127.0.0.1:8000/xmlhttprequest/resources/access-control-sandboxed-iframe-denied-without-wildcard.cgi: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header has a value 'http://127.0.0.1:8000' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access. -This test verifies that sandboxed iframe does not have XmlHttpRequest access to its server with "Access-Control-Allow-Origin" set to its own origin (127.0.0.1). - -This test will print "PASS" on success. - - - --------- -Frame: '<!--framePath //<!--frame0-->-->' --------- -PASS: Exception thrown. Sandboxed iframe XHR access was denied in 'send'. [Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://127.0.0.1:8000/xmlhttprequest/resources/access-control-sandboxed-iframe-denied-without-wildcard.cgi'.].
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-without-wildcard.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-without-wildcard.html deleted file mode 100644 index 01a6c9c3c..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-without-wildcard.html +++ /dev/null
@@ -1,22 +0,0 @@ -<html> -<script> - -if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.dumpChildFramesAsText(); -} - -</script> -<body> - - <p>This test verifies that sandboxed iframe does not have XmlHttpRequest access to - its server with "Access-Control-Allow-Origin" set to its own origin (127.0.0.1).</p> - - <p>This test will print "PASS" on success.</p> - - <iframe sandbox="allow-scripts" - src="http://127.0.0.1:8000/xmlhttprequest/resources/access-control-sandboxed-iframe-denied-without-wildcard-iframe.html" style="width: 500px;"> - </iframe> - -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-denied-without-wildcard-iframe.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-denied-without-wildcard-iframe.html deleted file mode 100644 index a0f07c0..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-denied-without-wildcard-iframe.html +++ /dev/null
@@ -1,26 +0,0 @@ -<html> -<body> -<pre id='console'></pre> -<script type="text/javascript"> - -document.getElementById('console').innerHTML = (function() { - var xhr = new XMLHttpRequest; - - try { - xhr.open("GET", "http://127.0.0.1:8000/xmlhttprequest/resources/access-control-sandboxed-iframe-denied-without-wildcard.cgi", false); - } catch(e) { - return "FAIL: Exception thrown. Sandboxed iframe XHR access is not allowed in 'open'. [" + e.message + "]."; - } - - try { - xhr.send(); - } catch(e) { - return "PASS: Exception thrown. Sandboxed iframe XHR access was denied in 'send'. [" + e.message + "]."; - } - - return xhr.responseText; -})(); - -</script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-denied-without-wildcard.cgi b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-denied-without-wildcard.cgi deleted file mode 100755 index 96e6169..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-denied-without-wildcard.cgi +++ /dev/null
@@ -1,8 +0,0 @@ -#!/usr/bin/perl -wT -use strict; - -print "Content-Type: text/plain\n"; -print "Access-Control-Allow-Credentials: true\n"; -print "Access-Control-Allow-Origin: http://127.0.0.1:8000\n\n"; - -print "FAIL: Sandboxed iframe XHR access allowed.\n";
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/emulation/set-navigator-platform-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/emulation/set-navigator-platform-expected.txt new file mode 100644 index 0000000..d15d6f2d --- /dev/null +++ b/third_party/WebKit/LayoutTests/inspector-protocol/emulation/set-navigator-platform-expected.txt
@@ -0,0 +1,3 @@ +Tests that navigator.platform can be overridden. +navigator.platform = TestPlatform +
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/emulation/set-navigator-platform.js b/third_party/WebKit/LayoutTests/inspector-protocol/emulation/set-navigator-platform.js new file mode 100644 index 0000000..ddc18c2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/inspector-protocol/emulation/set-navigator-platform.js
@@ -0,0 +1,8 @@ +(async function(testRunner) { + var {page, session, dp} = await testRunner.startBlank('Tests that navigator.platform can be overridden.'); + + await dp.Emulation.setNavigatorOverrides({ platform: 'TestPlatform' }); + var result = await dp.Runtime.evaluate({ expression: 'navigator.platform' }); + testRunner.log('navigator.platform = ' + result.result.result.value); + testRunner.completeTest(); +})
diff --git a/third_party/WebKit/Source/core/editing/EphemeralRange.cpp b/third_party/WebKit/Source/core/editing/EphemeralRange.cpp index 907ff9c..4e4dd1a5 100644 --- a/third_party/WebKit/Source/core/editing/EphemeralRange.cpp +++ b/third_party/WebKit/Source/core/editing/EphemeralRange.cpp
@@ -38,9 +38,9 @@ return; } DCHECK(end_position_.IsNotNull()); + DCHECK(start_position_.IsValidFor(*start_position_.GetDocument())); + DCHECK(end_position_.IsValidFor(*end_position_.GetDocument())); DCHECK_EQ(start_position_.GetDocument(), end_position_.GetDocument()); - DCHECK(start_position_.IsConnected()); - DCHECK(end_position_.IsConnected()); DCHECK_LE(start_position_, end_position_); }
diff --git a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp index 7c93599f..cc93eb6 100644 --- a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp +++ b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp
@@ -132,8 +132,8 @@ const PositionInFlatTree& extent = ToPositionInFlatTree(selection_in_dom.Extent()); if (base.IsNull() || extent.IsNull() || base == extent || - !IsPositionValidFor(base, frame_selection.GetDocument()) || - !IsPositionValidFor(extent, frame_selection.GetDocument())) + !base.IsValidFor(frame_selection.GetDocument()) || + !extent.IsValidFor(frame_selection.GetDocument())) return {}; return base <= extent ? EphemeralRangeInFlatTree(base, extent) : EphemeralRangeInFlatTree(extent, base);
diff --git a/third_party/WebKit/Source/core/editing/Position.cpp b/third_party/WebKit/Source/core/editing/Position.cpp index 39e6ecb..cd64c22 100644 --- a/third_party/WebKit/Source/core/editing/Position.cpp +++ b/third_party/WebKit/Source/core/editing/Position.cpp
@@ -334,7 +334,8 @@ *other.ComputeContainerNode()); } -bool IsPositionValidFor(const Position& position, const Document& document) { +static bool IsPositionValidFor(const Position& position, + const Document& document) { if (position.IsNull()) return true; if (position.GetDocument() != document) @@ -342,8 +343,8 @@ return position.AnchorNode()->isConnected(); } -bool IsPositionValidFor(const PositionInFlatTree& position, - const Document& document) { +static bool IsPositionValidFor(const PositionInFlatTree& position, + const Document& document) { if (position.IsNull()) return true; if (position.GetDocument() != document)
diff --git a/third_party/WebKit/Source/core/editing/Position.h b/third_party/WebKit/Source/core/editing/Position.h index 256e91b3..460a2a2 100644 --- a/third_party/WebKit/Source/core/editing/Position.h +++ b/third_party/WebKit/Source/core/editing/Position.h
@@ -230,9 +230,6 @@ using Position = PositionTemplate<EditingStrategy>; using PositionInFlatTree = PositionTemplate<EditingInFlatTreeStrategy>; -bool IsPositionValidFor(const Position&, const Document&); -bool IsPositionValidFor(const PositionInFlatTree&, const Document&); - template <typename Strategy> bool operator==(const PositionTemplate<Strategy>& a, const PositionTemplate<Strategy>& b) {
diff --git a/third_party/WebKit/Source/core/frame/Navigator.cpp b/third_party/WebKit/Source/core/frame/Navigator.cpp index 48d3ad7..26089b1 100644 --- a/third_party/WebKit/Source/core/frame/Navigator.cpp +++ b/third_party/WebKit/Source/core/frame/Navigator.cpp
@@ -59,6 +59,14 @@ return ""; } +String Navigator::platform() const { + if (GetFrame() && + !GetFrame()->GetSettings()->GetNavigatorPlatformOverride().IsEmpty()) { + return GetFrame()->GetSettings()->GetNavigatorPlatformOverride(); + } + return NavigatorID::platform(); +} + String Navigator::userAgent() const { // If the frame is already detached it no longer has a meaningful useragent. if (!GetFrame() || !GetFrame()->GetPage())
diff --git a/third_party/WebKit/Source/core/frame/Navigator.h b/third_party/WebKit/Source/core/frame/Navigator.h index 2104cae..9009549 100644 --- a/third_party/WebKit/Source/core/frame/Navigator.h +++ b/third_party/WebKit/Source/core/frame/Navigator.h
@@ -57,6 +57,7 @@ String vendor() const; String vendorSub() const; + String platform() const override; String userAgent() const override; // NavigatorLanguage
diff --git a/third_party/WebKit/Source/core/frame/NavigatorID.cpp b/third_party/WebKit/Source/core/frame/NavigatorID.cpp index 0bd1d9d9..227a6f8 100644 --- a/third_party/WebKit/Source/core/frame/NavigatorID.cpp +++ b/third_party/WebKit/Source/core/frame/NavigatorID.cpp
@@ -55,7 +55,7 @@ return agent.Substring(agent.find('/') + 1); } -String NavigatorID::platform() { +String NavigatorID::platform() const { #if defined(OS_MACOSX) // Match Safari and Mozilla on Mac x86. return "MacIntel";
diff --git a/third_party/WebKit/Source/core/frame/NavigatorID.h b/third_party/WebKit/Source/core/frame/NavigatorID.h index f3ca4fe..6685bba 100644 --- a/third_party/WebKit/Source/core/frame/NavigatorID.h +++ b/third_party/WebKit/Source/core/frame/NavigatorID.h
@@ -41,7 +41,7 @@ String appCodeName(); String appName(); String appVersion(); - String platform(); + virtual String platform() const; String product(); virtual String userAgent() const = 0; };
diff --git a/third_party/WebKit/Source/core/frame/Settings.json5 b/third_party/WebKit/Source/core/frame/Settings.json5 index c34fbc3..e41dad8 100644 --- a/third_party/WebKit/Source/core/frame/Settings.json5 +++ b/third_party/WebKit/Source/core/frame/Settings.json5
@@ -971,5 +971,9 @@ name: "forceDisplayList2dCanvasEnabled", initial: false, }, + { + name: "navigatorPlatformOverride", + type: "String", + }, ], }
diff --git a/third_party/WebKit/Source/core/inspector/InspectorEmulationAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorEmulationAgent.cpp index 7c086eb..fa8da6f 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorEmulationAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorEmulationAgent.cpp
@@ -31,6 +31,7 @@ static const char kEmulatedMedia[] = "emulatedMedia"; static const char kDefaultBackgroundColorOverrideRGBA[] = "defaultBackgroundColorOverrideRGBA"; +static const char kNavigatorPlatform[] = "navigatorPlatform"; } InspectorEmulationAgent* InspectorEmulationAgent::Create( @@ -72,6 +73,10 @@ Maybe<protocol::DOM::RGBA>(std::move(rgba))); } } + String navigator_platform; + state_->getString(EmulationAgentState::kNavigatorPlatform, + &navigator_platform); + setNavigatorOverrides(navigator_platform); } Response InspectorEmulationAgent::disable() { @@ -84,6 +89,7 @@ web_local_frame_->View()->Scheduler()->RemoveVirtualTimeObserver(this); virtual_time_observer_registered_ = false; } + setNavigatorOverrides(String()); return Response::OK(); } @@ -160,6 +166,14 @@ return Response::OK(); } +Response InspectorEmulationAgent::setNavigatorOverrides( + const String& platform) { + state_->setString(EmulationAgentState::kNavigatorPlatform, platform); + GetWebViewImpl()->GetPage()->GetSettings().SetNavigatorPlatformOverride( + platform); + return Response::OK(); +} + void InspectorEmulationAgent::VirtualTimeBudgetExpired() { web_local_frame_->View()->Scheduler()->SetVirtualTimePolicy( WebViewScheduler::VirtualTimePolicy::PAUSE);
diff --git a/third_party/WebKit/Source/core/inspector/InspectorEmulationAgent.h b/third_party/WebKit/Source/core/inspector/InspectorEmulationAgent.h index 830a7c7a..d21129de 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorEmulationAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorEmulationAgent.h
@@ -50,6 +50,7 @@ protocol::Response setVirtualTimePolicy( const String& policy, protocol::Maybe<int> virtual_time_budget_ms) override; + protocol::Response setNavigatorOverrides(const String& platform) override; protocol::Response setDefaultBackgroundColorOverride( protocol::Maybe<protocol::DOM::RGBA>) override;
diff --git a/third_party/WebKit/Source/core/inspector/browser_protocol.json b/third_party/WebKit/Source/core/inspector/browser_protocol.json index 77fddf7..e4e7de8 100644 --- a/third_party/WebKit/Source/core/inspector/browser_protocol.json +++ b/third_party/WebKit/Source/core/inspector/browser_protocol.json
@@ -1082,6 +1082,14 @@ "experimental": true }, { + "name": "setNavigatorOverrides", + "description": "Overrides value returned by the javascript navigator object.", + "parameters": [ + { "name": "platform", "type": "string", "description": "The platform navigator.platform should return." } + ], + "experimental": true + }, + { "name": "setDefaultBackgroundColorOverride", "description": "Sets or clears an override of the default background color of the frame. This override is used if the content does not specify one.", "parameters": [
diff --git a/third_party/WebKit/Source/core/inspector/inspector_protocol_config.json b/third_party/WebKit/Source/core/inspector/inspector_protocol_config.json index 73ffa93..f780f74 100644 --- a/third_party/WebKit/Source/core/inspector/inspector_protocol_config.json +++ b/third_party/WebKit/Source/core/inspector/inspector_protocol_config.json
@@ -90,7 +90,7 @@ { "domain": "Emulation", "include": ["forceViewport", "resetViewport", "resetPageScaleFactor", "setPageScaleFactor", "setScriptExecutionDisabled", "setTouchEmulationEnabled", - "setEmulatedMedia", "setCPUThrottlingRate", "setVirtualTimePolicy", "setDefaultBackgroundColorOverride"], + "setEmulatedMedia", "setCPUThrottlingRate", "setVirtualTimePolicy", "setNavigatorOverrides", "setDefaultBackgroundColorOverride"], "include_events": ["virtualTimeBudgetExpired", "virtualTimePaused"] }, {
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/AXBreadcrumbsPane.js b/third_party/WebKit/Source/devtools/front_end/accessibility/AXBreadcrumbsPane.js index 545653e8..3d9bf5d 100644 --- a/third_party/WebKit/Source/devtools/front_end/accessibility/AXBreadcrumbsPane.js +++ b/third_party/WebKit/Source/devtools/front_end/accessibility/AXBreadcrumbsPane.js
@@ -16,6 +16,8 @@ /** @type {?Accessibility.AXBreadcrumb} */ this._preselectedBreadcrumb = null; + /** @type {?Accessibility.AXBreadcrumb} */ + this._inspectedNodeBreadcrumb = null; this._selectedByUser = true; @@ -27,6 +29,7 @@ this._rootElement.addEventListener('mouseleave', this._onMouseLeave.bind(this), false); this._rootElement.addEventListener('click', this._onClick.bind(this), false); this._rootElement.addEventListener('contextmenu', this._contextMenuEventFired.bind(this), false); + this._rootElement.addEventListener('focusout', this._onFocusOut.bind(this), false); this.registerRequiredCSS('accessibility/axBreadcrumbs.css'); } @@ -65,14 +68,14 @@ depth++; } - var inspectedNodeBreadcrumb = breadcrumb; - inspectedNodeBreadcrumb.setPreselected(true, this._selectedByUser); + this._inspectedNodeBreadcrumb = breadcrumb; + this._inspectedNodeBreadcrumb.setPreselected(true, this._selectedByUser); - this._setPreselectedBreadcrumb(inspectedNodeBreadcrumb); + this._setPreselectedBreadcrumb(this._inspectedNodeBreadcrumb); for (var child of axNode.children()) { var childBreadcrumb = new Accessibility.AXBreadcrumb(child, depth, false); - inspectedNodeBreadcrumb.appendChild(childBreadcrumb); + this._inspectedNodeBreadcrumb.appendChild(childBreadcrumb); } this._selectedByUser = false; @@ -147,10 +150,12 @@ return; if (this._preselectedBreadcrumb) this._preselectedBreadcrumb.setPreselected(false, this._selectedByUser); - this._preselectedBreadcrumb = breadcrumb; - if (this._preselectedBreadcrumb) - this._preselectedBreadcrumb.setPreselected(true, this._selectedByUser); - else if (this._selectedByUser) + if (breadcrumb) + this._preselectedBreadcrumb = breadcrumb; + else + this._preselectedBreadcrumb = this._inspectedNodeBreadcrumb; + this._preselectedBreadcrumb.setPreselected(true, this._selectedByUser); + if (!breadcrumb && this._selectedByUser) SDK.OverlayModel.hideDOMNodeHighlight(); } @@ -171,7 +176,7 @@ return; } var breadcrumb = breadcrumbElement.breadcrumb; - if (breadcrumb.preselected() || breadcrumb.inspected() || !breadcrumb.isDOMNode()) + if (!breadcrumb.isDOMNode()) return; this._setHoveredBreadcrumb(breadcrumb); } @@ -179,6 +184,15 @@ /** * @param {!Event} event */ + _onFocusOut(event) { + if (!this._preselectedBreadcrumb || event.target !== this._preselectedBreadcrumb.nodeElement()) + return; + this._setPreselectedBreadcrumb(null); + } + + /** + * @param {!Event} event + */ _onClick(event) { var breadcrumbElement = event.target.enclosingNodeOrSelfWithClass('ax-breadcrumb'); if (!breadcrumbElement) { @@ -189,7 +203,7 @@ if (breadcrumb.inspected()) { // If the user is clicking the inspected breadcrumb, they probably want to // focus it. - breadcrumb.element().focus(); + breadcrumb.nodeElement().focus(); return; } if (!breadcrumb.isDOMNode()) @@ -239,7 +253,7 @@ * @param {!Event} event */ _contextMenuEventFired(event) { - var breadcrumbElement = event.target.enclosingNodeOrSelfWithClass('ax-node'); + var breadcrumbElement = event.target.enclosingNodeOrSelfWithClass('ax-breadcrumb'); if (!breadcrumbElement) return; @@ -272,10 +286,11 @@ this._axNode = axNode; this._element = createElementWithClass('div', 'ax-breadcrumb'); - UI.ARIAUtils.markAsTreeitem(this._element); this._element.breadcrumb = this; this._nodeElement = createElementWithClass('div', 'ax-node'); + UI.ARIAUtils.markAsTreeitem(this._nodeElement); + this._nodeElement.tabIndex = -1; this._element.appendChild(this._nodeElement); this._nodeWrapper = createElementWithClass('div', 'wrapper'); this._nodeElement.appendChild(this._nodeWrapper); @@ -323,13 +338,20 @@ } /** + * @return {!Element} + */ + nodeElement() { + return this._nodeElement; + } + + /** * @param {!Accessibility.AXBreadcrumb} breadcrumb */ appendChild(breadcrumb) { this._children.push(breadcrumb); breadcrumb.setParent(this); this._nodeElement.classList.add('parent'); - UI.ARIAUtils.setExpanded(this._element, true); + UI.ARIAUtils.setExpanded(this._nodeElement, true); this._childrenGroupElement.appendChild(breadcrumb.element()); } @@ -359,7 +381,7 @@ if (preselected) this._nodeElement.setAttribute('tabIndex', 0); else - this._nodeElement.removeAttribute('tabIndex'); + this._nodeElement.setAttribute('tabIndex', -1); if (this._preselected) { if (selectedByUser) this._nodeElement.focus();
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js b/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js index 78b3918..52f29f2 100644 --- a/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js +++ b/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js
@@ -75,6 +75,7 @@ var node = this.node(); this._axNodeSubPane.setNode(node); this._ariaSubPane.setNode(node); + this._breadcrumbsSubPane.setNode(node); if (!node) return Promise.resolve(); var accessibilityModel = node.domModel().target().model(Accessibility.AccessibilityModel);
diff --git a/third_party/WebKit/Source/platform/CrossThreadCopier.h b/third_party/WebKit/Source/platform/CrossThreadCopier.h index f9cb7ae..37a8c1e 100644 --- a/third_party/WebKit/Source/platform/CrossThreadCopier.h +++ b/third_party/WebKit/Source/platform/CrossThreadCopier.h
@@ -94,23 +94,13 @@ // CrossThreadCopier specializations follow. template <typename T> -struct CrossThreadCopier<PassRefPtr<T>> { - STATIC_ONLY(CrossThreadCopier); - typedef PassRefPtr<T> Type; - static_assert(WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, - "PassRefPtr<T> can be passed across threads only if T is " - "ThreadSafeRefCounted."); - static PassRefPtr<T> Copy(PassRefPtr<T>&& pointer) { - return std::move(pointer); - } -}; -template <typename T> struct CrossThreadCopier<RefPtr<T>> : public CrossThreadCopierPassThrough<RefPtr<T>> { STATIC_ONLY(CrossThreadCopier); static_assert(WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, "RefPtr<T> can be passed across threads only if T is " "ThreadSafeRefCounted."); + static RefPtr<T> Copy(RefPtr<T> pointer) { return pointer; } }; template <typename T> struct CrossThreadCopier<sk_sp<T>>
diff --git a/third_party/WebKit/Source/platform/exported/WebAudioBus.cpp b/third_party/WebKit/Source/platform/exported/WebAudioBus.cpp index 462c4d3..afe4ac9 100644 --- a/third_party/WebKit/Source/platform/exported/WebAudioBus.cpp +++ b/third_party/WebKit/Source/platform/exported/WebAudioBus.cpp
@@ -85,7 +85,7 @@ return private_->Channel(channel_index)->MutableData(); } -PassRefPtr<AudioBus> WebAudioBus::Release() { +RefPtr<AudioBus> WebAudioBus::Release() { RefPtr<AudioBus> audio_bus(AdoptRef(static_cast<AudioBus*>(private_))); private_ = 0; return audio_bus;
diff --git a/third_party/WebKit/Source/platform/wtf/Forward.h b/third_party/WebKit/Source/platform/wtf/Forward.h index c6d12c1..a69c4669 100644 --- a/third_party/WebKit/Source/platform/wtf/Forward.h +++ b/third_party/WebKit/Source/platform/wtf/Forward.h
@@ -27,10 +27,10 @@ namespace WTF { template <typename T> -class PassRefPtr; -template <typename T> class RefPtr; template <typename T> +using PassRefPtr = RefPtr<T>; +template <typename T> class StringBuffer; template <typename T, size_t inlineCapacity, typename Allocator> class Vector;
diff --git a/third_party/WebKit/Source/platform/wtf/Functional.h b/third_party/WebKit/Source/platform/wtf/Functional.h index c85f989..ce5c2b4 100644 --- a/third_party/WebKit/Source/platform/wtf/Functional.h +++ b/third_party/WebKit/Source/platform/wtf/Functional.h
@@ -172,11 +172,6 @@ }; template <typename T> -struct ParamStorageTraits<PassRefPtr<T>> { - typedef RefPtr<T> StorageType; -}; - -template <typename T> struct ParamStorageTraits<RefPtr<T>> { typedef RefPtr<T> StorageType; };
diff --git a/third_party/WebKit/Source/platform/wtf/HashFunctions.h b/third_party/WebKit/Source/platform/wtf/HashFunctions.h index f1c27b3..f123973 100644 --- a/third_party/WebKit/Source/platform/wtf/HashFunctions.h +++ b/third_party/WebKit/Source/platform/wtf/HashFunctions.h
@@ -150,16 +150,10 @@ struct RefPtrHash : PtrHash<T> { using PtrHash<T>::GetHash; static unsigned GetHash(const RefPtr<T>& key) { return GetHash(key.Get()); } - static unsigned GetHash(const PassRefPtr<T>& key) { - return GetHash(key.Get()); - } using PtrHash<T>::Equal; static bool Equal(const RefPtr<T>& a, const RefPtr<T>& b) { return a == b; } static bool Equal(T* a, const RefPtr<T>& b) { return a == b; } static bool Equal(const RefPtr<T>& a, T* b) { return a == b; } - static bool Equal(const RefPtr<T>& a, const PassRefPtr<T>& b) { - return a == b; - } }; template <typename T>
diff --git a/third_party/WebKit/Source/platform/wtf/PassRefPtr.h b/third_party/WebKit/Source/platform/wtf/PassRefPtr.h index b2d9031..94e26255 100644 --- a/third_party/WebKit/Source/platform/wtf/PassRefPtr.h +++ b/third_party/WebKit/Source/platform/wtf/PassRefPtr.h
@@ -29,15 +29,11 @@ #include "platform/wtf/Allocator.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/Compiler.h" +#include "platform/wtf/Forward.h" #include "platform/wtf/TypeTraits.h" namespace WTF { -template <typename T> -class RefPtr; -template <typename T> -class PassRefPtr; - // requireAdoption() is not overloaded for WTF::RefCounted, which has a built-in // assumption that adoption is required. requireAdoption() is for bootstrapping // alternate reference count classes that are compatible with RefPtr/PassRefPtr @@ -61,146 +57,10 @@ } template <typename T> -class PassRefPtr { - DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); - - public: - PassRefPtr() : ptr_(nullptr) {} - PassRefPtr(std::nullptr_t) : ptr_(nullptr) {} - PassRefPtr(T* ptr) : ptr_(ptr) { RefIfNotNull(ptr); } - PassRefPtr(PassRefPtr&& o) : ptr_(o.LeakRef()) {} - template <typename U> - PassRefPtr(PassRefPtr<U>&& o, EnsurePtrConvertibleArgDecl(U, T)) - : ptr_(o.LeakRef()) {} - - ALWAYS_INLINE ~PassRefPtr() { DerefIfNotNull(ptr_); } - - template <typename U> - PassRefPtr(const RefPtr<U>&, EnsurePtrConvertibleArgDecl(U, T)); - template <typename U> - PassRefPtr(RefPtr<U>&&, EnsurePtrConvertibleArgDecl(U, T)); - - T* Get() const { return ptr_; } - - WARN_UNUSED_RESULT T* LeakRef(); - - T& operator*() const { return *ptr_; } - T* operator->() const { return ptr_; } - - bool operator!() const { return !ptr_; } - explicit operator bool() const { return ptr_ != nullptr; } - - private: - PassRefPtr& operator=(const PassRefPtr&) { - static_assert(!sizeof(T*), "PassRefPtr should never be assigned to"); - return *this; - } - - T* ptr_; -}; - -template <typename T> PassRefPtr<T> WrapPassRefPtr(T* ptr) { return PassRefPtr<T>(ptr); } -template <typename T> -template <typename U> -inline PassRefPtr<T>::PassRefPtr(const RefPtr<U>& o, - EnsurePtrConvertibleArgDefn(U, T)) - : ptr_(o.Get()) { - T* ptr = ptr_; - RefIfNotNull(ptr); -} - -template <typename T> -template <typename U> -inline PassRefPtr<T>::PassRefPtr(RefPtr<U>&& o, - EnsurePtrConvertibleArgDefn(U, T)) - : ptr_(o.LeakRef()) {} - -template <typename T> -inline T* PassRefPtr<T>::LeakRef() { - T* ptr = ptr_; - ptr_ = nullptr; - return ptr; -} - -template <typename T, typename U> -inline bool operator==(const PassRefPtr<T>& a, const PassRefPtr<U>& b) { - return a.Get() == b.Get(); -} - -template <typename T, typename U> -inline bool operator==(const PassRefPtr<T>& a, const RefPtr<U>& b) { - return a.Get() == b.Get(); -} - -template <typename T, typename U> -inline bool operator==(const RefPtr<T>& a, const PassRefPtr<U>& b) { - return a.Get() == b.Get(); -} - -template <typename T, typename U> -inline bool operator==(const PassRefPtr<T>& a, U* b) { - return a.Get() == b; -} - -template <typename T, typename U> -inline bool operator==(T* a, const PassRefPtr<U>& b) { - return a == b.Get(); -} - -template <typename T> -inline bool operator==(const PassRefPtr<T>& a, std::nullptr_t) { - return !a.Get(); -} - -template <typename T> -inline bool operator==(std::nullptr_t, const PassRefPtr<T>& b) { - return !b.Get(); -} - -template <typename T, typename U> -inline bool operator!=(const PassRefPtr<T>& a, const PassRefPtr<U>& b) { - return a.Get() != b.Get(); -} - -template <typename T, typename U> -inline bool operator!=(const PassRefPtr<T>& a, const RefPtr<U>& b) { - return a.Get() != b.Get(); -} - -template <typename T, typename U> -inline bool operator!=(const RefPtr<T>& a, const PassRefPtr<U>& b) { - return a.Get() != b.Get(); -} - -template <typename T, typename U> -inline bool operator!=(const PassRefPtr<T>& a, U* b) { - return a.Get() != b; -} - -template <typename T, typename U> -inline bool operator!=(T* a, const PassRefPtr<U>& b) { - return a != b.Get(); -} - -template <typename T> -inline bool operator!=(const PassRefPtr<T>& a, std::nullptr_t) { - return a.Get(); -} - -template <typename T> -inline bool operator!=(std::nullptr_t, const PassRefPtr<T>& b) { - return b.Get(); -} - -template <typename T> -inline T* GetPtr(const PassRefPtr<T>& p) { - return p.Get(); -} - } // namespace WTF using WTF::PassRefPtr;
diff --git a/third_party/WebKit/Source/platform/wtf/RefPtr.h b/third_party/WebKit/Source/platform/wtf/RefPtr.h index d24cf24..e46a7ac 100644 --- a/third_party/WebKit/Source/platform/wtf/RefPtr.h +++ b/third_party/WebKit/Source/platform/wtf/RefPtr.h
@@ -32,8 +32,6 @@ namespace WTF { template <typename T> -class PassRefPtr; -template <typename T> class RefPtrValuePeeker; template <typename T> class RefPtr; @@ -63,11 +61,6 @@ RefPtr(RefPtr<U>&& o, EnsurePtrConvertibleArgDecl(U, T)) : ptr_(o.LeakRef()) {} - // See comments in PassRefPtr.h for an explanation of why this takes a const - // reference. - template <typename U> - RefPtr(PassRefPtr<U>&&, EnsurePtrConvertibleArgDecl(U, T)); - // Hash table deleted values, which are only constructed and never copied or // destroyed. RefPtr(HashTableDeletedValueType) : ptr_(HashTableDeletedValue()) {} @@ -113,11 +106,6 @@ }; template <typename T> -template <typename U> -inline RefPtr<T>::RefPtr(PassRefPtr<U>&& o, EnsurePtrConvertibleArgDefn(U, T)) - : ptr_(o.LeakRef()) {} - -template <typename T> inline T* RefPtr<T>::LeakRef() { T* ptr = ptr_; ptr_ = nullptr; @@ -213,8 +201,6 @@ ALWAYS_INLINE RefPtrValuePeeker(std::nullptr_t) : ptr_(nullptr) {} template <typename U> RefPtrValuePeeker(const RefPtr<U>& p) : ptr_(p.Get()) {} - template <typename U> - RefPtrValuePeeker(const PassRefPtr<U>& p) : ptr_(p.Get()) {} ALWAYS_INLINE operator T*() const { return ptr_; }
diff --git a/third_party/WebKit/public/BUILD.gn b/third_party/WebKit/public/BUILD.gn index b45bfa5..93ef3fa5 100644 --- a/third_party/WebKit/public/BUILD.gn +++ b/third_party/WebKit/public/BUILD.gn
@@ -800,6 +800,7 @@ "platform/modules/presentation/presentation.mojom", "platform/modules/serviceworker/service_worker_error_type.mojom", "platform/modules/serviceworker/service_worker_event_status.mojom", + "platform/modules/serviceworker/service_worker_registration.mojom", "platform/modules/serviceworker/service_worker_stream_handle.mojom", "platform/modules/webauth/authenticator.mojom", "platform/modules/websockets/websocket.mojom",
diff --git a/third_party/WebKit/public/platform/WebAudioBus.h b/third_party/WebKit/public/platform/WebAudioBus.h index 6d3ecd3..0e0a027 100644 --- a/third_party/WebKit/public/platform/WebAudioBus.h +++ b/third_party/WebKit/public/platform/WebAudioBus.h
@@ -30,7 +30,7 @@ #if INSIDE_BLINK namespace WTF { template <typename T> -class PassRefPtr; +class RefPtr; } #endif @@ -68,7 +68,7 @@ float* ChannelData(unsigned channel_index); #if INSIDE_BLINK - WTF::PassRefPtr<AudioBus> Release(); + WTF::RefPtr<AudioBus> Release(); #endif private:
diff --git a/third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom b/third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom new file mode 100644 index 0000000..881148ac --- /dev/null +++ b/third_party/WebKit/public/platform/modules/serviceworker/service_worker_registration.mojom
@@ -0,0 +1,14 @@ +// 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. + +module blink.mojom; + +import "url/mojo/url.mojom"; + +// Represents options for register(): +// https://w3c.github.io/ServiceWorker/#dictdef-registrationoptions +struct ServiceWorkerRegistrationOptions { + url.mojom.Url scope; + // TODO(yuryu): Other values will be added as they are supported later. +};
diff --git a/tools/clang/scripts/test_tool.py b/tools/clang/scripts/test_tool.py index 58958ff..82528dc 100755 --- a/tools/clang/scripts/test_tool.py +++ b/tools/clang/scripts/test_tool.py
@@ -33,7 +33,7 @@ include_path_flags = ' '.join('-I %s' % include_path.replace('\\', '/') for include_path in include_paths) return json.dumps([{'directory': os.path.dirname(f), - 'command': 'clang++ -std=c++11 -fsyntax-only %s -c %s' % ( + 'command': 'clang++ -std=c++14 -fsyntax-only %s -c %s' % ( include_path_flags, os.path.basename(f)), 'file': os.path.basename(f)} for f in files], indent=2) @@ -186,9 +186,9 @@ print '[ RUN ] %s' % os.path.relpath(actual) expected_output = actual_output = None with open(expected, 'r') as f: - expected_output = f.readlines() + expected_output = f.read().splitlines() with open(actual, 'r') as f: - actual_output = f.readlines() + actual_output = f.read().splitlines() if actual_output != expected_output: failed += 1 for line in difflib.unified_diff(expected_output, actual_output,
diff --git a/tools/idl_parser/idl_parser.py b/tools/idl_parser/idl_parser.py index cba40fb68..9fa651b 100755 --- a/tools/idl_parser/idl_parser.py +++ b/tools/idl_parser/idl_parser.py
@@ -695,19 +695,24 @@ p[0] = self.BuildError(p, 'Arguments') def p_Argument(self, p): - """Argument : ExtendedAttributeList OptionalOrRequiredArgument""" - p[2].AddChildren(p[1]) - p[0] = p[2] - - def p_OptionalOrRequiredArgument(self, p): - """OptionalOrRequiredArgument : OPTIONAL Type ArgumentName Default - | Type Ellipsis ArgumentName""" - if len(p) > 4: - arg = self.BuildNamed('Argument', p, 3, ListFromConcat(p[2], p[4])) - arg.AddChildren(self.BuildTrue('OPTIONAL')) + """Argument : ExtendedAttributeList OPTIONAL TypeWithExtendedAttributes ArgumentName Default + | ExtendedAttributeList Type Ellipsis ArgumentName""" + if len(p) > 5: + p[0] = self.BuildNamed('Argument', p, 4, ListFromConcat(p[3], p[5])) + p[0].AddChildren(self.BuildTrue('OPTIONAL')) + p[0].AddChildren(p[1]) else: - arg = self.BuildNamed('Argument', p, 3, ListFromConcat(p[1], p[2])) - p[0] = arg + applicable_to_types, non_applicable_to_types = \ + DivideExtAttrsIntoApplicableAndNonApplicable(p[1]) + if applicable_to_types: + attributes = self.BuildProduction('ExtAttributes', p, 1, + applicable_to_types) + p[2].AddChildren(attributes) + p[0] = self.BuildNamed('Argument', p, 4, ListFromConcat(p[2], p[3])) + if non_applicable_to_types: + attributes = self.BuildProduction('ExtAttributes', p, 1, + non_applicable_to_types) + p[0].AddChildren(attributes) def p_ArgumentName(self, p): """ArgumentName : ArgumentNameKeyword
diff --git a/tools/idl_parser/test_parser/interface_web.idl b/tools/idl_parser/test_parser/interface_web.idl index b8671ff..750eae4 100644 --- a/tools/idl_parser/test_parser/interface_web.idl +++ b/tools/idl_parser/test_parser/interface_web.idl
@@ -447,4 +447,48 @@ */ interface MyIfaceAttributeRestClamp { attribute [Clamp] long myLong; +}; + +/** TREE + *Interface(MyIFaceArgumentWithAnnotatedType1) + * Operation(myFunction) + * Arguments() + * Argument(myLong) + * Type() + * PrimitiveType(long long) + * ExtAttributes() + * ExtAttribute(Clamp) + * Type() + * PrimitiveType(void) + */ +interface MyIFaceArgumentWithAnnotatedType1 { + void myFunction(optional [Clamp] long long myLong); +}; + +/** TREE + *Interface(MyIFaceArgumentWithAnnotatedType2) + * Operation(voidMethodTestArgumentWithExtAttribute1) + * Arguments() + * Argument(myLong) + * Type() + * PrimitiveType(long long) + * ExtAttributes() + * ExtAttribute(Clamp) + * ExtAttributes() + * ExtAttribute(XAttr) + * Type() + * PrimitiveType(void) + * Operation(voidMethodTestArgumentWithExtAttribute2) + * Arguments() + * Argument(longArg) + * Type() + * PrimitiveType(long) + * ExtAttributes() + * ExtAttribute(EnforceRange) + * Type() + * PrimitiveType(void) + */ +interface MyIFaceArgumentWithAnnotatedType2 { + void voidMethodTestArgumentWithExtAttribute1([Clamp, XAttr] long long myLong); + void voidMethodTestArgumentWithExtAttribute2([EnforceRange] long longArg); }; \ No newline at end of file