mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 380454, r=benjamin, sr=sicking
This commit is contained in:
parent
06df26de53
commit
d9c6b362ae
@ -13,8 +13,7 @@ function test() {
|
||||
setTimeout(iconDiscovery, 1000);
|
||||
}
|
||||
|
||||
function iconDiscovery() {
|
||||
var tests = [
|
||||
var iconDiscoveryTests = [
|
||||
{ text: "rel icon discovered" },
|
||||
{ rel: "abcdefg icon qwerty", text: "rel may contain additional rels separated by spaces" },
|
||||
{ rel: "ICON", text: "rel is case insensitive" },
|
||||
@ -23,12 +22,27 @@ function iconDiscovery() {
|
||||
{ href: "notthere.png", text: "404'd icon is removed properly" },
|
||||
{ href: "data:image/x-icon,%00", type: "image/x-icon", text: "data: URIs work" },
|
||||
{ type: "image/png; charset=utf-8", text: "type may have optional parameters (RFC2046)" }
|
||||
];
|
||||
];
|
||||
|
||||
for (let i = 0; i < tests.length; i++) {
|
||||
function runIconDiscoveryTest() {
|
||||
var test = iconDiscoveryTests[0];
|
||||
var head = gTestPage.document.getElementById("linkparent");
|
||||
var hasSrc = gProxyFavIcon.hasAttribute("src");
|
||||
if (test.pass)
|
||||
ok(hasSrc, test.text);
|
||||
else
|
||||
ok(!hasSrc, test.text);
|
||||
|
||||
head.removeChild(head.getElementsByTagName('link')[0]);
|
||||
iconDiscoveryTests.shift();
|
||||
setTimeout(iconDiscovery, 0) // Run the next test.
|
||||
}
|
||||
|
||||
function iconDiscovery() {
|
||||
if (iconDiscoveryTests.length) {
|
||||
gProxyFavIcon.removeAttribute("src");
|
||||
|
||||
var test = tests[i];
|
||||
var test = iconDiscoveryTests[0];
|
||||
var head = gTestPage.document.getElementById("linkparent");
|
||||
var link = gTestPage.document.createElement("link");
|
||||
|
||||
@ -43,19 +57,13 @@ function iconDiscovery() {
|
||||
link.type = type;
|
||||
head.appendChild(link);
|
||||
|
||||
var hasSrc = gProxyFavIcon.hasAttribute("src");
|
||||
if (test.pass)
|
||||
ok(hasSrc, test.text);
|
||||
else
|
||||
ok(!hasSrc, test.text);
|
||||
|
||||
head.removeChild(link);
|
||||
}
|
||||
setTimeout(runIconDiscoveryTest, 0);
|
||||
} else {
|
||||
searchDiscovery();
|
||||
}
|
||||
}
|
||||
|
||||
function searchDiscovery() {
|
||||
var tests = [
|
||||
var searchDiscoveryTests = [
|
||||
{ text: "rel search discovered" },
|
||||
{ rel: "SEARCH", text: "rel is case insensitive" },
|
||||
{ rel: "-search-", pass: false, text: "rel -search- not discovered" },
|
||||
@ -69,28 +77,12 @@ function searchDiscovery() {
|
||||
{ type: "application/opensearchdescription+xml; charset=utf-8", text: "type may have optional parameters (RFC2046)" },
|
||||
{ type: "aapplication/opensearchdescription+xml", pass: false, text: "type should not be loosely matched" },
|
||||
{ rel: "search search search", count: 1, text: "only one engine should be added" }
|
||||
];
|
||||
];
|
||||
|
||||
var head = gTestPage.document.getElementById("linkparent");
|
||||
function runSearchDiscoveryTest() {
|
||||
var browser = gBrowser.getBrowserForDocument(gTestPage.document);
|
||||
|
||||
for (let i = 0; i < tests.length; i++) {
|
||||
var test = tests[i];
|
||||
var link = gTestPage.document.createElement("link");
|
||||
|
||||
var rel = test.rel || "search";
|
||||
var href = test.href || "http://so.not.here.mozilla.com/search.xml";
|
||||
var type = test.type || "application/opensearchdescription+xml";
|
||||
var title = test.title || i;
|
||||
if (test.pass == undefined)
|
||||
test.pass = true;
|
||||
|
||||
link.rel = rel;
|
||||
link.href = href;
|
||||
link.type = type;
|
||||
link.title = title;
|
||||
head.appendChild(link);
|
||||
|
||||
var test = searchDiscoveryTests[0];
|
||||
var title = test.title || searchDiscoveryTests.length;
|
||||
if (browser.engines) {
|
||||
var hasEngine = (test.count) ? (browser.engines[0].title == title &&
|
||||
browser.engines.length == test.count) :
|
||||
@ -100,8 +92,44 @@ function searchDiscovery() {
|
||||
}
|
||||
else
|
||||
ok(!test.pass, test.text);
|
||||
}
|
||||
|
||||
searchDiscoveryTests.shift();
|
||||
setTimeout(searchDiscovery, 0) // Run the next test.
|
||||
}
|
||||
|
||||
function runMultipleEnginesTestAndFinalize() {
|
||||
var browser = gBrowser.getBrowserForDocument(gTestPage.document);
|
||||
ok(browser.engines, "has engines");
|
||||
is(browser.engines.length, 1, "only one engine");
|
||||
is(browser.engines[0].uri, "http://first.mozilla.com/search.xml", "first engine wins");
|
||||
|
||||
gTestPage.close();
|
||||
finish();
|
||||
}
|
||||
|
||||
function searchDiscovery() {
|
||||
var head = gTestPage.document.getElementById("linkparent");
|
||||
var browser = gBrowser.getBrowserForDocument(gTestPage.document);
|
||||
|
||||
if (searchDiscoveryTests.length) {
|
||||
var test = searchDiscoveryTests[0];
|
||||
var link = gTestPage.document.createElement("link");
|
||||
|
||||
var rel = test.rel || "search";
|
||||
var href = test.href || "http://so.not.here.mozilla.com/search.xml";
|
||||
var type = test.type || "application/opensearchdescription+xml";
|
||||
var title = test.title || searchDiscoveryTests.length;
|
||||
if (test.pass == undefined)
|
||||
test.pass = true;
|
||||
|
||||
link.rel = rel;
|
||||
link.href = href;
|
||||
link.type = type;
|
||||
link.title = title;
|
||||
head.appendChild(link);
|
||||
|
||||
setTimeout(runSearchDiscoveryTest, 0);
|
||||
} else {
|
||||
// Test multiple engines with the same title
|
||||
var link = gTestPage.document.createElement("link");
|
||||
link.rel = "search";
|
||||
@ -114,10 +142,6 @@ function searchDiscovery() {
|
||||
head.appendChild(link);
|
||||
head.appendChild(link2);
|
||||
|
||||
ok(browser.engines, "has engines");
|
||||
is(browser.engines.length, 1, "only one engine");
|
||||
is(browser.engines[0].uri, "http://first.mozilla.com/search.xml", "first engine wins");
|
||||
|
||||
gTestPage.close();
|
||||
finish();
|
||||
setTimeout(runMultipleEnginesTestAndFinalize, 0);
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include "nsParserUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsPLDOMEvent.h"
|
||||
|
||||
class nsHTMLLinkElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLLinkElement,
|
||||
@ -273,9 +274,10 @@ nsHTMLLinkElement::CreateAndDispatchEvent(nsIDocument* aDoc,
|
||||
strings, eIgnoreCase) != ATTR_VALUE_NO_MATCH)
|
||||
return;
|
||||
|
||||
nsContentUtils::DispatchTrustedEvent(aDoc,
|
||||
static_cast<nsIContent*>(this),
|
||||
aEventName, PR_TRUE, PR_TRUE);
|
||||
nsRefPtr<nsPLDOMEvent> event = new nsPLDOMEvent(this, aEventName);
|
||||
if (event) {
|
||||
event->PostDOMEvent();
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -136,7 +136,7 @@ NS_DispatchToCurrentThread(nsIRunnable *event)
|
||||
{
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
nsIThread *thread = NS_GetCurrentThread();
|
||||
NS_ENSURE_STATE(thread);
|
||||
if (!thread) { return NS_ERROR_UNEXPECTED; }
|
||||
#else
|
||||
nsCOMPtr<nsIThread> thread;
|
||||
nsresult rv = NS_GetCurrentThread(getter_AddRefs(thread));
|
||||
|
@ -200,6 +200,10 @@ nsThreadManager::GetCurrentThread()
|
||||
if (data)
|
||||
return static_cast<nsThread *>(data);
|
||||
|
||||
if (!mInitialized) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// OK, that's fine. We'll dynamically create one :-)
|
||||
nsRefPtr<nsThread> thread = new nsThread();
|
||||
if (!thread || NS_FAILED(thread->InitCurrentThread()))
|
||||
|
@ -69,7 +69,8 @@ public:
|
||||
// method must be called when the given thread is the current thread.
|
||||
void UnregisterCurrentThread(nsThread *thread);
|
||||
|
||||
// Returns the current thread. Returns null if OOM.
|
||||
// Returns the current thread. Returns null if OOM or if ThreadManager isn't
|
||||
// initialized.
|
||||
nsThread *GetCurrentThread();
|
||||
|
||||
// This needs to be public in order to support static instantiation of this
|
||||
|
Loading…
Reference in New Issue
Block a user