1 # -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 
    3 # ***** BEGIN LICENSE BLOCK ***** 
    4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1 
    6 # The contents of this file are subject to the Mozilla Public License Version 
    7 # 1.1 (the "License"); you may not use this file except in compliance with 
    8 # the License. You may obtain a copy of the License at 
    9 # http://www.mozilla.org/MPL/ 
   11 # Software distributed under the License is distributed on an "AS IS" basis, 
   12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
   13 # for the specific language governing rights and limitations under the 
   16 # The Original Code is Mozilla Communicator client code, released 
   19 # The Initial Developer of the Original Code is 
   20 # Netscape Communications Corporation. 
   21 # Portions created by the Initial Developer are Copyright (C) 1998 
   22 # the Initial Developer. All Rights Reserved. 
   25 #   Michael Lowe <michael.lowe@bigfoot.com> 
   26 #   Blake Ross   <blaker@netscape.com> 
   28 # Alternatively, the contents of this file may be used under the terms of 
   29 # either the GNU General Public License Version 2 or later (the "GPL"), or 
   30 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 
   31 # in which case the provisions of the GPL or the LGPL are applicable instead 
   32 # of those above. If you wish to allow use of your version of this file only 
   33 # under the terms of either the GPL or the LGPL, and not to allow others to 
   34 # use your version of this file under the terms of the MPL, indicate your 
   35 # decision by deleting the provisions above and replace them with the notice 
   36 # and other provisions required by the GPL or the LGPL. If you do not delete 
   37 # the provisions above, a recipient may use your version of this file under 
   38 # the terms of any one of the MPL, the GPL or the LGPL. 
   40 # ***** END LICENSE BLOCK ***** 
   46   pref = Components.classes[
"@mozilla.org/preferences-service;1"]
 
   47                    .getService(Components.interfaces.nsIPrefBranch);
 
   52 Components.utils.import(
"resource:///modules/openLocationLastURL.jsm");
 
   56   dialog.input         = document.getElementById(
"dialog.input");
 
   57   dialog.open          = document.documentElement.getButton(
"accept");
 
   58   dialog.openWhereList = document.getElementById(
"openWhereList");
 
   59   dialog.openTopWindow = document.getElementById(
"currentWindow");
 
   60   dialog.bundle        = document.getElementById(
"openLocationBundle");
 
   62   if (
"arguments" in 
window && 
window.arguments.length >= 1)
 
   65   dialog.openWhereList.selectedItem = 
dialog.openTopWindow;
 
   69       var useAutoFill = 
pref.getBoolPref(
"browser.urlbar.autoFill");
 
   71         dialog.input.setAttribute(
"completedefaultindex", 
"true");
 
   75       var 
value = 
pref.getIntPref(
"general.open_location.last_window_choice");
 
   76       var 
element = 
dialog.openWhereList.getElementsByAttribute(
"value", value)[0];
 
  100     url = 
browser.getShortcutOrURI(
dialog.input.value, postData);
 
  107     switch (
dialog.openWhereList.value) {
 
  113                                         url, postData.value, 
null, 
null, 
true);
 
  125     pref.setIntPref(
"general.open_location.last_window_choice", 
dialog.openWhereList.value);
 
  135   var iid = Components.interfaces[iidName];
 
  136   return Components.classes[contractid].createInstance(iid);
 
  143     var fp = Components.classes[
"@mozilla.org/filepicker;1"].createInstance(
nsIFilePicker);
 
  148     if (fp.show() == 
nsIFilePicker.returnOK && fp.fileURL.spec && fp.fileURL.spec.length > 0)
 
  149       dialog.input.value = fp.fileURL.spec;
 
function createInstance(contractid, iidName)