@@ -2953,10 +2953,10 @@ index 0000000000000000000000000000000000000000..268fbc361d8053182bb6c27f626e853d
2953
2953
+
2954
2954
diff --git a/juggler/content/FrameTree.js b/juggler/content/FrameTree.js
2955
2955
new file mode 100644
2956
- index 0000000000000000000000000000000000000000..5a1df2837d70531a670163b7c860108895bc9106
2956
+ index 0000000000000000000000000000000000000000..8a87dabd37e83cba0f1dfac07d8fd18875c042ef
2957
2957
--- /dev/null
2958
2958
+++ b/juggler/content/FrameTree.js
2959
- @@ -0,0 +1,462 @@
2959
+ @@ -0,0 +1,471 @@
2960
2960
+ "use strict";
2961
2961
+ const Ci = Components.interfaces;
2962
2962
+ const Cr = Components.results;
@@ -3149,12 +3149,19 @@ index 0000000000000000000000000000000000000000..5a1df2837d70531a670163b7c8601088
3149
3149
+ const isTransferring = flag & Ci.nsIWebProgressListener.STATE_TRANSFERRING;
3150
3150
+ const isStop = flag & Ci.nsIWebProgressListener.STATE_STOP;
3151
3151
+
3152
+ + let isDownload = false;
3153
+ + try {
3154
+ + isDownload = (channel.contentDisposition === Ci.nsIChannel.DISPOSITION_ATTACHMENT);
3155
+ + } catch(e) {
3156
+ + // The method is expected to throw if it's not an attachment.
3157
+ + }
3158
+ +
3152
3159
+ if (isStart) {
3153
3160
+ // Starting a new navigation.
3154
3161
+ frame._pendingNavigationId = this._channelId(channel);
3155
3162
+ frame._pendingNavigationURL = channel.URI.spec;
3156
3163
+ this.emit(FrameTree.Events.NavigationStarted, frame);
3157
- + } else if (isTransferring || (isStop && frame._pendingNavigationId && !status)) {
3164
+ + } else if (isTransferring || (isStop && frame._pendingNavigationId && !status && !isDownload )) {
3158
3165
+ // Navigation is committed.
3159
3166
+ for (const subframe of frame._children)
3160
3167
+ this._detachFrame(subframe);
@@ -3166,12 +3173,14 @@ index 0000000000000000000000000000000000000000..5a1df2837d70531a670163b7c8601088
3166
3173
+ this.emit(FrameTree.Events.NavigationCommitted, frame);
3167
3174
+ if (frame === this._mainFrame)
3168
3175
+ this.forcePageReady();
3169
- + } else if (isStop && frame._pendingNavigationId && status) {
3176
+ + } else if (isStop && frame._pendingNavigationId && ( status || isDownload) ) {
3170
3177
+ // Navigation is aborted.
3171
3178
+ const navigationId = frame._pendingNavigationId;
3172
3179
+ frame._pendingNavigationId = null;
3173
3180
+ frame._pendingNavigationURL = null;
3174
- + this.emit(FrameTree.Events.NavigationAborted, frame, navigationId, helper.getNetworkErrorStatusText(status));
3181
+ + // Always report download navigation as failure to match other browsers.
3182
+ + const errorText = isDownload ? 'Will download to file' : helper.getNetworkErrorStatusText(status);
3183
+ + this.emit(FrameTree.Events.NavigationAborted, frame, navigationId, errorText);
3175
3184
+ }
3176
3185
+ }
3177
3186
+
0 commit comments