Commit 687069ee authored by beidson@apple.com's avatar beidson@apple.com

WebCore:

2008-07-07  Brady Eidson  <beidson@apple.com>

        Reviewed by Mitz and Geoff

        Test: fast/loader/empty-ref-versus-no-ref.html

        Fix for https://bugs.webkit.org/show_bug.cgi?id=18951 and <rdar://problem/5921760>
        "all DOM operations stop working when location.hash set to '#'"

        The underlying problem is that KURL didn't really know the difference between "empty ref"
        and "no ref at all" when changing the ref.  So changing to the empty ref in JS ended up 
        affecting removal of the ref, which ended up causing an infinite load load, also killing
        javascript.

        * platform/KURL.cpp:
        (WebCore::KURL::setRef):  Changed "isEmpty()" to "isNull()", since NULL has the special 
          meaning of "no ref at all" while empty means "empty ref"

LayoutTests:

2008-07-07  Brady Eidson  <beidson@apple.com>

        Reviewed by Mitz and Geoff

        Test the fix for https://bugs.webkit.org/show_bug.cgi?id=18951 and <rdar://problem/5921760>

        * fast/loader/empty-ref-versus-no-ref-expected.txt: Added.
        * fast/loader/empty-ref-versus-no-ref.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@35040 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1e1baa1f
2008-07-07 Brady Eidson <beidson@apple.com>
Reviewed by Mitz and Geoff
Test the fix for https://bugs.webkit.org/show_bug.cgi?id=18951 and <rdar://problem/5921760>
* fast/loader/empty-ref-versus-no-ref-expected.txt: Added.
* fast/loader/empty-ref-versus-no-ref.html: Added.
2008-07-07 Nikolas Zimmermann <zimmermann@kde.org>
Reviewed by Antti.
Test for https://bugs.webkit.org/show_bug.cgi?id=18951
WebKit used to be confused when setting the ref to an empty anchor from a non-empty anchor, causing all sorts of weird loading behavior.
Not anymore!
anchor has been set
anchor has been removed
<html>
<head>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function runTest() {
window.location.hash = '#foobarbaz';
var node = document.createElement('div');
node.innerHTML = 'anchor has been set';
document.body.appendChild(node);
window.location.hash = '#';
var node = document.createElement('div');
node.innerHTML = 'anchor has been removed';
document.body.appendChild(node);
}
</script>
</head>
<body onload='runTest()'>
Test for https://bugs.webkit.org/show_bug.cgi?id=18951<br>
WebKit used to be confused when setting the ref to an empty anchor from a non-empty anchor, causing all sorts of weird loading behavior.<br>
Not anymore!<br>
</body>
</html>
2008-07-07 Brady Eidson <beidson@apple.com>
Reviewed by Mitz and Geoff
Test: fast/loader/empty-ref-versus-no-ref.html
Fix for https://bugs.webkit.org/show_bug.cgi?id=18951 and <rdar://problem/5921760>
"all DOM operations stop working when location.hash set to '#'"
The underlying problem is that KURL didn't really know the difference between "empty ref"
and "no ref at all" when changing the ref. So changing to the empty ref in JS ended up
affecting removal of the ref, which ended up causing an infinite load load, also killing
javascript.
* platform/KURL.cpp:
(WebCore::KURL::setRef): Changed "isEmpty()" to "isNull()", since NULL has the special
meaning of "no ref at all" while empty means "empty ref"
2008-07-07 Kevin McCullough <kmccullough@apple.com>
Reviewed by Darin.
......@@ -705,7 +705,7 @@ void KURL::setRef(const String& s)
{
if (!m_isValid)
return;
parse(m_string.left(m_queryEnd) + (s.isEmpty() ? "" : "#" + s));
parse(m_string.left(m_queryEnd) + (s.isNull() ? "" : "#" + s));
}
void KURL::setQuery(const String& query)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment