third_party/js/mozmill/shared-modules/downloads.js
function(controller, url) {
  controller.open(url);

  // Wait until the unknown content type dialog has been opened
  controller.waitForEval("subject.getMostRecentWindow('').document.documentElement.id == 'unknownContentType'",
                         gTimeout, 100, mozmill.wm);

  utils.handleWindow("type", "", function (controller) {
    // Select to save the file directly
    var saveFile = new elementslib.ID(controller.window.document, "save");
    controller.waitThenClick(saveFile, gTimeout);
    controller.waitForEval("subject.selected == true", gTimeout, 100,
                           saveFile.getNode());
  
    // Wait until the OK button has been enabled and click on it
    var button = new elementslib.Lookup(controller.window.document,
                                        '/id("unknownContentType")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}');
    controller.waitForElement(button, gTimeout);
    controller.waitForEval("subject.okButton.hasAttribute('disabled') == false", gTimeout, 100,
                           {okButton: button.getNode()});
    controller.click(button);
  });
}
function(controller, url) {
  controller.open(url);

  // Wait until the unknown content type dialog has been opened
  controller.waitForEval("subject.getMostRecentWindow('').document.documentElement.id == 'unknownContentType'",
                         gTimeout, 100, mozmill.wm);

  utils.handleWindow("type", "", function (controller) {
    // Select to save the file directly
    var saveFile = new elementslib.ID(controller.window.document, "save");
    controller.waitThenClick(saveFile, gTimeout);
    controller.waitForEval("subject.selected == true", gTimeout, 100,
                           saveFile.getNode());
  
    // Wait until the OK button has been enabled and click on it
    var button = new elementslib.Lookup(controller.window.document,
                                        '/id("unknownContentType")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}');
    controller.waitForElement(button, gTimeout);
    controller.waitForEval("subject.okButton.hasAttribute('disabled') == false", gTimeout, 100,
                           {okButton: button.getNode()});
    controller.click(button);
  });
}
function ( controller , url ) { controller . open ( url ) ; // Wait until the unknown content type dialog has been opened controller . waitForEval ( "subject.getMostRecentWindow('').document.documentElement.id == 'unknownContentType'" , gTimeout , 100 , mozmill . wm ) ; utils . handleWindow ( "type" , "" , function ( controller ) { // Select to save the file directly var saveFile = new elementslib . ID ( controller . window . document , "save" ) ; controller . waitThenClick ( saveFile , gTimeout ) ; controller . waitForEval ( "subject.selected == true" , gTimeout , 100 , saveFile . getNode ( ) ) ; // Wait until the OK button has been enabled and click on it var button = new elementslib . Lookup ( controller . window . document , '/id("unknownContentType")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}' ) ; controller . waitForElement ( button , gTimeout ) ; controller . waitForEval ( "subject.okButton.hasAttribute('disabled') == false" , gTimeout , 100 , { okButton : button . getNode ( ) } ) ; controller . click ( button ) ; } ) ; }
Download the file of unkown type from the given location by saving it
automatically to disk

@param {MozMillController} controller
MozMillController of the browser window
@param {string} url
URL of the file which has to be downloaded
Download the file of unkown type from the given location by saving it automatically to disk