Commit 163877f8 authored by law%netscape.com's avatar law%netscape.com
Browse files

Hopefully a fix for bug #4779

parent 38afad7a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1177,7 +1177,10 @@ nsFileDownloadDialog::AttributeChanged( nsIDocument *aDocument,
    if ( id == "data.execute" ) {
        nsString cmd;
        nsCOMPtr<nsIAtom> atomCommand = nsDontQueryInterface<nsIAtom>( NS_NewAtom("command") );
        // Get requested command.
        aContent->GetAttribute( kNameSpaceID_None, atomCommand, cmd );
        // Reset (immediately, to prevent feedback loop).
        aContent->SetAttribute( kNameSpaceID_None, atomCommand, "", PR_FALSE );
        if ( cmd == "ok" ) {
            OnOK( aContent );
        } else if ( cmd == "start" ) {
@@ -1188,7 +1191,6 @@ nsFileDownloadDialog::AttributeChanged( nsIDocument *aDocument,
            OnClose();
        } else {
        }
        aContent->SetAttribute( kNameSpaceID_None, atomCommand, "", PR_FALSE );
    }

    return rv;
+16 −7
Original line number Diff line number Diff line
@@ -57,16 +57,22 @@
            data.execute.setAttribute("command","start");
        }

        function stop() {
            // Stop the download.
            data.execute.setAttribute("command","stop");
        }

        var started = false;
        var completed = false;
        var startTime;
        var interval = 1000; // Update every 1000 milliseconds.
        var lastUpdate = -interval; // Update initially.

        function stop() {
            if ( started &amp;&amp; !completed ) {
                // Stop the download.
                data.execute.setAttribute( "command", "stop" );
            } else {
                // Close the window.
                data.execute.setAttribute( "command", "close" );
            }
        }

        function onProgress() {
            // Check for first time.
            if ( !started ) {
@@ -140,7 +146,10 @@
        }

        function onCompletion() {
            dialog.cancel.setAttribute( "disabled", "" );
            if ( !completed ) {
                completed = true;
                data.execute.setAttribute( "command", "close" );
            }
        }
    </html:script>

@@ -198,7 +207,7 @@

        <html:tr>
            <html:td align="center" colspan="2">
                <html:button id="dialog.cancel" onclick="stop()" disabled="">Cancel</html:button>
                <html:button id="dialog.cancel" onclick="stop()">Cancel</html:button>
            </html:td>
        </html:tr>