Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Unified Diff: Source/bindings/core/v8/RejectedPromises.cpp

Issue 1090583005: Revert of DevTools: [console] Logged promise rejections do not change state once handled (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Encompass Oilpan fix Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/core/v8/RejectedPromises.h ('k') | Source/bindings/core/v8/V8Initializer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/RejectedPromises.cpp
diff --git a/Source/bindings/core/v8/RejectedPromises.cpp b/Source/bindings/core/v8/RejectedPromises.cpp
index 872d2b23b69fcabf5ea92f2787ef419d494536b6..97e5a1b1569b3a13becff0088dc014207bde6f53 100644
--- a/Source/bindings/core/v8/RejectedPromises.cpp
+++ b/Source/bindings/core/v8/RejectedPromises.cpp
@@ -14,8 +14,6 @@
namespace blink {
-static const unsigned maxReportedHandlersPendingResolution = 1000;
-
class RejectedPromises::Message final : public NoBaseWillBeGarbageCollectedFinalized<RejectedPromises::Message> {
public:
static PassOwnPtrWillBeRawPtr<Message> create(const ScriptValue& promise, const ScriptValue& exception, const String& errorMessage, const String& resourceName, int scriptId, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack)
@@ -38,7 +36,6 @@ private:
, m_lineNumber(lineNumber)
, m_columnNumber(columnNumber)
, m_callStack(callStack)
- , m_consoleMessageId(0)
{
}
@@ -52,7 +49,6 @@ private:
const int m_lineNumber;
const int m_columnNumber;
const RefPtrWillBeMember<ScriptCallStack> m_callStack;
- unsigned m_consoleMessageId;
};
RejectedPromises::RejectedPromises()
@@ -64,10 +60,9 @@ DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(RejectedPromises);
DEFINE_TRACE(RejectedPromises)
{
visitor->trace(m_queue);
- visitor->trace(m_reportedAsErrors);
}
-void RejectedPromises::rejectedWithNoHandler(ScriptState* scriptState, v8::PromiseRejectMessage data, const String& errorMessage, const String& resourceName, int scriptId, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack)
+void RejectedPromises::add(ScriptState* scriptState, v8::PromiseRejectMessage data, const String& errorMessage, const String& resourceName, int scriptId, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack)
{
v8::Handle<v8::Promise> promise = data.GetPromise();
OwnPtrWillBeRawPtr<Message> message = Message::create(ScriptValue(scriptState, promise), ScriptValue(scriptState, data.GetValue()), errorMessage, resourceName, scriptId, lineNumber, columnNumber, callStack);
@@ -75,46 +70,6 @@ void RejectedPromises::rejectedWithNoHandler(ScriptState* scriptState, v8::Promi
m_queue.append(message.release());
}
-void RejectedPromises::handlerAdded(v8::PromiseRejectMessage data)
-{
- // First look it up in the pending messages and fast return, it'll be covered by processQueue().
- for (auto it = m_queue.begin(); it != m_queue.end(); ++it) {
- ScriptState* scriptState = (*it)->m_promise.scriptState();
- if (!scriptState->contextIsValid())
- continue;
-
- ScriptState::Scope scope(scriptState);
- v8::Handle<v8::Value> promise = (*it)->m_promise.v8Value();
- if (promise == data.GetPromise())
- return;
- }
-
- // Then look it up in the reported errors.
- for (auto it = m_reportedAsErrors.begin(); it != m_reportedAsErrors.end(); ++it) {
- ScriptState* scriptState = (*it)->m_promise.scriptState();
- if (!scriptState->contextIsValid())
- continue;
-
- ScriptState::Scope scope(scriptState);
- v8::Handle<v8::Value> promise = (*it)->m_promise.v8Value();
- if (promise != data.GetPromise())
- continue;
-
- // If execution termination has been triggered, quietly bail out.
- if (v8::V8::IsExecutionTerminating(scriptState->isolate()))
- continue;
- ExecutionContext* executionContext = scriptState->executionContext();
- if (!executionContext)
- continue;
-
- RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMessageSource, RevokedErrorMessageLevel, "Handler added to rejected promise");
- consoleMessage->setRelatedMessageId((*it)->m_consoleMessageId);
- executionContext->addConsoleMessage(consoleMessage.release());
- m_reportedAsErrors.remove(it);
- break;
- }
-}
-
void RejectedPromises::dispose()
{
processQueue();
@@ -160,12 +115,7 @@ void RejectedPromises::processQueue()
consoleMessage->setScriptArguments(arguments);
consoleMessage->setCallStack(message->m_callStack);
consoleMessage->setScriptId(message->m_scriptId);
- message->m_consoleMessageId = consoleMessage->assignMessageId();
executionContext->addConsoleMessage(consoleMessage.release());
-
- m_reportedAsErrors.append(message.release());
- if (m_reportedAsErrors.size() > maxReportedHandlersPendingResolution)
- m_reportedAsErrors.removeFirst();
}
}
« no previous file with comments | « Source/bindings/core/v8/RejectedPromises.h ('k') | Source/bindings/core/v8/V8Initializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698