Commit c4e6f044 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Implement HTMLLocation_put_hash.

parent b1fd8dae
......@@ -524,8 +524,29 @@ static HRESULT WINAPI HTMLLocation_get_search(IHTMLLocation *iface, BSTR *p)
static HRESULT WINAPI HTMLLocation_put_hash(IHTMLLocation *iface, BSTR v)
{
HTMLLocation *This = impl_from_IHTMLLocation(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
WCHAR *hash = v;
HRESULT hres;
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
if(!This->window || !This->window->base.outer_window) {
FIXME("No window available\n");
return E_FAIL;
}
if(hash[0] != '#') {
unsigned size = (1 /* # */ + wcslen(v) + 1) * sizeof(WCHAR);
if(!(hash = heap_alloc(size)))
return E_OUTOFMEMORY;
hash[0] = '#';
memcpy(hash + 1, v, size - sizeof(WCHAR));
}
hres = navigate_url(This->window->base.outer_window, hash, This->window->base.outer_window->uri, BINDING_NAVIGATED);
if(hash != v)
heap_free(hash);
return hres;
}
static HRESULT WINAPI HTMLLocation_get_hash(IHTMLLocation *iface, BSTR *p)
......
......@@ -895,6 +895,18 @@ async_test("script_load", function() {
external.writeStream("simple", "ready_states += 'exec,';");
});
sync_test("location", function() {
document.body.innerHTML = '<a name="testanchor">test</a>';
ok(location.hash === "", "initial location.hash = " + location.hash);
location.hash = "TestAnchor";
ok(location.hash === "#TestAnchor", "location.hash after set to TestAnchor = " + location.hash);
location.hash = "##foo";
ok(location.hash === "##foo", "location.hash after set to ##foo = " + location.hash);
location.hash = "#testanchor";
ok(location.hash === "#testanchor", "location.hash after set to #testanchor = " + location.hash);
});
sync_test("navigator", function() {
var v = document.documentMode, re;
var app = navigator.appVersion;
......
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