B2G/gecko/browser/components/places/src/PlacesUIUtils.jsm
/**
   * Gives the user a chance to cancel loading lots of tabs at once
   */
Gives the user a chance to cancel loading lots of tabs at once
Gives the user a chance to cancel loading lots of tabs at once
function PUIU__confirmOpenInTabs(numTabsToOpen, aWindow) {
    const WARN_ON_OPEN_PREF = "browser.tabs.warnOnOpen";
    var reallyOpen = true;
    if (Services.prefs.getBoolPref(WARN_ON_OPEN_PREF)) {
      if (numTabsToOpen >= Services.prefs.getIntPref("browser.tabs.maxOpenBeforeWarn")) {
        var warnOnOpen = { value: true };
        var messageKey = "tabs.openWarningMultipleBranded";
        var openKey = "tabs.openButtonMultiple";
        const BRANDING_BUNDLE_URI = "chrome://branding/locale/brand.properties";
        var brandShortName = Cc["@mozilla.org/intl/stringbundle;1"].
                             getService(Ci.nsIStringBundleService).
                             createBundle(BRANDING_BUNDLE_URI).
                             GetStringFromName("brandShortName");
        var buttonPressed = Services.prompt.confirmEx(
          aWindow,
          this.getString("tabs.openWarningTitle"),
          this.getFormattedString(messageKey, [numTabsToOpen, brandShortName]),
          (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0) +
            (Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1),
          this.getString(openKey), null, null,
          this.getFormattedString("tabs.openWarningPromptMeBranded",
                                  [brandShortName]),
          warnOnOpen
        );
        reallyOpen = (buttonPressed == 0);
        if (reallyOpen && !warnOnOpen.value)
          Services.prefs.setBoolPref(WARN_ON_OPEN_PREF, false);
      }
    }
    return reallyOpen;
  }
function PUIU__confirmOpenInTabs ( numTabsToOpen , aWindow ) { const WARN_ON_OPEN_PREF = "browser.tabs.warnOnOpen" ; var reallyOpen = true ; if ( Services . prefs . getBoolPref ( WARN_ON_OPEN_PREF ) ) { if ( numTabsToOpen >= Services . prefs . getIntPref ( "browser.tabs.maxOpenBeforeWarn" ) ) { var warnOnOpen = { value : true } ; var messageKey = "tabs.openWarningMultipleBranded" ; var openKey = "tabs.openButtonMultiple" ; const BRANDING_BUNDLE_URI = "chrome://branding/locale/brand.properties" ; var brandShortName = Cc [ "@mozilla.org/intl/stringbundle;1" ] . getService ( Ci . nsIStringBundleService ) . createBundle ( BRANDING_BUNDLE_URI ) . GetStringFromName ( "brandShortName" ) ; var buttonPressed = Services . prompt . confirmEx ( aWindow , this . getString ( "tabs.openWarningTitle" ) , this . getFormattedString ( messageKey , [ numTabsToOpen , brandShortName ] ) , ( Services . prompt . BUTTON_TITLE_IS_STRING * Services . prompt . BUTTON_POS_0 ) + ( Services . prompt . BUTTON_TITLE_CANCEL * Services . prompt . BUTTON_POS_1 ) , this . getString ( openKey ) , null , null , this . getFormattedString ( "tabs.openWarningPromptMeBranded" , [ brandShortName ] ) , warnOnOpen ) ; reallyOpen = ( buttonPressed == 0 ) ; if ( reallyOpen && ! warnOnOpen . value ) Services . prefs . setBoolPref ( WARN_ON_OPEN_PREF , false ) ; } } return reallyOpen ; }
Gives the user a chance to cancel loading lots of tabs at once
Gives the user a chance to cancel loading lots of tabs at once
// default to true: if it were false, we wouldn't get this far // don't set the pref unless they press OK and it's false