diff --git a/Makefile.in b/Makefile.in
index 75e8260c0584..8413ba3cfc9e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -202,6 +202,9 @@ else
BUILDID = $(shell $(PYTHON) $(srcdir)/config/printconfigsetting.py $(DIST)/bin/platform.ini Build BuildID)
endif
+MOZ_SOURCE_STAMP = $(shell hg -R $(srcdir) parent --template="{node|short}\n" 2>/dev/null)
+export MOZ_SOURCE_STAMP
+
#XXX: this is a hack, since we don't want to clobber for MSVC
# PGO support, but we can't do this test in client.mk
ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
diff --git a/accessible/tests/mochitest/common.js b/accessible/tests/mochitest/common.js
index cd4d8c2fb1c9..61e90732303c 100644
--- a/accessible/tests/mochitest/common.js
+++ b/accessible/tests/mochitest/common.js
@@ -115,9 +115,9 @@ function addA11yLoadEvent(aFunc)
if (state.value & STATE_BUSY)
return waitForDocLoad();
- aFunc.call();
+ window.setTimeout(aFunc, 150);
},
- 200
+ 0
);
}
@@ -125,7 +125,7 @@ function addA11yLoadEvent(aFunc)
}
////////////////////////////////////////////////////////////////////////////////
-// Get DOM node/accesible helpers
+// Helpers for getting DOM node/accessible
/**
* Return the DOM node by identifier (may be accessible, DOM node or ID).
diff --git a/browser/app/Makefile.in b/browser/app/Makefile.in
index 0b70fef33825..347a0f36cb04 100644
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -69,9 +69,9 @@ GRE_BUILDID = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBX
DEFINES += -DGRE_MILESTONE=$(GRE_MILESTONE) -DGRE_BUILDID=$(GRE_BUILDID)
-SOURCE_STAMP := $(shell cd $(topsrcdir) ; hg identify . 2>/dev/null | cut -f1 -d' ')
-ifdef SOURCE_STAMP
-DEFINES += -DMOZ_SOURCE_STAMP="$(SOURCE_STAMP)"
+MOZ_SOURCE_STAMP ?= $(shell hg -R $(topsrcdir) parent --template="{node|short}\n" 2>/dev/null)
+ifdef MOZ_SOURCE_STAMP
+DEFINES += -DMOZ_SOURCE_STAMP="$(MOZ_SOURCE_STAMP)"
endif
SOURCE_REPO := $(shell hg -R $(topsrcdir) showconfig paths.default 2>/dev/null | sed -e "s/^ssh:/http:/")
diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css
index 20be64bd7478..1147acc098e9 100644
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -148,11 +148,11 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m
#navigator-toolbox[inFullscreen="true"] > #fullscr-toggler,
#nav-bar[mode="text"] > #window-controls > toolbarbutton > .toolbarbutton-icon {
- display: -moz-box;
+ display: -moz-box;
}
#nav-bar[mode="text"] > #window-controls > toolbarbutton > .toolbarbutton-text {
- display: none;
+ display: none;
}
/* ::::: Keyboard UI Panel ::::: */
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index 2001dc47558b..dcae21701ec0 100644
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -440,6 +440,8 @@ const gPopupBlockerObserver = {
if (gPrivateBrowsingUI.privateBrowsingEnabled)
blockedPopupAllowSite.setAttribute("disabled", "true");
+ else
+ blockedPopupAllowSite.removeAttribute("disabled");
var item = aEvent.target.lastChild;
while (item && item.getAttribute("observes") != "blockedPopupsSeparator") {
@@ -1062,8 +1064,6 @@ function BrowserStartup() {
gURLBar.setAttribute("enablehistory", "false");
}
- CombinedStopReload.wrap();
-
allTabs.readPref();
setTimeout(delayedStartup, 0, isLoadingBlank, mustLoadSidebar);
@@ -1388,8 +1388,6 @@ function BrowserShutdown()
ctrlTab.uninit();
allTabs.uninit();
- CombinedStopReload.uninit();
-
gGestureSupport.init(false);
FullScreen.cleanup();
@@ -3321,8 +3319,6 @@ function BrowserCustomizeToolbar()
if (splitter)
splitter.parentNode.removeChild(splitter);
- CombinedStopReload.unwrap();
-
var customizeURL = "chrome://global/content/customizeToolbar.xul";
gCustomizeSheet = getBoolPref("toolbar.customization.usesheet", false);
@@ -3393,8 +3389,6 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) {
UpdateUrlbarSearchSplitterState();
- CombinedStopReload.wrap();
-
gHomeButton.updatePersonalToolbarStyle();
// Update the urlbar
@@ -3951,10 +3945,14 @@ var XULBrowserWindow = {
onStateChange: function (aWebProgress, aRequest, aStateFlags, aStatus) {
const nsIWebProgressListener = Ci.nsIWebProgressListener;
const nsIChannel = Ci.nsIChannel;
- if (aStateFlags & nsIWebProgressListener.STATE_START &&
- aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
+ if (aStateFlags & nsIWebProgressListener.STATE_START) {
+ // This (thanks to the filter) is a network start or the first
+ // stray request (the first request outside of the document load),
+ // initialize the throbber and his friends.
- if (aRequest && aWebProgress.DOMWindow == content)
+ // Call start document load listeners (only if this is a network load)
+ if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK &&
+ aRequest && aWebProgress.DOMWindow == content)
this.startDocumentLoad(aRequest);
this.isBusy = true;
@@ -3977,7 +3975,6 @@ var XULBrowserWindow = {
// XXX: This needs to be based on window activity...
this.stopCommand.removeAttribute("disabled");
- CombinedStopReload.switchToStop();
}
}
else if (aStateFlags & nsIWebProgressListener.STATE_STOP) {
@@ -4045,7 +4042,6 @@ var XULBrowserWindow = {
this.throbberElement.removeAttribute("busy");
this.stopCommand.setAttribute("disabled", "true");
- CombinedStopReload.switchToReload(aRequest instanceof Ci.nsIRequest);
}
}
},
@@ -4320,105 +4316,7 @@ var XULBrowserWindow = {
} catch (e) {
}
}
-};
-
-var CombinedStopReload = {
- wrap: function () {
- if (this.container)
- return;
-
- var stop = document.getElementById("stop-button");
- if (!stop)
- return;
-
- var reload = document.getElementById("reload-button");
- if (!reload)
- return;
-
- this._reloadBeforeStop = (reload.nextSibling == stop);
- if (!this._reloadBeforeStop && stop.nextSibling != reload)
- return;
-
- this.container = document.createElement("deck");
- this.container.id = "stop-reload-container";
- stop.parentNode.replaceChild(this.container, stop);
- this.container.appendChild(stop);
- this.container.appendChild(reload);
- this.stop = stop;
- this.reload = reload;
- this.container.selectedPanel =
- XULBrowserWindow.stopCommand.getAttribute("disabled") == "true"
- ? reload : stop;
- stop.addEventListener("click", this, false);
- },
-
- handleEvent: function (event) {
- // the only event we listen to is "click" on the stop button
- if (event.button == 0 &&
- !this.stop.disabled)
- this._stopClicked = true;
- },
-
- switchToStop: function () {
- if (!this.container)
- return;
-
- this._cancelTransition();
- this.container.selectedPanel = this.stop;
- },
-
- switchToReload: function (aDelay) {
- if (!this.container)
- return;
-
- if (!aDelay || this._stopClicked) {
- this._stopClicked = false;
- this._cancelTransition();
- this.container.selectedPanel = this.reload;
- return;
- }
-
- if (this._timer)
- return;
-
- this._timer = setTimeout(function (self) {
- self._timer = 0;
- self.container.selectedPanel = self.reload;
- }, 650, this);
- },
-
- _cancelTransition: function () {
- if (this._timer) {
- clearTimeout(this._timer);
- this._timer = 0;
- }
- },
-
- unwrap: function () {
- if (!this.container)
- return;
-
- var toolbar = this.container.parentNode;
- if (this._reloadBeforeStop) {
- toolbar.replaceChild(this.stop, this.container);
- toolbar.insertBefore(this.reload, this.stop);
- } else {
- toolbar.replaceChild(this.reload, this.container);
- toolbar.insertBefore(this.stop, this.reload);
- }
- this.uninit();
- },
-
- uninit: function () {
- this._cancelTransition();
- if (this.container) {
- this.stop.removeEventListener("click", this, false);
- this.container = null;
- this.reload = null;
- this.stop = null;
- }
- }
-};
+}
var TabsProgressListener = {
onProgressChange: function (aBrowser, aWebProgress, aRequest,
diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul
index 06662d6bd061..00d9553f0923 100644
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -296,10 +296,16 @@
style="visibility:hidden"/>
-
-
-
+
+
+
+
+
+
+
-
-
-
diff --git a/browser/base/content/sanitizeDialog.js b/browser/base/content/sanitizeDialog.js
index 5098d6817231..34f7ec347af5 100644
--- a/browser/base/content/sanitizeDialog.js
+++ b/browser/base/content/sanitizeDialog.js
@@ -92,6 +92,8 @@ var gSanitizePromptDialog = {
if (this.selectedTimespan === Sanitizer.TIMESPAN_EVERYTHING) {
this.prepareWarning();
this.warningBox.hidden = false;
+ document.title =
+ this.bundleBrowser.getString("sanitizeDialog2.everything.title");
}
else
this.warningBox.hidden = true;
diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js
index 9b23940e80d1..503616b86d25 100644
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -475,7 +475,7 @@ function buildHelpMenu()
#ifdef MOZ_UPDATER
var updates =
Components.classes["@mozilla.org/updates/update-service;1"].
- getService(Components.interfaces.nsIApplicationUpdateService2);
+ getService(Components.interfaces.nsIApplicationUpdateService);
var um =
Components.classes["@mozilla.org/updates/update-manager;1"].
getService(Components.interfaces.nsIUpdateManager);
diff --git a/browser/components/nsBrowserContentHandler.js b/browser/components/nsBrowserContentHandler.js
index 7940b0c39089..38b5bd4be344 100644
--- a/browser/components/nsBrowserContentHandler.js
+++ b/browser/components/nsBrowserContentHandler.js
@@ -471,6 +471,9 @@ var nsBrowserContentHandler = {
}
if (cmdLine.handleFlag("silent", false))
cmdLine.preventDefault = true;
+ if (cmdLine.findFlag("private-toggle", false) >= 0 &&
+ cmdLine.state != cmdLine.STATE_INITIAL_LAUNCH)
+ cmdLine.preventDefault = true;
var searchParam = cmdLine.handleFlagWithParam("search", false);
if (searchParam) {
diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js
index 2538a6bdc417..060ba569bd3e 100644
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -66,8 +66,7 @@ const BOOKMARKS_BACKUP_MAX_BACKUPS = 10;
// Factory object
const BrowserGlueServiceFactory = {
_instance: null,
- createInstance: function (outer, iid)
- {
+ createInstance: function BGSF_createInstance(outer, iid) {
if (outer != null)
throw Components.results.NS_ERROR_NO_AGGREGATION;
return this._instance == null ?
@@ -124,8 +123,7 @@ BrowserGlue.prototype = {
_isPlacesLockedObserver: false,
_isPlacesDatabaseLocked: false,
- _setPrefToSaveSession: function(aForce)
- {
+ _setPrefToSaveSession: function BG__setPrefToSaveSession(aForce) {
if (!this._saveSession && !aForce)
return;
@@ -138,8 +136,7 @@ BrowserGlue.prototype = {
},
// nsIObserver implementation
- observe: function(subject, topic, data)
- {
+ observe: function BG_observe(subject, topic, data) {
switch(topic) {
case "xpcom-shutdown":
this._dispose();
@@ -217,8 +214,7 @@ BrowserGlue.prototype = {
},
// initialization (called on application startup)
- _init: function()
- {
+ _init: function BG__init() {
// observer registration
const osvr = this._observerService;
osvr.addObserver(this, "xpcom-shutdown", false);
@@ -241,8 +237,7 @@ BrowserGlue.prototype = {
},
// cleanup (called on application shutdown)
- _dispose: function()
- {
+ _dispose: function BG__dispose() {
// observer removal
const osvr = this._observerService;
osvr.removeObserver(this, "xpcom-shutdown");
@@ -265,16 +260,14 @@ BrowserGlue.prototype = {
osvr.removeObserver(this, "places-database-locked");
},
- _onAppDefaults: function()
- {
+ _onAppDefaults: function BG__onAppDefaults() {
// apply distribution customizations (prefs)
// other customizations are applied in _onProfileStartup()
this._distributionCustomizer.applyPrefDefaults();
},
// profile startup handler (contains profile initialization routines)
- _onProfileStartup: function()
- {
+ _onProfileStartup: function BG__onProfileStartup() {
this._sanitizer.onStartup();
// check if we're in safe mode
var app = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo).
@@ -314,8 +307,7 @@ BrowserGlue.prototype = {
},
// profile shutdown handler (contains profile cleanup routines)
- _onProfileShutdown: function()
- {
+ _onProfileShutdown: function BG__onProfileShutdown() {
#ifdef WINCE
// If there's a pending update, clear cache to free up disk space.
try {
@@ -335,8 +327,7 @@ BrowserGlue.prototype = {
},
// Browser startup complete. All initial windows have opened.
- _onBrowserStartup: function()
- {
+ _onBrowserStartup: function BG__onBrowserStartup() {
// Show about:rights notification, if needed.
if (this._shouldShowRights())
this._showRightsNotification();
@@ -389,8 +380,7 @@ BrowserGlue.prototype = {
#endif
},
- _onQuitRequest: function(aCancelQuit, aQuitType)
- {
+ _onQuitRequest: function BG__onQuitRequest(aCancelQuit, aQuitType) {
// If user has already dismissed quit request, then do nothing
if ((aCancelQuit instanceof Ci.nsISupportsPRBool) && aCancelQuit.data)
return;
@@ -515,7 +505,7 @@ BrowserGlue.prototype = {
* before, if a newer version is available, or if the override pref says to
* always show it.
*/
- _shouldShowRights : function () {
+ _shouldShowRights: function BG__shouldShowRights() {
// Look for an unconditional override pref. If set, do what it says.
// (true --> never show, false --> always show)
try {
@@ -547,7 +537,7 @@ BrowserGlue.prototype = {
return true;
},
- _showRightsNotification : function () {
+ _showRightsNotification: function BG__showRightsNotification() {
// Stick the notification onto the selected tab of the active browser window.
var win = this.getMostRecentBrowserWindow();
var browser = win.gBrowser; // for closure in notification bar callback
@@ -580,7 +570,7 @@ BrowserGlue.prototype = {
box.persistence = 3; // arbitrary number, just so bar sticks around for a bit
},
- _showPluginUpdatePage : function () {
+ _showPluginUpdatePage: function BG__showPluginUpdatePage() {
this._prefs.setBoolPref(PREF_PLUGINS_NOTIFYUSER, false);
var formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].
@@ -612,7 +602,7 @@ BrowserGlue.prototype = {
* Set to true by safe-mode dialog to indicate we must restore default
* bookmarks.
*/
- _initPlaces: function bg__initPlaces() {
+ _initPlaces: function BG__initPlaces() {
// We must instantiate the history service since it will tell us if we
// need to import or restore bookmarks due to first-run, corruption or
// forced migration (due to a major schema change).
@@ -758,7 +748,7 @@ BrowserGlue.prototype = {
* Note: quit-application-granted notification is received twice
* so replace this method with a no-op when first called.
*/
- _shutdownPlaces: function bg__shutdownPlaces() {
+ _shutdownPlaces: function BG__shutdownPlaces() {
this._backupBookmarks();
// Backup bookmarks to bookmarks.html to support apps that depend
@@ -778,7 +768,7 @@ BrowserGlue.prototype = {
/**
* Backup bookmarks if needed.
*/
- _backupBookmarks: function nsBrowserGlue__backupBookmarks() {
+ _backupBookmarks: function BG__backupBookmarks() {
Cu.import("resource://gre/modules/utils.js");
let lastBackupFile = PlacesUtils.backups.getMostRecent();
@@ -800,7 +790,7 @@ BrowserGlue.prototype = {
/**
* Show the notificationBox for a locked places database.
*/
- _showPlacesLockedNotificationBox: function nsBrowserGlue__showPlacesLockedNotificationBox() {
+ _showPlacesLockedNotificationBox: function BG__showPlacesLockedNotificationBox() {
var brandBundle = this._bundleService.createBundle("chrome://branding/locale/brand.properties");
var applicationName = brandBundle.GetStringFromName("brandShortName");
var placesBundle = this._bundleService.createBundle("chrome://browser/locale/places/places.properties");
@@ -835,7 +825,7 @@ BrowserGlue.prototype = {
box.persistence = -1; // Until user closes it
},
- _migrateUI: function bg__migrateUI() {
+ _migrateUI: function BG__migrateUI() {
var migration = 0;
try {
migration = this._prefs.getIntPref("browser.migration.version");
@@ -886,14 +876,14 @@ BrowserGlue.prototype = {
}
},
- _getPersist: function bg__getPersist(aSource, aProperty) {
+ _getPersist: function BG__getPersist(aSource, aProperty) {
var target = this._dataSource.GetTarget(aSource, aProperty, true);
if (target instanceof Ci.nsIRDFLiteral)
return target.Value;
return null;
},
- _setPersist: function bg__setPersist(aSource, aProperty, aTarget) {
+ _setPersist: function BG__setPersist(aSource, aProperty, aTarget) {
this._dirty = true;
try {
var oldTarget = this._dataSource.GetTarget(aSource, aProperty, true);
@@ -914,12 +904,12 @@ BrowserGlue.prototype = {
// public nsIBrowserGlue members
// ------------------------------
- sanitize: function(aParentWindow)
- {
+ sanitize: function BG_sanitize(aParentWindow) {
this._sanitizer.sanitize(aParentWindow);
},
- ensurePlacesDefaultQueriesInitialized: function() {
+ ensurePlacesDefaultQueriesInitialized:
+ function BG_ensurePlacesDefaultQueriesInitialized() {
// This is actual version of the smart bookmarks, must be increased every
// time smart bookmarks change.
// When adding a new smart bookmark below, its newInVersion property must
@@ -951,13 +941,13 @@ BrowserGlue.prototype = {
getService(Ci.nsIAnnotationService);
var callback = {
- _uri: function(aSpec) {
+ _uri: function BG_EPDQI__uri(aSpec) {
return Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService).
newURI(aSpec, null, null);
},
- runBatched: function() {
+ runBatched: function BG_EPDQI_runBatched() {
var smartBookmarks = [];
var bookmarksMenuIndex = 0;
var bookmarksToolbarIndex = 0;
@@ -1082,8 +1072,7 @@ BrowserGlue.prototype = {
#endif
// this returns the most recent non-popup browser window
- getMostRecentBrowserWindow : function ()
- {
+ getMostRecentBrowserWindow: function BG_getMostRecentBrowserWindow() {
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Components.interfaces.nsIWindowMediator);
@@ -1147,7 +1136,7 @@ GeolocationPrompt.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIGeolocationPrompt]),
- prompt: function(request) {
+ prompt: function GP_prompt(request) {
var pm = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
var result = pm.testExactPermission(request.requestingURI, "geo");
diff --git a/browser/components/places/content/menu.xml b/browser/components/places/content/menu.xml
index 3a64d2013caa..f3d0a017db95 100644
--- a/browser/components/places/content/menu.xml
+++ b/browser/components/places/content/menu.xml
@@ -624,8 +624,7 @@
diff --git a/browser/components/places/tests/unit/test_placesTxn.js b/browser/components/places/tests/unit/test_placesTxn.js
index 62ece99ee684..dd68c16cb117 100644
--- a/browser/components/places/tests/unit/test_placesTxn.js
+++ b/browser/components/places/tests/unit/test_placesTxn.js
@@ -548,6 +548,10 @@ function run_test() {
flags: 0,
value: 123,
expires: Ci.nsIAnnotationService.EXPIRE_NEVER };
+ var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
+ getService(Ci.nsINavHistoryService);
+ hs.addVisit(uri("http://www.mozilla.org/"), Date.now() * 1000, null,
+ hs.TRANSITION_TYPED, false, 0);
var genPageAnnoTxn = ptSvc.setPageAnnotation(uri("http://www.mozilla.org/"), pageAnnoObj);
genPageAnnoTxn.doTransaction();
do_check_true(annosvc.pageHasAnnotation(uri("http://www.mozilla.org/"), "testAnno/testInt"));
diff --git a/browser/components/preferences/advanced.js b/browser/components/preferences/advanced.js
index c8d6680b9b06..980a69b8a005 100644
--- a/browser/components/preferences/advanced.js
+++ b/browser/components/preferences/advanced.js
@@ -403,7 +403,7 @@ var gAdvancedPane = {
{
var aus =
Components.classes["@mozilla.org/updates/update-service;1"].
- getService(Components.interfaces.nsIApplicationUpdateService2);
+ getService(Components.interfaces.nsIApplicationUpdateService);
var enabledPref = document.getElementById("app.update.enabled");
var enableAppUpdate = document.getElementById("enableAppUpdate");
diff --git a/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js b/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
index e9be4d33b559..f6d47a9b6c4f 100644
--- a/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
+++ b/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
@@ -450,7 +450,10 @@ PrivateBrowsingService.prototype = {
case "command-line-startup":
this._obs.removeObserver(this, "command-line-startup");
aSubject.QueryInterface(Ci.nsICommandLine);
- this.handle(aSubject);
+ if (aSubject.findFlag("private", false) >= 0) {
+ this.privateBrowsingEnabled = true;
+ this._autoStarted = true;
+ }
break;
case "sessionstore-browser-state-restored":
if (this._currentStatus == STATE_WAITING_FOR_RESTORE) {
@@ -464,14 +467,17 @@ PrivateBrowsingService.prototype = {
// nsICommandLineHandler
handle: function PBS_handle(aCmdLine) {
- if (aCmdLine.handleFlag("private", false)) {
- this.privateBrowsingEnabled = true;
- this._autoStarted = true;
+ if (aCmdLine.handleFlag("private", false))
+ ; // It has already been handled
+ else if (aCmdLine.handleFlag("private-toggle", false)) {
+ this.privateBrowsingEnabled = !this.privateBrowsingEnabled;
+ this._autoStarted = false;
}
},
get helpInfo PBS_get_helpInfo() {
- return " -private Enable private browsing mode.\n";
+ return " -private Enable private browsing mode.\n" +
+ " -private-toggle Toggle private browsing mode.\n";
},
// nsIPrivateBrowsingService
diff --git a/browser/components/privatebrowsing/test/browser/Makefile.in b/browser/components/privatebrowsing/test/browser/Makefile.in
index 513a2cc54d8d..90852e061f94 100644
--- a/browser/components/privatebrowsing/test/browser/Makefile.in
+++ b/browser/components/privatebrowsing/test/browser/Makefile.in
@@ -48,6 +48,7 @@ _BROWSER_TEST_FILES = \
browser_console_clear.js \
browser_privatebrowsing_beforeunload.js \
browser_privatebrowsing_certexceptionsui.js \
+ browser_privatebrowsing_commandline_toggle.js \
browser_privatebrowsing_crh.js \
browser_privatebrowsing_downloadmonitor.js \
browser_privatebrowsing_fastswitch.js \
@@ -61,6 +62,7 @@ _BROWSER_TEST_FILES = \
browser_privatebrowsing_openlocation.js \
browser_privatebrowsing_pageinfo.js \
browser_privatebrowsing_placestitle.js \
+ browser_privatebrowsing_popupblocker.js \
browser_privatebrowsing_popupmode.js \
browser_privatebrowsing_searchbar.js \
browser_privatebrowsing_sslsite_transition.js \
@@ -73,6 +75,9 @@ _BROWSER_TEST_FILES = \
browser_privatebrowsing_windowtitle_page.html \
browser_privatebrowsing_zoom.js \
browser_privatebrowsing_zoomrestore.js \
+ ctxmenu.html \
+ ctxmenu-image.png \
+ popup.html \
staller.sjs \
title.sjs \
$(NULL)
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_commandline_toggle.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_commandline_toggle.js
new file mode 100644
index 000000000000..4e54ff5e7a80
--- /dev/null
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_commandline_toggle.js
@@ -0,0 +1,160 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Private Browsing Tests.
+ *
+ * The Initial Developer of the Original Code is
+ * Ehsan Akhgari.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Ehsan Akhgari (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+// This test makes sure that private browsing toggles correctly via the -private
+// command line argument.
+
+function test() {
+ // initialization
+ let pb = Cc["@mozilla.org/privatebrowsing;1"].
+ getService(Ci.nsIPrivateBrowsingService);
+ let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
+ getService(Ci.nsIWindowWatcher);
+
+ waitForExplicitFinish();
+
+ function simulatePrivateCommandLineArgument() {
+ function testprivatecl() {
+ }
+
+ testprivatecl.prototype = {
+ _arguments: ["private-toggle"],
+ get length getLength() {
+ return this._arguments.length;
+ },
+ getArgument: function getArgument(aIndex) {
+ return this._arguments[aIndex];
+ },
+ findFlag: function findFlag(aFlag, aCaseSensitive) {
+ for (let i = 0; i < this._arguments.length; ++i)
+ if (aCaseSensitive ?
+ (this._arguments[i] == aFlag) :
+ (this._arguments[i].toLowerCase() == aFlag.toLowerCase()))
+ return i;
+ return -1;
+ },
+ removeArguments: function removeArguments(aStart, aEnd) {
+ this._arguments.splice(aStart, aEnd - aStart + 1);
+ },
+ handleFlag: function handleFlag (aFlag, aCaseSensitive) {
+ let res = this.findFlag(aFlag, aCaseSensitive);
+ if (res > -1) {
+ this.removeArguments(res, res);
+ return true;
+ }
+ return false;
+ },
+ handleFlagWithParam: function handleFlagWithParam(aFlag, aCaseSensitive) {
+ return null;
+ },
+ STATE_INITIAL_LAUNCH: 0,
+ STATE_REMOTE_AUTO: 1,
+ STATE_REMOTE_EXPLICIT: 2,
+ get state getState() {
+ return this.STATE_REMOTE_AUTO;
+ },
+ preventDefault: false,
+ workingDirectory: null,
+ windowContext: null,
+ resolveFile: function resolveFile (aArgument) {
+ return null;
+ },
+ resolveURI: function resolveURI (aArgument) {
+ return null;
+ },
+ QueryInterface: function(aIID) {
+ if (!aIID.equals(Ci.nsICommandLine)
+ && !aIID.equals(Ci.nsISupports))
+ throw Cr.NS_ERROR_NO_INTERFACE;
+ return this;
+ }
+ };
+
+ let testcl = new testprivatecl();
+
+ let catMan = Cc["@mozilla.org/categorymanager;1"].
+ getService(Ci.nsICategoryManager);
+ let categories = catMan.enumerateCategory("command-line-handler");
+ while (categories.hasMoreElements()) {
+ let category = categories.getNext().QueryInterface(Ci.nsISupportsCString).data;
+ let contractID = catMan.getCategoryEntry("command-line-handler", category);
+ let handler = Cc[contractID].getService(Ci.nsICommandLineHandler);
+ handler.handle(testcl);
+ }
+ }
+
+ let observer = {
+ observe: function (aSubject, aTopic, aData) {
+ isnot(aTopic, "domwindowopened", "The -private-toggle argument should be silent");
+ }
+ };
+ ww.registerNotification(observer);
+
+ let tab = gBrowser.selectedTab;
+ let browser = gBrowser.getBrowserForTab(tab);
+ browser.addEventListener("load", function () {
+ browser.removeEventListener("load", arguments.callee, true);
+ ok(!pb.privateBrowsingEnabled, "The private browsing mode should not be started");
+ is(browser.contentWindow.location, "about:", "The correct page has been loaded");
+
+ simulatePrivateCommandLineArgument();
+ tab = gBrowser.selectedTab;
+ browser = gBrowser.getBrowserForTab(tab);
+ browser.addEventListener("load", function() {
+ browser.removeEventListener("load", arguments.callee, true);
+ ok(pb.privateBrowsingEnabled, "The private browsing mode should be started");
+ is(browser.contentWindow.location, "about:privatebrowsing",
+ "about:privatebrowsing should now be loaded");
+
+ simulatePrivateCommandLineArgument();
+ tab = gBrowser.selectedTab;
+ browser = gBrowser.getBrowserForTab(tab);
+ browser.addEventListener("load", function() {
+ browser.removeEventListener("load", arguments.callee, true);
+ ok(!pb.privateBrowsingEnabled, "The private browsing mode should be stopped");
+ is(browser.contentWindow.location, "about:",
+ "about: should now be loaded");
+
+ let newTab = gBrowser.addTab();
+ gBrowser.removeTab(tab);
+ ww.unregisterNotification(observer);
+ finish();
+ }, true);
+ }, true);
+ }, true);
+ browser.loadURI("about:");
+}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_contextmenu_blockimage.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_contextmenu_blockimage.js
new file mode 100644
index 000000000000..2ff592850a14
--- /dev/null
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_contextmenu_blockimage.js
@@ -0,0 +1,89 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Private Browsing Tests.
+ *
+ * The Initial Developer of the Original Code is
+ * Ehsan Akhgari.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Ehsan Akhgari (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+// This test makes sure that private browsing mode disables the Block Image
+// context menu item.
+
+function test() {
+ // initialization
+ let pb = Cc["@mozilla.org/privatebrowsing;1"].
+ getService(Ci.nsIPrivateBrowsingService);
+
+ const TEST_URI = "http://localhost:8888/browser/browser/components/privatebrowsing/test/browser/ctxmenu.html";
+
+ waitForExplicitFinish();
+
+ function checkBlockImageMenuItem(expectedHidden, callback) {
+ let tab = gBrowser.addTab();
+ gBrowser.selectedTab = tab;
+ let browser = gBrowser.getBrowserForTab(tab);
+ browser.addEventListener("load", function() {
+ browser.removeEventListener("load", arguments.callee, true);
+
+ executeSoon(function() {
+ let contextMenu = document.getElementById("contentAreaContextMenu");
+ let blockImage = document.getElementById("context-blockimage");
+ let image = browser.contentDocument.getElementsByTagName("img")[0];
+ ok(image, "The content image should be accessible");
+
+ contextMenu.addEventListener("popupshown", function() {
+ contextMenu.removeEventListener("popupshown", arguments.callee, false);
+
+ is(blockImage.hidden, expectedHidden,
+ "The Block Image menu item should " + (expectedHidden ? "" : "not ") + "be hidden");
+ contextMenu.hidePopup();
+ gBrowser.removeTab(tab);
+ callback();
+ }, false);
+
+ document.popupNode = image;
+ EventUtils.synthesizeMouse(image, 2, 2,
+ {type: "contextmenu", button: 2},
+ browser.contentWindow);
+ });
+ }, true);
+ browser.loadURI(TEST_URI);
+ }
+
+ checkBlockImageMenuItem(false, function() {
+ pb.privateBrowsingEnabled = true;
+ checkBlockImageMenuItem(true, function() {
+ pb.privateBrowsingEnabled = false;
+ checkBlockImageMenuItem(false, finish);
+ });
+ });
+}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cookieacceptdialog.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cookieacceptdialog.js
new file mode 100644
index 000000000000..a3d5ccd84746
--- /dev/null
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cookieacceptdialog.js
@@ -0,0 +1,117 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Private Browsing Tests.
+ *
+ * The Initial Developer of the Original Code is
+ * Ehsan Akhgari.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Ehsan Akhgari (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+// This test makes sure that private browsing mode disables the "remember"
+// option in the cookie accept dialog.
+
+function test() {
+ // initialization
+ let pb = Cc["@mozilla.org/privatebrowsing;1"].
+ getService(Ci.nsIPrivateBrowsingService);
+ let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
+ getService(Ci.nsIWindowWatcher);
+ let cp = Cc["@mozilla.org/embedcomp/cookieprompt-service;1"].
+ getService(Ci.nsICookiePromptService);
+
+ waitForExplicitFinish();
+
+ function checkRememberOption(expectedDisabled, callback) {
+ let observer = {
+ observe: function(aSubject, aTopic, aData) {
+ if (aTopic === "domwindowopened") {
+ ww.unregisterNotification(this);
+ let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
+ win.addEventListener("load", function onLoad(event) {
+ win.removeEventListener("load", onLoad, false);
+
+ executeSoon(function() {
+ let doc = win.document;
+ let remember = doc.getElementById("persistDomainAcceptance");
+ ok(remember, "The remember checkbox should exist");
+
+ if (expectedDisabled)
+ is(remember.getAttribute("disabled"), "true",
+ "The checkbox should be disabled");
+ else
+ ok(!remember.hasAttribute("disabled"),
+ "The checkbox should not be disabled");
+
+ win.close();
+ callback();
+ });
+ }, false);
+ }
+ }
+ };
+ ww.registerNotification(observer);
+
+ let remember = {};
+ const time = (new Date("Jan 1, 2030")).getTime() / 1000;
+ let cookie = {
+ name: "foo",
+ value: "bar",
+ isDomain: true,
+ host: "mozilla.org",
+ path: "/baz",
+ isSecure: false,
+ expires: time,
+ status: 0,
+ policy: 0,
+ isSession: false,
+ expiry: time,
+ isHttpOnly: true,
+ QueryInterface: function(iid) {
+ const validIIDs = [Components.interfaces.nsISupports,
+ Components.interfaces.nsICookie,
+ Components.interfaces.nsICookie2];
+ for (var i = 0; i < validIIDs.length; ++i)
+ if (iid == validIIDs[i])
+ return this;
+ throw Components.results.NS_ERROR_NO_INTERFACE;
+ }
+ };
+ cp.cookieDialog(window, cookie, "mozilla.org", 10, false, remember);
+ }
+
+ checkRememberOption(false, function() {
+ pb.privateBrowsingEnabled = true;
+ checkRememberOption(true, function() {
+ pb.privateBrowsingEnabled = false;
+ checkRememberOption(false, finish);
+ });
+ });
+}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_popupblocker.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_popupblocker.js
new file mode 100644
index 000000000000..ba66cacf3625
--- /dev/null
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_popupblocker.js
@@ -0,0 +1,101 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Private Browsing Tests.
+ *
+ * The Initial Developer of the Original Code is
+ * Ehsan Akhgari.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Ehsan Akhgari (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+// This test makes sure that private browsing mode disables the remember option
+// for the popup blocker menu.
+
+function test() {
+ // initialization
+ let pb = Cc["@mozilla.org/privatebrowsing;1"].
+ getService(Ci.nsIPrivateBrowsingService);
+
+ let oldPopupPolicy = gPrefService.getBoolPref("dom.disable_open_during_load");
+ gPrefService.setBoolPref("dom.disable_open_during_load", true);
+
+ const TEST_URI = "http://localhost:8888/browser/browser/components/privatebrowsing/test/browser/popup.html";
+
+ waitForExplicitFinish();
+
+ function testPopupBlockerMenuItem(expectedDisabled, callback) {
+ gBrowser.addEventListener("DOMUpdatePageReport", function() {
+ gBrowser.removeEventListener("DOMUpdatePageReport", arguments.callee, false);
+ executeSoon(function() {
+ let pageReportButton = document.getElementById("page-report-button");
+ let notification = gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked");
+
+ ok(!pageReportButton.hidden, "The page report button should not be hidden");
+ ok(notification, "The notification box should be displayed");
+
+ function checkMenuItem(callback) {
+ document.addEventListener("popupshown", function(event) {
+ document.removeEventListener("popupshown", arguments.callee, false);
+
+ if (expectedDisabled)
+ is(document.getElementById("blockedPopupAllowSite").getAttribute("disabled"), "true",
+ "The allow popups menu item should be disabled");
+
+ event.originalTarget.hidePopup();
+ callback();
+ }, false);
+ }
+
+ checkMenuItem(function() {
+ checkMenuItem(function() {
+ gBrowser.removeTab(tab);
+ callback();
+ });
+ notification.querySelector("button").doCommand();
+ });
+ EventUtils.synthesizeMouse(document.getElementById("page-report-button"), 1, 1, {});
+ });
+ }, false);
+
+ let tab = gBrowser.addTab(TEST_URI);
+ gBrowser.selectedTab = tab;
+ }
+
+ testPopupBlockerMenuItem(false, function() {
+ pb.privateBrowsingEnabled = true;
+ testPopupBlockerMenuItem(true, function() {
+ pb.privateBrowsingEnabled = false;
+ testPopupBlockerMenuItem(false, function() {
+ gPrefService.setBoolPref("dom.disable_open_during_load", oldPopupPolicy);
+ finish();
+ });
+ });
+ });
+}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_ui.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_ui.js
index 380ae6127643..09727aeab966 100644
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_ui.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_ui.js
@@ -60,13 +60,19 @@ function test() {
// test the gPrivateBrowsingUI object
ok(gPrivateBrowsingUI, "The gPrivateBrowsingUI object exists");
+ is(pb.privateBrowsingEnabled, false, "The private browsing mode should not be started initially");
+ is(gPrivateBrowsingUI.privateBrowsingEnabled, false, "gPrivateBrowsingUI should expose the correct private browsing status");
ok(pbMenuItem, "The Private Browsing menu item exists");
is(pbMenuItem.getAttribute("label"), pbMenuItem.getAttribute("startlabel"), "The Private Browsing menu item should read \"Start Private Browsing\"");
gPrivateBrowsingUI.toggleMode();
+ is(pb.privateBrowsingEnabled, true, "The private browsing mode should be started");
+ is(gPrivateBrowsingUI.privateBrowsingEnabled, true, "gPrivateBrowsingUI should expose the correct private browsing status");
// check to see if the Private Browsing mode was activated successfully
is(observer.data, "enter", "Private Browsing mode was activated using the gPrivateBrowsingUI object");
is(pbMenuItem.getAttribute("label"), pbMenuItem.getAttribute("stoplabel"), "The Private Browsing menu item should read \"Stop Private Browsing\"");
gPrivateBrowsingUI.toggleMode()
+ is(pb.privateBrowsingEnabled, false, "The private browsing mode should not be started");
+ is(gPrivateBrowsingUI.privateBrowsingEnabled, false, "gPrivateBrowsingUI should expose the correct private browsing status");
// check to see if the Private Browsing mode was deactivated successfully
is(observer.data, "exit", "Private Browsing mode was deactivated using the gPrivateBrowsingUI object");
is(pbMenuItem.getAttribute("label"), pbMenuItem.getAttribute("startlabel"), "The Private Browsing menu item should read \"Start Private Browsing\"");
diff --git a/browser/components/privatebrowsing/test/browser/ctxmenu-image.png b/browser/components/privatebrowsing/test/browser/ctxmenu-image.png
new file mode 100644
index 000000000000..4c3be508477e
Binary files /dev/null and b/browser/components/privatebrowsing/test/browser/ctxmenu-image.png differ
diff --git a/browser/components/privatebrowsing/test/browser/ctxmenu.html b/browser/components/privatebrowsing/test/browser/ctxmenu.html
new file mode 100644
index 000000000000..7661c24dede7
--- /dev/null
+++ b/browser/components/privatebrowsing/test/browser/ctxmenu.html
@@ -0,0 +1,9 @@
+
+
+
+ Page containing an image
+
+
+
+
+
diff --git a/browser/components/privatebrowsing/test/browser/popup.html b/browser/components/privatebrowsing/test/browser/popup.html
new file mode 100644
index 000000000000..333a303469ee
--- /dev/null
+++ b/browser/components/privatebrowsing/test/browser/popup.html
@@ -0,0 +1,11 @@
+
+
+
+ Page creating a popup
+
+
+
+
+
diff --git a/browser/components/privatebrowsing/test/unit/do_test_privatebrowsing_commandline.js b/browser/components/privatebrowsing/test/unit/do_test_privatebrowsing_commandline.js
index e458cff7efc5..dca4dbcb9840 100644
--- a/browser/components/privatebrowsing/test/unit/do_test_privatebrowsing_commandline.js
+++ b/browser/components/privatebrowsing/test/unit/do_test_privatebrowsing_commandline.js
@@ -97,10 +97,13 @@ testprivatecl.prototype = {
function do_test() {
// initialization
let pb = Cc[PRIVATEBROWSING_CONTRACT_ID].
- getService(Ci.nsIPrivateBrowsingService);
+ getService(Ci.nsIPrivateBrowsingService).
+ QueryInterface(Ci.nsIObserver);
let testcl = new testprivatecl();
+ pb.observe(testcl, "command-line-startup", null);
+
let catMan = Cc["@mozilla.org/categorymanager;1"].
getService(Ci.nsICategoryManager);
let categories = catMan.enumerateCategory("command-line-handler");
diff --git a/browser/components/sessionstore/test/browser/browser_490040.js b/browser/components/sessionstore/test/browser/browser_490040.js
index 9728a7ffc573..7ee5cd6c5a23 100644
--- a/browser/components/sessionstore/test/browser/browser_490040.js
+++ b/browser/components/sessionstore/test/browser/browser_490040.js
@@ -66,12 +66,16 @@ function test() {
gPrefService.setIntPref("browser.sessionstore.max_windows_undo",
curClosedWindowCount + 1);
+ var origWin;
let windowObserver = {
observe: function(aSubject, aTopic, aData) {
let theWin = aSubject.QueryInterface(Ci.nsIDOMWindow);
+ if (origWin && theWin != origWin)
+ return;
- switch(aTopic) {
+ switch (aTopic) {
case "domwindowopened":
+ origWin = theWin;
theWin.addEventListener("load", function () {
theWin.removeEventListener("load", arguments.callee, false);
executeSoon(function() {
diff --git a/browser/components/sessionstore/test/browser/browser_514751.js b/browser/components/sessionstore/test/browser/browser_514751.js
index 1910d335a05b..97d933b131d4 100644
--- a/browser/components/sessionstore/test/browser/browser_514751.js
+++ b/browser/components/sessionstore/test/browser/browser_514751.js
@@ -52,8 +52,6 @@ function test() {
let ss = Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore);
- let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
- getService(Ci.nsIWindowWatcher);
waitForExplicitFinish();
@@ -68,44 +66,21 @@ function test() {
}]
};
- let windowObserver = {
- observe: function(aSubject, aTopic, aData) {
- let theWin = aSubject.QueryInterface(Ci.nsIDOMWindow);
-
- switch(aTopic) {
- case "domwindowopened":
- theWin.addEventListener("load", function () {
- theWin.removeEventListener("load", arguments.callee, false);
- executeSoon(function() {
- var gotError = false;
- try {
- ss.setWindowState(theWin, JSON.stringify(state), true);
- } catch (e) {
- if (/NS_ERROR_MALFORMED_URI/.test(e))
- gotError = true;
- }
- ok(!gotError, "Didn't get a malformed URI error.");
- executeSoon(function() {
- theWin.close();
- });
- });
- }, false);
- break;
-
- case "domwindowclosed":
- ww.unregisterNotification(this);
- is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
- finish();
- break;
+ var theWin = openDialog(location, "", "chrome,all,dialog=no");
+ theWin.addEventListener("load", function () {
+ executeSoon(function () {
+ var gotError = false;
+ try {
+ ss.setWindowState(theWin, JSON.stringify(state), true);
+ } catch (e) {
+ if (/NS_ERROR_MALFORMED_URI/.test(e))
+ gotError = true;
}
- }
- }
- ww.registerNotification(windowObserver);
- ww.openWindow(null,
- location,
- "_blank",
- "chrome,all,dialog=no",
- null);
-
+ ok(!gotError, "Didn't get a malformed URI error.");
+ theWin.close();
+ is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
+ finish();
+ });
+ }, false);
}
diff --git a/chrome/src/nsChromeRegistry.cpp b/chrome/src/nsChromeRegistry.cpp
index e707ed9e7828..c4382c2cea17 100644
--- a/chrome/src/nsChromeRegistry.cpp
+++ b/chrome/src/nsChromeRegistry.cpp
@@ -764,6 +764,37 @@ nsChromeRegistry::GetSelectedLocale(const nsACString& aPackage, nsACString& aLoc
return NS_OK;
}
+NS_IMETHODIMP
+nsChromeRegistry::IsLocaleRTL(const nsACString& package, PRBool *aResult)
+{
+ *aResult = PR_FALSE;
+
+ nsCAutoString locale;
+ GetSelectedLocale(package, locale);
+ if (locale.Length() < 2)
+ return NS_OK;
+
+ // first check the intl.uidirection. preference, and if that is not
+ // set, check the same preference but with just the first two characters of
+ // the locale. If that isn't set, default to left-to-right.
+ nsCAutoString prefString = NS_LITERAL_CSTRING("intl.uidirection.") + locale;
+ nsCOMPtr prefBranch (do_GetService(NS_PREFSERVICE_CONTRACTID));
+ if (!prefBranch)
+ return NS_OK;
+
+ nsXPIDLCString dir;
+ prefBranch->GetCharPref(prefString.get(), getter_Copies(dir));
+ if (dir.IsEmpty()) {
+ PRInt32 hyphen = prefString.FindChar('-');
+ if (hyphen >= 1) {
+ nsCAutoString shortPref(Substring(prefString, 0, hyphen));
+ prefBranch->GetCharPref(shortPref.get(), getter_Copies(dir));
+ }
+ }
+ *aResult = dir.EqualsLiteral("rtl");
+ return NS_OK;
+}
+
NS_IMETHODIMP
nsChromeRegistry::GetLocalesForPackage(const nsACString& aPackage,
nsIUTF8StringEnumerator* *aResult)
diff --git a/config/system-headers b/config/system-headers
index 7e35258d3ffd..890ead5340bc 100644
--- a/config/system-headers
+++ b/config/system-headers
@@ -1012,10 +1012,17 @@ bzlib.h
#ifdef MOZ_PLATFORM_HILDON
hildon-uri.h
hildon-mime.h
+hildon-file-chooser-dialog.h
#endif
#ifdef NS_OSSO
libosso.h
+osso-mem.h
#endif
#ifdef MOZ_ENABLE_GIO
gio/gio.h
#endif
+#ifdef MOZ_ENABLE_LIBCONIC
+conic/conicconnection.h
+conic/conicconnectionevent.h
+conic/conicstatisticsevent.h
+#endif
diff --git a/content/base/public/nsIChromeRegistry.idl b/content/base/public/nsIChromeRegistry.idl
index f95dad800b28..43362895ee92 100644
--- a/content/base/public/nsIChromeRegistry.idl
+++ b/content/base/public/nsIChromeRegistry.idl
@@ -80,7 +80,7 @@ interface nsIChromeRegistry : nsISupports
[notxpcom] boolean wrappersEnabled(in nsIURI aURI);
};
-[scriptable, uuid(2860e205-490e-4b06-90b6-87160d35a5a7)]
+[scriptable, uuid(c2461347-2b8f-48c7-9d59-3a61fb868828)]
interface nsIXULChromeRegistry : nsIChromeRegistry
{
/* Should be called when locales change to reload all chrome (including XUL). */
@@ -88,6 +88,9 @@ interface nsIXULChromeRegistry : nsIChromeRegistry
ACString getSelectedLocale(in ACString packageName);
+ // Get the direction of the locale via the intl.uidirection. pref
+ boolean isLocaleRTL(in ACString package);
+
/* Should be called when skins change. Reloads only stylesheets. */
void refreshSkins();
diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp
index 02d386f3a4f0..d1d03a3b66e8 100644
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/nsGenericElement.cpp
@@ -2786,6 +2786,8 @@ nsGenericElement::doPreHandleEvent(nsIContent* aContent,
{
//FIXME! Document how this event retargeting works, Bug 329124.
aVisitor.mCanHandle = PR_TRUE;
+ aVisitor.mMayHaveListenerManager =
+ aContent->HasFlag(NODE_HAS_LISTENERMANAGER);
// Don't propagate mouseover and mouseout events when mouse is moving
// inside native anonymous content.
diff --git a/content/base/test/test_classList.html b/content/base/test/test_classList.html
index 795a783e9a00..5dd75a9bd652 100644
--- a/content/base/test/test_classList.html
+++ b/content/base/test/test_classList.html
@@ -91,6 +91,24 @@ function checkModification(e, funcName, argument, expectedRes, before, after) {
}
}
+function assignToClassListStrict(e) {
+ "use strict";
+ try {
+ e.classList = "foo";
+ ok(false, "assigning to classList didn't throw");
+ } catch (e) { }
+}
+
+function assignToClassList(e) {
+ try {
+ var expect = e.classList;
+ e.classList = "foo";
+ is(e.classList, expect, "classList should be unchanged after assignment");
+ } catch (e) {
+ ok(false, "assigning to classList threw");
+ }
+}
+
function testClassList(e) {
// basic tests
@@ -101,10 +119,9 @@ function testClassList(e) {
is(typeof(e.classList.add), "function", "no classList.add function");
is(typeof(e.classList.remove), "function", "no classList.remove function");
is(typeof(e.classList.toggle), "function", "no classList.toggle function");
- try {
- e.classList = "foo";
- ok(false, "assigning to classList didn't throw");
- } catch (e) { }
+
+ assignToClassListStrict(e);
+ assignToClassList(e);
// length attribute
diff --git a/content/events/public/nsEventDispatcher.h b/content/events/public/nsEventDispatcher.h
index 16879062fff6..2a185383b91d 100644
--- a/content/events/public/nsEventDispatcher.h
+++ b/content/events/public/nsEventDispatcher.h
@@ -136,8 +136,8 @@ public:
: nsEventChainVisitor(aPresContext, aEvent, aDOMEvent, aEventStatus),
mCanHandle(PR_TRUE), mForceContentDispatch(PR_FALSE),
mRelatedTargetIsInAnon(PR_FALSE), mOriginalTargetIsInAnon(aIsInAnon),
- mWantsWillHandleEvent(PR_FALSE), mParentTarget(nsnull),
- mEventTargetAtParent(nsnull) {}
+ mWantsWillHandleEvent(PR_FALSE), mMayHaveListenerManager(PR_TRUE),
+ mParentTarget(nsnull), mEventTargetAtParent(nsnull) {}
void Reset() {
mItemFlags = 0;
@@ -145,6 +145,7 @@ public:
mCanHandle = PR_TRUE;
mForceContentDispatch = PR_FALSE;
mWantsWillHandleEvent = PR_FALSE;
+ mMayHaveListenerManager = PR_TRUE;
mParentTarget = nsnull;
mEventTargetAtParent = nsnull;
}
@@ -182,6 +183,12 @@ public:
*/
PRPackedBool mWantsWillHandleEvent;
+ /**
+ * If it is known that the current target doesn't have a listener manager
+ * when PreHandleEvent is called, set this to PR_FALSE.
+ */
+ PRPackedBool mMayHaveListenerManager;
+
/**
* Parent item in the event target chain.
*/
diff --git a/content/events/src/nsEventDispatcher.cpp b/content/events/src/nsEventDispatcher.cpp
index 72ce16e52f56..2d9f32bb0bec 100644
--- a/content/events/src/nsEventDispatcher.cpp
+++ b/content/events/src/nsEventDispatcher.cpp
@@ -51,6 +51,7 @@
#define NS_TARGET_CHAIN_FORCE_CONTENT_DISPATCH (1 << 0)
#define NS_TARGET_CHAIN_WANTS_WILL_HANDLE_EVENT (1 << 1)
+#define NS_TARGET_CHAIN_MAY_HAVE_MANAGER (1 << 2)
// nsEventTargetChainItem represents a single item in the event target chain.
class nsEventTargetChainItem
@@ -118,7 +119,6 @@ public:
return !!(mFlags & NS_TARGET_CHAIN_FORCE_CONTENT_DISPATCH);
}
-
void SetWantsWillHandleEvent(PRBool aWants)
{
if (aWants) {
@@ -133,6 +133,20 @@ public:
return !!(mFlags & NS_TARGET_CHAIN_WANTS_WILL_HANDLE_EVENT);
}
+ void SetMayHaveListenerManager(PRBool aMayHave)
+ {
+ if (aMayHave) {
+ mFlags |= NS_TARGET_CHAIN_MAY_HAVE_MANAGER;
+ } else {
+ mFlags &= ~NS_TARGET_CHAIN_MAY_HAVE_MANAGER;
+ }
+ }
+
+ PRBool MayHaveListenerManager()
+ {
+ return !!(mFlags & NS_TARGET_CHAIN_MAY_HAVE_MANAGER);
+ }
+
nsPIDOMEventTarget* CurrentTarget()
{
return mTarget;
@@ -158,12 +172,37 @@ public:
/**
* If the current item in the event target chain has an event listener
- * manager, this method sets the .currentTarget to the CurrentTarget()
- * and calls nsIEventListenerManager::HandleEvent().
+ * manager, this method calls nsIEventListenerManager::HandleEvent().
*/
nsresult HandleEvent(nsEventChainPostVisitor& aVisitor, PRUint32 aFlags,
PRBool aMayHaveNewListenerManagers,
- nsCxPusher* aPusher);
+ nsCxPusher* aPusher)
+ {
+ if (WantsWillHandleEvent()) {
+ mTarget->WillHandleEvent(aVisitor);
+ }
+ if (aVisitor.mEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH) {
+ return NS_OK;
+ }
+ if (!mManager) {
+ if (!MayHaveListenerManager() && !aMayHaveNewListenerManagers) {
+ return NS_OK;
+ }
+ mManager = mTarget->GetListenerManager(PR_FALSE);
+ }
+ if (mManager) {
+ NS_ASSERTION(aVisitor.mEvent->currentTarget == nsnull,
+ "CurrentTarget should be null!");
+ mManager->HandleEvent(aVisitor.mPresContext, aVisitor.mEvent,
+ &aVisitor.mDOMEvent,
+ CurrentTarget(), aFlags,
+ &aVisitor.mEventStatus,
+ aPusher);
+ NS_ASSERTION(aVisitor.mEvent->currentTarget == nsnull,
+ "CurrentTarget should be null!");
+ }
+ return NS_OK;
+ }
/**
* Copies mItemFlags and mItemData to aVisitor and calls PostHandleEvent.
@@ -217,43 +256,12 @@ nsEventTargetChainItem::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
nsresult rv = mTarget->PreHandleEvent(aVisitor);
SetForceContentDispatch(aVisitor.mForceContentDispatch);
SetWantsWillHandleEvent(aVisitor.mWantsWillHandleEvent);
+ SetMayHaveListenerManager(aVisitor.mMayHaveListenerManager);
mItemFlags = aVisitor.mItemFlags;
mItemData = aVisitor.mItemData;
return rv;
}
-nsresult
-nsEventTargetChainItem::HandleEvent(nsEventChainPostVisitor& aVisitor,
- PRUint32 aFlags,
- PRBool aMayHaveNewListenerManagers,
- nsCxPusher* aPusher)
-{
- if (WantsWillHandleEvent()) {
- mTarget->WillHandleEvent(aVisitor);
- }
- if (aVisitor.mEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH) {
- return NS_OK;
- }
- if (!mManager) {
- if (!aMayHaveNewListenerManagers) {
- return NS_OK;
- }
- mManager = mTarget->GetListenerManager(PR_FALSE);
- }
- if (mManager) {
- NS_ASSERTION(aVisitor.mEvent->currentTarget == nsnull,
- "CurrentTarget should be null!");
- mManager->HandleEvent(aVisitor.mPresContext, aVisitor.mEvent,
- &aVisitor.mDOMEvent,
- CurrentTarget(), aFlags,
- &aVisitor.mEventStatus,
- aPusher);
- NS_ASSERTION(aVisitor.mEvent->currentTarget == nsnull,
- "CurrentTarget should be null!");
- }
- return NS_OK;
-}
-
nsresult
nsEventTargetChainItem::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
{
@@ -470,6 +478,14 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
nsCOMPtr target = do_QueryInterface(aTarget);
#ifdef DEBUG
+ if (!nsContentUtils::IsSafeToRunScript()) {
+ nsresult rv = NS_ERROR_FAILURE;
+ if (target->GetContextForEventHandlers(&rv) ||
+ NS_FAILED(rv)) {
+ NS_ERROR("This is unsafe!");
+ }
+ }
+
if (aDOMEvent) {
nsCOMPtr privEvt(do_QueryInterface(aDOMEvent));
if (privEvt) {
@@ -580,7 +596,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
NS_EVENT_FLAG_BUBBLE |
NS_EVENT_FLAG_CAPTURE,
aCallback,
- PR_TRUE,
+ PR_FALSE,
&pusher);
preVisitor.mEventStatus = postVisitor.mEventStatus;
diff --git a/content/media/test/seek1.js b/content/media/test/seek1.js
index 504f3f3a8f0b..1a54d9601dae 100644
--- a/content/media/test/seek1.js
+++ b/content/media/test/seek1.js
@@ -12,13 +12,13 @@ function startTest() {
return false;
ok(!v.seeking, "seeking should default to false");
try {
- v.seeking = 1;
- readonly = false;
+ v.seeking = true;
+ readonly = v.seeking === false;
}
catch(e) {
- readonly = true;
+ readonly = "threw exception: " + e;
}
- ok(readonly, "seeking should be readonly");
+ is(readonly, true, "seeking should be readonly");
v.play();
v.currentTime=seekTime;
diff --git a/content/media/test/test_networkState.html b/content/media/test/test_networkState.html
index bd3e7b81108f..4b6374294d56 100644
--- a/content/media/test/test_networkState.html
+++ b/content/media/test/test_networkState.html
@@ -10,17 +10,37 @@