зеркало из https://github.com/mozilla/pjs.git
Add logging to browser_alltabslistener.js to try to track down bug 478241
This commit is contained in:
Родитель
433bee4fa9
Коммит
eca5d4d1bf
|
@ -3,6 +3,10 @@ const Ci = Components.interfaces;
|
|||
const gCompleteState = Ci.nsIWebProgressListener.STATE_STOP +
|
||||
Ci.nsIWebProgressListener.STATE_IS_NETWORK;
|
||||
|
||||
function LOG(str) {
|
||||
dump(str + "\n");
|
||||
}
|
||||
|
||||
var gFrontProgressListener = {
|
||||
onProgressChange: function (aWebProgress, aRequest,
|
||||
aCurSelfProgress, aMaxSelfProgress,
|
||||
|
@ -11,6 +15,7 @@ var gFrontProgressListener = {
|
|||
|
||||
onStateChange: function (aWebProgress, aRequest, aStateFlags, aStatus) {
|
||||
var state = "onStateChange";
|
||||
LOG("FrontProgress: " + state + " 0x" + aStateFlags.toString(16));
|
||||
ok(gFrontNotificationsPos < gFrontNotifications.length, "Got an expected notification for the front notifications listener");
|
||||
is(state, gFrontNotifications[gFrontNotificationsPos], "Got a notification for the front notifications listener");
|
||||
gFrontNotificationsPos++;
|
||||
|
@ -18,6 +23,7 @@ var gFrontProgressListener = {
|
|||
|
||||
onLocationChange: function (aWebProgress, aRequest, aLocationURI) {
|
||||
var state = "onLocationChange";
|
||||
LOG("FrontProgress: " + state + " " + aLocationURI.spec);
|
||||
ok(gFrontNotificationsPos < gFrontNotifications.length, "Got an expected notification for the front notifications listener");
|
||||
is(state, gFrontNotifications[gFrontNotificationsPos], "Got a notification for the front notifications listener");
|
||||
gFrontNotificationsPos++;
|
||||
|
@ -28,6 +34,7 @@ var gFrontProgressListener = {
|
|||
|
||||
onSecurityChange: function (aWebProgress, aRequest, aState) {
|
||||
var state = "onSecurityChange";
|
||||
LOG("FrontProgress: " + state + " 0x" + aState.toString(16));
|
||||
ok(gFrontNotificationsPos < gFrontNotifications.length, "Got an expected notification for the front notifications listener");
|
||||
is(state, gFrontNotifications[gFrontNotificationsPos], "Got a notification for the front notifications listener");
|
||||
gFrontNotificationsPos++;
|
||||
|
@ -42,6 +49,7 @@ var gAllProgressListener = {
|
|||
|
||||
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
|
||||
var state = "onStateChange";
|
||||
LOG("AllProgress: " + state + " 0x" + aStateFlags.toString(16));
|
||||
ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
|
||||
ok(gAllNotificationsPos < gAllNotifications.length, "Got an expected notification for the all notifications listener");
|
||||
is(state, gAllNotifications[gAllNotificationsPos], "Got a notification for the all notifications listener");
|
||||
|
@ -56,6 +64,7 @@ var gAllProgressListener = {
|
|||
|
||||
onLocationChange: function (aBrowser, aWebProgress, aRequest, aLocationURI) {
|
||||
var state = "onLocationChange";
|
||||
LOG("AllProgress: " + state + " " + aLocationURI.spec);
|
||||
ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
|
||||
ok(gAllNotificationsPos < gAllNotifications.length, "Got an expected notification for the all notifications listener");
|
||||
is(state, gAllNotifications[gAllNotificationsPos], "Got a notification for the all notifications listener");
|
||||
|
@ -69,6 +78,7 @@ var gAllProgressListener = {
|
|||
|
||||
onSecurityChange: function (aBrowser, aWebProgress, aRequest, aState) {
|
||||
var state = "onSecurityChange";
|
||||
LOG("AllProgress: " + state + " 0x" + aState.toString(16));
|
||||
ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
|
||||
ok(gAllNotificationsPos < gAllNotifications.length, "Got an expected notification for the all notifications listener");
|
||||
is(state, gAllNotifications[gAllNotificationsPos], "Got a notification for the all notifications listener");
|
||||
|
@ -82,6 +92,7 @@ var gTestPage = "/browser/browser/base/content/test/alltabslistener.html";
|
|||
var gNextTest;
|
||||
|
||||
function test() {
|
||||
LOG("Running tests from alltabslistener.js");
|
||||
waitForExplicitFinish();
|
||||
|
||||
gBackgroundTab = gBrowser.addTab("about:blank");
|
||||
|
@ -109,6 +120,7 @@ function startTests() {
|
|||
}
|
||||
|
||||
function startTest1() {
|
||||
LOG("\nTest 1");
|
||||
gBrowser.addProgressListener(gFrontProgressListener);
|
||||
gBrowser.addTabsProgressListener(gAllProgressListener);
|
||||
|
||||
|
@ -123,6 +135,7 @@ function startTest1() {
|
|||
}
|
||||
|
||||
function startTest2() {
|
||||
LOG("\nTest 2");
|
||||
gAllNotifications = [
|
||||
"onStateChange",
|
||||
"onLocationChange",
|
||||
|
@ -135,6 +148,7 @@ function startTest2() {
|
|||
}
|
||||
|
||||
function startTest3() {
|
||||
LOG("\nTest 3");
|
||||
gAllNotifications = [
|
||||
"onStateChange",
|
||||
"onLocationChange",
|
||||
|
@ -146,6 +160,7 @@ function startTest3() {
|
|||
}
|
||||
|
||||
function startTest4() {
|
||||
LOG("\nTest 4");
|
||||
gAllNotifications = [
|
||||
"onStateChange",
|
||||
"onLocationChange",
|
||||
|
@ -158,6 +173,7 @@ function startTest4() {
|
|||
}
|
||||
|
||||
function startTest5() {
|
||||
LOG("\nTest 5");
|
||||
// Switch the foreground browser
|
||||
[gForegroundBrowser, gBackgroundBrowser] = [gBackgroundBrowser, gForegroundBrowser];
|
||||
[gForegroundTab, gBackgroundTab] = [gBackgroundTab, gForegroundTab];
|
||||
|
@ -177,6 +193,7 @@ function startTest5() {
|
|||
}
|
||||
|
||||
function startTest6() {
|
||||
LOG("\nTest 6");
|
||||
gAllNotifications = [
|
||||
"onStateChange",
|
||||
"onLocationChange",
|
||||
|
@ -188,6 +205,7 @@ function startTest6() {
|
|||
}
|
||||
|
||||
function finishTest() {
|
||||
LOG("\nFinished tests from alltabslistener.js");
|
||||
gBrowser.removeProgressListener(gFrontProgressListener);
|
||||
gBrowser.removeTabsProgressListener(gAllProgressListener);
|
||||
gBrowser.removeTab(gBackgroundTab);
|
||||
|
|
Загрузка…
Ссылка в новой задаче