browser.js File Reference
#include <browser>
Include dependency graph for browser.js:

Go to the source code of this file.

Functions

Cu import ("resource://gre/modules/XPCOMUtils.jsm")
 
 forEach (function(elementGlobal){var[name, id]=elementGlobal;window.__defineGetter__(name, function(){var element=document.getElementById(id);if(!element) return null;delete window[name];return window[name]=element;});window.__defineSetter__(name, function(val){delete window[name];return window[name]=val;});})
 
 __defineGetter__ ("gPrefService", function(){delete this.gPrefService;return this.gPrefService=Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch2).QueryInterface(Ci.nsIPrefService);})
 
 __defineSetter__ ("PluralForm", function(val){delete this.PluralForm;return this.PluralForm=val;})
 
function pageShowEventHandlers (event)
 
function getContentAreaFrameCount ()
 
function UpdateBackForwardCommands (aWebNavigation)
 
function BookmarkThisTab ()
 
function findChildShell (aDocument, aDocShell, aSoughtURI)
 
function BrowserStartup ()
 
function HandleAppCommandEvent (evt)
 
function prepareForStartup ()
 
function delayedStartup (isLoadingBlank, mustLoadSidebar)
 
function BrowserShutdown ()
 
function AutoHideTabbarPrefListener ()
 
function BrowserOpenFileWindow ()
 
function BrowserCloseTabOrWindow ()
 
function BrowserTryToCloseWindow ()
 
function loadURI (uri, referrer, postData, allowThirdPartyFixup)
 
function getShortcutOrURI (aURL, aPostDataRef)
 
function getPostDataStream (aStringData, aKeyword, aEncKeyword, aType)
 
function readFromClipboard ()
 
function BrowserViewSourceOfDocument (aDocument)
 
function BrowserPageInfo (doc, initialTab, imageElement)
 
function URLBarSetURI (aURI, aValid)
 
function losslessDecodeURI (aURI)
 
function UpdateUrlbarSearchSplitterState ()
 
function UpdatePageProxyState ()
 
function SetPageProxyState (aState)
 
function PageProxySetIcon (aURL)
 
function PageProxyClearIcon ()
 
function PageProxyClickHandler (aEvent)
 
function BrowserImport ()
 
function BrowserOnCommand (event)
 
function getMeOutOfHere ()
 
function BrowserFullScreen ()
 
function onFullScreen ()
 
function getWebNavigation ()
 
function BrowserReloadWithFlags (reloadFlags)
 
function toggleAffectedChrome (aHide)
 
function onEnterPrintPreview ()
 
function onExitPrintPreview ()
 
function getPPBrowser ()
 
function getMarkupDocumentViewer ()
 
function FillInHTMLTooltip (tipElement)
 
function BrowserCustomizeToolbar ()
 
function BrowserToolboxCustomizeDone (aToolboxChanged)
 
function BrowserToolboxCustomizeChange ()
 
function updateEditUIVisibility ()
 
function mimeTypeIsTextBased (aMimeType)
 
function getBrowserSelection (aCharLen)
 
function openWebPanel (aTitle, aURI)
 
function asyncOpenWebPanel (event)
 
function contentAreaClick (event, fieldNormalClicks)
 
function handleLinkClick (event, href, linkNode)
 
function middleMousePaste (event)
 
function MultiplexHandler (event)
 
function SelectDetector (event, doReload)
 
function SetForcedDetector (doReload)
 
function SetForcedCharset (charset)
 
function BrowserSetForcedCharacterSet (aCharset)
 
function BrowserSetForcedDetector (doReload)
 
function UpdateCurrentCharset ()
 
function UpdateCharsetDetector ()
 
function UpdateMenus (event)
 
function CreateMenu (node)
 
function charsetLoadListener (event)
 
function getAllStyleSheets (frameset)
 
function stylesheetFillPopup (menuPopup)
 
function stylesheetInFrame (frame, title)
 
