mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1125713 - Browser API: Add event for page download progress, r=fabrice
This commit is contained in:
parent
4da70f1fe2
commit
f2202e383e
@ -113,7 +113,8 @@ BrowserElementChild.prototype = {
|
||||
.addProgressListener(this._progressListener,
|
||||
Ci.nsIWebProgress.NOTIFY_LOCATION |
|
||||
Ci.nsIWebProgress.NOTIFY_SECURITY |
|
||||
Ci.nsIWebProgress.NOTIFY_STATE_WINDOW);
|
||||
Ci.nsIWebProgress.NOTIFY_STATE_WINDOW |
|
||||
Ci.nsIWebProgress.NOTIFY_PROGRESS);
|
||||
|
||||
docShell.QueryInterface(Ci.nsIWebNavigation)
|
||||
.sessionHistory = Cc["@mozilla.org/browser/shistory;1"]
|
||||
@ -1371,8 +1372,12 @@ BrowserElementChild.prototype = {
|
||||
},
|
||||
|
||||
onStatusChange: function(webProgress, request, status, message) {},
|
||||
|
||||
onProgressChange: function(webProgress, request, curSelfProgress,
|
||||
maxSelfProgress, curTotalProgress, maxTotalProgress) {},
|
||||
maxSelfProgress, curTotalProgress, maxTotalProgress) {
|
||||
sendAsyncMsg('loadprogresschanged', { curTotalProgress: curTotalProgress,
|
||||
maxTotalProgress: maxTotalProgress });
|
||||
},
|
||||
},
|
||||
|
||||
// Expose the message manager for WebApps and others.
|
||||
|
@ -181,6 +181,7 @@ BrowserElementParent.prototype = {
|
||||
"hello": this._recvHello,
|
||||
"loadstart": this._fireProfiledEventFromMsg,
|
||||
"loadend": this._fireProfiledEventFromMsg,
|
||||
"loadprogresschanged": this._fireEventFromMsg,
|
||||
"close": this._fireEventFromMsg,
|
||||
"error": this._fireEventFromMsg,
|
||||
"firstpaint": this._fireProfiledEventFromMsg,
|
||||
|
@ -13,7 +13,8 @@ function runTest() {
|
||||
// Load emptypage1 into the iframe, wait for that to finish loading, then
|
||||
// call runTest2.
|
||||
//
|
||||
// This should trigger loadstart, locationchange, and loadend events.
|
||||
// This should trigger loadstart, locationchange, loadprogresschanged and
|
||||
// loadend events.
|
||||
|
||||
var seenLoadEnd = false;
|
||||
var seenLoadStart = false;
|
||||
@ -74,6 +75,7 @@ function runTest2() {
|
||||
var seenLoadStart = false;
|
||||
var seenLoadEnd = false;
|
||||
var seenLocationChange = false;
|
||||
var seenLoadProgressChanged = false;
|
||||
|
||||
// Add this event listener to the document; the events should bubble.
|
||||
document.addEventListener('mozbrowserloadstart', function(e) {
|
||||
@ -103,6 +105,14 @@ function runTest2() {
|
||||
is(e.detail.backgroundColor, 'transparent', 'Expected background color reported')
|
||||
});
|
||||
|
||||
iframe.addEventListener('mozbrowserloadprogresschanged', function(e) {
|
||||
ok(e.isTrusted, 'Event should be trusted.');
|
||||
seenLoadProgressChanged = true;
|
||||
ok(seenLoadStart, 'Load end after load start.');
|
||||
ok(seenLocationChange, 'Load end after location change.');
|
||||
ok(!seenLoadEnd, 'Load end after load progress.');
|
||||
});
|
||||
|
||||
iframe.src = browserElementTestHelpers.emptyPage2;
|
||||
|
||||
function waitForAllCallbacks() {
|
||||
|
Loading…
Reference in New Issue
Block a user