summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--webkit/data/layout_tests/chrome/fast/dom/resources/1.gifbin0 -> 17839 bytes
-rw-r--r--webkit/data/layout_tests/chrome/fast/dom/window-image-name-conflict-expected.txt1
-rw-r--r--webkit/data/layout_tests/chrome/fast/dom/window-image-name-conflict.html22
-rw-r--r--webkit/port/bindings/v8/v8_custom.cpp32
4 files changed, 39 insertions, 16 deletions
diff --git a/webkit/data/layout_tests/chrome/fast/dom/resources/1.gif b/webkit/data/layout_tests/chrome/fast/dom/resources/1.gif
new file mode 100644
index 0000000..92b3f5b
--- /dev/null
+++ b/webkit/data/layout_tests/chrome/fast/dom/resources/1.gif
Binary files differ
diff --git a/webkit/data/layout_tests/chrome/fast/dom/window-image-name-conflict-expected.txt b/webkit/data/layout_tests/chrome/fast/dom/window-image-name-conflict-expected.txt
new file mode 100644
index 0000000..7ef22e9
--- /dev/null
+++ b/webkit/data/layout_tests/chrome/fast/dom/window-image-name-conflict-expected.txt
@@ -0,0 +1 @@
+PASS
diff --git a/webkit/data/layout_tests/chrome/fast/dom/window-image-name-conflict.html b/webkit/data/layout_tests/chrome/fast/dom/window-image-name-conflict.html
new file mode 100644
index 0000000..2b9d154
--- /dev/null
+++ b/webkit/data/layout_tests/chrome/fast/dom/window-image-name-conflict.html
@@ -0,0 +1,22 @@
+<html>
+<head>
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function runTest() {
+ try {
+ new Image();
+ document.getElementById("result").innerHTML = 'PASS';
+ } catch (e) {
+ // failed
+ }
+}
+</script>
+</head>
+
+<body onload="runTest()">
+<img id="Image" src="resources/1.gif" />
+<div id="result">FAIL</div>
+</body>
+</html>
diff --git a/webkit/port/bindings/v8/v8_custom.cpp b/webkit/port/bindings/v8/v8_custom.cpp
index 205b6c3..a16fd8d 100644
--- a/webkit/port/bindings/v8/v8_custom.cpp
+++ b/webkit/port/bindings/v8/v8_custom.cpp
@@ -1282,20 +1282,6 @@ NAMED_PROPERTY_GETTER(DOMWindow) {
if (!result.IsEmpty())
return result;
- // Search named items in the document.
- Document* doc = frame->document();
- if (doc) {
- RefPtr<HTMLCollection> items = doc->windowNamedItems(prop_name);
- if (items->length() >= 1) {
- if (items->length() == 1) {
- return V8Proxy::ToV8Object(V8ClassIndex::NODE, items->firstItem());
- } else {
- return V8Proxy::ToV8Object(V8ClassIndex::HTMLCOLLECTION,
- static_cast<Peerable*>(items.get()));
- }
- }
- }
-
// Lazy initialization map keeps global properties that can be lazily
// initialized. The value is the code to instantiate the property.
// It must return the value of property after initialization.
@@ -1349,11 +1335,23 @@ NAMED_PROPERTY_GETTER(DOMWindow) {
ASSERT(proxy);
v8::Local<v8::Value> result = proxy->Evaluate(prop_name, 0, code, 0);
- if (result.IsEmpty()) return result;
-
return result;
}
+ // Search named items in the document.
+ Document* doc = frame->document();
+ if (doc) {
+ RefPtr<HTMLCollection> items = doc->windowNamedItems(prop_name);
+ if (items->length() >= 1) {
+ if (items->length() == 1) {
+ return V8Proxy::ToV8Object(V8ClassIndex::NODE, items->firstItem());
+ } else {
+ return V8Proxy::ToV8Object(V8ClassIndex::HTMLCOLLECTION,
+ static_cast<Peerable*>(items.get()));
+ }
+ }
+ }
+
return v8::Handle<v8::Value>();
}
@@ -1415,6 +1413,8 @@ NAMED_PROPERTY_GETTER(HTMLDocument) {
if (!imp->hasNamedItem(key) && !imp->hasDocExtraNamedItem(key)) {
return v8::Handle<v8::Value>();
}
+
+
RefPtr<HTMLCollection> items = imp->documentNamedItems(key);
if (items->length() == 0) return v8::Handle<v8::Value>();
if (items->length() == 1) {