function stylesheetSwitchFrame (frame, title)
 
function stylesheetSwitchAll (frameset, title)
 
function setStyleDisabled (disabled)
 
function WindowIsClosing ()
 
function warnAboutClosingWindow ()
 
function BrowserOpenAddonsMgr (aPane)
 
function escapeNameValuePair (aName, aValue, aIsFormUrlEncoded)
 
function AddKeywordForSearchField ()
 
function SwitchDocumentDirection (aWindow)
 
function getPluginInfo (pluginElement)
 
function missingPluginInstaller ()
 
function convertFromUnicode (charset, str)
 
places js textZoom js
tabPreviews js XPCOMUtils 
defineLazyGetter (this,"Win7Features", function(){return null;})
 
function undoCloseTab (aIndex)
 
function undoCloseWindow (aIndex)
 
function formatURL (aFormat, aIsPref)
 
function BookmarkAllTabsHandler ()
 
function getNotificationBox (aWindow)
 
function getBrowser () gBrowser
 
function getNavToolbox () gNavToolbox
 

Variables

let Ci = Components.interfaces
 
let Cu = Components.utils
 
const nsIWebNavigation = Ci.nsIWebNavigation
 
var gCharsetMenu = null
 
var gLastBrowserCharset = null
 
var gPrevCharset = null
 
var gProxyFavIcon = null
 
var gLastValidURLStr = ""
 
var gProgressCollapseTimer = null
 
var gSidebarCommand = ""
 
var gInPrintPreviewMode = false
 
let gDownloadMgr = null
 
var gContextMenu = null
 
var gChromeState = null
 
var gAutoHideTabbarPrefListener = null
 
var gBookmarkAllTabsHandler = null
 
var gEditUIVisible = true
 
let gInitialPages
 
const gSessionHistoryObserver
 
const gPopupBlockerObserver
 
const gXPInstallObserver
 
let gGestureSupport
 
AutoHideTabbarPrefListener prototype
 
var LocationBarHelpers
 
var browserDragAndDrop
 
var FullScreen
 
var XULBrowserWindow
 
var gWebPanelURI
 
var contentAreaDNDObserver
 
var BrowserOffline
 
var OfflineApps
 
var MailIntegration
 
missingPluginInstaller prototype installSinglePlugin
 
var FeedHandler
 
var gIdentityHandler
 
let DownloadMonitorPanel
 
let gPrivateBrowsingUI
 
let gURLBarEmptyText
 

Function Documentation

__defineGetter__ ( "Application"  ,
function(){delete Application;Application=Cc["@mozilla.org/fuel/application;1"].getService(Ci.fuelIApplication);return Application;}   
)

Construct a column spec parser and read the column specification immediately

Parameters
aMediaListThe media list to find columns to display for
aPlaylistthe playlist binding
aMaska bitfield containing the source to look for; see the ColumnSpecParser.ORIGIN_* constants
[optional]aConstraint the media type constraint to use, if any
__defineSetter__ ( "PluralForm"  ,
function(val){delete this.PluralForm;return this.PluralForm=val;}   
)
function AddKeywordForSearchField ( )

Definition at line 5834 of file browser.js.

Here is the call graph for this function:

function asyncOpenWebPanel (   event)

Definition at line 4801 of file browser.js.

Here is the caller graph for this function:

function AutoHideTabbarPrefListener ( )

Definition at line 1513 of file browser.js.

Here is the caller graph for this function:

function BookmarkAllTabsHandler ( )

This also takes care of updating the command enabled-state when tabs are created or removed.

Definition at line 6407 of file browser.js.

Here is the caller graph for this function:

function BookmarkThisTab ( )

Definition at line 271 of file browser.js.

function BrowserCloseTabOrWindow ( )

Definition at line 1911 of file browser.js.

Here is the call graph for this function:

function BrowserCustomizeToolbar ( )

Definition at line 3357 of file browser.js.

