Diff
Modified: branches/safari-536.26-branch/LayoutTests/ChangeLog (125126 => 125127)
--- branches/safari-536.26-branch/LayoutTests/ChangeLog 2012-08-09 00:41:02 UTC (rev 125126)
+++ branches/safari-536.26-branch/LayoutTests/ChangeLog 2012-08-09 00:52:29 UTC (rev 125127)
@@ -1,5 +1,20 @@
2012-08-07 Lucas Forschler <[email protected]>
+ Merge 123936
+
+ 2012-07-27 Brady Eidson <[email protected]>
+
+ Plugins should not be allowed to override standard properties/attributes in non-standard worlds
+ <rdar://problem/11975252> and https://bugs.webkit.org/show_bug.cgi?id=92519
+
+ Reviewed by Anders Carlsson.
+
+ * plugins/npruntime/overrides-all-properties-expected.txt: Added.
+ * plugins/npruntime/overrides-all-properties.html: Added.
+ * platform/chromium/TestExpectations: Test behaves different in V8, so skip on chromium
+
+2012-08-07 Lucas Forschler <[email protected]>
+
Merge 116291
2012-05-07 Antti Koivisto <[email protected]>
Copied: branches/safari-536.26-branch/LayoutTests/plugins/npruntime/overrides-all-properties-expected.txt (from rev 123936, trunk/LayoutTests/plugins/npruntime/overrides-all-properties-expected.txt) (0 => 125127)
--- branches/safari-536.26-branch/LayoutTests/plugins/npruntime/overrides-all-properties-expected.txt (rev 0)
+++ branches/safari-536.26-branch/LayoutTests/plugins/npruntime/overrides-all-properties-expected.txt 2012-08-09 00:52:29 UTC (rev 125127)
@@ -0,0 +1,21 @@
+
+
+Test that the plugin script object - in a non-standard world - can override any property on its owning node *except* for the properties that are built in to the node or its constructor/prototype chain.
+For example, it can override "madeUpProperty" but cannot override "getAttribute" or "className".
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+
Copied: branches/safari-536.26-branch/LayoutTests/plugins/npruntime/overrides-all-properties.html (from rev 123936, trunk/LayoutTests/plugins/npruntime/overrides-all-properties.html) (0 => 125127)
--- branches/safari-536.26-branch/LayoutTests/plugins/npruntime/overrides-all-properties.html (rev 0)
+++ branches/safari-536.26-branch/LayoutTests/plugins/npruntime/overrides-all-properties.html 2012-08-09 00:52:29 UTC (rev 125127)
@@ -0,0 +1,65 @@
+<head>
+
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+function runTest() {
+ if (!window.testRunner) {
+ log("This test can only be run under WebKit's testRunner environment");
+ return;
+ }
+
+ testRunner.evaluateScriptInIsolatedWorld(0, " \
+ function test(msg, expected) \
+ { \
+ var console = document.getElementById('console'); \
+ var span = document.createElement('span'); \
+ if (msg == undefined) \
+ msg = 'undefined'; \
+ else \
+ msg = msg.toString(); \
+ span.innerHTML = msg == expected ? 'PASS<br>' : 'FAIL - <br>(' + msg + ') but expected <br>(' + expected + ')<br>'; \
+ console.appendChild(span); \
+ } \
+ \
+ pluginEmbed = document.getElementById('plugin-embed'); \
+ \
+ test('madeUpProperty' in pluginEmbed, 'true'); \
+ test(typeof pluginEmbed.madeUpProperty, 'string'); \
+ test(pluginEmbed.madeUpProperty, 'My name is madeUpProperty'); \
+ test('getAttribute' in pluginEmbed, 'true'); \
+ test(typeof pluginEmbed.getAttribute, 'function'); \
+ test(pluginEmbed.getAttribute, 'function getAttribute() {\\n [native code]\\n}'); \
+ \
+ test(Object.getOwnPropertyDescriptor(pluginEmbed, 'madeUpProperty'), '[object Object]'); \
+ test(Object.getOwnPropertyDescriptor(pluginEmbed, 'getAttribute'), 'undefined'); \
+ \
+ pluginObject = document.getElementById('plugin-object'); \
+ \
+ test('madeUpProperty' in pluginObject, 'true'); \
+ test(typeof pluginObject.madeUpProperty, 'string'); \
+ test(pluginObject.madeUpProperty, 'My name is madeUpProperty'); \
+ test('getAttribute' in pluginObject, 'true'); \
+ test(typeof pluginObject.getAttribute, 'function'); \
+ test(pluginObject.getAttribute, 'function getAttribute() {\\n [native code]\\n}'); \
+ \
+ test(Object.getOwnPropertyDescriptor(pluginObject, 'madeUpProperty'), '[object Object]'); \
+ test(Object.getOwnPropertyDescriptor(pluginObject, 'getAttribute'), 'undefined'); \
+ ");
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+</script>
+</head>
+
+<body _onLoad_="runTest()">
+<embed id="plugin-embed" type="application/x-webkit-test-netscape" test="plugin-scriptable-object-overrides-all-properties"></embed><br>
+<object id="plugin-object" type="application/x-webkit-test-netscape" test="plugin-scriptable-object-overrides-all-properties"></object><br>
+Test that the plugin script object - in a non-standard world - can override any property on its owning node *except* for the properties that are built in to the node or its constructor/prototype chain.<br>
+For example, it can override "madeUpProperty" but cannot override "getAttribute" or "className".<br>
+<div id="console"></div>
+</body>
Modified: branches/safari-536.26-branch/Source/WebCore/ChangeLog (125126 => 125127)
--- branches/safari-536.26-branch/Source/WebCore/ChangeLog 2012-08-09 00:41:02 UTC (rev 125126)
+++ branches/safari-536.26-branch/Source/WebCore/ChangeLog 2012-08-09 00:52:29 UTC (rev 125127)
@@ -1,5 +1,37 @@
2012-08-07 Lucas Forschler <[email protected]>
+ Merge 123936
+
+ 2012-07-27 Brady Eidson <[email protected]>
+
+ Plugins should not be allowed to override standard properties/attributes in non-standard worlds
+ <rdar://problem/11975252> and https://bugs.webkit.org/show_bug.cgi?id=92519
+
+ Reviewed by Anders Carlsson.
+
+ Change the 3 plugin-owning element's custom bindings to prefer built-in properties if they exist.
+ When they do they don't give the plugin a chance to override.
+
+ Test: plugins/npruntime/overrides-all-properties.html
+
+ Add plugin custom functions to prefer built-in properties over plugin scriptable object properties:
+ * bindings/js/JSPluginElementFunctions.h:
+ (WebCore::pluginElementCustomGetOwnPropertySlot):
+ (WebCore::pluginElementCustomGetOwnPropertyDescriptor):
+
+ Use those new custom functions for getting properties:
+ * bindings/js/JSHTMLAppletElementCustom.cpp:
+ (WebCore::JSHTMLAppletElement::getOwnPropertySlotDelegate):
+ (WebCore::JSHTMLAppletElement::getOwnPropertyDescriptorDelegate):
+ * bindings/js/JSHTMLEmbedElementCustom.cpp:
+ (WebCore::JSHTMLEmbedElement::getOwnPropertySlotDelegate):
+ (WebCore::JSHTMLEmbedElement::getOwnPropertyDescriptorDelegate):
+ * bindings/js/JSHTMLObjectElementCustom.cpp:
+ (WebCore::JSHTMLObjectElement::getOwnPropertySlotDelegate):
+ (WebCore::JSHTMLObjectElement::getOwnPropertyDescriptorDelegate):
+
+2012-08-07 Lucas Forschler <[email protected]>
+
Merge 120328
2012-06-13 Mark Hahnenberg <[email protected]>
Modified: branches/safari-536.26-branch/Source/WebCore/bindings/js/JSHTMLAppletElementCustom.cpp (125126 => 125127)
--- branches/safari-536.26-branch/Source/WebCore/bindings/js/JSHTMLAppletElementCustom.cpp 2012-08-09 00:41:02 UTC (rev 125126)
+++ branches/safari-536.26-branch/Source/WebCore/bindings/js/JSHTMLAppletElementCustom.cpp 2012-08-09 00:52:29 UTC (rev 125127)
@@ -35,12 +35,12 @@
bool JSHTMLAppletElement::getOwnPropertySlotDelegate(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
- return runtimeObjectCustomGetOwnPropertySlot(exec, propertyName, slot, this);
+ return pluginElementCustomGetOwnPropertySlot<JSHTMLAppletElement, Base>(exec, propertyName, slot, this);
}
bool JSHTMLAppletElement::getOwnPropertyDescriptorDelegate(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
- return runtimeObjectCustomGetOwnPropertyDescriptor(exec, propertyName, descriptor, this);
+ return pluginElementCustomGetOwnPropertyDescriptor<JSHTMLAppletElement, Base>(exec, propertyName, descriptor, this);
}
bool JSHTMLAppletElement::putDelegate(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
Modified: branches/safari-536.26-branch/Source/WebCore/bindings/js/JSHTMLEmbedElementCustom.cpp (125126 => 125127)
--- branches/safari-536.26-branch/Source/WebCore/bindings/js/JSHTMLEmbedElementCustom.cpp 2012-08-09 00:41:02 UTC (rev 125126)
+++ branches/safari-536.26-branch/Source/WebCore/bindings/js/JSHTMLEmbedElementCustom.cpp 2012-08-09 00:52:29 UTC (rev 125127)
@@ -35,12 +35,12 @@
bool JSHTMLEmbedElement::getOwnPropertySlotDelegate(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
- return runtimeObjectCustomGetOwnPropertySlot(exec, propertyName, slot, this);
+ return pluginElementCustomGetOwnPropertySlot<JSHTMLEmbedElement, Base>(exec, propertyName, slot, this);
}
bool JSHTMLEmbedElement::getOwnPropertyDescriptorDelegate(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
- return runtimeObjectCustomGetOwnPropertyDescriptor(exec, propertyName, descriptor, this);
+ return pluginElementCustomGetOwnPropertyDescriptor<JSHTMLEmbedElement, Base>(exec, propertyName, descriptor, this);
}
bool JSHTMLEmbedElement::putDelegate(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
Modified: branches/safari-536.26-branch/Source/WebCore/bindings/js/JSHTMLObjectElementCustom.cpp (125126 => 125127)
--- branches/safari-536.26-branch/Source/WebCore/bindings/js/JSHTMLObjectElementCustom.cpp 2012-08-09 00:41:02 UTC (rev 125126)
+++ branches/safari-536.26-branch/Source/WebCore/bindings/js/JSHTMLObjectElementCustom.cpp 2012-08-09 00:52:29 UTC (rev 125127)
@@ -35,12 +35,12 @@
bool JSHTMLObjectElement::getOwnPropertySlotDelegate(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
- return runtimeObjectCustomGetOwnPropertySlot(exec, propertyName, slot, this);
+ return pluginElementCustomGetOwnPropertySlot<JSHTMLObjectElement, Base>(exec, propertyName, slot, this);
}
bool JSHTMLObjectElement::getOwnPropertyDescriptorDelegate(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
- return runtimeObjectCustomGetOwnPropertyDescriptor(exec, propertyName, descriptor, this);
+ return pluginElementCustomGetOwnPropertyDescriptor<JSHTMLObjectElement, Base>(exec, propertyName, descriptor, this);
}
bool JSHTMLObjectElement::putDelegate(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
Modified: branches/safari-536.26-branch/Source/WebCore/bindings/js/JSPluginElementFunctions.h (125126 => 125127)
--- branches/safari-536.26-branch/Source/WebCore/bindings/js/JSPluginElementFunctions.h 2012-08-09 00:41:02 UTC (rev 125126)
+++ branches/safari-536.26-branch/Source/WebCore/bindings/js/JSPluginElementFunctions.h 2012-08-09 00:52:29 UTC (rev 125127)
@@ -44,6 +44,34 @@
bool runtimeObjectCustomPut(JSC::ExecState*, const JSC::Identifier&, JSC::JSValue, JSHTMLElement*, JSC::PutPropertySlot&);
JSC::CallType runtimeObjectGetCallData(JSHTMLElement*, JSC::CallData&);
+ template <class Type, class Base> bool pluginElementCustomGetOwnPropertySlot(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::PropertySlot& slot, Type* element)
+ {
+ if (!element->globalObject()->world()->isNormal()) {
+ if (JSC::getStaticValueSlot<Type, Base>(exec, element->s_info.staticPropHashTable, element, propertyName, slot))
+ return true;
+
+ JSC::JSValue proto = element->prototype();
+ if (proto.isObject() && JSC::jsCast<JSC::JSObject*>(asObject(proto))->hasProperty(exec, propertyName))
+ return false;
+ }
+
+ return runtimeObjectCustomGetOwnPropertySlot(exec, propertyName, slot, element);
+ }
+
+ template <class Type, class Base> bool pluginElementCustomGetOwnPropertyDescriptor(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::PropertyDescriptor& descriptor, Type* element)
+ {
+ if (!element->globalObject()->world()->isNormal()) {
+ if (JSC::getStaticValueDescriptor<Type, Base>(exec, element->s_info.staticPropHashTable, element, propertyName, descriptor))
+ return true;
+
+ JSC::JSValue proto = element->prototype();
+ if (proto.isObject() && JSC::jsCast<JSC::JSObject*>(asObject(proto))->hasProperty(exec, propertyName))
+ return false;
+ }
+
+ return runtimeObjectCustomGetOwnPropertyDescriptor(exec, propertyName, descriptor, element);
+ }
+
} // namespace WebCore
#endif // JSPluginElementFunctions_h
Modified: branches/safari-536.26-branch/Tools/ChangeLog (125126 => 125127)
--- branches/safari-536.26-branch/Tools/ChangeLog 2012-08-09 00:41:02 UTC (rev 125126)
+++ branches/safari-536.26-branch/Tools/ChangeLog 2012-08-09 00:52:29 UTC (rev 125127)
@@ -1,5 +1,38 @@
2012-08-07 Lucas Forschler <[email protected]>
+ Merge 123936
+
+ 2012-07-27 Brady Eidson <[email protected]>
+
+ Plugins should not be allowed to override standard properties/attributes in non-standard worlds
+ <rdar://problem/11975252> and https://bugs.webkit.org/show_bug.cgi?id=92519
+
+ Reviewed by Anders Carlsson.
+
+ Add a test plugin which overrides all properties it is asked about:
+ * DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableObjectOverridesAllProperties.cpp: Added.
+ (PluginScriptableObjectOverridesAllProperties):
+ (PluginScriptableObjectOverridesAllProperties::PluginScriptableObjectOverridesAllProperties):
+ (PluginObject):
+ (PluginScriptableObjectOverridesAllProperties::PluginObject::PluginObject):
+ (PluginScriptableObjectOverridesAllProperties::PluginObject::~PluginObject):
+ (PluginScriptableObjectOverridesAllProperties::PluginObject::hasProperty):
+ (PluginScriptableObjectOverridesAllProperties::PluginObject::getProperty):
+ (PluginScriptableObjectOverridesAllProperties::NPP_GetValue):
+
+ Expose NPN_MemAlloc to the test plugin:
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp:
+ (PluginTest::NPN_MemAlloc):
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.h:
+ (PluginTest):
+
+ * DumpRenderTree/DumpRenderTree.gypi:
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
+ * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
+
+2012-08-07 Lucas Forschler <[email protected]>
+
Merge 124815
2012-08-03 Brady Eidson <[email protected]>
Modified: branches/safari-536.26-branch/Tools/DumpRenderTree/DumpRenderTree.gypi (125126 => 125127)
--- branches/safari-536.26-branch/Tools/DumpRenderTree/DumpRenderTree.gypi 2012-08-09 00:41:02 UTC (rev 125126)
+++ branches/safari-536.26-branch/Tools/DumpRenderTree/DumpRenderTree.gypi 2012-08-09 00:52:29 UTC (rev 125127)
@@ -71,6 +71,7 @@
'TestNetscapePlugIn/Tests/NullNPPGetValuePointer.cpp',
'TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp',
'TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp',
+ 'TestNetscapePlugIn/Tests/PluginScriptableObjectOverridesAllProperties.cpp',
'TestNetscapePlugIn/Tests/PrivateBrowsing.cpp',
'TestNetscapePlugIn/main.cpp',
],
Modified: branches/safari-536.26-branch/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj (125126 => 125127)
--- branches/safari-536.26-branch/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj 2012-08-09 00:41:02 UTC (rev 125126)
+++ branches/safari-536.26-branch/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj 2012-08-09 00:52:29 UTC (rev 125127)
@@ -67,6 +67,7 @@
4437730E125CBC3600AAE02C /* WebArchiveDumpSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 44A997830FCDE86400580F10 /* WebArchiveDumpSupport.cpp */; };
4437730F125CBC4D00AAE02C /* WebArchiveDumpSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 44A997820FCDE86400580F10 /* WebArchiveDumpSupport.h */; };
4AD6A11413C8124000EA9737 /* FormValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AD6A11313C8124000EA9737 /* FormValue.cpp */; };
+ 515F429C15C07872007C8F90 /* PluginScriptableObjectOverridesAllProperties.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515F429B15C07872007C8F90 /* PluginScriptableObjectOverridesAllProperties.cpp */; };
5106803E15CC7B10001A8A23 /* SlowNPPNew.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5106803D15CC7B10001A8A23 /* SlowNPPNew.cpp */; };
5185F6B210714E07007AA393 /* HistoryDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5185F69F10714A57007AA393 /* HistoryDelegate.mm */; };
5185F6B310714E12007AA393 /* HistoryDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5185F69E10714A57007AA393 /* HistoryDelegate.h */; };
@@ -270,6 +271,7 @@
44A997820FCDE86400580F10 /* WebArchiveDumpSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebArchiveDumpSupport.h; path = cf/WebArchiveDumpSupport.h; sourceTree = "<group>"; };
44A997830FCDE86400580F10 /* WebArchiveDumpSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebArchiveDumpSupport.cpp; path = cf/WebArchiveDumpSupport.cpp; sourceTree = "<group>"; };
4AD6A11313C8124000EA9737 /* FormValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormValue.cpp; sourceTree = "<group>"; };
+ 515F429B15C07872007C8F90 /* PluginScriptableObjectOverridesAllProperties.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginScriptableObjectOverridesAllProperties.cpp; sourceTree = "<group>"; };
5106803D15CC7B10001A8A23 /* SlowNPPNew.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SlowNPPNew.cpp; path = TestNetscapePlugIn/Tests/SlowNPPNew.cpp; sourceTree = SOURCE_ROOT; };
5185F69E10714A57007AA393 /* HistoryDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HistoryDelegate.h; path = mac/HistoryDelegate.h; sourceTree = "<group>"; };
5185F69F10714A57007AA393 /* HistoryDelegate.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = HistoryDelegate.mm; path = mac/HistoryDelegate.mm; sourceTree = "<group>"; };
@@ -541,6 +543,7 @@
C0EC3C9B12787F0500939164 /* NullNPPGetValuePointer.cpp */,
C06F9ABB1267A7060058E1F6 /* PassDifferentNPPStruct.cpp */,
1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */,
+ 515F429B15C07872007C8F90 /* PluginScriptableObjectOverridesAllProperties.cpp */,
1A1E4296141141C400388758 /* PrivateBrowsing.cpp */,
5106803D15CC7B10001A8A23 /* SlowNPPNew.cpp */,
);
@@ -891,6 +894,7 @@
1A1E4298141141C400388758 /* PrivateBrowsing.cpp in Sources */,
1A66C35114576A920099A115 /* ContentsScaleFactor.cpp in Sources */,
5106803E15CC7B10001A8A23 /* SlowNPPNew.cpp in Sources */,
+ 515F429C15C07872007C8F90 /* PluginScriptableObjectOverridesAllProperties.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: branches/safari-536.26-branch/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp (125126 => 125127)
--- branches/safari-536.26-branch/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp 2012-08-09 00:41:02 UTC (rev 125126)
+++ branches/safari-536.26-branch/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp 2012-08-09 00:52:29 UTC (rev 125127)
@@ -166,6 +166,11 @@
browser->invalidaterect(m_npp, invalidRect);
}
+void* PluginTest::NPN_MemAlloc(uint32_t size)
+{
+ return browser->memalloc(size);
+}
+
// NPRuntime NPN functions.
NPIdentifier PluginTest::NPN_GetStringIdentifier(const NPUTF8 *name)
Modified: branches/safari-536.26-branch/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h (125126 => 125127)
--- branches/safari-536.26-branch/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h 2012-08-09 00:41:02 UTC (rev 125126)
+++ branches/safari-536.26-branch/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h 2012-08-09 00:52:29 UTC (rev 125127)
@@ -76,6 +76,7 @@
NPError NPN_GetURLNotify(const char* url, const char* target, void* notifyData);
NPError NPN_GetValue(NPNVariable, void* value);
void NPN_InvalidateRect(NPRect* invalidRect);
+ void* NPN_MemAlloc(uint32_t size);
// NPRuntime NPN functions.
NPIdentifier NPN_GetStringIdentifier(const NPUTF8* name);
Copied: branches/safari-536.26-branch/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableObjectOverridesAllProperties.cpp (from rev 123936, trunk/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableObjectOverridesAllProperties.cpp) (0 => 125127)
--- branches/safari-536.26-branch/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableObjectOverridesAllProperties.cpp (rev 0)
+++ branches/safari-536.26-branch/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableObjectOverridesAllProperties.cpp 2012-08-09 00:52:29 UTC (rev 125127)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2012 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "PluginTest.h"
+
+#include <string.h>
+
+using namespace std;
+
+class PluginScriptableObjectOverridesAllProperties : public PluginTest {
+public:
+ PluginScriptableObjectOverridesAllProperties(NPP npp, const string& identifier)
+ : PluginTest(npp, identifier)
+ {
+ }
+
+private:
+ class PluginObject : public Object<PluginObject> {
+ public:
+ PluginObject()
+ {
+ }
+
+ ~PluginObject()
+ {
+ }
+
+ bool hasProperty(NPIdentifier propertyName)
+ {
+ return true;
+ }
+
+ bool getProperty(NPIdentifier propertyName, NPVariant* result)
+ {
+ static const char* message = "My name is ";
+ char* propertyString = pluginTest()->NPN_UTF8FromIdentifier(propertyName);
+
+ int bufferLength = strlen(propertyString) + strlen(message) + 1;
+ char* resultBuffer = static_cast<char*>(pluginTest()->NPN_MemAlloc(bufferLength));
+ snprintf(resultBuffer, bufferLength, "%s%s", message, propertyString);
+
+ STRINGZ_TO_NPVARIANT(resultBuffer, *result);
+
+ return true;
+ }
+ };
+
+ virtual NPError NPP_GetValue(NPPVariable variable, void *value)
+ {
+ if (variable != NPPVpluginScriptableNPObject)
+ return NPERR_GENERIC_ERROR;
+
+ *(NPObject**)value = PluginObject::create(this);
+
+ return NPERR_NO_ERROR;
+ }
+
+};
+
+static PluginTest::Register<PluginScriptableObjectOverridesAllProperties> pluginScriptableObjectOverridesAllProperties("plugin-scriptable-object-overrides-all-properties");
Modified: branches/safari-536.26-branch/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj (125126 => 125127)
--- branches/safari-536.26-branch/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj 2012-08-09 00:41:02 UTC (rev 125126)
+++ branches/safari-536.26-branch/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj 2012-08-09 00:52:29 UTC (rev 125127)
@@ -450,6 +450,10 @@
>
</File>
<File
+ RelativePath="..\Tests\PluginScriptableObjectOverridesAllProperties.cpp"
+ >
+ </File>
+ <File
RelativePath="..\Tests\PrivateBrowsing.cpp"
>
</File>
Modified: branches/safari-536.26-branch/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro (125126 => 125127)
--- branches/safari-536.26-branch/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro 2012-08-09 00:41:02 UTC (rev 125126)
+++ branches/safari-536.26-branch/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro 2012-08-09 00:52:29 UTC (rev 125127)
@@ -28,6 +28,7 @@
Tests/NullNPPGetValuePointer.cpp \
Tests/PassDifferentNPPStruct.cpp \
Tests/PluginScriptableNPObjectInvokeDefault.cpp \
+ Tests/PluginScriptableObjectOverridesAllProperties.cpp \
Tests/PrivateBrowsing.cpp
WEBKIT += webcore # For NPAPI headers