Bug 450450. Add some debugging output to try to fix random orange in test_loadflags.html.
This commit is contained in:
Родитель
b7383fd8ec
Коммит
9d4d8f4611
|
@ -7,11 +7,11 @@
|
|||
document.cookie = "can=has";
|
||||
|
||||
// send a message to our test document, to say we're done loading
|
||||
window.opener.postMessage("f_lf_i msg data", "http://mochi.test:8888");
|
||||
window.opener.postMessage("f_lf_i msg data img", "http://mochi.test:8888");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<body onload="window.opener.postMessage('f_lf_i msg data page', 'http://mochi.test:8888');">
|
||||
<img src="http://example.org/tests/extensions/cookie/test/image1.png" onload="runTest()" />
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -10,6 +10,9 @@ var gLoads = 0;
|
|||
|
||||
// setupTest() is run from 'onload='.
|
||||
function setupTest(uri, domain, cookies, loads, headers) {
|
||||
ok(true, "setupTest uri: " + uri + " domain: " + domain + " cookies: " + cookies +
|
||||
" loads: " + loads + " headers: " + headers);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
@ -53,6 +56,8 @@ function finishTest()
|
|||
function obs () {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
ok(true, "adding observer");
|
||||
|
||||
this.window = window;
|
||||
this.os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
|
@ -65,12 +70,28 @@ obs.prototype = {
|
|||
this.window.netscape.security
|
||||
.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
ok(true, "theSubject " + theSubject);
|
||||
ok(true, "theTopic " + theTopic);
|
||||
ok(true, "theData " + theData);
|
||||
|
||||
var channel = theSubject.QueryInterface(
|
||||
this.window.Components.interfaces.nsIHttpChannel);
|
||||
ok(true, "channel " + channel);
|
||||
try {
|
||||
ok(true, "channel.URI " + channel.URI);
|
||||
ok(true, "channel.URI.spec " + channel.URI.spec);
|
||||
channel.visitRequestHeaders({
|
||||
visitHeader: function(aHeader, aValue) {
|
||||
ok(true, aHeader + ": " + aValue);
|
||||
}});
|
||||
} catch (err) {
|
||||
ok(false, "catch error " + err);
|
||||
}
|
||||
|
||||
// Ignore notifications we don't care about (like favicons)
|
||||
if (channel.URI.spec.indexOf(
|
||||
"http://example.org/tests/extensions/cookie/test/") == -1) {
|
||||
ok(true, "ignoring this one");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -83,6 +104,8 @@ obs.prototype = {
|
|||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
ok(true, "removing observer");
|
||||
|
||||
this.os.removeObserver(this, "http-on-modify-request");
|
||||
this.os = null;
|
||||
this.window = null;
|
||||
|
@ -93,8 +116,16 @@ obs.prototype = {
|
|||
// Count and check loads.
|
||||
function messageReceiver(evt)
|
||||
{
|
||||
is(evt.data, "f_lf_i msg data", "message data received from popup");
|
||||
if (evt.data != "f_lf_i msg data") {
|
||||
ok(evt.data == "f_lf_i msg data img" || evt.data == "f_lf_i msg data page",
|
||||
"message data received from popup");
|
||||
if (evt.data == "f_lf_i msg data img") {
|
||||
ok(true, "message data received from popup for image");
|
||||
}
|
||||
if (evt.data == "f_lf_i msg data page") {
|
||||
ok(true, "message data received from popup for page");
|
||||
}
|
||||
if (evt.data != "f_lf_i msg data img" && evt.data != "f_lf_i msg data page") {
|
||||
ok(true, "got this message but don't know what it is " + evt.data);
|
||||
gPopup.close();
|
||||
window.removeEventListener("message", messageReceiver, false);
|
||||
|
||||
|
@ -124,8 +155,14 @@ function runTest() {
|
|||
var cs = Components.classes["@mozilla.org/cookiemanager;1"]
|
||||
.getService(Components.interfaces.nsICookieManager);
|
||||
var count = 0;
|
||||
for(var list = cs.enumerator; list.hasMoreElements(); list.getNext())
|
||||
var list = cs.enumerator;
|
||||
while (list.hasMoreElements()) {
|
||||
var cookie = list.getNext().QueryInterface(Components.interfaces.nsICookie);
|
||||
ok(true, "cookie: " + cookie);
|
||||
ok(true, "cookie host " + cookie.host + " path " + cookie.path + " name " + cookie.name +
|
||||
" value " + cookie.value + " isSecure " + cookie.isSecure + " expires " + cookie.expires);
|
||||
++count;
|
||||
}
|
||||
is(count, gExpectedCookies, "total number of cookies");
|
||||
cs.removeAll();
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*1 load: file_loadflags_inner.html.
|
||||
*2 headers: 1 for file_loadflags_inner.html + 1 for image1.png.
|
||||
-->
|
||||
<body onload="setupTest('http://example.org/tests/extensions/cookie/test/file_loadflags_inner.html', 'example.org', 5, 1, 2)">
|
||||
<body onload="setupTest('http://example.org/tests/extensions/cookie/test/file_loadflags_inner.html', 'example.org', 5, 2, 2)">
|
||||
<p id="display"></p>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript" src="file_testloadflags.js">
|
||||
|
|
Загрузка…
Ссылка в новой задаче