Here is the call graph for this function:

function BrowserFullScreen ( )

Definition at line 2520 of file browser.js.

function BrowserImport ( )

Definition at line 2354 of file browser.js.

function BrowserOnCommand (   event)

Handle command events bubbling up from error page content

Definition at line 2375 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function BrowserOpenAddonsMgr (   aPane)

Definition at line 5805 of file browser.js.

function BrowserOpenFileWindow ( )

Definition at line 1891 of file browser.js.

Here is the call graph for this function:

function BrowserPageInfo (   doc,
  initialTab,
  imageElement 
)

Definition at line 2128 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function BrowserReloadWithFlags (   reloadFlags)

Definition at line 2539 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function BrowserSetForcedCharacterSet (   aCharset)

Definition at line 5126 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function BrowserSetForcedDetector (   doReload)

Definition at line 5135 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function BrowserShutdown ( )

Definition at line 1382 of file browser.js.

function BrowserStartup ( )

Definition at line 913 of file browser.js.

Here is the call graph for this function:

function BrowserToolboxCustomizeChange ( )

Definition at line 3469 of file browser.js.

Here is the caller graph for this function:

function BrowserToolboxCustomizeDone (   aToolboxChanged)

Definition at line 3403 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function BrowserTryToCloseWindow ( )

Definition at line 1924 of file browser.js.

Here is the call graph for this function:

function BrowserViewSourceOfDocument (   aDocument)

Definition at line 2080 of file browser.js.

Here is the call graph for this function:

function charsetLoadListener (   event)

Definition at line 5203 of file browser.js.

Here is the caller graph for this function:

function contentAreaClick (   event,
  fieldNormalClicks 
)

Definition at line 4819 of file browser.js.

Here is the call graph for this function:

function convertFromUnicode (   charset,
  str 
)

Definition at line 6129 of file browser.js.

Here is the caller graph for this function:

function CreateMenu (   node)

Definition at line 5197 of file browser.js.

XPCOMUtils defineLazyGetter ( this  ,
"Win7Features"  ,
function(){return null;}   
)
function delayedStartup (   isLoadingBlank,
  mustLoadSidebar 
)

Definition at line 1182 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function escapeNameValuePair (   aName,
  aValue,
  aIsFormUrlEncoded 
)

Definition at line 5826 of file browser.js.

Here is the caller graph for this function:

function FillInHTMLTooltip (   tipElement)

Content area tooltip. XXX - this must move into XBL binding/equiv! Do not want to pollute browser.js with functionality that can be encapsulated into browser widget. TEMPORARY!

NOTE: Any changes to this routine need to be mirrored in ChromeListener::FindTitleText() (located in mozilla/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp) which performs the same function, but for embedded clients that don't use a XUL/JS layer. It is important that the logic of these two routines be kept more or less in sync. (pinkerton)

Definition at line 2653 of file browser.js.

function findChildShell (   aDocument,
  aDocShell,
  aSoughtURI 
)

Given a starting docshell and a URI to look up, find the docshell the URI is loaded in.

Parameters
aDocumentA document to find instead of using just a URI - this is more specific.
aDocShellThe doc shell to start at
aSoughtURIThe URI that we're looking for
Returns
The doc shell that the sought URI is loaded in. Can be in subframes.

Definition at line 306 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

forEach ( function(elementGlobal){var[name, id]=elementGlobal;window.__defineGetter__(name, function(){var element=document.getElementById(id);if(!element) return null;delete window[name];return window[name]=element;});window.__defineSetter__(name, function(val){delete window[name];return window[name]=val;});}  )
function formatURL (   aFormat,
  aIsPref 
)

Format a URL eg: echo formatURL("https://addons.mozilla.org/%LOCALE%/%APP%/%VERSION%/");

https://addons.mozilla.org/en-US/firefox/3.0a1/

Currently supported built-ins are LOCALE, APP, and any value from nsIXULAppInfo, uppercased.

