diff --git a/application/basilisk/.eslintrc.js b/application/basilisk/.eslintrc.js new file mode 100644 index 000000000..7bd47cc08 --- /dev/null +++ b/application/basilisk/.eslintrc.js @@ -0,0 +1,11 @@ +"use strict"; + +module.exports = { + "extends": [ + "../toolkit/.eslintrc.js" + ], + + "rules": { + "no-shadow": "error" + } +}; diff --git a/application/basilisk/LICENSE b/application/basilisk/LICENSE new file mode 100644 index 000000000..3955efd76 --- /dev/null +++ b/application/basilisk/LICENSE @@ -0,0 +1,7 @@ +Please see the file ../toolkit/content/license.html for the copyright +licensing conditions attached to this codebase, including copies of the +licenses concerned. + +You are not granted rights or licenses to the trademarks of +Moonchild Productions or any other party, including, without limitation, +the Basilisk name or logo. diff --git a/application/basilisk/Makefile.in b/application/basilisk/Makefile.in new file mode 100644 index 000000000..2eb9e708f --- /dev/null +++ b/application/basilisk/Makefile.in @@ -0,0 +1,16 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +include $(topsrcdir)/config/rules.mk + +ifdef MAKENSISU + +# For Windows build the uninstaller during the application build since the +# uninstaller is included with the application for mar file generation. +libs:: + $(MAKE) -C installer/windows uninstaller +ifdef MOZ_MAINTENANCE_SERVICE + $(MAKE) -C installer/windows maintenanceservice_installer +endif +endif diff --git a/application/basilisk/app-rules.mk b/application/basilisk/app-rules.mk new file mode 100644 index 000000000..2c3165304 --- /dev/null +++ b/application/basilisk/app-rules.mk @@ -0,0 +1 @@ +PURGECACHES_DIRS = $(DIST)/bin/browser diff --git a/application/basilisk/app.mozbuild b/application/basilisk/app.mozbuild new file mode 100644 index 000000000..2a8252ced --- /dev/null +++ b/application/basilisk/app.mozbuild @@ -0,0 +1,15 @@ +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +include('/toolkit/toolkit.mozbuild') + +if CONFIG['MOZ_EXTENSIONS']: + DIRS += ['/extensions'] + +DIRS += ['/%s' % CONFIG['MOZ_BRANDING_DIRECTORY']] + +# Never add dirs after browser because they apparently won't get +# packaged properly on Mac. +DIRS += ['/application/basilisk'] diff --git a/application/basilisk/app/Makefile.in b/application/basilisk/app/Makefile.in new file mode 100644 index 000000000..cdd6284dc --- /dev/null +++ b/application/basilisk/app/Makefile.in @@ -0,0 +1,103 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +dist_dest = $(DIST)/$(MOZ_MACBUNDLE_NAME) + +# hardcode en-US for the moment +AB_CD = en-US + +# Build a binary bootstrapping with XRE_main + +ifndef MOZ_WINCONSOLE +ifneq (,$(MOZ_DEBUG)$(MOZ_ASAN)) +MOZ_WINCONSOLE = 1 +else +MOZ_WINCONSOLE = 0 +endif +endif + +# This switches $(INSTALL) to copy mode, like $(SYSINSTALL), so things that +# shouldn't get 755 perms need $(IFLAGS1) for either way of calling nsinstall. +NSDISTMODE = copy + +include $(topsrcdir)/config/config.mk + +# If we are trying to show an error dialog about the lack of SSE2 support, +# make sure that code itself doesn't use SSE2. +ifdef MOZ_LINUX_32_SSE2_STARTUP_ERROR +CXXFLAGS := $(filter-out -march=% -msse -msse2 -mfpmath=sse,$(CXXFLAGS)) +CXX := $(filter-out -march=% -msse -msse2 -mfpmath=sse,$(CXX)) +CXXFLAGS += -mno-sse -mno-sse2 -mfpmath=387 +CXX += -march=pentiumpro +endif + +ifeq ($(OS_ARCH),WINNT) +# Rebuild basilisk.exe if the manifest changes - it's included by splash.rc. +# (this dependency should really be just for basilisk.exe, not other targets) +# Note the manifest file exists in the tree, so we use the explicit filename +# here. +EXTRA_DEPS += basilisk.exe.manifest +endif + +PROGRAMS_DEST = $(DIST)/bin + +include $(topsrcdir)/config/rules.mk + +ifneq (,$(filter-out WINNT,$(OS_ARCH))) + +ifdef COMPILE_ENVIRONMENT +libs:: + cp -p $(MOZ_APP_NAME)$(BIN_SUFFIX) $(DIST)/bin/$(MOZ_APP_NAME)-bin$(BIN_SUFFIX) +endif + +GARBAGE += $(addprefix $(FINAL_TARGET)/defaults/pref/, firefox.js) + +endif + +# channel-prefs.js is handled separate from other prefs due to bug 756325 +libs:: $(srcdir)/profile/channel-prefs.js + $(NSINSTALL) -D $(DIST)/bin/defaults/pref + $(call py_action,preprocessor,-Fsubstitution $(PREF_PPFLAGS) $(ACDEFINES) $^ -o $(DIST)/bin/defaults/pref/channel-prefs.js) + +ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) + +MAC_APP_NAME = $(MOZ_APP_DISPLAYNAME) + +ifdef MOZ_DEBUG +MAC_APP_NAME := $(MAC_APP_NAME)Debug +endif + +AB_CD = $(MOZ_UI_LOCALE) + +ifeq (zh-TW,$(AB_CD)) +LPROJ_ROOT := $(subst -,_,$(AB_CD)) +else +LPROJ_ROOT := $(firstword $(subst -, ,$(AB_CD))) +endif +LPROJ := Contents/Resources/$(LPROJ_ROOT).lproj + +clean clobber repackage:: + $(RM) -r $(dist_dest) + +MAC_BUNDLE_VERSION = $(shell $(PYTHON) $(srcdir)/macversion.py --version=$(MOZ_APP_VERSION) --buildid=$(DEPTH)/buildid.h) + +.PHONY: repackage +tools repackage:: $(DIST)/bin/$(MOZ_APP_NAME) + $(MKDIR) -p $(dist_dest)/Contents/MacOS + $(MKDIR) -p $(dist_dest)/$(LPROJ) + rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents $(dist_dest) --exclude English.lproj + rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(dist_dest)/$(LPROJ) + sed -e 's/%APP_VERSION%/$(MOZ_APP_VERSION)/' -e 's/%MAC_APP_NAME%/$(MAC_APP_NAME)/' -e 's/%MOZ_MACBUNDLE_ID%/$(MOZ_MACBUNDLE_ID)/' -e 's/%MAC_BUNDLE_VERSION%/$(MAC_BUNDLE_VERSION)/' $(srcdir)/macbuild/Contents/Info.plist.in > $(dist_dest)/Contents/Info.plist + sed -e 's/%MAC_APP_NAME%/$(MAC_APP_NAME)/' $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(dist_dest)/$(LPROJ)/InfoPlist.strings + rsync -a --exclude-from='$(srcdir)/macbuild/Contents/MacOS-files.in' $(DIST)/bin/ $(dist_dest)/Contents/Resources + rsync -a --include-from='$(srcdir)/macbuild/Contents/MacOS-files.in' --exclude '*' $(DIST)/bin/ $(dist_dest)/Contents/MacOS + $(RM) $(dist_dest)/Contents/MacOS/$(MOZ_APP_NAME) + rsync -aL $(DIST)/bin/$(MOZ_APP_NAME) $(dist_dest)/Contents/MacOS + cp -RL $(DIST)/branding/firefox.icns $(dist_dest)/Contents/Resources/firefox.icns + cp -RL $(DIST)/branding/document.icns $(dist_dest)/Contents/Resources/document.icns + $(MKDIR) -p $(dist_dest)/Contents/Library/LaunchServices + mv -f $(dist_dest)/Contents/MacOS/updater.app/Contents/MacOS/org.mozilla.updater $(dist_dest)/Contents/Library/LaunchServices + ln -s ../../../../Library/LaunchServices/org.mozilla.updater $(dist_dest)/Contents/MacOS/updater.app/Contents/MacOS/org.mozilla.updater + printf APPLMOZB > $(dist_dest)/Contents/PkgInfo +endif diff --git a/application/basilisk/app/basilisk.exe.manifest b/application/basilisk/app/basilisk.exe.manifest new file mode 100644 index 000000000..079e15b58 --- /dev/null +++ b/application/basilisk/app/basilisk.exe.manifest @@ -0,0 +1,42 @@ + + + +Firefox + + + + + + + + + + + + + + + True/PM + + + + + + + + + + + diff --git a/application/basilisk/app/blocklist.xml b/application/basilisk/app/blocklist.xml new file mode 100644 index 000000000..1c71bcd61 --- /dev/null +++ b/application/basilisk/app/blocklist.xml @@ -0,0 +1,3604 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + + + + + + + + + app.update.auto + app.update.enabled + app.update.interval + app.update.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + browser.startup.homepage + + + + + + security.csp.enable + security.fileuri.strict_origin_policy + security.mixed_content.block_active_content + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.search.defaultenginename + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + browser.startup.homepage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + https://java.com/ + + + + + + + + + + + + + https://java.com/ + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + https://java.com/ + + + + + https://real.com/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + https://java.com/ + + + + + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + https://get.adobe.com/reader/ + + + + + https://get.adobe.com/reader/ + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + + + + https://java.com/ + + + + + + + + + + + + + https://get.adobe.com/reader + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + https://get.adobe.com/reader/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + https://get.adobe.com/shockwave/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + https://java.com/ + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + https://java.com/ + + + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + https://java.com/ + + + + + https://java.com/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + https://java.com/ + + + + + + https://java.com/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + https://java.com/ + + + + + + + + + + + + + https://java.com/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + https://java.com/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + https://java.com/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + + https://java.com/ + + + + + + https://java.com/ + + + + + + + + + https://get.adobe.com/reader + + + + + https://support.apple.com/en-us/HT205771 + + + + + + + + + + + https://java.com/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + https://java.com/ + + + + + + https://java.com/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + https://java.com/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + https://java.com/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + https://java.com/ + + + + + + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/shockwave/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + https://get.adobe.com/reader + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + https://java.com/ + + + + + https://www.microsoft.com/getsilverlight + + + + + + + + + https://get.adobe.com/flashplayer/ + + + + + + https://java.com/ + + + + + + https://java.com/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + https://get.adobe.com/flashplayer/ + + + + + + WINNT 6.1 + 0x10de + DIRECT2D + BLOCKED_DRIVER_VERSION + 8.17.12.5896 + LESS_THAN_OR_EQUAL + + 0x0a6c + + + + WINNT 6.2 + 0x1022 + DIRECT2D + BLOCKED_DRIVER_VERSION + 9.10.8.0 + LESS_THAN_OR_EQUAL + + + All + 0x8086 + BLOCKED_DRIVER_VERSION + 8.15.10.1872 + EQUAL + + 0x2a42 + 0x2e22 + 0x2e12 + 0x2e32 + 0x0046 + + + + All + 0x8086 + BLOCKED_DRIVER_VERSION + 8.15.10.1994 + EQUAL + + 0x2a42 + 0x2e22 + 0x2e12 + 0x2e32 + 0x0046 + + + + WINNT 5.2 + 0x8086 + HARDWARE_VIDEO_DECODING + BLOCKED_DRIVER_VERSION + 10.18.10.3947 + EQUAL + + + WINNT 6.3 + 0x8086 + HARDWARE_VIDEO_DECODING + BLOCKED_DRIVER_VERSION + 10.18.10.3947 + EQUAL + + + Darwin 12 + 0x1002 + WEBGL_MSAA + BLOCKED_DEVICE + + + Darwin 10 + 0x8086 + WEBGL_MSAA + BLOCKED_DEVICE + + + All + 0x1002 + DIRECT2D + BLOCKED_DRIVER_VERSION + 8.982.0.0 + EQUAL + + + WINNT 5.1 + 0x8086 + DIRECT3D_9_LAYERS + BLOCKED_DRIVER_VERSION + 6.14.10.5218 + LESS_THAN + + + Darwin 10 + 0x1002 + WEBGL_MSAA + BLOCKED_DEVICE + + + WINNT 5.1 + 0x8086 + HARDWARE_VIDEO_DECODING + BLOCKED_DRIVER_VERSION + 10.18.10.3947 + EQUAL + + + WINNT 6.2 + 0x1002 + DIRECT2D + BLOCKED_DRIVER_VERSION + 9.10.8.0 + LESS_THAN_OR_EQUAL + + + WINNT 10.0 + 0x8086 + HARDWARE_VIDEO_DECODING + BLOCKED_DRIVER_VERSION + 10.18.10.3947 + EQUAL + + + All + 0x1002 + DIRECT3D_9_LAYERS + BLOCKED_DRIVER_VERSION + 8.982.0.0 + EQUAL + + + WINNT 6.1 + 0x10de + DIRECT3D_9_LAYERS + BLOCKED_DRIVER_VERSION + 8.17.12.5896 + LESS_THAN_OR_EQUAL + + 0x0a6c + + + + WINNT 6.2 + 0x8086 + HARDWARE_VIDEO_DECODING + BLOCKED_DRIVER_VERSION + 10.18.10.3947 + EQUAL + + + WINNT 8.1 + 0x1002 + DIRECT2D + BLOCKED_DRIVER_VERSION + 15.201.1151.0 + LESS_THAN + + 0x6920 + 0x6921 + 0x6928 + 0x6929 + 0x692b + 0x692f + 0x6930 + 0x6938 + 0x6939 + 0x6900 + 0x6901 + 0x6902 + 0x6903 + 0x6907 + 0x7300 + 0x9870 + 0x9874 + 0x9875 + 0x9876 + 0x9877 + + + + WINNT 6.1 + 0x8086 + HARDWARE_VIDEO_DECODING + BLOCKED_DRIVER_VERSION + 10.18.10.3947 + EQUAL + + + All + 0x8086 + BLOCKED_DRIVER_VERSION + 8.15.10.2086 + EQUAL + + 0x2a42 + 0x2e22 + 0x2e12 + 0x2e32 + 0x0046 + + + + All + 0x1022 + DIRECT3D_9_LAYERS + BLOCKED_DRIVER_VERSION + 8.982.0.0 + EQUAL + + + Darwin 11 + 0x1002 + WEBGL_MSAA + BLOCKED_DEVICE + + + Darwin 11 + 0x8086 + WEBGL_MSAA + BLOCKED_DEVICE + + + All + 0x8086 + BLOCKED_DRIVER_VERSION + 8.15.10.1855 + EQUAL + + 0x2a42 + 0x2e22 + 0x2e12 + 0x2e32 + 0x0046 + + + + WINNT 6.1 + 0x1002 + DIRECT3D_9_LAYERS + BLOCKED_DEVICE + + 0x9802 + 0x9803 + 0x9803 + 0x9804 + 0x9805 + 0x9806 + 0x9807 + + + + WINNT 6.0 + 0x8086 + HARDWARE_VIDEO_DECODING + BLOCKED_DRIVER_VERSION + 10.18.10.3947 + EQUAL + + + Darwin 12 + 0x10de + WEBGL_MSAA + BLOCKED_DEVICE + + + Darwin 12 + 0x8086 + WEBGL_MSAA + BLOCKED_DEVICE + + + Darwin 11 + 0x10de + WEBGL_MSAA + BLOCKED_DEVICE + + + All + 0x8086 + BLOCKED_DRIVER_VERSION + 8.15.10.1851 + EQUAL + + 0x2a42 + 0x2e22 + 0x2e12 + 0x2e32 + 0x0046 + + + + WINNT 6.1 + 0x1002 + DIRECT2D + BLOCKED_DEVICE + + 0x9802 + 0x9803 + 0x9803 + 0x9804 + 0x9805 + 0x9806 + 0x9807 + + + + Darwin 10 + 0x10de + WEBGL_MSAA + BLOCKED_DEVICE + + + All + 0x8086 + BLOCKED_DRIVER_VERSION + 8.15.10.1883 + EQUAL + + 0x2a42 + 0x2e22 + 0x2e12 + 0x2e32 + 0x0046 + + + + All + 0x8086 + BLOCKED_DRIVER_VERSION + 8.15.10.1892 + EQUAL + + 0x2a42 + 0x2e22 + 0x2e12 + 0x2e32 + 0x0046 + + + + All + 0x1022 + DIRECT2D + BLOCKED_DRIVER_VERSION + 8.982.0.0 + EQUAL + + + WINNT 5.1 + 0x8086 + WEBGL_ANGLE + BLOCKED_DRIVER_VERSION + 6.14.10.5218 + LESS_THAN + + + + WINNT 10.0 + 0x1002 + DIRECT2D + BLOCKED_DRIVER_VERSION + 15.201.1151.0 + LESS_THAN + + 0x6920 + 0x6921 + 0x6928 + 0x6929 + 0x692b + 0x692f + 0x6930 + 0x6938 + 0x6939 + 0x6900 + 0x6901 + 0x6902 + 0x6903 + 0x6907 + 0x7300 + 0x9870 + 0x9874 + 0x9875 + 0x9876 + 0x9877 + + + + All + 0x8086 + DIRECT2D + BLOCKED_DRIVER_VERSION + 8.15.10.2413 + LESS_THAN_OR_EQUAL + + + WINNT 5.1 + 0x10de + DIRECT3D_9_LAYERS + BLOCKED_DRIVER_VERSION + 7.0.0.0 + GREATER_THAN_OR_EQUAL + + + diff --git a/application/basilisk/app/macbuild/Contents/Info.plist.in b/application/basilisk/app/macbuild/Contents/Info.plist.in new file mode 100644 index 000000000..62bd676d9 --- /dev/null +++ b/application/basilisk/app/macbuild/Contents/Info.plist.in @@ -0,0 +1,224 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + html + htm + shtml + xht + xhtml + + CFBundleTypeIconFile + document.icns + CFBundleTypeName + HTML Document + CFBundleTypeOSTypes + + HTML + + CFBundleTypeRole + Viewer + + + CFBundleTypeExtensions + + svg + + CFBundleTypeIconFile + document.icns + CFBundleTypeMIMETypes + + image/svg+xml + + CFBundleTypeName + SVG document + CFBundleTypeOSTypes + + TEXT + + CFBundleTypeRole + Viewer + NSDocumentClass + BrowserDocument + + + CFBundleTypeExtensions + + text + txt + js + log + css + xul + rdf + + CFBundleTypeIconFile + document.icns + CFBundleTypeName + Text Document + CFBundleTypeOSTypes + + TEXT + utxt + + CFBundleTypeRole + Viewer + + + CFBundleTypeExtensions + + jpeg + jpg + png + gif + + CFBundleTypeIconFile + fileBookmark.icns + CFBundleTypeName + document.icns + CFBundleTypeOSTypes + + GIFf + JPEG + PNGf + + CFBundleTypeRole + Viewer + + + CFBundleTypeExtensions + + oga + ogg + + CFBundleTypeIconFile + document.icns + CFBundleTypeMIMETypes + + audio/ogg + + CFBundleTypeName + HTML5 Audio (Ogg) + CFBundleTypeRole + Viewer + + + CFBundleTypeExtensions + + ogv + + CFBundleTypeIconFile + document.icns + CFBundleTypeMIMETypes + + video/ogg + + CFBundleTypeName + HTML5 Video (Ogg) + CFBundleTypeRole + Viewer + + + CFBundleTypeExtensions + + webm + + CFBundleTypeIconFile + document.icns + CFBundleTypeMIMETypes + + video/webm + + CFBundleTypeName + HTML5 Video (WebM) + CFBundleTypeRole + Viewer + + + CFBundleExecutable + basilisk + CFBundleGetInfoString + %MAC_APP_NAME% %APP_VERSION% + CFBundleIconFile + firefox.icns + CFBundleIdentifier + %MOZ_MACBUNDLE_ID% + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + %MAC_APP_NAME% + CFBundlePackageType + APPL + CFBundleShortVersionString + %APP_VERSION% + CFBundleSignature + MOZB + CFBundleURLTypes + + + CFBundleURLIconFile + document.icns + CFBundleURLName + http URL + CFBundleURLSchemes + + http + + + + CFBundleURLIconFile + document.icns + CFBundleURLName + https URL + CFBundleURLSchemes + + https + + + + CFBundleURLName + ftp URL + CFBundleURLSchemes + + ftp + + + + CFBundleURLName + file URL + CFBundleURLSchemes + + file + + + + CFBundleVersion + %MAC_BUNDLE_VERSION% + NSAppleScriptEnabled + + LSApplicationCategoryType + public.app-category.productivity + LSFileQuarantineEnabled + + LSMinimumSystemVersion + 10.9.0 + NSSupportsAutomaticGraphicsSwitching + + NSPrincipalClass + GoannaNSApplication + SMPrivilegedExecutables + + org.mozilla.updater + identifier "org.mozilla.updater" and ((anchor apple generic and certificate leaf[field.1.2.840.113635.100.6.1.9]) or (anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] and certificate leaf[field.1.2.840.113635.100.6.1.13] and certificate leaf[subject.OU] = "43AQ936H96")) + + NSDisablePersistence + + + diff --git a/application/basilisk/app/macbuild/Contents/MacOS-files.in b/application/basilisk/app/macbuild/Contents/MacOS-files.in new file mode 100644 index 000000000..849336bc9 --- /dev/null +++ b/application/basilisk/app/macbuild/Contents/MacOS-files.in @@ -0,0 +1,9 @@ +/*.app/*** +/*.dylib +/certutil +/firefox-bin +/gtest/*** +/pk12util +/ssltunnel +/xpcshell +/XUL diff --git a/application/basilisk/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in b/application/basilisk/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in new file mode 100644 index 000000000..74d192cb0 --- /dev/null +++ b/application/basilisk/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in @@ -0,0 +1,5 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +CFBundleName = "%MAC_APP_NAME%"; diff --git a/application/basilisk/app/macversion.py b/application/basilisk/app/macversion.py new file mode 100644 index 000000000..839aac1ff --- /dev/null +++ b/application/basilisk/app/macversion.py @@ -0,0 +1,44 @@ +#!/usr/bin/python +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +from optparse import OptionParser +import sys +import re + +o = OptionParser() +o.add_option("--buildid", dest="buildid") +o.add_option("--version", dest="version") + +(options, args) = o.parse_args() + +if not options.buildid: + print >>sys.stderr, "--buildid is required" + sys.exit(1) + +if not options.version: + print >>sys.stderr, "--version is required" + sys.exit(1) + +# We want to build a version number that matches the format allowed for +# CFBundleVersion (nnnnn[.nn[.nn]]). We'll incorporate both the version +# number as well as the date, so that it changes at least daily (for nightly +# builds), but also so that newly-built older versions (e.g. beta build) aren't +# considered "newer" than previously-built newer versions (e.g. a trunk nightly) + +define, MOZ_BUILDID, buildid = open(options.buildid, 'r').read().split() + +# extract only the major version (i.e. "14" from "14.0b1") +majorVersion = re.match(r'^(\d+)[^\d].*', options.version).group(1) +# last two digits of the year +twodigityear = buildid[2:4] +month = buildid[4:6] +if month[0] == '0': + month = month[1] +day = buildid[6:8] +if day[0] == '0': + day = day[1] + +print '%s.%s.%s' % (majorVersion + twodigityear, month, day) diff --git a/application/basilisk/app/module.ver b/application/basilisk/app/module.ver new file mode 100644 index 000000000..0373ff96d --- /dev/null +++ b/application/basilisk/app/module.ver @@ -0,0 +1,8 @@ +WIN32_MODULE_COMPANYNAME=Moonchild Productions +WIN32_MODULE_COPYRIGHT=©Basilisk and Mozilla Developers; available under the MPL 2 license. +WIN32_MODULE_PRODUCTVERSION=@MOZ_APP_WINVERSION@ +WIN32_MODULE_PRODUCTVERSION_STRING=@MOZ_APP_VERSION@ +WIN32_MODULE_TRADEMARKS=Basilisk is a Trademark of Moonchild Productions. +WIN32_MODULE_DESCRIPTION=@MOZ_APP_DISPLAYNAME@ +WIN32_MODULE_PRODUCTNAME=@MOZ_APP_DISPLAYNAME@ +WIN32_MODULE_NAME=@MOZ_APP_DISPLAYNAME@ diff --git a/application/basilisk/app/moz.build b/application/basilisk/app/moz.build new file mode 100644 index 000000000..2a6194868 --- /dev/null +++ b/application/basilisk/app/moz.build @@ -0,0 +1,97 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +DIRS += ['profile/extensions'] + +GoannaProgram(CONFIG['MOZ_APP_NAME']) + +JS_PREFERENCE_PP_FILES += [ + 'profile/firefox.js', +] + +SOURCES += [ + 'nsBrowserApp.cpp', +] + +FINAL_TARGET_FILES += ['blocklist.xml'] +FINAL_TARGET_FILES.defaults.profile += ['profile/prefs.js'] +FINAL_TARGET_FILES.defaults += ['permissions'] + +DEFINES['APP_VERSION'] = CONFIG['MOZ_APP_VERSION'] + +LOCAL_INCLUDES += [ + '!/build', + '/toolkit/xre', + '/xpcom/base', + '/xpcom/build', +] + +USE_LIBS += [ + 'mozglue', +] + +if CONFIG['LIBFUZZER']: + USE_LIBS += [ 'fuzzer' ] + LOCAL_INCLUDES += [ + '/tools/fuzzing/libfuzzer', + ] + +if CONFIG['_MSC_VER']: + # Always enter a Windows program through wmain, whether or not we're + # a console application. + WIN32_EXE_LDFLAGS += ['-ENTRY:wmainCRTStartup'] + +if CONFIG['OS_ARCH'] == 'WINNT': + RCINCLUDE = 'splash.rc' + DEFINES['MOZ_PHOENIX'] = True + +for cdm in CONFIG['MOZ_EME_MODULES']: + DEFINES['MOZ_%s_EME' % cdm.upper()] = True + +if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT': + # For sandbox includes and the include dependencies those have + LOCAL_INCLUDES += [ + '/security/sandbox/chromium', + '/security/sandbox/chromium-shim', + ] + + USE_LIBS += [ + 'sandbox_s', + ] + + DELAYLOAD_DLLS += [ + 'winmm.dll', + 'user32.dll', + ] + +# Control the default heap size. +# This is the heap returned by GetProcessHeap(). +# As we use the CRT heap, the default size is too large and wastes VM. +# +# The default heap size is 1MB on Win32. +# The heap will grow if need be. +# +# Set it to 256k. See bug 127069. +if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['GNU_CC']: + LDFLAGS += ['/HEAP:0x40000'] + +DISABLE_STL_WRAPPING = True + +if CONFIG['MOZ_LINKER']: + OS_LIBS += CONFIG['MOZ_ZLIB_LIBS'] + +if CONFIG['HAVE_CLOCK_MONOTONIC']: + OS_LIBS += CONFIG['REALTIME_LIBS'] + +if CONFIG['MOZ_GPSD']: + DEFINES['MOZ_GPSD'] = True + +if CONFIG['MOZ_LINUX_32_SSE2_STARTUP_ERROR']: + DEFINES['MOZ_LINUX_32_SSE2_STARTUP_ERROR'] = True + +for icon in ('firefox', 'document', 'newwindow', 'newtab', 'pbmode'): + DEFINES[icon.upper() + '_ICO'] = '"%s/%s/%s.ico"' % ( + TOPSRCDIR, CONFIG['MOZ_BRANDING_DIRECTORY'], icon) diff --git a/application/basilisk/app/nsBrowserApp.cpp b/application/basilisk/app/nsBrowserApp.cpp new file mode 100644 index 000000000..fc7876209 --- /dev/null +++ b/application/basilisk/app/nsBrowserApp.cpp @@ -0,0 +1,321 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsXULAppAPI.h" +#include "mozilla/XREAppData.h" +#include "application.ini.h" +#include "mozilla/Bootstrap.h" +#if defined(XP_WIN) +#include +#include +#elif defined(XP_UNIX) +#include +#include +#endif + +#include +#include +#include + +#include "nsCOMPtr.h" +#include "nsIFile.h" +#include "nsStringGlue.h" + +#ifdef XP_WIN +#ifdef MOZ_ASAN +// ASAN requires firefox.exe to be built with -MD, and it's OK if we don't +// support Windows XP SP2 in ASAN builds. +#define XRE_DONT_SUPPORT_XPSP2 +#endif +#define XRE_WANT_ENVIRON +#define strcasecmp _stricmp +#ifdef MOZ_SANDBOX +#include "mozilla/sandboxing/SandboxInitialization.h" +#endif +#endif +#include "BinaryPath.h" + +#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL + +#include "mozilla/Sprintf.h" +#include "mozilla/Telemetry.h" +#include "mozilla/WindowsDllBlocklist.h" + +#ifdef LIBFUZZER +#include "FuzzerDefs.h" +#endif + +#ifdef MOZ_LINUX_32_SSE2_STARTUP_ERROR +#include +#include "mozilla/Unused.h" + +static bool +IsSSE2Available() +{ + // The rest of the app has been compiled to assume that SSE2 is present + // unconditionally, so we can't use the normal copy of SSE.cpp here. + // Since SSE.cpp caches the results and we need them only transiently, + // instead of #including SSE.cpp here, let's just inline the specific check + // that's needed. + unsigned int level = 1u; + unsigned int eax, ebx, ecx, edx; + unsigned int bits = (1u<<26); + unsigned int max = __get_cpuid_max(0, nullptr); + if (level > max) { + return false; + } + __cpuid_count(level, 0, eax, ebx, ecx, edx); + return (edx & bits) == bits; +} + +static const char sSSE2Message[] = + "This browser version requires a processor with the SSE2 instruction " + "set extension.\nYou may be able to obtain a version that does not " + "require SSE2 from your Linux distribution.\n"; + +__attribute__((constructor)) +static void +SSE2Check() +{ + if (IsSSE2Available()) { + return; + } + // Using write() in order to avoid jemalloc-based buffering. Ignoring return + // values, since there isn't much we could do on failure and there is no + // point in trying to recover from errors. + MOZ_UNUSED(write(STDERR_FILENO, + sSSE2Message, + MOZ_ARRAY_LENGTH(sSSE2Message) - 1)); + // _exit() instead of exit() to avoid running the usual "at exit" code. + _exit(255); +} +#endif + +#if !defined(MOZ_WIDGET_COCOA) && !defined(MOZ_WIDGET_ANDROID) +#define MOZ_BROWSER_CAN_BE_CONTENTPROC +#include "../../ipc/contentproc/plugin-container.cpp" +#endif + +using namespace mozilla; + +#ifdef XP_MACOSX +#define kOSXResourcesFolder "Resources" +#endif +#define kDesktopFolder "browser" + +static void Output(const char *fmt, ... ) +{ + va_list ap; + va_start(ap, fmt); + +#ifndef XP_WIN + vfprintf(stderr, fmt, ap); +#else + char msg[2048]; + vsnprintf_s(msg, _countof(msg), _TRUNCATE, fmt, ap); + + wchar_t wide_msg[2048]; + MultiByteToWideChar(CP_UTF8, + 0, + msg, + -1, + wide_msg, + _countof(wide_msg)); +#if MOZ_WINCONSOLE + fwprintf_s(stderr, wide_msg); +#else + // Linking user32 at load-time interferes with the DLL blocklist (bug 932100). + // This is a rare codepath, so we can load user32 at run-time instead. + HMODULE user32 = LoadLibraryW(L"user32.dll"); + if (user32) { + decltype(MessageBoxW)* messageBoxW = + (decltype(MessageBoxW)*) GetProcAddress(user32, "MessageBoxW"); + if (messageBoxW) { + messageBoxW(nullptr, wide_msg, L"Basilisk", MB_OK + | MB_ICONERROR + | MB_SETFOREGROUND); + } + FreeLibrary(user32); + } +#endif +#endif + + va_end(ap); +} + +/** + * Return true if |arg| matches the given argument name. + */ +static bool IsArg(const char* arg, const char* s) +{ + if (*arg == '-') + { + if (*++arg == '-') + ++arg; + return !strcasecmp(arg, s); + } + +#if defined(XP_WIN) + if (*arg == '/') + return !strcasecmp(++arg, s); +#endif + + return false; +} + +Bootstrap::UniquePtr gBootstrap; + +static int do_main(int argc, char* argv[], char* envp[]) +{ + // Allow firefox.exe to launch XULRunner apps via -app + // Note that -app must be the *first* argument. + const char *appDataFile = getenv("XUL_APP_FILE"); + if ((!appDataFile || !*appDataFile) && + (argc > 1 && IsArg(argv[1], "app"))) { + if (argc == 2) { + Output("Incorrect number of arguments passed to -app"); + return 255; + } + appDataFile = argv[2]; + + char appEnv[MAXPATHLEN]; + SprintfLiteral(appEnv, "XUL_APP_FILE=%s", argv[2]); + if (putenv(strdup(appEnv))) { + Output("Couldn't set %s.\n", appEnv); + return 255; + } + argv[2] = argv[0]; + argv += 2; + argc -= 2; + } else if (argc > 1 && IsArg(argv[1], "xpcshell")) { + for (int i = 1; i < argc; i++) { + argv[i] = argv[i + 1]; + } + + XREShellData shellData; +#if defined(XP_WIN) && defined(MOZ_SANDBOX) + shellData.sandboxBrokerServices = + sandboxing::GetInitializedBrokerServices(); +#endif + + return gBootstrap->XRE_XPCShellMain(--argc, argv, envp, &shellData); + } + + BootstrapConfig config; + + if (appDataFile && *appDataFile) { + config.appData = nullptr; + config.appDataPath = appDataFile; + } else { + // no -app flag so we use the compiled-in app data + config.appData = &sAppData; + config.appDataPath = kDesktopFolder; + } + +#if defined(XP_WIN) && defined(MOZ_SANDBOX) + sandbox::BrokerServices* brokerServices = + sandboxing::GetInitializedBrokerServices(); +#if defined(MOZ_CONTENT_SANDBOX) + if (!brokerServices) { + Output("Couldn't initialize the broker services.\n"); + return 255; + } +#endif + config.sandboxBrokerServices = brokerServices; +#endif + +#ifdef LIBFUZZER + if (getenv("LIBFUZZER")) + gBootstrap->XRE_LibFuzzerSetDriver(fuzzer::FuzzerDriver); +#endif + + return gBootstrap->XRE_main(argc, argv, config); +} + +static nsresult +InitXPCOMGlue(const char *argv0) +{ + UniqueFreePtr exePath = BinaryPath::Get(argv0); + if (!exePath) { + Output("Couldn't find the application directory.\n"); + return NS_ERROR_FAILURE; + } + + gBootstrap = mozilla::GetBootstrap(exePath.get()); + if (!gBootstrap) { + Output("Couldn't load XPCOM.\n"); + return NS_ERROR_FAILURE; + } + + // This will set this thread as the main thread. + gBootstrap->NS_LogInit(); + + return NS_OK; +} + +int main(int argc, char* argv[], char* envp[]) +{ + mozilla::TimeStamp start = mozilla::TimeStamp::Now(); + +#ifdef HAS_DLL_BLOCKLIST + DllBlocklist_Initialize(); +#endif + +#ifdef MOZ_BROWSER_CAN_BE_CONTENTPROC + // We are launching as a content process, delegate to the appropriate + // main + if (argc > 1 && IsArg(argv[1], "contentproc")) { +#if defined(XP_WIN) && defined(MOZ_SANDBOX) + // We need to initialize the sandbox TargetServices before InitXPCOMGlue + // because we might need the sandbox broker to give access to some files. + if (IsSandboxedProcess() && !sandboxing::GetInitializedTargetServices()) { + Output("Failed to initialize the sandbox target services."); + return 255; + } +#endif + + nsresult rv = InitXPCOMGlue(argv[0]); + if (NS_FAILED(rv)) { + return 255; + } + + int result = content_process_main(gBootstrap.get(), argc, argv); + + // InitXPCOMGlue calls NS_LogInit, so we need to balance it here. + gBootstrap->NS_LogTerm(); + + return result; + } +#endif + + + nsresult rv = InitXPCOMGlue(argv[0]); + if (NS_FAILED(rv)) { + return 255; + } + + gBootstrap->XRE_StartupTimelineRecord(mozilla::StartupTimeline::START, start); + +#ifdef MOZ_BROWSER_CAN_BE_CONTENTPROC + gBootstrap->XRE_EnableSameExecutableForContentProc(); +#endif + + int result = do_main(argc, argv, envp); + + gBootstrap->NS_LogTerm(); + +#ifdef XP_MACOSX + // Allow writes again. While we would like to catch writes from static + // destructors to allow early exits to use _exit, we know that there is + // at least one such write that we don't control (see bug 826029). For + // now we enable writes again and early exits will have to use exit instead + // of _exit. + gBootstrap->XRE_StopLateWriteChecks(); +#endif + + gBootstrap.reset(); + + return result; +} diff --git a/application/basilisk/app/permissions b/application/basilisk/app/permissions new file mode 100644 index 000000000..a2afdded2 --- /dev/null +++ b/application/basilisk/app/permissions @@ -0,0 +1,23 @@ +# This file has default permissions for the permission manager. +# The file-format is strict: +# * matchtype \t type \t permission \t host +# * "origin" should be used for matchtype, "host" is supported for legacy reasons +# * type is a string that identifies the type of permission (e.g. "cookie") +# * permission is an integer between 1 and 15 +# See nsPermissionManager.cpp for more... + +# UITour +origin uitour 1 https://www.mozilla.org +origin uitour 1 https://self-repair.mozilla.org +origin uitour 1 https://support.mozilla.org +origin uitour 1 https://addons.mozilla.org +origin uitour 1 https://discovery.addons.mozilla.org +origin uitour 1 about:home + +# XPInstall +origin install 1 https://addons.mozilla.org +origin install 1 https://testpilot.firefox.com + +# Remote troubleshooting +origin remote-troubleshooting 1 https://input.mozilla.org +origin remote-troubleshooting 1 https://support.mozilla.org diff --git a/application/basilisk/app/profile/channel-prefs.js b/application/basilisk/app/profile/channel-prefs.js new file mode 100644 index 000000000..633c489f3 --- /dev/null +++ b/application/basilisk/app/profile/channel-prefs.js @@ -0,0 +1,5 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +pref("app.update.channel", "@MOZ_UPDATE_CHANNEL@"); diff --git a/application/basilisk/app/profile/extensions/moz.build b/application/basilisk/app/profile/extensions/moz.build new file mode 100644 index 000000000..bb02c9165 --- /dev/null +++ b/application/basilisk/app/profile/extensions/moz.build @@ -0,0 +1,7 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +DIRS += ['{972ce4c6-7e08-4474-a285-3208198ce6fd}'] diff --git a/application/basilisk/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf.in b/application/basilisk/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf.in new file mode 100644 index 000000000..4c346b4b9 --- /dev/null +++ b/application/basilisk/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf.in @@ -0,0 +1,42 @@ + + + + +#filter substitution + + + + + {972ce4c6-7e08-4474-a285-3208198ce6fd} + @MOZ_APP_VERSION_DISPLAY@ + + + + + @MOZ_APP_ID@ + @MOZ_APP_VERSION@ + @MOZ_APP_VERSION@ + + + + + Default + The default theme. + + + Mozilla + Mozilla Contributors + + + true + + classic/1.0 + + chrome://browser/content/default-theme-icon.svg + + + diff --git a/application/basilisk/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/moz.build b/application/basilisk/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/moz.build new file mode 100644 index 000000000..524877ea0 --- /dev/null +++ b/application/basilisk/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/moz.build @@ -0,0 +1,15 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION'] +DEFINES['MOZ_APP_VERSION_DISPLAY'] = CONFIG['MOZ_APP_VERSION_DISPLAY'] +DEFINES['MOZ_APP_ID'] = CONFIG['MOZ_APP_ID'] + +FINAL_TARGET = 'dist/bin/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}' + +FINAL_TARGET_PP_FILES += [ + 'install.rdf.in', +] diff --git a/application/basilisk/app/profile/firefox.js b/application/basilisk/app/profile/firefox.js new file mode 100644 index 000000000..4d0422f3e --- /dev/null +++ b/application/basilisk/app/profile/firefox.js @@ -0,0 +1,1576 @@ +# -*- indent-tabs-mode: nil; js-indent-level: 2 -*- +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// XXX Toolkit-specific preferences should be moved into toolkit.js + +#filter substitution + +# +# SYNTAX HINTS: +# +# - Dashes are delimiters; use underscores instead. +# - The first character after a period must be alphabetic. +# - Computed values (e.g. 50 * 1024) don't work. +# + +#ifdef XP_UNIX +#ifndef XP_MACOSX +#define UNIX_BUT_NOT_MAC +#endif +#endif + +pref("browser.chromeURL","chrome://browser/content/"); +pref("browser.hiddenWindowChromeURL", "chrome://browser/content/hiddenWindow.xul"); + +// Enables some extra Extension System Logging (can reduce performance) +pref("extensions.logging.enabled", false); + +// Disables strict compatibility, making addons compatible-by-default. +pref("extensions.strictCompatibility", false); + +// Specifies a minimum maxVersion an addon needs to say it's compatible with +// for it to be compatible by default. +pref("extensions.minCompatibleAppVersion", "4.0"); +// Temporary preference to forcibly make themes more safe with Australis even if +// extensions.checkCompatibility=false has been set. +pref("extensions.checkCompatibility.temporaryThemeOverride_minAppVersion", "29.0a1"); + +pref("xpinstall.customConfirmationUI", true); + +// Preferences for AMO integration +pref("extensions.getAddons.cache.enabled", false); +pref("extensions.getAddons.maxResults", 15); +pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/%LOCALE%/firefox/api/%API_VERSION%/search/guid:%IDS%?src=firefox&appOS=%OS%&appVersion=%VERSION%"); +pref("extensions.getAddons.getWithPerformance.url", "https://services.addons.mozilla.org/%LOCALE%/firefox/api/%API_VERSION%/search/guid:%IDS%?src=firefox&appOS=%OS%&appVersion=%VERSION%&tMain=%TIME_MAIN%&tFirstPaint=%TIME_FIRST_PAINT%&tSessionRestored=%TIME_SESSION_RESTORED%"); +pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%&platform=%OS%&appver=%VERSION%"); +pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/firefox/api/%API_VERSION%/search/%TERMS%/all/%MAX_RESULTS%/%OS%/%VERSION%/%COMPATIBILITY_MODE%?src=firefox"); +pref("extensions.webservice.discoverURL", "https://discovery.addons.mozilla.org/%LOCALE%/firefox/discovery/pane/%VERSION%/%OS%/%COMPATIBILITY_MODE%"); +pref("extensions.getAddons.recommended.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/list/recommended/all/%MAX_RESULTS%/%OS%/%VERSION%?src=firefox"); +pref("extensions.getAddons.link.url", "https://addons.mozilla.org/%LOCALE%/firefox/"); +pref("extensions.getAddons.themes.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/themes/?src=firefox"); + +pref("extensions.update.autoUpdateDefault", true); + +// Check AUS for system add-on updates. +pref("extensions.systemAddon.update.url", "http://localhost/dummy-system-addons.xml"); + +// Disable add-ons that are not installed by the user in all scopes by default. +// See the SCOPE constants in AddonManager.jsm for values to use here. +pref("extensions.autoDisableScopes", 15); + +// Whether or not webextension themes are supported. +pref("extensions.webextensions.themes.enabled", false); + +// Add-on content security policies. +pref("extensions.webextensions.base-content-security-policy", "script-src 'self' https://* moz-extension: blob: filesystem: 'unsafe-eval' 'unsafe-inline'; object-src 'self' https://* moz-extension: blob: filesystem:;"); +pref("extensions.webextensions.default-content-security-policy", "script-src 'self'; object-src 'self';"); + +// Require signed add-ons by default +pref("xpinstall.signatures.required", false); +pref("xpinstall.signatures.devInfoURL", "https://wiki.mozilla.org/Addons/Extension_Signing"); + +// Dictionary download preference +pref("browser.dictionaries.download.url", "https://addons.mozilla.org/%LOCALE%/firefox/dictionaries/"); + +// At startup, should we check to see if the installation +// date is older than some threshold +pref("app.update.checkInstallTime", true); + +// The number of days a binary is permitted to be old without checking is defined in +// firefox-branding.js (app.update.checkInstallTime.days) + +// The minimum delay in seconds for the timer to fire between the notification +// of each consumer of the timer manager. +// minimum=30 seconds, default=120 seconds, and maximum=300 seconds +pref("app.update.timerMinimumDelay", 120); + +// The minimum delay in milliseconds for the first firing after startup of the timer +// to notify consumers of the timer manager. +// minimum=10 seconds, default=30 seconds, and maximum=120 seconds +pref("app.update.timerFirstInterval", 30000); + +// App-specific update preferences + +// The interval to check for updates (app.update.interval) is defined in +// firefox-branding.js + +// Alternative windowtype for an application update user interface window. When +// a window with this windowtype is open the application update service won't +// open the normal application update user interface window. +pref("app.update.altwindowtype", "Browser:About"); + +// Enables some extra Application Update Logging (can reduce performance) +pref("app.update.log", false); + +// The number of general background check failures to allow before notifying the +// user of the failure. User initiated update checks always notify the user of +// the failure. +pref("app.update.backgroundMaxErrors", 10); + +// Whether or not app updates are enabled +pref("app.update.enabled", true); + +// If set to true, the Update Service will automatically download updates when +// app updates are enabled per the app.update.enabled preference and if the user +// can apply updates. +pref("app.update.auto", true); + +// If set to true, the Update Service will present no UI for any event. +pref("app.update.silent", false); + +// If set to true, the hamburger button will show badges for update events. +#ifndef RELEASE_OR_BETA +pref("app.update.badge", true); +#else +pref("app.update.badge", false); +#endif +// app.update.badgeWaitTime is in branding section + +// If set to true, the Update Service will apply updates in the background +// when it finishes downloading them. +pref("app.update.staging.enabled", true); + +// Update service URL: +pref("app.update.url", ""); +// app.update.url.manual is in branding section +// app.update.url.details is in branding section + +// app.update.interval is in branding section +// app.update.promptWaitTime is in branding section + +// Show the Update Checking/Ready UI when the user was idle for x seconds +pref("app.update.idletime", 60); + +// Whether or not to attempt using the service for updates. +#ifdef MOZ_MAINTENANCE_SERVICE +pref("app.update.service.enabled", true); +#endif + +// Symmetric (can be overridden by individual extensions) update preferences. +// e.g. +// extensions.{GUID}.update.enabled +// extensions.{GUID}.update.url +// .. etc .. +// +pref("extensions.update.enabled", true); +pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=53.0&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%"); +pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%"); +pref("extensions.update.interval", 86400); // Check for updates to Extensions and + // Themes every day +// Non-symmetric (not shared by extensions) extension-specific [update] preferences +pref("extensions.dss.enabled", false); // Dynamic Skin Switching +pref("extensions.dss.switchPending", false); // Non-dynamic switch pending after next + // restart. + +pref("extensions.{972ce4c6-7e08-4474-a285-3208198ce6fd}.name", "chrome://browser/locale/browser.properties"); +pref("extensions.{972ce4c6-7e08-4474-a285-3208198ce6fd}.description", "chrome://browser/locale/browser.properties"); + +pref("lightweightThemes.update.enabled", true); +pref("lightweightThemes.getMoreURL", "https://addons.mozilla.org/%LOCALE%/firefox/themes"); +pref("lightweightThemes.recommendedThemes", ""); + +// Enable the UI for Encrypted Media Extensions (EME) +#if defined(MOZ_WIDEVINE_EME) +pref("browser.eme.ui.enabled", true); +#else +pref("browser.eme.ui.enabled", false); +#endif + +// UI tour experience. +pref("browser.uitour.enabled", false); +pref("browser.uitour.loglevel", "Error"); +pref("browser.uitour.requireSecure", true); +pref("browser.uitour.themeOrigin", "https://addons.mozilla.org/%LOCALE%/firefox/themes/"); +pref("browser.uitour.url", "https://www.mozilla.org/%LOCALE%/firefox/%VERSION%/tour/"); +// How long to show a Hearbeat survey (two hours, in seconds) +pref("browser.uitour.surveyDuration", 0); + +pref("browser.customizemode.tip0.shown", true); +pref("browser.customizemode.tip0.learnMoreUrl", "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/customize"); + +pref("keyword.enabled", true); +pref("browser.fixup.domainwhitelist.localhost", true); + +pref("general.useragent.locale", "@AB_CD@"); +// We need Firefox compatibility mode enabled by default for Basilisk +pref("general.useragent.compatMode.firefox", true); + +pref("general.skins.selectedSkin", "classic/1.0"); + +pref("general.smoothScroll", true); +#ifdef UNIX_BUT_NOT_MAC +pref("general.autoScroll", false); +#else +pref("general.autoScroll", true); +#endif + +// At startup, check if we're the default browser and prompt user if not. +pref("browser.shell.checkDefaultBrowser", true); +pref("browser.shell.shortcutFavicons",true); +pref("browser.shell.mostRecentDateSetAsDefault", ""); +#ifdef RELEASE_OR_BETA +pref("browser.shell.skipDefaultBrowserCheckOnFirstRun", false); +#else +pref("browser.shell.skipDefaultBrowserCheckOnFirstRun", true); +#endif +pref("browser.shell.skipDefaultBrowserCheck", true); +pref("browser.shell.defaultBrowserCheckCount", 0); +pref("browser.defaultbrowser.notificationbar", false); + +// 0 = blank, 1 = home (browser.startup.homepage), 2 = last visited page, 3 = resume previous browser session +// The behavior of option 3 is detailed at: http://wiki.mozilla.org/Session_Restore +pref("browser.startup.page", 1); +pref("browser.startup.homepage", "chrome://branding/locale/browserconfig.properties"); +// Whether we should skip the homepage when opening the first-run page +pref("browser.startup.firstrunSkipsHomepage", false); + +pref("browser.slowStartup.notificationDisabled", false); +pref("browser.slowStartup.timeThreshold", 40000); +pref("browser.slowStartup.maxSamples", 5); + +// This url, if changed, MUST continue to point to an https url. Pulling arbitrary content to inject into +// this page over http opens us up to a man-in-the-middle attack that we'd rather not face. If you are a downstream +// repackager of this code using an alternate snippet url, please keep your users safe +pref("browser.aboutHomeSnippets.updateUrl", "https://snippets.cdn.mozilla.net/%STARTPAGE_VERSION%/%NAME%/%VERSION%/%APPBUILDID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/"); + +pref("browser.enable_automatic_image_resizing", true); +pref("browser.casting.enabled", false); +pref("browser.chrome.site_icons", true); +pref("browser.chrome.favicons", true); +// browser.warnOnQuit == false will override all other possible prompts when quitting or restarting +pref("browser.warnOnQuit", true); +// browser.showQuitWarning specifically controls the quit warning dialog. We +// might still show the window closing dialog with showQuitWarning == false. +pref("browser.showQuitWarning", false); +pref("browser.fullscreen.autohide", true); +pref("browser.fullscreen.animate", true); +pref("browser.overlink-delay", 80); + +#ifdef UNIX_BUT_NOT_MAC +pref("browser.urlbar.clickSelectsAll", false); +#else +pref("browser.urlbar.clickSelectsAll", true); +#endif +#ifdef UNIX_BUT_NOT_MAC +pref("browser.urlbar.doubleClickSelectsAll", true); +#else +pref("browser.urlbar.doubleClickSelectsAll", false); +#endif + +// Control autoFill behavior +pref("browser.urlbar.autoFill", true); +pref("browser.urlbar.autoFill.typed", true); + +// 0: Match anywhere (e.g., middle of words) +// 1: Match on word boundaries and then try matching anywhere +// 2: Match only on word boundaries (e.g., after / or .) +// 3: Match at the beginning of the url or title +pref("browser.urlbar.matchBehavior", 1); +pref("browser.urlbar.filter.javascript", true); + +// the maximum number of results to show in autocomplete when doing richResults +pref("browser.urlbar.maxRichResults", 10); +// The amount of time (ms) to wait after the user has stopped typing +// before starting to perform autocomplete. 50 is the default set in +// autocomplete.xml. +pref("browser.urlbar.delay", 50); + +// The special characters below can be typed into the urlbar to either restrict +// the search to visited history, bookmarked, tagged pages; or force a match on +// just the title text or url. +pref("browser.urlbar.restrict.history", "^"); +pref("browser.urlbar.restrict.bookmark", "*"); +pref("browser.urlbar.restrict.tag", "+"); +pref("browser.urlbar.restrict.openpage", "%"); +pref("browser.urlbar.restrict.typed", "~"); +pref("browser.urlbar.restrict.searches", "$"); +pref("browser.urlbar.match.title", "#"); +pref("browser.urlbar.match.url", "@"); + +// The default behavior for the urlbar can be configured to use any combination +// of the match filters with each additional filter adding more results (union). +pref("browser.urlbar.suggest.history", true); +pref("browser.urlbar.suggest.bookmark", true); +pref("browser.urlbar.suggest.openpage", true); +pref("browser.urlbar.suggest.searches", false); +pref("browser.urlbar.userMadeSearchSuggestionsChoice", false); +// 4 here means the suggestion notification will be automatically +// hidden the 4th day, so it will actually be shown on 3 different days. +pref("browser.urlbar.daysBeforeHidingSuggestionsPrompt", 4); +pref("browser.urlbar.lastSuggestionsPromptDate", 20160601); + +// Limit the number of characters sent to the current search engine to fetch +// suggestions. +pref("browser.urlbar.maxCharsForSearchSuggestions", 20); + +// Restrictions to current suggestions can also be applied (intersection). +// Typed suggestion works only if history is set to true. +pref("browser.urlbar.suggest.history.onlyTyped", false); + +pref("browser.urlbar.formatting.enabled", true); +pref("browser.urlbar.trimURLs", true); + +#if defined(NIGHTLY_BUILD) +pref("browser.urlbar.oneOffSearches", true); +#else +pref("browser.urlbar.oneOffSearches", false); +#endif + +// If changed to true, copying the entire URL from the location bar will put the +// human readable (percent-decoded) URL on the clipboard. +pref("browser.urlbar.decodeURLsOnCopy", false); + +pref("browser.altClickSave", false); + +// Enable logging downloads operations to the Console. +pref("browser.download.loglevel", "Error"); + +// Number of milliseconds to wait for the http headers (and thus +// the Content-Disposition filename) before giving up and falling back to +// picking a filename without that info in hand so that the user sees some +// feedback from their action. +pref("browser.download.saveLinkAsFilenameTimeout", 4000); + +pref("browser.download.useDownloadDir", true); +pref("browser.download.folderList", 1); +pref("browser.download.manager.addToRecentDocs", true); +pref("browser.download.manager.resumeOnWakeDelay", 10000); + +#ifdef RELEASE_OR_BETA +pref("browser.download.showPanelDropmarker", false); +#else +pref("browser.download.showPanelDropmarker", true); +#endif + +// This allows disabling the animated notifications shown by +// the Downloads Indicator when a download starts or completes. +pref("browser.download.animateNotifications", true); + +// This records whether or not the panel has been shown at least once. +pref("browser.download.panel.shown", false); + +#ifndef XP_MACOSX +pref("browser.helperApps.deleteTempFileOnExit", true); +#endif + +// search engines URL +pref("browser.search.searchEnginesURL", "https://addons.mozilla.org/%LOCALE%/firefox/search-engines/"); + +// pointer to the default engine name +pref("browser.search.defaultenginename", "chrome://browser-region/locale/region.properties"); + +// Ordering of Search Engines in the Engine list. +pref("browser.search.order.1", "chrome://browser-region/locale/region.properties"); +pref("browser.search.order.2", "chrome://browser-region/locale/region.properties"); +pref("browser.search.order.3", "chrome://browser-region/locale/region.properties"); + +// Market-specific search defaults +// This is disabled globally, and then enabled for individual locales +// in firefox-l10n.js +pref("browser.search.geoSpecificDefaults", false); +pref("browser.search.geoSpecificDefaults.url", ""); + +// US specific default (used as a fallback if the geoSpecificDefaults request fails). +pref("browser.search.defaultenginename.US", "data:text/plain,browser.search.defaultenginename.US=DuckDuckGo"); +pref("browser.search.order.US.1", "data:text/plain,browser.search.order.US.1=DuckDuckGo"); +pref("browser.search.order.US.2", "data:text/plain,browser.search.order.US.2=Bing"); +pref("browser.search.order.US.3", "data:text/plain,browser.search.order.US.3=Yahoo"); + +// search bar results always open in a new tab +pref("browser.search.openintab", false); + +// context menu searches open in the foreground +pref("browser.search.context.loadInBackground", false); + +// comma seperated list of of engines to hide in the search panel. +pref("browser.search.hiddenOneOffs", ""); + +#ifndef RELEASE_OR_BETA +pref("browser.search.reset.enabled", true); +#endif + +pref("browser.sessionhistory.max_entries", 50); + +// Built-in default permissions. +pref("permissions.manager.defaultsUrl", "resource://app/defaults/permissions"); + +// handle links targeting new windows +// 1=current window/tab, 2=new window, 3=new tab in most recent window +pref("browser.link.open_newwindow", 3); + +// handle external links (i.e. links opened from a different application) +// default: use browser.link.open_newwindow +// 1-3: see browser.link.open_newwindow for interpretation +pref("browser.link.open_newwindow.override.external", -1); + +// 0: no restrictions - divert everything +// 1: don't divert window.open at all +// 2: don't divert window.open with features +pref("browser.link.open_newwindow.restriction", 2); + +// If true, this pref causes windows opened by window.open to be forced into new +// tabs (rather than potentially opening separate windows, depending on +// window.open arguments) when the browser is in fullscreen mode. +// We set this differently on Mac because the fullscreen implementation there is +// different. +#ifdef XP_MACOSX +pref("browser.link.open_newwindow.disabled_in_fullscreen", true); +#else +pref("browser.link.open_newwindow.disabled_in_fullscreen", false); +#endif + +// Tabbed browser +pref("browser.tabs.closeWindowWithLastTab", true); +pref("browser.tabs.insertRelatedAfterCurrent", true); +pref("browser.tabs.warnOnClose", true); +pref("browser.tabs.warnOnCloseOtherTabs", true); +pref("browser.tabs.warnOnOpen", true); +pref("browser.tabs.maxOpenBeforeWarn", 15); +pref("browser.tabs.loadInBackground", true); +pref("browser.tabs.opentabfor.middleclick", true); +pref("browser.tabs.loadDivertedInBackground", false); +pref("browser.tabs.loadBookmarksInBackground", false); +pref("browser.tabs.tabClipWidth", 140); +pref("browser.tabs.animate", true); +#ifdef UNIX_BUT_NOT_MAC +pref("browser.tabs.drawInTitlebar", false); +#else +pref("browser.tabs.drawInTitlebar", true); +#endif + +// When tabs opened by links in other tabs via a combination of +// browser.link.open_newwindow being set to 3 and target="_blank" etc are +// closed: +// true return to the tab that opened this tab (its owner) +// false return to the adjacent tab (old default) +pref("browser.tabs.selectOwnerOnClose", true); + +pref("browser.tabs.showAudioPlayingIcon", true); +// This should match Chromium's audio indicator delay. +pref("browser.tabs.delayHidingAudioPlayingIconMS", 3000); + +pref("browser.ctrlTab.previews", false); + +// By default, do not export HTML at shutdown. +// If true, at shutdown the bookmarks in your menu and toolbar will +// be exported as HTML to the bookmarks.html file. +pref("browser.bookmarks.autoExportHTML", false); + +// The maximum number of daily bookmark backups to +// keep in {PROFILEDIR}/bookmarkbackups. Special values: +// -1: unlimited +// 0: no backups created (and deletes all existing backups) +pref("browser.bookmarks.max_backups", 15); + +pref("browser.bookmarks.showRecentlyBookmarked", true); + +// Scripts & Windows prefs +pref("dom.disable_open_during_load", true); +pref("javascript.options.showInConsole", true); +#ifdef DEBUG +pref("general.warnOnAboutConfig", false); +#endif + +// This is the pref to control the location bar, change this to true to +// force this - this makes the origin of popup windows more obvious to avoid +// spoofing. We would rather not do it by default because it affects UE for web +// applications, but without it there isn't a really good way to prevent chrome +// spoofing, see bug 337344 +pref("dom.disable_window_open_feature.location", true); +// prevent JS from setting status messages +pref("dom.disable_window_status_change", true); +// allow JS to move and resize existing windows +pref("dom.disable_window_move_resize", false); +// prevent JS from monkeying with window focus, etc +pref("dom.disable_window_flip", true); + +// popups.policy 1=allow,2=reject +pref("privacy.popups.policy", 1); +pref("privacy.popups.usecustom", true); +pref("privacy.popups.showBrowserMessage", true); + +pref("privacy.item.cookies", false); + +pref("privacy.clearOnShutdown.history", true); +pref("privacy.clearOnShutdown.formdata", true); +pref("privacy.clearOnShutdown.downloads", true); +pref("privacy.clearOnShutdown.cookies", true); +pref("privacy.clearOnShutdown.cache", true); +pref("privacy.clearOnShutdown.sessions", true); +pref("privacy.clearOnShutdown.offlineApps", false); +pref("privacy.clearOnShutdown.siteSettings", false); +pref("privacy.clearOnShutdown.openWindows", false); + +pref("privacy.cpd.history", true); +pref("privacy.cpd.formdata", true); +pref("privacy.cpd.passwords", false); +pref("privacy.cpd.downloads", true); +pref("privacy.cpd.cookies", true); +pref("privacy.cpd.cache", true); +pref("privacy.cpd.sessions", true); +pref("privacy.cpd.offlineApps", false); +pref("privacy.cpd.siteSettings", false); +pref("privacy.cpd.openWindows", false); + +pref("privacy.history.custom", false); + +// What default should we use for the time span in the sanitizer: +// 0 - Clear everything +// 1 - Last Hour +// 2 - Last 2 Hours +// 3 - Last 4 Hours +// 4 - Today +// 5 - Last 5 minutes +// 6 - Last 24 hours +pref("privacy.sanitize.timeSpan", 1); +pref("privacy.sanitize.sanitizeOnShutdown", false); + +pref("privacy.sanitize.migrateFx3Prefs", false); + +pref("privacy.panicButton.enabled", true); + +pref("privacy.firstparty.isolate", false); + +// Time until temporary permissions expire, in ms +pref("privacy.temporary_permission_expire_time_ms", 3600000); + +// Show the SafeBrowsing UI controls or not. +pref("browser.safebrowsing.UI.enabled", true); + +pref("network.proxy.share_proxy_settings", false); // use the same proxy settings for all protocols + +// simple gestures support +pref("browser.gesture.swipe.left", "Browser:BackOrBackDuplicate"); +pref("browser.gesture.swipe.right", "Browser:ForwardOrForwardDuplicate"); +pref("browser.gesture.swipe.up", "cmd_scrollTop"); +pref("browser.gesture.swipe.down", "cmd_scrollBottom"); +#ifdef XP_MACOSX +pref("browser.gesture.pinch.latched", true); +pref("browser.gesture.pinch.threshold", 150); +#else +pref("browser.gesture.pinch.latched", false); +pref("browser.gesture.pinch.threshold", 25); +#endif +#ifdef XP_WIN +// Enabled for touch input display zoom. +pref("browser.gesture.pinch.out", "cmd_fullZoomEnlarge"); +pref("browser.gesture.pinch.in", "cmd_fullZoomReduce"); +pref("browser.gesture.pinch.out.shift", "cmd_fullZoomReset"); +pref("browser.gesture.pinch.in.shift", "cmd_fullZoomReset"); +#else +// Disabled by default due to issues with track pad input. +pref("browser.gesture.pinch.out", ""); +pref("browser.gesture.pinch.in", ""); +pref("browser.gesture.pinch.out.shift", ""); +pref("browser.gesture.pinch.in.shift", ""); +#endif +pref("browser.gesture.twist.latched", false); +pref("browser.gesture.twist.threshold", 0); +pref("browser.gesture.twist.right", "cmd_gestureRotateRight"); +pref("browser.gesture.twist.left", "cmd_gestureRotateLeft"); +pref("browser.gesture.twist.end", "cmd_gestureRotateEnd"); +pref("browser.gesture.tap", "cmd_fullZoomReset"); + +pref("browser.snapshots.limit", 0); + +// 0: Nothing happens +// 1: Scrolling contents +// 2: Go back or go forward, in your history +// 3: Zoom in or out. +#ifdef XP_MACOSX +// On OS X, if the wheel has one axis only, shift+wheel comes through as a +// horizontal scroll event. Thus, we can't assign anything other than normal +// scrolling to shift+wheel. +pref("mousewheel.with_alt.action", 2); +pref("mousewheel.with_shift.action", 1); +// On MacOS X, control+wheel is typically handled by system and we don't +// receive the event. So, command key which is the main modifier key for +// acceleration is the best modifier for zoom-in/out. However, we should keep +// the control key setting for backward compatibility. +pref("mousewheel.with_meta.action", 3); // command key on Mac +// Disable control-/meta-modified horizontal mousewheel events, since +// those are used on Mac as part of modified swipe gestures (e.g. +// Left swipe+Cmd = go back in a new tab). +pref("mousewheel.with_control.action.override_x", 0); +pref("mousewheel.with_meta.action.override_x", 0); +#else +pref("mousewheel.with_alt.action", 1); +pref("mousewheel.with_shift.action", 2); +pref("mousewheel.with_meta.action", 1); // win key on Win, Super/Hyper on Linux +#endif +pref("mousewheel.with_control.action",3); +pref("mousewheel.with_win.action", 1); + +pref("browser.xul.error_pages.enabled", true); +pref("browser.xul.error_pages.expert_bad_cert", false); + +// Enable captive portal detection. +pref("network.captive-portal-service.enabled", true); + +// If true, network link events will change the value of navigator.onLine +pref("network.manage-offline-status", true); + +// We want to make sure mail URLs are handled externally... +pref("network.protocol-handler.external.mailto", true); // for mail +pref("network.protocol-handler.external.news", true); // for news +pref("network.protocol-handler.external.snews", true); // for secure news +pref("network.protocol-handler.external.nntp", true); // also news +#ifdef XP_WIN +pref("network.protocol-handler.external.ms-windows-store", true); +#endif + +// ...without warning dialogs +pref("network.protocol-handler.warn-external.mailto", false); +pref("network.protocol-handler.warn-external.news", false); +pref("network.protocol-handler.warn-external.snews", false); +pref("network.protocol-handler.warn-external.nntp", false); +#ifdef XP_WIN +pref("network.protocol-handler.warn-external.ms-windows-store", false); +#endif + +// By default, all protocol handlers are exposed. This means that +// the browser will respond to openURL commands for all URL types. +// It will also try to open link clicks inside the browser before +// failing over to the system handlers. +pref("network.protocol-handler.expose-all", true); +pref("network.protocol-handler.expose.mailto", false); +pref("network.protocol-handler.expose.news", false); +pref("network.protocol-handler.expose.snews", false); +pref("network.protocol-handler.expose.nntp", false); + +pref("accessibility.typeaheadfind", false); +pref("accessibility.typeaheadfind.timeout", 5000); +pref("accessibility.typeaheadfind.linksonly", false); +pref("accessibility.typeaheadfind.flashBar", 1); + +#ifdef NIGHTLY_BUILD +pref("findbar.highlightAll", true); +pref("findbar.modalHighlight", true); +#endif + +// Tracks when accessibility is loaded into the previous session. +pref("accessibility.loadedInLastSession", false); + +pref("plugins.click_to_play", true); +pref("plugins.testmode", false); + +pref("plugin.default.state", 1); + +// Plugins bundled in XPIs are enabled by default. +pref("plugin.defaultXpi.state", 2); + +// Flash is enabled by default, and Java is click-to-activate by default on +// all channels. +pref("plugin.state.flash", 2); +pref("plugin.state.java", 1); + +// On ESR only, we re-enable all plugins instead of only loading Flash. +pref("plugin.load_flash_only", false); + +#ifdef XP_WIN +pref("browser.preferences.instantApply", false); +#else +pref("browser.preferences.instantApply", true); +#endif + +pref("browser.download.show_plugins_in_list", true); +pref("browser.download.hide_plugins_without_extensions", true); + +// Backspace and Shift+Backspace behavior +// 0 goes Back/Forward +// 1 act like PgUp/PgDown +// 2 and other values, nothing +#ifdef UNIX_BUT_NOT_MAC +pref("browser.backspace_action", 2); +#else +pref("browser.backspace_action", 0); +#endif + +// this will automatically enable inline spellchecking (if it is available) for +// editable elements in HTML +// 0 = spellcheck nothing +// 1 = check multi-line controls [default] +// 2 = check multi/single line controls +pref("layout.spellcheckDefault", 1); + +pref("browser.send_pings", false); + +/* initial web feed readers list */ +pref("browser.contentHandlers.types.0.title", "chrome://browser-region/locale/region.properties"); +pref("browser.contentHandlers.types.0.uri", "chrome://browser-region/locale/region.properties"); +pref("browser.contentHandlers.types.0.type", "application/vnd.mozilla.maybe.feed"); +pref("browser.contentHandlers.types.1.title", "chrome://browser-region/locale/region.properties"); +pref("browser.contentHandlers.types.1.uri", "chrome://browser-region/locale/region.properties"); +pref("browser.contentHandlers.types.1.type", "application/vnd.mozilla.maybe.feed"); +pref("browser.contentHandlers.types.2.title", "chrome://browser-region/locale/region.properties"); +pref("browser.contentHandlers.types.2.uri", "chrome://browser-region/locale/region.properties"); +pref("browser.contentHandlers.types.2.type", "application/vnd.mozilla.maybe.feed"); +pref("browser.contentHandlers.types.3.title", "chrome://browser-region/locale/region.properties"); +pref("browser.contentHandlers.types.3.uri", "chrome://browser-region/locale/region.properties"); +pref("browser.contentHandlers.types.3.type", "application/vnd.mozilla.maybe.feed"); +pref("browser.contentHandlers.types.4.title", "chrome://browser-region/locale/region.properties"); +pref("browser.contentHandlers.types.4.uri", "chrome://browser-region/locale/region.properties"); +pref("browser.contentHandlers.types.4.type", "application/vnd.mozilla.maybe.feed"); +pref("browser.contentHandlers.types.5.title", "chrome://browser-region/locale/region.properties"); +pref("browser.contentHandlers.types.5.uri", "chrome://browser-region/locale/region.properties"); +pref("browser.contentHandlers.types.5.type", "application/vnd.mozilla.maybe.feed"); + +pref("browser.feeds.handler", "ask"); +pref("browser.videoFeeds.handler", "ask"); +pref("browser.audioFeeds.handler", "ask"); + +// At startup, if the handler service notices that the version number in the +// region.properties file is newer than the version number in the handler +// service datastore, it will add any new handlers it finds in the prefs (as +// seeded by this file) to its datastore. +pref("goanna.handlerService.defaultHandlersVersion", "chrome://browser-region/locale/region.properties"); + +// The default set of web-based protocol handlers shown in the application +// selection dialog for webcal: ; I've arbitrarily picked 4 default handlers +// per protocol, but if some locale wants more than that (or defaults for some +// protocol not currently listed here), we should go ahead and add those. + +// webcal +pref("goanna.handlerService.schemes.webcal.0.name", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.webcal.0.uriTemplate", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.webcal.1.name", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.webcal.1.uriTemplate", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.webcal.2.name", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.webcal.2.uriTemplate", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.webcal.3.name", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.webcal.3.uriTemplate", "chrome://browser-region/locale/region.properties"); + +// mailto +pref("goanna.handlerService.schemes.mailto.0.name", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.mailto.0.uriTemplate", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.mailto.1.name", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.mailto.1.uriTemplate", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.mailto.2.name", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.mailto.2.uriTemplate", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.mailto.3.name", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.mailto.3.uriTemplate", "chrome://browser-region/locale/region.properties"); + +// irc +pref("goanna.handlerService.schemes.irc.0.name", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.irc.0.uriTemplate", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.irc.1.name", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.irc.1.uriTemplate", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.irc.2.name", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.irc.2.uriTemplate", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.irc.3.name", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.irc.3.uriTemplate", "chrome://browser-region/locale/region.properties"); + +// ircs +pref("goanna.handlerService.schemes.ircs.0.name", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.ircs.0.uriTemplate", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.ircs.1.name", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.ircs.1.uriTemplate", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.ircs.2.name", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.ircs.2.uriTemplate", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.ircs.3.name", "chrome://browser-region/locale/region.properties"); +pref("goanna.handlerService.schemes.ircs.3.uriTemplate", "chrome://browser-region/locale/region.properties"); + +pref("browser.geolocation.warning.infoURL", "https://www.basilisk-browser.org/geolocation.shtml"); + +pref("browser.EULA.version", 3); +pref("browser.rights.version", 3); +pref("browser.rights.3.shown", false); + +#ifdef DEBUG +// Don't show the about:rights notification in debug builds. +pref("browser.rights.override", true); +#endif + +pref("browser.selfsupport.url", ""); + +pref("browser.sessionstore.resume_from_crash", true); +pref("browser.sessionstore.resume_session_once", false); + +// minimal interval between two save operations in milliseconds +pref("browser.sessionstore.interval", 15000); +// on which sites to save text data, POSTDATA and cookies +// 0 = everywhere, 1 = unencrypted sites, 2 = nowhere +pref("browser.sessionstore.privacy_level", 0); +// how many tabs can be reopened (per window) +pref("browser.sessionstore.max_tabs_undo", 10); +// how many windows can be reopened (per session) - on non-OS X platforms this +// pref may be ignored when dealing with pop-up windows to ensure proper startup +pref("browser.sessionstore.max_windows_undo", 3); +// number of crashes that can occur before the about:sessionrestore page is displayed +// (this pref has no effect if more than 6 hours have passed since the last crash) +pref("browser.sessionstore.max_resumed_crashes", 1); +// number of back button session history entries to restore (-1 = all of them) +pref("browser.sessionstore.max_serialize_back", 10); +// number of forward button session history entries to restore (-1 = all of them) +pref("browser.sessionstore.max_serialize_forward", -1); +// restore_on_demand overrides MAX_CONCURRENT_TAB_RESTORES (sessionstore constant) +// and restore_hidden_tabs. When true, tabs will not be restored until they are +// focused (also applies to tabs that aren't visible). When false, the values +// for MAX_CONCURRENT_TAB_RESTORES and restore_hidden_tabs are respected. +// Selected tabs are always restored regardless of this pref. +pref("browser.sessionstore.restore_on_demand", true); +// Whether to automatically restore hidden tabs (i.e., tabs in other tab groups) or not +pref("browser.sessionstore.restore_hidden_tabs", false); +// If restore_on_demand is set, pinned tabs are restored on startup by default. +// When set to true, this pref overrides that behavior, and pinned tabs will only +// be restored when they are focused. +pref("browser.sessionstore.restore_pinned_tabs_on_demand", false); +// The version at which we performed the latest upgrade backup +pref("browser.sessionstore.upgradeBackup.latestBuildID", ""); +// How many upgrade backups should be kept +pref("browser.sessionstore.upgradeBackup.maxUpgradeBackups", 3); +// End-users should not run sessionstore in debug mode +pref("browser.sessionstore.debug", false); +// Causes SessionStore to ignore non-final update messages from +// browser tabs that were not caused by a flush from the parent. +// This is a testing flag and should not be used by end-users. +pref("browser.sessionstore.debug.no_auto_updates", false); +// Forget closed windows/tabs after two weeks +pref("browser.sessionstore.cleanup.forget_closed_after", 1209600000); + +// allow META refresh by default +pref("accessibility.blockautorefresh", false); + +// Whether history is enabled or not. +pref("places.history.enabled", true); + +// the (maximum) number of the recent visits to sample +// when calculating frecency +pref("places.frecency.numVisits", 10); + +// buckets (in days) for frecency calculation +pref("places.frecency.firstBucketCutoff", 4); +pref("places.frecency.secondBucketCutoff", 14); +pref("places.frecency.thirdBucketCutoff", 31); +pref("places.frecency.fourthBucketCutoff", 90); + +// weights for buckets for frecency calculations +pref("places.frecency.firstBucketWeight", 100); +pref("places.frecency.secondBucketWeight", 70); +pref("places.frecency.thirdBucketWeight", 50); +pref("places.frecency.fourthBucketWeight", 30); +pref("places.frecency.defaultBucketWeight", 10); + +// bonus (in percent) for visit transition types for frecency calculations +pref("places.frecency.embedVisitBonus", 0); +pref("places.frecency.framedLinkVisitBonus", 0); +pref("places.frecency.linkVisitBonus", 100); +pref("places.frecency.typedVisitBonus", 2000); +// The bookmarks bonus is always added on top of any other bonus, including +// the redirect source and the typed ones. +pref("places.frecency.bookmarkVisitBonus", 75); +// The redirect source bonus overwrites any transition bonus. +// 0 would hide these pages, instead we want them low ranked. Thus we use +// linkVisitBonus - bookmarkVisitBonus, so that a bookmarked source is in par +// with a common link. +pref("places.frecency.redirectSourceVisitBonus", 25); +pref("places.frecency.downloadVisitBonus", 0); +// The perm/temp redirects here relate to redirect targets, not sources. +pref("places.frecency.permRedirectVisitBonus", 50); +pref("places.frecency.tempRedirectVisitBonus", 40); +pref("places.frecency.reloadVisitBonus", 0); +pref("places.frecency.defaultVisitBonus", 0); + +// bonus (in percent) for place types for frecency calculations +pref("places.frecency.unvisitedBookmarkBonus", 140); +pref("places.frecency.unvisitedTypedBonus", 200); + +// Controls behavior of the "Add Exception" dialog launched from SSL error pages +// 0 - don't pre-populate anything +// 1 - pre-populate site URL, but don't fetch certificate +// 2 - pre-populate site URL and pre-fetch certificate +pref("browser.ssl_override_behavior", 2); + +// True if the user should be prompted when a web application supports +// offline apps. +pref("browser.offline-apps.notify", true); + +// if true, use full page zoom instead of text zoom +pref("browser.zoom.full", true); + +// Whether or not to save and restore zoom levels on a per-site basis. +pref("browser.zoom.siteSpecific", true); + +// Whether or not to update background tabs to the current zoom level. +pref("browser.zoom.updateBackgroundTabs", true); + +// The breakpad report server to link to in about:crashes +pref("breakpad.reportURL", "https://crash-stats.mozilla.com/report/index/"); + +// URL for "Learn More" for Crash Reporter +pref("toolkit.crashreporter.infoURL", + "https://www.mozilla.org/legal/privacy/firefox.html#crash-reporter"); + +// base URL for web-based support pages +pref("app.support.baseURL", "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/"); + +// a11y conflicts with e10s support page +pref("app.support.e10sAccessibilityUrl", "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/accessibility-ppt"); + +// base url for web-based feedback pages +pref("app.feedback.baseURL", "https://forum.palemoon.org/viewforum.php?f=61"); + +// Name of alternate about: page for certificate errors (when undefined, defaults to about:neterror) +pref("security.alternate_certificate_error_page", "certerror"); + +// Whether to start the private browsing mode at application startup +pref("browser.privatebrowsing.autostart", false); + +// Don't try to alter this pref, it'll be reset the next time you use the +// bookmarking dialog +pref("browser.bookmarks.editDialog.firstEditField", "namePicker"); + +pref("dom.ipc.plugins.flash.disable-protected-mode", false); + +// Feature-disable the protected-mode auto-flip +pref("browser.flash-protected-mode-flip.enable", false); + +// Whether we've already flipped protected mode automatically +pref("browser.flash-protected-mode-flip.done", false); + +pref("dom.ipc.shims.enabledWarnings", false); + +// Start the browser in e10s mode +pref("browser.tabs.remote.autostart", false); +pref("browser.tabs.remote.desktopbehavior", true); + +#if defined(XP_WIN) && defined(MOZ_SANDBOX) +// When this pref is true the Windows process sandbox will set up dummy +// interceptions and log to the browser console when calls fail in the sandboxed +// process and also if they are subsequently allowed by the broker process. +// This will require a restart. +pref("security.sandbox.windows.log", false); + +// Controls whether and how the Windows NPAPI plugin process is sandboxed. +// To get a different setting for a particular plugin replace "default", with +// the plugin's nice file name, see: nsPluginTag::GetNiceFileName. +// On windows these levels are: +// 0 - no sandbox +// 1 - sandbox with USER_NON_ADMIN access token level +// 2 - a more strict sandbox, which might cause functionality issues. This now +// includes running at low integrity. +// 3 - the strongest settings we seem to be able to use without breaking +// everything, but will probably cause some functionality restrictions +pref("dom.ipc.plugins.sandbox-level.default", 0); +#if defined(_AMD64_) +// The lines in PluginModuleParent.cpp should be changed in line with this. +pref("dom.ipc.plugins.sandbox-level.flash", 2); +#else +pref("dom.ipc.plugins.sandbox-level.flash", 0); +#endif + +#if defined(MOZ_CONTENT_SANDBOX) +// This controls the strength of the Windows content process sandbox for testing +// purposes. This will require a restart. +// On windows these levels are: +// See - security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp +// SetSecurityLevelForContentProcess() for what the different settings mean. +#if defined(NIGHTLY_BUILD) +pref("security.sandbox.content.level", 2); +#else +pref("security.sandbox.content.level", 1); +#endif + +// This controls the depth of stack trace that is logged when Windows sandbox +// logging is turned on. This is only currently available for the content +// process because the only other sandbox (for GMP) has too strict a policy to +// allow stack tracing. This does not require a restart to take effect. +pref("security.sandbox.windows.log.stackTraceDepth", 0); +#endif +#endif + +#if defined(XP_MACOSX) && defined(MOZ_SANDBOX) && defined(MOZ_CONTENT_SANDBOX) +// This pref is discussed in bug 1083344, the naming is inspired from its +// Windows counterpart, but on Mac it's an integer which means: +// 0 -> "no sandbox" +// 1 -> "preliminary content sandboxing enabled: write access to +// home directory is prevented" +// 2 -> "preliminary content sandboxing enabled with profile protection: +// write access to home directory is prevented, read and write access +// to ~/Library and profile directories are prevented (excluding +// $PROFILE/{extensions,weave})" +// This setting is read when the content process is started. On Mac the content +// process is killed when all windows are closed, so a change will take effect +// when the 1st window is opened. +#if defined(NIGHTLY_BUILD) +pref("security.sandbox.content.level", 2); +#else +pref("security.sandbox.content.level", 1); +#endif +#endif + +#if defined(XP_LINUX) && defined(MOZ_SANDBOX) && defined(MOZ_CONTENT_SANDBOX) +// This pref is introduced as part of bug 742434, the naming is inspired from +// its Windows/Mac counterpart, but on Linux it's an integer which means: +// 0 -> "no sandbox" +// 1 -> "content sandbox using seccomp-bpf when available" +// 2 -> "seccomp-bpf + file broker" +// Content sandboxing on Linux is currently in the stage of +// 'just getting it enabled', which includes a very permissive whitelist. We +// enable seccomp-bpf on nightly to see if everything is running, or if we need +// to whitelist more system calls. +// +// So the purpose of this setting is to allow nightly users to disable the +// sandbox while we fix their problems. This way, they won't have to wait for +// another nightly release which disables seccomp-bpf again. +// +// This setting may not be required anymore once we decide to permanently +// enable the content sandbox. +pref("security.sandbox.content.level", 2); +#endif + +#if defined(XP_MACOSX) || defined(XP_WIN) +#if defined(MOZ_SANDBOX) && defined(MOZ_CONTENT_SANDBOX) +// ID (a UUID when set by goanna) that is used to form the name of a +// sandbox-writable temporary directory to be used by content processes +// when a temporary writable file is required in a level 1 sandbox. +pref("security.sandbox.content.tempDirSuffix", ""); +#endif +#endif + +#if defined(MOZ_SANDBOX) +#if defined(XP_MACOSX) +// This pref determines if messages relevant to sandbox violations are +// logged. +// At present, this setting refers only to mac sandbox messages sent to +// the system console but the setting will be used on other platforms +// in the future. +pref("security.sandbox.logging.enabled", true); +#endif +#endif + +// This pref governs whether we attempt to work around problems caused by +// plugins using OS calls to manipulate the cursor while running out-of- +// process. These workarounds all involve intercepting (hooking) certain +// OS calls in the plugin process, then arranging to make certain OS calls +// in the browser process. Eventually plugins will be required to use the +// NPAPI to manipulate the cursor, and these workarounds will be removed. +// See bug 621117. +#ifdef XP_MACOSX +pref("dom.ipc.plugins.nativeCursorSupport", true); +#endif + +#ifdef XP_WIN +pref("browser.taskbar.previews.enable", false); +pref("browser.taskbar.previews.max", 20); +pref("browser.taskbar.previews.cachetime", 5); +pref("browser.taskbar.lists.enabled", true); +pref("browser.taskbar.lists.frequent.enabled", true); +pref("browser.taskbar.lists.recent.enabled", false); +pref("browser.taskbar.lists.maxListItemCount", 7); +pref("browser.taskbar.lists.tasks.enabled", true); +pref("browser.taskbar.lists.refreshInSeconds", 120); +#endif + +// The sync engines to use. +pref("services.sync.registerEngines", "Bookmarks,Form,History,Password,Prefs,Tab,Addons,ExtensionStorage"); +// Preferences to be synced by default +pref("services.sync.prefs.sync.accessibility.blockautorefresh", true); +pref("services.sync.prefs.sync.accessibility.browsewithcaret", true); +pref("services.sync.prefs.sync.accessibility.typeaheadfind", true); +pref("services.sync.prefs.sync.accessibility.typeaheadfind.linksonly", true); +pref("services.sync.prefs.sync.addons.ignoreUserEnabledChanges", true); +// The addons prefs related to repository verification are intentionally +// not synced for security reasons. If a system is compromised, a user +// could weaken the pref locally, install an add-on from an untrusted +// source, and this would propagate automatically to other, +// uncompromised Sync-connected devices. +pref("services.sync.prefs.sync.browser.ctrlTab.previews", true); +pref("services.sync.prefs.sync.browser.download.useDownloadDir", true); +pref("services.sync.prefs.sync.browser.formfill.enable", true); +pref("services.sync.prefs.sync.browser.link.open_newwindow", true); +pref("services.sync.prefs.sync.browser.newtabpage.enabled", true); +pref("services.sync.prefs.sync.browser.newtabpage.pinned", true); +pref("services.sync.prefs.sync.browser.offline-apps.notify", true); +pref("services.sync.prefs.sync.browser.safebrowsing.phishing.enabled", true); +pref("services.sync.prefs.sync.browser.safebrowsing.malware.enabled", true); +pref("services.sync.prefs.sync.browser.search.update", true); +pref("services.sync.prefs.sync.browser.sessionstore.restore_on_demand", true); +pref("services.sync.prefs.sync.browser.startup.homepage", true); +pref("services.sync.prefs.sync.browser.startup.page", true); +pref("services.sync.prefs.sync.browser.tabs.loadInBackground", true); +pref("services.sync.prefs.sync.browser.tabs.warnOnClose", true); +pref("services.sync.prefs.sync.browser.tabs.warnOnOpen", true); +pref("services.sync.prefs.sync.browser.urlbar.autocomplete.enabled", true); +pref("services.sync.prefs.sync.browser.urlbar.maxRichResults", true); +pref("services.sync.prefs.sync.browser.urlbar.suggest.bookmark", true); +pref("services.sync.prefs.sync.browser.urlbar.suggest.history", true); +pref("services.sync.prefs.sync.browser.urlbar.suggest.history.onlyTyped", true); +pref("services.sync.prefs.sync.browser.urlbar.suggest.openpage", true); +pref("services.sync.prefs.sync.browser.urlbar.suggest.searches", true); +pref("services.sync.prefs.sync.dom.disable_open_during_load", true); +pref("services.sync.prefs.sync.dom.disable_window_flip", true); +pref("services.sync.prefs.sync.dom.disable_window_move_resize", true); +pref("services.sync.prefs.sync.dom.event.contextmenu.enabled", true); +pref("services.sync.prefs.sync.extensions.personas.current", true); +pref("services.sync.prefs.sync.extensions.update.enabled", true); +pref("services.sync.prefs.sync.intl.accept_languages", true); +pref("services.sync.prefs.sync.javascript.enabled", true); +pref("services.sync.prefs.sync.layout.spellcheckDefault", true); +pref("services.sync.prefs.sync.lightweightThemes.selectedThemeID", true); +pref("services.sync.prefs.sync.lightweightThemes.usedThemes", true); +pref("services.sync.prefs.sync.network.cookie.cookieBehavior", true); +pref("services.sync.prefs.sync.network.cookie.lifetimePolicy", true); +pref("services.sync.prefs.sync.network.cookie.lifetime.days", true); +pref("services.sync.prefs.sync.network.cookie.thirdparty.sessionOnly", true); +pref("services.sync.prefs.sync.permissions.default.image", true); +pref("services.sync.prefs.sync.pref.advanced.images.disable_button.view_image", true); +pref("services.sync.prefs.sync.pref.advanced.javascript.disable_button.advanced", true); +pref("services.sync.prefs.sync.pref.downloads.disable_button.edit_actions", true); +pref("services.sync.prefs.sync.pref.privacy.disable_button.cookie_exceptions", true); +pref("services.sync.prefs.sync.privacy.clearOnShutdown.cache", true); +pref("services.sync.prefs.sync.privacy.clearOnShutdown.cookies", true); +pref("services.sync.prefs.sync.privacy.clearOnShutdown.downloads", true); +pref("services.sync.prefs.sync.privacy.clearOnShutdown.formdata", true); +pref("services.sync.prefs.sync.privacy.clearOnShutdown.history", true); +pref("services.sync.prefs.sync.privacy.clearOnShutdown.offlineApps", true); +pref("services.sync.prefs.sync.privacy.clearOnShutdown.sessions", true); +pref("services.sync.prefs.sync.privacy.clearOnShutdown.siteSettings", true); +pref("services.sync.prefs.sync.privacy.donottrackheader.enabled", true); +pref("services.sync.prefs.sync.privacy.sanitize.sanitizeOnShutdown", true); +pref("services.sync.prefs.sync.privacy.trackingprotection.enabled", true); +pref("services.sync.prefs.sync.privacy.trackingprotection.pbmode.enabled", true); +pref("services.sync.prefs.sync.security.OCSP.enabled", true); +pref("services.sync.prefs.sync.security.OCSP.require", true); +pref("services.sync.prefs.sync.security.default_personal_cert", true); +pref("services.sync.prefs.sync.security.tls.version.min", true); +pref("services.sync.prefs.sync.security.tls.version.max", true); +pref("services.sync.prefs.sync.services.sync.syncedTabs.showRemoteIcons", true); +pref("services.sync.prefs.sync.signon.rememberSignons", true); +pref("services.sync.prefs.sync.spellchecker.dictionary", true); +pref("services.sync.prefs.sync.xpinstall.whitelist.required", true); + +// A preference that controls whether we should show the icon for a remote tab. +// This pref has no UI but exists because some people may be concerned that +// fetching these icons to show remote tabs may leak information about that +// user's tabs and bookmarks. Note this pref is also synced. +pref("services.sync.syncedTabs.showRemoteIcons", true); + +pref("services.sync.sendTabToDevice.enabled", true); + +// Developer edition preferences +#ifdef MOZ_DEV_EDITION +sticky_pref("lightweightThemes.selectedThemeID", "firefox-compact-dark@mozilla.org"); +#else +sticky_pref("lightweightThemes.selectedThemeID", ""); +#endif + +// Whether the character encoding menu is under the main Firefox button. This +// preference is a string so that localizers can alter it. +pref("browser.menu.showCharacterEncoding", "chrome://browser/locale/browser.properties"); + +// Allow using tab-modal prompts when possible. +pref("prompts.tab_modal.enabled", true); + +// Activates preloading of the new tab url. +pref("browser.newtab.preload", true); + +// Remembers if the about:newtab intro has been shown +// NOTE: This preference is unused but was not removed in case +// this information will be valuable in the future. +pref("browser.newtabpage.introShown", false); + +// Toggles the content of 'about:newtab'. Shows the grid when enabled. +pref("browser.newtabpage.enabled", true); + +// Toggles the enhanced content of 'about:newtab'. Shows sponsored tiles. +sticky_pref("browser.newtabpage.enhanced", false); + +// enables Activity Stream inspired layout +pref("browser.newtabpage.compact", false); + +// enables showing basic placeholders for missing thumbnails +pref("browser.newtabpage.thumbnailPlaceholder", false); + +// number of rows of newtab grid +pref("browser.newtabpage.rows", 3); + +// number of columns of newtab grid +pref("browser.newtabpage.columns", 5); + +// directory tiles download URL +pref("browser.newtabpage.directory.source", "https://tiles.services.mozilla.com/v3/links/fetch/%LOCALE%/%CHANNEL%"); + +// endpoint to send newtab click and view pings +pref("browser.newtabpage.directory.ping", "https://tiles.services.mozilla.com/v3/links/"); + +// activates the remote-hosted newtab page +pref("browser.newtabpage.remote", false); + +// remote newtab version targeted +pref("browser.newtabpage.remote.version", "1"); + +// Toggles endpoints allowed for remote newtab communications +pref("browser.newtabpage.remote.mode", "production"); + +// content-signature tests for remote newtab +pref("browser.newtabpage.remote.content-signing-test", false); + +// verification keys for remote-hosted newtab page +pref("browser.newtabpage.remote.keys", ""); + +// Enable the DOM fullscreen API. +pref("full-screen-api.enabled", true); + +// Startup Crash Tracking +// number of startup crashes that can occur before starting into safe mode automatically +// (this pref has no effect if more than 6 hours have passed since the last crash) +pref("toolkit.startup.max_resumed_crashes", 3); + +// Completely disable pdf.js as an option to preview pdfs within firefox. +// Note: if this is not disabled it does not necessarily mean pdf.js is the pdf +// handler just that it is an option. +pref("pdfjs.disabled", false); +// Used by pdf.js to know the first time firefox is run with it installed so it +// can become the default pdf viewer. +pref("pdfjs.firstRun", true); +// The values of preferredAction and alwaysAskBeforeHandling before pdf.js +// became the default. +pref("pdfjs.previousHandler.preferredAction", 0); +pref("pdfjs.previousHandler.alwaysAskBeforeHandling", false); + +// The maximum amount of decoded image data we'll willingly keep around (we +// might keep around more than this, but we'll try to get down to this value). +// (This is intentionally on the high side; see bug 746055.) +pref("image.mem.max_decoded_image_kb", 256000); + +// Block insecure active content on https pages +pref("security.mixed_content.block_active_content", true); + +// Show degraded UI for http pages with password fields. +pref("security.insecure_password.ui.enabled", true); + +// Show in-content login form warning UI for insecure login fields +pref("security.insecure_field_warning.contextual.enabled", true); + +// 1 = allow MITM for certificate pinning checks. +pref("security.cert_pinning.enforcement_level", 1); + + +// Override the Goanna-default value of false for Firefox. +pref("plain_text.wrap_long_lines", true); + +// If this turns true, Moz*Gesture events are not called stopPropagation() +// before content. +pref("dom.debug.propagate_gesture_events_through_content", false); + +// The request URL of the GeoLocation backend. +pref("geo.wifi.uri", "http://ip-api.com/json/?fields=lat,lon,status,message"); + +#ifdef XP_MACOSX +#ifdef RELEASE_OR_BETA +pref("geo.provider.use_corelocation", false); +#else +pref("geo.provider.use_corelocation", true); +#endif +#endif + +#ifdef XP_WIN +pref("geo.provider.ms-windows-location", false); +#endif + +#ifdef MOZ_WIDGET_GTK +#ifdef MOZ_GPSD +#ifdef RELEASE_OR_BETA +pref("geo.provider.use_gpsd", false); +#else +pref("geo.provider.use_gpsd", true); +#endif +#endif +#endif + +// Necko IPC security checks only needed for app isolation for cookies/cache/etc: +// currently irrelevant for desktop e10s +pref("network.disable.ipc.security", true); + +// CustomizableUI debug logging. +pref("browser.uiCustomization.debug", false); + +// CustomizableUI state of the browser's user interface +pref("browser.uiCustomization.state", ""); + +// The remote content URL shown for FxA signup. Must use HTTPS. +pref("identity.fxaccounts.remote.signup.uri", "https://accounts.firefox.com/signup?service=sync&context=fx_desktop_v3"); + +// The URL where remote content that forces re-authentication for Firefox Accounts +// should be fetched. Must use HTTPS. +pref("identity.fxaccounts.remote.force_auth.uri", "https://accounts.firefox.com/force_auth?service=sync&context=fx_desktop_v3"); + +// The remote content URL shown for signin in. Must use HTTPS. +pref("identity.fxaccounts.remote.signin.uri", "https://accounts.firefox.com/signin?service=sync&context=fx_desktop_v3"); + +// The remote content URL where FxAccountsWebChannel messages originate. +pref("identity.fxaccounts.remote.webchannel.uri", "https://accounts.firefox.com/"); + +// The value of the context query parameter passed in some fxa requests when config +// discovery is enabled. +pref("identity.fxaccounts.contextParam", "fx_desktop_v3"); + +// The URL we take the user to when they opt to "manage" their Firefox Account. +// Note that this will always need to be in the same TLD as the +// "identity.fxaccounts.remote.signup.uri" pref. +pref("identity.fxaccounts.settings.uri", "https://accounts.firefox.com/settings?service=sync&context=fx_desktop_v3"); + +// The URL of the FxA device manager page +pref("identity.fxaccounts.settings.devices.uri", "https://accounts.firefox.com/settings/clients?service=sync&context=fx_desktop_v3"); + +// The remote URL of the FxA Profile Server +pref("identity.fxaccounts.remote.profile.uri", "https://profile.accounts.firefox.com/v1"); + +// The remote URL of the FxA OAuth Server +pref("identity.fxaccounts.remote.oauth.uri", "https://oauth.accounts.firefox.com/v1"); + +// Whether we display profile images in the UI or not. +pref("identity.fxaccounts.profile_image.enabled", true); + +// Token server used by the FxA Sync identity. +pref("identity.sync.tokenserver.uri", "https://token.services.mozilla.com/1.0/sync/1.5"); + +// URLs for promo links to mobile browsers. Note that consumers are expected to +// append a value for utm_campaign. +pref("identity.mobilepromo.android", ""); +pref("identity.mobilepromo.ios", ""); + +// Migrate any existing Firefox Account data from the default profile to the +// Developer Edition profile. +#ifdef MOZ_DEV_EDITION +pref("identity.fxaccounts.migrateToDevEdition", true); +#else +pref("identity.fxaccounts.migrateToDevEdition", false); +#endif + +// On GTK, we now default to showing the menubar only when alt is pressed: +#ifdef MOZ_WIDGET_GTK +pref("ui.key.menuAccessKeyFocuses", true); +#endif + +#ifdef MOZ_EME +// Encrypted media extensions. +// EME is visible but disabled by default. This is so that the +// "Play DRM content" checkbox in the browser UI is unchecked by default. +// DRM requires downloading and installing proprietary binaries, which +// users didn't necessarily opt-in to by installing the browser. +// The first time a site using EME is encountered, the user will be +// prompted to enable DRM, whereupon the EME plugin binaries will be +// downloaded if permission is granted. +pref("media.eme.enabled", false); +pref("media.eme.apiVisible", true); +#else +// Disable redundant interfaces +pref("media.eme.apiVisible", false); +#endif + +// Whether we should run a test-pattern through EME GMPs before assuming they'll +// decode H.264. +pref("media.gmp.trial-create.enabled", true); + +// Note: when media.gmp-*.visible is true, provided we're running on a +// supported platform/OS version, the corresponding CDM appears in the +// plugins list, Firefox will download the GMP/CDM if enabled, and our +// UI to re-enable EME prompts the user to re-enable EME if it's disabled +// and script requests EME. If *.visible is false, we won't show the UI +// to enable the CDM if its disabled; it's as if the keysystem is completely +// unsupported. + +#ifdef MOZ_WIDEVINE_EME +pref("media.gmp-widevinecdm.visible", true); +pref("media.gmp-widevinecdm.enabled", true); +#endif + +// Play with different values of the decay time and get telemetry, +// 0 means to randomize (and persist) the experiment value in users' profiles, +// -1 means no experiment is run and we use the preferred value for frecency (6h) +pref("browser.cache.frecency_experiment", -1); + +pref("browser.translation.detectLanguage", false); +pref("browser.translation.neverForLanguages", ""); +// Show the translation UI bits, like the info bar, notification icon and preferences. +pref("browser.translation.ui.show", false); +// Allows to define the translation engine. Bing is default, Yandex may optionally switched on. +pref("browser.translation.engine", "bing"); + +// Telemetry settings. +// Determines if Telemetry pings can be archived locally. +pref("toolkit.telemetry.archive.enabled", false); + +// Telemetry experiments settings. +pref("experiments.enabled", false); +pref("experiments.manifest.fetchIntervalSeconds", 86400); +pref("experiments.manifest.uri", "https://telemetry-experiment.cdn.mozilla.net/manifest/v1/firefox/%VERSION%/%CHANNEL%"); +// Whether experiments are supported by the current application profile. +pref("experiments.supported", false); + +// Enable GMP support in the addon manager. +pref("media.gmp-provider.enabled", true); + +#ifdef NIGHTLY_BUILD +pref("privacy.trackingprotection.ui.enabled", true); +#else +pref("privacy.trackingprotection.ui.enabled", false); +#endif +pref("privacy.trackingprotection.introCount", 0); +pref("privacy.trackingprotection.introURL", "https://www.mozilla.org/%LOCALE%/firefox/%VERSION%/tracking-protection/start/"); + +// Enable Contextual Identity Containers +#ifdef NIGHTLY_BUILD +pref("privacy.userContext.enabled", true); +pref("privacy.userContext.ui.enabled", true); +pref("privacy.usercontext.about_newtab_segregation.enabled", true); + +// 0 disables long press, 1 when clicked, the menu is shown, 2 the menu is shown after X milliseconds. +pref("privacy.userContext.longPressBehavior", 2); +#else +pref("privacy.userContext.enabled", false); +pref("privacy.userContext.ui.enabled", false); +pref("privacy.usercontext.about_newtab_segregation.enabled", false); + +// 0 disables long press, 1 when clicked, the menu is shown, 2 the menu is shown after X milliseconds. +pref("privacy.userContext.longPressBehavior", 0); +#endif + +#ifndef RELEASE_OR_BETA +// At the moment, autostart.2 is used, while autostart.1 is unused. +// We leave it here set to false to reset users' defaults and allow +// us to change everybody to true in the future, when desired. +pref("browser.tabs.remote.autostart.1", false); +pref("browser.tabs.remote.autostart.2", true); +#endif + +// For the about:tabcrashed page +pref("browser.tabs.crashReporting.sendReport", true); +pref("browser.tabs.crashReporting.includeURL", false); +pref("browser.tabs.crashReporting.requestEmail", false); +pref("browser.tabs.crashReporting.emailMe", false); +pref("browser.tabs.crashReporting.email", ""); + +// Enable e10s add-on interposition by default. +pref("extensions.interposition.enabled", true); +pref("extensions.interposition.prefetching", true); + +// Enable blocking of e10s for add-on users on beta/release. +#ifdef RELEASE_OR_BETA +pref("extensions.e10sBlocksEnabling", true); +#endif + +// How often to check for CPOW timeouts. CPOWs are only timed out by +// the hang monitor. +pref("dom.ipc.cpow.timeout", 500); + +// Causes access on unsafe CPOWs from browser code to throw by default. +pref("dom.ipc.cpows.forbid-unsafe-from-browser", true); + +// Don't allow add-ons marked as multiprocessCompatible to use CPOWs. +pref("dom.ipc.cpows.forbid-cpows-in-compat-addons", true); + +// ...except for these add-ons: +pref("dom.ipc.cpows.allow-cpows-in-compat-addons", "{b9db16a4-6edc-47ec-a1f4-b86292ed211d},firegestures@xuldev.org,{DDC359D1-844A-42a7-9AA1-88A850A938A8},privateTab@infocatcher,mousegesturessuite@lemon_juice.addons.mozilla.org,treestyletab@piro.sakura.ne.jp,cliqz@cliqz.com,{AE93811A-5C9A-4d34-8462-F7B864FC4696},contextsearch2@lwz.addons.mozilla.org,{EF522540-89F5-46b9-B6FE-1829E2B572C6},{677a8f98-fd64-40b0-a883-b8c95d0cbf17},images@wink.su,fx-devtools,toolkit/require,url_advisor@kaspersky.com,{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d},{dc572301-7619-498c-a57d-39143191b318},dta@downthemall.net,{86095750-AD15-46d8-BF32-C0789F7E6A32},screenwise-prod@google.com,{91aa5abe-9de4-4347-b7b5-322c38dd9271},secureLogin@blueimp.net,ich@maltegoetz.de,come.back.block.image.from@cat-in-136.blogspot.com,{7b1bf0b6-a1b9-42b0-b75d-252036438bdc},s3crypto@data,{1e0fd655-5aea-4b4c-a583-f76ef1e3af9c},akahuku.fx.sp@toshiakisp.github.io,{aff87fa2-a58e-4edd-b852-0a20203c1e17},{1018e4d6-728f-4b20-ad56-37578a4de76b},rehostimage@engy.us,lazarus@interclue.com,{b2e69492-2358-071a-7056-24ad0c3defb1},flashstopper@byo.co.il,{e4a8a97b-f2ed-450b-b12d-ee082ba24781},jid1-f3mYMbCpz2AZYl@jetpack,{8c550e28-88c9-4764-bb52-aa489cf2efcd},{37fa1426-b82d-11db-8314-0800200c9a66},{ac2cfa60-bc96-11e0-962b-0800200c9a66},igetter@presenta.net,killspinners@byo.co.il,abhere2@moztw.org,{fc6339b8-9581-4fc7-b824-dffcb091fcb7},wampi@wink.su,backtrack@byalexv.co.uk,Gladiator_X@mail.ru,{73a6fe31-595d-460b-a920-fcc0f8843232},{46551EC9-40F0-4e47-8E18-8E5CF550CFB8},acewebextension_unlisted@acestream.org,@screen_maker,yasearch@yandex.ru,sp@avast.com,s3google@translator,igetterextension@presenta.net,{C1A2A613-35F1-4FCF-B27F-2840527B6556},screenwise-testing@google.com,helper-sig@savefrom.net,browser-loader,ImageSaver@Merci.chao,proxtube@abz.agency,wrc@avast.com,{9AA46F4F-4DC7-4c06-97AF-5035170634FE},jid1-CikLKKPVkw6ipw@jetpack,artur.dubovoy@gmail.com,nlgfeb@nlgfeb.ext,{A065A84F-95B6-433A-A0C8-4C040B77CE8A},fdm_ffext@freedownloadmanager.org"); + +// Enable e10s hang monitoring (slow script checking and plugin hang +// detection). +pref("dom.ipc.processHangMonitor", true); + +#ifdef DEBUG +// Don't report hangs in DEBUG builds. They're too slow and often a +// debugger is attached. +pref("dom.ipc.reportProcessHangs", false); +#else +pref("dom.ipc.reportProcessHangs", true); +#endif + +pref("browser.reader.detectedFirstArticle", false); +// Don't limit how many nodes we care about on desktop: +pref("reader.parse-node-limit", 0); + +// On desktop, we want the URLs to be included here for ease of debugging, +// and because (normally) these errors are not persisted anywhere. +pref("reader.errors.includeURLs", true); + +pref("view_source.tab", true); + +pref("dom.serviceWorkers.enabled", true); +pref("dom.serviceWorkers.openWindow.enabled", true); + +// Enable Push API. +pref("dom.push.enabled", true); + +// These are the thumbnail width/height set in about:newtab. +// If you change this, ENSURE IT IS THE SAME SIZE SET +// by about:newtab. These values are in CSS pixels. +pref("toolkit.pageThumbs.minWidth", 280); +pref("toolkit.pageThumbs.minHeight", 190); + +// Enable speech synthesis +pref("media.webspeech.synth.enabled", true); + +pref("browser.esedbreader.loglevel", "Error"); + +pref("browser.laterrun.enabled", false); + +pref("browser.migrate.automigrate.enabled", false); +// 4 here means the suggestion notification will be automatically +// hidden the 4th day, so it will actually be shown on 3 different days. +pref("browser.migrate.automigrate.daysToOfferUndo", 4); +pref("browser.migrate.automigrate.ui.enabled", true); + +// See comments in bug 1340115 on how we got to these numbers. +pref("browser.migrate.chrome.history.limit", 2000); +pref("browser.migrate.chrome.history.maxAgeInDays", 180); + +// Enable browser frames for use on desktop. Only exposed to chrome callers. +pref("dom.mozBrowserFramesEnabled", true); + +pref("extensions.pocket.enabled", true); + +pref("signon.schemeUpgrades", true); + +// "Simplify Page" feature in Print Preview. This feature is disabled by default +// in toolkit. +// +// This feature is only enabled on Nightly for Linux until bug 1306295 is fixed. +// For non-Linux, this feature is only enabled up to early Beta. +#ifdef UNIX_BUT_NOT_MAC +#if defined(NIGHTLY_BUILD) +pref("print.use_simplify_page", true); +#endif +#else +#if defined(EARLY_BETA_OR_EARLIER) +pref("print.use_simplify_page", true); +#endif +#endif + +// Space separated list of URLS that are allowed to send objects (instead of +// only strings) through webchannels. This list is duplicated in mobile/android/app/mobile.js +pref("webchannel.allowObject.urlWhitelist", "https://accounts.firefox.com https://content.cdn.mozilla.net https://input.mozilla.org https://support.mozilla.org https://install.mozilla.org"); + +// Whether or not the browser should scan for unsubmitted +// crash reports, and then show a notification for submitting +// those reports. +#ifdef EARLY_BETA_OR_EARLIER +pref("browser.crashReports.unsubmittedCheck.enabled", true); +#else +pref("browser.crashReports.unsubmittedCheck.enabled", false); +#endif + +// chancesUntilSuppress is how many times we'll show the unsubmitted +// crash report notification across different days and shutdown +// without a user choice before we suppress the notification for +// some number of days. +pref("browser.crashReports.unsubmittedCheck.chancesUntilSuppress", 4); +pref("browser.crashReports.unsubmittedCheck.autoSubmit", false); + +#ifdef NIGHTLY_BUILD +// Enable the (fairly costly) client/server validation on nightly only. The other prefs +// controlling validation are located in /services/sync/services-sync.js +pref("services.sync.validation.enabled", true); +#endif + +// Preferences for the form autofill system extension +pref("browser.formautofill.experimental", false); + +// Enable safebrowsing v4 tables (suffixed by "-proto") update. +#ifdef NIGHTLY_BUILD +pref("urlclassifier.malwareTable", "goog-malware-shavar,goog-unwanted-shavar,goog-malware-proto,goog-unwanted-proto,test-malware-simple,test-unwanted-simple"); +pref("urlclassifier.phishTable", "goog-phish-shavar,goog-phish-proto,test-phish-simple"); +#endif diff --git a/application/basilisk/app/profile/pagethemes.rdf b/application/basilisk/app/profile/pagethemes.rdf new file mode 100644 index 000000000..3d09b95f5 --- /dev/null +++ b/application/basilisk/app/profile/pagethemes.rdf @@ -0,0 +1,7 @@ + + + + + diff --git a/application/basilisk/app/profile/prefs.js b/application/basilisk/app/profile/prefs.js new file mode 100644 index 000000000..8c6f0d639 --- /dev/null +++ b/application/basilisk/app/profile/prefs.js @@ -0,0 +1,13 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +# Mozilla User Preferences + +/* Do not edit this file. + * + * If you make changes to this file while the browser is running, + * the changes will be overwritten when the browser exits. + * + * To make a manual change to preferences, you can visit the URL about:config + */ diff --git a/application/basilisk/app/splash.rc b/application/basilisk/app/splash.rc new file mode 100644 index 000000000..beccf8706 --- /dev/null +++ b/application/basilisk/app/splash.rc @@ -0,0 +1,21 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include +#include "nsNativeAppSupportWin.h" + +1 24 "basilisk.exe.manifest" + +IDI_APPICON ICON FIREFOX_ICO +IDI_DOCUMENT ICON DOCUMENT_ICO +IDI_APPLICATION ICON FIREFOX_ICO +IDI_NEWWINDOW ICON NEWWINDOW_ICO +IDI_NEWTAB ICON NEWTAB_ICO +IDI_PBMODE ICON PBMODE_ICO + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STARTMENU_APPNAME, "@MOZ_APP_DISPLAYNAME@" +END diff --git a/application/basilisk/base/.eslintrc.js b/application/basilisk/base/.eslintrc.js new file mode 100644 index 000000000..978d7b372 --- /dev/null +++ b/application/basilisk/base/.eslintrc.js @@ -0,0 +1,4 @@ +"use strict"; + +module.exports = { +}; diff --git a/application/basilisk/base/content/aboutDialog-appUpdater.js b/application/basilisk/base/content/aboutDialog-appUpdater.js new file mode 100644 index 000000000..e5fa77a34 --- /dev/null +++ b/application/basilisk/base/content/aboutDialog-appUpdater.js @@ -0,0 +1,425 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Note: this file is included in aboutDialog.xul if MOZ_UPDATER is defined. + +Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); +Components.utils.import("resource://gre/modules/DownloadUtils.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils", + "resource://gre/modules/UpdateUtils.jsm"); + +const PREF_APP_UPDATE_CANCELATIONS_OSX = "app.update.cancelations.osx"; +const PREF_APP_UPDATE_ELEVATE_NEVER = "app.update.elevate.never"; + +var gAppUpdater; + +function onUnload(aEvent) { + if (gAppUpdater.isChecking) + gAppUpdater.checker.stopChecking(Components.interfaces.nsIUpdateChecker.CURRENT_CHECK); + // Safe to call even when there isn't a download in progress. + gAppUpdater.removeDownloadListener(); + gAppUpdater = null; +} + + +function appUpdater() { + XPCOMUtils.defineLazyServiceGetter(this, "aus", + "@mozilla.org/updates/update-service;1", + "nsIApplicationUpdateService"); + XPCOMUtils.defineLazyServiceGetter(this, "checker", + "@mozilla.org/updates/update-checker;1", + "nsIUpdateChecker"); + XPCOMUtils.defineLazyServiceGetter(this, "um", + "@mozilla.org/updates/update-manager;1", + "nsIUpdateManager"); + + this.updateDeck = document.getElementById("updateDeck"); + + // Hide the update deck when the update window is already open and it's not + // already applied, to avoid syncing issues between them. Applied updates + // don't have any information to sync between the windows as they both just + // show the "Restart to continue"-type button. + if (Services.wm.getMostRecentWindow("Update:Wizard") && + !this.isApplied) { + this.updateDeck.hidden = true; + return; + } + + this.bundle = Services.strings. + createBundle("chrome://browser/locale/browser.properties"); + + let manualURL = Services.urlFormatter.formatURLPref("app.update.url.manual"); + let manualLink = document.getElementById("manualLink"); + manualLink.value = manualURL; + manualLink.href = manualURL; + document.getElementById("failedLink").href = manualURL; + + if (this.updateDisabledAndLocked) { + this.selectPanel("adminDisabled"); + return; + } + + if (this.isPending || this.isApplied) { + this.selectPanel("apply"); + return; + } + + if (this.aus.isOtherInstanceHandlingUpdates) { + this.selectPanel("otherInstanceHandlingUpdates"); + return; + } + + if (this.isDownloading) { + this.startDownload(); + // selectPanel("downloading") is called from setupDownloadingUI(). + return; + } + + // Honor the "Never check for updates" option by not only disabling background + // update checks, but also in the About dialog, by presenting a + // "Check for updates" button. + // If updates are found, the user is then asked if he wants to "Update to ". + if (!this.updateEnabled || + Services.prefs.prefHasUserValue(PREF_APP_UPDATE_ELEVATE_NEVER)) { + this.selectPanel("checkForUpdates"); + return; + } + + // That leaves the options + // "Check for updates, but let me choose whether to install them", and + // "Automatically install updates". + // In both cases, we check for updates without asking. + // In the "let me choose" case, we ask before downloading though, in onCheckComplete. + this.checkForUpdates(); +} + +appUpdater.prototype = +{ + // true when there is an update check in progress. + isChecking: false, + + // true when there is an update already staged / ready to be applied. + get isPending() { + if (this.update) { + return this.update.state == "pending" || + this.update.state == "pending-service" || + this.update.state == "pending-elevate"; + } + return this.um.activeUpdate && + (this.um.activeUpdate.state == "pending" || + this.um.activeUpdate.state == "pending-service" || + this.um.activeUpdate.state == "pending-elevate"); + }, + + // true when there is an update already installed in the background. + get isApplied() { + if (this.update) + return this.update.state == "applied" || + this.update.state == "applied-service"; + return this.um.activeUpdate && + (this.um.activeUpdate.state == "applied" || + this.um.activeUpdate.state == "applied-service"); + }, + + // true when there is an update download in progress. + get isDownloading() { + if (this.update) + return this.update.state == "downloading"; + return this.um.activeUpdate && + this.um.activeUpdate.state == "downloading"; + }, + + // true when updating is disabled by an administrator. + get updateDisabledAndLocked() { + return !this.updateEnabled && + Services.prefs.prefIsLocked("app.update.enabled"); + }, + + // true when updating is enabled. + get updateEnabled() { + try { + return Services.prefs.getBoolPref("app.update.enabled"); + } catch (e) { } + return true; // Firefox default is true + }, + + // true when updating in background is enabled. + get backgroundUpdateEnabled() { + return this.updateEnabled && + gAppUpdater.aus.canStageUpdates; + }, + + // true when updating is automatic. + get updateAuto() { + try { + return Services.prefs.getBoolPref("app.update.auto"); + } catch (e) { } + return true; // Firefox default is true + }, + + /** + * Sets the panel of the updateDeck. + * + * @param aChildID + * The id of the deck's child to select, e.g. "apply". + */ + selectPanel(aChildID) { + let panel = document.getElementById(aChildID); + + let button = panel.querySelector("button"); + if (button) { + if (aChildID == "downloadAndInstall") { + let updateVersion = gAppUpdater.update.displayVersion; + button.label = this.bundle.formatStringFromName("update.downloadAndInstallButton.label", [updateVersion], 1); + button.accessKey = this.bundle.GetStringFromName("update.downloadAndInstallButton.accesskey"); + } + this.updateDeck.selectedPanel = panel; + if (!document.commandDispatcher.focusedElement || // don't steal the focus + document.commandDispatcher.focusedElement.localName == "button") // except from the other buttons + button.focus(); + + } else { + this.updateDeck.selectedPanel = panel; + } + }, + + /** + * Check for updates + */ + checkForUpdates() { + // Clear prefs that could prevent a user from discovering available updates. + if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_CANCELATIONS_OSX)) { + Services.prefs.clearUserPref(PREF_APP_UPDATE_CANCELATIONS_OSX); + } + if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_ELEVATE_NEVER)) { + Services.prefs.clearUserPref(PREF_APP_UPDATE_ELEVATE_NEVER); + } + this.selectPanel("checkingForUpdates"); + this.isChecking = true; + this.checker.checkForUpdates(this.updateCheckListener, true); + // after checking, onCheckComplete() is called + }, + + /** + * Handles oncommand for the "Restart to Update" button + * which is presented after the download has been downloaded. + */ + buttonRestartAfterDownload() { + if (!this.isPending && !this.isApplied) { + return; + } + + gAppUpdater.selectPanel("restarting"); + + // Notify all windows that an application quit has been requested. + let cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]. + createInstance(Components.interfaces.nsISupportsPRBool); + Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart"); + + // Something aborted the quit process. + if (cancelQuit.data) { + gAppUpdater.selectPanel("apply"); + return; + } + + let appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"]. + getService(Components.interfaces.nsIAppStartup); + + // If already in safe mode restart in safe mode (bug 327119) + if (Services.appinfo.inSafeMode) { + appStartup.restartInSafeMode(Components.interfaces.nsIAppStartup.eAttemptQuit); + return; + } + + appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit | + Components.interfaces.nsIAppStartup.eRestart); + }, + + /** + * Implements nsIUpdateCheckListener. The methods implemented by + * nsIUpdateCheckListener are in a different scope from nsIIncrementalDownload + * to make it clear which are used by each interface. + */ + updateCheckListener: { + /** + * See nsIUpdateService.idl + */ + onCheckComplete(aRequest, aUpdates, aUpdateCount) { + gAppUpdater.isChecking = false; + gAppUpdater.update = gAppUpdater.aus. + selectUpdate(aUpdates, aUpdates.length); + if (!gAppUpdater.update) { + gAppUpdater.selectPanel("noUpdatesFound"); + return; + } + + if (gAppUpdater.update.unsupported) { + if (gAppUpdater.update.detailsURL) { + let unsupportedLink = document.getElementById("unsupportedLink"); + unsupportedLink.href = gAppUpdater.update.detailsURL; + } + gAppUpdater.selectPanel("unsupportedSystem"); + return; + } + + if (!gAppUpdater.aus.canApplyUpdates) { + gAppUpdater.selectPanel("manualUpdate"); + return; + } + + if (gAppUpdater.updateAuto) // automatically download and install + gAppUpdater.startDownload(); + else // ask + gAppUpdater.selectPanel("downloadAndInstall"); + }, + + /** + * See nsIUpdateService.idl + */ + onError(aRequest, aUpdate) { + // Errors in the update check are treated as no updates found. If the + // update check fails repeatedly without a success the user will be + // notified with the normal app update user interface so this is safe. + gAppUpdater.isChecking = false; + gAppUpdater.selectPanel("noUpdatesFound"); + }, + + /** + * See nsISupports.idl + */ + QueryInterface(aIID) { + if (!aIID.equals(Components.interfaces.nsIUpdateCheckListener) && + !aIID.equals(Components.interfaces.nsISupports)) + throw Components.results.NS_ERROR_NO_INTERFACE; + return this; + } + }, + + /** + * Starts the download of an update mar. + */ + startDownload() { + if (!this.update) + this.update = this.um.activeUpdate; + this.update.QueryInterface(Components.interfaces.nsIWritablePropertyBag); + this.update.setProperty("foregroundDownload", "true"); + + this.aus.pauseDownload(); + let state = this.aus.downloadUpdate(this.update, false); + if (state == "failed") { + this.selectPanel("downloadFailed"); + return; + } + + this.setupDownloadingUI(); + }, + + /** + * Switches to the UI responsible for tracking the download. + */ + setupDownloadingUI() { + this.downloadStatus = document.getElementById("downloadStatus"); + this.downloadStatus.value = + DownloadUtils.getTransferTotal(0, this.update.selectedPatch.size); + this.selectPanel("downloading"); + this.aus.addDownloadListener(this); + }, + + removeDownloadListener() { + if (this.aus) { + this.aus.removeDownloadListener(this); + } + }, + + /** + * See nsIRequestObserver.idl + */ + onStartRequest(aRequest, aContext) { + }, + + /** + * See nsIRequestObserver.idl + */ + onStopRequest(aRequest, aContext, aStatusCode) { + switch (aStatusCode) { + case Components.results.NS_ERROR_UNEXPECTED: + if (this.update.selectedPatch.state == "download-failed" && + (this.update.isCompleteUpdate || this.update.patchCount != 2)) { + // Verification error of complete patch, informational text is held in + // the update object. + this.removeDownloadListener(); + this.selectPanel("downloadFailed"); + break; + } + // Verification failed for a partial patch, complete patch is now + // downloading so return early and do NOT remove the download listener! + break; + case Components.results.NS_BINDING_ABORTED: + // Do not remove UI listener since the user may resume downloading again. + break; + case Components.results.NS_OK: + this.removeDownloadListener(); + if (this.backgroundUpdateEnabled) { + this.selectPanel("applying"); + let self = this; + Services.obs.addObserver(function(aSubject, aTopic, aData) { + // Update the UI when the background updater is finished + let status = aData; + if (status == "applied" || status == "applied-service" || + status == "pending" || status == "pending-service" || + status == "pending-elevate") { + // If the update is successfully applied, or if the updater has + // fallen back to non-staged updates, show the "Restart to Update" + // button. + self.selectPanel("apply"); + } else if (status == "failed") { + // Background update has failed, let's show the UI responsible for + // prompting the user to update manually. + self.selectPanel("downloadFailed"); + } else if (status == "downloading") { + // We've fallen back to downloading the full update because the + // partial update failed to get staged in the background. + // Therefore we need to keep our observer. + self.setupDownloadingUI(); + return; + } + Services.obs.removeObserver(arguments.callee, "update-staged"); + }, "update-staged", false); + } else { + this.selectPanel("apply"); + } + break; + default: + this.removeDownloadListener(); + this.selectPanel("downloadFailed"); + break; + } + }, + + /** + * See nsIProgressEventSink.idl + */ + onStatus(aRequest, aContext, aStatus, aStatusArg) { + }, + + /** + * See nsIProgressEventSink.idl + */ + onProgress(aRequest, aContext, aProgress, aProgressMax) { + this.downloadStatus.value = + DownloadUtils.getTransferTotal(aProgress, aProgressMax); + }, + + /** + * See nsISupports.idl + */ + QueryInterface(aIID) { + if (!aIID.equals(Components.interfaces.nsIProgressEventSink) && + !aIID.equals(Components.interfaces.nsIRequestObserver) && + !aIID.equals(Components.interfaces.nsISupports)) + throw Components.results.NS_ERROR_NO_INTERFACE; + return this; + } +}; diff --git a/application/basilisk/base/content/aboutDialog.css b/application/basilisk/base/content/aboutDialog.css new file mode 100644 index 000000000..baeeada7a --- /dev/null +++ b/application/basilisk/base/content/aboutDialog.css @@ -0,0 +1,97 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#aboutDialog { + width: 620px; + /* Set an explicit line-height to avoid discrepancies in 'auto' spacing + across screens with different device DPI, which may cause font metrics + to round differently. */ + line-height: 1.5; +} + +#rightBox { + background-image: url("chrome://branding/content/about-wordmark.svg"); + background-repeat: no-repeat; + /* padding-top creates room for the wordmark */ + padding-top: 38px; + margin-top:20px; +} + +#rightBox:-moz-locale-dir(rtl) { + background-position: 100% 0; +} + +#bottomBox { + padding: 15px 10px 0; +} + +#version { + font-weight: bold; + margin-top: 10px; + margin-left: 0; + -moz-user-select: text; + -moz-user-focus: normal; + cursor: text; +} + +#version:-moz-locale-dir(rtl) { + direction: ltr; + text-align: right; + margin-left: 5px; + margin-right: 0; +} + +#releasenotes { + margin-top: 10px; +} + +#distribution, +#distributionId { + display: none; + margin-top: 0; + margin-bottom: 0; +} + +.text-blurb { + margin-bottom: 10px; + margin-inline-start: 0; + padding-inline-start: 0; +} + +#updateButton, +#updateDeck > hbox > label { + margin-inline-start: 0; + padding-inline-start: 0; +} + +.update-throbber { + width: 16px; + min-height: 16px; + margin-inline-end: 3px; + list-style-image: url("chrome://global/skin/icons/loading.png"); +} + +@media (min-resolution: 1.1dppx) { + .update-throbber { + list-style-image: url("chrome://global/skin/icons/loading@2x.png"); + } +} + +description > .text-link, +description > .text-link:focus { + margin: 0px; + padding: 0px; +} + +.bottom-link, +.bottom-link:focus { + text-align: center; + margin: 0 40px; +} + +#currentChannel { + margin: 0; + padding: 0; + font-weight: bold; +} diff --git a/application/basilisk/base/content/aboutDialog.js b/application/basilisk/base/content/aboutDialog.js new file mode 100644 index 000000000..d8965ec55 --- /dev/null +++ b/application/basilisk/base/content/aboutDialog.js @@ -0,0 +1,83 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +// Services = object with smart getters for common XPCOM services +Components.utils.import("resource://gre/modules/Services.jsm"); + +function init(aEvent) { + if (aEvent.target != document) + return; + + try { + var distroId = Services.prefs.getCharPref("distribution.id"); + if (distroId) { + var distroVersion = Services.prefs.getCharPref("distribution.version"); + + var distroIdField = document.getElementById("distributionId"); + distroIdField.value = distroId + " - " + distroVersion; + distroIdField.style.display = "block"; + + try { + // This is in its own try catch due to bug 895473 and bug 900925. + var distroAbout = Services.prefs.getComplexValue("distribution.about", + Components.interfaces.nsISupportsString); + var distroField = document.getElementById("distribution"); + distroField.value = distroAbout; + distroField.style.display = "block"; + } catch (ex) { + // Pref is unset + Components.utils.reportError(ex); + } + } + } catch (e) { + // Pref is unset + } + + // Include the build ID + let versionField = document.getElementById("version"); + let version = Services.appinfo.version; + let buildID = Services.appinfo.appBuildID; + let year = buildID.slice(0, 4); + let month = buildID.slice(4, 6); + let day = buildID.slice(6, 8); + let hour = buildID.slice(8, 10); + let minute = buildID.slice(10, 12); + if (Services.prefs.getBoolPref("general.useragent.appVersionIsBuildID")) { + versionField.textContent = `${year}.${month}.${day}`; + } else { + versionField.textContent = `v` + version + ` (${year}-${month}-${day})`; + } + + // Display warning if this is an "a#" (nightly or aurora) build + if (/a\d+$/.test(version)) { + document.getElementById("experimental").hidden = false; + document.getElementById("communityDesc").hidden = true; + } + + // Append "(32-bit)" or "(64-bit)" build architecture to the version number: + let bundle = Services.strings.createBundle("chrome://browser/locale/browser.properties"); + let archResource = Services.appinfo.is64Bit + ? "aboutDialog.architecture.sixtyFourBit" + : "aboutDialog.architecture.thirtyTwoBit"; + let arch = bundle.GetStringFromName(archResource); + versionField.textContent += ` (${arch})`; + +#ifdef MOZ_UPDATER + gAppUpdater = new appUpdater(); + + let channelLabel = document.getElementById("currentChannel"); + let currentChannelText = document.getElementById("currentChannelText"); + channelLabel.value = UpdateUtils.UpdateChannel; + if (/^release($|\-)/.test(channelLabel.value)) + currentChannelText.hidden = true; +#endif + +#ifdef XP_MACOSX + // it may not be sized at this point, and we need its width to calculate its position + window.sizeToContent(); + window.moveTo((screen.availWidth / 2) - (window.outerWidth / 2), screen.availHeight / 5); +#endif +} diff --git a/application/basilisk/base/content/aboutDialog.xul b/application/basilisk/base/content/aboutDialog.xul new file mode 100644 index 000000000..b77896b95 --- /dev/null +++ b/application/basilisk/base/content/aboutDialog.xul @@ -0,0 +1,151 @@ + + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + + + + + + +%brandDTD; + +%aboutDialogDTD; +]> + +#ifdef XP_MACOSX + +#endif + + + + + + + + + + + + +
+
+

&generic.title;

+

&captivePortal.title;

+

&dnsNotFound.title;

+

&fileNotFound.title;

+

&fileAccessDenied.title;

+

&malformedURI.title;

+

&unknownProtocolFound.title;

+

&connectionFailure.title;

+

&netTimeout.title;

+

&redirectLoop.title;

+

&unknownSocketType.title;

+

&netReset.title;

+

¬Cached.title;

+

&netOffline.title;

+

&netInterrupt.title;

+

&deniedPortAccess.title;

+

&proxyResolveFailure.title;

+

&proxyConnectFailure.title;

+

&contentEncodingError.title;

+

&unsafeContentType.title;

+

&nssFailure2.title;

+

&certerror.longpagetitle1;

+

&cspBlocked.title;

+

&remoteXUL.title;

+

&corruptedContentErrorv2.title;

+

&sslv3Used.title;

+

&weakCryptoUsed.title;

+

&inadequateSecurityError.title;

+
+
+
&generic.longDesc;
+
&captivePortal.longDesc;
+
&dnsNotFound.longDesc;
+
&fileNotFound.longDesc;
+
&fileAccessDenied.longDesc;
+
&malformedURI.longDesc;
+
&unknownProtocolFound.longDesc;
+
&connectionFailure.longDesc;
+
&netTimeout.longDesc;
+
&redirectLoop.longDesc;
+
&unknownSocketType.longDesc;
+
&netReset.longDesc;
+
¬Cached.longDesc;
+
&netOffline.longDesc2;
+
&netInterrupt.longDesc;
+
&deniedPortAccess.longDesc;
+
&proxyResolveFailure.longDesc;
+
&proxyConnectFailure.longDesc;
+
&contentEncodingError.longDesc;
+
&unsafeContentType.longDesc;
+
&nssFailure2.longDesc2;
+
&certerror.introPara;
+
&cspBlocked.longDesc;
+
&remoteXUL.longDesc;
+
&corruptedContentErrorv2.longDesc;
+
&sslv3Used.longDesc2;
+
&weakCryptoUsed.longDesc2;
+
&inadequateSecurityError.longDesc;
+
+
+ + +
+ + +
+

