Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Roll out r121610 and r122487 which may have been causing flaky crashes
https://bugs.webkit.org/show_bug.cgi?id=91637 Reviewed by Kentaro Hara. Flaky crashes started in random tests following r121610. It's not clear that r121610 is to blame, but we'd like to prove or disprove it. If this doesn't resolve the crashes, this patch should be rolled out. Source/WebCore: * WebCore.gypi: * bindings/v8/NPObjectWrapper.cpp: Added. (WebCore): (NPProxyObject): (WebCore::NPObjectWrapper::NPObjectWrapper): (WebCore::NPObjectWrapper::create): (WebCore::NPObjectWrapper::clear): (WebCore::NPObjectWrapper::getWrapper): (WebCore::NPObjectWrapper::getUnderlyingNPObject): (WebCore::NPObjectWrapper::getObjectForCall): (WebCore::NPObjectWrapper::NPAllocate): (WebCore::NPObjectWrapper::NPDeallocate): (WebCore::NPObjectWrapper::NPPInvalidate): (WebCore::NPObjectWrapper::NPHasMethod): (WebCore::NPObjectWrapper::NPInvoke): (WebCore::NPObjectWrapper::NPInvokeDefault): (WebCore::NPObjectWrapper::NPHasProperty): (WebCore::NPObjectWrapper::NPGetProperty): (WebCore::NPObjectWrapper::NPSetProperty): (WebCore::NPObjectWrapper::NPRemoveProperty): (WebCore::NPObjectWrapper::NPNEnumerate): (WebCore::NPObjectWrapper::NPNConstruct): (WebCore::NPObjectWrapper::NPInvokePrivate): * bindings/v8/NPObjectWrapper.h: Added. (WebCore): (NPObjectWrapper): * bindings/v8/NPV8Object.cpp: (WebCore::freeV8NPObject): (_NPN_Invoke): (_NPN_InvokeDefault): (_NPN_EvaluateHelper): (_NPN_GetProperty): (_NPN_SetProperty): (_NPN_RemoveProperty): (_NPN_HasProperty): (_NPN_HasMethod): (_NPN_Enumerate): (_NPN_Construct): * bindings/v8/NPV8Object.h: (WebCore): * bindings/v8/ScriptController.cpp: (WebCore::ScriptController::ScriptController): (WebCore::ScriptController::clearScriptObjects): (WebCore::ScriptController::windowScriptNPObject): * bindings/v8/ScriptController.h: (ScriptController): Source/WebKit/chromium: * src/WebBindings.cpp: (WebKit::getRangeImpl): (WebKit::getElementImpl): (WebKit::getArrayBufferImpl): (WebKit::getArrayBufferViewImpl): (WebKit::WebBindings::toV8Value): Tools: * DumpRenderTree/DumpRenderTree.gypi: * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp: * DumpRenderTree/TestNetscapePlugIn/PluginTest.h: (PluginTest): * DumpRenderTree/TestNetscapePlugIn/Tests/LeakWindowScriptableObject.cpp: Removed. LayoutTests: * plugins/npruntime/leak-window-scriptable-object-expected.txt: Removed. * plugins/npruntime/leak-window-scriptable-object.html: Removed. Canonical link: https://commits.webkit.org/109568@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123110 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
9e27fdb
commit 5e89b79969b6c7358a5c8b9aaead1f911db1a627
Showing
18 changed files
with
446 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,181 @@ | ||
/* | ||
* Copyright (C) 2011 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 "config.h" | ||
#include "NPObjectWrapper.h" | ||
|
||
namespace WebCore { | ||
|
||
struct NPProxyObject { | ||
NPObject object; | ||
NPObjectWrapper* wrapper; | ||
}; | ||
|
||
NPClass NPObjectWrapper::m_npClassWrapper = { | ||
NP_CLASS_STRUCT_VERSION, | ||
NPObjectWrapper::NPAllocate, | ||
NPObjectWrapper::NPDeallocate, | ||
NPObjectWrapper::NPPInvalidate, | ||
NPObjectWrapper::NPHasMethod, | ||
NPObjectWrapper::NPInvoke, | ||
NPObjectWrapper::NPInvokeDefault, | ||
NPObjectWrapper::NPHasProperty, | ||
NPObjectWrapper::NPGetProperty, | ||
NPObjectWrapper::NPSetProperty, | ||
NPObjectWrapper::NPRemoveProperty, | ||
NPObjectWrapper::NPNEnumerate, | ||
NPObjectWrapper::NPNConstruct | ||
}; | ||
|
||
NPObjectWrapper::NPObjectWrapper(NPObject* obj) | ||
: m_wrappedNPObject(obj) | ||
{ | ||
} | ||
|
||
NPObject* NPObjectWrapper::create(NPObject* object) | ||
{ | ||
ASSERT(object); | ||
NPProxyObject* proxyObject = reinterpret_cast<NPProxyObject*>(_NPN_CreateObject(0, &m_npClassWrapper)); | ||
proxyObject->wrapper = new NPObjectWrapper(object); | ||
return reinterpret_cast<NPObject*>(proxyObject); | ||
} | ||
|
||
void NPObjectWrapper::clear() | ||
{ | ||
m_wrappedNPObject = 0; | ||
} | ||
|
||
NPObjectWrapper* NPObjectWrapper::getWrapper(NPObject* obj) | ||
{ | ||
if (&m_npClassWrapper == obj->_class) { | ||
NPProxyObject* proxyObject = reinterpret_cast<NPProxyObject*>(obj); | ||
return proxyObject->wrapper; | ||
} | ||
return 0; | ||
} | ||
|
||
NPObject* NPObjectWrapper::getUnderlyingNPObject(NPObject* obj) | ||
{ | ||
NPObjectWrapper* wrapper = getWrapper(obj); | ||
return wrapper ? wrapper->m_wrappedNPObject : 0; | ||
} | ||
|
||
NPObject* NPObjectWrapper::getObjectForCall(NPObject* obj) | ||
{ | ||
NPObject* actualObject = getUnderlyingNPObject(obj); | ||
return actualObject ? actualObject : 0; | ||
} | ||
|
||
NPObject* NPObjectWrapper::NPAllocate(NPP, NPClass*) | ||
{ | ||
return reinterpret_cast<NPObject*>(new NPProxyObject); | ||
} | ||
|
||
void NPObjectWrapper::NPDeallocate(NPObject* obj) | ||
{ | ||
NPProxyObject* proxyObject = reinterpret_cast<NPProxyObject*>(obj); | ||
delete proxyObject->wrapper; | ||
delete proxyObject; | ||
} | ||
|
||
void NPObjectWrapper::NPPInvalidate(NPObject* obj) | ||
{ | ||
NPObject* actualObject = getObjectForCall(obj); | ||
if (actualObject && actualObject->_class->invalidate) | ||
actualObject->_class->invalidate(actualObject); | ||
} | ||
|
||
bool NPObjectWrapper::NPHasMethod(NPObject* obj, NPIdentifier name) | ||
{ | ||
NPObject* actualObject = getObjectForCall(obj); | ||
return actualObject ? _NPN_HasMethod(0, actualObject, name) : false; | ||
} | ||
|
||
bool NPObjectWrapper::NPInvoke(NPObject* obj, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result) | ||
{ | ||
NPObject* actualObject = getObjectForCall(obj); | ||
return actualObject ? _NPN_Invoke(0, actualObject, name, args, argCount, result) : false; | ||
} | ||
|
||
bool NPObjectWrapper::NPInvokeDefault(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result) | ||
{ | ||
NPObject* actualObject = getObjectForCall(obj); | ||
return actualObject ? _NPN_InvokeDefault(0, actualObject, args, argCount, result) : false; | ||
} | ||
|
||
bool NPObjectWrapper::NPHasProperty(NPObject* obj, NPIdentifier name) | ||
{ | ||
NPObject* actualObject = getObjectForCall(obj); | ||
return actualObject ? _NPN_HasProperty(0, actualObject, name) : false; | ||
} | ||
|
||
bool NPObjectWrapper::NPGetProperty(NPObject* obj, NPIdentifier name, NPVariant* result) | ||
{ | ||
NPObject* actualObject = getObjectForCall(obj); | ||
return actualObject ? _NPN_GetProperty(0, actualObject, name, result) : false; | ||
} | ||
|
||
bool NPObjectWrapper::NPSetProperty(NPObject* obj, NPIdentifier name, const NPVariant* value) | ||
{ | ||
NPObject* actualObject = getObjectForCall(obj); | ||
return actualObject ? _NPN_SetProperty(0, actualObject, name, value) : false; | ||
} | ||
|
||
bool NPObjectWrapper::NPRemoveProperty(NPObject* obj, NPIdentifier name) { | ||
NPObject* actualObject = getObjectForCall(obj); | ||
return actualObject ? _NPN_RemoveProperty(0, actualObject, name) : false; | ||
} | ||
|
||
bool NPObjectWrapper::NPNEnumerate(NPObject* obj, NPIdentifier** value, uint32_t* count) | ||
{ | ||
NPObject* actualObject = getObjectForCall(obj); | ||
return actualObject ? _NPN_Enumerate(0, actualObject, value, count) : false; | ||
} | ||
|
||
bool NPObjectWrapper::NPNConstruct(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result) | ||
{ | ||
NPObject* actualObject = getObjectForCall(obj); | ||
return actualObject ? _NPN_Construct(0, actualObject, args, argCount, result) : false; | ||
} | ||
|
||
bool NPObjectWrapper::NPInvokePrivate(NPP npp, NPObject* obj, bool isDefault, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result) | ||
{ | ||
NPObject* actualObject = getObjectForCall(obj); | ||
if (!actualObject) | ||
return false; | ||
|
||
if (isDefault) { | ||
return _NPN_InvokeDefault(0, actualObject, args, argCount, result); | ||
} else { | ||
return _NPN_Invoke(0, actualObject, name, args, argCount, result); | ||
} | ||
} | ||
|
||
} // namespace WebCore |
Oops, something went wrong.