Definition at line 6398 of file browser.js.

function getAllStyleSheets (   frameset)

Definition at line 5217 of file browser.js.

Here is the caller graph for this function:

function getBrowser ( )

Definition at line 502 of file browserUtilities.js.

Here is the caller graph for this function:

function getBrowserSelection (   aCharLen)

Gets the selected text in the active browser. Leading and trailing whitespace is removed, and consecutive whitespace is replaced by a single space. A maximum of 150 characters will be returned, regardless of the value of aCharLen.

Parameters
aCharLenThe maximum number of characters to return.

Definition at line 4749 of file browser.js.

function getContentAreaFrameCount ( )

Determine whether or not the content area is displaying a page with frames, and if so, toggle the display of the 'save frame as' menu item.

Definition at line 163 of file browser.js.

function getMarkupDocumentViewer ( )

Definition at line 2635 of file browser.js.

Here is the caller graph for this function:

function getMeOutOfHere ( )

Re-direct the browser to a known-safe page. This function is used when, for example, the user browses to a known malware page and is presented with about:blocked. The "Get me out of here!" button should take the user to the default start page so that even when their own homepage is infected, we can get them somewhere safe.

Definition at line 2503 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function getNavToolbox ( )
function getNotificationBox (   aWindow)

Definition at line 6942 of file browser.js.

function getPluginInfo (   pluginElement)

Definition at line 5905 of file browser.js.

Here is the call graph for this function:

function getPostDataStream (   aStringData,
  aKeyword,
  aEncKeyword,
  aType 
)

Definition at line 2031 of file browser.js.

Here is the caller graph for this function:

function getPPBrowser ( )

Definition at line 2630 of file browser.js.

function getShortcutOrURI (   aURL,
  aPostDataRef 
)

Definition at line 1960 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function getWebNavigation ( )

Definition at line 2530 of file browser.js.

Here is the caller graph for this function:

function HandleAppCommandEvent (   evt)

Definition at line 1071 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function handleLinkClick (   event,
  href,
  linkNode 
)

Definition at line 4944 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

Cu import ( "resource://gre/modules/XPCOMUtils.jsm"  )
function loadURI (   uri,
  referrer,
  postData,
  allowThirdPartyFixup 
)

Definition at line 1946 of file browser.js.

Here is the caller graph for this function:

function losslessDecodeURI (   aURI)

Definition at line 2223 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function middleMousePaste (   event)

Definition at line 4994 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function mimeTypeIsTextBased (   aMimeType)

Returns true if |aMimeType| is text-based, false otherwise.

Parameters
aMimeTypeThe MIME type to check.

If adding types to this function, please also check the similar function in findbar.xml

Definition at line 3839 of file browser.js.

function missingPluginInstaller ( )

Definition at line 5940 of file browser.js.

function MultiplexHandler (   event)

Definition at line 5072 of file browser.js.

Here is the call graph for this function:

function onEnterPrintPreview ( )

Definition at line 2617 of file browser.js.

Here is the call graph for this function:

function onExitPrintPreview ( )

Definition at line 2623 of file browser.js.

Here is the call graph for this function:

function onFullScreen ( )

Definition at line 2525 of file browser.js.

Here is the caller graph for this function:

function openWebPanel (   aTitle,
  aURI 
)

Definition at line 4776 of file browser.js.

Here is the call graph for this function:

function PageProxyClearIcon ( )

Definition at line 2343 of file browser.js.

Here is the caller graph for this function:

function PageProxyClickHandler (   aEvent)

Definition at line 2348 of file browser.js.

Here is the call graph for this function:

function PageProxySetIcon (   aURL)

Definition at line 2332 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function pageShowEventHandlers (   event)

We can avoid adding multiple load event listeners and save some time by adding one listener that calls all real handlers.

Definition at line 151 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function prepareForStartup ( )

Definition at line 1100 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function readFromClipboard ( )