+

+ + +
+ + +
+

+

+ + + + + + + +
+ + + +
+

&prefReset.longDesc;

+ +
+ +
+ + +
+ +
+
+ +
+ +
+ + +
+

+ + +

+
+ +
+
+
+

&weakCryptoAdvanced.longDesc;

+
+ + +
+

+ +

+
+ +
+ +
+ +
+ +
+ + + + + + diff --git a/application/basilisk/base/content/aboutRobots-icon.png b/application/basilisk/base/content/aboutRobots-icon.png new file mode 100644 index 000000000..1c4899aaf Binary files /dev/null and b/application/basilisk/base/content/aboutRobots-icon.png differ diff --git a/application/basilisk/base/content/aboutRobots-widget-left.png b/application/basilisk/base/content/aboutRobots-widget-left.png new file mode 100644 index 000000000..3a1e48d5f Binary files /dev/null and b/application/basilisk/base/content/aboutRobots-widget-left.png differ diff --git a/application/basilisk/base/content/aboutRobots.xhtml b/application/basilisk/base/content/aboutRobots.xhtml new file mode 100644 index 000000000..1cef8fe16 --- /dev/null +++ b/application/basilisk/base/content/aboutRobots.xhtml @@ -0,0 +1,107 @@ + + + + + + %htmlDTD; + + %netErrorDTD; + + %globalDTD; + + %aboutrobotsDTD; +]> + + + + &robots.pagetitle; + + + + + + + + + + + +
+ + +
+

