Commit 1c727793 authored by yurys@chromium.org's avatar yurys@chromium.org

Fix assertion failure in ScriptRegexp::match

BUG=517980

Review URL: https://codereview.chromium.org/1315413005

git-svn-id: svn://svn.chromium.org/blink/trunk@201350 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c7fc2f72
......@@ -41,8 +41,6 @@
#include "core/xmlhttprequest/XMLHttpRequest.h"
#include "core/xmlhttprequest/XMLHttpRequestUpload.h"
#include "platform/ScriptForbiddenScope.h"
#include "wtf/MainThread.h"
#include "wtf/Optional.h"
#include "wtf/text/StringBuilder.h"
#include "wtf/text/StringHash.h"
......@@ -242,9 +240,7 @@ void AsyncCallTracker::didEnqueueEvent(EventTarget* eventTarget, Event* event)
{
ASSERT(eventTarget->executionContext());
ASSERT(m_debuggerAgent->trackingAsyncCalls());
Optional<ScriptForbiddenScope::AllowUserAgentScript> allowScripting;
if (isMainThread())
allowScripting.emplace();
ScriptForbiddenScope::AllowUserAgentScript allowScripting;
int operationId = m_debuggerAgent->traceAsyncOperationStarting(event->type());
ExecutionContextData* data = createContextDataIfNeeded(eventTarget->executionContext());
data->m_eventCallChains.set(event, operationId);
......@@ -310,9 +306,7 @@ void AsyncCallTracker::didEnqueueMutationRecord(ExecutionContext* context, Mutat
ExecutionContextData* data = createContextDataIfNeeded(context);
if (data->m_mutationObserverCallChains.contains(observer))
return;
Optional<ScriptForbiddenScope::AllowUserAgentScript> allowScripting;
if (isMainThread())
allowScripting.emplace();
ScriptForbiddenScope::AllowUserAgentScript allowScripting;
int operationId = m_debuggerAgent->traceAsyncOperationStarting(enqueueMutationRecordName);
data->m_mutationObserverCallChains.set(observer, operationId);
}
......
......@@ -34,8 +34,6 @@
#include "core/inspector/ScriptAsyncCallStack.h"
#include "core/inspector/v8/V8Debugger.h"
#include "platform/ScriptForbiddenScope.h"
#include "wtf/MainThread.h"
#include "wtf/Optional.h"
namespace blink {
......@@ -262,9 +260,7 @@ bool InspectorDebuggerAgent::isPaused()
PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> InspectorDebuggerAgent::currentAsyncStackTraceForConsole()
{
Optional<ScriptForbiddenScope::AllowUserAgentScript> allowScripting;
if (isMainThread())
allowScripting.emplace();
ScriptForbiddenScope::AllowUserAgentScript allowScripting;
return m_v8DebuggerAgent->currentAsyncStackTraceForConsole();
}
......
......@@ -44,14 +44,14 @@ bool ScriptForbiddenScope::isScriptForbidden()
}
ScriptForbiddenScope::AllowUserAgentScript::AllowUserAgentScript()
: m_change(s_scriptForbiddenCount, 0)
{
ASSERT(isMainThread());
if (isMainThread())
m_change.emplace(s_scriptForbiddenCount, 0);
}
ScriptForbiddenScope::AllowUserAgentScript::~AllowUserAgentScript()
{
ASSERT(!s_scriptForbiddenCount);
ASSERT(!isMainThread() || !s_scriptForbiddenCount);
}
} // namespace blink
......@@ -7,6 +7,7 @@
#include "platform/PlatformExport.h"
#include "wtf/Assertions.h"
#include "wtf/Optional.h"
#include "wtf/TemporaryChange.h"
namespace blink {
......@@ -21,7 +22,7 @@ public:
AllowUserAgentScript();
~AllowUserAgentScript();
private:
TemporaryChange<unsigned> m_change;
Optional<TemporaryChange<unsigned>> m_change;
};
static void enter();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment