Skip to content
Permalink
Browse files
2010-06-09 Anton Muhin <antonm@chromium.org>
        Reviewed by Nate Chapin.

        [v8] First phase of switching to new named property query API
        https://bugs.webkit.org/show_bug.cgi?id=40303

        To allow better management of attributes of intercepted properties,
        we're starting to switch to new named property query API which
        now could return attributes instead of simple property present/absent
        flag.  The next step would remove USE_NEW_QUERY_CALLBACK, then
        v8 would have them enabled by default.

        * bindings/scripts/CodeGeneratorV8.pm:
        * bindings/v8/NPV8Object.cpp:
        * bindings/v8/ScriptArray.cpp:
        * bindings/v8/ScriptCallStack.cpp:
        * bindings/v8/SerializedScriptValue.cpp:
        * bindings/v8/V8Binding.cpp:
        * bindings/v8/V8DOMWrapper.cpp:
        * bindings/v8/V8GCController.cpp:
        * bindings/v8/V8IsolatedContext.cpp:
        * bindings/v8/V8NPObject.cpp:
        (WebCore::npObjectQueryProperty):
        * bindings/v8/V8Proxy.cpp:
        * bindings/v8/custom/V8PopStateEventCustom.cpp:
        * bindings/v8/custom/V8StorageCustom.cpp:
        (WebCore::V8Storage::namedPropertyQuery):
        * config.h:

Canonical link: https://commits.webkit.org/51947@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@60932 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eseidel committed Jun 10, 2010
1 parent 42b8104 commit c7163452642d81c2f97c80a7323590d9ee9982c0
Showing 15 changed files with 41 additions and 20 deletions.
@@ -1,3 +1,33 @@
2010-06-09 Anton Muhin <antonm@chromium.org>

Reviewed by Nate Chapin.

[v8] First phase of switching to new named property query API
https://bugs.webkit.org/show_bug.cgi?id=40303

To allow better management of attributes of intercepted properties,
we're starting to switch to new named property query API which
now could return attributes instead of simple property present/absent
flag. The next step would remove USE_NEW_QUERY_CALLBACK, then
v8 would have them enabled by default.

* bindings/scripts/CodeGeneratorV8.pm:
* bindings/v8/NPV8Object.cpp:
* bindings/v8/ScriptArray.cpp:
* bindings/v8/ScriptCallStack.cpp:
* bindings/v8/SerializedScriptValue.cpp:
* bindings/v8/V8Binding.cpp:
* bindings/v8/V8DOMWrapper.cpp:
* bindings/v8/V8GCController.cpp:
* bindings/v8/V8IsolatedContext.cpp:
* bindings/v8/V8NPObject.cpp:
(WebCore::npObjectQueryProperty):
* bindings/v8/V8Proxy.cpp:
* bindings/v8/custom/V8PopStateEventCustom.cpp:
* bindings/v8/custom/V8StorageCustom.cpp:
(WebCore::V8Storage::namedPropertyQuery):
* config.h:

2010-06-09 Steve Block <steveblock@google.com>

Reviewed by Jeremy Orlow.
@@ -469,7 +469,7 @@ END
if ($hasCustomEnumerator) {
push(@headerContent, <<END);
static v8::Handle<v8::Array> namedPropertyEnumerator(const v8::AccessorInfo&);
static v8::Handle<v8::Boolean> namedPropertyQuery(v8::Local<v8::String>, const v8::AccessorInfo&);
static v8::Handle<v8::Integer> namedPropertyQuery(v8::Local<v8::String>, const v8::AccessorInfo&);
END
}
}
@@ -1548,7 +1548,7 @@ END
push(@implContent, " desc->${setOn}Template()->SetNamedPropertyHandler(V8${interfaceName}::namedPropertyGetter, ");
push(@implContent, $hasSetter ? "V8${interfaceName}::namedPropertySetter, " : "0, ");
# If there is a custom enumerator, there MUST be custom query to properly communicate property attributes.
push(@implContent, $hasEnumerator ? "V8${interfaceName}::namedPropertyQuery," : "0, ");
push(@implContent, $hasEnumerator ? "V8${interfaceName}::namedPropertyQuery, " : "0, ");
push(@implContent, $hasDeleter ? "V8${interfaceName}::namedPropertyDeleter, " : "0, ");
push(@implContent, $hasEnumerator ? "V8${interfaceName}::namedPropertyEnumerator" : "0");
push(@implContent, ");\n");
@@ -49,7 +49,6 @@
#endif

#include <stdio.h>
#include <v8.h>
#include <wtf/StringExtras.h>

using namespace WebCore;
@@ -39,8 +39,6 @@
#include "V8Binding.h"
#include "V8Proxy.h"

#include <v8.h>

namespace WebCore {

ScriptArray::ScriptArray(ScriptState* scriptState, v8::Handle<v8::Array> v8Array)
@@ -37,7 +37,6 @@
#include "V8Binding.h"

#include <v8-debug.h>
#include <v8.h>

namespace WebCore {

@@ -44,7 +44,6 @@
#include "V8ImageData.h"
#include "V8Proxy.h"

#include <v8.h>
#include <wtf/Assertions.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
@@ -44,8 +44,6 @@
#include "V8Proxy.h"
#include <wtf/text/CString.h>

#include <v8.h>

namespace WebCore {

// WebCoreStringResource is a helper class for v8ExternalString. It is used
@@ -82,7 +82,6 @@

#include <algorithm>
#include <utility>
#include <v8.h>
#include <v8-debug.h>
#include <wtf/Assertions.h>
#include <wtf/OwnArrayPtr.h>
@@ -46,7 +46,6 @@

#include <algorithm>
#include <utility>
#include <v8.h>
#include <v8-debug.h>
#include <wtf/HashMap.h>
#include <wtf/StdLibExtras.h>
@@ -38,7 +38,6 @@
#include "ScriptController.h"
#include "V8DOMWindow.h"
#include "V8HiddenPropertyName.h"
#include <v8.h>

namespace WebCore {

@@ -243,10 +243,10 @@ v8::Handle<v8::Value> npObjectGetIndexedProperty(v8::Local<v8::Object> self, uin
return npObjectGetProperty(self, identifier, v8::Number::New(index));
}

v8::Handle<v8::Boolean> npObjectQueryProperty(v8::Local<v8::String> name, const v8::AccessorInfo& info)
v8::Handle<v8::Integer> npObjectQueryProperty(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
NPIdentifier identifier = getStringIdentifier(name);
return npObjectGetProperty(info.Holder(), identifier, name).IsEmpty() ? v8::Handle<v8::Boolean>() : v8::True();
return npObjectGetProperty(info.Holder(), identifier, name).IsEmpty() ? v8::Handle<v8::Integer>() : v8::Integer::New(v8::None);
}

static v8::Handle<v8::Value> npObjectSetProperty(v8::Local<v8::Object> self, NPIdentifier identifier, v8::Local<v8::Value> value)
@@ -67,7 +67,6 @@
#include <algorithm>
#include <stdio.h>
#include <utility>
#include <v8.h>
#include <wtf/Assertions.h>
#include <wtf/OwnArrayPtr.h>
#include <wtf/StdLibExtras.h>
@@ -35,8 +35,6 @@
#include "SerializedScriptValue.h"
#include "V8Proxy.h"

#include <v8.h>

namespace WebCore {

v8::Handle<v8::Value> V8PopStateEvent::stateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
@@ -79,17 +79,17 @@ v8::Handle<v8::Value> V8Storage::namedPropertyGetter(v8::Local<v8::String> name,
return storageGetter(name, info);
}

v8::Handle<v8::Boolean> V8Storage::namedPropertyQuery(v8::Local<v8::String> v8Name, const v8::AccessorInfo& info)
v8::Handle<v8::Integer> V8Storage::namedPropertyQuery(v8::Local<v8::String> v8Name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Storage.NamedPropertyQuery");

Storage* storage = V8Storage::toNative(info.Holder());
String name = toWebCoreString(v8Name);

if (storage->contains(name) && name != "length")
return v8::True();
return v8::Integer::New(v8::None);

return v8::Handle<v8::Boolean>();
return v8::Handle<v8::Integer>();
}

static v8::Handle<v8::Value> storageSetter(v8::Local<v8::String> v8Name, v8::Local<v8::Value> v8Value, const v8::AccessorInfo& info)
@@ -223,3 +223,7 @@ typedef float CGFloat;
#if PLATFORM(WIN) && PLATFORM(CG)
#define WTF_USE_SAFARI_THEME 1
#endif

#if defined(WTF_USE_V8)
#define USE_NEW_QUERY_CALLBACKS
#endif

0 comments on commit c716345

Please sign in to comment.