|
|
ScriptState::contextIsEmpty shouldn't return true for a context whose global object is detached
I cannot reproduce bug 385366 but my best guess is that V8AbstractEventListener::handleEvent calls context->Global() after the global object is detached from the context (because of the frame navigation).
Currently ScriptState is used in the following programming pattern:
class DOMObject {
DOMObject(ScriptState* scriptState) : m_scriptState(scriptState) { } // Record the script state when the DOMObject is created.
void methodTriggeredAsynchrnously() { // Blink calls this sometime later.
if (m_scriptState->contextIsEmpty()) // If the context is already gone, we do nothing.
return;
ScriptState::Scope scope(m_scriptState.get()); // Otherwise, enter the context and do the actual work.
...; // Do the actual work.
}
RefPtr<ScriptState> m_scriptState;
};
The problem is that m_scriptState->contextIsEmpty() returns true even if the global object is detached from the context. We should return false in that case.
This CL also renames contextIsEmpty to contextIsValid for clarity.
BUG= 385366
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=181392
Total comments: 2
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+45 lines, -34 lines) |
Patch |
 |
M |
Source/bindings/core/v8/ScheduledAction.cpp
|
View
|
1
2
3
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
Source/bindings/core/v8/ScriptController.cpp
|
View
|
1
2
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
 |
M |
Source/bindings/core/v8/ScriptDebugServer.cpp
|
View
|
1
2
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
Source/bindings/core/v8/ScriptState.h
|
View
|
1
2
|
2 chunks |
+4 lines, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/core/v8/ScriptState.cpp
|
View
|
|
2 chunks |
+8 lines, -0 lines |
0 comments
|
Download
|
 |
M |
Source/bindings/core/v8/ScriptValue.cpp
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/core/v8/V8AbstractEventListener.cpp
|
View
|
1
2
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
Source/bindings/core/v8/V8CustomElementLifecycleCallbacks.cpp
|
View
|
1
2
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
 |
M |
Source/bindings/core/v8/V8EventListenerList.cpp
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/core/v8/V8MutationCallback.cpp
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/core/v8/WindowProxy.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/core/v8/custom/V8WindowCustom.cpp
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/modules/v8/custom/V8CustomSQLStatementErrorCallback.cpp
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/templates/callback_interface.cpp
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/bindings/tests/results/V8TestCallbackInterface.cpp
|
View
|
1
2
|
10 chunks |
+10 lines, -10 lines |
0 comments
|
Download
|
 |
M |
Source/core/inspector/InspectorOverlay.cpp
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/core/inspector/PageRuntimeAgent.cpp
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
Source/web/WebPluginContainerImpl.cpp
|
View
|
1
2
3
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
Total messages: 13 (4 generated)
|