&robots.errorTitleText;

+
+ + +
+ + +
+

&robots.errorShortDescText;

+
+ + +
+
    +
  • &robots.errorLongDesc1;
  • +
  • &robots.errorLongDesc2;
  • +
  • &robots.errorLongDesc3;
  • +
  • &robots.errorLongDesc4;
  • +
+
+ + +
+

&robots.errorTrailerDescText;

+
+ +
+ + + + + + +
+ + + diff --git a/application/basilisk/base/content/aboutTabCrashed.css b/application/basilisk/base/content/aboutTabCrashed.css new file mode 100644 index 000000000..de0eabe8b --- /dev/null +++ b/application/basilisk/base/content/aboutTabCrashed.css @@ -0,0 +1,11 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +html:not(.crashDumpSubmitted) #reportSent, +html:not(.crashDumpAvailable) #reportBox, +.container[multiple="true"] > .offers > #offerHelpMessageSingle, +.container[multiple="false"] > .offers > #offerHelpMessageMultiple, +.container[multiple="false"] > .button-container > #restoreAll { + display: none; +} \ No newline at end of file diff --git a/application/basilisk/base/content/aboutTabCrashed.js b/application/basilisk/base/content/aboutTabCrashed.js new file mode 100644 index 000000000..23400c743 --- /dev/null +++ b/application/basilisk/base/content/aboutTabCrashed.js @@ -0,0 +1,308 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +var AboutTabCrashed = { + /** + * This can be set to true once this page receives a message from the + * parent saying whether or not a crash report is available. + */ + hasReport: false, + + /** + * The messages that we might receive from the parent. + */ + MESSAGES: [ + "SetCrashReportAvailable", + "CrashReportSent", + "UpdateCount", + ], + + /** + * Items for which we will listen for click events. + */ + CLICK_TARGETS: [ + "closeTab", + "restoreTab", + "restoreAll", + "sendReport", + ], + + /** + * Returns information about this crashed tab. + * + * @return (Object) An object with the following properties: + * title (String): + * The title of the page that crashed. + * URL (String): + * The URL of the page that crashed. + */ + get pageData() { + delete this.pageData; + + let URL = document.documentURI; + let queryString = URL.replace(/^about:tabcrashed?e=tabcrashed/, ""); + + let titleMatch = queryString.match(/d=([^&]*)/); + let URLMatch = queryString.match(/u=([^&]*)/); + + return this.pageData = { + title: titleMatch && titleMatch[1] ? decodeURIComponent(titleMatch[1]) : "", + URL: URLMatch && URLMatch[1] ? decodeURIComponent(URLMatch[1]) : "", + }; + }, + + init() { + this.MESSAGES.forEach((msg) => addMessageListener(msg, this.receiveMessage.bind(this))); + addEventListener("DOMContentLoaded", this); + + document.title = this.pageData.title; + }, + + receiveMessage(message) { + switch (message.name) { + case "UpdateCount": { + this.setMultiple(message.data.count > 1); + break; + } + case "SetCrashReportAvailable": { + this.onSetCrashReportAvailable(message); + break; + } + case "CrashReportSent": { + this.onCrashReportSent(); + break; + } + } + }, + + handleEvent(event) { + switch (event.type) { + case "DOMContentLoaded": { + this.onDOMContentLoaded(); + break; + } + case "click": { + this.onClick(event); + break; + } + case "input": { + this.onInput(event); + break; + } + } + }, + + onDOMContentLoaded() { + this.CLICK_TARGETS.forEach((targetID) => { + let el = document.getElementById(targetID); + el.addEventListener("click", this); + }); + + // For setting "emailMe" checkbox automatically on email value change. + document.getElementById("email").addEventListener("input", this); + + // Error pages are loaded as LOAD_BACKGROUND, so they don't get load events. + let event = new CustomEvent("AboutTabCrashedLoad", {bubbles:true}); + document.dispatchEvent(event); + + sendAsyncMessage("Load"); + }, + + onClick(event) { + switch (event.target.id) { + case "closeTab": { + this.sendMessage("closeTab"); + break; + } + + case "restoreTab": { + this.sendMessage("restoreTab"); + break; + } + + case "restoreAll": { + this.sendMessage("restoreAll"); + break; + } + + case "sendReport": { + this.showCrashReportUI(event.target.checked); + break; + } + } + }, + + onInput(event) { + switch (event.target.id) { + case "email": { + document.getElementById("emailMe").checked = !!event.target.value; + break; + } + } + }, + /** + * After this page tells the parent that it has loaded, the parent + * will respond with whether or not a crash report is available. This + * method handles that message. + * + * @param message + * The message from the parent, which should contain a data + * Object property with the following properties: + * + * hasReport (bool): + * Whether or not there is a crash report. + * + * sendReport (bool): + * Whether or not the the user prefers to send the report + * by default. + * + * includeURL (bool): + * Whether or not the user prefers to send the URL of + * the tab that crashed. + * + * emailMe (bool): + * Whether or not to send the email address of the user + * in the report. + * + * email (String): + * The email address of the user (empty if emailMe is false). + * + * requestAutoSubmit (bool): + * Whether or not we should ask the user to automatically + * submit backlogged crash reports. + * + */ + onSetCrashReportAvailable(message) { + let data = message.data; + + if (data.hasReport) { + this.hasReport = true; + document.documentElement.classList.add("crashDumpAvailable"); + + document.getElementById("sendReport").checked = data.sendReport; + document.getElementById("includeURL").checked = data.includeURL; + + if (data.requestEmail) { + document.getElementById("requestEmail").hidden = false; + document.getElementById("emailMe").checked = data.emailMe; + if (data.emailMe) { + document.getElementById("email").value = data.email; + } + } + + this.showCrashReportUI(data.sendReport); + } else { + this.showCrashReportUI(false); + } + + if (data.requestAutoSubmit) { + document.getElementById("requestAutoSubmit").hidden = false; + } + + let event = new CustomEvent("AboutTabCrashedReady", {bubbles:true}); + document.dispatchEvent(event); + }, + + /** + * Handler for when the parent reports that the crash report associated + * with this about:tabcrashed page has been sent. + */ + onCrashReportSent() { + document.documentElement.classList.remove("crashDumpAvailable"); + document.documentElement.classList.add("crashDumpSubmitted"); + }, + + /** + * Toggles the display of the crash report form. + * + * @param shouldShow (bool) + * True if the crash report form should be shown + */ + showCrashReportUI(shouldShow) { + let options = document.getElementById("options"); + options.hidden = !shouldShow; + }, + + /** + * Toggles whether or not the page is one of several visible pages + * showing the crash reporter. This controls some of the language + * on the page, along with what the "primary" button is. + * + * @param hasMultiple (bool) + * True if there are multiple crash report pages being shown. + */ + setMultiple(hasMultiple) { + let main = document.getElementById("main"); + main.setAttribute("multiple", hasMultiple); + + let restoreTab = document.getElementById("restoreTab"); + + // The "Restore All" button has the "primary" class by default, so + // we only need to modify the "Restore Tab" button. + if (hasMultiple) { + restoreTab.classList.remove("primary"); + } else { + restoreTab.classList.add("primary"); + } + }, + + /** + * Sends a message to the parent in response to the user choosing + * one of the actions available on the page. This might also send up + * crash report information if the user has chosen to submit a crash + * report. + * + * @param messageName (String) + * The message to send to the parent + */ + sendMessage(messageName) { + let comments = ""; + let email = ""; + let URL = ""; + let sendReport = false; + let emailMe = false; + let includeURL = false; + let autoSubmit = false; + + if (this.hasReport) { + sendReport = document.getElementById("sendReport").checked; + if (sendReport) { + comments = document.getElementById("comments").value.trim(); + + includeURL = document.getElementById("includeURL").checked; + if (includeURL) { + URL = this.pageData.URL.trim(); + } + + if (!document.getElementById("requestEmail").hidden) { + emailMe = document.getElementById("emailMe").checked; + if (emailMe) { + email = document.getElementById("email").value.trim(); + } + } + } + } + + let requestAutoSubmit = document.getElementById("requestAutoSubmit"); + if (requestAutoSubmit.hidden) { + // The checkbox is hidden if the user has already opted in to sending + // backlogged crash reports. + autoSubmit = true; + } else { + autoSubmit = document.getElementById("autoSubmit").checked; + } + + sendAsyncMessage(messageName, { + sendReport, + comments, + email, + emailMe, + includeURL, + URL, + autoSubmit, + }); + }, +}; + +AboutTabCrashed.init(); diff --git a/application/basilisk/base/content/aboutTabCrashed.xhtml b/application/basilisk/base/content/aboutTabCrashed.xhtml new file mode 100644 index 000000000..c7a7a199c --- /dev/null +++ b/application/basilisk/base/content/aboutTabCrashed.xhtml @@ -0,0 +1,97 @@ + + + + + + %htmlDTD; + + %globalDTD; + + %brandDTD; + + %tabCrashedDTD; +]> + + + + + + + + + +
+ +
+

