mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1175306 fix metadata url for hello and share, r=markh
This commit is contained in:
parent
f8246cd713
commit
0dedf92a3c
@ -351,6 +351,7 @@ skip-if = buildapp == 'mulet' || e10s # Bug 1101973 - breaks the next test in e1
|
||||
skip-if = buildapp == 'mulet'
|
||||
[browser_private_no_prompt.js]
|
||||
skip-if = buildapp == 'mulet'
|
||||
[browser_PageMetaData_pushstate.js]
|
||||
[browser_relatedTabs.js]
|
||||
[browser_remoteTroubleshoot.js]
|
||||
support-files =
|
||||
|
@ -0,0 +1,32 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let rooturi = "https://example.com/browser/toolkit/modules/tests/browser/";
|
||||
yield BrowserTestUtils.openNewForegroundTab(gBrowser, rooturi + "metadata_simple.html");
|
||||
let result = yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
return PageMetadata.getData(content.document);
|
||||
});
|
||||
// result should have description
|
||||
is(result.url, rooturi + "metadata_simple.html", "metadata url is correct");
|
||||
is(result.title, "Test Title", "metadata title is correct");
|
||||
is(result.description, "A very simple test page", "description is correct");
|
||||
|
||||
result = yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
content.history.pushState({}, "2", "2.html");
|
||||
return PageMetadata.getData(content.document);
|
||||
});
|
||||
// result should not have description
|
||||
is(result.url, rooturi + "2.html", "metadata url is correct");
|
||||
is(result.title, "Test Title", "metadata title is correct");
|
||||
ok(!result.description, "description is undefined");
|
||||
|
||||
let documentURI = yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
return content.document.documentURI;
|
||||
});
|
||||
is(gBrowser.currentURI.spec, rooturi + "2.html", "gBrowser has correct url");
|
||||
is(documentURI, rooturi + "2.html", "content.document has correct url");
|
||||
|
||||
gBrowser.removeTab(gBrowser.selectedTab);
|
||||
});
|
@ -50,6 +50,21 @@ this.PageMetadata = {
|
||||
previews: [],
|
||||
};
|
||||
|
||||
// if pushState was used to change the url, most likely all meta data is
|
||||
// invalid. This is the case with several major sites that rely on
|
||||
// pushState. In that case, we'll only return uri and title. If document is
|
||||
// via XHR or something, there is no view or history.
|
||||
if (document.defaultView) {
|
||||
let docshell = document.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShell);
|
||||
let shentry = {};
|
||||
if (docshell.getCurrentSHEntry(shentry) &&
|
||||
shentry.value && shentry.value.URIWasModified) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
this._getMetaData(document, result);
|
||||
this._getLinkData(document, result);
|
||||
this._getPageData(document, result);
|
||||
|
Loading…
Reference in New Issue
Block a user