diff --git a/chrome/VERSION b/chrome/VERSION index fddaec8..53b8ef1a 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=57 MINOR=0 -BUILD=2965 +BUILD=2966 PATCH=0
diff --git a/chrome/browser/resources/md_history/app.js b/chrome/browser/resources/md_history/app.js index a1766845..846643fa 100644 --- a/chrome/browser/resources/md_history/app.js +++ b/chrome/browser/resources/md_history/app.js
@@ -53,8 +53,12 @@ searchTerm: '', groupedOffset: 0, - set range(val) { this._range = Number(val); }, - get range() { return this._range; }, + set range(val) { + this._range = Number(val); + }, + get range() { + return this._range; + }, }; } }, @@ -86,7 +90,9 @@ showMenuPromo_: { type: Boolean, - value: function() { return loadTimeData.getBoolean('showMenuPromo'); }, + value: function() { + return loadTimeData.getBoolean('showMenuPromo'); + }, }, // True if the window is narrow enough for the page to have a drawer. @@ -164,7 +170,9 @@ }, /** @private */ - onCrToolbarMenuPromoClose_: function() { this.showMenuPromo_ = false; }, + onCrToolbarMenuPromoClose_: function() { + this.showMenuPromo_ = false; + }, /** @private */ onCrToolbarMenuPromoShown_: function() { @@ -211,7 +219,9 @@ toolbar.count = 0; }, - deleteSelected: function() { this.$.history.deleteSelectedWithPrompt(); }, + deleteSelected: function() { + this.$.history.deleteSelectedWithPrompt(); + }, /** * @param {HistoryQuery} info An object containing information about the @@ -230,7 +240,9 @@ /** * Shows and focuses the search bar in the toolbar. */ - focusToolbarSearchField: function() { this.$.toolbar.showSearchField(); }, + focusToolbarSearchField: function() { + this.$.toolbar.showSearchField(); + }, /** * @param {Event} e @@ -276,7 +288,9 @@ /** * Called when browsing data is cleared. */ - historyDeleted: function() { this.$.history.historyDeleted(); }, + historyDeleted: function() { + this.$.history.historyDeleted(); + }, /** * Update sign in state of synced device manager after user logs in or out. @@ -353,7 +367,9 @@ * @return {string} * @private */ - getSelectedPage_: function(selectedPage, items) { return selectedPage; }, + getSelectedPage_: function(selectedPage, items) { + return selectedPage; + }, /** @private */ closeDrawer_: function() {
diff --git a/chrome/browser/resources/md_history/browser_service.js b/chrome/browser/resources/md_history/browser_service.js index 8f8f0c3..a2a09ad4 100644 --- a/chrome/browser/resources/md_history/browser_service.js +++ b/chrome/browser/resources/md_history/browser_service.js
@@ -24,7 +24,9 @@ deleteItems: function(items) { if (this.pendingDeleteItems_ != null) { // There's already a deletion in progress, reject immediately. - return new Promise(function(resolve, reject) { reject(items); }); + return new Promise(function(resolve, reject) { + reject(items); + }); } var removalList = items.map(function(item) { @@ -45,7 +47,9 @@ /** * @param {!string} url */ - removeBookmark: function(url) { chrome.send('removeBookmark', [url]); }, + removeBookmark: function(url) { + chrome.send('removeBookmark', [url]); + }, /** * @param {string} sessionTag @@ -74,7 +78,9 @@ chrome.send('deleteForeignSession', [sessionTag]); }, - openClearBrowsingData: function() { chrome.send('clearBrowsingData'); }, + openClearBrowsingData: function() { + chrome.send('clearBrowsingData'); + }, /** * @param {string} histogram @@ -114,7 +120,9 @@ this.pendingDeletePromise_ = null; }, - menuPromoShown: function() { chrome.send('menuPromoShown'); }, + menuPromoShown: function() { + chrome.send('menuPromoShown'); + }, }; cr.addSingletonGetter(BrowserService);
diff --git a/chrome/browser/resources/md_history/grouped_list.js b/chrome/browser/resources/md_history/grouped_list.js index f772e52..a867d17 100644 --- a/chrome/browser/resources/md_history/grouped_list.js +++ b/chrome/browser/resources/md_history/grouped_list.js
@@ -139,7 +139,9 @@ e.model.set('domain.rendered', true); // Give the history-items time to render. - setTimeout(function() { collapse.toggle() }, 0); + setTimeout(function() { + collapse.toggle() + }, 0); }, /**
diff --git a/chrome/browser/resources/md_history/history_item.js b/chrome/browser/resources/md_history/history_item.js index dbd8b19..4dd5d354 100644 --- a/chrome/browser/resources/md_history/history_item.js +++ b/chrome/browser/resources/md_history/history_item.js
@@ -233,7 +233,9 @@ * @return {string} * @private */ - getAriaChecked_: function(selected) { return selected ? 'true' : 'false'; }, + getAriaChecked_: function(selected) { + return selected ? 'true' : 'false'; + }, /** * Remove bookmark of current item when bookmark-star is clicked.
diff --git a/chrome/browser/resources/md_history/history_list.js b/chrome/browser/resources/md_history/history_list.js index 4cfb8ca..fad3d1b 100644 --- a/chrome/browser/resources/md_history/history_list.js +++ b/chrome/browser/resources/md_history/history_list.js
@@ -155,5 +155,7 @@ * @return {string} * @private */ - pathForItem_: function(index) { return 'historyData_.' + index; }, + pathForItem_: function(index) { + return 'historyData_.' + index; + }, });
diff --git a/chrome/browser/resources/md_history/history_list_behavior.js b/chrome/browser/resources/md_history/history_list_behavior.js index 7373f1f..3f871c40 100644 --- a/chrome/browser/resources/md_history/history_list_behavior.js +++ b/chrome/browser/resources/md_history/history_list_behavior.js
@@ -35,7 +35,9 @@ */ selectedPaths: { type: Object, - value: /** @return {!Set<string>} */ function() { return new Set(); }, + value: /** @return {!Set<string>} */ function() { + return new Set(); + }, }, lastSelectedPath: String, @@ -59,7 +61,9 @@ * @return {boolean} * @private */ - hasResults: function(historyDataLength) { return historyDataLength > 0; }, + hasResults: function(historyDataLength) { + return historyDataLength > 0; + }, /** * @param {string} searchedTerm @@ -170,7 +174,9 @@ var array = this.get(node.currentPath); var splices = []; - node.indexes.sort(function(a, b) { return b - a; }); + node.indexes.sort(function(a, b) { + return b - a; + }); node.indexes.forEach(function(index) { if (node.leaf || this.removeItemsBeneathNode_(node.children[index])) { var item = array.splice(index, 1)[0];
diff --git a/chrome/browser/resources/md_history/history_toolbar.js b/chrome/browser/resources/md_history/history_toolbar.js index f940ad30..b7d8042e 100644 --- a/chrome/browser/resources/md_history/history_toolbar.js +++ b/chrome/browser/resources/md_history/history_toolbar.js
@@ -83,14 +83,18 @@ .getSearchField(); }, - showSearchField: function() { this.searchField.showAndFocus(); }, + showSearchField: function() { + this.searchField.showAndFocus(); + }, /** * Changes the toolbar background color depending on whether any history items * are currently selected. * @private */ - changeToolbarView_: function() { this.itemsSelected_ = this.count > 0; }, + changeToolbarView_: function() { + this.itemsSelected_ = this.count > 0; + }, /** * When changing the search term externally, update the search field to @@ -123,10 +127,14 @@ }, /** @private */ - onClearSelectionTap_: function() { this.fire('unselect-all'); }, + onClearSelectionTap_: function() { + this.fire('unselect-all'); + }, /** @private */ - onDeleteTap_: function() { this.fire('delete-selected'); }, + onDeleteTap_: function() { + this.fire('delete-selected'); + }, /** * If the user is a supervised user the delete button is not shown. @@ -170,5 +178,7 @@ * @private * @return {boolean} */ - isToday_: function() { return this.groupedOffset == 0; }, + isToday_: function() { + return this.groupedOffset == 0; + }, });
diff --git a/chrome/browser/resources/md_history/list_container.js b/chrome/browser/resources/md_history/list_container.js index d808ab58..a166742 100644 --- a/chrome/browser/resources/md_history/list_container.js +++ b/chrome/browser/resources/md_history/list_container.js
@@ -114,7 +114,9 @@ }, /** @return {Element} */ - getContentScrollTarget: function() { return this.getSelectedList_(); }, + getContentScrollTarget: function() { + return this.getSelectedList_(); + }, /** @return {number} */ getSelectedItemCount: function() { @@ -178,10 +180,14 @@ }, /** @private */ - groupedOffsetChanged_: function() { this.queryHistory(false); }, + groupedOffsetChanged_: function() { + this.queryHistory(false); + }, /** @private */ - loadMoreHistory_: function() { this.queryHistory(true); }, + loadMoreHistory_: function() { + this.queryHistory(true); + }, /** * @param {HistoryQuery} info @@ -299,7 +305,9 @@ * @return {Element} * @private */ - getSelectedList_: function() { return this.$$('#' + this.selectedPage_); }, + getSelectedList_: function() { + return this.$$('#' + this.selectedPage_); + }, /** @private */ canDeleteHistory_: function() {
diff --git a/chrome/browser/resources/md_history/side_bar.js b/chrome/browser/resources/md_history/side_bar.js index 9f44922..d442b02 100644 --- a/chrome/browser/resources/md_history/side_bar.js +++ b/chrome/browser/resources/md_history/side_bar.js
@@ -30,12 +30,16 @@ * @param {CustomEvent} e * @private */ - onSpacePressed_: function(e) { e.detail.keyboardEvent.path[0].click(); }, + onSpacePressed_: function(e) { + e.detail.keyboardEvent.path[0].click(); + }, /** * @private */ - onSelectorActivate_: function() { this.fire('history-close-drawer'); }, + onSelectorActivate_: function() { + this.fire('history-close-drawer'); + }, /** * Relocates the user to the clear browsing data section of the settings page. @@ -55,5 +59,7 @@ * accessibility purposes, taps are handled separately by <iron-selector>. * @private */ - onItemClick_: function(e) { e.preventDefault(); }, + onItemClick_: function(e) { + e.preventDefault(); + }, });
diff --git a/chrome/browser/resources/md_history/synced_device_card.js b/chrome/browser/resources/md_history/synced_device_card.js index 244cc82f7..7d37148 100644 --- a/chrome/browser/resources/md_history/synced_device_card.js +++ b/chrome/browser/resources/md_history/synced_device_card.js
@@ -12,7 +12,9 @@ */ tabs: { type: Array, - value: function() { return []; }, + value: function() { + return []; + }, observer: 'updateIcons_' },
diff --git a/chrome/browser/resources/md_history/synced_device_manager.js b/chrome/browser/resources/md_history/synced_device_manager.js index e23f571..e943d48 100644 --- a/chrome/browser/resources/md_history/synced_device_manager.js +++ b/chrome/browser/resources/md_history/synced_device_manager.js
@@ -36,7 +36,9 @@ */ syncedDevices_: { type: Array, - value: function() { return []; }, + value: function() { + return []; + }, }, /** @private */ @@ -87,10 +89,14 @@ }, /** @override */ - detached: function() { this.focusGrid_.destroy(); }, + detached: function() { + this.focusGrid_.destroy(); + }, /** @return {HTMLElement} */ - getContentScrollTarget: function() { return this; }, + getContentScrollTarget: function() { + return this; + }, /** * @param {!ForeignSession} session @@ -106,7 +112,9 @@ if (newTabs.length == 0) continue; - newTabs.forEach(function(tab) { tab.windowId = windowId; }); + newTabs.forEach(function(tab) { + tab.windowId = windowId; + }); var windowAdded = false; if (!this.searchTerm) { @@ -138,7 +146,9 @@ }, /** @private */ - onSignInTap_: function() { chrome.send('startSignInFlow'); }, + onSignInTap_: function() { + chrome.send('startSignInFlow'); + }, /** @private */ onOpenMenu_: function(e) { @@ -177,7 +187,9 @@ return prev.concat(cur.createFocusRows()); }, []) - .forEach(function(row) { this.focusGrid_.addRow(row); }.bind(this)); + .forEach(function(row) { + this.focusGrid_.addRow(row); + }.bind(this)); this.focusGrid_.ensureRowActive(); }); }, @@ -195,7 +207,9 @@ }, /** @private */ - clearDisplayedSyncedDevices_: function() { this.syncedDevices_ = []; }, + clearDisplayedSyncedDevices_: function() { + this.syncedDevices_ = []; + }, /** * Decide whether or not should display no synced tabs message.
diff --git a/third_party/WebKit/Source/bindings/bindings.gni b/third_party/WebKit/Source/bindings/bindings.gni index 575564d3..b9f7253 100644 --- a/third_party/WebKit/Source/bindings/bindings.gni +++ b/third_party/WebKit/Source/bindings/bindings.gni
@@ -30,8 +30,6 @@ "core/v8/custom/V8PromiseRejectionEventCustom.cpp", "core/v8/custom/V8WindowCustom.cpp", "core/v8/custom/V8XMLHttpRequestCustom.cpp", - "core/v8/ActiveDOMCallback.cpp", - "core/v8/ActiveDOMCallback.h", "core/v8/ActiveScriptWrappable.cpp", "core/v8/ActiveScriptWrappable.h", "core/v8/ArrayValue.cpp",
diff --git a/third_party/WebKit/Source/bindings/core/v8/ActiveDOMCallback.cpp b/third_party/WebKit/Source/bindings/core/v8/ActiveDOMCallback.cpp deleted file mode 100644 index 977b220..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/ActiveDOMCallback.cpp +++ /dev/null
@@ -1,52 +0,0 @@ -/* - * Copyright (C) 2010. 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "bindings/core/v8/ActiveDOMCallback.h" - -#include "core/dom/ExecutionContext.h" -#include "core/dom/SuspendableObject.h" -#include "core/workers/WorkerGlobalScope.h" - -namespace blink { - -ActiveDOMCallback::ActiveDOMCallback(ExecutionContext* context) - : m_context(context) {} - -ActiveDOMCallback::~ActiveDOMCallback() {} - -bool ActiveDOMCallback::canInvokeCallback() const { - return !m_context->isContextSuspended() && !m_context->isContextDestroyed(); -} - -DEFINE_TRACE(ActiveDOMCallback) { - visitor->trace(m_context); -} - -} // namespace blink
diff --git a/third_party/WebKit/Source/bindings/core/v8/ActiveDOMCallback.h b/third_party/WebKit/Source/bindings/core/v8/ActiveDOMCallback.h deleted file mode 100644 index fac53d6..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/ActiveDOMCallback.h +++ /dev/null
@@ -1,63 +0,0 @@ -/* - * Copyright (C) 2010, 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef ActiveDOMCallback_h -#define ActiveDOMCallback_h - -#include "core/CoreExport.h" -#include "platform/heap/Handle.h" - -namespace blink { - -class ExecutionContext; - -// A base class that prevents binding callbacks from executing when -// ContextLifecycleObservers are stopped or suspended, and is used by the -// generated callback v8 bindings code to avoid erroneously CRASH()'ing -// after script execution on a worker has been scheduled to terminate. -// -// Should only be created, used, and destroyed on the script execution -// context thread. -class CORE_EXPORT ActiveDOMCallback : public GarbageCollectedMixin { - public: - explicit ActiveDOMCallback(ExecutionContext*); - virtual ~ActiveDOMCallback(); - - bool canInvokeCallback() const; - - DECLARE_TRACE(); - - private: - Member<ExecutionContext> m_context; -}; - -} // namespace blink - -#endif // ActiveDOMCallback_h
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8IntersectionObserverCallback.cpp b/third_party/WebKit/Source/bindings/core/v8/V8IntersectionObserverCallback.cpp index 43f8a72..5f21bb5 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8IntersectionObserverCallback.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8IntersectionObserverCallback.cpp
@@ -17,9 +17,7 @@ v8::Local<v8::Function> callback, v8::Local<v8::Object> owner, ScriptState* scriptState) - : ActiveDOMCallback(scriptState->getExecutionContext()), - m_callback(scriptState->isolate(), callback), - m_scriptState(scriptState) { + : m_callback(scriptState->isolate(), callback), m_scriptState(scriptState) { V8PrivateProperty::getIntersectionObserverCallback(scriptState->isolate()) .set(scriptState->context(), owner, callback); m_callback.setPhantom(); @@ -30,9 +28,10 @@ void V8IntersectionObserverCallback::handleEvent( const HeapVector<Member<IntersectionObserverEntry>>& entries, IntersectionObserver& observer) { - if (!canInvokeCallback()) + ExecutionContext* executionContext = m_scriptState->getExecutionContext(); + if (!executionContext || executionContext->isContextSuspended() || + executionContext->isContextDestroyed()) return; - if (!m_scriptState->contextIsValid()) return; ScriptState::Scope scope(m_scriptState.get()); @@ -62,7 +61,6 @@ DEFINE_TRACE(V8IntersectionObserverCallback) { IntersectionObserverCallback::trace(visitor); - ActiveDOMCallback::trace(visitor); } } // namespace blink
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8IntersectionObserverCallback.h b/third_party/WebKit/Source/bindings/core/v8/V8IntersectionObserverCallback.h index 4641bb36..04bab17 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8IntersectionObserverCallback.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8IntersectionObserverCallback.h
@@ -5,7 +5,6 @@ #ifndef V8IntersectionObserverCallback_h #define V8IntersectionObserverCallback_h -#include "bindings/core/v8/ActiveDOMCallback.h" #include "bindings/core/v8/DOMWrapperWorld.h" #include "bindings/core/v8/ScopedPersistent.h" #include "core/CoreExport.h" @@ -14,10 +13,7 @@ namespace blink { class V8IntersectionObserverCallback final - : public IntersectionObserverCallback, - public ActiveDOMCallback { - USING_GARBAGE_COLLECTED_MIXIN(V8IntersectionObserverCallback); - + : public IntersectionObserverCallback { public: CORE_EXPORT V8IntersectionObserverCallback(v8::Local<v8::Function>, v8::Local<v8::Object>,
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8MutationCallback.cpp b/third_party/WebKit/Source/bindings/core/v8/V8MutationCallback.cpp index 2e37dfe5..a9b62b5 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8MutationCallback.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8MutationCallback.cpp
@@ -39,9 +39,7 @@ V8MutationCallback::V8MutationCallback(v8::Local<v8::Function> callback, v8::Local<v8::Object> owner, ScriptState* scriptState) - : ActiveDOMCallback(scriptState->getExecutionContext()), - m_callback(scriptState->isolate(), callback), - m_scriptState(scriptState) { + : m_callback(scriptState->isolate(), callback), m_scriptState(scriptState) { V8PrivateProperty::getMutationObserverCallback(scriptState->isolate()) .set(scriptState->context(), owner, callback); m_callback.setPhantom(); @@ -52,11 +50,11 @@ void V8MutationCallback::call( const HeapVector<Member<MutationRecord>>& mutations, MutationObserver* observer) { - if (!canInvokeCallback()) - return; - v8::Isolate* isolate = m_scriptState->isolate(); - + ExecutionContext* executionContext = m_scriptState->getExecutionContext(); + if (!executionContext || executionContext->isContextSuspended() || + executionContext->isContextDestroyed()) + return; if (!m_scriptState->contextIsValid()) return; ScriptState::Scope scope(m_scriptState.get()); @@ -85,7 +83,6 @@ DEFINE_TRACE(V8MutationCallback) { MutationCallback::trace(visitor); - ActiveDOMCallback::trace(visitor); } } // namespace blink
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8MutationCallback.h b/third_party/WebKit/Source/bindings/core/v8/V8MutationCallback.h index 5dc0f7a..4002f20 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8MutationCallback.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8MutationCallback.h
@@ -26,7 +26,6 @@ #ifndef V8MutationCallback_h #define V8MutationCallback_h -#include "bindings/core/v8/ActiveDOMCallback.h" #include "bindings/core/v8/ScopedPersistent.h" #include "bindings/core/v8/ScriptState.h" #include "core/dom/MutationCallback.h" @@ -37,10 +36,7 @@ class ExecutionContext; -class V8MutationCallback final : public MutationCallback, - public ActiveDOMCallback { - USING_GARBAGE_COLLECTED_MIXIN(V8MutationCallback); - +class V8MutationCallback final : public MutationCallback { public: static V8MutationCallback* create(v8::Local<v8::Function> callback, v8::Local<v8::Object> owner,
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ResizeObserverCallbackCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/V8ResizeObserverCallbackCustom.cpp index 88d364ba..c1642c5 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8ResizeObserverCallbackCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8ResizeObserverCallbackCustom.cpp
@@ -15,11 +15,11 @@ void V8ResizeObserverCallback::handleEvent( const HeapVector<Member<ResizeObserverEntry>>& entries, ResizeObserver* observer) { - if (!canInvokeCallback()) - return; - v8::Isolate* isolate = m_scriptState->isolate(); - + ExecutionContext* executionContext = m_scriptState->getExecutionContext(); + if (!executionContext || executionContext->isContextSuspended() || + executionContext->isContextDestroyed()) + return; if (!m_scriptState->contextIsValid()) return; ScriptState::Scope scope(m_scriptState.get());
diff --git a/third_party/WebKit/Source/bindings/modules/v8/custom/V8CustomSQLStatementErrorCallback.cpp b/third_party/WebKit/Source/bindings/modules/v8/custom/V8CustomSQLStatementErrorCallback.cpp index 4164179..3f46b17c 100644 --- a/third_party/WebKit/Source/bindings/modules/v8/custom/V8CustomSQLStatementErrorCallback.cpp +++ b/third_party/WebKit/Source/bindings/modules/v8/custom/V8CustomSQLStatementErrorCallback.cpp
@@ -40,13 +40,13 @@ bool V8SQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLError* error) { - if (!canInvokeCallback()) - return true; - v8::Isolate* isolate = m_scriptState->isolate(); + ExecutionContext* executionContext = m_scriptState->getExecutionContext(); + if (!executionContext || executionContext->isContextSuspended() || + executionContext->isContextDestroyed()) + return true; if (!m_scriptState->contextIsValid()) return true; - ScriptState::Scope scope(m_scriptState.get()); v8::Local<v8::Value> transactionHandle =
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_callback_interface.py b/third_party/WebKit/Source/bindings/scripts/v8_callback_interface.py index a9c70a6..6cf34d58 100644 --- a/third_party/WebKit/Source/bindings/scripts/v8_callback_interface.py +++ b/third_party/WebKit/Source/bindings/scripts/v8_callback_interface.py
@@ -39,7 +39,6 @@ import v8_utilities CALLBACK_INTERFACE_H_INCLUDES = frozenset([ - 'bindings/core/v8/ActiveDOMCallback.h', 'bindings/core/v8/DOMWrapperWorld.h', 'bindings/core/v8/ScopedPersistent.h', ])
diff --git a/third_party/WebKit/Source/bindings/templates/callback_interface.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/callback_interface.cpp.tmpl index f2c6416..a101dda 100644 --- a/third_party/WebKit/Source/bindings/templates/callback_interface.cpp.tmpl +++ b/third_party/WebKit/Source/bindings/templates/callback_interface.cpp.tmpl
@@ -10,8 +10,7 @@ namespace blink { {{v8_class}}::{{v8_class}}(v8::Local<v8::Function> callback, ScriptState* scriptState) - : ActiveDOMCallback(scriptState->getExecutionContext()) - , m_scriptState(scriptState) { + : m_scriptState(scriptState) { m_callback.set(scriptState->isolate(), callback); } @@ -19,19 +18,18 @@ DEFINE_TRACE({{v8_class}}) { {{cpp_class}}::trace(visitor); - ActiveDOMCallback::trace(visitor); } {% for method in methods if not method.is_custom %} {{method.cpp_type}} {{v8_class}}::{{method.name}}({{method.argument_declarations | join(', ')}}) { {% set return_default = 'return true' if method.idl_type == 'boolean' else 'return' %}{# void #} - if (!canInvokeCallback()) + ExecutionContext* executionContext = m_scriptState->getExecutionContext(); + if (!executionContext || executionContext->isContextSuspended() || + executionContext->isContextDestroyed()) {{return_default}}; - if (!m_scriptState->contextIsValid()) {{return_default}}; - ScriptState::Scope scope(m_scriptState.get()); {% if method.call_with_this_handle %} v8::Local<v8::Value> thisHandle = thisValue.v8Value();
diff --git a/third_party/WebKit/Source/bindings/templates/callback_interface.h.tmpl b/third_party/WebKit/Source/bindings/templates/callback_interface.h.tmpl index 728b7bf..54dbfc1 100644 --- a/third_party/WebKit/Source/bindings/templates/callback_interface.h.tmpl +++ b/third_party/WebKit/Source/bindings/templates/callback_interface.h.tmpl
@@ -10,8 +10,7 @@ namespace blink { -class {{v8_class}} final : public {{cpp_class}}, public ActiveDOMCallback { - USING_GARBAGE_COLLECTED_MIXIN({{v8_class}}); +class {{v8_class}} final : public {{cpp_class}} { public: static {{v8_class}}* create(v8::Local<v8::Function> callback, ScriptState* scriptState) { return new {{v8_class}}(callback, scriptState);
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackInterface.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackInterface.cpp index aed27ab..01ed1af99 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackInterface.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackInterface.cpp
@@ -22,8 +22,7 @@ namespace blink { V8TestCallbackInterface::V8TestCallbackInterface(v8::Local<v8::Function> callback, ScriptState* scriptState) - : ActiveDOMCallback(scriptState->getExecutionContext()) - , m_scriptState(scriptState) { + : m_scriptState(scriptState) { m_callback.set(scriptState->isolate(), callback); } @@ -31,16 +30,15 @@ DEFINE_TRACE(V8TestCallbackInterface) { TestCallbackInterface::trace(visitor); - ActiveDOMCallback::trace(visitor); } void V8TestCallbackInterface::voidMethod() { - if (!canInvokeCallback()) + ExecutionContext* executionContext = m_scriptState->getExecutionContext(); + if (!executionContext || executionContext->isContextSuspended() || + executionContext->isContextDestroyed()) return; - if (!m_scriptState->contextIsValid()) return; - ScriptState::Scope scope(m_scriptState.get()); v8::Local<v8::Value> *argv = 0; @@ -48,12 +46,12 @@ } bool V8TestCallbackInterface::booleanMethod() { - if (!canInvokeCallback()) + ExecutionContext* executionContext = m_scriptState->getExecutionContext(); + if (!executionContext || executionContext->isContextSuspended() || + executionContext->isContextDestroyed()) return true; - if (!m_scriptState->contextIsValid()) return true; - ScriptState::Scope scope(m_scriptState.get()); v8::Local<v8::Value> *argv = 0; @@ -64,12 +62,12 @@ } void V8TestCallbackInterface::voidMethodBooleanArg(bool boolArg) { - if (!canInvokeCallback()) + ExecutionContext* executionContext = m_scriptState->getExecutionContext(); + if (!executionContext || executionContext->isContextSuspended() || + executionContext->isContextDestroyed()) return; - if (!m_scriptState->contextIsValid()) return; - ScriptState::Scope scope(m_scriptState.get()); v8::Local<v8::Value> boolArgHandle = v8Boolean(boolArg, m_scriptState->isolate()); v8::Local<v8::Value> argv[] = { boolArgHandle }; @@ -78,12 +76,12 @@ } void V8TestCallbackInterface::voidMethodSequenceArg(const HeapVector<Member<TestInterfaceEmpty>>& sequenceArg) { - if (!canInvokeCallback()) + ExecutionContext* executionContext = m_scriptState->getExecutionContext(); + if (!executionContext || executionContext->isContextSuspended() || + executionContext->isContextDestroyed()) return; - if (!m_scriptState->contextIsValid()) return; - ScriptState::Scope scope(m_scriptState.get()); v8::Local<v8::Value> sequenceArgHandle = toV8(sequenceArg, m_scriptState->context()->Global(), m_scriptState->isolate()); v8::Local<v8::Value> argv[] = { sequenceArgHandle }; @@ -92,12 +90,12 @@ } void V8TestCallbackInterface::voidMethodFloatArg(float floatArg) { - if (!canInvokeCallback()) + ExecutionContext* executionContext = m_scriptState->getExecutionContext(); + if (!executionContext || executionContext->isContextSuspended() || + executionContext->isContextDestroyed()) return; - if (!m_scriptState->contextIsValid()) return; - ScriptState::Scope scope(m_scriptState.get()); v8::Local<v8::Value> floatArgHandle = v8::Number::New(m_scriptState->isolate(), floatArg); v8::Local<v8::Value> argv[] = { floatArgHandle }; @@ -106,12 +104,12 @@ } void V8TestCallbackInterface::voidMethodTestInterfaceEmptyArg(TestInterfaceEmpty* testInterfaceEmptyArg) { - if (!canInvokeCallback()) + ExecutionContext* executionContext = m_scriptState->getExecutionContext(); + if (!executionContext || executionContext->isContextSuspended() || + executionContext->isContextDestroyed()) return; - if (!m_scriptState->contextIsValid()) return; - ScriptState::Scope scope(m_scriptState.get()); v8::Local<v8::Value> testInterfaceEmptyArgHandle = toV8(testInterfaceEmptyArg, m_scriptState->context()->Global(), m_scriptState->isolate()); v8::Local<v8::Value> argv[] = { testInterfaceEmptyArgHandle }; @@ -120,12 +118,12 @@ } void V8TestCallbackInterface::voidMethodTestInterfaceEmptyStringArg(TestInterfaceEmpty* testInterfaceEmptyArg, const String& stringArg) { - if (!canInvokeCallback()) + ExecutionContext* executionContext = m_scriptState->getExecutionContext(); + if (!executionContext || executionContext->isContextSuspended() || + executionContext->isContextDestroyed()) return; - if (!m_scriptState->contextIsValid()) return; - ScriptState::Scope scope(m_scriptState.get()); v8::Local<v8::Value> testInterfaceEmptyArgHandle = toV8(testInterfaceEmptyArg, m_scriptState->context()->Global(), m_scriptState->isolate()); v8::Local<v8::Value> stringArgHandle = v8String(m_scriptState->isolate(), stringArg); @@ -135,12 +133,12 @@ } void V8TestCallbackInterface::callbackWithThisValueVoidMethodStringArg(ScriptValue thisValue, const String& stringArg) { - if (!canInvokeCallback()) + ExecutionContext* executionContext = m_scriptState->getExecutionContext(); + if (!executionContext || executionContext->isContextSuspended() || + executionContext->isContextDestroyed()) return; - if (!m_scriptState->contextIsValid()) return; - ScriptState::Scope scope(m_scriptState.get()); v8::Local<v8::Value> thisHandle = thisValue.v8Value(); v8::Local<v8::Value> stringArgHandle = v8String(m_scriptState->isolate(), stringArg);
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackInterface.h b/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackInterface.h index 182f129..af5a4326 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackInterface.h +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackInterface.h
@@ -12,7 +12,6 @@ #ifndef V8TestCallbackInterface_h #define V8TestCallbackInterface_h -#include "bindings/core/v8/ActiveDOMCallback.h" #include "bindings/core/v8/DOMWrapperWorld.h" #include "bindings/core/v8/ScopedPersistent.h" #include "bindings/tests/idls/core/TestCallbackInterface.h" @@ -20,8 +19,7 @@ namespace blink { -class V8TestCallbackInterface final : public TestCallbackInterface, public ActiveDOMCallback { - USING_GARBAGE_COLLECTED_MIXIN(V8TestCallbackInterface); +class V8TestCallbackInterface final : public TestCallbackInterface { public: static V8TestCallbackInterface* create(v8::Local<v8::Function> callback, ScriptState* scriptState) { return new V8TestCallbackInterface(callback, scriptState);
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py index 374259c..dc79044 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py
@@ -112,6 +112,24 @@ if self._rebase_in_progress(): self._run_git(['rebase', '--abort']) + def unstaged_changes(self): + """Lists files with unstaged changes, including untracked files. + + Returns a dict mapping modified file paths (relative to checkout root) + to one-character codes identifying the change, e.g. 'M' for modified, + 'D' for deleted, '?' for untracked. + """ + # `git status -z` is a version of `git status -s`, that's recommended + # for machine parsing. Lines are terminated with NUL rather than LF. + unstaged_changes = {} + change_lines = self._run_git(['status', '-z']).rstrip('\x00').split('\x00') + for line in change_lines: + if line[1] == ' ': + continue # Already staged for commit. + path = line[3:] + unstaged_changes[path] = line[1] + return unstaged_changes + def status_command(self): # git status returns non-zero when there are changes, so we use git diff name --name-status HEAD instead. # No file contents printed, thus utf-8 autodecoding in self.run is fine.
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm.py index 888ca82..b5bb031 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm.py
@@ -121,6 +121,9 @@ def exists(self, path): self._subclass_must_implement() + def unstaged_changes(self): + self._subclass_must_implement() + def changed_files(self, git_commit=None): self._subclass_must_implement()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py index 2bc3946b..a6300b7f 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py
@@ -130,3 +130,6 @@ def changed_files(self): return [] + + def unstaged_changes(self): + return {}
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py index 620a8d2..000aa153 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py
@@ -252,3 +252,23 @@ scm._run_git = lambda args: 'Date: 2013-02-08 01:55:21 -0800' self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013-02-08T09:55:21Z') + + def test_unstaged_files(self): + scm = self.make_scm() + status_lines = [ + ' M d/modified.txt', + ' D d/deleted.txt', + '?? d/untracked.txt', + 'D d/deleted.txt', + 'M d/modified-staged.txt', + 'A d/added-staged.txt', + ] + # pylint: disable=protected-access + scm._run_git = lambda args: '\x00'.join(status_lines) + '\x00' + self.assertEqual( + scm.unstaged_changes(), + { + 'd/modified.txt': 'M', + 'd/deleted.txt': 'D', + 'd/untracked.txt': '?', + })
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py index 6acc722..a74fa650 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
@@ -30,6 +30,7 @@ import json import logging import optparse +import re import sys import traceback @@ -523,7 +524,13 @@ self._remove_all_pass_testharness_baselines(test_prefix_list) - self._tool.scm().add_all(pathspec=self._layout_tests_dir()) + self._tool.scm().add_list(self.unstaged_baselines()) + + def unstaged_baselines(self): + """Returns absolute paths for unstaged (including untracked) baselines.""" + baseline_re = re.compile(r'.*[\\/]LayoutTests[\\/].*-expected\.(txt|png|wav)$') + unstaged_changes = self._tool.scm().unstaged_changes() + return sorted(self._tool.scm().absolute_path(path) for path in unstaged_changes if re.match(baseline_re, path)) def _remove_all_pass_testharness_baselines(self, test_prefix_list): """Removes all of the all-PASS baselines for the given builders and tests.
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl.py index 601aa1a..e4da1f0 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl.py
@@ -52,10 +52,20 @@ def execute(self, options, args, tool): self._tool = tool + + unstaged_baselines = self.unstaged_baselines() + if unstaged_baselines: + _log.error('Aborting: there are unstaged baselines:') + for path in unstaged_baselines: + _log.error(' %s', path) + return + issue_number = self._get_issue_number(options) if not issue_number: return + # TODO(qyearsley): Replace this with git cl try-results to remove + # dependency on Rietveld. See crbug.com/671684. builds = self.rietveld.latest_try_jobs(issue_number, self._try_bots()) if options.trigger_jobs:
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py index a748e370..d8b5250 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py
@@ -299,3 +299,12 @@ 'Try starting a new job for MOCK Try Win by running :\n' ' git cl try -b MOCK Try Win\n' ]) + + def test_bails_when_there_are_unstaged_baselines(self): + scm = self.tool.scm() + scm.unstaged_changes = lambda: {'third_party/WebKit/LayoutTests/my-test-expected.txt': '?'} + self.command.execute(self.command_options(issue=11112222), [], self.tool) + self.assertLog([ + 'ERROR: Aborting: there are unstaged baselines:\n', + 'ERROR: /mock-checkout/third_party/WebKit/LayoutTests/my-test-expected.txt\n', + ])
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py index 496ab1d..882cd5a 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
@@ -484,6 +484,22 @@ '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.html', '--verbose', '--results-directory', '/tmp']] ]) + def test_unstaged_baselines(self): + scm = self.tool.scm() + scm.unstaged_changes = lambda: { + 'third_party/WebKit/LayoutTests/x/foo-expected.txt': 'M', + 'third_party/WebKit/LayoutTests/x/foo-expected.something': '?', + 'third_party/WebKit/LayoutTests/x/foo-expected.png': '?', + 'third_party/WebKit/LayoutTests/x/foo.html': 'M', + 'docs/something.md': '?', + } + self.assertEqual( + self.command.unstaged_baselines(), + [ + '/mock-checkout/third_party/WebKit/LayoutTests/x/foo-expected.png', + '/mock-checkout/third_party/WebKit/LayoutTests/x/foo-expected.txt', + ]) + class TestRebaselineJsonUpdatesExpectationsFiles(BaseTestCase): command_constructor = RebaselineJson