Index: Source/bindings/core/v8/V8Binding.cpp |
diff --git a/Source/bindings/core/v8/V8Binding.cpp b/Source/bindings/core/v8/V8Binding.cpp |
index 9d52428fd65061187f4d4bac23574645fca3a314..38112e38fa7126b5985f4a00a46d03817f6c3125 100644 |
--- a/Source/bindings/core/v8/V8Binding.cpp |
+++ b/Source/bindings/core/v8/V8Binding.cpp |
@@ -1055,6 +1055,43 @@ PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol |
return InspectorFunctionCallEvent::data(context, info.scriptId(), info.resourceName(), info.lineNumber()); |
} |
+bool AttributesWithObservableSideEffectOnGet::hasNoSideEffect(v8::Isolate* isolate, v8::Handle<v8::Value> domObject, v8::Handle<v8::Value> attributeName) |
+{ |
+ if (!V8DOMWrapper::isWrapper(isolate, domObject)) |
+ return false; |
+ const WrapperTypeInfo* wrapperTypeInfo = |
+ toWrapperTypeInfo(v8::Handle<v8::Object>::Cast(domObject)); |
+ |
+ if (attributeName.IsEmpty() || !attributeName->IsString()) |
+ return false; |
+ String attribute = V8StringResource<>(attributeName); |
+ |
+ if (!wrapperTypeInfo || attribute.isEmpty()) |
+ return false; |
+ |
+ for (const auto& entry : *attributesWithSideEffectOnGet()) { |
+ if (wrapperTypeInfo->isSubclass(entry.first) |
+ && attribute == entry.second) |
+ return false; |
+ } |
+ |
+ return true; |
+} |
+ |
+void AttributesWithObservableSideEffectOnGet::add(const WrapperTypeInfo* wrapperTypeInfo, String attributeName) |
+{ |
+ AttributeSet* attributes = attributesWithSideEffectOnGet(); |
+ AttributeSet::ValueType value(wrapperTypeInfo, attributeName); |
+ if (!attributes->contains(value)) |
+ attributes->append(value); |
+} |
+ |
+AttributesWithObservableSideEffectOnGet::AttributeSet* AttributesWithObservableSideEffectOnGet::attributesWithSideEffectOnGet() |
+{ |
+ DEFINE_STATIC_LOCAL(AttributeSet, attributes, ()); |
+ return &attributes; |
+} |
+ |
void v8ConstructorAttributeGetterAsProperty(v8::Local<v8::String> propertyName, const v8::PropertyCallbackInfo<v8::Value>& info) |
{ |
v8ConstructorAttributeGetter(info); |