Definition at line 2045 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function SelectDetector (   event,
  doReload 
)

Definition at line 5092 of file browser.js.

Here is the caller graph for this function:

function SetForcedCharset (   charset)

Definition at line 5121 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function SetForcedDetector (   doReload)

Definition at line 5116 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function SetPageProxyState (   aState)

Definition at line 2308 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function setStyleDisabled (   disabled)

Definition at line 5308 of file browser.js.

Here is the call graph for this function:

function stylesheetFillPopup (   menuPopup)

Definition at line 5226 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function stylesheetInFrame (   frame,
  title 
)

Definition at line 5280 of file browser.js.

Here is the caller graph for this function:

function stylesheetSwitchAll (   frameset,
  title 
)

Definition at line 5300 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function stylesheetSwitchFrame (   frame,
  title 
)

Definition at line 5285 of file browser.js.

Here is the caller graph for this function:

function SwitchDocumentDirection (   aWindow)

Definition at line 5899 of file browser.js.

function toggleAffectedChrome (   aHide)

Definition at line 2560 of file browser.js.

Here is the caller graph for this function:

function undoCloseTab (   aIndex)

Re-open a closed tab.

Parameters
aIndexThe index of the tab (via nsSessionStore.getClosedTabData)
Returns
a reference to the reopened tab.

Definition at line 6350 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function undoCloseWindow (   aIndex)

Re-open a closed window.

Parameters
aIndexThe index of the window (via nsSessionStore.getClosedWindowData)
Returns
a reference to the reopened window.

Definition at line 6380 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function UpdateBackForwardCommands (   aWebNavigation)

Definition at line 172 of file browser.js.

function UpdateCharsetDetector ( )

Definition at line 5161 of file browser.js.

Here is the caller graph for this function:

function UpdateCurrentCharset ( )

Definition at line 5142 of file browser.js.

Here is the caller graph for this function:

function updateEditUIVisibility ( )

Update the global flag that tracks whether or not any edit UI (the Edit menu, edit-related items in the context menu, and edit-related toolbar buttons is visible, then update the edit commands' enabled state accordingly. We use this flag to skip updating the edit commands on focus or selection changes when no UI is visible to improve performance (including pageload performance, since focus changes when you load a new page).

If UI is visible, we use goUpdateGlobalEditMenuItems to set the commands' enabled state so the UI will reflect it appropriately.

If the UI isn't visible, we enable all edit commands so keyboard shortcuts still work and just lazily disable them as needed when the user presses a shortcut.

This doesn't work on Mac, since Mac menus flash when users press their keyboard shortcuts, so edit UI is essentially always visible on the Mac, and we need to always update the edit commands. Thus on Mac this function is a no op.

Definition at line 3493 of file browser.js.

Here is the caller graph for this function:

function UpdateMenus (   event)

Definition at line 5186 of file browser.js.

Here is the call graph for this function:

function UpdatePageProxyState ( )

Definition at line 2302 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function UpdateUrlbarSearchSplitterState ( )

Definition at line 2253 of file browser.js.

Here is the caller graph for this function:

function URLBarSetURI (   aURI,
  aValid 
)

Definition at line 2201 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

function warnAboutClosingWindow ( )

Checks if this is the last full browser window around. If it is, this will be communicated like quitting. Otherwise, we warn about closing multiple tabs.

Returns
true if closing can proceed, false if it got cancelled.

Definition at line 5735 of file browser.js.

Here is the caller graph for this function:

function WindowIsClosing ( )

Definition at line 5713 of file browser.js.

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

var browserDragAndDrop

Definition at line 2703 of file browser.js.

var BrowserOffline

Definition at line 5313 of file browser.js.

Definition at line 67 of file browser.js.

var contentAreaDNDObserver

Definition at line 5029 of file browser.js.

let Cu = Components.utils

Definition at line 68 of file browser.js.

let DownloadMonitorPanel

Definition at line 6808 of file browser.js.

var FeedHandler

The Feed Handler object manages discovery of RSS/ATOM feeds in web pages and shows UI when they are discovered.

Definition at line 6147 of file browser.js.

var FullScreen

Definition at line 3534 of file browser.js.

var gAutoHideTabbarPrefListener = null

Definition at line 88 of file browser.js.

var gBookmarkAllTabsHandler = null

Definition at line 89 of file browser.js.

var gCharsetMenu = null

Definition at line 73 of file browser.js.

var gChromeState = null

Definition at line 86 of file browser.js.

var gContextMenu = null

Definition at line 84 of file browser.js.

let gDownloadMgr = null

Definition at line 81 of file browser.js.

var gEditUIVisible = true

Definition at line 92 of file browser.js.

let gGestureSupport

Definition at line 675 of file browser.js.

var gIdentityHandler

Utility object to handle manipulations of the identity indicators in the UI

Definition at line 6449 of file browser.js.

let gInitialPages
Initial value:
= [
"about:blank",
"about:privatebrowsing",
"about:sessionrestore"
]

Definition at line 141 of file browser.js.

var gInPrintPreviewMode = false

Definition at line 80 of file browser.js.

var gLastBrowserCharset = null

Definition at line 74 of file browser.js.

var gLastValidURLStr = ""

Definition at line 77 of file browser.js.

const gPopupBlockerObserver

Definition at line 324 of file browser.js.

var gPrevCharset = null

Definition at line 75 of file browser.js.

let gPrivateBrowsingUI

Definition at line 6953 of file browser.js.

var gProgressCollapseTimer = null

Definition at line 78 of file browser.js.

var gProxyFavIcon = null

Definition at line 76 of file browser.js.

const gSessionHistoryObserver
Initial value:
= {
observe: function(subject, topic, data)
{
if (topic != "browser:purge-session-history")
return;
var backCommand = document.getElementById("Browser:Back");
backCommand.setAttribute("disabled", "true");
var fwdCommand = document.getElementById("Browser:Forward");
fwdCommand.setAttribute("disabled", "true");
if (gURLBar) {
gURLBar.editor.transactionManager.clear()
}
}
}
observe topic
Definition: FeedWriter.js:1326
observe data
Definition: FeedWriter.js:1329
sbDeviceFirmwareAutoCheckForUpdate prototype observe

Definition at line 276 of file browser.js.

var gSidebarCommand = ""

Definition at line 79 of file browser.js.

let gURLBarEmptyText

Definition at line 7181 of file browser.js.

var gWebPanelURI

Definition at line 4775 of file browser.js.

const gXPInstallObserver

Definition at line 571 of file browser.js.

missingPluginInstaller prototype installSinglePlugin

Definition at line 5943 of file browser.js.

var LocationBarHelpers
Initial value:
= {
_timeoutID: null,
_searchBegin: function LocBar_searchBegin() {
function delayedBegin(self) {
self._timeoutID = null;
document.getElementById("urlbar-throbber").setAttribute("busy", "true");
}
this._timeoutID = setTimeout(delayedBegin, 500, this);
},
_searchComplete: function LocBar_searchComplete() {
if (this._timeoutID) {
clearTimeout(this._timeoutID);
this._timeoutID = null;
}
document.getElementById("urlbar-throbber").removeAttribute("busy");
}
}
aWindow setTimeout(function(){_this.restoreHistory(aWindow, aTabs, aTabData, aIdMap);}, 0)
return null
Definition: FeedWriter.js:1143

Definition at line 2280 of file browser.js.

var MailIntegration

Definition at line 5773 of file browser.js.

const nsIWebNavigation = Ci.nsIWebNavigation

Definition at line 71 of file browser.js.

var OfflineApps

Definition at line 5417 of file browser.js.

Definition at line 1518 of file browser.js.

var XULBrowserWindow

Definition at line 3848 of file browser.js.