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 @@ ...@@ -41,8 +41,6 @@
#include "core/xmlhttprequest/XMLHttpRequest.h" #include "core/xmlhttprequest/XMLHttpRequest.h"
#include "core/xmlhttprequest/XMLHttpRequestUpload.h" #include "core/xmlhttprequest/XMLHttpRequestUpload.h"
#include "platform/ScriptForbiddenScope.h" #include "platform/ScriptForbiddenScope.h"
#include "wtf/MainThread.h"
#include "wtf/Optional.h"
#include "wtf/text/StringBuilder.h" #include "wtf/text/StringBuilder.h"
#include "wtf/text/StringHash.h" #include "wtf/text/StringHash.h"
...@@ -242,9 +240,7 @@ void AsyncCallTracker::didEnqueueEvent(EventTarget* eventTarget, Event* event) ...@@ -242,9 +240,7 @@ void AsyncCallTracker::didEnqueueEvent(EventTarget* eventTarget, Event* event)
{ {
ASSERT(eventTarget->executionContext()); ASSERT(eventTarget->executionContext());
ASSERT(m_debuggerAgent->trackingAsyncCalls()); ASSERT(m_debuggerAgent->trackingAsyncCalls());
Optional<ScriptForbiddenScope::AllowUserAgentScript> allowScripting; ScriptForbiddenScope::AllowUserAgentScript allowScripting;
if (isMainThread())
allowScripting.emplace();
int operationId = m_debuggerAgent->traceAsyncOperationStarting(event->type()); int operationId = m_debuggerAgent->traceAsyncOperationStarting(event->type());
ExecutionContextData* data = createContextDataIfNeeded(eventTarget->executionContext()); ExecutionContextData* data = createContextDataIfNeeded(eventTarget->executionContext());
data->m_eventCallChains.set(event, operationId); data->m_eventCallChains.set(event, operationId);
...@@ -310,9 +306,7 @@ void AsyncCallTracker::didEnqueueMutationRecord(ExecutionContext* context, Mutat ...@@ -310,9 +306,7 @@ void AsyncCallTracker::didEnqueueMutationRecord(ExecutionContext* context, Mutat
ExecutionContextData* data = createContextDataIfNeeded(context); ExecutionContextData* data = createContextDataIfNeeded(context);
if (data->m_mutationObserverCallChains.contains(observer)) if (data->m_mutationObserverCallChains.contains(observer))
return; return;
Optional<ScriptForbiddenScope::AllowUserAgentScript> allowScripting; ScriptForbiddenScope::AllowUserAgentScript allowScripting;
if (isMainThread())
allowScripting.emplace();
int operationId = m_debuggerAgent->traceAsyncOperationStarting(enqueueMutationRecordName); int operationId = m_debuggerAgent->traceAsyncOperationStarting(enqueueMutationRecordName);
data->m_mutationObserverCallChains.set(observer, operationId); data->m_mutationObserverCallChains.set(observer, operationId);
} }
......
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
#include "core/inspector/ScriptAsyncCallStack.h" #include "core/inspector/ScriptAsyncCallStack.h"
#include "core/inspector/v8/V8Debugger.h" #include "core/inspector/v8/V8Debugger.h"
#include "platform/ScriptForbiddenScope.h" #include "platform/ScriptForbiddenScope.h"
#include "wtf/MainThread.h"
#include "wtf/Optional.h"
namespace blink { namespace blink {
...@@ -262,9 +260,7 @@ bool InspectorDebuggerAgent::isPaused() ...@@ -262,9 +260,7 @@ bool InspectorDebuggerAgent::isPaused()
PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> InspectorDebuggerAgent::currentAsyncStackTraceForConsole() PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> InspectorDebuggerAgent::currentAsyncStackTraceForConsole()
{ {
Optional<ScriptForbiddenScope::AllowUserAgentScript> allowScripting; ScriptForbiddenScope::AllowUserAgentScript allowScripting;
if (isMainThread())
allowScripting.emplace();
return m_v8DebuggerAgent->currentAsyncStackTraceForConsole(); return m_v8DebuggerAgent->currentAsyncStackTraceForConsole();
} }
......
...@@ -44,14 +44,14 @@ bool ScriptForbiddenScope::isScriptForbidden() ...@@ -44,14 +44,14 @@ bool ScriptForbiddenScope::isScriptForbidden()
} }
ScriptForbiddenScope::AllowUserAgentScript::AllowUserAgentScript() ScriptForbiddenScope::AllowUserAgentScript::AllowUserAgentScript()
: m_change(s_scriptForbiddenCount, 0)
{ {
ASSERT(isMainThread()); if (isMainThread())
m_change.emplace(s_scriptForbiddenCount, 0);
} }
ScriptForbiddenScope::AllowUserAgentScript::~AllowUserAgentScript() ScriptForbiddenScope::AllowUserAgentScript::~AllowUserAgentScript()
{ {
ASSERT(!s_scriptForbiddenCount); ASSERT(!isMainThread() || !s_scriptForbiddenCount);
} }
} // namespace blink } // namespace blink
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "platform/PlatformExport.h" #include "platform/PlatformExport.h"
#include "wtf/Assertions.h" #include "wtf/Assertions.h"
#include "wtf/Optional.h"
#include "wtf/TemporaryChange.h" #include "wtf/TemporaryChange.h"
namespace blink { namespace blink {
...@@ -21,7 +22,7 @@ public: ...@@ -21,7 +22,7 @@ public:
AllowUserAgentScript(); AllowUserAgentScript();
~AllowUserAgentScript(); ~AllowUserAgentScript();
private: private:
TemporaryChange<unsigned> m_change; Optional<TemporaryChange<unsigned>> m_change;
}; };
static void enter(); 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