&tabCrashed.header2;

+
+ +
+

&tabCrashed.offerHelp;

+

&tabCrashed.single.offerHelpMessage;

+

&tabCrashed.multiple.offerHelpMessage;

+
+ +
+

&tabCrashed.requestHelp;

+

&tabCrashed.requestHelpMessage;

+ +

&tabCrashed.requestReport;

+ +
+ + +
+ +
    +
  • + +
  • + +
  • + + +
  • + + +
+ + +
+ +

&tabCrashed.reportSent;

+ +
+ + + +
+
+ + + + + +
+ + +
+

&safeb.blocked.phishingPage.title2;

+

&safeb.blocked.malwarePage.title;

+

&safeb.blocked.unwantedPage.title;

+
+ +
+ + +
+

&safeb.blocked.phishingPage.shortDesc2;

+

&safeb.blocked.malwarePage.shortDesc;

+

&safeb.blocked.unwantedPage.shortDesc;

+
+ + +
+

&safeb.blocked.phishingPage.longDesc2;

+

&safeb.blocked.malwarePage.longDesc;

+

&safeb.blocked.unwantedPage.longDesc;

+
+ + +
+ + +
+ +
+
+
+ +
+
+ + + + diff --git a/application/basilisk/base/content/browser-addons.js b/application/basilisk/base/content/browser-addons.js new file mode 100644 index 000000000..378437b2b --- /dev/null +++ b/application/basilisk/base/content/browser-addons.js @@ -0,0 +1,869 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Removes a doorhanger notification if all of the installs it was notifying +// about have ended in some way. +function removeNotificationOnEnd(notification, installs) { + let count = installs.length; + + function maybeRemove(install) { + install.removeListener(this); + + if (--count == 0) { + // Check that the notification is still showing + let current = PopupNotifications.getNotification(notification.id, notification.browser); + if (current === notification) + notification.remove(); + } + } + + for (let install of installs) { + install.addListener({ + onDownloadCancelled: maybeRemove, + onDownloadFailed: maybeRemove, + onInstallFailed: maybeRemove, + onInstallEnded: maybeRemove + }); + } +} + +const gXPInstallObserver = { + _findChildShell(aDocShell, aSoughtShell) { + if (aDocShell == aSoughtShell) + return aDocShell; + + var node = aDocShell.QueryInterface(Components.interfaces.nsIDocShellTreeItem); + for (var i = 0; i < node.childCount; ++i) { + var docShell = node.getChildAt(i); + docShell = this._findChildShell(docShell, aSoughtShell); + if (docShell == aSoughtShell) + return docShell; + } + return null; + }, + + _getBrowser(aDocShell) { + for (let browser of gBrowser.browsers) { + if (this._findChildShell(browser.docShell, aDocShell)) + return browser; + } + return null; + }, + + pendingInstalls: new WeakMap(), + + showInstallConfirmation(browser, installInfo, height = undefined) { + // If the confirmation notification is already open cache the installInfo + // and the new confirmation will be shown later + if (PopupNotifications.getNotification("addon-install-confirmation", browser)) { + let pending = this.pendingInstalls.get(browser); + if (pending) { + pending.push(installInfo); + } else { + this.pendingInstalls.set(browser, [installInfo]); + } + return; + } + + let showNextConfirmation = () => { + // Make sure the browser is still alive. + if (gBrowser.browsers.indexOf(browser) == -1) + return; + + let pending = this.pendingInstalls.get(browser); + if (pending && pending.length) + this.showInstallConfirmation(browser, pending.shift()); + } + + // If all installs have already been cancelled in some way then just show + // the next confirmation + if (installInfo.installs.every(i => i.state != AddonManager.STATE_DOWNLOADED)) { + showNextConfirmation(); + return; + } + + const anchorID = "addons-notification-icon"; + + // Make notifications persistent + var options = { + displayURI: installInfo.originatingURI, + persistent: true, + }; + + let acceptInstallation = () => { + for (let install of installInfo.installs) + install.install(); + installInfo = null; + + Services.telemetry + .getHistogramById("SECURITY_UI") + .add(Ci.nsISecurityUITelemetry.WARNING_CONFIRM_ADDON_INSTALL_CLICK_THROUGH); + }; + + let cancelInstallation = () => { + if (installInfo) { + for (let install of installInfo.installs) { + // The notification may have been closed because the add-ons got + // cancelled elsewhere, only try to cancel those that are still + // pending install. + if (install.state != AddonManager.STATE_CANCELLED) + install.cancel(); + } + } + + showNextConfirmation(); + }; + + let unsigned = installInfo.installs.filter(i => i.addon.signedState <= AddonManager.SIGNEDSTATE_MISSING); + let someUnsigned = unsigned.length > 0 && unsigned.length < installInfo.installs.length; + + options.eventCallback = (aEvent) => { + switch (aEvent) { + case "removed": + cancelInstallation(); + break; + case "shown": + let addonList = document.getElementById("addon-install-confirmation-content"); + while (addonList.firstChild) + addonList.firstChild.remove(); + + for (let install of installInfo.installs) { + let container = document.createElement("hbox"); + + let name = document.createElement("label"); + name.setAttribute("value", install.addon.name); + name.setAttribute("class", "addon-install-confirmation-name"); + container.appendChild(name); + + if (someUnsigned && install.addon.signedState <= AddonManager.SIGNEDSTATE_MISSING) { + let unsignedLabel = document.createElement("label"); + unsignedLabel.setAttribute("value", + gNavigatorBundle.getString("addonInstall.unsigned")); + unsignedLabel.setAttribute("class", + "addon-install-confirmation-unsigned"); + container.appendChild(unsignedLabel); + } + + addonList.appendChild(container); + } + break; + } + }; + + options.learnMoreURL = Services.urlFormatter.formatURLPref("app.support.baseURL"); + + let messageString; + let notification = document.getElementById("addon-install-confirmation-notification"); + if (unsigned.length == installInfo.installs.length) { + // None of the add-ons are verified + messageString = gNavigatorBundle.getString("addonConfirmInstallUnsigned.message"); + notification.setAttribute("warning", "true"); + options.learnMoreURL += "unsigned-addons"; + } else if (unsigned.length == 0) { + // All add-ons are verified or don't need to be verified + messageString = gNavigatorBundle.getString("addonConfirmInstall.message"); + notification.removeAttribute("warning"); + options.learnMoreURL += "find-and-install-add-ons"; + } else { + // Some of the add-ons are unverified, the list of names will indicate + // which + messageString = gNavigatorBundle.getString("addonConfirmInstallSomeUnsigned.message"); + notification.setAttribute("warning", "true"); + options.learnMoreURL += "unsigned-addons"; + } + + let brandBundle = document.getElementById("bundle_brand"); + let brandShortName = brandBundle.getString("brandShortName"); + + messageString = PluralForm.get(installInfo.installs.length, messageString); + messageString = messageString.replace("#1", brandShortName); + messageString = messageString.replace("#2", installInfo.installs.length); + + let action = { + label: gNavigatorBundle.getString("addonInstall.acceptButton.label"), + accessKey: gNavigatorBundle.getString("addonInstall.acceptButton.accesskey"), + callback: acceptInstallation, + }; + + let secondaryAction = { + label: gNavigatorBundle.getString("addonInstall.cancelButton.label"), + accessKey: gNavigatorBundle.getString("addonInstall.cancelButton.accesskey"), + callback: () => {}, + }; + + if (height) { + notification.style.minHeight = height + "px"; + } + + let tab = gBrowser.getTabForBrowser(browser); + if (tab) { + gBrowser.selectedTab = tab; + } + + let popup = PopupNotifications.show(browser, "addon-install-confirmation", + messageString, anchorID, action, + [secondaryAction], options); + + removeNotificationOnEnd(popup, installInfo.installs); + + Services.telemetry + .getHistogramById("SECURITY_UI") + .add(Ci.nsISecurityUITelemetry.WARNING_CONFIRM_ADDON_INSTALL); + }, + + observe(aSubject, aTopic, aData) { + var brandBundle = document.getElementById("bundle_brand"); + var installInfo = aSubject.wrappedJSObject; + var browser = installInfo.browser; + + // Make sure the browser is still alive. + if (!browser || gBrowser.browsers.indexOf(browser) == -1) + return; + + const anchorID = "addons-notification-icon"; + var messageString, action; + var brandShortName = brandBundle.getString("brandShortName"); + + var notificationID = aTopic; + // Make notifications persistent + var options = { + displayURI: installInfo.originatingURI, + persistent: true, + hideClose: true, + timeout: Date.now() + 30000, + }; + + switch (aTopic) { + case "addon-install-disabled": { + notificationID = "xpinstall-disabled"; + let secondaryActions = null; + + if (gPrefService.prefIsLocked("xpinstall.enabled")) { + messageString = gNavigatorBundle.getString("xpinstallDisabledMessageLocked"); + buttons = []; + } else { + messageString = gNavigatorBundle.getString("xpinstallDisabledMessage"); + + action = { + label: gNavigatorBundle.getString("xpinstallDisabledButton"), + accessKey: gNavigatorBundle.getString("xpinstallDisabledButton.accesskey"), + callback: function editPrefs() { + gPrefService.setBoolPref("xpinstall.enabled", true); + } + }; + + secondaryActions = [{ + label: gNavigatorBundle.getString("addonInstall.cancelButton.label"), + accessKey: gNavigatorBundle.getString("addonInstall.cancelButton.accesskey"), + callback: () => {}, + }]; + } + + PopupNotifications.show(browser, notificationID, messageString, anchorID, + action, secondaryActions, options); + break; } + case "addon-install-origin-blocked": { + messageString = gNavigatorBundle.getFormattedString("xpinstallPromptMessage", + [brandShortName]); + + options.removeOnDismissal = true; + options.persistent = false; + + let secHistogram = Components.classes["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry).getHistogramById("SECURITY_UI"); + secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_ADDON_ASKING_PREVENTED); + let popup = PopupNotifications.show(browser, notificationID, + messageString, anchorID, + null, null, options); + removeNotificationOnEnd(popup, installInfo.installs); + break; } + case "addon-install-blocked": { + messageString = gNavigatorBundle.getFormattedString("xpinstallPromptMessage", + [brandShortName]); + + let secHistogram = Components.classes["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry).getHistogramById("SECURITY_UI"); + action = { + label: gNavigatorBundle.getString("xpinstallPromptAllowButton"), + accessKey: gNavigatorBundle.getString("xpinstallPromptAllowButton.accesskey"), + callback() { + secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_ADDON_ASKING_PREVENTED_CLICK_THROUGH); + installInfo.install(); + } + }; + let secondaryAction = { + label: gNavigatorBundle.getString("xpinstallPromptMessage.dontAllow"), + accessKey: gNavigatorBundle.getString("xpinstallPromptMessage.dontAllow.accesskey"), + callback: () => {}, + }; + + secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_ADDON_ASKING_PREVENTED); + let popup = PopupNotifications.show(browser, notificationID, + messageString, anchorID, + action, [secondaryAction], options); + removeNotificationOnEnd(popup, installInfo.installs); + break; } + case "addon-install-started": { + let needsDownload = function needsDownload(aInstall) { + return aInstall.state != AddonManager.STATE_DOWNLOADED; + } + // If all installs have already been downloaded then there is no need to + // show the download progress + if (!installInfo.installs.some(needsDownload)) + return; + notificationID = "addon-progress"; + messageString = gNavigatorBundle.getString("addonDownloadingAndVerifying"); + messageString = PluralForm.get(installInfo.installs.length, messageString); + messageString = messageString.replace("#1", installInfo.installs.length); + options.installs = installInfo.installs; + options.contentWindow = browser.contentWindow; + options.sourceURI = browser.currentURI; + options.eventCallback = function(aEvent) { + switch (aEvent) { + case "shown": + let notificationElement = [...this.owner.panel.childNodes] + .find(n => n.notification == this); + if (notificationElement) { + if (Preferences.get("xpinstall.customConfirmationUI", false)) { + notificationElement.setAttribute("mainactiondisabled", "true"); + } else { + notificationElement.button.hidden = true; + } + } + break; + case "removed": + options.contentWindow = null; + options.sourceURI = null; + break; + } + }; + action = { + label: gNavigatorBundle.getString("addonInstall.acceptButton.label"), + accessKey: gNavigatorBundle.getString("addonInstall.acceptButton.accesskey"), + callback: () => {}, + }; + let secondaryAction = { + label: gNavigatorBundle.getString("addonInstall.cancelButton.label"), + accessKey: gNavigatorBundle.getString("addonInstall.cancelButton.accesskey"), + callback: () => { + for (let install of installInfo.installs) { + if (install.state != AddonManager.STATE_CANCELLED) { + install.cancel(); + } + } + }, + }; + let notification = PopupNotifications.show(browser, notificationID, messageString, + anchorID, action, + [secondaryAction], options); + notification._startTime = Date.now(); + + break; } + case "addon-install-failed": { + options.removeOnDismissal = true; + options.persistent = false; + + // TODO This isn't terribly ideal for the multiple failure case + for (let install of installInfo.installs) { + let host; + try { + host = options.displayURI.host; + } catch (e) { + // displayURI might be missing or 'host' might throw for non-nsStandardURL nsIURIs. + } + + if (!host) + host = (install.sourceURI instanceof Ci.nsIStandardURL) && + install.sourceURI.host; + + let error = (host || install.error == 0) ? "addonInstallError" : "addonLocalInstallError"; + let args; + if (install.error < 0) { + error += install.error; + args = [brandShortName, install.name]; + } else if (install.addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED) { + error += "Blocklisted"; + args = [install.name]; + } else { + error += "Incompatible"; + args = [brandShortName, Services.appinfo.version, install.name]; + } + + // Add Learn More link when refusing to install an unsigned add-on + if (install.error == AddonManager.ERROR_SIGNEDSTATE_REQUIRED) { + options.learnMoreURL = Services.urlFormatter.formatURLPref("app.support.baseURL") + "unsigned-addons"; + } + + messageString = gNavigatorBundle.getFormattedString(error, args); + + PopupNotifications.show(browser, notificationID, messageString, anchorID, + action, null, options); + + // Can't have multiple notifications with the same ID, so stop here. + break; + } + this._removeProgressNotification(browser); + break; } + case "addon-install-confirmation": { + let showNotification = () => { + let height = undefined; + + if (PopupNotifications.isPanelOpen) { + let rect = document.getElementById("addon-progress-notification").getBoundingClientRect(); + height = rect.height; + } + + this._removeProgressNotification(browser); + this.showInstallConfirmation(browser, installInfo, height); + }; + + let progressNotification = PopupNotifications.getNotification("addon-progress", browser); + if (progressNotification) { + let downloadDuration = Date.now() - progressNotification._startTime; + let securityDelay = Services.prefs.getIntPref("security.dialog_enable_delay") - downloadDuration; + if (securityDelay > 0) { + setTimeout(() => { + // The download may have been cancelled during the security delay + if (PopupNotifications.getNotification("addon-progress", browser)) + showNotification(); + }, securityDelay); + break; + } + } + showNotification(); + break; } + case "addon-install-complete": { + let needsRestart = installInfo.installs.some(function(i) { + return i.addon.pendingOperations != AddonManager.PENDING_NONE; + }); + + let secondaryActions = null; + + if (needsRestart) { + notificationID = "addon-install-restart"; + messageString = gNavigatorBundle.getString("addonsInstalledNeedsRestart"); + action = { + label: gNavigatorBundle.getString("addonInstallRestartButton"), + accessKey: gNavigatorBundle.getString("addonInstallRestartButton.accesskey"), + callback() { + BrowserUtils.restartApplication(); + } + }; + secondaryActions = [{ + label: gNavigatorBundle.getString("addonInstallRestartIgnoreButton"), + accessKey: gNavigatorBundle.getString("addonInstallRestartIgnoreButton.accesskey"), + callback: () => {}, + }]; + } else { + messageString = gNavigatorBundle.getString("addonsInstalled"); + action = null; + } + + messageString = PluralForm.get(installInfo.installs.length, messageString); + messageString = messageString.replace("#1", installInfo.installs[0].name); + messageString = messageString.replace("#2", installInfo.installs.length); + messageString = messageString.replace("#3", brandShortName); + + // Remove notification on dismissal, since it's possible to cancel the + // install through the addons manager UI, making the "restart" prompt + // irrelevant. + options.removeOnDismissal = true; + options.persistent = false; + + PopupNotifications.show(browser, notificationID, messageString, anchorID, + action, secondaryActions, options); + break; } + } + }, + _removeProgressNotification(aBrowser) { + let notification = PopupNotifications.getNotification("addon-progress", aBrowser); + if (notification) + notification.remove(); + } +}; + +const gExtensionsNotifications = { + initialized: false, + init() { + this.updateAlerts(); + this.boundUpdate = this.updateAlerts.bind(this); + ExtensionsUI.on("change", this.boundUpdate); + this.initialized = true; + }, + + uninit() { + // uninit() can race ahead of init() in some cases, if that happens, + // we have no handler to remove. + if (!this.initialized) { + return; + } + ExtensionsUI.off("change", this.boundUpdate); + }, + + updateAlerts() { + let sideloaded = ExtensionsUI.sideloaded; + let updates = ExtensionsUI.updates; + if (sideloaded.size + updates.size == 0) { + gMenuButtonBadgeManager.removeBadge(gMenuButtonBadgeManager.BADGEID_ADDONS); + } else { + gMenuButtonBadgeManager.addBadge(gMenuButtonBadgeManager.BADGEID_ADDONS, + "addon-alert"); + } + + let container = document.getElementById("PanelUI-footer-addons"); + + while (container.firstChild) { + container.firstChild.remove(); + } + + const DEFAULT_EXTENSION_ICON = + "chrome://mozapps/skin/extensions/extensionGeneric.svg"; + let items = 0; + for (let update of updates) { + if (++items > 4) { + break; + } + + let button = document.createElement("toolbarbutton"); + let text = gNavigatorBundle.getFormattedString("webextPerms.updateMenuItem", [update.addon.name]); + button.setAttribute("label", text); + + let icon = update.addon.iconURL || DEFAULT_EXTENSION_ICON; + button.setAttribute("image", icon); + + button.addEventListener("click", evt => { + ExtensionsUI.showUpdate(gBrowser, update); + }); + + container.appendChild(button); + } + + let appName; + for (let addon of sideloaded) { + if (++items > 4) { + break; + } + if (!appName) { + let brandBundle = document.getElementById("bundle_brand"); + appName = brandBundle.getString("brandShortName"); + } + + let button = document.createElement("toolbarbutton"); + let text = gNavigatorBundle.getFormattedString("webextPerms.sideloadMenuItem", [addon.name, appName]); + button.setAttribute("label", text); + + let icon = addon.iconURL || DEFAULT_EXTENSION_ICON; + button.setAttribute("image", icon); + + button.addEventListener("click", evt => { + ExtensionsUI.showSideloaded(gBrowser, addon); + }); + + container.appendChild(button); + } + }, +}; + +var LightWeightThemeWebInstaller = { + init() { + let mm = window.messageManager; + mm.addMessageListener("LightWeightThemeWebInstaller:Install", this); + mm.addMessageListener("LightWeightThemeWebInstaller:Preview", this); + mm.addMessageListener("LightWeightThemeWebInstaller:ResetPreview", this); + }, + + receiveMessage(message) { + // ignore requests from background tabs + if (message.target != gBrowser.selectedBrowser) { + return; + } + + let data = message.data; + + switch (message.name) { + case "LightWeightThemeWebInstaller:Install": { + this._installRequest(data.themeData, data.baseURI); + break; + } + case "LightWeightThemeWebInstaller:Preview": { + this._preview(data.themeData, data.baseURI); + break; + } + case "LightWeightThemeWebInstaller:ResetPreview": { + this._resetPreview(data && data.baseURI); + break; + } + } + }, + + handleEvent(event) { + switch (event.type) { + case "TabSelect": { + this._resetPreview(); + break; + } + } + }, + + get _manager() { + let temp = {}; + Cu.import("resource://gre/modules/LightweightThemeManager.jsm", temp); + delete this._manager; + return this._manager = temp.LightweightThemeManager; + }, + + _installRequest(dataString, baseURI) { + let data = this._manager.parseTheme(dataString, baseURI); + + if (!data) { + return; + } + + let uri = makeURI(baseURI); + + // A notification bar with the option to undo is normally shown after a + // theme is installed. But the discovery pane served from the url(s) + // below has its own toggle switch for quick undos, so don't show the + // notification in that case. + let notify = uri.prePath != "https://discovery.addons.mozilla.org"; + if (notify) { + try { + if (Services.prefs.getBoolPref("extensions.webapi.testing") + && (uri.prePath == "https://discovery.addons.allizom.org" + || uri.prePath == "https://discovery.addons-dev.allizom.org")) { + notify = false; + } + } catch (e) { + // getBoolPref() throws if the testing pref isn't set. ignore it. + } + } + + if (this._isAllowed(baseURI)) { + this._install(data, notify); + return; + } + + let allowButtonText = + gNavigatorBundle.getString("lwthemeInstallRequest.allowButton"); + let allowButtonAccesskey = + gNavigatorBundle.getString("lwthemeInstallRequest.allowButton.accesskey"); + let message = + gNavigatorBundle.getFormattedString("lwthemeInstallRequest.message", + [uri.host]); + let buttons = [{ + label: allowButtonText, + accessKey: allowButtonAccesskey, + callback() { + LightWeightThemeWebInstaller._install(data, notify); + } + }]; + + this._removePreviousNotifications(); + + let notificationBox = gBrowser.getNotificationBox(); + let notificationBar = + notificationBox.appendNotification(message, "lwtheme-install-request", "", + notificationBox.PRIORITY_INFO_MEDIUM, + buttons); + notificationBar.persistence = 1; + }, + + _install(newLWTheme, notify) { + let previousLWTheme = this._manager.currentTheme; + + let listener = { + onEnabling(aAddon, aRequiresRestart) { + if (!aRequiresRestart) { + return; + } + + let messageString = gNavigatorBundle.getFormattedString("lwthemeNeedsRestart.message", + [aAddon.name], 1); + + let action = { + label: gNavigatorBundle.getString("lwthemeNeedsRestart.button"), + accessKey: gNavigatorBundle.getString("lwthemeNeedsRestart.accesskey"), + callback() { + BrowserUtils.restartApplication(); + } + }; + + let options = { + persistent: true + }; + + PopupNotifications.show(gBrowser.selectedBrowser, "addon-theme-change", + messageString, "addons-notification-icon", + action, null, options); + }, + + onEnabled(aAddon) { + if (notify) { + LightWeightThemeWebInstaller._postInstallNotification(newLWTheme, previousLWTheme); + } + } + }; + + AddonManager.addAddonListener(listener); + this._manager.currentTheme = newLWTheme; + AddonManager.removeAddonListener(listener); + }, + + _postInstallNotification(newTheme, previousTheme) { + function text(id) { + return gNavigatorBundle.getString("lwthemePostInstallNotification." + id); + } + + let buttons = [{ + label: text("undoButton"), + accessKey: text("undoButton.accesskey"), + callback() { + LightWeightThemeWebInstaller._manager.forgetUsedTheme(newTheme.id); + LightWeightThemeWebInstaller._manager.currentTheme = previousTheme; + } + }, { + label: text("manageButton"), + accessKey: text("manageButton.accesskey"), + callback() { + BrowserOpenAddonsMgr("addons://list/theme"); + } + }]; + + this._removePreviousNotifications(); + + let notificationBox = gBrowser.getNotificationBox(); + let notificationBar = + notificationBox.appendNotification(text("message"), + "lwtheme-install-notification", "", + notificationBox.PRIORITY_INFO_MEDIUM, + buttons); + notificationBar.persistence = 1; + notificationBar.timeout = Date.now() + 20000; // 20 seconds + }, + + _removePreviousNotifications() { + let box = gBrowser.getNotificationBox(); + + ["lwtheme-install-request", + "lwtheme-install-notification"].forEach(function(value) { + let notification = box.getNotificationWithValue(value); + if (notification) + box.removeNotification(notification); + }); + }, + + _preview(dataString, baseURI) { + if (!this._isAllowed(baseURI)) + return; + + let data = this._manager.parseTheme(dataString, baseURI); + if (!data) + return; + + this._resetPreview(); + gBrowser.tabContainer.addEventListener("TabSelect", this); + this._manager.previewTheme(data); + }, + + _resetPreview(baseURI) { + if (baseURI && !this._isAllowed(baseURI)) + return; + gBrowser.tabContainer.removeEventListener("TabSelect", this); + this._manager.resetPreview(); + }, + + _isAllowed(srcURIString) { + let uri; + try { + uri = makeURI(srcURIString); + } catch (e) { + // makeURI fails if srcURIString is a nonsense URI + return false; + } + + if (!uri.schemeIs("https")) { + return false; + } + + let pm = Services.perms; + return pm.testPermission(uri, "install") == pm.ALLOW_ACTION; + } +}; + +/* + * Listen for Lightweight Theme styling changes and update the browser's theme accordingly. + */ +var LightweightThemeListener = { + _modifiedStyles: [], + + init() { + XPCOMUtils.defineLazyGetter(this, "styleSheet", function() { + for (let i = document.styleSheets.length - 1; i >= 0; i--) { + let sheet = document.styleSheets[i]; + if (sheet.href == "chrome://browser/skin/browser-lightweightTheme.css") + return sheet; + } + return undefined; + }); + + Services.obs.addObserver(this, "lightweight-theme-styling-update", false); + Services.obs.addObserver(this, "lightweight-theme-optimized", false); + if (document.documentElement.hasAttribute("lwtheme")) + this.updateStyleSheet(document.documentElement.style.backgroundImage); + }, + + uninit() { + Services.obs.removeObserver(this, "lightweight-theme-styling-update"); + Services.obs.removeObserver(this, "lightweight-theme-optimized"); + }, + + /** + * Append the headerImage to the background-image property of all rulesets in + * browser-lightweightTheme.css. + * + * @param headerImage - a string containing a CSS image for the lightweight theme header. + */ + updateStyleSheet(headerImage) { + if (!this.styleSheet) + return; + this.substituteRules(this.styleSheet.cssRules, headerImage); + }, + + substituteRules(ruleList, headerImage, existingStyleRulesModified = 0) { + let styleRulesModified = 0; + for (let i = 0; i < ruleList.length; i++) { + let rule = ruleList[i]; + if (rule instanceof Ci.nsIDOMCSSGroupingRule) { + // Add the number of modified sub-rules to the modified count + styleRulesModified += this.substituteRules(rule.cssRules, headerImage, existingStyleRulesModified + styleRulesModified); + } else if (rule instanceof Ci.nsIDOMCSSStyleRule) { + if (!rule.style.backgroundImage) + continue; + let modifiedIndex = existingStyleRulesModified + styleRulesModified; + if (!this._modifiedStyles[modifiedIndex]) + this._modifiedStyles[modifiedIndex] = { backgroundImage: rule.style.backgroundImage }; + + rule.style.backgroundImage = this._modifiedStyles[modifiedIndex].backgroundImage + ", " + headerImage; + styleRulesModified++; + } else { + Cu.reportError("Unsupported rule encountered"); + } + } + return styleRulesModified; + }, + + // nsIObserver + observe(aSubject, aTopic, aData) { + if ((aTopic != "lightweight-theme-styling-update" && aTopic != "lightweight-theme-optimized") || + !this.styleSheet) + return; + + if (aTopic == "lightweight-theme-optimized" && aSubject != window) + return; + + let themeData = JSON.parse(aData); + if (!themeData) + return; + this.updateStyleSheet("url(" + themeData.headerURL + ")"); + }, +}; diff --git a/application/basilisk/base/content/browser-captivePortal.js b/application/basilisk/base/content/browser-captivePortal.js new file mode 100644 index 000000000..c2e45c4ed --- /dev/null +++ b/application/basilisk/base/content/browser-captivePortal.js @@ -0,0 +1,257 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +XPCOMUtils.defineLazyServiceGetter(this, "cps", + "@mozilla.org/network/captive-portal-service;1", + "nsICaptivePortalService"); + +var CaptivePortalWatcher = { + /** + * This constant is chosen to be large enough for a portal recheck to complete, + * and small enough that the delay in opening a tab isn't too noticeable. + * Please see comments for _delayedCaptivePortalDetected for more details. + */ + PORTAL_RECHECK_DELAY_MS: Preferences.get("captivedetect.portalRecheckDelayMS", 500), + + // This is the value used to identify the captive portal notification. + PORTAL_NOTIFICATION_VALUE: "captive-portal-detected", + + // This holds a weak reference to the captive portal tab so that we + // don't leak it if the user closes it. + _captivePortalTab: null, + + /** + * If a portal is detected when we don't have focus, we first wait for focus + * and then add the tab if, after a recheck, the portal is still active. This + * is set to true while we wait so that in the unlikely event that we receive + * another notification while waiting, we don't do things twice. + */ + _delayedCaptivePortalDetectedInProgress: false, + + // In the situation above, this is set to true while we wait for the recheck. + // This flag exists so that tests can appropriately simulate a recheck. + _waitingForRecheck: false, + + get _captivePortalNotification() { + let nb = document.getElementById("high-priority-global-notificationbox"); + return nb.getNotificationWithValue(this.PORTAL_NOTIFICATION_VALUE); + }, + + get canonicalURL() { + return Services.prefs.getCharPref("captivedetect.canonicalURL"); + }, + + get _browserBundle() { + delete this._browserBundle; + return this._browserBundle = + Services.strings.createBundle("chrome://browser/locale/browser.properties"); + }, + + init() { + Services.obs.addObserver(this, "captive-portal-login", false); + Services.obs.addObserver(this, "captive-portal-login-abort", false); + Services.obs.addObserver(this, "captive-portal-login-success", false); + + if (cps.state == cps.LOCKED_PORTAL) { + // A captive portal has already been detected. + this._captivePortalDetected(); + + // Automatically open a captive portal tab if there's no other browser window. + let windows = Services.wm.getEnumerator("navigator:browser"); + if (windows.getNext() == window && !windows.hasMoreElements()) { + this.ensureCaptivePortalTab(); + } + } + + cps.recheckCaptivePortal(); + }, + + uninit() { + Services.obs.removeObserver(this, "captive-portal-login"); + Services.obs.removeObserver(this, "captive-portal-login-abort"); + Services.obs.removeObserver(this, "captive-portal-login-success"); + + + if (this._delayedCaptivePortalDetectedInProgress) { + Services.obs.removeObserver(this, "xul-window-visible"); + } + }, + + observe(aSubject, aTopic, aData) { + switch (aTopic) { + case "captive-portal-login": + this._captivePortalDetected(); + break; + case "captive-portal-login-abort": + case "captive-portal-login-success": + this._captivePortalGone(); + break; + case "xul-window-visible": + this._delayedCaptivePortalDetected(); + break; + } + }, + + _captivePortalDetected() { + if (this._delayedCaptivePortalDetectedInProgress) { + return; + } + + let win = RecentWindow.getMostRecentBrowserWindow(); + // If no browser window has focus, open and show the tab when we regain focus. + // This is so that if a different application was focused, when the user + // (re-)focuses a browser window, we open the tab immediately in that window + // so they can log in before continuing to browse. + if (win != Services.ww.activeWindow) { + this._delayedCaptivePortalDetectedInProgress = true; + Services.obs.addObserver(this, "xul-window-visible", false); + } + + this._showNotification(); + }, + + /** + * Called after we regain focus if we detect a portal while a browser window + * doesn't have focus. Triggers a portal recheck to reaffirm state, and adds + * the tab if needed after a short delay to allow the recheck to complete. + */ + _delayedCaptivePortalDetected() { + if (!this._delayedCaptivePortalDetectedInProgress) { + return; + } + + let win = RecentWindow.getMostRecentBrowserWindow(); + if (win != Services.ww.activeWindow) { + // The window that got focused was not a browser window. + return; + } + Services.obs.removeObserver(this, "xul-window-visible"); + this._delayedCaptivePortalDetectedInProgress = false; + + if (win != window) { + // Some other browser window got focus, we don't have to do anything. + return; + } + // Trigger a portal recheck. The user may have logged into the portal via + // another client, or changed networks. + cps.recheckCaptivePortal(); + this._waitingForRecheck = true; + let requestTime = Date.now(); + + let self = this; + Services.obs.addObserver(function observer() { + let time = Date.now() - requestTime; + Services.obs.removeObserver(observer, "captive-portal-check-complete"); + self._waitingForRecheck = false; + if (cps.state != cps.LOCKED_PORTAL) { + // We're free of the portal! + return; + } + + if (time <= self.PORTAL_RECHECK_DELAY_MS) { + // The amount of time elapsed since we requested a recheck (i.e. since + // the browser window was focused) was small enough that we can add and + // focus a tab with the login page with no noticeable delay. + self.ensureCaptivePortalTab(); + } + }, "captive-portal-check-complete", false); + }, + + _captivePortalGone() { + if (this._delayedCaptivePortalDetectedInProgress) { + Services.obs.removeObserver(this, "xul-window-visible"); + this._delayedCaptivePortalDetectedInProgress = false; + } + + this._removeNotification(); + }, + + handleEvent(aEvent) { + if (aEvent.type != "TabSelect" || !this._captivePortalTab || !this._captivePortalNotification) { + return; + } + + let tab = this._captivePortalTab.get(); + let n = this._captivePortalNotification; + if (!tab || !n) { + return; + } + + let doc = tab.ownerDocument; + let button = n.querySelector("button.notification-button"); + if (doc.defaultView.gBrowser.selectedTab == tab) { + button.style.visibility = "hidden"; + } else { + button.style.visibility = "visible"; + } + }, + + _showNotification() { + let buttons = [ + { + label: this._browserBundle.GetStringFromName("captivePortal.showLoginPage"), + callback: () => { + this.ensureCaptivePortalTab(); + + // Returning true prevents the notification from closing. + return true; + }, + isDefault: true, + }, + ]; + + let message = this._browserBundle.GetStringFromName("captivePortal.infoMessage2"); + + let closeHandler = (aEventName) => { + if (aEventName != "removed") { + return; + } + gBrowser.tabContainer.removeEventListener("TabSelect", this); + }; + + let nb = document.getElementById("high-priority-global-notificationbox"); + nb.appendNotification(message, this.PORTAL_NOTIFICATION_VALUE, "", + nb.PRIORITY_INFO_MEDIUM, buttons, closeHandler); + + gBrowser.tabContainer.addEventListener("TabSelect", this); + }, + + _removeNotification() { + let n = this._captivePortalNotification; + if (!n || !n.parentNode) { + return; + } + n.close(); + }, + + ensureCaptivePortalTab() { + let tab; + if (this._captivePortalTab) { + tab = this._captivePortalTab.get(); + } + + // If the tab is gone or going, we need to open a new one. + if (!tab || tab.closing || !tab.parentNode) { + tab = gBrowser.addTab(this.canonicalURL, { ownerTab: gBrowser.selectedTab }); + this._captivePortalTab = Cu.getWeakReference(tab); + } + + gBrowser.selectedTab = tab; + + let canonicalURI = makeURI(this.canonicalURL); + + // When we are no longer captive, close the tab if it's at the canonical URL. + let tabCloser = () => { + Services.obs.removeObserver(tabCloser, "captive-portal-login-abort"); + Services.obs.removeObserver(tabCloser, "captive-portal-login-success"); + if (!tab || tab.closing || !tab.parentNode || !tab.linkedBrowser || + !tab.linkedBrowser.currentURI.equalsExceptRef(canonicalURI)) { + return; + } + gBrowser.removeTab(tab); + } + Services.obs.addObserver(tabCloser, "captive-portal-login-abort", false); + Services.obs.addObserver(tabCloser, "captive-portal-login-success", false); + }, +}; diff --git a/application/basilisk/base/content/browser-charsetmenu.inc b/application/basilisk/base/content/browser-charsetmenu.inc new file mode 100644 index 000000000..806b1cf03 --- /dev/null +++ b/application/basilisk/base/content/browser-charsetmenu.inc @@ -0,0 +1,12 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + + + + + diff --git a/application/basilisk/base/content/browser-compacttheme.js b/application/basilisk/base/content/browser-compacttheme.js new file mode 100644 index 000000000..87095df51 --- /dev/null +++ b/application/basilisk/base/content/browser-compacttheme.js @@ -0,0 +1,106 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * Listeners for the compact theme. This adds an extra stylesheet + * to browser.xul if a pref is set and no other themes are applied. + */ +var CompactTheme = { + styleSheetLocation: "chrome://browser/skin/compacttheme.css", + styleSheet: null, + initialized: false, + + get isStyleSheetEnabled() { + return this.styleSheet && !this.styleSheet.sheet.disabled; + }, + + get isThemeCurrentlyApplied() { + let theme = LightweightThemeManager.currentTheme; + return theme && ( + theme.id == "firefox-compact-dark@mozilla.org" || + theme.id == "firefox-compact-light@mozilla.org"); + }, + + init() { + this.initialized = true; + Services.obs.addObserver(this, "lightweight-theme-styling-update", false); + + if (this.isThemeCurrentlyApplied) { + this._toggleStyleSheet(true); + } + }, + + createStyleSheet() { + let styleSheetAttr = `href="${this.styleSheetLocation}" type="text/css"`; + this.styleSheet = document.createProcessingInstruction( + "xml-stylesheet", styleSheetAttr); + this.styleSheet.addEventListener("load", this); + document.insertBefore(this.styleSheet, document.documentElement); + this.styleSheet.sheet.disabled = true; + }, + + observe(subject, topic, data) { + if (topic == "lightweight-theme-styling-update") { + let newTheme = JSON.parse(data); + if (newTheme && ( + newTheme.id == "firefox-compact-light@mozilla.org" || + newTheme.id == "firefox-compact-dark@mozilla.org")) { + // We are using the theme ID on this object instead of always referencing + // LightweightThemeManager.currentTheme in case this is a preview + this._toggleStyleSheet(true); + } else { + this._toggleStyleSheet(false); + } + + } + }, + + handleEvent(e) { + if (e.type === "load") { + this.styleSheet.removeEventListener("load", this); + this.refreshBrowserDisplay(); + } + }, + + refreshBrowserDisplay() { + // Don't touch things on the browser if gBrowserInit.onLoad hasn't + // yet fired. + if (this.initialized) { + gBrowser.tabContainer._positionPinnedTabs(); + } + }, + + _toggleStyleSheet(enabled) { + let wasEnabled = this.isStyleSheetEnabled; + if (enabled) { + // The stylesheet may not have been created yet if it wasn't + // needed on initial load. Make it now. + if (!this.styleSheet) { + this.createStyleSheet(); + } + this.styleSheet.sheet.disabled = false; + this.refreshBrowserDisplay(); + } else if (!enabled && wasEnabled) { + this.styleSheet.sheet.disabled = true; + this.refreshBrowserDisplay(); + } + }, + + uninit() { + Services.obs.removeObserver(this, "lightweight-theme-styling-update"); + if (this.styleSheet) { + this.styleSheet.removeEventListener("load", this); + } + this.styleSheet = null; + } +}; + +#ifdef INSTALL_COMPACT_THEMES +// If the compact theme is going to be applied in gBrowserInit.onLoad, +// then preload it now. This prevents a flash of unstyled content where the +// normal theme is applied while the compact theme stylesheet is loading. +if (this != Services.appShell.hiddenDOMWindow && CompactTheme.isThemeCurrentlyApplied) { + CompactTheme.createStyleSheet(); +} +#endif diff --git a/application/basilisk/base/content/browser-context.inc b/application/basilisk/base/content/browser-context.inc new file mode 100644 index 000000000..fbad5e584 --- /dev/null +++ b/application/basilisk/base/content/browser-context.inc @@ -0,0 +1,452 @@ +# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# NB: IF YOU ADD ITEMS TO THIS FILE, PLEASE UPDATE THE WHITELIST IN +# BrowserUITelemetry.jsm. SEE BUG 991757 FOR DETAILS. + + + + + + + + + + + + + + + +# label and data-usercontextid are dynamically set. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#ifdef CONTEXT_COPY_IMAGE_CONTENTS + +#endif + + + + + + + + + + + + + + + + + + + + + +