https://bugs.webkit.org/show_bug.cgi?id=79409
Reviewed by Adam Barth.
Source/WebCore:
The original change already included the code, but it led to some
problems, so it was reverted in http://trac.webkit.org/changeset/63845.
However, not removing the items leaks a considerable amount of memory,
so I'm adding the code back. The bug that led to the revert was that
the accessor was removed unconditionally. I'm now only removing it,
when the last item with that name is removed.
Test: fast/dom/HTMLDocument/named-item.html
* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::V8DOMWindowShell::namedItemRemoved):
LayoutTests:
* fast/dom/HTMLDocument/named-item-expected.txt: Added.
* fast/dom/HTMLDocument/named-item.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108780
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-24 Jochen Eisinger <jochen@chromium.org>
+
+ [v8] when a named item on document goes out of scope, actually remove it
+ https://bugs.webkit.org/show_bug.cgi?id=79409
+
+ Reviewed by Adam Barth.
+
+ * fast/dom/HTMLDocument/named-item-expected.txt: Added.
+ * fast/dom/HTMLDocument/named-item.html: Added.
+
2012-02-24 Flex Mobile <rhauck@adobe.com>
Convert some fast/regions pixel tests to reftests
--- /dev/null
+Tests that the named item created for an image with an ID is correctly removed. The test passes, if you see a "PASS" message in the div below.
+
+PASS
--- /dev/null
+<html>
+<head>
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function test() {
+ var div = document.getElementById("testdiv");
+ var img = document.createElement("img");
+ img.id = "testimg";
+ div.appendChild(img);
+ div.innerHTML = "";
+ if ("testimg" in document)
+ div.innerText = "FAIL: named item was not removed";
+ else
+ div.innerText = "PASS";
+}
+</script>
+</head>
+<body onload="test()">
+<p>
+Tests that the named item created for an image with an ID is correctly removed.
+The test passes, if you see a "PASS" message in the div below.
+</p>
+<div id="testdiv"></div>
+</body>
+</html>
+
+2012-02-24 Jochen Eisinger <jochen@chromium.org>
+
+ [v8] when a named item on document goes out of scope, actually remove it
+ https://bugs.webkit.org/show_bug.cgi?id=79409
+
+ Reviewed by Adam Barth.
+
+ The original change already included the code, but it led to some
+ problems, so it was reverted in http://trac.webkit.org/changeset/63845.
+ However, not removing the items leaks a considerable amount of memory,
+ so I'm adding the code back. The bug that led to the revert was that
+ the accessor was removed unconditionally. I'm now only removing it,
+ when the last item with that name is removed.
+
+ Test: fast/dom/HTMLDocument/named-item.html
+
+ * bindings/v8/V8DOMWindowShell.cpp:
+ (WebCore::V8DOMWindowShell::namedItemRemoved):
+
2012-02-24 Kentaro Hara <haraken@chromium.org>
Move Worker-related APIs from DOMWindow.idl to DOMWindowWorker.idl
void V8DOMWindowShell::namedItemRemoved(HTMLDocument* doc, const AtomicString& name)
{
+ if (doc->hasNamedItem(name.impl()) || doc->hasExtraNamedItem(name.impl()))
+ return;
+
+ if (!initContextIfNeeded())
+ return;
+
+ v8::HandleScope handleScope;
+ v8::Context::Scope contextScope(m_context);
+
+ ASSERT(!m_document.IsEmpty());
+ checkDocumentWrapper(m_document, doc);
+ m_document->Delete(v8String(name));
}
void V8DOMWindowShell::updateSecurityOrigin()