From f9cab004186edb425a9b88ad649726605080a17c Mon Sep 17 00:00:00 2001 From: Thomas Groman Date: Mon, 20 Apr 2020 20:49:37 -0700 Subject: move browser to webbrowser/ --- LICENSE | 7 - Makefile.in | 13 - app-rules.mk | 1 - app.mozbuild | 17 - app/Makefile.in | 108 - app/application.ini | 50 - app/blocklist.xml | 3909 ---------- app/macbuild/Contents/CodeResources | 1 - app/macbuild/Contents/Info.plist.in | 227 - app/macbuild/Contents/MacOS-files.in | 10 - .../Resources/English.lproj/InfoPlist.strings.in | 5 - app/macbuild/Contents/_CodeSignature/CodeResources | 71 - app/macversion.py | 44 - app/module.ver | 8 - app/moz.build | 64 - app/nsBrowserApp.cpp | 393 -- app/palemoon.exe.manifest | 48 - app/permissions | 14 - app/profile/channel-prefs.js | 6 - app/profile/extensions/moz.build | 7 - .../Makefile.in | 10 - .../install.rdf.in | 40 - .../moz.build | 8 - app/profile/pagethemes.rdf | 7 - app/profile/prefs.js | 13 - app/profile/webbrowser.js | 1205 ---- app/splash.rc | 21 - base/content/aboutDialog.css | 74 - base/content/aboutDialog.js | 62 - base/content/aboutDialog.xul | 86 - base/content/autocomplete.css | 17 - base/content/autocomplete.xml | 2128 ------ base/content/autorecovery.js | 60 - base/content/autorecovery.xul | 12 - base/content/baseMenuOverlay.xul | 114 - base/content/browser-addons.js | 537 -- base/content/browser-appmenu.inc | 381 - base/content/browser-charsetmenu.inc | 62 - base/content/browser-context.inc | 384 - base/content/browser-devtools-theme.js | 91 - base/content/browser-doctype.inc | 19 - base/content/browser-feeds.js | 224 - base/content/browser-fullScreen.js | 462 -- base/content/browser-fullZoom.js | 526 -- base/content/browser-gestureSupport.js | 1059 --- base/content/browser-menubar.inc | 564 -- base/content/browser-menudragging.js | 340 - base/content/browser-menudragging.xul | 13 - base/content/browser-places.js | 1316 ---- base/content/browser-plugins.js | 781 -- base/content/browser-sets.inc | 357 - base/content/browser-syncui.js | 472 -- base/content/browser-tabPreviews.js | 1058 --- base/content/browser-tabPreviews.xml | 78 - base/content/browser-thumbnails.js | 203 - base/content/browser-title.css | 204 - base/content/browser-uacompat.js | 45 - base/content/browser-webrtcUI.js | 55 - base/content/browser.css | 759 -- base/content/browser.js | 7440 -------------------- base/content/browser.xul | 1046 --- base/content/browserMountPoints.inc | 12 - base/content/content.js | 177 - base/content/downloadManagerOverlay.xul | 32 - base/content/global-devtools-theme-scripts.inc | 6 - base/content/global-scripts.inc | 13 - base/content/hiddenWindow.xul | 19 - base/content/highlighter.css | 105 - base/content/jsConsoleOverlay.xul | 18 - base/content/macBrowserOverlay.xul | 67 - base/content/nsContextMenu.js | 1603 ----- base/content/openLocation.js | 150 - base/content/openLocation.xul | 57 - base/content/overrides/app-license.html | 6 - base/content/padlock.css | 203 - base/content/padlock.js | 234 - base/content/padlock.xul | 63 - base/content/padlock_classic_broken.png | Bin 726 -> 0 bytes base/content/padlock_classic_ev.png | Bin 566 -> 0 bytes base/content/padlock_classic_https.png | Bin 589 -> 0 bytes base/content/padlock_classic_low.png | Bin 682 -> 0 bytes base/content/padlock_mod_broken.png | Bin 728 -> 0 bytes base/content/padlock_mod_ev.png | Bin 290 -> 0 bytes base/content/padlock_mod_https.png | Bin 338 -> 0 bytes base/content/padlock_mod_low.png | Bin 386 -> 0 bytes base/content/palemoon.xhtml | 66 - base/content/popup-notifications.inc | 104 - base/content/safeMode.css | 8 - base/content/safeMode.js | 128 - base/content/safeMode.xul | 55 - base/content/sanitize.js | 534 -- base/content/sanitize.xul | 190 - base/content/sanitizeDialog.css | 23 - base/content/sanitizeDialog.js | 910 --- base/content/softwareUpdateOverlay.xul | 18 - base/content/tabbrowser.css | 77 - base/content/tabbrowser.xml | 5403 -------------- base/content/test/general/audio.ogg | Bin 47411 -> 0 bytes base/content/urlbarBindings.xml | 1800 ----- base/content/utilityOverlay.js | 901 --- base/content/viewSourceOverlay.xul | 26 - base/content/web-panels.js | 102 - base/content/web-panels.xul | 84 - base/content/win6BrowserOverlay.xul | 12 - base/jar.mn | 79 - base/moz.build | 20 - branding/shared/background.png | Bin 115 -> 0 bytes branding/shared/branding.mozbuild | 55 - branding/shared/locales/browserconfig.properties | 2 - branding/shared/newtab.ico | Bin 1150 -> 0 bytes branding/shared/newwindow.ico | Bin 1150 -> 0 bytes branding/shared/pbmode.ico | Bin 1150 -> 0 bytes branding/shared/pref/preferences.inc | 118 - branding/shared/pref/uaoverrides.inc | 83 - branding/unofficial/VisualElements_150.png | Bin 19030 -> 0 bytes branding/unofficial/VisualElements_70.png | Bin 5861 -> 0 bytes branding/unofficial/appname.bmp | Bin 11158 -> 0 bytes branding/unofficial/branding.nsi | 12 - branding/unofficial/configure.sh | 5 - branding/unofficial/content/about-background.png | Bin 95145 -> 0 bytes branding/unofficial/content/about-logo.png | Bin 15708 -> 0 bytes branding/unofficial/content/about-logo@2x.png | Bin 49779 -> 0 bytes branding/unofficial/content/about.png | Bin 13027 -> 0 bytes branding/unofficial/content/aboutDialog.css | 19 - branding/unofficial/content/icon48.png | Bin 2145 -> 0 bytes branding/unofficial/content/icon64.png | Bin 3025 -> 0 bytes branding/unofficial/content/jar.mn | 15 - branding/unofficial/content/moz.build | 7 - branding/unofficial/default16.png | Bin 693 -> 0 bytes branding/unofficial/default32.png | Bin 1624 -> 0 bytes branding/unofficial/default48.png | Bin 2771 -> 0 bytes branding/unofficial/disk.icns | Bin 39250 -> 0 bytes branding/unofficial/document.icns | Bin 12451 -> 0 bytes branding/unofficial/document.ico | Bin 22486 -> 0 bytes branding/unofficial/dsstore | Bin 6148 -> 0 bytes branding/unofficial/firefox.icns | Bin 12079 -> 0 bytes branding/unofficial/firefox.ico | Bin 22486 -> 0 bytes .../unofficial/locales/browserconfig.properties | 0 branding/unofficial/locales/en-US/brand.dtd | 4 - branding/unofficial/locales/en-US/brand.properties | 5 - branding/unofficial/locales/jar.mn | 12 - branding/unofficial/locales/moz.build | 3 - branding/unofficial/moz.build | 13 - branding/unofficial/mozicon128.png | Bin 11024 -> 0 bytes branding/unofficial/pref/webbrowser-branding.js | 9 - .../webbrowser.VisualElementsManifest.xml | 8 - branding/unofficial/webbrowser.desktop | 353 - branding/unofficial/wizHeader.bmp | Bin 25818 -> 0 bytes branding/unofficial/wizHeaderRTL.bmp | Bin 25818 -> 0 bytes branding/unofficial/wizWatermark.bmp | Bin 154542 -> 0 bytes branding/unstable/VisualElements_150.png | Bin 34257 -> 0 bytes branding/unstable/VisualElements_70.png | Bin 9508 -> 0 bytes branding/unstable/appname.bmp | Bin 11158 -> 0 bytes branding/unstable/branding.nsi | 16 - branding/unstable/configure.sh | 6 - branding/unstable/content/about-background.jpg | Bin 115006 -> 0 bytes branding/unstable/content/about-logo.png | Bin 42470 -> 0 bytes branding/unstable/content/about-logo@2x.png | Bin 120348 -> 0 bytes branding/unstable/content/about-wordmark.png | Bin 11708 -> 0 bytes branding/unstable/content/about.png | Bin 55384 -> 0 bytes branding/unstable/content/aboutDialog.css | 53 - branding/unstable/content/icon48.png | Bin 4855 -> 0 bytes branding/unstable/content/icon64.png | Bin 6531 -> 0 bytes branding/unstable/content/jar.mn | 16 - branding/unstable/content/moz.build | 7 - branding/unstable/default16.png | Bin 872 -> 0 bytes branding/unstable/default32.png | Bin 2499 -> 0 bytes branding/unstable/default48.png | Bin 4855 -> 0 bytes branding/unstable/disk.icns | Bin 39250 -> 0 bytes branding/unstable/document.icns | Bin 12451 -> 0 bytes branding/unstable/document.ico | Bin 19790 -> 0 bytes branding/unstable/dsstore | Bin 6148 -> 0 bytes branding/unstable/firefox.icns | Bin 59809 -> 0 bytes branding/unstable/firefox.ico | Bin 100371 -> 0 bytes branding/unstable/locales/en-US/brand.dtd | 4 - branding/unstable/locales/en-US/brand.properties | 5 - branding/unstable/locales/jar.mn | 12 - branding/unstable/locales/moz.build | 9 - branding/unstable/moz.build | 13 - branding/unstable/mozicon128.png | Bin 24891 -> 0 bytes .../unstable/palemoon.VisualElementsManifest.xml | 8 - branding/unstable/pref/palemoon-branding.js | 46 - branding/unstable/wizHeader.bmp | Bin 25818 -> 0 bytes branding/unstable/wizHeaderRTL.bmp | Bin 25818 -> 0 bytes branding/unstable/wizWatermark.bmp | Bin 154542 -> 0 bytes build.mk | 63 - components/BrowserComponents.manifest | 64 - components/abouthome/aboutHome.css | 343 - components/abouthome/aboutHome.js | 227 - components/abouthome/aboutHome.xhtml | 62 - components/abouthome/addons.png | Bin 1444 -> 0 bytes components/abouthome/addons@2x.png | Bin 3783 -> 0 bytes components/abouthome/bookmarks.png | Bin 1276 -> 0 bytes components/abouthome/bookmarks@2x.png | Bin 2946 -> 0 bytes components/abouthome/downloads.png | Bin 898 -> 0 bytes components/abouthome/downloads@2x.png | Bin 2018 -> 0 bytes components/abouthome/history.png | Bin 1654 -> 0 bytes components/abouthome/history@2x.png | Bin 4629 -> 0 bytes components/abouthome/jar.mn | 33 - components/abouthome/moz.build | 8 - components/abouthome/noise.png | Bin 4025 -> 0 bytes components/abouthome/restore-large.png | Bin 2841 -> 0 bytes components/abouthome/restore-large@2x.png | Bin 7267 -> 0 bytes components/abouthome/restore.png | Bin 1796 -> 0 bytes components/abouthome/restore@2x.png | Bin 4810 -> 0 bytes components/abouthome/settings.png | Bin 1557 -> 0 bytes components/abouthome/settings@2x.png | Bin 3836 -> 0 bytes components/abouthome/snippet1.png | Bin 1470 -> 0 bytes components/abouthome/snippet1@2x.png | Bin 3243 -> 0 bytes components/abouthome/snippet2.png | Bin 3287 -> 0 bytes components/abouthome/snippet2@2x.png | Bin 11027 -> 0 bytes components/abouthome/sync.png | Bin 1879 -> 0 bytes components/abouthome/sync@2x.png | Bin 4615 -> 0 bytes components/build/Makefile.in | 8 - components/build/moz.build | 36 - components/build/nsBrowserCompsCID.h | 31 - components/build/nsModule.cpp | 91 - components/certerror/content/aboutCertError.css | 17 - components/certerror/content/aboutCertError.xhtml | 247 - components/certerror/jar.mn | 7 - components/certerror/moz.build | 7 - components/dirprovider/DirectoryProvider.cpp | 268 - components/dirprovider/DirectoryProvider.h | 51 - components/dirprovider/moz.build | 13 - components/distribution.js | 345 - components/downloads/BrowserDownloads.manifest | 4 - components/downloads/DownloadsCommon.jsm | 1920 ----- components/downloads/DownloadsLogger.jsm | 76 - components/downloads/DownloadsStartup.js | 278 - components/downloads/DownloadsTaskbar.jsm | 177 - components/downloads/DownloadsUI.js | 151 - components/downloads/DownloadsViewUI.jsm | 250 - .../downloads/content/allDownloadsViewOverlay.css | 56 - .../downloads/content/allDownloadsViewOverlay.js | 1399 ---- .../downloads/content/allDownloadsViewOverlay.xul | 119 - .../downloads/content/contentAreaDownloadsView.css | 11 - .../downloads/content/contentAreaDownloadsView.js | 15 - .../downloads/content/contentAreaDownloadsView.xul | 45 - components/downloads/content/download.css | 45 - components/downloads/content/download.xml | 188 - components/downloads/content/downloads.css | 132 - components/downloads/content/downloads.js | 1614 ----- components/downloads/content/downloadsOverlay.xul | 142 - components/downloads/content/indicator.js | 609 -- components/downloads/content/indicatorOverlay.xul | 60 - components/downloads/jar.mn | 18 - components/downloads/moz.build | 23 - components/feeds/BrowserFeeds.manifest | 28 - components/feeds/FeedConverter.js | 591 -- components/feeds/FeedWriter.js | 1397 ---- components/feeds/WebContentConverter.js | 927 --- components/feeds/content/subscribe.css | 7 - components/feeds/content/subscribe.js | 23 - components/feeds/content/subscribe.xhtml | 65 - components/feeds/content/subscribe.xml | 40 - components/feeds/jar.mn | 9 - components/feeds/moz.build | 33 - components/feeds/nsFeedSniffer.cpp | 363 - components/feeds/nsFeedSniffer.h | 37 - components/feeds/nsIFeedResultService.idl | 66 - .../feeds/nsIWebContentConverterRegistrar.idl | 117 - components/fuel/fuelApplication.js | 822 --- components/fuel/fuelApplication.manifest | 3 - components/fuel/fuelIApplication.idl | 347 - components/fuel/moz.build | 14 - components/moz.build | 47 - components/newtab/cells.js | 126 - components/newtab/drag.js | 151 - components/newtab/dragDataHelper.js | 22 - components/newtab/drop.js | 150 - components/newtab/dropPreview.js | 222 - components/newtab/dropTargetShim.js | 232 - components/newtab/grid.js | 175 - components/newtab/jar.mn | 8 - components/newtab/moz.build | 8 - components/newtab/newTab.css | 349 - components/newtab/newTab.js | 69 - components/newtab/newTab.xhtml | 61 - components/newtab/page.js | 244 - components/newtab/search.js | 134 - components/newtab/sites.js | 353 - components/newtab/transformations.js | 270 - components/newtab/undo.js | 116 - components/newtab/updater.js | 177 - components/nsAboutRedirector.js | 114 - components/nsBrowserContentHandler.js | 803 --- components/nsBrowserGlue.js | 1867 ----- components/nsIBrowserGlue.idl | 47 - components/nsIBrowserHandler.idl | 20 - components/pageinfo/feeds.js | 59 - components/pageinfo/feeds.xml | 40 - components/pageinfo/jar.mn | 13 - components/pageinfo/moz.build | 8 - components/pageinfo/pageInfo.css | 26 - components/pageinfo/pageInfo.js | 1286 ---- components/pageinfo/pageInfo.xml | 29 - components/pageinfo/pageInfo.xul | 507 -- components/pageinfo/permissions.js | 341 - components/pageinfo/security.js | 378 - components/permissions/aboutPermissions.css | 11 - components/permissions/aboutPermissions.js | 1335 ---- components/permissions/aboutPermissions.xml | 113 - components/permissions/aboutPermissions.xul | 313 - components/permissions/jar.mn | 9 - components/permissions/moz.build | 7 - components/places/PlacesUIUtils.jsm | 1373 ---- components/places/content/bookmarkProperties.js | 675 -- components/places/content/bookmarkProperties.xul | 43 - components/places/content/bookmarksPanel.js | 25 - components/places/content/bookmarksPanel.xul | 55 - components/places/content/browserPlacesViews.js | 1754 ----- components/places/content/controller.js | 1895 ----- components/places/content/downloadsViewOverlay.xul | 47 - components/places/content/editBookmarkOverlay.js | 1063 --- components/places/content/editBookmarkOverlay.xul | 228 - components/places/content/history-panel.js | 91 - components/places/content/history-panel.xul | 95 - components/places/content/menu.xml | 488 -- components/places/content/moveBookmarks.js | 54 - components/places/content/moveBookmarks.xul | 53 - components/places/content/organizer.css | 7 - components/places/content/places.css | 16 - components/places/content/places.js | 1553 ---- components/places/content/places.xul | 471 -- components/places/content/placesOverlay.xul | 247 - components/places/content/sidebarUtils.js | 108 - components/places/content/tree.xml | 789 --- components/places/content/treeView.js | 1770 ----- components/places/jar.mn | 34 - components/places/moz.build | 9 - components/preferences/advanced.js | 755 -- components/preferences/advanced.xul | 465 -- components/preferences/applicationManager.js | 102 - components/preferences/applicationManager.xul | 59 - components/preferences/applications.js | 1890 ----- components/preferences/applications.xul | 99 - components/preferences/colors.xul | 102 - components/preferences/connection.js | 200 - components/preferences/connection.xul | 164 - components/preferences/content.js | 187 - components/preferences/content.xul | 171 - components/preferences/cookies.js | 948 --- components/preferences/cookies.xul | 106 - components/preferences/fonts.js | 144 - components/preferences/fonts.xul | 279 - components/preferences/handlers.css | 25 - components/preferences/handlers.xml | 81 - components/preferences/jar.mn | 44 - components/preferences/languages.js | 304 - components/preferences/languages.xul | 98 - components/preferences/main.js | 473 -- components/preferences/main.xul | 188 - components/preferences/moz.build | 14 - components/preferences/newtaburl.js | 102 - components/preferences/permissions.js | 463 -- components/preferences/permissions.xul | 85 - components/preferences/preferences.xul | 92 - components/preferences/privacy.js | 485 -- components/preferences/privacy.xul | 273 - components/preferences/sanitize.js | 12 - components/preferences/sanitize.xul | 108 - components/preferences/security.js | 251 - components/preferences/security.xul | 181 - components/preferences/selectBookmark.js | 83 - components/preferences/selectBookmark.xul | 44 - components/preferences/sync.js | 192 - components/preferences/sync.xul | 178 - components/preferences/tabs.js | 90 - components/preferences/tabs.xul | 102 - .../content/aboutPrivateBrowsing.xhtml | 156 - components/privatebrowsing/jar.mn | 6 - components/privatebrowsing/moz.build | 7 - components/search/content/engineManager.js | 492 -- components/search/content/engineManager.xul | 93 - components/search/content/search.xml | 837 --- components/search/content/searchbarBindings.css | 13 - components/search/jar.mn | 9 - components/search/moz.build | 7 - components/sessionstore/DocumentUtils.jsm | 230 - components/sessionstore/SessionStorage.jsm | 165 - components/sessionstore/SessionStore.jsm | 4786 ------------- components/sessionstore/XPathGenerator.jsm | 97 - components/sessionstore/_SessionFile.jsm | 314 - .../sessionstore/content/aboutSessionRestore.js | 320 - .../sessionstore/content/aboutSessionRestore.xhtml | 94 - .../sessionstore/content/content-sessionStore.js | 40 - components/sessionstore/jar.mn | 8 - components/sessionstore/moz.build | 29 - components/sessionstore/nsISessionStartup.idl | 59 - components/sessionstore/nsISessionStore.idl | 206 - components/sessionstore/nsSessionStartup.js | 296 - components/sessionstore/nsSessionStore.js | 37 - components/sessionstore/nsSessionStore.manifest | 18 - components/shell/ShellService.jsm | 114 - components/shell/content/setDesktopBackground.js | 214 - components/shell/content/setDesktopBackground.xul | 84 - components/shell/jar.mn | 7 - components/shell/moz.build | 40 - components/shell/nsGNOMEShellService.cpp | 637 -- components/shell/nsGNOMEShellService.h | 36 - components/shell/nsIGNOMEShellService.idl | 19 - components/shell/nsIMacShellService.idl | 15 - components/shell/nsIShellService.idl | 95 - components/shell/nsIWindowsShellService.idl | 17 - components/shell/nsMacShellService.cpp | 434 -- components/shell/nsMacShellService.h | 32 - components/shell/nsSetDefaultBrowser.js | 30 - components/shell/nsSetDefaultBrowser.manifest | 3 - components/shell/nsShellService.h | 12 - components/shell/nsWindowsShellService.cpp | 1277 ---- components/shell/nsWindowsShellService.h | 37 - components/statusbar/Downloads.jsm | 674 -- components/statusbar/Progress.jsm | 183 - components/statusbar/Status.jsm | 492 -- components/statusbar/Status4Evar.jsm | 312 - components/statusbar/Toolbars.jsm | 221 - components/statusbar/content-thunk.js | 23 - components/statusbar/content/overlay.css | 14 - components/statusbar/content/overlay.js | 16 - components/statusbar/content/overlay.xul | 82 - components/statusbar/content/prefs.css | 10 - components/statusbar/content/prefs.js | 274 - components/statusbar/content/prefs.xml | 704 -- components/statusbar/content/prefs.xul | 297 - components/statusbar/content/tabbrowser.xml | 218 - components/statusbar/jar.mn | 15 - components/statusbar/moz.build | 25 - components/statusbar/status4evar.idl | 57 - components/statusbar/status4evar.js | 695 -- components/statusbar/status4evar.manifest | 3 - components/sync/aboutSyncTabs-bindings.xml | 46 - components/sync/aboutSyncTabs.css | 11 - components/sync/aboutSyncTabs.js | 313 - components/sync/aboutSyncTabs.xul | 68 - components/sync/addDevice.js | 157 - components/sync/addDevice.xul | 129 - components/sync/genericChange.js | 234 - components/sync/genericChange.xul | 123 - components/sync/jar.mn | 22 - components/sync/key.xhtml | 54 - components/sync/moz.build | 8 - components/sync/notification.xml | 129 - components/sync/progress.js | 71 - components/sync/progress.xhtml | 55 - components/sync/quota.js | 247 - components/sync/quota.xul | 65 - components/sync/setup.js | 1071 --- components/sync/setup.xul | 491 -- components/sync/utils.js | 218 - config/mozconfig | 9 - config/mozconfigs/common | 7 - config/mozconfigs/linux32/beta | 7 - config/mozconfigs/linux32/common-opt | 19 - config/mozconfigs/linux32/debug | 22 - config/mozconfigs/linux32/debug-asan | 20 - config/mozconfigs/linux32/l10n-mozconfig | 12 - config/mozconfigs/linux32/release | 13 - config/mozconfigs/linux32/valgrind | 11 - config/mozconfigs/linux64/beta | 7 - config/mozconfigs/linux64/common-opt | 19 - config/mozconfigs/linux64/debug | 22 - config/mozconfigs/linux64/debug-asan | 20 - .../mozconfigs/linux64/debug-static-analysis-clang | 15 - config/mozconfigs/linux64/l10n-mozconfig | 12 - config/mozconfigs/linux64/release | 13 - config/mozconfigs/linux64/valgrind | 11 - config/mozconfigs/macosx-universal/beta | 5 - config/mozconfigs/macosx-universal/common-opt | 19 - config/mozconfigs/macosx-universal/l10n-mozconfig | 11 - config/mozconfigs/macosx-universal/release | 11 - config/mozconfigs/macosx64/debug | 19 - config/mozconfigs/macosx64/debug-asan | 16 - config/mozconfigs/macosx64/l10n-mozconfig | 8 - config/mozconfigs/win32/beta | 7 - config/mozconfigs/win32/common-opt | 33 - config/mozconfigs/win32/debug | 26 - config/mozconfigs/win32/l10n-mozconfig | 16 - config/mozconfigs/win32/release | 13 - config/mozconfigs/win64/debug | 22 - config/mozconfigs/win64/nightly | 26 - config/tooltool-manifests/linux32/clang.manifest | 17 - config/tooltool-manifests/linux32/releng.manifest | 1 - config/tooltool-manifests/linux64/clang.manifest | 17 - config/tooltool-manifests/linux64/releng.manifest | 1 - config/tooltool-manifests/macosx64/releng.manifest | 17 - config/version.txt | 1 - configure.in | 37 - confvars.sh | 104 - defs.mk | 1 - doc/BUILD | 68 - doc/mozconfig.example | 35 - installer/Makefile.in | 196 - installer/moz.build | 6 - installer/package-manifest.in | 337 - installer/removed-files.in | 116 - installer/windows/Makefile.in | 69 - installer/windows/app.tag | 4 - installer/windows/moz.build | 15 - installer/windows/nsis/defines.nsi.in | 65 - installer/windows/nsis/installer.nsi | 1162 --- installer/windows/nsis/shared.nsh | 1306 ---- installer/windows/nsis/uninstaller.nsi | 557 -- installer/windows/nsis/updater_append.ini | 12 - locales/Makefile.in | 222 - locales/all-locales | 97 - .../en-US/chrome/browser-region/region.properties | 38 - locales/en-US/chrome/browser/aboutCertError.dtd | 40 - locales/en-US/chrome/browser/aboutDialog.dtd | 91 - locales/en-US/chrome/browser/aboutHome.dtd | 26 - .../en-US/chrome/browser/aboutPrivateBrowsing.dtd | 21 - .../en-US/chrome/browser/aboutSessionRestore.dtd | 23 - locales/en-US/chrome/browser/aboutSyncTabs.dtd | 21 - locales/en-US/chrome/browser/baseMenuOverlay.dtd | 45 - locales/en-US/chrome/browser/browser.dtd | 608 -- locales/en-US/chrome/browser/browser.properties | 420 -- locales/en-US/chrome/browser/charsetMenu.dtd | 18 - .../en-US/chrome/browser/charsetMenu.properties | 103 - locales/en-US/chrome/browser/charsetOverlay.dtd | 23 - .../en-US/chrome/browser/downloads/downloads.dtd | 96 - .../chrome/browser/downloads/downloads.properties | 78 - locales/en-US/chrome/browser/engineManager.dtd | 29 - .../en-US/chrome/browser/engineManager.properties | 9 - locales/en-US/chrome/browser/feeds/subscribe.dtd | 10 - .../chrome/browser/feeds/subscribe.properties | 53 - locales/en-US/chrome/browser/newTab.dtd | 11 - locales/en-US/chrome/browser/newTab.properties | 7 - locales/en-US/chrome/browser/openLocation.dtd | 14 - .../en-US/chrome/browser/openLocation.properties | 5 - locales/en-US/chrome/browser/pageInfo.dtd | 92 - locales/en-US/chrome/browser/pageInfo.properties | 56 - locales/en-US/chrome/browser/palemoon.dtd | 15 - .../browser/permissions/aboutPermissions.dtd | 50 - .../permissions/aboutPermissions.properties | 14 - .../browser/places/bookmarkProperties.properties | 19 - .../chrome/browser/places/editBookmarkOverlay.dtd | 28 - .../en-US/chrome/browser/places/moveBookmarks.dtd | 9 - locales/en-US/chrome/browser/places/places.dtd | 140 - .../en-US/chrome/browser/places/places.properties | 95 - .../en-US/chrome/browser/preferences/advanced.dtd | 151 - .../browser/preferences/applicationManager.dtd | 8 - .../preferences/applicationManager.properties | 14 - .../chrome/browser/preferences/applications.dtd | 14 - .../en-US/chrome/browser/preferences/colors.dtd | 30 - .../chrome/browser/preferences/connection.dtd | 49 - .../en-US/chrome/browser/preferences/content.dtd | 41 - .../en-US/chrome/browser/preferences/cookies.dtd | 27 - locales/en-US/chrome/browser/preferences/fonts.dtd | 107 - .../en-US/chrome/browser/preferences/languages.dtd | 19 - locales/en-US/chrome/browser/preferences/main.dtd | 44 - .../chrome/browser/preferences/permissions.dtd | 28 - .../chrome/browser/preferences/preferences.dtd | 23 - .../browser/preferences/preferences.properties | 153 - .../en-US/chrome/browser/preferences/privacy.dtd | 83 - .../en-US/chrome/browser/preferences/security.dtd | 49 - .../chrome/browser/preferences/selectBookmark.dtd | 9 - locales/en-US/chrome/browser/preferences/sync.dtd | 47 - locales/en-US/chrome/browser/preferences/tabs.dtd | 36 - locales/en-US/chrome/browser/quitDialog.properties | 13 - locales/en-US/chrome/browser/safeMode.dtd | 27 - locales/en-US/chrome/browser/sanitize.dtd | 64 - locales/en-US/chrome/browser/search.properties | 18 - locales/en-US/chrome/browser/searchbar.dtd | 6 - .../en-US/chrome/browser/setDesktopBackground.dtd | 15 - .../en-US/chrome/browser/shellservice.properties | 13 - .../en-US/chrome/browser/statusbar/meta.properties | 9 - .../chrome/browser/statusbar/overlay.properties | 17 - .../chrome/browser/statusbar/prefs.properties | 4 - .../chrome/browser/statusbar/statusbar-overlay.dtd | 10 - .../chrome/browser/statusbar/statusbar-prefs.dtd | 99 - locales/en-US/chrome/browser/syncBrand.dtd | 6 - .../chrome/browser/syncGenericChange.properties | 37 - locales/en-US/chrome/browser/syncKey.dtd | 18 - locales/en-US/chrome/browser/syncProgress.dtd | 15 - locales/en-US/chrome/browser/syncQuota.dtd | 8 - locales/en-US/chrome/browser/syncQuota.properties | 42 - locales/en-US/chrome/browser/syncSetup.dtd | 116 - locales/en-US/chrome/browser/syncSetup.properties | 51 - locales/en-US/chrome/browser/tabbrowser.dtd | 6 - locales/en-US/chrome/browser/tabbrowser.properties | 30 - locales/en-US/chrome/browser/taskbar.properties | 12 - .../en-US/chrome/overrides/appstrings.properties | 37 - locales/en-US/chrome/overrides/netError.dtd | 254 - locales/en-US/chrome/overrides/settingsChange.dtd | 7 - .../en-US/crashreporter/crashreporter-override.ini | 9 - locales/en-US/defines.inc | 12 - locales/en-US/installer/custom.properties | 85 - locales/en-US/installer/mui.properties | 61 - locales/en-US/installer/override.properties | 86 - locales/en-US/profile/bookmarks.inc | 40 - .../en-US/profile/chrome/userChrome-example.css | 50 - .../en-US/profile/chrome/userContent-example.css | 32 - locales/en-US/searchplugins/amazondotcom.xml | 15 - locales/en-US/searchplugins/answers.xml | 16 - locales/en-US/searchplugins/bing.xml | 18 - locales/en-US/searchplugins/creativecommons.xml | 14 - locales/en-US/searchplugins/duckduckgo-html.xml | 10 - locales/en-US/searchplugins/duckduckgo.xml | 16 - locales/en-US/searchplugins/eBay.xml | 19 - locales/en-US/searchplugins/list.txt | 5 - locales/en-US/searchplugins/wikipedia.xml | 18 - locales/en-US/searchplugins/yahoo.xml | 17 - locales/en-US/updater/updater.ini | 10 - locales/en-US/webbrowser-l10n.js | 3 - locales/filter.py | 37 - locales/generic/extract-bookmarks.py | 62 - locales/generic/profile/bookmarks.html.in | 19 - locales/generic/profile/localstore.rdf | 9 - locales/generic/profile/mimeTypes.rdf | 17 - locales/jar.mn | 97 - locales/l10n.ini | 18 - locales/moz.build | 7 - locales/shipped-locales | 90 - modules/AboutHomeUtils.jsm | 67 - modules/AutoCompletePopup.jsm | 293 - modules/BrowserNewTabPreloader.jsm | 436 -- modules/CharsetMenu.jsm | 160 - modules/FormSubmitObserver.jsm | 235 - modules/FormValidationHandler.jsm | 157 - modules/NetworkPrioritizer.jsm | 179 - modules/PageMenu.jsm | 238 - modules/PopupNotifications.jsm | 994 --- modules/QuotaManager.jsm | 51 - modules/RecentWindow.jsm | 68 - modules/SharedFrame.jsm | 221 - modules/Windows8WindowFrameColor.jsm | 53 - modules/WindowsJumpLists.jsm | 581 -- modules/WindowsPreviewPerTab.jsm | 861 --- modules/moz.build | 42 - modules/offlineAppCache.jsm | 20 - modules/openLocationLastURL.jsm | 85 - modules/webrtcUI.jsm | 292 - moz.build | 23 - moz.configure | 7 - themes/LICENSE | 2 - themes/linux/Geolocation-16.png | Bin 606 -> 0 bytes themes/linux/Geolocation-64.png | Bin 8056 -> 0 bytes themes/linux/Go-arrow.png | Bin 573 -> 0 bytes themes/linux/Info.png | Bin 767 -> 0 bytes themes/linux/KUI-close.png | Bin 393 -> 0 bytes themes/linux/Makefile.in | 8 - themes/linux/Privacy-16.png | Bin 822 -> 0 bytes themes/linux/Privacy-32.png | Bin 2085 -> 0 bytes themes/linux/Privacy-48.png | Bin 3422 -> 0 bytes themes/linux/Privacy-64.png | Bin 4828 -> 0 bytes themes/linux/Secure.png | Bin 865 -> 0 bytes themes/linux/Security-broken.png | Bin 928 -> 0 bytes themes/linux/Toolbar-small.png | Bin 5429 -> 0 bytes themes/linux/Toolbar.png | Bin 8925 -> 0 bytes themes/linux/aboutCertError.css | 73 - .../linux/aboutCertError_sectionCollapsed-rtl.png | Bin 791 -> 0 bytes themes/linux/aboutCertError_sectionCollapsed.png | Bin 776 -> 0 bytes themes/linux/aboutCertError_sectionExpanded.png | Bin 767 -> 0 bytes themes/linux/aboutPrivateBrowsing.css | 47 - themes/linux/aboutSessionRestore-window-icon.png | Bin 405 -> 0 bytes themes/linux/aboutSessionRestore.css | 90 - themes/linux/aboutSyncTabs.css | 101 - themes/linux/actionicon-tab.png | Bin 236 -> 0 bytes themes/linux/autocomplete.css | 210 - themes/linux/browser.css | 2210 ------ themes/linux/click-to-play-warning-stripes.png | Bin 1563 -> 0 bytes themes/linux/communicator/communicator.css | 6 - themes/linux/communicator/jar.mn | 7 - themes/linux/communicator/moz.build | 7 - themes/linux/downloads/allDownloadsViewOverlay.css | 125 - themes/linux/downloads/buttons.png | Bin 5091 -> 0 bytes .../linux/downloads/contentAreaDownloadsView.css | 11 - themes/linux/downloads/download-glow-small.png | Bin 556 -> 0 bytes themes/linux/downloads/download-glow.png | Bin 723 -> 0 bytes .../downloads/download-notification-finish.png | Bin 3626 -> 0 bytes .../downloads/download-notification-start.png | Bin 3166 -> 0 bytes themes/linux/downloads/download-summary.png | Bin 691 -> 0 bytes themes/linux/downloads/downloads.css | 376 - themes/linux/engineManager.css | 16 - themes/linux/feeds/feedIcon.png | Bin 1794 -> 0 bytes themes/linux/feeds/feedIcon16.png | Bin 799 -> 0 bytes themes/linux/feeds/subscribe-ui.css | 29 - themes/linux/feeds/subscribe.css | 163 - themes/linux/icon.png | Bin 2185 -> 0 bytes themes/linux/identity-icons-generic.png | Bin 965 -> 0 bytes themes/linux/identity-icons-https-ev.png | Bin 708 -> 0 bytes themes/linux/identity-icons-https-mixed-active.png | Bin 984 -> 0 bytes themes/linux/identity-icons-https.png | Bin 672 -> 0 bytes themes/linux/identity.png | Bin 9690 -> 0 bytes themes/linux/imagedocument.png | Bin 2185 -> 0 bytes themes/linux/jar.mn | 142 - themes/linux/mixed-content-blocked-16.png | Bin 346 -> 0 bytes themes/linux/mixed-content-blocked-64.png | Bin 2063 -> 0 bytes themes/linux/monitor.png | Bin 6217 -> 0 bytes themes/linux/monitor_16-10.png | Bin 6787 -> 0 bytes themes/linux/moz.build | 9 - themes/linux/newtab/newTab.css | 27 - themes/linux/page-livemarks.png | Bin 799 -> 0 bytes themes/linux/pageInfo.css | 276 - themes/linux/pageInfo.png | Bin 8849 -> 0 bytes themes/linux/permissions/aboutPermissions.css | 149 - themes/linux/places/bookmarksMenu.png | Bin 461 -> 0 bytes themes/linux/places/bookmarksToolbar.png | Bin 508 -> 0 bytes themes/linux/places/calendar.png | Bin 670 -> 0 bytes themes/linux/places/downloads.png | Bin 599 -> 0 bytes themes/linux/places/editBookmarkOverlay.css | 71 - themes/linux/places/livemark-item.png | Bin 863 -> 0 bytes themes/linux/places/organizer.css | 107 - themes/linux/places/organizer.xml | 21 - themes/linux/places/pageStarred.png | Bin 767 -> 0 bytes themes/linux/places/places.css | 221 - themes/linux/places/query.png | Bin 678 -> 0 bytes themes/linux/places/star-icons.png | Bin 1106 -> 0 bytes themes/linux/places/starPage.png | Bin 723 -> 0 bytes themes/linux/places/starred48.png | Bin 2658 -> 0 bytes themes/linux/places/tag.png | Bin 877 -> 0 bytes themes/linux/places/toolbarDropMarker.png | Bin 583 -> 0 bytes themes/linux/places/unsortedBookmarks.png | Bin 748 -> 0 bytes themes/linux/places/unstarred48.png | Bin 2255 -> 0 bytes themes/linux/pointerLock-16.png | Bin 249 -> 0 bytes themes/linux/pointerLock-64.png | Bin 1119 -> 0 bytes themes/linux/preferences/Options-sync.png | Bin 3585 -> 0 bytes themes/linux/preferences/Options.png | Bin 12680 -> 0 bytes themes/linux/preferences/alwaysAsk.png | Bin 575 -> 0 bytes themes/linux/preferences/applications.css | 66 - themes/linux/preferences/mail.png | Bin 548 -> 0 bytes themes/linux/preferences/preferences.css | 156 - themes/linux/privatebrowsing-mask.png | Bin 1355 -> 0 bytes themes/linux/sanitizeDialog.css | 107 - themes/linux/searchbar.css | 72 - themes/linux/setDesktopBackground.css | 18 - themes/linux/slowStartup-16.png | Bin 478 -> 0 bytes themes/linux/statusbar/overlay.css | 114 - themes/linux/statusbar/prefs.css | 8 - themes/linux/sync-128.png | Bin 20229 -> 0 bytes themes/linux/sync-16-throbber.png | Bin 10365 -> 0 bytes themes/linux/sync-16.png | Bin 1847 -> 0 bytes themes/linux/sync-24-throbber.png | Bin 15774 -> 0 bytes themes/linux/sync-32.png | Bin 3384 -> 0 bytes themes/linux/sync-bg.png | Bin 21309 -> 0 bytes themes/linux/sync-desktopIcon.png | Bin 291 -> 0 bytes themes/linux/sync-mobileIcon.png | Bin 352 -> 0 bytes themes/linux/syncCommon.css | 49 - themes/linux/syncProgress.css | 46 - themes/linux/syncQuota.css | 26 - themes/linux/syncSetup.css | 127 - themes/linux/tabbrowser/alltabs.png | Bin 192 -> 0 bytes themes/linux/tabbrowser/connecting.png | Bin 8540 -> 0 bytes themes/linux/tabbrowser/loading.png | Bin 12184 -> 0 bytes themes/linux/tabbrowser/tab-overflow-border.png | Bin 193 -> 0 bytes themes/linux/tabbrowser/tab.png | Bin 353 -> 0 bytes themes/linux/tabbrowser/tabDragIndicator.png | Bin 450 -> 0 bytes themes/linux/urlbar-arrow.png | Bin 305 -> 0 bytes themes/linux/web-notifications-icon.svg | 15 - themes/linux/web-notifications-tray.svg | 23 - themes/linux/webRTC-shareDevice-16.png | Bin 224 -> 0 bytes themes/linux/webRTC-shareDevice-64.png | Bin 1097 -> 0 bytes themes/linux/webRTC-sharingDevice-16.png | Bin 404 -> 0 bytes themes/moz.build | 14 - themes/osx/Geolocation-16.png | Bin 704 -> 0 bytes themes/osx/Geolocation-64.png | Bin 8424 -> 0 bytes themes/osx/Info.png | Bin 641 -> 0 bytes themes/osx/KUI-background.png | Bin 222 -> 0 bytes themes/osx/KUI-close.png | Bin 393 -> 0 bytes themes/osx/Makefile.in | 7 - themes/osx/Privacy-16.png | Bin 800 -> 0 bytes themes/osx/Privacy-32.png | Bin 1995 -> 0 bytes themes/osx/Privacy-48.png | Bin 3884 -> 0 bytes themes/osx/Privacy-64.png | Bin 8140 -> 0 bytes themes/osx/Search-glass.png | Bin 1448 -> 0 bytes themes/osx/Secure24.png | Bin 1098 -> 0 bytes themes/osx/Toolbar-glass.png | Bin 18355 -> 0 bytes themes/osx/Toolbar-inverted.png | Bin 4653 -> 0 bytes themes/osx/Toolbar.png | Bin 15505 -> 0 bytes themes/osx/aboutCertError.css | 73 - themes/osx/aboutCertError_sectionCollapsed-rtl.png | Bin 791 -> 0 bytes themes/osx/aboutCertError_sectionCollapsed.png | Bin 776 -> 0 bytes themes/osx/aboutCertError_sectionExpanded.png | Bin 767 -> 0 bytes themes/osx/aboutPrivateBrowsing.css | 47 - themes/osx/aboutSessionRestore.css | 73 - themes/osx/aboutSyncTabs.css | 101 - themes/osx/actionicon-tab.png | Bin 425 -> 0 bytes themes/osx/appmenu-dropmarker.png | Bin 262 -> 0 bytes themes/osx/appmenu-icons.png | Bin 2115 -> 0 bytes themes/osx/autocomplete.css | 198 - themes/osx/browser.css | 2802 -------- themes/osx/click-to-play-warning-stripes.png | Bin 1563 -> 0 bytes themes/osx/communicator/communicator.css | 6 - themes/osx/communicator/jar.mn | 7 - themes/osx/communicator/moz.build | 7 - themes/osx/downloads/allDownloadsViewOverlay.css | 146 - themes/osx/downloads/buttons.png | Bin 6881 -> 0 bytes themes/osx/downloads/contentAreaDownloadsView.css | 22 - themes/osx/downloads/download-glow.png | Bin 546 -> 0 bytes .../osx/downloads/download-notification-finish.png | Bin 3755 -> 0 bytes .../osx/downloads/download-notification-start.png | Bin 3166 -> 0 bytes themes/osx/downloads/download-summary.png | Bin 741 -> 0 bytes themes/osx/downloads/downloads.css | 394 -- themes/osx/engineManager.css | 16 - themes/osx/feeds/feed-icons-16.png | Bin 2187 -> 0 bytes themes/osx/feeds/feedIcon.png | Bin 1833 -> 0 bytes themes/osx/feeds/feedIcon16.png | Bin 791 -> 0 bytes themes/osx/feeds/subscribe-ui.css | 29 - themes/osx/feeds/subscribe.css | 159 - themes/osx/icon.png | Bin 2185 -> 0 bytes themes/osx/identity-icons-generic.png | Bin 965 -> 0 bytes themes/osx/identity-icons-https-ev.png | Bin 708 -> 0 bytes themes/osx/identity-icons-https-mixed-active.png | Bin 984 -> 0 bytes themes/osx/identity-icons-https.png | Bin 672 -> 0 bytes themes/osx/identity.png | Bin 10508 -> 0 bytes themes/osx/imagedocument.png | Bin 2185 -> 0 bytes themes/osx/jar.mn | 181 - themes/osx/keyhole-forward-mask.svg | 15 - themes/osx/livemark-folder.png | Bin 680 -> 0 bytes themes/osx/menu-back.png | Bin 341 -> 0 bytes themes/osx/menu-forward.png | Bin 343 -> 0 bytes themes/osx/mixed-content-blocked-16.png | Bin 346 -> 0 bytes themes/osx/mixed-content-blocked-64.png | Bin 2063 -> 0 bytes themes/osx/monitor.png | Bin 6217 -> 0 bytes themes/osx/monitor_16-10.png | Bin 6787 -> 0 bytes themes/osx/moz.build | 9 - themes/osx/newtab/newTab.css | 29 - themes/osx/page-livemarks.png | Bin 683 -> 0 bytes themes/osx/page-livemarks@2x.png | Bin 1167 -> 0 bytes themes/osx/pageInfo.css | 258 - themes/osx/pageInfo.png | Bin 8118 -> 0 bytes themes/osx/panel-expander-closed.png | Bin 155 -> 0 bytes themes/osx/panel-expander-closed@2x.png | Bin 362 -> 0 bytes themes/osx/panel-expander-open.png | Bin 155 -> 0 bytes themes/osx/panel-expander-open@2x.png | Bin 356 -> 0 bytes themes/osx/panel-plus-sign.png | Bin 212 -> 0 bytes themes/osx/permissions/aboutPermissions.css | 153 - themes/osx/places/allBookmarks.png | Bin 673 -> 0 bytes themes/osx/places/bookmark.png | Bin 1779 -> 0 bytes themes/osx/places/bookmarksMenu.png | Bin 353 -> 0 bytes themes/osx/places/bookmarksToolbar.png | Bin 524 -> 0 bytes themes/osx/places/bookmarksToolbar@2x.png | Bin 1179 -> 0 bytes themes/osx/places/calendar.png | Bin 614 -> 0 bytes themes/osx/places/downloads.png | Bin 678 -> 0 bytes themes/osx/places/editBookmark.png | Bin 1642 -> 0 bytes themes/osx/places/editBookmarkOverlay.css | 105 - themes/osx/places/expander-closed-active.png | Bin 1329 -> 0 bytes themes/osx/places/expander-closed.png | Bin 837 -> 0 bytes themes/osx/places/expander-open-active.png | Bin 1329 -> 0 bytes themes/osx/places/expander-open.png | Bin 818 -> 0 bytes themes/osx/places/folderDropArrow.png | Bin 201 -> 0 bytes themes/osx/places/folderDropArrow@2x.png | Bin 443 -> 0 bytes themes/osx/places/history.png | Bin 843 -> 0 bytes themes/osx/places/history@2x.png | Bin 1872 -> 0 bytes themes/osx/places/libraryToolbar.png | Bin 2217 -> 0 bytes themes/osx/places/livemark-item.png | Bin 863 -> 0 bytes themes/osx/places/organizer.css | 134 - themes/osx/places/places.css | 146 - themes/osx/places/query.png | Bin 549 -> 0 bytes themes/osx/places/query@2x.png | Bin 1055 -> 0 bytes themes/osx/places/starred48.png | Bin 1785 -> 0 bytes themes/osx/places/tag.png | Bin 789 -> 0 bytes themes/osx/places/tag@2x.png | Bin 1593 -> 0 bytes themes/osx/places/toolbarDropMarker.png | Bin 302 -> 0 bytes themes/osx/places/unfiledBookmarks.png | Bin 586 -> 0 bytes themes/osx/places/unfiledBookmarks@2x.png | Bin 1289 -> 0 bytes themes/osx/places/unsortedBookmarks.png | Bin 780 -> 0 bytes themes/osx/places/unstarred48.png | Bin 818 -> 0 bytes themes/osx/pointerLock-16.png | Bin 249 -> 0 bytes themes/osx/pointerLock-64.png | Bin 1119 -> 0 bytes themes/osx/preferences/Options-sync.png | Bin 3585 -> 0 bytes themes/osx/preferences/Options.png | Bin 9077 -> 0 bytes themes/osx/preferences/alwaysAsk.png | Bin 446 -> 0 bytes themes/osx/preferences/application.png | Bin 441 -> 0 bytes themes/osx/preferences/applications.css | 64 - themes/osx/preferences/mail.png | Bin 630 -> 0 bytes themes/osx/preferences/preferences.css | 142 - themes/osx/preferences/saveFile.png | Bin 791 -> 0 bytes themes/osx/privatebrowsing-dark.png | Bin 1355 -> 0 bytes themes/osx/privatebrowsing-light.png | Bin 696 -> 0 bytes themes/osx/privatebrowsing-mask.png | Bin 1074 -> 0 bytes themes/osx/privatebrowsing-mask@2x.png | Bin 2639 -> 0 bytes themes/osx/reload-stop-go.png | Bin 1945 -> 0 bytes themes/osx/sanitizeDialog.css | 93 - themes/osx/searchbar-dropdown-arrow.png | Bin 509 -> 0 bytes themes/osx/searchbar.css | 79 - themes/osx/setDesktopBackground.css | 18 - themes/osx/shared.inc | 6 - themes/osx/slowStartup-16.png | Bin 512 -> 0 bytes themes/osx/statusbar/overlay.css | 108 - themes/osx/statusbar/prefs.css | 13 - themes/osx/sync-128.png | Bin 20229 -> 0 bytes themes/osx/sync-16.png | Bin 1847 -> 0 bytes themes/osx/sync-32.png | Bin 3384 -> 0 bytes themes/osx/sync-bg.png | Bin 21309 -> 0 bytes themes/osx/sync-desktopIcon.png | Bin 291 -> 0 bytes themes/osx/sync-mobileIcon.png | Bin 352 -> 0 bytes themes/osx/sync-throbber.png | Bin 10362 -> 0 bytes themes/osx/syncCommon.css | 49 - themes/osx/syncProgress.css | 46 - themes/osx/syncQuota.css | 26 - themes/osx/syncSetup.css | 132 - themes/osx/tabbrowser/alltabs-inverted.png | Bin 469 -> 0 bytes themes/osx/tabbrowser/alltabs.png | Bin 584 -> 0 bytes themes/osx/tabbrowser/connecting.png | Bin 8540 -> 0 bytes themes/osx/tabbrowser/loading.png | Bin 10727 -> 0 bytes themes/osx/tabbrowser/newtab-glass.png | Bin 398 -> 0 bytes themes/osx/tabbrowser/newtab-inverted.png | Bin 247 -> 0 bytes themes/osx/tabbrowser/newtab.png | Bin 237 -> 0 bytes themes/osx/tabbrowser/tab-arrow-left-glass.png | Bin 331 -> 0 bytes themes/osx/tabbrowser/tab-arrow-left-inverted.png | Bin 250 -> 0 bytes themes/osx/tabbrowser/tab-arrow-left.png | Bin 368 -> 0 bytes themes/osx/tabbrowser/tab-overflow-border.png | Bin 193 -> 0 bytes themes/osx/tabbrowser/tabDragIndicator.png | Bin 3117 -> 0 bytes .../osx/toolbarbutton-dropdown-arrow-inverted.png | Bin 221 -> 0 bytes themes/osx/toolbarbutton-dropdown-arrow.png | Bin 287 -> 0 bytes themes/osx/urlbar-arrow.png | Bin 305 -> 0 bytes themes/osx/urlbar-history-dropmarker.png | Bin 480 -> 0 bytes themes/osx/urlbar-popup-blocked.png | Bin 745 -> 0 bytes themes/osx/web-notifications-icon.svg | 15 - themes/osx/web-notifications-tray.svg | 23 - themes/osx/webRTC-shareDevice-16.png | Bin 233 -> 0 bytes themes/osx/webRTC-shareDevice-64.png | Bin 1097 -> 0 bytes themes/osx/webRTC-sharingDevice-16.png | Bin 404 -> 0 bytes themes/shared/browser.inc | 8 - themes/shared/newtab/controls.png | Bin 4180 -> 0 bytes themes/shared/newtab/newTab.css.inc | 203 - themes/shared/newtab/noise.png | Bin 2118 -> 0 bytes themes/shared/newtab/pinned.png | Bin 307 -> 0 bytes themes/shared/plugin-doorhanger.inc.css | 53 - themes/shared/plugins/notification-pluginAlert.png | Bin 648 -> 0 bytes .../shared/plugins/notification-pluginAlert@2x.png | Bin 1189 -> 0 bytes .../shared/plugins/notification-pluginBlocked.png | Bin 968 -> 0 bytes .../plugins/notification-pluginBlocked@2x.png | Bin 2067 -> 0 bytes .../shared/plugins/notification-pluginNormal.png | Bin 340 -> 0 bytes .../plugins/notification-pluginNormal@2x.png | Bin 469 -> 0 bytes themes/shared/statusbar/dynamic.css | 25 - themes/shared/statusbar/overlay.css | 169 - themes/shared/statusbar/pms16.png | Bin 604 -> 0 bytes themes/shared/statusbar/pms24.png | Bin 774 -> 0 bytes themes/shared/statusbar/prefs.css | 38 - themes/shared/statusbar/pulse.png | Bin 2775 -> 0 bytes themes/shared/statusbar/throbber-idle.png | Bin 713 -> 0 bytes themes/shared/statusbar/throbberStatic.png | Bin 1736 -> 0 bytes themes/shared/tabbrowser/tab-audio-small.svg | 58 - themes/shared/tabbrowser/tab-audio.svg | 18 - themes/windows/Geolocation-16.png | Bin 704 -> 0 bytes themes/windows/Geolocation-64.png | Bin 8424 -> 0 bytes themes/windows/Info.png | Bin 615 -> 0 bytes themes/windows/KUI-background.png | Bin 222 -> 0 bytes themes/windows/KUI-close.png | Bin 393 -> 0 bytes themes/windows/Makefile.in | 7 - themes/windows/Privacy-16.png | Bin 798 -> 0 bytes themes/windows/Privacy-32.png | Bin 1997 -> 0 bytes themes/windows/Privacy-48.png | Bin 3912 -> 0 bytes themes/windows/Privacy-64.png | Bin 8172 -> 0 bytes themes/windows/Push-16.png | Bin 704 -> 0 bytes themes/windows/Push-64.png | Bin 8388 -> 0 bytes themes/windows/Secure24.png | Bin 1117 -> 0 bytes themes/windows/Toolbar-glass.png | Bin 18803 -> 0 bytes themes/windows/Toolbar-glass.svg | 3218 --------- themes/windows/Toolbar-inverted.png | Bin 7101 -> 0 bytes themes/windows/Toolbar-inverted.svg | 302 - themes/windows/Toolbar.png | Bin 16015 -> 0 bytes themes/windows/Toolbar.svg | 1356 ---- themes/windows/aboutCertError.css | 73 - .../aboutCertError_sectionCollapsed-rtl.png | Bin 791 -> 0 bytes themes/windows/aboutCertError_sectionCollapsed.png | Bin 776 -> 0 bytes themes/windows/aboutCertError_sectionExpanded.png | Bin 767 -> 0 bytes themes/windows/aboutPrivateBrowsing.css | 47 - themes/windows/aboutSessionRestore-window-icon.png | Bin 352 -> 0 bytes themes/windows/aboutSessionRestore.css | 73 - themes/windows/aboutSyncTabs.css | 101 - themes/windows/actionicon-tab.png | Bin 425 -> 0 bytes themes/windows/appmenu-dropmarker.png | Bin 262 -> 0 bytes themes/windows/appmenu-icons.png | Bin 2115 -> 0 bytes themes/windows/autocomplete.css | 238 - themes/windows/browser.css | 3856 ---------- themes/windows/caption-buttons.svg | 121 - themes/windows/click-to-play-warning-stripes.png | Bin 1563 -> 0 bytes themes/windows/communicator/communicator.css | 6 - themes/windows/communicator/jar.mn | 7 - themes/windows/communicator/moz.build | 7 - .../windows/downloads/allDownloadsViewOverlay.css | 178 - themes/windows/downloads/buttons.png | Bin 6881 -> 0 bytes .../windows/downloads/contentAreaDownloadsView.css | 22 - .../downloads/download-notification-finish.png | Bin 3755 -> 0 bytes .../downloads/download-notification-start.png | Bin 3166 -> 0 bytes themes/windows/downloads/download-summary.png | Bin 741 -> 0 bytes themes/windows/downloads/downloads.css | 487 -- themes/windows/engineManager.css | 16 - themes/windows/feeds/feed-icons-16.png | Bin 2138 -> 0 bytes themes/windows/feeds/feedIcon.png | Bin 1885 -> 0 bytes themes/windows/feeds/feedIcon16.png | Bin 787 -> 0 bytes themes/windows/feeds/subscribe-ui.css | 29 - themes/windows/feeds/subscribe.css | 163 - themes/windows/icon.png | Bin 2185 -> 0 bytes themes/windows/identity-icons-generic.png | Bin 965 -> 0 bytes themes/windows/identity-icons-https-ev.png | Bin 708 -> 0 bytes .../windows/identity-icons-https-mixed-active.png | Bin 984 -> 0 bytes themes/windows/identity-icons-https.png | Bin 672 -> 0 bytes themes/windows/identity.png | Bin 11844 -> 0 bytes themes/windows/imagedocument.png | Bin 2185 -> 0 bytes themes/windows/jar.mn | 168 - themes/windows/keyhole-forward-mask.svg | 15 - themes/windows/livemark-folder.png | Bin 626 -> 0 bytes themes/windows/menu-back.png | Bin 435 -> 0 bytes themes/windows/menu-forward.png | Bin 434 -> 0 bytes themes/windows/mixed-content-blocked-16.png | Bin 346 -> 0 bytes themes/windows/mixed-content-blocked-64.png | Bin 2063 -> 0 bytes themes/windows/monitor.png | Bin 6217 -> 0 bytes themes/windows/monitor_16-10.png | Bin 6787 -> 0 bytes themes/windows/moz.build | 9 - themes/windows/newtab/newTab.css | 29 - themes/windows/pageInfo.css | 268 - themes/windows/pageInfo.png | Bin 8432 -> 0 bytes themes/windows/permissions/aboutPermissions.css | 153 - themes/windows/places/allBookmarks.png | Bin 612 -> 0 bytes themes/windows/places/bookmark.png | Bin 1779 -> 0 bytes themes/windows/places/bookmarksMenu.png | Bin 346 -> 0 bytes themes/windows/places/bookmarksToolbar.png | Bin 380 -> 0 bytes themes/windows/places/calendar.png | Bin 637 -> 0 bytes themes/windows/places/downloads.png | Bin 674 -> 0 bytes themes/windows/places/editBookmark.png | Bin 1642 -> 0 bytes themes/windows/places/editBookmarkOverlay.css | 80 - themes/windows/places/history.png | Bin 871 -> 0 bytes themes/windows/places/libraryToolbar.png | Bin 1331 -> 0 bytes themes/windows/places/livemark-item.png | Bin 863 -> 0 bytes themes/windows/places/organizer.css | 253 - themes/windows/places/places.css | 172 - themes/windows/places/query.png | Bin 602 -> 0 bytes themes/windows/places/starred48.png | Bin 1911 -> 0 bytes themes/windows/places/tag.png | Bin 676 -> 0 bytes themes/windows/places/toolbarDropMarker.png | Bin 223 -> 0 bytes themes/windows/places/unsortedBookmarks.png | Bin 762 -> 0 bytes themes/windows/places/unstarred48.png | Bin 818 -> 0 bytes themes/windows/pointerLock-16.png | Bin 249 -> 0 bytes themes/windows/pointerLock-64.png | Bin 1119 -> 0 bytes themes/windows/preferences/Options-sync.png | Bin 3585 -> 0 bytes themes/windows/preferences/Options.png | Bin 8899 -> 0 bytes themes/windows/preferences/alwaysAsk.png | Bin 439 -> 0 bytes themes/windows/preferences/application.png | Bin 419 -> 0 bytes themes/windows/preferences/applications.css | 64 - themes/windows/preferences/mail.png | Bin 549 -> 0 bytes themes/windows/preferences/preferences.css | 146 - themes/windows/preferences/saveFile.png | Bin 767 -> 0 bytes themes/windows/privatebrowsing-dark.png | Bin 1355 -> 0 bytes themes/windows/privatebrowsing-light.png | Bin 696 -> 0 bytes themes/windows/reload-stop-go.png | Bin 1945 -> 0 bytes themes/windows/sanitize.png | Bin 779 -> 0 bytes themes/windows/sanitizeDialog.css | 93 - themes/windows/searchbar-dropdown-arrow.png | Bin 517 -> 0 bytes themes/windows/searchbar.css | 81 - themes/windows/setDesktopBackground.css | 18 - themes/windows/slowStartup-16.png | Bin 512 -> 0 bytes themes/windows/statusbar/overlay.css | 104 - themes/windows/statusbar/prefs.css | 7 - themes/windows/sync-128.png | Bin 20229 -> 0 bytes themes/windows/sync-16.png | Bin 1847 -> 0 bytes themes/windows/sync-32.png | Bin 3384 -> 0 bytes themes/windows/sync-bg.png | Bin 21309 -> 0 bytes themes/windows/sync-desktopIcon.png | Bin 291 -> 0 bytes themes/windows/sync-mobileIcon.png | Bin 352 -> 0 bytes themes/windows/sync-throbber.png | Bin 10362 -> 0 bytes themes/windows/syncCommon.css | 49 - themes/windows/syncProgress.css | 46 - themes/windows/syncQuota.css | 26 - themes/windows/syncSetup.css | 132 - themes/windows/tabbrowser/alltabs-inverted.png | Bin 469 -> 0 bytes themes/windows/tabbrowser/alltabs.png | Bin 584 -> 0 bytes themes/windows/tabbrowser/connecting.png | Bin 8540 -> 0 bytes themes/windows/tabbrowser/loading.png | Bin 10727 -> 0 bytes themes/windows/tabbrowser/newtab-glass.png | Bin 398 -> 0 bytes themes/windows/tabbrowser/newtab-inverted.png | Bin 247 -> 0 bytes themes/windows/tabbrowser/newtab.png | Bin 237 -> 0 bytes themes/windows/tabbrowser/tab-arrow-left-glass.png | Bin 331 -> 0 bytes .../windows/tabbrowser/tab-arrow-left-inverted.png | Bin 250 -> 0 bytes themes/windows/tabbrowser/tab-arrow-left.png | Bin 368 -> 0 bytes themes/windows/tabbrowser/tab-overflow-border.png | Bin 193 -> 0 bytes themes/windows/tabbrowser/tabDragIndicator.png | Bin 3117 -> 0 bytes .../toolbarbutton-dropdown-arrow-inverted.png | Bin 221 -> 0 bytes themes/windows/toolbarbutton-dropdown-arrow.png | Bin 287 -> 0 bytes themes/windows/urlbar-arrow.png | Bin 305 -> 0 bytes themes/windows/urlbar-history-dropmarker.png | Bin 480 -> 0 bytes themes/windows/urlbar-popup-blocked.png | Bin 745 -> 0 bytes themes/windows/web-notifications-icon.svg | 15 - themes/windows/web-notifications-tray.svg | 23 - themes/windows/webRTC-shareDevice-16.png | Bin 233 -> 0 bytes themes/windows/webRTC-shareDevice-64.png | Bin 1097 -> 0 bytes themes/windows/webRTC-sharingDevice-16.png | Bin 404 -> 0 bytes webbrowser/LICENSE | 7 + webbrowser/Makefile.in | 13 + webbrowser/app-rules.mk | 1 + webbrowser/app.mozbuild | 17 + webbrowser/app/Makefile.in | 108 + webbrowser/app/application.ini | 50 + webbrowser/app/blocklist.xml | 3909 ++++++++++ webbrowser/app/macbuild/Contents/CodeResources | 1 + webbrowser/app/macbuild/Contents/Info.plist.in | 227 + webbrowser/app/macbuild/Contents/MacOS-files.in | 10 + .../Resources/English.lproj/InfoPlist.strings.in | 5 + .../macbuild/Contents/_CodeSignature/CodeResources | 71 + webbrowser/app/macversion.py | 44 + webbrowser/app/module.ver | 8 + webbrowser/app/moz.build | 64 + webbrowser/app/nsBrowserApp.cpp | 393 ++ webbrowser/app/palemoon.exe.manifest | 48 + webbrowser/app/permissions | 14 + webbrowser/app/profile/channel-prefs.js | 6 + webbrowser/app/profile/extensions/moz.build | 7 + .../Makefile.in | 10 + .../install.rdf.in | 40 + .../moz.build | 8 + webbrowser/app/profile/pagethemes.rdf | 7 + webbrowser/app/profile/prefs.js | 13 + webbrowser/app/profile/webbrowser.js | 1205 ++++ webbrowser/app/splash.rc | 21 + webbrowser/base/content/aboutDialog.css | 74 + webbrowser/base/content/aboutDialog.js | 62 + webbrowser/base/content/aboutDialog.xul | 86 + webbrowser/base/content/autocomplete.css | 17 + webbrowser/base/content/autocomplete.xml | 2128 ++++++ webbrowser/base/content/autorecovery.js | 60 + webbrowser/base/content/autorecovery.xul | 12 + webbrowser/base/content/baseMenuOverlay.xul | 114 + webbrowser/base/content/browser-addons.js | 537 ++ webbrowser/base/content/browser-appmenu.inc | 381 + webbrowser/base/content/browser-charsetmenu.inc | 62 + webbrowser/base/content/browser-context.inc | 384 + webbrowser/base/content/browser-devtools-theme.js | 91 + webbrowser/base/content/browser-doctype.inc | 19 + webbrowser/base/content/browser-feeds.js | 224 + webbrowser/base/content/browser-fullScreen.js | 462 ++ webbrowser/base/content/browser-fullZoom.js | 526 ++ webbrowser/base/content/browser-gestureSupport.js | 1059 +++ webbrowser/base/content/browser-menubar.inc | 564 ++ webbrowser/base/content/browser-menudragging.js | 340 + webbrowser/base/content/browser-menudragging.xul | 13 + webbrowser/base/content/browser-places.js | 1316 ++++ webbrowser/base/content/browser-plugins.js | 781 ++ webbrowser/base/content/browser-sets.inc | 357 + webbrowser/base/content/browser-syncui.js | 472 ++ webbrowser/base/content/browser-tabPreviews.js | 1058 +++ webbrowser/base/content/browser-tabPreviews.xml | 78 + webbrowser/base/content/browser-thumbnails.js | 203 + webbrowser/base/content/browser-title.css | 204 + webbrowser/base/content/browser-uacompat.js | 45 + webbrowser/base/content/browser-webrtcUI.js | 55 + webbrowser/base/content/browser.css | 759 ++ webbrowser/base/content/browser.js | 7440 ++++++++++++++++++++ webbrowser/base/content/browser.xul | 1046 +++ webbrowser/base/content/browserMountPoints.inc | 12 + webbrowser/base/content/content.js | 177 + webbrowser/base/content/downloadManagerOverlay.xul | 32 + .../base/content/global-devtools-theme-scripts.inc | 6 + webbrowser/base/content/global-scripts.inc | 13 + webbrowser/base/content/hiddenWindow.xul | 19 + webbrowser/base/content/highlighter.css | 105 + webbrowser/base/content/jsConsoleOverlay.xul | 18 + webbrowser/base/content/macBrowserOverlay.xul | 67 + webbrowser/base/content/nsContextMenu.js | 1603 +++++ webbrowser/base/content/openLocation.js | 150 + webbrowser/base/content/openLocation.xul | 57 + webbrowser/base/content/overrides/app-license.html | 6 + webbrowser/base/content/padlock.css | 203 + webbrowser/base/content/padlock.js | 234 + webbrowser/base/content/padlock.xul | 63 + webbrowser/base/content/padlock_classic_broken.png | Bin 0 -> 726 bytes webbrowser/base/content/padlock_classic_ev.png | Bin 0 -> 566 bytes webbrowser/base/content/padlock_classic_https.png | Bin 0 -> 589 bytes webbrowser/base/content/padlock_classic_low.png | Bin 0 -> 682 bytes webbrowser/base/content/padlock_mod_broken.png | Bin 0 -> 728 bytes webbrowser/base/content/padlock_mod_ev.png | Bin 0 -> 290 bytes webbrowser/base/content/padlock_mod_https.png | Bin 0 -> 338 bytes webbrowser/base/content/padlock_mod_low.png | Bin 0 -> 386 bytes webbrowser/base/content/palemoon.xhtml | 66 + webbrowser/base/content/popup-notifications.inc | 104 + webbrowser/base/content/safeMode.css | 8 + webbrowser/base/content/safeMode.js | 128 + webbrowser/base/content/safeMode.xul | 55 + webbrowser/base/content/sanitize.js | 534 ++ webbrowser/base/content/sanitize.xul | 190 + webbrowser/base/content/sanitizeDialog.css | 23 + webbrowser/base/content/sanitizeDialog.js | 910 +++ webbrowser/base/content/softwareUpdateOverlay.xul | 18 + webbrowser/base/content/tabbrowser.css | 77 + webbrowser/base/content/tabbrowser.xml | 5403 ++++++++++++++ webbrowser/base/content/test/general/audio.ogg | Bin 0 -> 47411 bytes webbrowser/base/content/urlbarBindings.xml | 1800 +++++ webbrowser/base/content/utilityOverlay.js | 901 +++ webbrowser/base/content/viewSourceOverlay.xul | 26 + webbrowser/base/content/web-panels.js | 102 + webbrowser/base/content/web-panels.xul | 84 + webbrowser/base/content/win6BrowserOverlay.xul | 12 + webbrowser/base/jar.mn | 79 + webbrowser/base/moz.build | 20 + webbrowser/branding/shared/background.png | Bin 0 -> 115 bytes webbrowser/branding/shared/branding.mozbuild | 55 + .../shared/locales/browserconfig.properties | 2 + webbrowser/branding/shared/newtab.ico | Bin 0 -> 1150 bytes webbrowser/branding/shared/newwindow.ico | Bin 0 -> 1150 bytes webbrowser/branding/shared/pbmode.ico | Bin 0 -> 1150 bytes webbrowser/branding/shared/pref/preferences.inc | 118 + webbrowser/branding/shared/pref/uaoverrides.inc | 83 + .../branding/unofficial/VisualElements_150.png | Bin 0 -> 19030 bytes .../branding/unofficial/VisualElements_70.png | Bin 0 -> 5861 bytes webbrowser/branding/unofficial/appname.bmp | Bin 0 -> 11158 bytes webbrowser/branding/unofficial/branding.nsi | 12 + webbrowser/branding/unofficial/configure.sh | 5 + .../unofficial/content/about-background.png | Bin 0 -> 95145 bytes .../branding/unofficial/content/about-logo.png | Bin 0 -> 15708 bytes .../branding/unofficial/content/about-logo@2x.png | Bin 0 -> 49779 bytes webbrowser/branding/unofficial/content/about.png | Bin 0 -> 13027 bytes .../branding/unofficial/content/aboutDialog.css | 19 + webbrowser/branding/unofficial/content/icon48.png | Bin 0 -> 2145 bytes webbrowser/branding/unofficial/content/icon64.png | Bin 0 -> 3025 bytes webbrowser/branding/unofficial/content/jar.mn | 15 + webbrowser/branding/unofficial/content/moz.build | 7 + webbrowser/branding/unofficial/default16.png | Bin 0 -> 693 bytes webbrowser/branding/unofficial/default32.png | Bin 0 -> 1624 bytes webbrowser/branding/unofficial/default48.png | Bin 0 -> 2771 bytes webbrowser/branding/unofficial/disk.icns | Bin 0 -> 39250 bytes webbrowser/branding/unofficial/document.icns | Bin 0 -> 12451 bytes webbrowser/branding/unofficial/document.ico | Bin 0 -> 22486 bytes webbrowser/branding/unofficial/dsstore | Bin 0 -> 6148 bytes webbrowser/branding/unofficial/firefox.icns | Bin 0 -> 12079 bytes webbrowser/branding/unofficial/firefox.ico | Bin 0 -> 22486 bytes .../unofficial/locales/browserconfig.properties | 0 .../branding/unofficial/locales/en-US/brand.dtd | 4 + .../unofficial/locales/en-US/brand.properties | 5 + webbrowser/branding/unofficial/locales/jar.mn | 12 + webbrowser/branding/unofficial/locales/moz.build | 3 + webbrowser/branding/unofficial/moz.build | 13 + webbrowser/branding/unofficial/mozicon128.png | Bin 0 -> 11024 bytes .../unofficial/pref/webbrowser-branding.js | 9 + .../webbrowser.VisualElementsManifest.xml | 8 + webbrowser/branding/unofficial/webbrowser.desktop | 353 + webbrowser/branding/unofficial/wizHeader.bmp | Bin 0 -> 25818 bytes webbrowser/branding/unofficial/wizHeaderRTL.bmp | Bin 0 -> 25818 bytes webbrowser/branding/unofficial/wizWatermark.bmp | Bin 0 -> 154542 bytes .../branding/unstable/VisualElements_150.png | Bin 0 -> 34257 bytes webbrowser/branding/unstable/VisualElements_70.png | Bin 0 -> 9508 bytes webbrowser/branding/unstable/appname.bmp | Bin 0 -> 11158 bytes webbrowser/branding/unstable/branding.nsi | 16 + webbrowser/branding/unstable/configure.sh | 6 + .../branding/unstable/content/about-background.jpg | Bin 0 -> 115006 bytes .../branding/unstable/content/about-logo.png | Bin 0 -> 42470 bytes .../branding/unstable/content/about-logo@2x.png | Bin 0 -> 120348 bytes .../branding/unstable/content/about-wordmark.png | Bin 0 -> 11708 bytes webbrowser/branding/unstable/content/about.png | Bin 0 -> 55384 bytes .../branding/unstable/content/aboutDialog.css | 53 + webbrowser/branding/unstable/content/icon48.png | Bin 0 -> 4855 bytes webbrowser/branding/unstable/content/icon64.png | Bin 0 -> 6531 bytes webbrowser/branding/unstable/content/jar.mn | 16 + webbrowser/branding/unstable/content/moz.build | 7 + webbrowser/branding/unstable/default16.png | Bin 0 -> 872 bytes webbrowser/branding/unstable/default32.png | Bin 0 -> 2499 bytes webbrowser/branding/unstable/default48.png | Bin 0 -> 4855 bytes webbrowser/branding/unstable/disk.icns | Bin 0 -> 39250 bytes webbrowser/branding/unstable/document.icns | Bin 0 -> 12451 bytes webbrowser/branding/unstable/document.ico | Bin 0 -> 19790 bytes webbrowser/branding/unstable/dsstore | Bin 0 -> 6148 bytes webbrowser/branding/unstable/firefox.icns | Bin 0 -> 59809 bytes webbrowser/branding/unstable/firefox.ico | Bin 0 -> 100371 bytes .../branding/unstable/locales/en-US/brand.dtd | 4 + .../unstable/locales/en-US/brand.properties | 5 + webbrowser/branding/unstable/locales/jar.mn | 12 + webbrowser/branding/unstable/locales/moz.build | 9 + webbrowser/branding/unstable/moz.build | 13 + webbrowser/branding/unstable/mozicon128.png | Bin 0 -> 24891 bytes .../unstable/palemoon.VisualElementsManifest.xml | 8 + .../branding/unstable/pref/palemoon-branding.js | 46 + webbrowser/branding/unstable/wizHeader.bmp | Bin 0 -> 25818 bytes webbrowser/branding/unstable/wizHeaderRTL.bmp | Bin 0 -> 25818 bytes webbrowser/branding/unstable/wizWatermark.bmp | Bin 0 -> 154542 bytes webbrowser/build.mk | 63 + webbrowser/components/BrowserComponents.manifest | 64 + webbrowser/components/abouthome/aboutHome.css | 343 + webbrowser/components/abouthome/aboutHome.js | 227 + webbrowser/components/abouthome/aboutHome.xhtml | 62 + webbrowser/components/abouthome/addons.png | Bin 0 -> 1444 bytes webbrowser/components/abouthome/addons@2x.png | Bin 0 -> 3783 bytes webbrowser/components/abouthome/bookmarks.png | Bin 0 -> 1276 bytes webbrowser/components/abouthome/bookmarks@2x.png | Bin 0 -> 2946 bytes webbrowser/components/abouthome/downloads.png | Bin 0 -> 898 bytes webbrowser/components/abouthome/downloads@2x.png | Bin 0 -> 2018 bytes webbrowser/components/abouthome/history.png | Bin 0 -> 1654 bytes webbrowser/components/abouthome/history@2x.png | Bin 0 -> 4629 bytes webbrowser/components/abouthome/jar.mn | 33 + webbrowser/components/abouthome/moz.build | 8 + webbrowser/components/abouthome/noise.png | Bin 0 -> 4025 bytes webbrowser/components/abouthome/restore-large.png | Bin 0 -> 2841 bytes .../components/abouthome/restore-large@2x.png | Bin 0 -> 7267 bytes webbrowser/components/abouthome/restore.png | Bin 0 -> 1796 bytes webbrowser/components/abouthome/restore@2x.png | Bin 0 -> 4810 bytes webbrowser/components/abouthome/settings.png | Bin 0 -> 1557 bytes webbrowser/components/abouthome/settings@2x.png | Bin 0 -> 3836 bytes webbrowser/components/abouthome/snippet1.png | Bin 0 -> 1470 bytes webbrowser/components/abouthome/snippet1@2x.png | Bin 0 -> 3243 bytes webbrowser/components/abouthome/snippet2.png | Bin 0 -> 3287 bytes webbrowser/components/abouthome/snippet2@2x.png | Bin 0 -> 11027 bytes webbrowser/components/abouthome/sync.png | Bin 0 -> 1879 bytes webbrowser/components/abouthome/sync@2x.png | Bin 0 -> 4615 bytes webbrowser/components/build/Makefile.in | 8 + webbrowser/components/build/moz.build | 36 + webbrowser/components/build/nsBrowserCompsCID.h | 31 + webbrowser/components/build/nsModule.cpp | 91 + .../certerror/content/aboutCertError.css | 17 + .../certerror/content/aboutCertError.xhtml | 247 + webbrowser/components/certerror/jar.mn | 7 + webbrowser/components/certerror/moz.build | 7 + .../components/dirprovider/DirectoryProvider.cpp | 268 + .../components/dirprovider/DirectoryProvider.h | 51 + webbrowser/components/dirprovider/moz.build | 13 + webbrowser/components/distribution.js | 345 + .../components/downloads/BrowserDownloads.manifest | 4 + .../components/downloads/DownloadsCommon.jsm | 1920 +++++ .../components/downloads/DownloadsLogger.jsm | 76 + .../components/downloads/DownloadsStartup.js | 278 + .../components/downloads/DownloadsTaskbar.jsm | 177 + webbrowser/components/downloads/DownloadsUI.js | 151 + .../components/downloads/DownloadsViewUI.jsm | 250 + .../downloads/content/allDownloadsViewOverlay.css | 56 + .../downloads/content/allDownloadsViewOverlay.js | 1399 ++++ .../downloads/content/allDownloadsViewOverlay.xul | 119 + .../downloads/content/contentAreaDownloadsView.css | 11 + .../downloads/content/contentAreaDownloadsView.js | 15 + .../downloads/content/contentAreaDownloadsView.xul | 45 + .../components/downloads/content/download.css | 45 + .../components/downloads/content/download.xml | 188 + .../components/downloads/content/downloads.css | 132 + .../components/downloads/content/downloads.js | 1614 +++++ .../downloads/content/downloadsOverlay.xul | 142 + .../components/downloads/content/indicator.js | 609 ++ .../downloads/content/indicatorOverlay.xul | 60 + webbrowser/components/downloads/jar.mn | 18 + webbrowser/components/downloads/moz.build | 23 + webbrowser/components/feeds/BrowserFeeds.manifest | 28 + webbrowser/components/feeds/FeedConverter.js | 591 ++ webbrowser/components/feeds/FeedWriter.js | 1397 ++++ webbrowser/components/feeds/WebContentConverter.js | 927 +++ webbrowser/components/feeds/content/subscribe.css | 7 + webbrowser/components/feeds/content/subscribe.js | 23 + .../components/feeds/content/subscribe.xhtml | 65 + webbrowser/components/feeds/content/subscribe.xml | 40 + webbrowser/components/feeds/jar.mn | 9 + webbrowser/components/feeds/moz.build | 33 + webbrowser/components/feeds/nsFeedSniffer.cpp | 363 + webbrowser/components/feeds/nsFeedSniffer.h | 37 + .../components/feeds/nsIFeedResultService.idl | 66 + .../feeds/nsIWebContentConverterRegistrar.idl | 117 + webbrowser/components/fuel/fuelApplication.js | 822 +++ .../components/fuel/fuelApplication.manifest | 3 + webbrowser/components/fuel/fuelIApplication.idl | 347 + webbrowser/components/fuel/moz.build | 14 + webbrowser/components/moz.build | 47 + webbrowser/components/newtab/cells.js | 126 + webbrowser/components/newtab/drag.js | 151 + webbrowser/components/newtab/dragDataHelper.js | 22 + webbrowser/components/newtab/drop.js | 150 + webbrowser/components/newtab/dropPreview.js | 222 + webbrowser/components/newtab/dropTargetShim.js | 232 + webbrowser/components/newtab/grid.js | 175 + webbrowser/components/newtab/jar.mn | 8 + webbrowser/components/newtab/moz.build | 8 + webbrowser/components/newtab/newTab.css | 349 + webbrowser/components/newtab/newTab.js | 69 + webbrowser/components/newtab/newTab.xhtml | 61 + webbrowser/components/newtab/page.js | 244 + webbrowser/components/newtab/search.js | 134 + webbrowser/components/newtab/sites.js | 353 + webbrowser/components/newtab/transformations.js | 270 + webbrowser/components/newtab/undo.js | 116 + webbrowser/components/newtab/updater.js | 177 + webbrowser/components/nsAboutRedirector.js | 114 + webbrowser/components/nsBrowserContentHandler.js | 803 +++ webbrowser/components/nsBrowserGlue.js | 1867 +++++ webbrowser/components/nsIBrowserGlue.idl | 47 + webbrowser/components/nsIBrowserHandler.idl | 20 + webbrowser/components/pageinfo/feeds.js | 59 + webbrowser/components/pageinfo/feeds.xml | 40 + webbrowser/components/pageinfo/jar.mn | 13 + webbrowser/components/pageinfo/moz.build | 8 + webbrowser/components/pageinfo/pageInfo.css | 26 + webbrowser/components/pageinfo/pageInfo.js | 1286 ++++ webbrowser/components/pageinfo/pageInfo.xml | 29 + webbrowser/components/pageinfo/pageInfo.xul | 507 ++ webbrowser/components/pageinfo/permissions.js | 341 + webbrowser/components/pageinfo/security.js | 378 + .../components/permissions/aboutPermissions.css | 11 + .../components/permissions/aboutPermissions.js | 1335 ++++ .../components/permissions/aboutPermissions.xml | 113 + .../components/permissions/aboutPermissions.xul | 313 + webbrowser/components/permissions/jar.mn | 9 + webbrowser/components/permissions/moz.build | 7 + webbrowser/components/places/PlacesUIUtils.jsm | 1373 ++++ .../places/content/bookmarkProperties.js | 675 ++ .../places/content/bookmarkProperties.xul | 43 + .../components/places/content/bookmarksPanel.js | 25 + .../components/places/content/bookmarksPanel.xul | 55 + .../places/content/browserPlacesViews.js | 1754 +++++ webbrowser/components/places/content/controller.js | 1895 +++++ .../places/content/downloadsViewOverlay.xul | 47 + .../places/content/editBookmarkOverlay.js | 1063 +++ .../places/content/editBookmarkOverlay.xul | 228 + .../components/places/content/history-panel.js | 91 + .../components/places/content/history-panel.xul | 95 + webbrowser/components/places/content/menu.xml | 488 ++ .../components/places/content/moveBookmarks.js | 54 + .../components/places/content/moveBookmarks.xul | 53 + webbrowser/components/places/content/organizer.css | 7 + webbrowser/components/places/content/places.css | 16 + webbrowser/components/places/content/places.js | 1553 ++++ webbrowser/components/places/content/places.xul | 471 ++ .../components/places/content/placesOverlay.xul | 247 + .../components/places/content/sidebarUtils.js | 108 + webbrowser/components/places/content/tree.xml | 789 +++ webbrowser/components/places/content/treeView.js | 1770 +++++ webbrowser/components/places/jar.mn | 34 + webbrowser/components/places/moz.build | 9 + webbrowser/components/preferences/advanced.js | 755 ++ webbrowser/components/preferences/advanced.xul | 465 ++ .../components/preferences/applicationManager.js | 102 + .../components/preferences/applicationManager.xul | 59 + webbrowser/components/preferences/applications.js | 1890 +++++ webbrowser/components/preferences/applications.xul | 99 + webbrowser/components/preferences/colors.xul | 102 + webbrowser/components/preferences/connection.js | 200 + webbrowser/components/preferences/connection.xul | 164 + webbrowser/components/preferences/content.js | 187 + webbrowser/components/preferences/content.xul | 171 + webbrowser/components/preferences/cookies.js | 948 +++ webbrowser/components/preferences/cookies.xul | 106 + webbrowser/components/preferences/fonts.js | 144 + webbrowser/components/preferences/fonts.xul | 279 + webbrowser/components/preferences/handlers.css | 25 + webbrowser/components/preferences/handlers.xml | 81 + webbrowser/components/preferences/jar.mn | 44 + webbrowser/components/preferences/languages.js | 304 + webbrowser/components/preferences/languages.xul | 98 + webbrowser/components/preferences/main.js | 473 ++ webbrowser/components/preferences/main.xul | 188 + webbrowser/components/preferences/moz.build | 14 + webbrowser/components/preferences/newtaburl.js | 102 + webbrowser/components/preferences/permissions.js | 463 ++ webbrowser/components/preferences/permissions.xul | 85 + webbrowser/components/preferences/preferences.xul | 92 + webbrowser/components/preferences/privacy.js | 485 ++ webbrowser/components/preferences/privacy.xul | 273 + webbrowser/components/preferences/sanitize.js | 12 + webbrowser/components/preferences/sanitize.xul | 108 + webbrowser/components/preferences/security.js | 251 + webbrowser/components/preferences/security.xul | 181 + .../components/preferences/selectBookmark.js | 83 + .../components/preferences/selectBookmark.xul | 44 + webbrowser/components/preferences/sync.js | 192 + webbrowser/components/preferences/sync.xul | 178 + webbrowser/components/preferences/tabs.js | 90 + webbrowser/components/preferences/tabs.xul | 102 + .../content/aboutPrivateBrowsing.xhtml | 156 + webbrowser/components/privatebrowsing/jar.mn | 6 + webbrowser/components/privatebrowsing/moz.build | 7 + .../components/search/content/engineManager.js | 492 ++ .../components/search/content/engineManager.xul | 93 + webbrowser/components/search/content/search.xml | 837 +++ .../search/content/searchbarBindings.css | 13 + webbrowser/components/search/jar.mn | 9 + webbrowser/components/search/moz.build | 7 + .../components/sessionstore/DocumentUtils.jsm | 230 + .../components/sessionstore/SessionStorage.jsm | 165 + .../components/sessionstore/SessionStore.jsm | 4786 +++++++++++++ .../components/sessionstore/XPathGenerator.jsm | 97 + .../components/sessionstore/_SessionFile.jsm | 314 + .../sessionstore/content/aboutSessionRestore.js | 320 + .../sessionstore/content/aboutSessionRestore.xhtml | 94 + .../sessionstore/content/content-sessionStore.js | 40 + webbrowser/components/sessionstore/jar.mn | 8 + webbrowser/components/sessionstore/moz.build | 29 + .../components/sessionstore/nsISessionStartup.idl | 59 + .../components/sessionstore/nsISessionStore.idl | 206 + .../components/sessionstore/nsSessionStartup.js | 296 + .../components/sessionstore/nsSessionStore.js | 37 + .../sessionstore/nsSessionStore.manifest | 18 + webbrowser/components/shell/ShellService.jsm | 114 + .../shell/content/setDesktopBackground.js | 214 + .../shell/content/setDesktopBackground.xul | 84 + webbrowser/components/shell/jar.mn | 7 + webbrowser/components/shell/moz.build | 40 + .../components/shell/nsGNOMEShellService.cpp | 637 ++ webbrowser/components/shell/nsGNOMEShellService.h | 36 + .../components/shell/nsIGNOMEShellService.idl | 19 + webbrowser/components/shell/nsIMacShellService.idl | 15 + webbrowser/components/shell/nsIShellService.idl | 95 + .../components/shell/nsIWindowsShellService.idl | 17 + webbrowser/components/shell/nsMacShellService.cpp | 434 ++ webbrowser/components/shell/nsMacShellService.h | 32 + webbrowser/components/shell/nsSetDefaultBrowser.js | 30 + .../components/shell/nsSetDefaultBrowser.manifest | 3 + webbrowser/components/shell/nsShellService.h | 12 + .../components/shell/nsWindowsShellService.cpp | 1277 ++++ .../components/shell/nsWindowsShellService.h | 37 + webbrowser/components/statusbar/Downloads.jsm | 674 ++ webbrowser/components/statusbar/Progress.jsm | 183 + webbrowser/components/statusbar/Status.jsm | 492 ++ webbrowser/components/statusbar/Status4Evar.jsm | 312 + webbrowser/components/statusbar/Toolbars.jsm | 221 + webbrowser/components/statusbar/content-thunk.js | 23 + .../components/statusbar/content/overlay.css | 14 + webbrowser/components/statusbar/content/overlay.js | 16 + .../components/statusbar/content/overlay.xul | 82 + webbrowser/components/statusbar/content/prefs.css | 10 + webbrowser/components/statusbar/content/prefs.js | 274 + webbrowser/components/statusbar/content/prefs.xml | 704 ++ webbrowser/components/statusbar/content/prefs.xul | 297 + .../components/statusbar/content/tabbrowser.xml | 218 + webbrowser/components/statusbar/jar.mn | 15 + webbrowser/components/statusbar/moz.build | 25 + webbrowser/components/statusbar/status4evar.idl | 57 + webbrowser/components/statusbar/status4evar.js | 695 ++ .../components/statusbar/status4evar.manifest | 3 + .../components/sync/aboutSyncTabs-bindings.xml | 46 + webbrowser/components/sync/aboutSyncTabs.css | 11 + webbrowser/components/sync/aboutSyncTabs.js | 313 + webbrowser/components/sync/aboutSyncTabs.xul | 68 + webbrowser/components/sync/addDevice.js | 157 + webbrowser/components/sync/addDevice.xul | 129 + webbrowser/components/sync/genericChange.js | 234 + webbrowser/components/sync/genericChange.xul | 123 + webbrowser/components/sync/jar.mn | 22 + webbrowser/components/sync/key.xhtml | 54 + webbrowser/components/sync/moz.build | 8 + webbrowser/components/sync/notification.xml | 129 + webbrowser/components/sync/progress.js | 71 + webbrowser/components/sync/progress.xhtml | 55 + webbrowser/components/sync/quota.js | 247 + webbrowser/components/sync/quota.xul | 65 + webbrowser/components/sync/setup.js | 1071 +++ webbrowser/components/sync/setup.xul | 491 ++ webbrowser/components/sync/utils.js | 218 + webbrowser/config/mozconfig | 9 + webbrowser/config/mozconfigs/common | 7 + webbrowser/config/mozconfigs/linux32/beta | 7 + webbrowser/config/mozconfigs/linux32/common-opt | 19 + webbrowser/config/mozconfigs/linux32/debug | 22 + webbrowser/config/mozconfigs/linux32/debug-asan | 20 + .../config/mozconfigs/linux32/l10n-mozconfig | 12 + webbrowser/config/mozconfigs/linux32/release | 13 + webbrowser/config/mozconfigs/linux32/valgrind | 11 + webbrowser/config/mozconfigs/linux64/beta | 7 + webbrowser/config/mozconfigs/linux64/common-opt | 19 + webbrowser/config/mozconfigs/linux64/debug | 22 + webbrowser/config/mozconfigs/linux64/debug-asan | 20 + .../mozconfigs/linux64/debug-static-analysis-clang | 15 + .../config/mozconfigs/linux64/l10n-mozconfig | 12 + webbrowser/config/mozconfigs/linux64/release | 13 + webbrowser/config/mozconfigs/linux64/valgrind | 11 + webbrowser/config/mozconfigs/macosx-universal/beta | 5 + .../config/mozconfigs/macosx-universal/common-opt | 19 + .../mozconfigs/macosx-universal/l10n-mozconfig | 11 + .../config/mozconfigs/macosx-universal/release | 11 + webbrowser/config/mozconfigs/macosx64/debug | 19 + webbrowser/config/mozconfigs/macosx64/debug-asan | 16 + .../config/mozconfigs/macosx64/l10n-mozconfig | 8 + webbrowser/config/mozconfigs/win32/beta | 7 + webbrowser/config/mozconfigs/win32/common-opt | 33 + webbrowser/config/mozconfigs/win32/debug | 26 + webbrowser/config/mozconfigs/win32/l10n-mozconfig | 16 + webbrowser/config/mozconfigs/win32/release | 13 + webbrowser/config/mozconfigs/win64/debug | 22 + webbrowser/config/mozconfigs/win64/nightly | 26 + .../tooltool-manifests/linux32/clang.manifest | 17 + .../tooltool-manifests/linux32/releng.manifest | 1 + .../tooltool-manifests/linux64/clang.manifest | 17 + .../tooltool-manifests/linux64/releng.manifest | 1 + .../tooltool-manifests/macosx64/releng.manifest | 17 + webbrowser/config/version.txt | 1 + webbrowser/configure.in | 37 + webbrowser/confvars.sh | 104 + webbrowser/defs.mk | 1 + webbrowser/doc/BUILD | 68 + webbrowser/doc/mozconfig.example | 35 + webbrowser/installer/Makefile.in | 196 + webbrowser/installer/moz.build | 6 + webbrowser/installer/package-manifest.in | 337 + webbrowser/installer/removed-files.in | 116 + webbrowser/installer/windows/Makefile.in | 69 + webbrowser/installer/windows/app.tag | 4 + webbrowser/installer/windows/moz.build | 15 + webbrowser/installer/windows/nsis/defines.nsi.in | 65 + webbrowser/installer/windows/nsis/installer.nsi | 1162 +++ webbrowser/installer/windows/nsis/shared.nsh | 1306 ++++ webbrowser/installer/windows/nsis/uninstaller.nsi | 557 ++ .../installer/windows/nsis/updater_append.ini | 12 + webbrowser/locales/Makefile.in | 222 + webbrowser/locales/all-locales | 97 + .../en-US/chrome/browser-region/region.properties | 38 + .../en-US/chrome/browser/aboutCertError.dtd | 40 + .../locales/en-US/chrome/browser/aboutDialog.dtd | 91 + .../locales/en-US/chrome/browser/aboutHome.dtd | 26 + .../en-US/chrome/browser/aboutPrivateBrowsing.dtd | 21 + .../en-US/chrome/browser/aboutSessionRestore.dtd | 23 + .../locales/en-US/chrome/browser/aboutSyncTabs.dtd | 21 + .../en-US/chrome/browser/baseMenuOverlay.dtd | 45 + .../locales/en-US/chrome/browser/browser.dtd | 608 ++ .../en-US/chrome/browser/browser.properties | 420 ++ .../locales/en-US/chrome/browser/charsetMenu.dtd | 18 + .../en-US/chrome/browser/charsetMenu.properties | 103 + .../en-US/chrome/browser/charsetOverlay.dtd | 23 + .../en-US/chrome/browser/downloads/downloads.dtd | 96 + .../chrome/browser/downloads/downloads.properties | 78 + .../locales/en-US/chrome/browser/engineManager.dtd | 29 + .../en-US/chrome/browser/engineManager.properties | 9 + .../en-US/chrome/browser/feeds/subscribe.dtd | 10 + .../chrome/browser/feeds/subscribe.properties | 53 + webbrowser/locales/en-US/chrome/browser/newTab.dtd | 11 + .../locales/en-US/chrome/browser/newTab.properties | 7 + .../locales/en-US/chrome/browser/openLocation.dtd | 14 + .../en-US/chrome/browser/openLocation.properties | 5 + .../locales/en-US/chrome/browser/pageInfo.dtd | 92 + .../en-US/chrome/browser/pageInfo.properties | 56 + .../locales/en-US/chrome/browser/palemoon.dtd | 15 + .../browser/permissions/aboutPermissions.dtd | 50 + .../permissions/aboutPermissions.properties | 14 + .../browser/places/bookmarkProperties.properties | 19 + .../chrome/browser/places/editBookmarkOverlay.dtd | 28 + .../en-US/chrome/browser/places/moveBookmarks.dtd | 9 + .../locales/en-US/chrome/browser/places/places.dtd | 140 + .../en-US/chrome/browser/places/places.properties | 95 + .../en-US/chrome/browser/preferences/advanced.dtd | 151 + .../browser/preferences/applicationManager.dtd | 8 + .../preferences/applicationManager.properties | 14 + .../chrome/browser/preferences/applications.dtd | 14 + .../en-US/chrome/browser/preferences/colors.dtd | 30 + .../chrome/browser/preferences/connection.dtd | 49 + .../en-US/chrome/browser/preferences/content.dtd | 41 + .../en-US/chrome/browser/preferences/cookies.dtd | 27 + .../en-US/chrome/browser/preferences/fonts.dtd | 107 + .../en-US/chrome/browser/preferences/languages.dtd | 19 + .../en-US/chrome/browser/preferences/main.dtd | 44 + .../chrome/browser/preferences/permissions.dtd | 28 + .../chrome/browser/preferences/preferences.dtd | 23 + .../browser/preferences/preferences.properties | 153 + .../en-US/chrome/browser/preferences/privacy.dtd | 83 + .../en-US/chrome/browser/preferences/security.dtd | 49 + .../chrome/browser/preferences/selectBookmark.dtd | 9 + .../en-US/chrome/browser/preferences/sync.dtd | 47 + .../en-US/chrome/browser/preferences/tabs.dtd | 36 + .../en-US/chrome/browser/quitDialog.properties | 13 + .../locales/en-US/chrome/browser/safeMode.dtd | 27 + .../locales/en-US/chrome/browser/sanitize.dtd | 64 + .../locales/en-US/chrome/browser/search.properties | 18 + .../locales/en-US/chrome/browser/searchbar.dtd | 6 + .../en-US/chrome/browser/setDesktopBackground.dtd | 15 + .../en-US/chrome/browser/shellservice.properties | 13 + .../en-US/chrome/browser/statusbar/meta.properties | 9 + .../chrome/browser/statusbar/overlay.properties | 17 + .../chrome/browser/statusbar/prefs.properties | 4 + .../chrome/browser/statusbar/statusbar-overlay.dtd | 10 + .../chrome/browser/statusbar/statusbar-prefs.dtd | 99 + .../locales/en-US/chrome/browser/syncBrand.dtd | 6 + .../chrome/browser/syncGenericChange.properties | 37 + .../locales/en-US/chrome/browser/syncKey.dtd | 18 + .../locales/en-US/chrome/browser/syncProgress.dtd | 15 + .../locales/en-US/chrome/browser/syncQuota.dtd | 8 + .../en-US/chrome/browser/syncQuota.properties | 42 + .../locales/en-US/chrome/browser/syncSetup.dtd | 116 + .../en-US/chrome/browser/syncSetup.properties | 51 + .../locales/en-US/chrome/browser/tabbrowser.dtd | 6 + .../en-US/chrome/browser/tabbrowser.properties | 30 + .../en-US/chrome/browser/taskbar.properties | 12 + .../en-US/chrome/overrides/appstrings.properties | 37 + .../locales/en-US/chrome/overrides/netError.dtd | 254 + .../en-US/chrome/overrides/settingsChange.dtd | 7 + .../en-US/crashreporter/crashreporter-override.ini | 9 + webbrowser/locales/en-US/defines.inc | 12 + .../locales/en-US/installer/custom.properties | 85 + webbrowser/locales/en-US/installer/mui.properties | 61 + .../locales/en-US/installer/override.properties | 86 + webbrowser/locales/en-US/profile/bookmarks.inc | 40 + .../en-US/profile/chrome/userChrome-example.css | 50 + .../en-US/profile/chrome/userContent-example.css | 32 + .../locales/en-US/searchplugins/amazondotcom.xml | 15 + webbrowser/locales/en-US/searchplugins/answers.xml | 16 + webbrowser/locales/en-US/searchplugins/bing.xml | 18 + .../en-US/searchplugins/creativecommons.xml | 14 + .../en-US/searchplugins/duckduckgo-html.xml | 10 + .../locales/en-US/searchplugins/duckduckgo.xml | 16 + webbrowser/locales/en-US/searchplugins/eBay.xml | 19 + webbrowser/locales/en-US/searchplugins/list.txt | 5 + .../locales/en-US/searchplugins/wikipedia.xml | 18 + webbrowser/locales/en-US/searchplugins/yahoo.xml | 17 + webbrowser/locales/en-US/updater/updater.ini | 10 + webbrowser/locales/en-US/webbrowser-l10n.js | 3 + webbrowser/locales/filter.py | 37 + webbrowser/locales/generic/extract-bookmarks.py | 62 + .../locales/generic/profile/bookmarks.html.in | 19 + webbrowser/locales/generic/profile/localstore.rdf | 9 + webbrowser/locales/generic/profile/mimeTypes.rdf | 17 + webbrowser/locales/jar.mn | 97 + webbrowser/locales/l10n.ini | 18 + webbrowser/locales/moz.build | 7 + webbrowser/locales/shipped-locales | 90 + webbrowser/modules/AboutHomeUtils.jsm | 67 + webbrowser/modules/AutoCompletePopup.jsm | 293 + webbrowser/modules/BrowserNewTabPreloader.jsm | 436 ++ webbrowser/modules/CharsetMenu.jsm | 160 + webbrowser/modules/FormSubmitObserver.jsm | 235 + webbrowser/modules/FormValidationHandler.jsm | 157 + webbrowser/modules/NetworkPrioritizer.jsm | 179 + webbrowser/modules/PageMenu.jsm | 238 + webbrowser/modules/PopupNotifications.jsm | 994 +++ webbrowser/modules/QuotaManager.jsm | 51 + webbrowser/modules/RecentWindow.jsm | 68 + webbrowser/modules/SharedFrame.jsm | 221 + webbrowser/modules/Windows8WindowFrameColor.jsm | 53 + webbrowser/modules/WindowsJumpLists.jsm | 581 ++ webbrowser/modules/WindowsPreviewPerTab.jsm | 861 +++ webbrowser/modules/moz.build | 42 + webbrowser/modules/offlineAppCache.jsm | 20 + webbrowser/modules/openLocationLastURL.jsm | 85 + webbrowser/modules/webrtcUI.jsm | 292 + webbrowser/moz.build | 23 + webbrowser/moz.configure | 7 + webbrowser/themes/LICENSE | 2 + webbrowser/themes/linux/Geolocation-16.png | Bin 0 -> 606 bytes webbrowser/themes/linux/Geolocation-64.png | Bin 0 -> 8056 bytes webbrowser/themes/linux/Go-arrow.png | Bin 0 -> 573 bytes webbrowser/themes/linux/Info.png | Bin 0 -> 767 bytes webbrowser/themes/linux/KUI-close.png | Bin 0 -> 393 bytes webbrowser/themes/linux/Makefile.in | 8 + webbrowser/themes/linux/Privacy-16.png | Bin 0 -> 822 bytes webbrowser/themes/linux/Privacy-32.png | Bin 0 -> 2085 bytes webbrowser/themes/linux/Privacy-48.png | Bin 0 -> 3422 bytes webbrowser/themes/linux/Privacy-64.png | Bin 0 -> 4828 bytes webbrowser/themes/linux/Secure.png | Bin 0 -> 865 bytes webbrowser/themes/linux/Security-broken.png | Bin 0 -> 928 bytes webbrowser/themes/linux/Toolbar-small.png | Bin 0 -> 5429 bytes webbrowser/themes/linux/Toolbar.png | Bin 0 -> 8925 bytes webbrowser/themes/linux/aboutCertError.css | 73 + .../linux/aboutCertError_sectionCollapsed-rtl.png | Bin 0 -> 791 bytes .../linux/aboutCertError_sectionCollapsed.png | Bin 0 -> 776 bytes .../linux/aboutCertError_sectionExpanded.png | Bin 0 -> 767 bytes webbrowser/themes/linux/aboutPrivateBrowsing.css | 47 + .../linux/aboutSessionRestore-window-icon.png | Bin 0 -> 405 bytes webbrowser/themes/linux/aboutSessionRestore.css | 90 + webbrowser/themes/linux/aboutSyncTabs.css | 101 + webbrowser/themes/linux/actionicon-tab.png | Bin 0 -> 236 bytes webbrowser/themes/linux/autocomplete.css | 210 + webbrowser/themes/linux/browser.css | 2210 ++++++ .../themes/linux/click-to-play-warning-stripes.png | Bin 0 -> 1563 bytes .../themes/linux/communicator/communicator.css | 6 + webbrowser/themes/linux/communicator/jar.mn | 7 + webbrowser/themes/linux/communicator/moz.build | 7 + .../linux/downloads/allDownloadsViewOverlay.css | 125 + webbrowser/themes/linux/downloads/buttons.png | Bin 0 -> 5091 bytes .../linux/downloads/contentAreaDownloadsView.css | 11 + .../themes/linux/downloads/download-glow-small.png | Bin 0 -> 556 bytes .../themes/linux/downloads/download-glow.png | Bin 0 -> 723 bytes .../downloads/download-notification-finish.png | Bin 0 -> 3626 bytes .../downloads/download-notification-start.png | Bin 0 -> 3166 bytes .../themes/linux/downloads/download-summary.png | Bin 0 -> 691 bytes webbrowser/themes/linux/downloads/downloads.css | 376 + webbrowser/themes/linux/engineManager.css | 16 + webbrowser/themes/linux/feeds/feedIcon.png | Bin 0 -> 1794 bytes webbrowser/themes/linux/feeds/feedIcon16.png | Bin 0 -> 799 bytes webbrowser/themes/linux/feeds/subscribe-ui.css | 29 + webbrowser/themes/linux/feeds/subscribe.css | 163 + webbrowser/themes/linux/icon.png | Bin 0 -> 2185 bytes webbrowser/themes/linux/identity-icons-generic.png | Bin 0 -> 965 bytes .../themes/linux/identity-icons-https-ev.png | Bin 0 -> 708 bytes .../linux/identity-icons-https-mixed-active.png | Bin 0 -> 984 bytes webbrowser/themes/linux/identity-icons-https.png | Bin 0 -> 672 bytes webbrowser/themes/linux/identity.png | Bin 0 -> 9690 bytes webbrowser/themes/linux/imagedocument.png | Bin 0 -> 2185 bytes webbrowser/themes/linux/jar.mn | 142 + .../themes/linux/mixed-content-blocked-16.png | Bin 0 -> 346 bytes .../themes/linux/mixed-content-blocked-64.png | Bin 0 -> 2063 bytes webbrowser/themes/linux/monitor.png | Bin 0 -> 6217 bytes webbrowser/themes/linux/monitor_16-10.png | Bin 0 -> 6787 bytes webbrowser/themes/linux/moz.build | 9 + webbrowser/themes/linux/newtab/newTab.css | 27 + webbrowser/themes/linux/page-livemarks.png | Bin 0 -> 799 bytes webbrowser/themes/linux/pageInfo.css | 276 + webbrowser/themes/linux/pageInfo.png | Bin 0 -> 8849 bytes .../themes/linux/permissions/aboutPermissions.css | 149 + webbrowser/themes/linux/places/bookmarksMenu.png | Bin 0 -> 461 bytes .../themes/linux/places/bookmarksToolbar.png | Bin 0 -> 508 bytes webbrowser/themes/linux/places/calendar.png | Bin 0 -> 670 bytes webbrowser/themes/linux/places/downloads.png | Bin 0 -> 599 bytes .../themes/linux/places/editBookmarkOverlay.css | 71 + webbrowser/themes/linux/places/livemark-item.png | Bin 0 -> 863 bytes webbrowser/themes/linux/places/organizer.css | 107 + webbrowser/themes/linux/places/organizer.xml | 21 + webbrowser/themes/linux/places/pageStarred.png | Bin 0 -> 767 bytes webbrowser/themes/linux/places/places.css | 221 + webbrowser/themes/linux/places/query.png | Bin 0 -> 678 bytes webbrowser/themes/linux/places/star-icons.png | Bin 0 -> 1106 bytes webbrowser/themes/linux/places/starPage.png | Bin 0 -> 723 bytes webbrowser/themes/linux/places/starred48.png | Bin 0 -> 2658 bytes webbrowser/themes/linux/places/tag.png | Bin 0 -> 877 bytes .../themes/linux/places/toolbarDropMarker.png | Bin 0 -> 583 bytes .../themes/linux/places/unsortedBookmarks.png | Bin 0 -> 748 bytes webbrowser/themes/linux/places/unstarred48.png | Bin 0 -> 2255 bytes webbrowser/themes/linux/pointerLock-16.png | Bin 0 -> 249 bytes webbrowser/themes/linux/pointerLock-64.png | Bin 0 -> 1119 bytes .../themes/linux/preferences/Options-sync.png | Bin 0 -> 3585 bytes webbrowser/themes/linux/preferences/Options.png | Bin 0 -> 12680 bytes webbrowser/themes/linux/preferences/alwaysAsk.png | Bin 0 -> 575 bytes .../themes/linux/preferences/applications.css | 66 + webbrowser/themes/linux/preferences/mail.png | Bin 0 -> 548 bytes .../themes/linux/preferences/preferences.css | 156 + webbrowser/themes/linux/privatebrowsing-mask.png | Bin 0 -> 1355 bytes webbrowser/themes/linux/sanitizeDialog.css | 107 + webbrowser/themes/linux/searchbar.css | 72 + webbrowser/themes/linux/setDesktopBackground.css | 18 + webbrowser/themes/linux/slowStartup-16.png | Bin 0 -> 478 bytes webbrowser/themes/linux/statusbar/overlay.css | 114 + webbrowser/themes/linux/statusbar/prefs.css | 8 + webbrowser/themes/linux/sync-128.png | Bin 0 -> 20229 bytes webbrowser/themes/linux/sync-16-throbber.png | Bin 0 -> 10365 bytes webbrowser/themes/linux/sync-16.png | Bin 0 -> 1847 bytes webbrowser/themes/linux/sync-24-throbber.png | Bin 0 -> 15774 bytes webbrowser/themes/linux/sync-32.png | Bin 0 -> 3384 bytes webbrowser/themes/linux/sync-bg.png | Bin 0 -> 21309 bytes webbrowser/themes/linux/sync-desktopIcon.png | Bin 0 -> 291 bytes webbrowser/themes/linux/sync-mobileIcon.png | Bin 0 -> 352 bytes webbrowser/themes/linux/syncCommon.css | 49 + webbrowser/themes/linux/syncProgress.css | 46 + webbrowser/themes/linux/syncQuota.css | 26 + webbrowser/themes/linux/syncSetup.css | 127 + webbrowser/themes/linux/tabbrowser/alltabs.png | Bin 0 -> 192 bytes webbrowser/themes/linux/tabbrowser/connecting.png | Bin 0 -> 8540 bytes webbrowser/themes/linux/tabbrowser/loading.png | Bin 0 -> 12184 bytes .../linux/tabbrowser/tab-overflow-border.png | Bin 0 -> 193 bytes webbrowser/themes/linux/tabbrowser/tab.png | Bin 0 -> 353 bytes .../themes/linux/tabbrowser/tabDragIndicator.png | Bin 0 -> 450 bytes webbrowser/themes/linux/urlbar-arrow.png | Bin 0 -> 305 bytes webbrowser/themes/linux/web-notifications-icon.svg | 15 + webbrowser/themes/linux/web-notifications-tray.svg | 23 + webbrowser/themes/linux/webRTC-shareDevice-16.png | Bin 0 -> 224 bytes webbrowser/themes/linux/webRTC-shareDevice-64.png | Bin 0 -> 1097 bytes .../themes/linux/webRTC-sharingDevice-16.png | Bin 0 -> 404 bytes webbrowser/themes/moz.build | 14 + webbrowser/themes/osx/Geolocation-16.png | Bin 0 -> 704 bytes webbrowser/themes/osx/Geolocation-64.png | Bin 0 -> 8424 bytes webbrowser/themes/osx/Info.png | Bin 0 -> 641 bytes webbrowser/themes/osx/KUI-background.png | Bin 0 -> 222 bytes webbrowser/themes/osx/KUI-close.png | Bin 0 -> 393 bytes webbrowser/themes/osx/Makefile.in | 7 + webbrowser/themes/osx/Privacy-16.png | Bin 0 -> 800 bytes webbrowser/themes/osx/Privacy-32.png | Bin 0 -> 1995 bytes webbrowser/themes/osx/Privacy-48.png | Bin 0 -> 3884 bytes webbrowser/themes/osx/Privacy-64.png | Bin 0 -> 8140 bytes webbrowser/themes/osx/Search-glass.png | Bin 0 -> 1448 bytes webbrowser/themes/osx/Secure24.png | Bin 0 -> 1098 bytes webbrowser/themes/osx/Toolbar-glass.png | Bin 0 -> 18355 bytes webbrowser/themes/osx/Toolbar-inverted.png | Bin 0 -> 4653 bytes webbrowser/themes/osx/Toolbar.png | Bin 0 -> 15505 bytes webbrowser/themes/osx/aboutCertError.css | 73 + .../osx/aboutCertError_sectionCollapsed-rtl.png | Bin 0 -> 791 bytes .../themes/osx/aboutCertError_sectionCollapsed.png | Bin 0 -> 776 bytes .../themes/osx/aboutCertError_sectionExpanded.png | Bin 0 -> 767 bytes webbrowser/themes/osx/aboutPrivateBrowsing.css | 47 + webbrowser/themes/osx/aboutSessionRestore.css | 73 + webbrowser/themes/osx/aboutSyncTabs.css | 101 + webbrowser/themes/osx/actionicon-tab.png | Bin 0 -> 425 bytes webbrowser/themes/osx/appmenu-dropmarker.png | Bin 0 -> 262 bytes webbrowser/themes/osx/appmenu-icons.png | Bin 0 -> 2115 bytes webbrowser/themes/osx/autocomplete.css | 198 + webbrowser/themes/osx/browser.css | 2802 ++++++++ .../themes/osx/click-to-play-warning-stripes.png | Bin 0 -> 1563 bytes .../themes/osx/communicator/communicator.css | 6 + webbrowser/themes/osx/communicator/jar.mn | 7 + webbrowser/themes/osx/communicator/moz.build | 7 + .../osx/downloads/allDownloadsViewOverlay.css | 146 + webbrowser/themes/osx/downloads/buttons.png | Bin 0 -> 6881 bytes .../osx/downloads/contentAreaDownloadsView.css | 22 + webbrowser/themes/osx/downloads/download-glow.png | Bin 0 -> 546 bytes .../osx/downloads/download-notification-finish.png | Bin 0 -> 3755 bytes .../osx/downloads/download-notification-start.png | Bin 0 -> 3166 bytes .../themes/osx/downloads/download-summary.png | Bin 0 -> 741 bytes webbrowser/themes/osx/downloads/downloads.css | 394 ++ webbrowser/themes/osx/engineManager.css | 16 + webbrowser/themes/osx/feeds/feed-icons-16.png | Bin 0 -> 2187 bytes webbrowser/themes/osx/feeds/feedIcon.png | Bin 0 -> 1833 bytes webbrowser/themes/osx/feeds/feedIcon16.png | Bin 0 -> 791 bytes webbrowser/themes/osx/feeds/subscribe-ui.css | 29 + webbrowser/themes/osx/feeds/subscribe.css | 159 + webbrowser/themes/osx/icon.png | Bin 0 -> 2185 bytes webbrowser/themes/osx/identity-icons-generic.png | Bin 0 -> 965 bytes webbrowser/themes/osx/identity-icons-https-ev.png | Bin 0 -> 708 bytes .../osx/identity-icons-https-mixed-active.png | Bin 0 -> 984 bytes webbrowser/themes/osx/identity-icons-https.png | Bin 0 -> 672 bytes webbrowser/themes/osx/identity.png | Bin 0 -> 10508 bytes webbrowser/themes/osx/imagedocument.png | Bin 0 -> 2185 bytes webbrowser/themes/osx/jar.mn | 181 + webbrowser/themes/osx/keyhole-forward-mask.svg | 15 + webbrowser/themes/osx/livemark-folder.png | Bin 0 -> 680 bytes webbrowser/themes/osx/menu-back.png | Bin 0 -> 341 bytes webbrowser/themes/osx/menu-forward.png | Bin 0 -> 343 bytes webbrowser/themes/osx/mixed-content-blocked-16.png | Bin 0 -> 346 bytes webbrowser/themes/osx/mixed-content-blocked-64.png | Bin 0 -> 2063 bytes webbrowser/themes/osx/monitor.png | Bin 0 -> 6217 bytes webbrowser/themes/osx/monitor_16-10.png | Bin 0 -> 6787 bytes webbrowser/themes/osx/moz.build | 9 + webbrowser/themes/osx/newtab/newTab.css | 29 + webbrowser/themes/osx/page-livemarks.png | Bin 0 -> 683 bytes webbrowser/themes/osx/page-livemarks@2x.png | Bin 0 -> 1167 bytes webbrowser/themes/osx/pageInfo.css | 258 + webbrowser/themes/osx/pageInfo.png | Bin 0 -> 8118 bytes webbrowser/themes/osx/panel-expander-closed.png | Bin 0 -> 155 bytes webbrowser/themes/osx/panel-expander-closed@2x.png | Bin 0 -> 362 bytes webbrowser/themes/osx/panel-expander-open.png | Bin 0 -> 155 bytes webbrowser/themes/osx/panel-expander-open@2x.png | Bin 0 -> 356 bytes webbrowser/themes/osx/panel-plus-sign.png | Bin 0 -> 212 bytes .../themes/osx/permissions/aboutPermissions.css | 153 + webbrowser/themes/osx/places/allBookmarks.png | Bin 0 -> 673 bytes webbrowser/themes/osx/places/bookmark.png | Bin 0 -> 1779 bytes webbrowser/themes/osx/places/bookmarksMenu.png | Bin 0 -> 353 bytes webbrowser/themes/osx/places/bookmarksToolbar.png | Bin 0 -> 524 bytes .../themes/osx/places/bookmarksToolbar@2x.png | Bin 0 -> 1179 bytes webbrowser/themes/osx/places/calendar.png | Bin 0 -> 614 bytes webbrowser/themes/osx/places/downloads.png | Bin 0 -> 678 bytes webbrowser/themes/osx/places/editBookmark.png | Bin 0 -> 1642 bytes .../themes/osx/places/editBookmarkOverlay.css | 105 + .../themes/osx/places/expander-closed-active.png | Bin 0 -> 1329 bytes webbrowser/themes/osx/places/expander-closed.png | Bin 0 -> 837 bytes .../themes/osx/places/expander-open-active.png | Bin 0 -> 1329 bytes webbrowser/themes/osx/places/expander-open.png | Bin 0 -> 818 bytes webbrowser/themes/osx/places/folderDropArrow.png | Bin 0 -> 201 bytes .../themes/osx/places/folderDropArrow@2x.png | Bin 0 -> 443 bytes webbrowser/themes/osx/places/history.png | Bin 0 -> 843 bytes webbrowser/themes/osx/places/history@2x.png | Bin 0 -> 1872 bytes webbrowser/themes/osx/places/libraryToolbar.png | Bin 0 -> 2217 bytes webbrowser/themes/osx/places/livemark-item.png | Bin 0 -> 863 bytes webbrowser/themes/osx/places/organizer.css | 134 + webbrowser/themes/osx/places/places.css | 146 + webbrowser/themes/osx/places/query.png | Bin 0 -> 549 bytes webbrowser/themes/osx/places/query@2x.png | Bin 0 -> 1055 bytes webbrowser/themes/osx/places/starred48.png | Bin 0 -> 1785 bytes webbrowser/themes/osx/places/tag.png | Bin 0 -> 789 bytes webbrowser/themes/osx/places/tag@2x.png | Bin 0 -> 1593 bytes webbrowser/themes/osx/places/toolbarDropMarker.png | Bin 0 -> 302 bytes webbrowser/themes/osx/places/unfiledBookmarks.png | Bin 0 -> 586 bytes .../themes/osx/places/unfiledBookmarks@2x.png | Bin 0 -> 1289 bytes webbrowser/themes/osx/places/unsortedBookmarks.png | Bin 0 -> 780 bytes webbrowser/themes/osx/places/unstarred48.png | Bin 0 -> 818 bytes webbrowser/themes/osx/pointerLock-16.png | Bin 0 -> 249 bytes webbrowser/themes/osx/pointerLock-64.png | Bin 0 -> 1119 bytes webbrowser/themes/osx/preferences/Options-sync.png | Bin 0 -> 3585 bytes webbrowser/themes/osx/preferences/Options.png | Bin 0 -> 9077 bytes webbrowser/themes/osx/preferences/alwaysAsk.png | Bin 0 -> 446 bytes webbrowser/themes/osx/preferences/application.png | Bin 0 -> 441 bytes webbrowser/themes/osx/preferences/applications.css | 64 + webbrowser/themes/osx/preferences/mail.png | Bin 0 -> 630 bytes webbrowser/themes/osx/preferences/preferences.css | 142 + webbrowser/themes/osx/preferences/saveFile.png | Bin 0 -> 791 bytes webbrowser/themes/osx/privatebrowsing-dark.png | Bin 0 -> 1355 bytes webbrowser/themes/osx/privatebrowsing-light.png | Bin 0 -> 696 bytes webbrowser/themes/osx/privatebrowsing-mask.png | Bin 0 -> 1074 bytes webbrowser/themes/osx/privatebrowsing-mask@2x.png | Bin 0 -> 2639 bytes webbrowser/themes/osx/reload-stop-go.png | Bin 0 -> 1945 bytes webbrowser/themes/osx/sanitizeDialog.css | 93 + webbrowser/themes/osx/searchbar-dropdown-arrow.png | Bin 0 -> 509 bytes webbrowser/themes/osx/searchbar.css | 79 + webbrowser/themes/osx/setDesktopBackground.css | 18 + webbrowser/themes/osx/shared.inc | 6 + webbrowser/themes/osx/slowStartup-16.png | Bin 0 -> 512 bytes webbrowser/themes/osx/statusbar/overlay.css | 108 + webbrowser/themes/osx/statusbar/prefs.css | 13 + webbrowser/themes/osx/sync-128.png | Bin 0 -> 20229 bytes webbrowser/themes/osx/sync-16.png | Bin 0 -> 1847 bytes webbrowser/themes/osx/sync-32.png | Bin 0 -> 3384 bytes webbrowser/themes/osx/sync-bg.png | Bin 0 -> 21309 bytes webbrowser/themes/osx/sync-desktopIcon.png | Bin 0 -> 291 bytes webbrowser/themes/osx/sync-mobileIcon.png | Bin 0 -> 352 bytes webbrowser/themes/osx/sync-throbber.png | Bin 0 -> 10362 bytes webbrowser/themes/osx/syncCommon.css | 49 + webbrowser/themes/osx/syncProgress.css | 46 + webbrowser/themes/osx/syncQuota.css | 26 + webbrowser/themes/osx/syncSetup.css | 132 + .../themes/osx/tabbrowser/alltabs-inverted.png | Bin 0 -> 469 bytes webbrowser/themes/osx/tabbrowser/alltabs.png | Bin 0 -> 584 bytes webbrowser/themes/osx/tabbrowser/connecting.png | Bin 0 -> 8540 bytes webbrowser/themes/osx/tabbrowser/loading.png | Bin 0 -> 10727 bytes webbrowser/themes/osx/tabbrowser/newtab-glass.png | Bin 0 -> 398 bytes .../themes/osx/tabbrowser/newtab-inverted.png | Bin 0 -> 247 bytes webbrowser/themes/osx/tabbrowser/newtab.png | Bin 0 -> 237 bytes .../themes/osx/tabbrowser/tab-arrow-left-glass.png | Bin 0 -> 331 bytes .../osx/tabbrowser/tab-arrow-left-inverted.png | Bin 0 -> 250 bytes .../themes/osx/tabbrowser/tab-arrow-left.png | Bin 0 -> 368 bytes .../themes/osx/tabbrowser/tab-overflow-border.png | Bin 0 -> 193 bytes .../themes/osx/tabbrowser/tabDragIndicator.png | Bin 0 -> 3117 bytes .../osx/toolbarbutton-dropdown-arrow-inverted.png | Bin 0 -> 221 bytes .../themes/osx/toolbarbutton-dropdown-arrow.png | Bin 0 -> 287 bytes webbrowser/themes/osx/urlbar-arrow.png | Bin 0 -> 305 bytes .../themes/osx/urlbar-history-dropmarker.png | Bin 0 -> 480 bytes webbrowser/themes/osx/urlbar-popup-blocked.png | Bin 0 -> 745 bytes webbrowser/themes/osx/web-notifications-icon.svg | 15 + webbrowser/themes/osx/web-notifications-tray.svg | 23 + webbrowser/themes/osx/webRTC-shareDevice-16.png | Bin 0 -> 233 bytes webbrowser/themes/osx/webRTC-shareDevice-64.png | Bin 0 -> 1097 bytes webbrowser/themes/osx/webRTC-sharingDevice-16.png | Bin 0 -> 404 bytes webbrowser/themes/shared/browser.inc | 8 + webbrowser/themes/shared/newtab/controls.png | Bin 0 -> 4180 bytes webbrowser/themes/shared/newtab/newTab.css.inc | 203 + webbrowser/themes/shared/newtab/noise.png | Bin 0 -> 2118 bytes webbrowser/themes/shared/newtab/pinned.png | Bin 0 -> 307 bytes webbrowser/themes/shared/plugin-doorhanger.inc.css | 53 + .../shared/plugins/notification-pluginAlert.png | Bin 0 -> 648 bytes .../shared/plugins/notification-pluginAlert@2x.png | Bin 0 -> 1189 bytes .../shared/plugins/notification-pluginBlocked.png | Bin 0 -> 968 bytes .../plugins/notification-pluginBlocked@2x.png | Bin 0 -> 2067 bytes .../shared/plugins/notification-pluginNormal.png | Bin 0 -> 340 bytes .../plugins/notification-pluginNormal@2x.png | Bin 0 -> 469 bytes webbrowser/themes/shared/statusbar/dynamic.css | 25 + webbrowser/themes/shared/statusbar/overlay.css | 169 + webbrowser/themes/shared/statusbar/pms16.png | Bin 0 -> 604 bytes webbrowser/themes/shared/statusbar/pms24.png | Bin 0 -> 774 bytes webbrowser/themes/shared/statusbar/prefs.css | 38 + webbrowser/themes/shared/statusbar/pulse.png | Bin 0 -> 2775 bytes .../themes/shared/statusbar/throbber-idle.png | Bin 0 -> 713 bytes .../themes/shared/statusbar/throbberStatic.png | Bin 0 -> 1736 bytes .../themes/shared/tabbrowser/tab-audio-small.svg | 58 + webbrowser/themes/shared/tabbrowser/tab-audio.svg | 18 + webbrowser/themes/windows/Geolocation-16.png | Bin 0 -> 704 bytes webbrowser/themes/windows/Geolocation-64.png | Bin 0 -> 8424 bytes webbrowser/themes/windows/Info.png | Bin 0 -> 615 bytes webbrowser/themes/windows/KUI-background.png | Bin 0 -> 222 bytes webbrowser/themes/windows/KUI-close.png | Bin 0 -> 393 bytes webbrowser/themes/windows/Makefile.in | 7 + webbrowser/themes/windows/Privacy-16.png | Bin 0 -> 798 bytes webbrowser/themes/windows/Privacy-32.png | Bin 0 -> 1997 bytes webbrowser/themes/windows/Privacy-48.png | Bin 0 -> 3912 bytes webbrowser/themes/windows/Privacy-64.png | Bin 0 -> 8172 bytes webbrowser/themes/windows/Push-16.png | Bin 0 -> 704 bytes webbrowser/themes/windows/Push-64.png | Bin 0 -> 8388 bytes webbrowser/themes/windows/Secure24.png | Bin 0 -> 1117 bytes webbrowser/themes/windows/Toolbar-glass.png | Bin 0 -> 18803 bytes webbrowser/themes/windows/Toolbar-glass.svg | 3218 +++++++++ webbrowser/themes/windows/Toolbar-inverted.png | Bin 0 -> 7101 bytes webbrowser/themes/windows/Toolbar-inverted.svg | 302 + webbrowser/themes/windows/Toolbar.png | Bin 0 -> 16015 bytes webbrowser/themes/windows/Toolbar.svg | 1356 ++++ webbrowser/themes/windows/aboutCertError.css | 73 + .../aboutCertError_sectionCollapsed-rtl.png | Bin 0 -> 791 bytes .../windows/aboutCertError_sectionCollapsed.png | Bin 0 -> 776 bytes .../windows/aboutCertError_sectionExpanded.png | Bin 0 -> 767 bytes webbrowser/themes/windows/aboutPrivateBrowsing.css | 47 + .../windows/aboutSessionRestore-window-icon.png | Bin 0 -> 352 bytes webbrowser/themes/windows/aboutSessionRestore.css | 73 + webbrowser/themes/windows/aboutSyncTabs.css | 101 + webbrowser/themes/windows/actionicon-tab.png | Bin 0 -> 425 bytes webbrowser/themes/windows/appmenu-dropmarker.png | Bin 0 -> 262 bytes webbrowser/themes/windows/appmenu-icons.png | Bin 0 -> 2115 bytes webbrowser/themes/windows/autocomplete.css | 238 + webbrowser/themes/windows/browser.css | 3856 ++++++++++ webbrowser/themes/windows/caption-buttons.svg | 121 + .../windows/click-to-play-warning-stripes.png | Bin 0 -> 1563 bytes .../themes/windows/communicator/communicator.css | 6 + webbrowser/themes/windows/communicator/jar.mn | 7 + webbrowser/themes/windows/communicator/moz.build | 7 + .../windows/downloads/allDownloadsViewOverlay.css | 178 + webbrowser/themes/windows/downloads/buttons.png | Bin 0 -> 6881 bytes .../windows/downloads/contentAreaDownloadsView.css | 22 + .../downloads/download-notification-finish.png | Bin 0 -> 3755 bytes .../downloads/download-notification-start.png | Bin 0 -> 3166 bytes .../themes/windows/downloads/download-summary.png | Bin 0 -> 741 bytes webbrowser/themes/windows/downloads/downloads.css | 487 ++ webbrowser/themes/windows/engineManager.css | 16 + webbrowser/themes/windows/feeds/feed-icons-16.png | Bin 0 -> 2138 bytes webbrowser/themes/windows/feeds/feedIcon.png | Bin 0 -> 1885 bytes webbrowser/themes/windows/feeds/feedIcon16.png | Bin 0 -> 787 bytes webbrowser/themes/windows/feeds/subscribe-ui.css | 29 + webbrowser/themes/windows/feeds/subscribe.css | 163 + webbrowser/themes/windows/icon.png | Bin 0 -> 2185 bytes .../themes/windows/identity-icons-generic.png | Bin 0 -> 965 bytes .../themes/windows/identity-icons-https-ev.png | Bin 0 -> 708 bytes .../windows/identity-icons-https-mixed-active.png | Bin 0 -> 984 bytes webbrowser/themes/windows/identity-icons-https.png | Bin 0 -> 672 bytes webbrowser/themes/windows/identity.png | Bin 0 -> 11844 bytes webbrowser/themes/windows/imagedocument.png | Bin 0 -> 2185 bytes webbrowser/themes/windows/jar.mn | 168 + webbrowser/themes/windows/keyhole-forward-mask.svg | 15 + webbrowser/themes/windows/livemark-folder.png | Bin 0 -> 626 bytes webbrowser/themes/windows/menu-back.png | Bin 0 -> 435 bytes webbrowser/themes/windows/menu-forward.png | Bin 0 -> 434 bytes .../themes/windows/mixed-content-blocked-16.png | Bin 0 -> 346 bytes .../themes/windows/mixed-content-blocked-64.png | Bin 0 -> 2063 bytes webbrowser/themes/windows/monitor.png | Bin 0 -> 6217 bytes webbrowser/themes/windows/monitor_16-10.png | Bin 0 -> 6787 bytes webbrowser/themes/windows/moz.build | 9 + webbrowser/themes/windows/newtab/newTab.css | 29 + webbrowser/themes/windows/pageInfo.css | 268 + webbrowser/themes/windows/pageInfo.png | Bin 0 -> 8432 bytes .../windows/permissions/aboutPermissions.css | 153 + webbrowser/themes/windows/places/allBookmarks.png | Bin 0 -> 612 bytes webbrowser/themes/windows/places/bookmark.png | Bin 0 -> 1779 bytes webbrowser/themes/windows/places/bookmarksMenu.png | Bin 0 -> 346 bytes .../themes/windows/places/bookmarksToolbar.png | Bin 0 -> 380 bytes webbrowser/themes/windows/places/calendar.png | Bin 0 -> 637 bytes webbrowser/themes/windows/places/downloads.png | Bin 0 -> 674 bytes webbrowser/themes/windows/places/editBookmark.png | Bin 0 -> 1642 bytes .../themes/windows/places/editBookmarkOverlay.css | 80 + webbrowser/themes/windows/places/history.png | Bin 0 -> 871 bytes .../themes/windows/places/libraryToolbar.png | Bin 0 -> 1331 bytes webbrowser/themes/windows/places/livemark-item.png | Bin 0 -> 863 bytes webbrowser/themes/windows/places/organizer.css | 253 + webbrowser/themes/windows/places/places.css | 172 + webbrowser/themes/windows/places/query.png | Bin 0 -> 602 bytes webbrowser/themes/windows/places/starred48.png | Bin 0 -> 1911 bytes webbrowser/themes/windows/places/tag.png | Bin 0 -> 676 bytes .../themes/windows/places/toolbarDropMarker.png | Bin 0 -> 223 bytes .../themes/windows/places/unsortedBookmarks.png | Bin 0 -> 762 bytes webbrowser/themes/windows/places/unstarred48.png | Bin 0 -> 818 bytes webbrowser/themes/windows/pointerLock-16.png | Bin 0 -> 249 bytes webbrowser/themes/windows/pointerLock-64.png | Bin 0 -> 1119 bytes .../themes/windows/preferences/Options-sync.png | Bin 0 -> 3585 bytes webbrowser/themes/windows/preferences/Options.png | Bin 0 -> 8899 bytes .../themes/windows/preferences/alwaysAsk.png | Bin 0 -> 439 bytes .../themes/windows/preferences/application.png | Bin 0 -> 419 bytes .../themes/windows/preferences/applications.css | 64 + webbrowser/themes/windows/preferences/mail.png | Bin 0 -> 549 bytes .../themes/windows/preferences/preferences.css | 146 + webbrowser/themes/windows/preferences/saveFile.png | Bin 0 -> 767 bytes webbrowser/themes/windows/privatebrowsing-dark.png | Bin 0 -> 1355 bytes .../themes/windows/privatebrowsing-light.png | Bin 0 -> 696 bytes webbrowser/themes/windows/reload-stop-go.png | Bin 0 -> 1945 bytes webbrowser/themes/windows/sanitize.png | Bin 0 -> 779 bytes webbrowser/themes/windows/sanitizeDialog.css | 93 + .../themes/windows/searchbar-dropdown-arrow.png | Bin 0 -> 517 bytes webbrowser/themes/windows/searchbar.css | 81 + webbrowser/themes/windows/setDesktopBackground.css | 18 + webbrowser/themes/windows/slowStartup-16.png | Bin 0 -> 512 bytes webbrowser/themes/windows/statusbar/overlay.css | 104 + webbrowser/themes/windows/statusbar/prefs.css | 7 + webbrowser/themes/windows/sync-128.png | Bin 0 -> 20229 bytes webbrowser/themes/windows/sync-16.png | Bin 0 -> 1847 bytes webbrowser/themes/windows/sync-32.png | Bin 0 -> 3384 bytes webbrowser/themes/windows/sync-bg.png | Bin 0 -> 21309 bytes webbrowser/themes/windows/sync-desktopIcon.png | Bin 0 -> 291 bytes webbrowser/themes/windows/sync-mobileIcon.png | Bin 0 -> 352 bytes webbrowser/themes/windows/sync-throbber.png | Bin 0 -> 10362 bytes webbrowser/themes/windows/syncCommon.css | 49 + webbrowser/themes/windows/syncProgress.css | 46 + webbrowser/themes/windows/syncQuota.css | 26 + webbrowser/themes/windows/syncSetup.css | 132 + .../themes/windows/tabbrowser/alltabs-inverted.png | Bin 0 -> 469 bytes webbrowser/themes/windows/tabbrowser/alltabs.png | Bin 0 -> 584 bytes .../themes/windows/tabbrowser/connecting.png | Bin 0 -> 8540 bytes webbrowser/themes/windows/tabbrowser/loading.png | Bin 0 -> 10727 bytes .../themes/windows/tabbrowser/newtab-glass.png | Bin 0 -> 398 bytes .../themes/windows/tabbrowser/newtab-inverted.png | Bin 0 -> 247 bytes webbrowser/themes/windows/tabbrowser/newtab.png | Bin 0 -> 237 bytes .../windows/tabbrowser/tab-arrow-left-glass.png | Bin 0 -> 331 bytes .../windows/tabbrowser/tab-arrow-left-inverted.png | Bin 0 -> 250 bytes .../themes/windows/tabbrowser/tab-arrow-left.png | Bin 0 -> 368 bytes .../windows/tabbrowser/tab-overflow-border.png | Bin 0 -> 193 bytes .../themes/windows/tabbrowser/tabDragIndicator.png | Bin 0 -> 3117 bytes .../toolbarbutton-dropdown-arrow-inverted.png | Bin 0 -> 221 bytes .../windows/toolbarbutton-dropdown-arrow.png | Bin 0 -> 287 bytes webbrowser/themes/windows/urlbar-arrow.png | Bin 0 -> 305 bytes .../themes/windows/urlbar-history-dropmarker.png | Bin 0 -> 480 bytes webbrowser/themes/windows/urlbar-popup-blocked.png | Bin 0 -> 745 bytes .../themes/windows/web-notifications-icon.svg | 15 + .../themes/windows/web-notifications-tray.svg | 23 + .../themes/windows/webRTC-shareDevice-16.png | Bin 0 -> 233 bytes .../themes/windows/webRTC-shareDevice-64.png | Bin 0 -> 1097 bytes .../themes/windows/webRTC-sharingDevice-16.png | Bin 0 -> 404 bytes 2158 files changed, 146940 insertions(+), 146940 deletions(-) delete mode 100644 LICENSE delete mode 100644 Makefile.in delete mode 100644 app-rules.mk delete mode 100644 app.mozbuild delete mode 100644 app/Makefile.in delete mode 100644 app/application.ini delete mode 100644 app/blocklist.xml delete mode 100644 app/macbuild/Contents/CodeResources delete mode 100644 app/macbuild/Contents/Info.plist.in delete mode 100644 app/macbuild/Contents/MacOS-files.in delete mode 100644 app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in delete mode 100644 app/macbuild/Contents/_CodeSignature/CodeResources delete mode 100644 app/macversion.py delete mode 100644 app/module.ver delete mode 100644 app/moz.build delete mode 100644 app/nsBrowserApp.cpp delete mode 100644 app/palemoon.exe.manifest delete mode 100644 app/permissions delete mode 100644 app/profile/channel-prefs.js delete mode 100644 app/profile/extensions/moz.build delete mode 100644 app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/Makefile.in delete mode 100644 app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf.in delete mode 100644 app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/moz.build delete mode 100644 app/profile/pagethemes.rdf delete mode 100644 app/profile/prefs.js delete mode 100644 app/profile/webbrowser.js delete mode 100644 app/splash.rc delete mode 100644 base/content/aboutDialog.css delete mode 100644 base/content/aboutDialog.js delete mode 100644 base/content/aboutDialog.xul delete mode 100644 base/content/autocomplete.css delete mode 100644 base/content/autocomplete.xml delete mode 100644 base/content/autorecovery.js delete mode 100644 base/content/autorecovery.xul delete mode 100644 base/content/baseMenuOverlay.xul delete mode 100644 base/content/browser-addons.js delete mode 100644 base/content/browser-appmenu.inc delete mode 100644 base/content/browser-charsetmenu.inc delete mode 100644 base/content/browser-context.inc delete mode 100644 base/content/browser-devtools-theme.js delete mode 100644 base/content/browser-doctype.inc delete mode 100644 base/content/browser-feeds.js delete mode 100644 base/content/browser-fullScreen.js delete mode 100644 base/content/browser-fullZoom.js delete mode 100644 base/content/browser-gestureSupport.js delete mode 100644 base/content/browser-menubar.inc delete mode 100644 base/content/browser-menudragging.js delete mode 100644 base/content/browser-menudragging.xul delete mode 100644 base/content/browser-places.js delete mode 100644 base/content/browser-plugins.js delete mode 100644 base/content/browser-sets.inc delete mode 100644 base/content/browser-syncui.js delete mode 100644 base/content/browser-tabPreviews.js delete mode 100644 base/content/browser-tabPreviews.xml delete mode 100644 base/content/browser-thumbnails.js delete mode 100644 base/content/browser-title.css delete mode 100644 base/content/browser-uacompat.js delete mode 100644 base/content/browser-webrtcUI.js delete mode 100644 base/content/browser.css delete mode 100644 base/content/browser.js delete mode 100644 base/content/browser.xul delete mode 100644 base/content/browserMountPoints.inc delete mode 100644 base/content/content.js delete mode 100644 base/content/downloadManagerOverlay.xul delete mode 100644 base/content/global-devtools-theme-scripts.inc delete mode 100644 base/content/global-scripts.inc delete mode 100644 base/content/hiddenWindow.xul delete mode 100644 base/content/highlighter.css delete mode 100644 base/content/jsConsoleOverlay.xul delete mode 100644 base/content/macBrowserOverlay.xul delete mode 100644 base/content/nsContextMenu.js delete mode 100644 base/content/openLocation.js delete mode 100644 base/content/openLocation.xul delete mode 100644 base/content/overrides/app-license.html delete mode 100644 base/content/padlock.css delete mode 100644 base/content/padlock.js delete mode 100644 base/content/padlock.xul delete mode 100644 base/content/padlock_classic_broken.png delete mode 100644 base/content/padlock_classic_ev.png delete mode 100644 base/content/padlock_classic_https.png delete mode 100644 base/content/padlock_classic_low.png delete mode 100644 base/content/padlock_mod_broken.png delete mode 100644 base/content/padlock_mod_ev.png delete mode 100644 base/content/padlock_mod_https.png delete mode 100644 base/content/padlock_mod_low.png delete mode 100644 base/content/palemoon.xhtml delete mode 100644 base/content/popup-notifications.inc delete mode 100644 base/content/safeMode.css delete mode 100644 base/content/safeMode.js delete mode 100644 base/content/safeMode.xul delete mode 100644 base/content/sanitize.js delete mode 100644 base/content/sanitize.xul delete mode 100644 base/content/sanitizeDialog.css delete mode 100644 base/content/sanitizeDialog.js delete mode 100644 base/content/softwareUpdateOverlay.xul delete mode 100644 base/content/tabbrowser.css delete mode 100644 base/content/tabbrowser.xml delete mode 100644 base/content/test/general/audio.ogg delete mode 100644 base/content/urlbarBindings.xml delete mode 100644 base/content/utilityOverlay.js delete mode 100644 base/content/viewSourceOverlay.xul delete mode 100644 base/content/web-panels.js delete mode 100644 base/content/web-panels.xul delete mode 100644 base/content/win6BrowserOverlay.xul delete mode 100644 base/jar.mn delete mode 100644 base/moz.build delete mode 100644 branding/shared/background.png delete mode 100644 branding/shared/branding.mozbuild delete mode 100644 branding/shared/locales/browserconfig.properties delete mode 100644 branding/shared/newtab.ico delete mode 100644 branding/shared/newwindow.ico delete mode 100644 branding/shared/pbmode.ico delete mode 100644 branding/shared/pref/preferences.inc delete mode 100644 branding/shared/pref/uaoverrides.inc delete mode 100644 branding/unofficial/VisualElements_150.png delete mode 100644 branding/unofficial/VisualElements_70.png delete mode 100644 branding/unofficial/appname.bmp delete mode 100644 branding/unofficial/branding.nsi delete mode 100644 branding/unofficial/configure.sh delete mode 100644 branding/unofficial/content/about-background.png delete mode 100644 branding/unofficial/content/about-logo.png delete mode 100644 branding/unofficial/content/about-logo@2x.png delete mode 100644 branding/unofficial/content/about.png delete mode 100644 branding/unofficial/content/aboutDialog.css delete mode 100644 branding/unofficial/content/icon48.png delete mode 100644 branding/unofficial/content/icon64.png delete mode 100644 branding/unofficial/content/jar.mn delete mode 100644 branding/unofficial/content/moz.build delete mode 100644 branding/unofficial/default16.png delete mode 100644 branding/unofficial/default32.png delete mode 100644 branding/unofficial/default48.png delete mode 100644 branding/unofficial/disk.icns delete mode 100644 branding/unofficial/document.icns delete mode 100644 branding/unofficial/document.ico delete mode 100644 branding/unofficial/dsstore delete mode 100644 branding/unofficial/firefox.icns delete mode 100644 branding/unofficial/firefox.ico delete mode 100644 branding/unofficial/locales/browserconfig.properties delete mode 100644 branding/unofficial/locales/en-US/brand.dtd delete mode 100644 branding/unofficial/locales/en-US/brand.properties delete mode 100644 branding/unofficial/locales/jar.mn delete mode 100644 branding/unofficial/locales/moz.build delete mode 100644 branding/unofficial/moz.build delete mode 100644 branding/unofficial/mozicon128.png delete mode 100644 branding/unofficial/pref/webbrowser-branding.js delete mode 100644 branding/unofficial/webbrowser.VisualElementsManifest.xml delete mode 100644 branding/unofficial/webbrowser.desktop delete mode 100644 branding/unofficial/wizHeader.bmp delete mode 100644 branding/unofficial/wizHeaderRTL.bmp delete mode 100644 branding/unofficial/wizWatermark.bmp delete mode 100644 branding/unstable/VisualElements_150.png delete mode 100644 branding/unstable/VisualElements_70.png delete mode 100644 branding/unstable/appname.bmp delete mode 100644 branding/unstable/branding.nsi delete mode 100644 branding/unstable/configure.sh delete mode 100644 branding/unstable/content/about-background.jpg delete mode 100644 branding/unstable/content/about-logo.png delete mode 100644 branding/unstable/content/about-logo@2x.png delete mode 100644 branding/unstable/content/about-wordmark.png delete mode 100644 branding/unstable/content/about.png delete mode 100644 branding/unstable/content/aboutDialog.css delete mode 100644 branding/unstable/content/icon48.png delete mode 100644 branding/unstable/content/icon64.png delete mode 100644 branding/unstable/content/jar.mn delete mode 100644 branding/unstable/content/moz.build delete mode 100644 branding/unstable/default16.png delete mode 100644 branding/unstable/default32.png delete mode 100644 branding/unstable/default48.png delete mode 100644 branding/unstable/disk.icns delete mode 100644 branding/unstable/document.icns delete mode 100644 branding/unstable/document.ico delete mode 100644 branding/unstable/dsstore delete mode 100644 branding/unstable/firefox.icns delete mode 100644 branding/unstable/firefox.ico delete mode 100644 branding/unstable/locales/en-US/brand.dtd delete mode 100644 branding/unstable/locales/en-US/brand.properties delete mode 100644 branding/unstable/locales/jar.mn delete mode 100644 branding/unstable/locales/moz.build delete mode 100644 branding/unstable/moz.build delete mode 100644 branding/unstable/mozicon128.png delete mode 100644 branding/unstable/palemoon.VisualElementsManifest.xml delete mode 100644 branding/unstable/pref/palemoon-branding.js delete mode 100644 branding/unstable/wizHeader.bmp delete mode 100644 branding/unstable/wizHeaderRTL.bmp delete mode 100644 branding/unstable/wizWatermark.bmp delete mode 100644 build.mk delete mode 100644 components/BrowserComponents.manifest delete mode 100644 components/abouthome/aboutHome.css delete mode 100644 components/abouthome/aboutHome.js delete mode 100644 components/abouthome/aboutHome.xhtml delete mode 100644 components/abouthome/addons.png delete mode 100644 components/abouthome/addons@2x.png delete mode 100644 components/abouthome/bookmarks.png delete mode 100644 components/abouthome/bookmarks@2x.png delete mode 100644 components/abouthome/downloads.png delete mode 100644 components/abouthome/downloads@2x.png delete mode 100644 components/abouthome/history.png delete mode 100644 components/abouthome/history@2x.png delete mode 100644 components/abouthome/jar.mn delete mode 100644 components/abouthome/moz.build delete mode 100644 components/abouthome/noise.png delete mode 100644 components/abouthome/restore-large.png delete mode 100644 components/abouthome/restore-large@2x.png delete mode 100644 components/abouthome/restore.png delete mode 100644 components/abouthome/restore@2x.png delete mode 100644 components/abouthome/settings.png delete mode 100644 components/abouthome/settings@2x.png delete mode 100644 components/abouthome/snippet1.png delete mode 100644 components/abouthome/snippet1@2x.png delete mode 100644 components/abouthome/snippet2.png delete mode 100644 components/abouthome/snippet2@2x.png delete mode 100644 components/abouthome/sync.png delete mode 100644 components/abouthome/sync@2x.png delete mode 100644 components/build/Makefile.in delete mode 100644 components/build/moz.build delete mode 100644 components/build/nsBrowserCompsCID.h delete mode 100644 components/build/nsModule.cpp delete mode 100644 components/certerror/content/aboutCertError.css delete mode 100644 components/certerror/content/aboutCertError.xhtml delete mode 100644 components/certerror/jar.mn delete mode 100644 components/certerror/moz.build delete mode 100644 components/dirprovider/DirectoryProvider.cpp delete mode 100644 components/dirprovider/DirectoryProvider.h delete mode 100644 components/dirprovider/moz.build delete mode 100644 components/distribution.js delete mode 100644 components/downloads/BrowserDownloads.manifest delete mode 100644 components/downloads/DownloadsCommon.jsm delete mode 100644 components/downloads/DownloadsLogger.jsm delete mode 100644 components/downloads/DownloadsStartup.js delete mode 100644 components/downloads/DownloadsTaskbar.jsm delete mode 100644 components/downloads/DownloadsUI.js delete mode 100644 components/downloads/DownloadsViewUI.jsm delete mode 100644 components/downloads/content/allDownloadsViewOverlay.css delete mode 100644 components/downloads/content/allDownloadsViewOverlay.js delete mode 100644 components/downloads/content/allDownloadsViewOverlay.xul delete mode 100644 components/downloads/content/contentAreaDownloadsView.css delete mode 100644 components/downloads/content/contentAreaDownloadsView.js delete mode 100644 components/downloads/content/contentAreaDownloadsView.xul delete mode 100644 components/downloads/content/download.css delete mode 100644 components/downloads/content/download.xml delete mode 100644 components/downloads/content/downloads.css delete mode 100644 components/downloads/content/downloads.js delete mode 100644 components/downloads/content/downloadsOverlay.xul delete mode 100644 components/downloads/content/indicator.js delete mode 100644 components/downloads/content/indicatorOverlay.xul delete mode 100644 components/downloads/jar.mn delete mode 100644 components/downloads/moz.build delete mode 100644 components/feeds/BrowserFeeds.manifest delete mode 100644 components/feeds/FeedConverter.js delete mode 100644 components/feeds/FeedWriter.js delete mode 100644 components/feeds/WebContentConverter.js delete mode 100644 components/feeds/content/subscribe.css delete mode 100644 components/feeds/content/subscribe.js delete mode 100644 components/feeds/content/subscribe.xhtml delete mode 100644 components/feeds/content/subscribe.xml delete mode 100644 components/feeds/jar.mn delete mode 100644 components/feeds/moz.build delete mode 100644 components/feeds/nsFeedSniffer.cpp delete mode 100644 components/feeds/nsFeedSniffer.h delete mode 100644 components/feeds/nsIFeedResultService.idl delete mode 100644 components/feeds/nsIWebContentConverterRegistrar.idl delete mode 100644 components/fuel/fuelApplication.js delete mode 100644 components/fuel/fuelApplication.manifest delete mode 100644 components/fuel/fuelIApplication.idl delete mode 100644 components/fuel/moz.build delete mode 100644 components/moz.build delete mode 100644 components/newtab/cells.js delete mode 100644 components/newtab/drag.js delete mode 100644 components/newtab/dragDataHelper.js delete mode 100644 components/newtab/drop.js delete mode 100644 components/newtab/dropPreview.js delete mode 100644 components/newtab/dropTargetShim.js delete mode 100644 components/newtab/grid.js delete mode 100644 components/newtab/jar.mn delete mode 100644 components/newtab/moz.build delete mode 100644 components/newtab/newTab.css delete mode 100644 components/newtab/newTab.js delete mode 100644 components/newtab/newTab.xhtml delete mode 100644 components/newtab/page.js delete mode 100644 components/newtab/search.js delete mode 100644 components/newtab/sites.js delete mode 100644 components/newtab/transformations.js delete mode 100644 components/newtab/undo.js delete mode 100644 components/newtab/updater.js delete mode 100644 components/nsAboutRedirector.js delete mode 100644 components/nsBrowserContentHandler.js delete mode 100644 components/nsBrowserGlue.js delete mode 100644 components/nsIBrowserGlue.idl delete mode 100644 components/nsIBrowserHandler.idl delete mode 100644 components/pageinfo/feeds.js delete mode 100644 components/pageinfo/feeds.xml delete mode 100644 components/pageinfo/jar.mn delete mode 100644 components/pageinfo/moz.build delete mode 100644 components/pageinfo/pageInfo.css delete mode 100644 components/pageinfo/pageInfo.js delete mode 100644 components/pageinfo/pageInfo.xml delete mode 100644 components/pageinfo/pageInfo.xul delete mode 100644 components/pageinfo/permissions.js delete mode 100644 components/pageinfo/security.js delete mode 100644 components/permissions/aboutPermissions.css delete mode 100644 components/permissions/aboutPermissions.js delete mode 100644 components/permissions/aboutPermissions.xml delete mode 100644 components/permissions/aboutPermissions.xul delete mode 100644 components/permissions/jar.mn delete mode 100644 components/permissions/moz.build delete mode 100644 components/places/PlacesUIUtils.jsm delete mode 100644 components/places/content/bookmarkProperties.js delete mode 100644 components/places/content/bookmarkProperties.xul delete mode 100644 components/places/content/bookmarksPanel.js delete mode 100644 components/places/content/bookmarksPanel.xul delete mode 100644 components/places/content/browserPlacesViews.js delete mode 100644 components/places/content/controller.js delete mode 100644 components/places/content/downloadsViewOverlay.xul delete mode 100644 components/places/content/editBookmarkOverlay.js delete mode 100644 components/places/content/editBookmarkOverlay.xul delete mode 100644 components/places/content/history-panel.js delete mode 100644 components/places/content/history-panel.xul delete mode 100644 components/places/content/menu.xml delete mode 100644 components/places/content/moveBookmarks.js delete mode 100644 components/places/content/moveBookmarks.xul delete mode 100644 components/places/content/organizer.css delete mode 100644 components/places/content/places.css delete mode 100644 components/places/content/places.js delete mode 100644 components/places/content/places.xul delete mode 100644 components/places/content/placesOverlay.xul delete mode 100644 components/places/content/sidebarUtils.js delete mode 100644 components/places/content/tree.xml delete mode 100644 components/places/content/treeView.js delete mode 100644 components/places/jar.mn delete mode 100644 components/places/moz.build delete mode 100644 components/preferences/advanced.js delete mode 100644 components/preferences/advanced.xul delete mode 100644 components/preferences/applicationManager.js delete mode 100644 components/preferences/applicationManager.xul delete mode 100644 components/preferences/applications.js delete mode 100644 components/preferences/applications.xul delete mode 100644 components/preferences/colors.xul delete mode 100644 components/preferences/connection.js delete mode 100644 components/preferences/connection.xul delete mode 100644 components/preferences/content.js delete mode 100644 components/preferences/content.xul delete mode 100644 components/preferences/cookies.js delete mode 100644 components/preferences/cookies.xul delete mode 100644 components/preferences/fonts.js delete mode 100644 components/preferences/fonts.xul delete mode 100644 components/preferences/handlers.css delete mode 100644 components/preferences/handlers.xml delete mode 100644 components/preferences/jar.mn delete mode 100644 components/preferences/languages.js delete mode 100644 components/preferences/languages.xul delete mode 100644 components/preferences/main.js delete mode 100644 components/preferences/main.xul delete mode 100644 components/preferences/moz.build delete mode 100644 components/preferences/newtaburl.js delete mode 100644 components/preferences/permissions.js delete mode 100644 components/preferences/permissions.xul delete mode 100644 components/preferences/preferences.xul delete mode 100644 components/preferences/privacy.js delete mode 100644 components/preferences/privacy.xul delete mode 100644 components/preferences/sanitize.js delete mode 100644 components/preferences/sanitize.xul delete mode 100644 components/preferences/security.js delete mode 100644 components/preferences/security.xul delete mode 100644 components/preferences/selectBookmark.js delete mode 100644 components/preferences/selectBookmark.xul delete mode 100644 components/preferences/sync.js delete mode 100644 components/preferences/sync.xul delete mode 100644 components/preferences/tabs.js delete mode 100644 components/preferences/tabs.xul delete mode 100644 components/privatebrowsing/content/aboutPrivateBrowsing.xhtml delete mode 100644 components/privatebrowsing/jar.mn delete mode 100644 components/privatebrowsing/moz.build delete mode 100644 components/search/content/engineManager.js delete mode 100644 components/search/content/engineManager.xul delete mode 100644 components/search/content/search.xml delete mode 100644 components/search/content/searchbarBindings.css delete mode 100644 components/search/jar.mn delete mode 100644 components/search/moz.build delete mode 100644 components/sessionstore/DocumentUtils.jsm delete mode 100644 components/sessionstore/SessionStorage.jsm delete mode 100644 components/sessionstore/SessionStore.jsm delete mode 100644 components/sessionstore/XPathGenerator.jsm delete mode 100644 components/sessionstore/_SessionFile.jsm delete mode 100644 components/sessionstore/content/aboutSessionRestore.js delete mode 100644 components/sessionstore/content/aboutSessionRestore.xhtml delete mode 100644 components/sessionstore/content/content-sessionStore.js delete mode 100644 components/sessionstore/jar.mn delete mode 100644 components/sessionstore/moz.build delete mode 100644 components/sessionstore/nsISessionStartup.idl delete mode 100644 components/sessionstore/nsISessionStore.idl delete mode 100644 components/sessionstore/nsSessionStartup.js delete mode 100644 components/sessionstore/nsSessionStore.js delete mode 100644 components/sessionstore/nsSessionStore.manifest delete mode 100644 components/shell/ShellService.jsm delete mode 100644 components/shell/content/setDesktopBackground.js delete mode 100644 components/shell/content/setDesktopBackground.xul delete mode 100644 components/shell/jar.mn delete mode 100644 components/shell/moz.build delete mode 100644 components/shell/nsGNOMEShellService.cpp delete mode 100644 components/shell/nsGNOMEShellService.h delete mode 100644 components/shell/nsIGNOMEShellService.idl delete mode 100644 components/shell/nsIMacShellService.idl delete mode 100644 components/shell/nsIShellService.idl delete mode 100644 components/shell/nsIWindowsShellService.idl delete mode 100644 components/shell/nsMacShellService.cpp delete mode 100644 components/shell/nsMacShellService.h delete mode 100644 components/shell/nsSetDefaultBrowser.js delete mode 100644 components/shell/nsSetDefaultBrowser.manifest delete mode 100644 components/shell/nsShellService.h delete mode 100644 components/shell/nsWindowsShellService.cpp delete mode 100644 components/shell/nsWindowsShellService.h delete mode 100644 components/statusbar/Downloads.jsm delete mode 100644 components/statusbar/Progress.jsm delete mode 100644 components/statusbar/Status.jsm delete mode 100644 components/statusbar/Status4Evar.jsm delete mode 100644 components/statusbar/Toolbars.jsm delete mode 100644 components/statusbar/content-thunk.js delete mode 100644 components/statusbar/content/overlay.css delete mode 100644 components/statusbar/content/overlay.js delete mode 100644 components/statusbar/content/overlay.xul delete mode 100644 components/statusbar/content/prefs.css delete mode 100644 components/statusbar/content/prefs.js delete mode 100644 components/statusbar/content/prefs.xml delete mode 100644 components/statusbar/content/prefs.xul delete mode 100644 components/statusbar/content/tabbrowser.xml delete mode 100644 components/statusbar/jar.mn delete mode 100644 components/statusbar/moz.build delete mode 100644 components/statusbar/status4evar.idl delete mode 100644 components/statusbar/status4evar.js delete mode 100644 components/statusbar/status4evar.manifest delete mode 100644 components/sync/aboutSyncTabs-bindings.xml delete mode 100644 components/sync/aboutSyncTabs.css delete mode 100644 components/sync/aboutSyncTabs.js delete mode 100644 components/sync/aboutSyncTabs.xul delete mode 100644 components/sync/addDevice.js delete mode 100644 components/sync/addDevice.xul delete mode 100644 components/sync/genericChange.js delete mode 100644 components/sync/genericChange.xul delete mode 100644 components/sync/jar.mn delete mode 100644 components/sync/key.xhtml delete mode 100644 components/sync/moz.build delete mode 100644 components/sync/notification.xml delete mode 100644 components/sync/progress.js delete mode 100644 components/sync/progress.xhtml delete mode 100644 components/sync/quota.js delete mode 100644 components/sync/quota.xul delete mode 100644 components/sync/setup.js delete mode 100644 components/sync/setup.xul delete mode 100644 components/sync/utils.js delete mode 100644 config/mozconfig delete mode 100644 config/mozconfigs/common delete mode 100644 config/mozconfigs/linux32/beta delete mode 100644 config/mozconfigs/linux32/common-opt delete mode 100644 config/mozconfigs/linux32/debug delete mode 100644 config/mozconfigs/linux32/debug-asan delete mode 100644 config/mozconfigs/linux32/l10n-mozconfig delete mode 100644 config/mozconfigs/linux32/release delete mode 100644 config/mozconfigs/linux32/valgrind delete mode 100644 config/mozconfigs/linux64/beta delete mode 100644 config/mozconfigs/linux64/common-opt delete mode 100644 config/mozconfigs/linux64/debug delete mode 100644 config/mozconfigs/linux64/debug-asan delete mode 100644 config/mozconfigs/linux64/debug-static-analysis-clang delete mode 100644 config/mozconfigs/linux64/l10n-mozconfig delete mode 100644 config/mozconfigs/linux64/release delete mode 100644 config/mozconfigs/linux64/valgrind delete mode 100644 config/mozconfigs/macosx-universal/beta delete mode 100644 config/mozconfigs/macosx-universal/common-opt delete mode 100644 config/mozconfigs/macosx-universal/l10n-mozconfig delete mode 100644 config/mozconfigs/macosx-universal/release delete mode 100644 config/mozconfigs/macosx64/debug delete mode 100644 config/mozconfigs/macosx64/debug-asan delete mode 100644 config/mozconfigs/macosx64/l10n-mozconfig delete mode 100644 config/mozconfigs/win32/beta delete mode 100644 config/mozconfigs/win32/common-opt delete mode 100644 config/mozconfigs/win32/debug delete mode 100644 config/mozconfigs/win32/l10n-mozconfig delete mode 100644 config/mozconfigs/win32/release delete mode 100644 config/mozconfigs/win64/debug delete mode 100644 config/mozconfigs/win64/nightly delete mode 100644 config/tooltool-manifests/linux32/clang.manifest delete mode 100644 config/tooltool-manifests/linux32/releng.manifest delete mode 100644 config/tooltool-manifests/linux64/clang.manifest delete mode 100644 config/tooltool-manifests/linux64/releng.manifest delete mode 100644 config/tooltool-manifests/macosx64/releng.manifest delete mode 100644 config/version.txt delete mode 100644 configure.in delete mode 100644 confvars.sh delete mode 100644 defs.mk delete mode 100644 doc/BUILD delete mode 100644 doc/mozconfig.example delete mode 100644 installer/Makefile.in delete mode 100644 installer/moz.build delete mode 100644 installer/package-manifest.in delete mode 100644 installer/removed-files.in delete mode 100644 installer/windows/Makefile.in delete mode 100644 installer/windows/app.tag delete mode 100644 installer/windows/moz.build delete mode 100644 installer/windows/nsis/defines.nsi.in delete mode 100644 installer/windows/nsis/installer.nsi delete mode 100644 installer/windows/nsis/shared.nsh delete mode 100644 installer/windows/nsis/uninstaller.nsi delete mode 100644 installer/windows/nsis/updater_append.ini delete mode 100644 locales/Makefile.in delete mode 100644 locales/all-locales delete mode 100644 locales/en-US/chrome/browser-region/region.properties delete mode 100644 locales/en-US/chrome/browser/aboutCertError.dtd delete mode 100644 locales/en-US/chrome/browser/aboutDialog.dtd delete mode 100644 locales/en-US/chrome/browser/aboutHome.dtd delete mode 100644 locales/en-US/chrome/browser/aboutPrivateBrowsing.dtd delete mode 100644 locales/en-US/chrome/browser/aboutSessionRestore.dtd delete mode 100644 locales/en-US/chrome/browser/aboutSyncTabs.dtd delete mode 100644 locales/en-US/chrome/browser/baseMenuOverlay.dtd delete mode 100644 locales/en-US/chrome/browser/browser.dtd delete mode 100644 locales/en-US/chrome/browser/browser.properties delete mode 100644 locales/en-US/chrome/browser/charsetMenu.dtd delete mode 100644 locales/en-US/chrome/browser/charsetMenu.properties delete mode 100644 locales/en-US/chrome/browser/charsetOverlay.dtd delete mode 100644 locales/en-US/chrome/browser/downloads/downloads.dtd delete mode 100644 locales/en-US/chrome/browser/downloads/downloads.properties delete mode 100644 locales/en-US/chrome/browser/engineManager.dtd delete mode 100644 locales/en-US/chrome/browser/engineManager.properties delete mode 100644 locales/en-US/chrome/browser/feeds/subscribe.dtd delete mode 100644 locales/en-US/chrome/browser/feeds/subscribe.properties delete mode 100644 locales/en-US/chrome/browser/newTab.dtd delete mode 100644 locales/en-US/chrome/browser/newTab.properties delete mode 100644 locales/en-US/chrome/browser/openLocation.dtd delete mode 100644 locales/en-US/chrome/browser/openLocation.properties delete mode 100644 locales/en-US/chrome/browser/pageInfo.dtd delete mode 100644 locales/en-US/chrome/browser/pageInfo.properties delete mode 100644 locales/en-US/chrome/browser/palemoon.dtd delete mode 100644 locales/en-US/chrome/browser/permissions/aboutPermissions.dtd delete mode 100644 locales/en-US/chrome/browser/permissions/aboutPermissions.properties delete mode 100644 locales/en-US/chrome/browser/places/bookmarkProperties.properties delete mode 100644 locales/en-US/chrome/browser/places/editBookmarkOverlay.dtd delete mode 100644 locales/en-US/chrome/browser/places/moveBookmarks.dtd delete mode 100644 locales/en-US/chrome/browser/places/places.dtd delete mode 100644 locales/en-US/chrome/browser/places/places.properties delete mode 100644 locales/en-US/chrome/browser/preferences/advanced.dtd delete mode 100644 locales/en-US/chrome/browser/preferences/applicationManager.dtd delete mode 100644 locales/en-US/chrome/browser/preferences/applicationManager.properties delete mode 100644 locales/en-US/chrome/browser/preferences/applications.dtd delete mode 100644 locales/en-US/chrome/browser/preferences/colors.dtd delete mode 100644 locales/en-US/chrome/browser/preferences/connection.dtd delete mode 100644 locales/en-US/chrome/browser/preferences/content.dtd delete mode 100644 locales/en-US/chrome/browser/preferences/cookies.dtd delete mode 100644 locales/en-US/chrome/browser/preferences/fonts.dtd delete mode 100644 locales/en-US/chrome/browser/preferences/languages.dtd delete mode 100644 locales/en-US/chrome/browser/preferences/main.dtd delete mode 100644 locales/en-US/chrome/browser/preferences/permissions.dtd delete mode 100644 locales/en-US/chrome/browser/preferences/preferences.dtd delete mode 100644 locales/en-US/chrome/browser/preferences/preferences.properties delete mode 100644 locales/en-US/chrome/browser/preferences/privacy.dtd delete mode 100644 locales/en-US/chrome/browser/preferences/security.dtd delete mode 100644 locales/en-US/chrome/browser/preferences/selectBookmark.dtd delete mode 100644 locales/en-US/chrome/browser/preferences/sync.dtd delete mode 100644 locales/en-US/chrome/browser/preferences/tabs.dtd delete mode 100644 locales/en-US/chrome/browser/quitDialog.properties delete mode 100644 locales/en-US/chrome/browser/safeMode.dtd delete mode 100644 locales/en-US/chrome/browser/sanitize.dtd delete mode 100644 locales/en-US/chrome/browser/search.properties delete mode 100644 locales/en-US/chrome/browser/searchbar.dtd delete mode 100644 locales/en-US/chrome/browser/setDesktopBackground.dtd delete mode 100644 locales/en-US/chrome/browser/shellservice.properties delete mode 100644 locales/en-US/chrome/browser/statusbar/meta.properties delete mode 100644 locales/en-US/chrome/browser/statusbar/overlay.properties delete mode 100644 locales/en-US/chrome/browser/statusbar/prefs.properties delete mode 100644 locales/en-US/chrome/browser/statusbar/statusbar-overlay.dtd delete mode 100644 locales/en-US/chrome/browser/statusbar/statusbar-prefs.dtd delete mode 100644 locales/en-US/chrome/browser/syncBrand.dtd delete mode 100644 locales/en-US/chrome/browser/syncGenericChange.properties delete mode 100644 locales/en-US/chrome/browser/syncKey.dtd delete mode 100644 locales/en-US/chrome/browser/syncProgress.dtd delete mode 100644 locales/en-US/chrome/browser/syncQuota.dtd delete mode 100644 locales/en-US/chrome/browser/syncQuota.properties delete mode 100644 locales/en-US/chrome/browser/syncSetup.dtd delete mode 100644 locales/en-US/chrome/browser/syncSetup.properties delete mode 100644 locales/en-US/chrome/browser/tabbrowser.dtd delete mode 100644 locales/en-US/chrome/browser/tabbrowser.properties delete mode 100644 locales/en-US/chrome/browser/taskbar.properties delete mode 100644 locales/en-US/chrome/overrides/appstrings.properties delete mode 100644 locales/en-US/chrome/overrides/netError.dtd delete mode 100644 locales/en-US/chrome/overrides/settingsChange.dtd delete mode 100644 locales/en-US/crashreporter/crashreporter-override.ini delete mode 100644 locales/en-US/defines.inc delete mode 100644 locales/en-US/installer/custom.properties delete mode 100644 locales/en-US/installer/mui.properties delete mode 100644 locales/en-US/installer/override.properties delete mode 100644 locales/en-US/profile/bookmarks.inc delete mode 100644 locales/en-US/profile/chrome/userChrome-example.css delete mode 100644 locales/en-US/profile/chrome/userContent-example.css delete mode 100644 locales/en-US/searchplugins/amazondotcom.xml delete mode 100644 locales/en-US/searchplugins/answers.xml delete mode 100644 locales/en-US/searchplugins/bing.xml delete mode 100644 locales/en-US/searchplugins/creativecommons.xml delete mode 100644 locales/en-US/searchplugins/duckduckgo-html.xml delete mode 100644 locales/en-US/searchplugins/duckduckgo.xml delete mode 100644 locales/en-US/searchplugins/eBay.xml delete mode 100644 locales/en-US/searchplugins/list.txt delete mode 100644 locales/en-US/searchplugins/wikipedia.xml delete mode 100644 locales/en-US/searchplugins/yahoo.xml delete mode 100644 locales/en-US/updater/updater.ini delete mode 100644 locales/en-US/webbrowser-l10n.js delete mode 100644 locales/filter.py delete mode 100644 locales/generic/extract-bookmarks.py delete mode 100644 locales/generic/profile/bookmarks.html.in delete mode 100644 locales/generic/profile/localstore.rdf delete mode 100644 locales/generic/profile/mimeTypes.rdf delete mode 100644 locales/jar.mn delete mode 100644 locales/l10n.ini delete mode 100644 locales/moz.build delete mode 100644 locales/shipped-locales delete mode 100644 modules/AboutHomeUtils.jsm delete mode 100644 modules/AutoCompletePopup.jsm delete mode 100644 modules/BrowserNewTabPreloader.jsm delete mode 100644 modules/CharsetMenu.jsm delete mode 100644 modules/FormSubmitObserver.jsm delete mode 100644 modules/FormValidationHandler.jsm delete mode 100644 modules/NetworkPrioritizer.jsm delete mode 100644 modules/PageMenu.jsm delete mode 100644 modules/PopupNotifications.jsm delete mode 100644 modules/QuotaManager.jsm delete mode 100644 modules/RecentWindow.jsm delete mode 100644 modules/SharedFrame.jsm delete mode 100644 modules/Windows8WindowFrameColor.jsm delete mode 100644 modules/WindowsJumpLists.jsm delete mode 100644 modules/WindowsPreviewPerTab.jsm delete mode 100644 modules/moz.build delete mode 100644 modules/offlineAppCache.jsm delete mode 100644 modules/openLocationLastURL.jsm delete mode 100644 modules/webrtcUI.jsm delete mode 100644 moz.build delete mode 100644 moz.configure delete mode 100644 themes/LICENSE delete mode 100644 themes/linux/Geolocation-16.png delete mode 100644 themes/linux/Geolocation-64.png delete mode 100644 themes/linux/Go-arrow.png delete mode 100644 themes/linux/Info.png delete mode 100644 themes/linux/KUI-close.png delete mode 100644 themes/linux/Makefile.in delete mode 100644 themes/linux/Privacy-16.png delete mode 100644 themes/linux/Privacy-32.png delete mode 100644 themes/linux/Privacy-48.png delete mode 100644 themes/linux/Privacy-64.png delete mode 100644 themes/linux/Secure.png delete mode 100644 themes/linux/Security-broken.png delete mode 100644 themes/linux/Toolbar-small.png delete mode 100644 themes/linux/Toolbar.png delete mode 100644 themes/linux/aboutCertError.css delete mode 100644 themes/linux/aboutCertError_sectionCollapsed-rtl.png delete mode 100644 themes/linux/aboutCertError_sectionCollapsed.png delete mode 100644 themes/linux/aboutCertError_sectionExpanded.png delete mode 100644 themes/linux/aboutPrivateBrowsing.css delete mode 100644 themes/linux/aboutSessionRestore-window-icon.png delete mode 100644 themes/linux/aboutSessionRestore.css delete mode 100644 themes/linux/aboutSyncTabs.css delete mode 100644 themes/linux/actionicon-tab.png delete mode 100644 themes/linux/autocomplete.css delete mode 100644 themes/linux/browser.css delete mode 100644 themes/linux/click-to-play-warning-stripes.png delete mode 100644 themes/linux/communicator/communicator.css delete mode 100644 themes/linux/communicator/jar.mn delete mode 100644 themes/linux/communicator/moz.build delete mode 100644 themes/linux/downloads/allDownloadsViewOverlay.css delete mode 100644 themes/linux/downloads/buttons.png delete mode 100644 themes/linux/downloads/contentAreaDownloadsView.css delete mode 100644 themes/linux/downloads/download-glow-small.png delete mode 100644 themes/linux/downloads/download-glow.png delete mode 100644 themes/linux/downloads/download-notification-finish.png delete mode 100644 themes/linux/downloads/download-notification-start.png delete mode 100644 themes/linux/downloads/download-summary.png delete mode 100644 themes/linux/downloads/downloads.css delete mode 100644 themes/linux/engineManager.css delete mode 100644 themes/linux/feeds/feedIcon.png delete mode 100644 themes/linux/feeds/feedIcon16.png delete mode 100644 themes/linux/feeds/subscribe-ui.css delete mode 100644 themes/linux/feeds/subscribe.css delete mode 100644 themes/linux/icon.png delete mode 100644 themes/linux/identity-icons-generic.png delete mode 100644 themes/linux/identity-icons-https-ev.png delete mode 100644 themes/linux/identity-icons-https-mixed-active.png delete mode 100644 themes/linux/identity-icons-https.png delete mode 100644 themes/linux/identity.png delete mode 100644 themes/linux/imagedocument.png delete mode 100644 themes/linux/jar.mn delete mode 100644 themes/linux/mixed-content-blocked-16.png delete mode 100644 themes/linux/mixed-content-blocked-64.png delete mode 100644 themes/linux/monitor.png delete mode 100644 themes/linux/monitor_16-10.png delete mode 100644 themes/linux/moz.build delete mode 100644 themes/linux/newtab/newTab.css delete mode 100644 themes/linux/page-livemarks.png delete mode 100644 themes/linux/pageInfo.css delete mode 100644 themes/linux/pageInfo.png delete mode 100644 themes/linux/permissions/aboutPermissions.css delete mode 100644 themes/linux/places/bookmarksMenu.png delete mode 100644 themes/linux/places/bookmarksToolbar.png delete mode 100644 themes/linux/places/calendar.png delete mode 100644 themes/linux/places/downloads.png delete mode 100644 themes/linux/places/editBookmarkOverlay.css delete mode 100644 themes/linux/places/livemark-item.png delete mode 100644 themes/linux/places/organizer.css delete mode 100644 themes/linux/places/organizer.xml delete mode 100644 themes/linux/places/pageStarred.png delete mode 100644 themes/linux/places/places.css delete mode 100644 themes/linux/places/query.png delete mode 100644 themes/linux/places/star-icons.png delete mode 100644 themes/linux/places/starPage.png delete mode 100644 themes/linux/places/starred48.png delete mode 100644 themes/linux/places/tag.png delete mode 100644 themes/linux/places/toolbarDropMarker.png delete mode 100644 themes/linux/places/unsortedBookmarks.png delete mode 100644 themes/linux/places/unstarred48.png delete mode 100644 themes/linux/pointerLock-16.png delete mode 100644 themes/linux/pointerLock-64.png delete mode 100644 themes/linux/preferences/Options-sync.png delete mode 100644 themes/linux/preferences/Options.png delete mode 100644 themes/linux/preferences/alwaysAsk.png delete mode 100644 themes/linux/preferences/applications.css delete mode 100644 themes/linux/preferences/mail.png delete mode 100644 themes/linux/preferences/preferences.css delete mode 100644 themes/linux/privatebrowsing-mask.png delete mode 100644 themes/linux/sanitizeDialog.css delete mode 100644 themes/linux/searchbar.css delete mode 100644 themes/linux/setDesktopBackground.css delete mode 100644 themes/linux/slowStartup-16.png delete mode 100644 themes/linux/statusbar/overlay.css delete mode 100644 themes/linux/statusbar/prefs.css delete mode 100644 themes/linux/sync-128.png delete mode 100644 themes/linux/sync-16-throbber.png delete mode 100644 themes/linux/sync-16.png delete mode 100644 themes/linux/sync-24-throbber.png delete mode 100644 themes/linux/sync-32.png delete mode 100644 themes/linux/sync-bg.png delete mode 100644 themes/linux/sync-desktopIcon.png delete mode 100644 themes/linux/sync-mobileIcon.png delete mode 100644 themes/linux/syncCommon.css delete mode 100644 themes/linux/syncProgress.css delete mode 100644 themes/linux/syncQuota.css delete mode 100644 themes/linux/syncSetup.css delete mode 100644 themes/linux/tabbrowser/alltabs.png delete mode 100644 themes/linux/tabbrowser/connecting.png delete mode 100644 themes/linux/tabbrowser/loading.png delete mode 100644 themes/linux/tabbrowser/tab-overflow-border.png delete mode 100644 themes/linux/tabbrowser/tab.png delete mode 100644 themes/linux/tabbrowser/tabDragIndicator.png delete mode 100644 themes/linux/urlbar-arrow.png delete mode 100644 themes/linux/web-notifications-icon.svg delete mode 100644 themes/linux/web-notifications-tray.svg delete mode 100644 themes/linux/webRTC-shareDevice-16.png delete mode 100644 themes/linux/webRTC-shareDevice-64.png delete mode 100644 themes/linux/webRTC-sharingDevice-16.png delete mode 100644 themes/moz.build delete mode 100644 themes/osx/Geolocation-16.png delete mode 100644 themes/osx/Geolocation-64.png delete mode 100644 themes/osx/Info.png delete mode 100644 themes/osx/KUI-background.png delete mode 100644 themes/osx/KUI-close.png delete mode 100644 themes/osx/Makefile.in delete mode 100644 themes/osx/Privacy-16.png delete mode 100644 themes/osx/Privacy-32.png delete mode 100644 themes/osx/Privacy-48.png delete mode 100644 themes/osx/Privacy-64.png delete mode 100644 themes/osx/Search-glass.png delete mode 100644 themes/osx/Secure24.png delete mode 100644 themes/osx/Toolbar-glass.png delete mode 100644 themes/osx/Toolbar-inverted.png delete mode 100644 themes/osx/Toolbar.png delete mode 100644 themes/osx/aboutCertError.css delete mode 100644 themes/osx/aboutCertError_sectionCollapsed-rtl.png delete mode 100644 themes/osx/aboutCertError_sectionCollapsed.png delete mode 100644 themes/osx/aboutCertError_sectionExpanded.png delete mode 100644 themes/osx/aboutPrivateBrowsing.css delete mode 100644 themes/osx/aboutSessionRestore.css delete mode 100644 themes/osx/aboutSyncTabs.css delete mode 100644 themes/osx/actionicon-tab.png delete mode 100644 themes/osx/appmenu-dropmarker.png delete mode 100644 themes/osx/appmenu-icons.png delete mode 100644 themes/osx/autocomplete.css delete mode 100644 themes/osx/browser.css delete mode 100644 themes/osx/click-to-play-warning-stripes.png delete mode 100644 themes/osx/communicator/communicator.css delete mode 100644 themes/osx/communicator/jar.mn delete mode 100644 themes/osx/communicator/moz.build delete mode 100644 themes/osx/downloads/allDownloadsViewOverlay.css delete mode 100644 themes/osx/downloads/buttons.png delete mode 100644 themes/osx/downloads/contentAreaDownloadsView.css delete mode 100644 themes/osx/downloads/download-glow.png delete mode 100644 themes/osx/downloads/download-notification-finish.png delete mode 100644 themes/osx/downloads/download-notification-start.png delete mode 100644 themes/osx/downloads/download-summary.png delete mode 100644 themes/osx/downloads/downloads.css delete mode 100644 themes/osx/engineManager.css delete mode 100644 themes/osx/feeds/feed-icons-16.png delete mode 100644 themes/osx/feeds/feedIcon.png delete mode 100644 themes/osx/feeds/feedIcon16.png delete mode 100644 themes/osx/feeds/subscribe-ui.css delete mode 100644 themes/osx/feeds/subscribe.css delete mode 100644 themes/osx/icon.png delete mode 100644 themes/osx/identity-icons-generic.png delete mode 100644 themes/osx/identity-icons-https-ev.png delete mode 100644 themes/osx/identity-icons-https-mixed-active.png delete mode 100644 themes/osx/identity-icons-https.png delete mode 100644 themes/osx/identity.png delete mode 100644 themes/osx/imagedocument.png delete mode 100644 themes/osx/jar.mn delete mode 100644 themes/osx/keyhole-forward-mask.svg delete mode 100644 themes/osx/livemark-folder.png delete mode 100644 themes/osx/menu-back.png delete mode 100644 themes/osx/menu-forward.png delete mode 100644 themes/osx/mixed-content-blocked-16.png delete mode 100644 themes/osx/mixed-content-blocked-64.png delete mode 100644 themes/osx/monitor.png delete mode 100644 themes/osx/monitor_16-10.png delete mode 100644 themes/osx/moz.build delete mode 100644 themes/osx/newtab/newTab.css delete mode 100644 themes/osx/page-livemarks.png delete mode 100644 themes/osx/page-livemarks@2x.png delete mode 100644 themes/osx/pageInfo.css delete mode 100644 themes/osx/pageInfo.png delete mode 100644 themes/osx/panel-expander-closed.png delete mode 100644 themes/osx/panel-expander-closed@2x.png delete mode 100644 themes/osx/panel-expander-open.png delete mode 100644 themes/osx/panel-expander-open@2x.png delete mode 100644 themes/osx/panel-plus-sign.png delete mode 100644 themes/osx/permissions/aboutPermissions.css delete mode 100644 themes/osx/places/allBookmarks.png delete mode 100644 themes/osx/places/bookmark.png delete mode 100644 themes/osx/places/bookmarksMenu.png delete mode 100644 themes/osx/places/bookmarksToolbar.png delete mode 100644 themes/osx/places/bookmarksToolbar@2x.png delete mode 100644 themes/osx/places/calendar.png delete mode 100644 themes/osx/places/downloads.png delete mode 100644 themes/osx/places/editBookmark.png delete mode 100644 themes/osx/places/editBookmarkOverlay.css delete mode 100644 themes/osx/places/expander-closed-active.png delete mode 100644 themes/osx/places/expander-closed.png delete mode 100644 themes/osx/places/expander-open-active.png delete mode 100644 themes/osx/places/expander-open.png delete mode 100644 themes/osx/places/folderDropArrow.png delete mode 100644 themes/osx/places/folderDropArrow@2x.png delete mode 100644 themes/osx/places/history.png delete mode 100644 themes/osx/places/history@2x.png delete mode 100644 themes/osx/places/libraryToolbar.png delete mode 100644 themes/osx/places/livemark-item.png delete mode 100644 themes/osx/places/organizer.css delete mode 100644 themes/osx/places/places.css delete mode 100644 themes/osx/places/query.png delete mode 100644 themes/osx/places/query@2x.png delete mode 100644 themes/osx/places/starred48.png delete mode 100644 themes/osx/places/tag.png delete mode 100644 themes/osx/places/tag@2x.png delete mode 100644 themes/osx/places/toolbarDropMarker.png delete mode 100644 themes/osx/places/unfiledBookmarks.png delete mode 100644 themes/osx/places/unfiledBookmarks@2x.png delete mode 100644 themes/osx/places/unsortedBookmarks.png delete mode 100644 themes/osx/places/unstarred48.png delete mode 100644 themes/osx/pointerLock-16.png delete mode 100644 themes/osx/pointerLock-64.png delete mode 100644 themes/osx/preferences/Options-sync.png delete mode 100644 themes/osx/preferences/Options.png delete mode 100644 themes/osx/preferences/alwaysAsk.png delete mode 100644 themes/osx/preferences/application.png delete mode 100644 themes/osx/preferences/applications.css delete mode 100644 themes/osx/preferences/mail.png delete mode 100644 themes/osx/preferences/preferences.css delete mode 100644 themes/osx/preferences/saveFile.png delete mode 100644 themes/osx/privatebrowsing-dark.png delete mode 100644 themes/osx/privatebrowsing-light.png delete mode 100644 themes/osx/privatebrowsing-mask.png delete mode 100644 themes/osx/privatebrowsing-mask@2x.png delete mode 100644 themes/osx/reload-stop-go.png delete mode 100644 themes/osx/sanitizeDialog.css delete mode 100644 themes/osx/searchbar-dropdown-arrow.png delete mode 100644 themes/osx/searchbar.css delete mode 100644 themes/osx/setDesktopBackground.css delete mode 100644 themes/osx/shared.inc delete mode 100644 themes/osx/slowStartup-16.png delete mode 100644 themes/osx/statusbar/overlay.css delete mode 100644 themes/osx/statusbar/prefs.css delete mode 100644 themes/osx/sync-128.png delete mode 100644 themes/osx/sync-16.png delete mode 100644 themes/osx/sync-32.png delete mode 100644 themes/osx/sync-bg.png delete mode 100644 themes/osx/sync-desktopIcon.png delete mode 100644 themes/osx/sync-mobileIcon.png delete mode 100644 themes/osx/sync-throbber.png delete mode 100644 themes/osx/syncCommon.css delete mode 100644 themes/osx/syncProgress.css delete mode 100644 themes/osx/syncQuota.css delete mode 100644 themes/osx/syncSetup.css delete mode 100644 themes/osx/tabbrowser/alltabs-inverted.png delete mode 100644 themes/osx/tabbrowser/alltabs.png delete mode 100644 themes/osx/tabbrowser/connecting.png delete mode 100644 themes/osx/tabbrowser/loading.png delete mode 100644 themes/osx/tabbrowser/newtab-glass.png delete mode 100644 themes/osx/tabbrowser/newtab-inverted.png delete mode 100644 themes/osx/tabbrowser/newtab.png delete mode 100644 themes/osx/tabbrowser/tab-arrow-left-glass.png delete mode 100644 themes/osx/tabbrowser/tab-arrow-left-inverted.png delete mode 100644 themes/osx/tabbrowser/tab-arrow-left.png delete mode 100644 themes/osx/tabbrowser/tab-overflow-border.png delete mode 100644 themes/osx/tabbrowser/tabDragIndicator.png delete mode 100644 themes/osx/toolbarbutton-dropdown-arrow-inverted.png delete mode 100644 themes/osx/toolbarbutton-dropdown-arrow.png delete mode 100644 themes/osx/urlbar-arrow.png delete mode 100644 themes/osx/urlbar-history-dropmarker.png delete mode 100644 themes/osx/urlbar-popup-blocked.png delete mode 100644 themes/osx/web-notifications-icon.svg delete mode 100644 themes/osx/web-notifications-tray.svg delete mode 100644 themes/osx/webRTC-shareDevice-16.png delete mode 100644 themes/osx/webRTC-shareDevice-64.png delete mode 100644 themes/osx/webRTC-sharingDevice-16.png delete mode 100644 themes/shared/browser.inc delete mode 100644 themes/shared/newtab/controls.png delete mode 100644 themes/shared/newtab/newTab.css.inc delete mode 100644 themes/shared/newtab/noise.png delete mode 100644 themes/shared/newtab/pinned.png delete mode 100644 themes/shared/plugin-doorhanger.inc.css delete mode 100644 themes/shared/plugins/notification-pluginAlert.png delete mode 100644 themes/shared/plugins/notification-pluginAlert@2x.png delete mode 100644 themes/shared/plugins/notification-pluginBlocked.png delete mode 100644 themes/shared/plugins/notification-pluginBlocked@2x.png delete mode 100644 themes/shared/plugins/notification-pluginNormal.png delete mode 100644 themes/shared/plugins/notification-pluginNormal@2x.png delete mode 100644 themes/shared/statusbar/dynamic.css delete mode 100644 themes/shared/statusbar/overlay.css delete mode 100644 themes/shared/statusbar/pms16.png delete mode 100644 themes/shared/statusbar/pms24.png delete mode 100644 themes/shared/statusbar/prefs.css delete mode 100644 themes/shared/statusbar/pulse.png delete mode 100644 themes/shared/statusbar/throbber-idle.png delete mode 100644 themes/shared/statusbar/throbberStatic.png delete mode 100644 themes/shared/tabbrowser/tab-audio-small.svg delete mode 100644 themes/shared/tabbrowser/tab-audio.svg delete mode 100644 themes/windows/Geolocation-16.png delete mode 100644 themes/windows/Geolocation-64.png delete mode 100644 themes/windows/Info.png delete mode 100644 themes/windows/KUI-background.png delete mode 100644 themes/windows/KUI-close.png delete mode 100644 themes/windows/Makefile.in delete mode 100644 themes/windows/Privacy-16.png delete mode 100644 themes/windows/Privacy-32.png delete mode 100644 themes/windows/Privacy-48.png delete mode 100644 themes/windows/Privacy-64.png delete mode 100644 themes/windows/Push-16.png delete mode 100644 themes/windows/Push-64.png delete mode 100644 themes/windows/Secure24.png delete mode 100644 themes/windows/Toolbar-glass.png delete mode 100644 themes/windows/Toolbar-glass.svg delete mode 100644 themes/windows/Toolbar-inverted.png delete mode 100644 themes/windows/Toolbar-inverted.svg delete mode 100644 themes/windows/Toolbar.png delete mode 100644 themes/windows/Toolbar.svg delete mode 100644 themes/windows/aboutCertError.css delete mode 100644 themes/windows/aboutCertError_sectionCollapsed-rtl.png delete mode 100644 themes/windows/aboutCertError_sectionCollapsed.png delete mode 100644 themes/windows/aboutCertError_sectionExpanded.png delete mode 100644 themes/windows/aboutPrivateBrowsing.css delete mode 100644 themes/windows/aboutSessionRestore-window-icon.png delete mode 100644 themes/windows/aboutSessionRestore.css delete mode 100644 themes/windows/aboutSyncTabs.css delete mode 100644 themes/windows/actionicon-tab.png delete mode 100644 themes/windows/appmenu-dropmarker.png delete mode 100644 themes/windows/appmenu-icons.png delete mode 100644 themes/windows/autocomplete.css delete mode 100644 themes/windows/browser.css delete mode 100644 themes/windows/caption-buttons.svg delete mode 100644 themes/windows/click-to-play-warning-stripes.png delete mode 100644 themes/windows/communicator/communicator.css delete mode 100644 themes/windows/communicator/jar.mn delete mode 100644 themes/windows/communicator/moz.build delete mode 100644 themes/windows/downloads/allDownloadsViewOverlay.css delete mode 100644 themes/windows/downloads/buttons.png delete mode 100644 themes/windows/downloads/contentAreaDownloadsView.css delete mode 100644 themes/windows/downloads/download-notification-finish.png delete mode 100644 themes/windows/downloads/download-notification-start.png delete mode 100644 themes/windows/downloads/download-summary.png delete mode 100644 themes/windows/downloads/downloads.css delete mode 100644 themes/windows/engineManager.css delete mode 100644 themes/windows/feeds/feed-icons-16.png delete mode 100644 themes/windows/feeds/feedIcon.png delete mode 100644 themes/windows/feeds/feedIcon16.png delete mode 100644 themes/windows/feeds/subscribe-ui.css delete mode 100644 themes/windows/feeds/subscribe.css delete mode 100644 themes/windows/icon.png delete mode 100644 themes/windows/identity-icons-generic.png delete mode 100644 themes/windows/identity-icons-https-ev.png delete mode 100644 themes/windows/identity-icons-https-mixed-active.png delete mode 100644 themes/windows/identity-icons-https.png delete mode 100644 themes/windows/identity.png delete mode 100644 themes/windows/imagedocument.png delete mode 100644 themes/windows/jar.mn delete mode 100644 themes/windows/keyhole-forward-mask.svg delete mode 100644 themes/windows/livemark-folder.png delete mode 100644 themes/windows/menu-back.png delete mode 100644 themes/windows/menu-forward.png delete mode 100644 themes/windows/mixed-content-blocked-16.png delete mode 100644 themes/windows/mixed-content-blocked-64.png delete mode 100644 themes/windows/monitor.png delete mode 100644 themes/windows/monitor_16-10.png delete mode 100644 themes/windows/moz.build delete mode 100644 themes/windows/newtab/newTab.css delete mode 100644 themes/windows/pageInfo.css delete mode 100644 themes/windows/pageInfo.png delete mode 100644 themes/windows/permissions/aboutPermissions.css delete mode 100644 themes/windows/places/allBookmarks.png delete mode 100644 themes/windows/places/bookmark.png delete mode 100644 themes/windows/places/bookmarksMenu.png delete mode 100644 themes/windows/places/bookmarksToolbar.png delete mode 100644 themes/windows/places/calendar.png delete mode 100644 themes/windows/places/downloads.png delete mode 100644 themes/windows/places/editBookmark.png delete mode 100644 themes/windows/places/editBookmarkOverlay.css delete mode 100644 themes/windows/places/history.png delete mode 100644 themes/windows/places/libraryToolbar.png delete mode 100644 themes/windows/places/livemark-item.png delete mode 100644 themes/windows/places/organizer.css delete mode 100644 themes/windows/places/places.css delete mode 100644 themes/windows/places/query.png delete mode 100644 themes/windows/places/starred48.png delete mode 100644 themes/windows/places/tag.png delete mode 100644 themes/windows/places/toolbarDropMarker.png delete mode 100644 themes/windows/places/unsortedBookmarks.png delete mode 100644 themes/windows/places/unstarred48.png delete mode 100644 themes/windows/pointerLock-16.png delete mode 100644 themes/windows/pointerLock-64.png delete mode 100644 themes/windows/preferences/Options-sync.png delete mode 100644 themes/windows/preferences/Options.png delete mode 100644 themes/windows/preferences/alwaysAsk.png delete mode 100644 themes/windows/preferences/application.png delete mode 100644 themes/windows/preferences/applications.css delete mode 100644 themes/windows/preferences/mail.png delete mode 100644 themes/windows/preferences/preferences.css delete mode 100644 themes/windows/preferences/saveFile.png delete mode 100644 themes/windows/privatebrowsing-dark.png delete mode 100644 themes/windows/privatebrowsing-light.png delete mode 100644 themes/windows/reload-stop-go.png delete mode 100644 themes/windows/sanitize.png delete mode 100644 themes/windows/sanitizeDialog.css delete mode 100644 themes/windows/searchbar-dropdown-arrow.png delete mode 100644 themes/windows/searchbar.css delete mode 100644 themes/windows/setDesktopBackground.css delete mode 100644 themes/windows/slowStartup-16.png delete mode 100644 themes/windows/statusbar/overlay.css delete mode 100644 themes/windows/statusbar/prefs.css delete mode 100644 themes/windows/sync-128.png delete mode 100644 themes/windows/sync-16.png delete mode 100644 themes/windows/sync-32.png delete mode 100644 themes/windows/sync-bg.png delete mode 100644 themes/windows/sync-desktopIcon.png delete mode 100644 themes/windows/sync-mobileIcon.png delete mode 100644 themes/windows/sync-throbber.png delete mode 100644 themes/windows/syncCommon.css delete mode 100644 themes/windows/syncProgress.css delete mode 100644 themes/windows/syncQuota.css delete mode 100644 themes/windows/syncSetup.css delete mode 100644 themes/windows/tabbrowser/alltabs-inverted.png delete mode 100644 themes/windows/tabbrowser/alltabs.png delete mode 100644 themes/windows/tabbrowser/connecting.png delete mode 100644 themes/windows/tabbrowser/loading.png delete mode 100644 themes/windows/tabbrowser/newtab-glass.png delete mode 100644 themes/windows/tabbrowser/newtab-inverted.png delete mode 100644 themes/windows/tabbrowser/newtab.png delete mode 100644 themes/windows/tabbrowser/tab-arrow-left-glass.png delete mode 100644 themes/windows/tabbrowser/tab-arrow-left-inverted.png delete mode 100644 themes/windows/tabbrowser/tab-arrow-left.png delete mode 100644 themes/windows/tabbrowser/tab-overflow-border.png delete mode 100644 themes/windows/tabbrowser/tabDragIndicator.png delete mode 100644 themes/windows/toolbarbutton-dropdown-arrow-inverted.png delete mode 100644 themes/windows/toolbarbutton-dropdown-arrow.png delete mode 100644 themes/windows/urlbar-arrow.png delete mode 100644 themes/windows/urlbar-history-dropmarker.png delete mode 100644 themes/windows/urlbar-popup-blocked.png delete mode 100644 themes/windows/web-notifications-icon.svg delete mode 100644 themes/windows/web-notifications-tray.svg delete mode 100644 themes/windows/webRTC-shareDevice-16.png delete mode 100644 themes/windows/webRTC-shareDevice-64.png delete mode 100644 themes/windows/webRTC-sharingDevice-16.png create mode 100644 webbrowser/LICENSE create mode 100644 webbrowser/Makefile.in create mode 100644 webbrowser/app-rules.mk create mode 100644 webbrowser/app.mozbuild create mode 100644 webbrowser/app/Makefile.in create mode 100644 webbrowser/app/application.ini create mode 100644 webbrowser/app/blocklist.xml create mode 100644 webbrowser/app/macbuild/Contents/CodeResources create mode 100644 webbrowser/app/macbuild/Contents/Info.plist.in create mode 100644 webbrowser/app/macbuild/Contents/MacOS-files.in create mode 100644 webbrowser/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in create mode 100644 webbrowser/app/macbuild/Contents/_CodeSignature/CodeResources create mode 100644 webbrowser/app/macversion.py create mode 100644 webbrowser/app/module.ver create mode 100644 webbrowser/app/moz.build create mode 100644 webbrowser/app/nsBrowserApp.cpp create mode 100644 webbrowser/app/palemoon.exe.manifest create mode 100644 webbrowser/app/permissions create mode 100644 webbrowser/app/profile/channel-prefs.js create mode 100644 webbrowser/app/profile/extensions/moz.build create mode 100644 webbrowser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/Makefile.in create mode 100644 webbrowser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf.in create mode 100644 webbrowser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/moz.build create mode 100644 webbrowser/app/profile/pagethemes.rdf create mode 100644 webbrowser/app/profile/prefs.js create mode 100644 webbrowser/app/profile/webbrowser.js create mode 100644 webbrowser/app/splash.rc create mode 100644 webbrowser/base/content/aboutDialog.css create mode 100644 webbrowser/base/content/aboutDialog.js create mode 100644 webbrowser/base/content/aboutDialog.xul create mode 100644 webbrowser/base/content/autocomplete.css create mode 100644 webbrowser/base/content/autocomplete.xml create mode 100644 webbrowser/base/content/autorecovery.js create mode 100644 webbrowser/base/content/autorecovery.xul create mode 100644 webbrowser/base/content/baseMenuOverlay.xul create mode 100644 webbrowser/base/content/browser-addons.js create mode 100644 webbrowser/base/content/browser-appmenu.inc create mode 100644 webbrowser/base/content/browser-charsetmenu.inc create mode 100644 webbrowser/base/content/browser-context.inc create mode 100644 webbrowser/base/content/browser-devtools-theme.js create mode 100644 webbrowser/base/content/browser-doctype.inc create mode 100644 webbrowser/base/content/browser-feeds.js create mode 100644 webbrowser/base/content/browser-fullScreen.js create mode 100644 webbrowser/base/content/browser-fullZoom.js create mode 100644 webbrowser/base/content/browser-gestureSupport.js create mode 100644 webbrowser/base/content/browser-menubar.inc create mode 100644 webbrowser/base/content/browser-menudragging.js create mode 100644 webbrowser/base/content/browser-menudragging.xul create mode 100644 webbrowser/base/content/browser-places.js create mode 100644 webbrowser/base/content/browser-plugins.js create mode 100644 webbrowser/base/content/browser-sets.inc create mode 100644 webbrowser/base/content/browser-syncui.js create mode 100644 webbrowser/base/content/browser-tabPreviews.js create mode 100644 webbrowser/base/content/browser-tabPreviews.xml create mode 100644 webbrowser/base/content/browser-thumbnails.js create mode 100644 webbrowser/base/content/browser-title.css create mode 100644 webbrowser/base/content/browser-uacompat.js create mode 100644 webbrowser/base/content/browser-webrtcUI.js create mode 100644 webbrowser/base/content/browser.css create mode 100644 webbrowser/base/content/browser.js create mode 100644 webbrowser/base/content/browser.xul create mode 100644 webbrowser/base/content/browserMountPoints.inc create mode 100644 webbrowser/base/content/content.js create mode 100644 webbrowser/base/content/downloadManagerOverlay.xul create mode 100644 webbrowser/base/content/global-devtools-theme-scripts.inc create mode 100644 webbrowser/base/content/global-scripts.inc create mode 100644 webbrowser/base/content/hiddenWindow.xul create mode 100644 webbrowser/base/content/highlighter.css create mode 100644 webbrowser/base/content/jsConsoleOverlay.xul create mode 100644 webbrowser/base/content/macBrowserOverlay.xul create mode 100644 webbrowser/base/content/nsContextMenu.js create mode 100644 webbrowser/base/content/openLocation.js create mode 100644 webbrowser/base/content/openLocation.xul create mode 100644 webbrowser/base/content/overrides/app-license.html create mode 100644 webbrowser/base/content/padlock.css create mode 100644 webbrowser/base/content/padlock.js create mode 100644 webbrowser/base/content/padlock.xul create mode 100644 webbrowser/base/content/padlock_classic_broken.png create mode 100644 webbrowser/base/content/padlock_classic_ev.png create mode 100644 webbrowser/base/content/padlock_classic_https.png create mode 100644 webbrowser/base/content/padlock_classic_low.png create mode 100644 webbrowser/base/content/padlock_mod_broken.png create mode 100644 webbrowser/base/content/padlock_mod_ev.png create mode 100644 webbrowser/base/content/padlock_mod_https.png create mode 100644 webbrowser/base/content/padlock_mod_low.png create mode 100644 webbrowser/base/content/palemoon.xhtml create mode 100644 webbrowser/base/content/popup-notifications.inc create mode 100644 webbrowser/base/content/safeMode.css create mode 100644 webbrowser/base/content/safeMode.js create mode 100644 webbrowser/base/content/safeMode.xul create mode 100644 webbrowser/base/content/sanitize.js create mode 100644 webbrowser/base/content/sanitize.xul create mode 100644 webbrowser/base/content/sanitizeDialog.css create mode 100644 webbrowser/base/content/sanitizeDialog.js create mode 100644 webbrowser/base/content/softwareUpdateOverlay.xul create mode 100644 webbrowser/base/content/tabbrowser.css create mode 100644 webbrowser/base/content/tabbrowser.xml create mode 100644 webbrowser/base/content/test/general/audio.ogg create mode 100644 webbrowser/base/content/urlbarBindings.xml create mode 100644 webbrowser/base/content/utilityOverlay.js create mode 100644 webbrowser/base/content/viewSourceOverlay.xul create mode 100644 webbrowser/base/content/web-panels.js create mode 100644 webbrowser/base/content/web-panels.xul create mode 100644 webbrowser/base/content/win6BrowserOverlay.xul create mode 100644 webbrowser/base/jar.mn create mode 100644 webbrowser/base/moz.build create mode 100644 webbrowser/branding/shared/background.png create mode 100644 webbrowser/branding/shared/branding.mozbuild create mode 100644 webbrowser/branding/shared/locales/browserconfig.properties create mode 100644 webbrowser/branding/shared/newtab.ico create mode 100644 webbrowser/branding/shared/newwindow.ico create mode 100644 webbrowser/branding/shared/pbmode.ico create mode 100644 webbrowser/branding/shared/pref/preferences.inc create mode 100644 webbrowser/branding/shared/pref/uaoverrides.inc create mode 100644 webbrowser/branding/unofficial/VisualElements_150.png create mode 100644 webbrowser/branding/unofficial/VisualElements_70.png create mode 100644 webbrowser/branding/unofficial/appname.bmp create mode 100644 webbrowser/branding/unofficial/branding.nsi create mode 100644 webbrowser/branding/unofficial/configure.sh create mode 100644 webbrowser/branding/unofficial/content/about-background.png create mode 100644 webbrowser/branding/unofficial/content/about-logo.png create mode 100644 webbrowser/branding/unofficial/content/about-logo@2x.png create mode 100644 webbrowser/branding/unofficial/content/about.png create mode 100644 webbrowser/branding/unofficial/content/aboutDialog.css create mode 100644 webbrowser/branding/unofficial/content/icon48.png create mode 100644 webbrowser/branding/unofficial/content/icon64.png create mode 100644 webbrowser/branding/unofficial/content/jar.mn create mode 100644 webbrowser/branding/unofficial/content/moz.build create mode 100644 webbrowser/branding/unofficial/default16.png create mode 100644 webbrowser/branding/unofficial/default32.png create mode 100644 webbrowser/branding/unofficial/default48.png create mode 100644 webbrowser/branding/unofficial/disk.icns create mode 100644 webbrowser/branding/unofficial/document.icns create mode 100644 webbrowser/branding/unofficial/document.ico create mode 100644 webbrowser/branding/unofficial/dsstore create mode 100644 webbrowser/branding/unofficial/firefox.icns create mode 100644 webbrowser/branding/unofficial/firefox.ico create mode 100644 webbrowser/branding/unofficial/locales/browserconfig.properties create mode 100644 webbrowser/branding/unofficial/locales/en-US/brand.dtd create mode 100644 webbrowser/branding/unofficial/locales/en-US/brand.properties create mode 100644 webbrowser/branding/unofficial/locales/jar.mn create mode 100644 webbrowser/branding/unofficial/locales/moz.build create mode 100644 webbrowser/branding/unofficial/moz.build create mode 100644 webbrowser/branding/unofficial/mozicon128.png create mode 100644 webbrowser/branding/unofficial/pref/webbrowser-branding.js create mode 100644 webbrowser/branding/unofficial/webbrowser.VisualElementsManifest.xml create mode 100644 webbrowser/branding/unofficial/webbrowser.desktop create mode 100644 webbrowser/branding/unofficial/wizHeader.bmp create mode 100644 webbrowser/branding/unofficial/wizHeaderRTL.bmp create mode 100644 webbrowser/branding/unofficial/wizWatermark.bmp create mode 100644 webbrowser/branding/unstable/VisualElements_150.png create mode 100644 webbrowser/branding/unstable/VisualElements_70.png create mode 100644 webbrowser/branding/unstable/appname.bmp create mode 100644 webbrowser/branding/unstable/branding.nsi create mode 100644 webbrowser/branding/unstable/configure.sh create mode 100644 webbrowser/branding/unstable/content/about-background.jpg create mode 100644 webbrowser/branding/unstable/content/about-logo.png create mode 100644 webbrowser/branding/unstable/content/about-logo@2x.png create mode 100644 webbrowser/branding/unstable/content/about-wordmark.png create mode 100644 webbrowser/branding/unstable/content/about.png create mode 100644 webbrowser/branding/unstable/content/aboutDialog.css create mode 100644 webbrowser/branding/unstable/content/icon48.png create mode 100644 webbrowser/branding/unstable/content/icon64.png create mode 100644 webbrowser/branding/unstable/content/jar.mn create mode 100644 webbrowser/branding/unstable/content/moz.build create mode 100644 webbrowser/branding/unstable/default16.png create mode 100644 webbrowser/branding/unstable/default32.png create mode 100644 webbrowser/branding/unstable/default48.png create mode 100644 webbrowser/branding/unstable/disk.icns create mode 100644 webbrowser/branding/unstable/document.icns create mode 100644 webbrowser/branding/unstable/document.ico create mode 100644 webbrowser/branding/unstable/dsstore create mode 100644 webbrowser/branding/unstable/firefox.icns create mode 100644 webbrowser/branding/unstable/firefox.ico create mode 100644 webbrowser/branding/unstable/locales/en-US/brand.dtd create mode 100644 webbrowser/branding/unstable/locales/en-US/brand.properties create mode 100644 webbrowser/branding/unstable/locales/jar.mn create mode 100644 webbrowser/branding/unstable/locales/moz.build create mode 100644 webbrowser/branding/unstable/moz.build create mode 100644 webbrowser/branding/unstable/mozicon128.png create mode 100644 webbrowser/branding/unstable/palemoon.VisualElementsManifest.xml create mode 100644 webbrowser/branding/unstable/pref/palemoon-branding.js create mode 100644 webbrowser/branding/unstable/wizHeader.bmp create mode 100644 webbrowser/branding/unstable/wizHeaderRTL.bmp create mode 100644 webbrowser/branding/unstable/wizWatermark.bmp create mode 100644 webbrowser/build.mk create mode 100644 webbrowser/components/BrowserComponents.manifest create mode 100644 webbrowser/components/abouthome/aboutHome.css create mode 100644 webbrowser/components/abouthome/aboutHome.js create mode 100644 webbrowser/components/abouthome/aboutHome.xhtml create mode 100644 webbrowser/components/abouthome/addons.png create mode 100644 webbrowser/components/abouthome/addons@2x.png create mode 100644 webbrowser/components/abouthome/bookmarks.png create mode 100644 webbrowser/components/abouthome/bookmarks@2x.png create mode 100644 webbrowser/components/abouthome/downloads.png create mode 100644 webbrowser/components/abouthome/downloads@2x.png create mode 100644 webbrowser/components/abouthome/history.png create mode 100644 webbrowser/components/abouthome/history@2x.png create mode 100644 webbrowser/components/abouthome/jar.mn create mode 100644 webbrowser/components/abouthome/moz.build create mode 100644 webbrowser/components/abouthome/noise.png create mode 100644 webbrowser/components/abouthome/restore-large.png create mode 100644 webbrowser/components/abouthome/restore-large@2x.png create mode 100644 webbrowser/components/abouthome/restore.png create mode 100644 webbrowser/components/abouthome/restore@2x.png create mode 100644 webbrowser/components/abouthome/settings.png create mode 100644 webbrowser/components/abouthome/settings@2x.png create mode 100644 webbrowser/components/abouthome/snippet1.png create mode 100644 webbrowser/components/abouthome/snippet1@2x.png create mode 100644 webbrowser/components/abouthome/snippet2.png create mode 100644 webbrowser/components/abouthome/snippet2@2x.png create mode 100644 webbrowser/components/abouthome/sync.png create mode 100644 webbrowser/components/abouthome/sync@2x.png create mode 100644 webbrowser/components/build/Makefile.in create mode 100644 webbrowser/components/build/moz.build create mode 100644 webbrowser/components/build/nsBrowserCompsCID.h create mode 100644 webbrowser/components/build/nsModule.cpp create mode 100644 webbrowser/components/certerror/content/aboutCertError.css create mode 100644 webbrowser/components/certerror/content/aboutCertError.xhtml create mode 100644 webbrowser/components/certerror/jar.mn create mode 100644 webbrowser/components/certerror/moz.build create mode 100644 webbrowser/components/dirprovider/DirectoryProvider.cpp create mode 100644 webbrowser/components/dirprovider/DirectoryProvider.h create mode 100644 webbrowser/components/dirprovider/moz.build create mode 100644 webbrowser/components/distribution.js create mode 100644 webbrowser/components/downloads/BrowserDownloads.manifest create mode 100644 webbrowser/components/downloads/DownloadsCommon.jsm create mode 100644 webbrowser/components/downloads/DownloadsLogger.jsm create mode 100644 webbrowser/components/downloads/DownloadsStartup.js create mode 100644 webbrowser/components/downloads/DownloadsTaskbar.jsm create mode 100644 webbrowser/components/downloads/DownloadsUI.js create mode 100644 webbrowser/components/downloads/DownloadsViewUI.jsm create mode 100644 webbrowser/components/downloads/content/allDownloadsViewOverlay.css create mode 100644 webbrowser/components/downloads/content/allDownloadsViewOverlay.js create mode 100644 webbrowser/components/downloads/content/allDownloadsViewOverlay.xul create mode 100644 webbrowser/components/downloads/content/contentAreaDownloadsView.css create mode 100644 webbrowser/components/downloads/content/contentAreaDownloadsView.js create mode 100644 webbrowser/components/downloads/content/contentAreaDownloadsView.xul create mode 100644 webbrowser/components/downloads/content/download.css create mode 100644 webbrowser/components/downloads/content/download.xml create mode 100644 webbrowser/components/downloads/content/downloads.css create mode 100644 webbrowser/components/downloads/content/downloads.js create mode 100644 webbrowser/components/downloads/content/downloadsOverlay.xul create mode 100644 webbrowser/components/downloads/content/indicator.js create mode 100644 webbrowser/components/downloads/content/indicatorOverlay.xul create mode 100644 webbrowser/components/downloads/jar.mn create mode 100644 webbrowser/components/downloads/moz.build create mode 100644 webbrowser/components/feeds/BrowserFeeds.manifest create mode 100644 webbrowser/components/feeds/FeedConverter.js create mode 100644 webbrowser/components/feeds/FeedWriter.js create mode 100644 webbrowser/components/feeds/WebContentConverter.js create mode 100644 webbrowser/components/feeds/content/subscribe.css create mode 100644 webbrowser/components/feeds/content/subscribe.js create mode 100644 webbrowser/components/feeds/content/subscribe.xhtml create mode 100644 webbrowser/components/feeds/content/subscribe.xml create mode 100644 webbrowser/components/feeds/jar.mn create mode 100644 webbrowser/components/feeds/moz.build create mode 100644 webbrowser/components/feeds/nsFeedSniffer.cpp create mode 100644 webbrowser/components/feeds/nsFeedSniffer.h create mode 100644 webbrowser/components/feeds/nsIFeedResultService.idl create mode 100644 webbrowser/components/feeds/nsIWebContentConverterRegistrar.idl create mode 100644 webbrowser/components/fuel/fuelApplication.js create mode 100644 webbrowser/components/fuel/fuelApplication.manifest create mode 100644 webbrowser/components/fuel/fuelIApplication.idl create mode 100644 webbrowser/components/fuel/moz.build create mode 100644 webbrowser/components/moz.build create mode 100644 webbrowser/components/newtab/cells.js create mode 100644 webbrowser/components/newtab/drag.js create mode 100644 webbrowser/components/newtab/dragDataHelper.js create mode 100644 webbrowser/components/newtab/drop.js create mode 100644 webbrowser/components/newtab/dropPreview.js create mode 100644 webbrowser/components/newtab/dropTargetShim.js create mode 100644 webbrowser/components/newtab/grid.js create mode 100644 webbrowser/components/newtab/jar.mn create mode 100644 webbrowser/components/newtab/moz.build create mode 100644 webbrowser/components/newtab/newTab.css create mode 100644 webbrowser/components/newtab/newTab.js create mode 100644 webbrowser/components/newtab/newTab.xhtml create mode 100644 webbrowser/components/newtab/page.js create mode 100644 webbrowser/components/newtab/search.js create mode 100644 webbrowser/components/newtab/sites.js create mode 100644 webbrowser/components/newtab/transformations.js create mode 100644 webbrowser/components/newtab/undo.js create mode 100644 webbrowser/components/newtab/updater.js create mode 100644 webbrowser/components/nsAboutRedirector.js create mode 100644 webbrowser/components/nsBrowserContentHandler.js create mode 100644 webbrowser/components/nsBrowserGlue.js create mode 100644 webbrowser/components/nsIBrowserGlue.idl create mode 100644 webbrowser/components/nsIBrowserHandler.idl create mode 100644 webbrowser/components/pageinfo/feeds.js create mode 100644 webbrowser/components/pageinfo/feeds.xml create mode 100644 webbrowser/components/pageinfo/jar.mn create mode 100644 webbrowser/components/pageinfo/moz.build create mode 100644 webbrowser/components/pageinfo/pageInfo.css create mode 100644 webbrowser/components/pageinfo/pageInfo.js create mode 100644 webbrowser/components/pageinfo/pageInfo.xml create mode 100644 webbrowser/components/pageinfo/pageInfo.xul create mode 100644 webbrowser/components/pageinfo/permissions.js create mode 100644 webbrowser/components/pageinfo/security.js create mode 100644 webbrowser/components/permissions/aboutPermissions.css create mode 100644 webbrowser/components/permissions/aboutPermissions.js create mode 100644 webbrowser/components/permissions/aboutPermissions.xml create mode 100644 webbrowser/components/permissions/aboutPermissions.xul create mode 100644 webbrowser/components/permissions/jar.mn create mode 100644 webbrowser/components/permissions/moz.build create mode 100644 webbrowser/components/places/PlacesUIUtils.jsm create mode 100644 webbrowser/components/places/content/bookmarkProperties.js create mode 100644 webbrowser/components/places/content/bookmarkProperties.xul create mode 100644 webbrowser/components/places/content/bookmarksPanel.js create mode 100644 webbrowser/components/places/content/bookmarksPanel.xul create mode 100644 webbrowser/components/places/content/browserPlacesViews.js create mode 100644 webbrowser/components/places/content/controller.js create mode 100644 webbrowser/components/places/content/downloadsViewOverlay.xul create mode 100644 webbrowser/components/places/content/editBookmarkOverlay.js create mode 100644 webbrowser/components/places/content/editBookmarkOverlay.xul create mode 100644 webbrowser/components/places/content/history-panel.js create mode 100644 webbrowser/components/places/content/history-panel.xul create mode 100644 webbrowser/components/places/content/menu.xml create mode 100644 webbrowser/components/places/content/moveBookmarks.js create mode 100644 webbrowser/components/places/content/moveBookmarks.xul create mode 100644 webbrowser/components/places/content/organizer.css create mode 100644 webbrowser/components/places/content/places.css create mode 100644 webbrowser/components/places/content/places.js create mode 100644 webbrowser/components/places/content/places.xul create mode 100644 webbrowser/components/places/content/placesOverlay.xul create mode 100644 webbrowser/components/places/content/sidebarUtils.js create mode 100644 webbrowser/components/places/content/tree.xml create mode 100644 webbrowser/components/places/content/treeView.js create mode 100644 webbrowser/components/places/jar.mn create mode 100644 webbrowser/components/places/moz.build create mode 100644 webbrowser/components/preferences/advanced.js create mode 100644 webbrowser/components/preferences/advanced.xul create mode 100644 webbrowser/components/preferences/applicationManager.js create mode 100644 webbrowser/components/preferences/applicationManager.xul create mode 100644 webbrowser/components/preferences/applications.js create mode 100644 webbrowser/components/preferences/applications.xul create mode 100644 webbrowser/components/preferences/colors.xul create mode 100644 webbrowser/components/preferences/connection.js create mode 100644 webbrowser/components/preferences/connection.xul create mode 100644 webbrowser/components/preferences/content.js create mode 100644 webbrowser/components/preferences/content.xul create mode 100644 webbrowser/components/preferences/cookies.js create mode 100644 webbrowser/components/preferences/cookies.xul create mode 100644 webbrowser/components/preferences/fonts.js create mode 100644 webbrowser/components/preferences/fonts.xul create mode 100644 webbrowser/components/preferences/handlers.css create mode 100644 webbrowser/components/preferences/handlers.xml create mode 100644 webbrowser/components/preferences/jar.mn create mode 100644 webbrowser/components/preferences/languages.js create mode 100644 webbrowser/components/preferences/languages.xul create mode 100644 webbrowser/components/preferences/main.js create mode 100644 webbrowser/components/preferences/main.xul create mode 100644 webbrowser/components/preferences/moz.build create mode 100644 webbrowser/components/preferences/newtaburl.js create mode 100644 webbrowser/components/preferences/permissions.js create mode 100644 webbrowser/components/preferences/permissions.xul create mode 100644 webbrowser/components/preferences/preferences.xul create mode 100644 webbrowser/components/preferences/privacy.js create mode 100644 webbrowser/components/preferences/privacy.xul create mode 100644 webbrowser/components/preferences/sanitize.js create mode 100644 webbrowser/components/preferences/sanitize.xul create mode 100644 webbrowser/components/preferences/security.js create mode 100644 webbrowser/components/preferences/security.xul create mode 100644 webbrowser/components/preferences/selectBookmark.js create mode 100644 webbrowser/components/preferences/selectBookmark.xul create mode 100644 webbrowser/components/preferences/sync.js create mode 100644 webbrowser/components/preferences/sync.xul create mode 100644 webbrowser/components/preferences/tabs.js create mode 100644 webbrowser/components/preferences/tabs.xul create mode 100644 webbrowser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml create mode 100644 webbrowser/components/privatebrowsing/jar.mn create mode 100644 webbrowser/components/privatebrowsing/moz.build create mode 100644 webbrowser/components/search/content/engineManager.js create mode 100644 webbrowser/components/search/content/engineManager.xul create mode 100644 webbrowser/components/search/content/search.xml create mode 100644 webbrowser/components/search/content/searchbarBindings.css create mode 100644 webbrowser/components/search/jar.mn create mode 100644 webbrowser/components/search/moz.build create mode 100644 webbrowser/components/sessionstore/DocumentUtils.jsm create mode 100644 webbrowser/components/sessionstore/SessionStorage.jsm create mode 100644 webbrowser/components/sessionstore/SessionStore.jsm create mode 100644 webbrowser/components/sessionstore/XPathGenerator.jsm create mode 100644 webbrowser/components/sessionstore/_SessionFile.jsm create mode 100644 webbrowser/components/sessionstore/content/aboutSessionRestore.js create mode 100644 webbrowser/components/sessionstore/content/aboutSessionRestore.xhtml create mode 100644 webbrowser/components/sessionstore/content/content-sessionStore.js create mode 100644 webbrowser/components/sessionstore/jar.mn create mode 100644 webbrowser/components/sessionstore/moz.build create mode 100644 webbrowser/components/sessionstore/nsISessionStartup.idl create mode 100644 webbrowser/components/sessionstore/nsISessionStore.idl create mode 100644 webbrowser/components/sessionstore/nsSessionStartup.js create mode 100644 webbrowser/components/sessionstore/nsSessionStore.js create mode 100644 webbrowser/components/sessionstore/nsSessionStore.manifest create mode 100644 webbrowser/components/shell/ShellService.jsm create mode 100644 webbrowser/components/shell/content/setDesktopBackground.js create mode 100644 webbrowser/components/shell/content/setDesktopBackground.xul create mode 100644 webbrowser/components/shell/jar.mn create mode 100644 webbrowser/components/shell/moz.build create mode 100644 webbrowser/components/shell/nsGNOMEShellService.cpp create mode 100644 webbrowser/components/shell/nsGNOMEShellService.h create mode 100644 webbrowser/components/shell/nsIGNOMEShellService.idl create mode 100644 webbrowser/components/shell/nsIMacShellService.idl create mode 100644 webbrowser/components/shell/nsIShellService.idl create mode 100644 webbrowser/components/shell/nsIWindowsShellService.idl create mode 100644 webbrowser/components/shell/nsMacShellService.cpp create mode 100644 webbrowser/components/shell/nsMacShellService.h create mode 100644 webbrowser/components/shell/nsSetDefaultBrowser.js create mode 100644 webbrowser/components/shell/nsSetDefaultBrowser.manifest create mode 100644 webbrowser/components/shell/nsShellService.h create mode 100644 webbrowser/components/shell/nsWindowsShellService.cpp create mode 100644 webbrowser/components/shell/nsWindowsShellService.h create mode 100644 webbrowser/components/statusbar/Downloads.jsm create mode 100644 webbrowser/components/statusbar/Progress.jsm create mode 100644 webbrowser/components/statusbar/Status.jsm create mode 100644 webbrowser/components/statusbar/Status4Evar.jsm create mode 100644 webbrowser/components/statusbar/Toolbars.jsm create mode 100644 webbrowser/components/statusbar/content-thunk.js create mode 100644 webbrowser/components/statusbar/content/overlay.css create mode 100644 webbrowser/components/statusbar/content/overlay.js create mode 100644 webbrowser/components/statusbar/content/overlay.xul create mode 100644 webbrowser/components/statusbar/content/prefs.css create mode 100644 webbrowser/components/statusbar/content/prefs.js create mode 100644 webbrowser/components/statusbar/content/prefs.xml create mode 100644 webbrowser/components/statusbar/content/prefs.xul create mode 100644 webbrowser/components/statusbar/content/tabbrowser.xml create mode 100644 webbrowser/components/statusbar/jar.mn create mode 100644 webbrowser/components/statusbar/moz.build create mode 100644 webbrowser/components/statusbar/status4evar.idl create mode 100644 webbrowser/components/statusbar/status4evar.js create mode 100644 webbrowser/components/statusbar/status4evar.manifest create mode 100644 webbrowser/components/sync/aboutSyncTabs-bindings.xml create mode 100644 webbrowser/components/sync/aboutSyncTabs.css create mode 100644 webbrowser/components/sync/aboutSyncTabs.js create mode 100644 webbrowser/components/sync/aboutSyncTabs.xul create mode 100644 webbrowser/components/sync/addDevice.js create mode 100644 webbrowser/components/sync/addDevice.xul create mode 100644 webbrowser/components/sync/genericChange.js create mode 100644 webbrowser/components/sync/genericChange.xul create mode 100644 webbrowser/components/sync/jar.mn create mode 100644 webbrowser/components/sync/key.xhtml create mode 100644 webbrowser/components/sync/moz.build create mode 100644 webbrowser/components/sync/notification.xml create mode 100644 webbrowser/components/sync/progress.js create mode 100644 webbrowser/components/sync/progress.xhtml create mode 100644 webbrowser/components/sync/quota.js create mode 100644 webbrowser/components/sync/quota.xul create mode 100644 webbrowser/components/sync/setup.js create mode 100644 webbrowser/components/sync/setup.xul create mode 100644 webbrowser/components/sync/utils.js create mode 100644 webbrowser/config/mozconfig create mode 100644 webbrowser/config/mozconfigs/common create mode 100644 webbrowser/config/mozconfigs/linux32/beta create mode 100644 webbrowser/config/mozconfigs/linux32/common-opt create mode 100644 webbrowser/config/mozconfigs/linux32/debug create mode 100644 webbrowser/config/mozconfigs/linux32/debug-asan create mode 100644 webbrowser/config/mozconfigs/linux32/l10n-mozconfig create mode 100644 webbrowser/config/mozconfigs/linux32/release create mode 100644 webbrowser/config/mozconfigs/linux32/valgrind create mode 100644 webbrowser/config/mozconfigs/linux64/beta create mode 100644 webbrowser/config/mozconfigs/linux64/common-opt create mode 100644 webbrowser/config/mozconfigs/linux64/debug create mode 100644 webbrowser/config/mozconfigs/linux64/debug-asan create mode 100644 webbrowser/config/mozconfigs/linux64/debug-static-analysis-clang create mode 100644 webbrowser/config/mozconfigs/linux64/l10n-mozconfig create mode 100644 webbrowser/config/mozconfigs/linux64/release create mode 100644 webbrowser/config/mozconfigs/linux64/valgrind create mode 100644 webbrowser/config/mozconfigs/macosx-universal/beta create mode 100644 webbrowser/config/mozconfigs/macosx-universal/common-opt create mode 100644 webbrowser/config/mozconfigs/macosx-universal/l10n-mozconfig create mode 100644 webbrowser/config/mozconfigs/macosx-universal/release create mode 100644 webbrowser/config/mozconfigs/macosx64/debug create mode 100644 webbrowser/config/mozconfigs/macosx64/debug-asan create mode 100644 webbrowser/config/mozconfigs/macosx64/l10n-mozconfig create mode 100644 webbrowser/config/mozconfigs/win32/beta create mode 100644 webbrowser/config/mozconfigs/win32/common-opt create mode 100644 webbrowser/config/mozconfigs/win32/debug create mode 100644 webbrowser/config/mozconfigs/win32/l10n-mozconfig create mode 100644 webbrowser/config/mozconfigs/win32/release create mode 100644 webbrowser/config/mozconfigs/win64/debug create mode 100644 webbrowser/config/mozconfigs/win64/nightly create mode 100644 webbrowser/config/tooltool-manifests/linux32/clang.manifest create mode 100644 webbrowser/config/tooltool-manifests/linux32/releng.manifest create mode 100644 webbrowser/config/tooltool-manifests/linux64/clang.manifest create mode 100644 webbrowser/config/tooltool-manifests/linux64/releng.manifest create mode 100644 webbrowser/config/tooltool-manifests/macosx64/releng.manifest create mode 100644 webbrowser/config/version.txt create mode 100644 webbrowser/configure.in create mode 100644 webbrowser/confvars.sh create mode 100644 webbrowser/defs.mk create mode 100644 webbrowser/doc/BUILD create mode 100644 webbrowser/doc/mozconfig.example create mode 100644 webbrowser/installer/Makefile.in create mode 100644 webbrowser/installer/moz.build create mode 100644 webbrowser/installer/package-manifest.in create mode 100644 webbrowser/installer/removed-files.in create mode 100644 webbrowser/installer/windows/Makefile.in create mode 100644 webbrowser/installer/windows/app.tag create mode 100644 webbrowser/installer/windows/moz.build create mode 100644 webbrowser/installer/windows/nsis/defines.nsi.in create mode 100644 webbrowser/installer/windows/nsis/installer.nsi create mode 100644 webbrowser/installer/windows/nsis/shared.nsh create mode 100644 webbrowser/installer/windows/nsis/uninstaller.nsi create mode 100644 webbrowser/installer/windows/nsis/updater_append.ini create mode 100644 webbrowser/locales/Makefile.in create mode 100644 webbrowser/locales/all-locales create mode 100644 webbrowser/locales/en-US/chrome/browser-region/region.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/aboutCertError.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/aboutDialog.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/aboutHome.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/aboutPrivateBrowsing.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/aboutSessionRestore.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/aboutSyncTabs.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/baseMenuOverlay.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/browser.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/browser.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/charsetMenu.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/charsetMenu.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/charsetOverlay.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/downloads/downloads.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/downloads/downloads.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/engineManager.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/engineManager.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/feeds/subscribe.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/feeds/subscribe.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/newTab.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/newTab.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/openLocation.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/openLocation.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/pageInfo.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/pageInfo.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/palemoon.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/permissions/aboutPermissions.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/permissions/aboutPermissions.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/places/bookmarkProperties.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/places/editBookmarkOverlay.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/places/moveBookmarks.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/places/places.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/places/places.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/advanced.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/applicationManager.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/applicationManager.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/applications.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/colors.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/connection.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/content.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/cookies.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/fonts.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/languages.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/main.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/permissions.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/preferences.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/preferences.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/privacy.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/security.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/selectBookmark.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/sync.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/preferences/tabs.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/quitDialog.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/safeMode.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/sanitize.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/search.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/searchbar.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/setDesktopBackground.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/shellservice.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/statusbar/meta.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/statusbar/overlay.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/statusbar/prefs.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/statusbar/statusbar-overlay.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/statusbar/statusbar-prefs.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/syncBrand.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/syncGenericChange.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/syncKey.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/syncProgress.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/syncQuota.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/syncQuota.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/syncSetup.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/syncSetup.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/tabbrowser.dtd create mode 100644 webbrowser/locales/en-US/chrome/browser/tabbrowser.properties create mode 100644 webbrowser/locales/en-US/chrome/browser/taskbar.properties create mode 100644 webbrowser/locales/en-US/chrome/overrides/appstrings.properties create mode 100644 webbrowser/locales/en-US/chrome/overrides/netError.dtd create mode 100644 webbrowser/locales/en-US/chrome/overrides/settingsChange.dtd create mode 100644 webbrowser/locales/en-US/crashreporter/crashreporter-override.ini create mode 100644 webbrowser/locales/en-US/defines.inc create mode 100644 webbrowser/locales/en-US/installer/custom.properties create mode 100644 webbrowser/locales/en-US/installer/mui.properties create mode 100644 webbrowser/locales/en-US/installer/override.properties create mode 100644 webbrowser/locales/en-US/profile/bookmarks.inc create mode 100644 webbrowser/locales/en-US/profile/chrome/userChrome-example.css create mode 100644 webbrowser/locales/en-US/profile/chrome/userContent-example.css create mode 100644 webbrowser/locales/en-US/searchplugins/amazondotcom.xml create mode 100644 webbrowser/locales/en-US/searchplugins/answers.xml create mode 100644 webbrowser/locales/en-US/searchplugins/bing.xml create mode 100644 webbrowser/locales/en-US/searchplugins/creativecommons.xml create mode 100644 webbrowser/locales/en-US/searchplugins/duckduckgo-html.xml create mode 100644 webbrowser/locales/en-US/searchplugins/duckduckgo.xml create mode 100644 webbrowser/locales/en-US/searchplugins/eBay.xml create mode 100644 webbrowser/locales/en-US/searchplugins/list.txt create mode 100644 webbrowser/locales/en-US/searchplugins/wikipedia.xml create mode 100644 webbrowser/locales/en-US/searchplugins/yahoo.xml create mode 100644 webbrowser/locales/en-US/updater/updater.ini create mode 100644 webbrowser/locales/en-US/webbrowser-l10n.js create mode 100644 webbrowser/locales/filter.py create mode 100644 webbrowser/locales/generic/extract-bookmarks.py create mode 100644 webbrowser/locales/generic/profile/bookmarks.html.in create mode 100644 webbrowser/locales/generic/profile/localstore.rdf create mode 100644 webbrowser/locales/generic/profile/mimeTypes.rdf create mode 100644 webbrowser/locales/jar.mn create mode 100644 webbrowser/locales/l10n.ini create mode 100644 webbrowser/locales/moz.build create mode 100644 webbrowser/locales/shipped-locales create mode 100644 webbrowser/modules/AboutHomeUtils.jsm create mode 100644 webbrowser/modules/AutoCompletePopup.jsm create mode 100644 webbrowser/modules/BrowserNewTabPreloader.jsm create mode 100644 webbrowser/modules/CharsetMenu.jsm create mode 100644 webbrowser/modules/FormSubmitObserver.jsm create mode 100644 webbrowser/modules/FormValidationHandler.jsm create mode 100644 webbrowser/modules/NetworkPrioritizer.jsm create mode 100644 webbrowser/modules/PageMenu.jsm create mode 100644 webbrowser/modules/PopupNotifications.jsm create mode 100644 webbrowser/modules/QuotaManager.jsm create mode 100644 webbrowser/modules/RecentWindow.jsm create mode 100644 webbrowser/modules/SharedFrame.jsm create mode 100644 webbrowser/modules/Windows8WindowFrameColor.jsm create mode 100644 webbrowser/modules/WindowsJumpLists.jsm create mode 100644 webbrowser/modules/WindowsPreviewPerTab.jsm create mode 100644 webbrowser/modules/moz.build create mode 100644 webbrowser/modules/offlineAppCache.jsm create mode 100644 webbrowser/modules/openLocationLastURL.jsm create mode 100644 webbrowser/modules/webrtcUI.jsm create mode 100644 webbrowser/moz.build create mode 100644 webbrowser/moz.configure create mode 100644 webbrowser/themes/LICENSE create mode 100644 webbrowser/themes/linux/Geolocation-16.png create mode 100644 webbrowser/themes/linux/Geolocation-64.png create mode 100644 webbrowser/themes/linux/Go-arrow.png create mode 100644 webbrowser/themes/linux/Info.png create mode 100644 webbrowser/themes/linux/KUI-close.png create mode 100644 webbrowser/themes/linux/Makefile.in create mode 100644 webbrowser/themes/linux/Privacy-16.png create mode 100644 webbrowser/themes/linux/Privacy-32.png create mode 100644 webbrowser/themes/linux/Privacy-48.png create mode 100644 webbrowser/themes/linux/Privacy-64.png create mode 100644 webbrowser/themes/linux/Secure.png create mode 100644 webbrowser/themes/linux/Security-broken.png create mode 100644 webbrowser/themes/linux/Toolbar-small.png create mode 100644 webbrowser/themes/linux/Toolbar.png create mode 100644 webbrowser/themes/linux/aboutCertError.css create mode 100644 webbrowser/themes/linux/aboutCertError_sectionCollapsed-rtl.png create mode 100644 webbrowser/themes/linux/aboutCertError_sectionCollapsed.png create mode 100644 webbrowser/themes/linux/aboutCertError_sectionExpanded.png create mode 100644 webbrowser/themes/linux/aboutPrivateBrowsing.css create mode 100644 webbrowser/themes/linux/aboutSessionRestore-window-icon.png create mode 100644 webbrowser/themes/linux/aboutSessionRestore.css create mode 100644 webbrowser/themes/linux/aboutSyncTabs.css create mode 100644 webbrowser/themes/linux/actionicon-tab.png create mode 100644 webbrowser/themes/linux/autocomplete.css create mode 100644 webbrowser/themes/linux/browser.css create mode 100644 webbrowser/themes/linux/click-to-play-warning-stripes.png create mode 100644 webbrowser/themes/linux/communicator/communicator.css create mode 100644 webbrowser/themes/linux/communicator/jar.mn create mode 100644 webbrowser/themes/linux/communicator/moz.build create mode 100644 webbrowser/themes/linux/downloads/allDownloadsViewOverlay.css create mode 100644 webbrowser/themes/linux/downloads/buttons.png create mode 100644 webbrowser/themes/linux/downloads/contentAreaDownloadsView.css create mode 100644 webbrowser/themes/linux/downloads/download-glow-small.png create mode 100644 webbrowser/themes/linux/downloads/download-glow.png create mode 100644 webbrowser/themes/linux/downloads/download-notification-finish.png create mode 100644 webbrowser/themes/linux/downloads/download-notification-start.png create mode 100644 webbrowser/themes/linux/downloads/download-summary.png create mode 100644 webbrowser/themes/linux/downloads/downloads.css create mode 100644 webbrowser/themes/linux/engineManager.css create mode 100644 webbrowser/themes/linux/feeds/feedIcon.png create mode 100644 webbrowser/themes/linux/feeds/feedIcon16.png create mode 100644 webbrowser/themes/linux/feeds/subscribe-ui.css create mode 100644 webbrowser/themes/linux/feeds/subscribe.css create mode 100644 webbrowser/themes/linux/icon.png create mode 100644 webbrowser/themes/linux/identity-icons-generic.png create mode 100644 webbrowser/themes/linux/identity-icons-https-ev.png create mode 100644 webbrowser/themes/linux/identity-icons-https-mixed-active.png create mode 100644 webbrowser/themes/linux/identity-icons-https.png create mode 100644 webbrowser/themes/linux/identity.png create mode 100644 webbrowser/themes/linux/imagedocument.png create mode 100644 webbrowser/themes/linux/jar.mn create mode 100644 webbrowser/themes/linux/mixed-content-blocked-16.png create mode 100644 webbrowser/themes/linux/mixed-content-blocked-64.png create mode 100644 webbrowser/themes/linux/monitor.png create mode 100644 webbrowser/themes/linux/monitor_16-10.png create mode 100644 webbrowser/themes/linux/moz.build create mode 100644 webbrowser/themes/linux/newtab/newTab.css create mode 100644 webbrowser/themes/linux/page-livemarks.png create mode 100644 webbrowser/themes/linux/pageInfo.css create mode 100644 webbrowser/themes/linux/pageInfo.png create mode 100644 webbrowser/themes/linux/permissions/aboutPermissions.css create mode 100644 webbrowser/themes/linux/places/bookmarksMenu.png create mode 100644 webbrowser/themes/linux/places/bookmarksToolbar.png create mode 100644 webbrowser/themes/linux/places/calendar.png create mode 100644 webbrowser/themes/linux/places/downloads.png create mode 100644 webbrowser/themes/linux/places/editBookmarkOverlay.css create mode 100644 webbrowser/themes/linux/places/livemark-item.png create mode 100644 webbrowser/themes/linux/places/organizer.css create mode 100644 webbrowser/themes/linux/places/organizer.xml create mode 100644 webbrowser/themes/linux/places/pageStarred.png create mode 100644 webbrowser/themes/linux/places/places.css create mode 100644 webbrowser/themes/linux/places/query.png create mode 100644 webbrowser/themes/linux/places/star-icons.png create mode 100644 webbrowser/themes/linux/places/starPage.png create mode 100644 webbrowser/themes/linux/places/starred48.png create mode 100644 webbrowser/themes/linux/places/tag.png create mode 100644 webbrowser/themes/linux/places/toolbarDropMarker.png create mode 100644 webbrowser/themes/linux/places/unsortedBookmarks.png create mode 100644 webbrowser/themes/linux/places/unstarred48.png create mode 100644 webbrowser/themes/linux/pointerLock-16.png create mode 100644 webbrowser/themes/linux/pointerLock-64.png create mode 100644 webbrowser/themes/linux/preferences/Options-sync.png create mode 100644 webbrowser/themes/linux/preferences/Options.png create mode 100644 webbrowser/themes/linux/preferences/alwaysAsk.png create mode 100644 webbrowser/themes/linux/preferences/applications.css create mode 100644 webbrowser/themes/linux/preferences/mail.png create mode 100644 webbrowser/themes/linux/preferences/preferences.css create mode 100644 webbrowser/themes/linux/privatebrowsing-mask.png create mode 100644 webbrowser/themes/linux/sanitizeDialog.css create mode 100644 webbrowser/themes/linux/searchbar.css create mode 100644 webbrowser/themes/linux/setDesktopBackground.css create mode 100644 webbrowser/themes/linux/slowStartup-16.png create mode 100644 webbrowser/themes/linux/statusbar/overlay.css create mode 100644 webbrowser/themes/linux/statusbar/prefs.css create mode 100644 webbrowser/themes/linux/sync-128.png create mode 100644 webbrowser/themes/linux/sync-16-throbber.png create mode 100644 webbrowser/themes/linux/sync-16.png create mode 100644 webbrowser/themes/linux/sync-24-throbber.png create mode 100644 webbrowser/themes/linux/sync-32.png create mode 100644 webbrowser/themes/linux/sync-bg.png create mode 100644 webbrowser/themes/linux/sync-desktopIcon.png create mode 100644 webbrowser/themes/linux/sync-mobileIcon.png create mode 100644 webbrowser/themes/linux/syncCommon.css create mode 100644 webbrowser/themes/linux/syncProgress.css create mode 100644 webbrowser/themes/linux/syncQuota.css create mode 100644 webbrowser/themes/linux/syncSetup.css create mode 100644 webbrowser/themes/linux/tabbrowser/alltabs.png create mode 100644 webbrowser/themes/linux/tabbrowser/connecting.png create mode 100644 webbrowser/themes/linux/tabbrowser/loading.png create mode 100644 webbrowser/themes/linux/tabbrowser/tab-overflow-border.png create mode 100644 webbrowser/themes/linux/tabbrowser/tab.png create mode 100644 webbrowser/themes/linux/tabbrowser/tabDragIndicator.png create mode 100644 webbrowser/themes/linux/urlbar-arrow.png create mode 100644 webbrowser/themes/linux/web-notifications-icon.svg create mode 100644 webbrowser/themes/linux/web-notifications-tray.svg create mode 100644 webbrowser/themes/linux/webRTC-shareDevice-16.png create mode 100644 webbrowser/themes/linux/webRTC-shareDevice-64.png create mode 100644 webbrowser/themes/linux/webRTC-sharingDevice-16.png create mode 100644 webbrowser/themes/moz.build create mode 100644 webbrowser/themes/osx/Geolocation-16.png create mode 100644 webbrowser/themes/osx/Geolocation-64.png create mode 100644 webbrowser/themes/osx/Info.png create mode 100644 webbrowser/themes/osx/KUI-background.png create mode 100644 webbrowser/themes/osx/KUI-close.png create mode 100644 webbrowser/themes/osx/Makefile.in create mode 100644 webbrowser/themes/osx/Privacy-16.png create mode 100644 webbrowser/themes/osx/Privacy-32.png create mode 100644 webbrowser/themes/osx/Privacy-48.png create mode 100644 webbrowser/themes/osx/Privacy-64.png create mode 100644 webbrowser/themes/osx/Search-glass.png create mode 100644 webbrowser/themes/osx/Secure24.png create mode 100644 webbrowser/themes/osx/Toolbar-glass.png create mode 100644 webbrowser/themes/osx/Toolbar-inverted.png create mode 100644 webbrowser/themes/osx/Toolbar.png create mode 100644 webbrowser/themes/osx/aboutCertError.css create mode 100644 webbrowser/themes/osx/aboutCertError_sectionCollapsed-rtl.png create mode 100644 webbrowser/themes/osx/aboutCertError_sectionCollapsed.png create mode 100644 webbrowser/themes/osx/aboutCertError_sectionExpanded.png create mode 100644 webbrowser/themes/osx/aboutPrivateBrowsing.css create mode 100644 webbrowser/themes/osx/aboutSessionRestore.css create mode 100644 webbrowser/themes/osx/aboutSyncTabs.css create mode 100644 webbrowser/themes/osx/actionicon-tab.png create mode 100644 webbrowser/themes/osx/appmenu-dropmarker.png create mode 100644 webbrowser/themes/osx/appmenu-icons.png create mode 100644 webbrowser/themes/osx/autocomplete.css create mode 100644 webbrowser/themes/osx/browser.css create mode 100644 webbrowser/themes/osx/click-to-play-warning-stripes.png create mode 100644 webbrowser/themes/osx/communicator/communicator.css create mode 100644 webbrowser/themes/osx/communicator/jar.mn create mode 100644 webbrowser/themes/osx/communicator/moz.build create mode 100644 webbrowser/themes/osx/downloads/allDownloadsViewOverlay.css create mode 100644 webbrowser/themes/osx/downloads/buttons.png create mode 100644 webbrowser/themes/osx/downloads/contentAreaDownloadsView.css create mode 100644 webbrowser/themes/osx/downloads/download-glow.png create mode 100644 webbrowser/themes/osx/downloads/download-notification-finish.png create mode 100644 webbrowser/themes/osx/downloads/download-notification-start.png create mode 100644 webbrowser/themes/osx/downloads/download-summary.png create mode 100644 webbrowser/themes/osx/downloads/downloads.css create mode 100644 webbrowser/themes/osx/engineManager.css create mode 100644 webbrowser/themes/osx/feeds/feed-icons-16.png create mode 100644 webbrowser/themes/osx/feeds/feedIcon.png create mode 100644 webbrowser/themes/osx/feeds/feedIcon16.png create mode 100644 webbrowser/themes/osx/feeds/subscribe-ui.css create mode 100644 webbrowser/themes/osx/feeds/subscribe.css create mode 100644 webbrowser/themes/osx/icon.png create mode 100644 webbrowser/themes/osx/identity-icons-generic.png create mode 100644 webbrowser/themes/osx/identity-icons-https-ev.png create mode 100644 webbrowser/themes/osx/identity-icons-https-mixed-active.png create mode 100644 webbrowser/themes/osx/identity-icons-https.png create mode 100644 webbrowser/themes/osx/identity.png create mode 100644 webbrowser/themes/osx/imagedocument.png create mode 100644 webbrowser/themes/osx/jar.mn create mode 100644 webbrowser/themes/osx/keyhole-forward-mask.svg create mode 100644 webbrowser/themes/osx/livemark-folder.png create mode 100644 webbrowser/themes/osx/menu-back.png create mode 100644 webbrowser/themes/osx/menu-forward.png create mode 100644 webbrowser/themes/osx/mixed-content-blocked-16.png create mode 100644 webbrowser/themes/osx/mixed-content-blocked-64.png create mode 100644 webbrowser/themes/osx/monitor.png create mode 100644 webbrowser/themes/osx/monitor_16-10.png create mode 100644 webbrowser/themes/osx/moz.build create mode 100644 webbrowser/themes/osx/newtab/newTab.css create mode 100644 webbrowser/themes/osx/page-livemarks.png create mode 100644 webbrowser/themes/osx/page-livemarks@2x.png create mode 100644 webbrowser/themes/osx/pageInfo.css create mode 100644 webbrowser/themes/osx/pageInfo.png create mode 100644 webbrowser/themes/osx/panel-expander-closed.png create mode 100644 webbrowser/themes/osx/panel-expander-closed@2x.png create mode 100644 webbrowser/themes/osx/panel-expander-open.png create mode 100644 webbrowser/themes/osx/panel-expander-open@2x.png create mode 100644 webbrowser/themes/osx/panel-plus-sign.png create mode 100644 webbrowser/themes/osx/permissions/aboutPermissions.css create mode 100644 webbrowser/themes/osx/places/allBookmarks.png create mode 100644 webbrowser/themes/osx/places/bookmark.png create mode 100644 webbrowser/themes/osx/places/bookmarksMenu.png create mode 100644 webbrowser/themes/osx/places/bookmarksToolbar.png create mode 100644 webbrowser/themes/osx/places/bookmarksToolbar@2x.png create mode 100644 webbrowser/themes/osx/places/calendar.png create mode 100644 webbrowser/themes/osx/places/downloads.png create mode 100644 webbrowser/themes/osx/places/editBookmark.png create mode 100644 webbrowser/themes/osx/places/editBookmarkOverlay.css create mode 100644 webbrowser/themes/osx/places/expander-closed-active.png create mode 100644 webbrowser/themes/osx/places/expander-closed.png create mode 100644 webbrowser/themes/osx/places/expander-open-active.png create mode 100644 webbrowser/themes/osx/places/expander-open.png create mode 100644 webbrowser/themes/osx/places/folderDropArrow.png create mode 100644 webbrowser/themes/osx/places/folderDropArrow@2x.png create mode 100644 webbrowser/themes/osx/places/history.png create mode 100644 webbrowser/themes/osx/places/history@2x.png create mode 100644 webbrowser/themes/osx/places/libraryToolbar.png create mode 100644 webbrowser/themes/osx/places/livemark-item.png create mode 100644 webbrowser/themes/osx/places/organizer.css create mode 100644 webbrowser/themes/osx/places/places.css create mode 100644 webbrowser/themes/osx/places/query.png create mode 100644 webbrowser/themes/osx/places/query@2x.png create mode 100644 webbrowser/themes/osx/places/starred48.png create mode 100644 webbrowser/themes/osx/places/tag.png create mode 100644 webbrowser/themes/osx/places/tag@2x.png create mode 100644 webbrowser/themes/osx/places/toolbarDropMarker.png create mode 100644 webbrowser/themes/osx/places/unfiledBookmarks.png create mode 100644 webbrowser/themes/osx/places/unfiledBookmarks@2x.png create mode 100644 webbrowser/themes/osx/places/unsortedBookmarks.png create mode 100644 webbrowser/themes/osx/places/unstarred48.png create mode 100644 webbrowser/themes/osx/pointerLock-16.png create mode 100644 webbrowser/themes/osx/pointerLock-64.png create mode 100644 webbrowser/themes/osx/preferences/Options-sync.png create mode 100644 webbrowser/themes/osx/preferences/Options.png create mode 100644 webbrowser/themes/osx/preferences/alwaysAsk.png create mode 100644 webbrowser/themes/osx/preferences/application.png create mode 100644 webbrowser/themes/osx/preferences/applications.css create mode 100644 webbrowser/themes/osx/preferences/mail.png create mode 100644 webbrowser/themes/osx/preferences/preferences.css create mode 100644 webbrowser/themes/osx/preferences/saveFile.png create mode 100644 webbrowser/themes/osx/privatebrowsing-dark.png create mode 100644 webbrowser/themes/osx/privatebrowsing-light.png create mode 100644 webbrowser/themes/osx/privatebrowsing-mask.png create mode 100644 webbrowser/themes/osx/privatebrowsing-mask@2x.png create mode 100644 webbrowser/themes/osx/reload-stop-go.png create mode 100644 webbrowser/themes/osx/sanitizeDialog.css create mode 100644 webbrowser/themes/osx/searchbar-dropdown-arrow.png create mode 100644 webbrowser/themes/osx/searchbar.css create mode 100644 webbrowser/themes/osx/setDesktopBackground.css create mode 100644 webbrowser/themes/osx/shared.inc create mode 100644 webbrowser/themes/osx/slowStartup-16.png create mode 100644 webbrowser/themes/osx/statusbar/overlay.css create mode 100644 webbrowser/themes/osx/statusbar/prefs.css create mode 100644 webbrowser/themes/osx/sync-128.png create mode 100644 webbrowser/themes/osx/sync-16.png create mode 100644 webbrowser/themes/osx/sync-32.png create mode 100644 webbrowser/themes/osx/sync-bg.png create mode 100644 webbrowser/themes/osx/sync-desktopIcon.png create mode 100644 webbrowser/themes/osx/sync-mobileIcon.png create mode 100644 webbrowser/themes/osx/sync-throbber.png create mode 100644 webbrowser/themes/osx/syncCommon.css create mode 100644 webbrowser/themes/osx/syncProgress.css create mode 100644 webbrowser/themes/osx/syncQuota.css create mode 100644 webbrowser/themes/osx/syncSetup.css create mode 100644 webbrowser/themes/osx/tabbrowser/alltabs-inverted.png create mode 100644 webbrowser/themes/osx/tabbrowser/alltabs.png create mode 100644 webbrowser/themes/osx/tabbrowser/connecting.png create mode 100644 webbrowser/themes/osx/tabbrowser/loading.png create mode 100644 webbrowser/themes/osx/tabbrowser/newtab-glass.png create mode 100644 webbrowser/themes/osx/tabbrowser/newtab-inverted.png create mode 100644 webbrowser/themes/osx/tabbrowser/newtab.png create mode 100644 webbrowser/themes/osx/tabbrowser/tab-arrow-left-glass.png create mode 100644 webbrowser/themes/osx/tabbrowser/tab-arrow-left-inverted.png create mode 100644 webbrowser/themes/osx/tabbrowser/tab-arrow-left.png create mode 100644 webbrowser/themes/osx/tabbrowser/tab-overflow-border.png create mode 100644 webbrowser/themes/osx/tabbrowser/tabDragIndicator.png create mode 100644 webbrowser/themes/osx/toolbarbutton-dropdown-arrow-inverted.png create mode 100644 webbrowser/themes/osx/toolbarbutton-dropdown-arrow.png create mode 100644 webbrowser/themes/osx/urlbar-arrow.png create mode 100644 webbrowser/themes/osx/urlbar-history-dropmarker.png create mode 100644 webbrowser/themes/osx/urlbar-popup-blocked.png create mode 100644 webbrowser/themes/osx/web-notifications-icon.svg create mode 100644 webbrowser/themes/osx/web-notifications-tray.svg create mode 100644 webbrowser/themes/osx/webRTC-shareDevice-16.png create mode 100644 webbrowser/themes/osx/webRTC-shareDevice-64.png create mode 100644 webbrowser/themes/osx/webRTC-sharingDevice-16.png create mode 100644 webbrowser/themes/shared/browser.inc create mode 100644 webbrowser/themes/shared/newtab/controls.png create mode 100644 webbrowser/themes/shared/newtab/newTab.css.inc create mode 100644 webbrowser/themes/shared/newtab/noise.png create mode 100644 webbrowser/themes/shared/newtab/pinned.png create mode 100644 webbrowser/themes/shared/plugin-doorhanger.inc.css create mode 100644 webbrowser/themes/shared/plugins/notification-pluginAlert.png create mode 100644 webbrowser/themes/shared/plugins/notification-pluginAlert@2x.png create mode 100644 webbrowser/themes/shared/plugins/notification-pluginBlocked.png create mode 100644 webbrowser/themes/shared/plugins/notification-pluginBlocked@2x.png create mode 100644 webbrowser/themes/shared/plugins/notification-pluginNormal.png create mode 100644 webbrowser/themes/shared/plugins/notification-pluginNormal@2x.png create mode 100644 webbrowser/themes/shared/statusbar/dynamic.css create mode 100644 webbrowser/themes/shared/statusbar/overlay.css create mode 100644 webbrowser/themes/shared/statusbar/pms16.png create mode 100644 webbrowser/themes/shared/statusbar/pms24.png create mode 100644 webbrowser/themes/shared/statusbar/prefs.css create mode 100644 webbrowser/themes/shared/statusbar/pulse.png create mode 100644 webbrowser/themes/shared/statusbar/throbber-idle.png create mode 100644 webbrowser/themes/shared/statusbar/throbberStatic.png create mode 100644 webbrowser/themes/shared/tabbrowser/tab-audio-small.svg create mode 100644 webbrowser/themes/shared/tabbrowser/tab-audio.svg create mode 100644 webbrowser/themes/windows/Geolocation-16.png create mode 100644 webbrowser/themes/windows/Geolocation-64.png create mode 100644 webbrowser/themes/windows/Info.png create mode 100644 webbrowser/themes/windows/KUI-background.png create mode 100644 webbrowser/themes/windows/KUI-close.png create mode 100644 webbrowser/themes/windows/Makefile.in create mode 100644 webbrowser/themes/windows/Privacy-16.png create mode 100644 webbrowser/themes/windows/Privacy-32.png create mode 100644 webbrowser/themes/windows/Privacy-48.png create mode 100644 webbrowser/themes/windows/Privacy-64.png create mode 100644 webbrowser/themes/windows/Push-16.png create mode 100644 webbrowser/themes/windows/Push-64.png create mode 100644 webbrowser/themes/windows/Secure24.png create mode 100644 webbrowser/themes/windows/Toolbar-glass.png create mode 100644 webbrowser/themes/windows/Toolbar-glass.svg create mode 100644 webbrowser/themes/windows/Toolbar-inverted.png create mode 100644 webbrowser/themes/windows/Toolbar-inverted.svg create mode 100644 webbrowser/themes/windows/Toolbar.png create mode 100644 webbrowser/themes/windows/Toolbar.svg create mode 100644 webbrowser/themes/windows/aboutCertError.css create mode 100644 webbrowser/themes/windows/aboutCertError_sectionCollapsed-rtl.png create mode 100644 webbrowser/themes/windows/aboutCertError_sectionCollapsed.png create mode 100644 webbrowser/themes/windows/aboutCertError_sectionExpanded.png create mode 100644 webbrowser/themes/windows/aboutPrivateBrowsing.css create mode 100644 webbrowser/themes/windows/aboutSessionRestore-window-icon.png create mode 100644 webbrowser/themes/windows/aboutSessionRestore.css create mode 100644 webbrowser/themes/windows/aboutSyncTabs.css create mode 100644 webbrowser/themes/windows/actionicon-tab.png create mode 100644 webbrowser/themes/windows/appmenu-dropmarker.png create mode 100644 webbrowser/themes/windows/appmenu-icons.png create mode 100644 webbrowser/themes/windows/autocomplete.css create mode 100644 webbrowser/themes/windows/browser.css create mode 100644 webbrowser/themes/windows/caption-buttons.svg create mode 100644 webbrowser/themes/windows/click-to-play-warning-stripes.png create mode 100644 webbrowser/themes/windows/communicator/communicator.css create mode 100644 webbrowser/themes/windows/communicator/jar.mn create mode 100644 webbrowser/themes/windows/communicator/moz.build create mode 100644 webbrowser/themes/windows/downloads/allDownloadsViewOverlay.css create mode 100644 webbrowser/themes/windows/downloads/buttons.png create mode 100644 webbrowser/themes/windows/downloads/contentAreaDownloadsView.css create mode 100644 webbrowser/themes/windows/downloads/download-notification-finish.png create mode 100644 webbrowser/themes/windows/downloads/download-notification-start.png create mode 100644 webbrowser/themes/windows/downloads/download-summary.png create mode 100644 webbrowser/themes/windows/downloads/downloads.css create mode 100644 webbrowser/themes/windows/engineManager.css create mode 100644 webbrowser/themes/windows/feeds/feed-icons-16.png create mode 100644 webbrowser/themes/windows/feeds/feedIcon.png create mode 100644 webbrowser/themes/windows/feeds/feedIcon16.png create mode 100644 webbrowser/themes/windows/feeds/subscribe-ui.css create mode 100644 webbrowser/themes/windows/feeds/subscribe.css create mode 100644 webbrowser/themes/windows/icon.png create mode 100644 webbrowser/themes/windows/identity-icons-generic.png create mode 100644 webbrowser/themes/windows/identity-icons-https-ev.png create mode 100644 webbrowser/themes/windows/identity-icons-https-mixed-active.png create mode 100644 webbrowser/themes/windows/identity-icons-https.png create mode 100644 webbrowser/themes/windows/identity.png create mode 100644 webbrowser/themes/windows/imagedocument.png create mode 100644 webbrowser/themes/windows/jar.mn create mode 100644 webbrowser/themes/windows/keyhole-forward-mask.svg create mode 100644 webbrowser/themes/windows/livemark-folder.png create mode 100644 webbrowser/themes/windows/menu-back.png create mode 100644 webbrowser/themes/windows/menu-forward.png create mode 100644 webbrowser/themes/windows/mixed-content-blocked-16.png create mode 100644 webbrowser/themes/windows/mixed-content-blocked-64.png create mode 100644 webbrowser/themes/windows/monitor.png create mode 100644 webbrowser/themes/windows/monitor_16-10.png create mode 100644 webbrowser/themes/windows/moz.build create mode 100644 webbrowser/themes/windows/newtab/newTab.css create mode 100644 webbrowser/themes/windows/pageInfo.css create mode 100644 webbrowser/themes/windows/pageInfo.png create mode 100644 webbrowser/themes/windows/permissions/aboutPermissions.css create mode 100644 webbrowser/themes/windows/places/allBookmarks.png create mode 100644 webbrowser/themes/windows/places/bookmark.png create mode 100644 webbrowser/themes/windows/places/bookmarksMenu.png create mode 100644 webbrowser/themes/windows/places/bookmarksToolbar.png create mode 100644 webbrowser/themes/windows/places/calendar.png create mode 100644 webbrowser/themes/windows/places/downloads.png create mode 100644 webbrowser/themes/windows/places/editBookmark.png create mode 100644 webbrowser/themes/windows/places/editBookmarkOverlay.css create mode 100644 webbrowser/themes/windows/places/history.png create mode 100644 webbrowser/themes/windows/places/libraryToolbar.png create mode 100644 webbrowser/themes/windows/places/livemark-item.png create mode 100644 webbrowser/themes/windows/places/organizer.css create mode 100644 webbrowser/themes/windows/places/places.css create mode 100644 webbrowser/themes/windows/places/query.png create mode 100644 webbrowser/themes/windows/places/starred48.png create mode 100644 webbrowser/themes/windows/places/tag.png create mode 100644 webbrowser/themes/windows/places/toolbarDropMarker.png create mode 100644 webbrowser/themes/windows/places/unsortedBookmarks.png create mode 100644 webbrowser/themes/windows/places/unstarred48.png create mode 100644 webbrowser/themes/windows/pointerLock-16.png create mode 100644 webbrowser/themes/windows/pointerLock-64.png create mode 100644 webbrowser/themes/windows/preferences/Options-sync.png create mode 100644 webbrowser/themes/windows/preferences/Options.png create mode 100644 webbrowser/themes/windows/preferences/alwaysAsk.png create mode 100644 webbrowser/themes/windows/preferences/application.png create mode 100644 webbrowser/themes/windows/preferences/applications.css create mode 100644 webbrowser/themes/windows/preferences/mail.png create mode 100644 webbrowser/themes/windows/preferences/preferences.css create mode 100644 webbrowser/themes/windows/preferences/saveFile.png create mode 100644 webbrowser/themes/windows/privatebrowsing-dark.png create mode 100644 webbrowser/themes/windows/privatebrowsing-light.png create mode 100644 webbrowser/themes/windows/reload-stop-go.png create mode 100644 webbrowser/themes/windows/sanitize.png create mode 100644 webbrowser/themes/windows/sanitizeDialog.css create mode 100644 webbrowser/themes/windows/searchbar-dropdown-arrow.png create mode 100644 webbrowser/themes/windows/searchbar.css create mode 100644 webbrowser/themes/windows/setDesktopBackground.css create mode 100644 webbrowser/themes/windows/slowStartup-16.png create mode 100644 webbrowser/themes/windows/statusbar/overlay.css create mode 100644 webbrowser/themes/windows/statusbar/prefs.css create mode 100644 webbrowser/themes/windows/sync-128.png create mode 100644 webbrowser/themes/windows/sync-16.png create mode 100644 webbrowser/themes/windows/sync-32.png create mode 100644 webbrowser/themes/windows/sync-bg.png create mode 100644 webbrowser/themes/windows/sync-desktopIcon.png create mode 100644 webbrowser/themes/windows/sync-mobileIcon.png create mode 100644 webbrowser/themes/windows/sync-throbber.png create mode 100644 webbrowser/themes/windows/syncCommon.css create mode 100644 webbrowser/themes/windows/syncProgress.css create mode 100644 webbrowser/themes/windows/syncQuota.css create mode 100644 webbrowser/themes/windows/syncSetup.css create mode 100644 webbrowser/themes/windows/tabbrowser/alltabs-inverted.png create mode 100644 webbrowser/themes/windows/tabbrowser/alltabs.png create mode 100644 webbrowser/themes/windows/tabbrowser/connecting.png create mode 100644 webbrowser/themes/windows/tabbrowser/loading.png create mode 100644 webbrowser/themes/windows/tabbrowser/newtab-glass.png create mode 100644 webbrowser/themes/windows/tabbrowser/newtab-inverted.png create mode 100644 webbrowser/themes/windows/tabbrowser/newtab.png create mode 100644 webbrowser/themes/windows/tabbrowser/tab-arrow-left-glass.png create mode 100644 webbrowser/themes/windows/tabbrowser/tab-arrow-left-inverted.png create mode 100644 webbrowser/themes/windows/tabbrowser/tab-arrow-left.png create mode 100644 webbrowser/themes/windows/tabbrowser/tab-overflow-border.png create mode 100644 webbrowser/themes/windows/tabbrowser/tabDragIndicator.png create mode 100644 webbrowser/themes/windows/toolbarbutton-dropdown-arrow-inverted.png create mode 100644 webbrowser/themes/windows/toolbarbutton-dropdown-arrow.png create mode 100644 webbrowser/themes/windows/urlbar-arrow.png create mode 100644 webbrowser/themes/windows/urlbar-history-dropmarker.png create mode 100644 webbrowser/themes/windows/urlbar-popup-blocked.png create mode 100644 webbrowser/themes/windows/web-notifications-icon.svg create mode 100644 webbrowser/themes/windows/web-notifications-tray.svg create mode 100644 webbrowser/themes/windows/webRTC-shareDevice-16.png create mode 100644 webbrowser/themes/windows/webRTC-shareDevice-64.png create mode 100644 webbrowser/themes/windows/webRTC-sharingDevice-16.png diff --git a/LICENSE b/LICENSE deleted file mode 100644 index e3b7160..0000000 --- a/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -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 the -Mozilla Foundation, Moonchild Productions or any party, including without -limitation the Pale Moon name or logo. diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index 92527ea..0000000 --- a/Makefile.in +++ /dev/null @@ -1,13 +0,0 @@ -# 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 -endif diff --git a/app-rules.mk b/app-rules.mk deleted file mode 100644 index 2c31653..0000000 --- a/app-rules.mk +++ /dev/null @@ -1 +0,0 @@ -PURGECACHES_DIRS = $(DIST)/bin/browser diff --git a/app.mozbuild b/app.mozbuild deleted file mode 100644 index 5f1c0b9..0000000 --- a/app.mozbuild +++ /dev/null @@ -1,17 +0,0 @@ -# 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/. - -if not CONFIG['LIBXUL_SDK']: - include('/toolkit/toolkit.mozbuild') - -if CONFIG['MOZ_EXTENSIONS']: - DIRS += ['/extensions'] - -DIRS += ['/%s' % CONFIG['MOZ_BRANDING_DIRECTORY']] - -# Never add tier dirs after browser because they apparently won't get -# packaged properly on Mac. -DIRS += ['/application/webbrowser'] - diff --git a/app/Makefile.in b/app/Makefile.in deleted file mode 100644 index 10dff6d..0000000 --- a/app/Makefile.in +++ /dev/null @@ -1,108 +0,0 @@ -# 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 - -DEFINES += \ - -DAB_CD=$(AB_CD) \ - -DAPP_VERSION="$(MOZ_APP_VERSION)" \ - -DFIREFOX_ICO=\"$(DIST)/branding/firefox.ico\" \ - -DDOCUMENT_ICO=\"$(DIST)/branding/document.ico\" \ - -DNEWWINDOW_ICO=\"$(DIST)/branding/newwindow.ico\" \ - -DNEWTAB_ICO=\"$(DIST)/branding/newtab.ico\" \ - -DPBMODE_ICO=\"$(DIST)/branding/pbmode.ico\" \ - $(NULL) - -# Build a binary bootstrapping with XRE_main - -ifndef MOZ_WINCONSOLE -ifdef MOZ_DEBUG -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 - -ifeq ($(OS_ARCH),WINNT) -# Rebuild firefox.exe if the manifest changes - it's included by splash.rc. -# (this dependency should really be just for firefox.exe, not other targets) -EXTRA_DEPS += $(PROGRAM).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/, webbrowser.js) - -endif - -ifndef LIBXUL_SDK -# 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) -endif - -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) - -AB := $(firstword $(subst -, ,$(AB_CD))) - -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:: $(PROGRAM) - $(MKDIR) -p '$(dist_dest)/Contents/MacOS' - $(MKDIR) -p '$(dist_dest)/Contents/Resources/$(AB).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)/Contents/Resources/$(AB).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)/Contents/Resources/$(AB).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/$(PROGRAM)' - rsync -aL $(PROGRAM) '$(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' - printf APPLMOZB > '$(dist_dest)/Contents/PkgInfo' -endif - -ifdef LIBXUL_SDK #{ -ifndef SKIP_COPY_XULRUNNER #{ -libs:: -ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) #{ - rsync -a --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework '$(dist_dest)/Contents/Frameworks' -else - $(NSINSTALL) -D $(DIST)/bin/xulrunner - (cd $(LIBXUL_SDK)/bin && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DIST)/bin/xulrunner && tar -xf -) -endif #} cocoa -endif #} SKIP_COPY_XULRUNNER -endif #} LIBXUL_SDK diff --git a/app/application.ini b/app/application.ini deleted file mode 100644 index 70d07ec..0000000 --- a/app/application.ini +++ /dev/null @@ -1,50 +0,0 @@ -#if MOZ_APP_STATIC_INI -#ifdef MOZ_BUILD_APP_IS_BROWSER -; This file is not used. If you modify it and want the application to use -; your modifications, move it under the browser/ subdirectory and start with -; the "-app /path/to/browser/application.ini" argument. -#else -; This file is not used. If you modify it and want the application to use -; your modifications, start with the "-app /path/to/application.ini" -; argument. -#endif -#endif -#if 0 -; 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/. -#endif -#filter substitution -#include @TOPOBJDIR@/buildid.h -#include @TOPOBJDIR@/source-repo.h - -[App] -# Vendor=@MOZ_APP_VENDOR@ -Vendor=Individual Programmer -# Name=@MOZ_APP_BASENAME@ -Name=Web Browser -RemotingName=@MOZ_APP_REMOTINGNAME@ -#ifdef MOZ_APP_DISPLAYNAME -CodeName=@MOZ_APP_DISPLAYNAME@ -#endif -Version=@MOZ_APP_VERSION@ -#ifdef MOZ_APP_PROFILE -Profile=@MOZ_APP_PROFILE@ -#endif -BuildID=@MOZ_BUILDID@ -#ifdef MOZ_SOURCE_REPO -SourceRepository=@MOZ_SOURCE_REPO@ -#endif -#ifdef MOZ_SOURCE_STAMP -SourceStamp=@MOZ_SOURCE_STAMP@ -#endif -ID=@MOZ_APP_ID@ - -[Gecko] -MinVersion=@GRE_MILESTONE@ -MaxVersion=@GRE_MILESTONE@ - -[XRE] -#ifdef MOZ_PROFILE_MIGRATOR -EnableProfileMigrator=1 -#endif diff --git a/app/blocklist.xml b/app/blocklist.xml deleted file mode 100644 index 4bc4be1..0000000 --- a/app/blocklist.xml +++ /dev/null @@ -1,3909 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - browser.startup.homepage - browser.search.defaultenginename - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - browser.startup.homepage - browser.search.defaultenginename - - - - - - - - - - - - - - - - - - - - - - - - - - - - browser.startup.homepage - browser.search.defaultenginename - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - browser.startup.homepage - browser.search.defaultenginename - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - security.csp.enable - security.fileuri.strict_origin_policy - security.mixed_content.block_active_content - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - app.update.auto - app.update.enabled - app.update.interval - app.update.url - - - - - - - - - - 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.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.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.search.defaultenginename - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - browser.startup.homepage - browser.search.defaultenginename - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - browser.startup.homepage - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - browser.startup.homepage - browser.search.defaultenginename - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - browser.startup.homepage - browser.search.defaultenginename - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - - - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - - - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - - - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://java.com/ - - - - - https://java.com/ - - - - - - - https://java.com/ - - - - - - - https://java.com/ - - - - - - - https://java.com/ - - - - - - - https://java.com/ - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://java.com/ - - - - - https://java.com/ - - - - - - - https://java.com/ - - - - - - - https://java.com/ - - - - - - - https://java.com/ - - - - - - - https://java.com/ - - - - - - - - - - - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://real.com/ - - - - - https://get.adobe.com/shockwave/ - - - - - https://get.adobe.com/shockwave/ - - - - - https://java.com/ - - - - - https://java.com/ - - - - - - - https://java.com/ - - - - - - - https://java.com/ - - - - - - - https://java.com/ - - - - - - - https://java.com/ - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - https://www.adobe.com/products/flashplayer/distribution3.html - - - - - WINNT 6.1 - 0x10de - - 0x0a6c - - DIRECT2D - BLOCKED_DRIVER_VERSION - 8.17.12.5896 - - LESS_THAN_OR_EQUAL - - - WINNT 6.1 - 0x10de - - 0x0a6c - - DIRECT3D_9_LAYERS - BLOCKED_DRIVER_VERSION - 8.17.12.5896 - - LESS_THAN_OR_EQUAL - - - WINNT 5.1 - 0x10de - DIRECT3D_9_LAYERS - BLOCKED_DRIVER_VERSION - 7.0.0.0 - - GREATER_THAN_OR_EQUAL - - - All - 0x1002 - DIRECT2D - BLOCKED_DRIVER_VERSION - 8.982.0.0 - EQUAL - - - All - 0x1022 - DIRECT2D - BLOCKED_DRIVER_VERSION - 8.982.0.0 - EQUAL - - - All - 0x1022 - DIRECT3D_9_LAYERS - BLOCKED_DRIVER_VERSION - 8.982.0.0 - EQUAL - - - All - 0x1002 - DIRECT3D_9_LAYERS - BLOCKED_DRIVER_VERSION - 8.982.0.0 - EQUAL - - - WINNT 6.2 - 0x1002 - DIRECT2D - BLOCKED_DRIVER_VERSION - 9.10.8.0 - - LESS_THAN_OR_EQUAL - - - WINNT 6.2 - 0x1022 - DIRECT2D - BLOCKED_DRIVER_VERSION - 9.10.8.0 - - LESS_THAN_OR_EQUAL - - - Darwin 10 - 0x10de - WEBGL_MSAA - BLOCKED_DEVICE - - - Darwin 11 - 0x10de - WEBGL_MSAA - BLOCKED_DEVICE - - - Darwin 12 - 0x10de - WEBGL_MSAA - BLOCKED_DEVICE - - - Darwin 10 - 0x8086 - WEBGL_MSAA - BLOCKED_DEVICE - - - Darwin 11 - 0x8086 - WEBGL_MSAA - BLOCKED_DEVICE - - - Darwin 12 - 0x8086 - WEBGL_MSAA - BLOCKED_DEVICE - - - Darwin 10 - 0x1002 - WEBGL_MSAA - BLOCKED_DEVICE - - - Darwin 11 - 0x1002 - WEBGL_MSAA - BLOCKED_DEVICE - - - Darwin 12 - 0x1002 - WEBGL_MSAA - BLOCKED_DEVICE - - - WINNT 6.1 - 0x1002 - - 0x68e1 - 0x68e4 - 0x68e5 - 0x68f9 - 0x9802 - 0x9803 - 0x9803 - 0x9804 - 0x9805 - 0x9806 - 0x9807 - - DIRECT2D - BLOCKED_DEVICE - - - WINNT 6.1 - 0x1002 - - 0x9802 - 0x9803 - 0x9803 - 0x9804 - 0x9805 - 0x9806 - 0x9807 - - DIRECT3D_9_LAYERS - BLOCKED_DEVICE - - - WINNT 10.0 - 0x1002 - - 0x6920 - 0x6921 - 0x6928 - 0x6929 - 0x692b - 0x692f - 0x6930 - 0x6938 - 0x6939 - 0x6900 - 0x6901 - 0x6902 - 0x6903 - 0x6907 - 0x7300 - 0x9870 - 0x9874 - 0x9875 - 0x9876 - 0x9877 - - DIRECT2D - BLOCKED_DRIVER_VERSION - 15.201.1151.0 - LESS_THAN - - - All - 0x8086 - DIRECT2D - BLOCKED_DRIVER_VERSION - 8.15.10.2413 - - LESS_THAN_OR_EQUAL - - - WINNT 8.1 - 0x1002 - - 0x6920 - 0x6921 - 0x6928 - 0x6929 - 0x692b - 0x692f - 0x6930 - 0x6938 - 0x6939 - 0x6900 - 0x6901 - 0x6902 - 0x6903 - 0x6907 - 0x7300 - 0x9870 - 0x9874 - 0x9875 - 0x9876 - 0x9877 - - DIRECT2D - BLOCKED_DRIVER_VERSION - 15.201.1151.0 - LESS_THAN - - - 0x8086 - - 0x2a42 - 0x2e22 - 0x2e12 - 0x2e32 - 0x0046 - - BLOCKED_DRIVER_VERSION - 8.15.10.1851 - EQUAL - - - 0x8086 - - 0x2a42 - 0x2e22 - 0x2e12 - 0x2e32 - 0x0046 - - BLOCKED_DRIVER_VERSION - 8.15.10.1855 - EQUAL - - - 0x8086 - - 0x2a42 - 0x2e22 - 0x2e12 - 0x2e32 - 0x0046 - - BLOCKED_DRIVER_VERSION - 8.15.10.1872 - EQUAL - - - 0x8086 - - 0x2a42 - 0x2e22 - 0x2e12 - 0x2e32 - 0x0046 - - BLOCKED_DRIVER_VERSION - 8.15.10.1883 - EQUAL - - - 0x8086 - - 0x2a42 - 0x2e22 - 0x2e12 - 0x2e32 - 0x0046 - - BLOCKED_DRIVER_VERSION - 8.15.10.1892 - EQUAL - - - 0x8086 - - 0x2a42 - 0x2e22 - 0x2e12 - 0x2e32 - 0x0046 - - BLOCKED_DRIVER_VERSION - 8.15.10.1994 - EQUAL - - - diff --git a/app/macbuild/Contents/CodeResources b/app/macbuild/Contents/CodeResources deleted file mode 100644 index 1a65e20..0000000 --- a/app/macbuild/Contents/CodeResources +++ /dev/null @@ -1 +0,0 @@ -_CodeSignature/CodeResources \ No newline at end of file diff --git a/app/macbuild/Contents/Info.plist.in b/app/macbuild/Contents/Info.plist.in deleted file mode 100644 index b224064..0000000 --- a/app/macbuild/Contents/Info.plist.in +++ /dev/null @@ -1,227 +0,0 @@ - - - - - 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 - palemoon - CFBundleGetInfoString - %MAC_APP_NAME% %APP_VERSION% - CFBundleIconFile - firefox - 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 - LSEnvironment - - MallocNanoZone - 0 - - LSMinimumSystemVersion - 10.6 - LSMinimumSystemVersionByArchitecture - - i386 - 10.6.0 - x86_64 - 10.6.0 - - NSSupportsAutomaticGraphicsSwitching - - NSPrincipalClass - GoannaNSApplication - - diff --git a/app/macbuild/Contents/MacOS-files.in b/app/macbuild/Contents/MacOS-files.in deleted file mode 100644 index 561366d..0000000 --- a/app/macbuild/Contents/MacOS-files.in +++ /dev/null @@ -1,10 +0,0 @@ -/*.app/*** -/*.dylib -/certutil -/firefox-bin -/gtest/*** -/pk12util -/ssltunnel -/xpcshell -/XUL - diff --git a/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in b/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in deleted file mode 100644 index 74d192c..0000000 --- a/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in +++ /dev/null @@ -1,5 +0,0 @@ -/* 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/app/macbuild/Contents/_CodeSignature/CodeResources b/app/macbuild/Contents/_CodeSignature/CodeResources deleted file mode 100644 index 6f6e20e..0000000 --- a/app/macbuild/Contents/_CodeSignature/CodeResources +++ /dev/null @@ -1,71 +0,0 @@ - - - - - rules - - ^Info.plist$ - - ^PkgInfo$ - - ^MacOS/ - - ^Resources/ - - ^MacOS/distribution/.* - omit - - weight - 10 - - ^MacOS/override.ini - omit - - weight - 10 - - ^MacOS/updates/.* - omit - - weight - 10 - - ^MacOS/active-update.xml$ - omit - - weight - 10 - - ^MacOS/defaults/.* - omit - - weight - 10 - - ^MacOS/removed-files$ - omit - - weight - 10 - - ^MacOS/updates.xml$ - omit - - weight - 10 - - ^Updated.app/.* - omit - - weight - 10 - - ^updating/.* - omit - - weight - 10 - - - - diff --git a/app/macversion.py b/app/macversion.py deleted file mode 100644 index 839aac1..0000000 --- a/app/macversion.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/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/app/module.ver b/app/module.ver deleted file mode 100644 index 7a00230..0000000 --- a/app/module.ver +++ /dev/null @@ -1,8 +0,0 @@ -WIN32_MODULE_COMPANYNAME=Moonchild Productions -WIN32_MODULE_COPYRIGHT=©Pale Moon, Firefox and Mozilla Developers, available under the MPL 2.0. -WIN32_MODULE_PRODUCTVERSION=@MOZ_APP_WINVERSION@ -WIN32_MODULE_PRODUCTVERSION_STRING=@MOZ_APP_VERSION@ -WIN32_MODULE_TRADEMARKS=The Pale Moon logo and project names are the property of Moonchild Productions. -WIN32_MODULE_DESCRIPTION=Pale Moon web browser -WIN32_MODULE_PRODUCTNAME=Pale Moon -WIN32_MODULE_NAME=Pale Moon diff --git a/app/moz.build b/app/moz.build deleted file mode 100644 index 07c4ba5..0000000 --- a/app/moz.build +++ /dev/null @@ -1,64 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; 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'] - -GeckoProgram(CONFIG['MOZ_APP_NAME']) - -JS_PREFERENCE_PP_FILES += [ - 'profile/webbrowser.js', -] - -if CONFIG['LIBXUL_SDK']: - PREF_JS_EXPORTS += [ - 'profile/channel-prefs.js', - ] - -SOURCES += ['nsBrowserApp.cpp'] - -FINAL_TARGET_FILES += ['blocklist.xml'] -FINAL_TARGET_FILES.defaults += ['permissions'] -FINAL_TARGET_FILES.defaults.profile += ['profile/prefs.js'] - -DEFINES['APP_VERSION'] = CONFIG['MOZ_APP_VERSION'] - -LOCAL_INCLUDES += ['!/build'] - -LOCAL_INCLUDES += [ - '/toolkit/xre', - '/xpcom/base', - '/xpcom/build', -] - -USE_LIBS += ['mozglue'] - -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 - -# 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'] diff --git a/app/nsBrowserApp.cpp b/app/nsBrowserApp.cpp deleted file mode 100644 index 8b06135..0000000 --- a/app/nsBrowserApp.cpp +++ /dev/null @@ -1,393 +0,0 @@ -/* -*- 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/AppData.h" -#include "application.ini.h" -#include "nsXPCOMGlue.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 -#define XRE_WANT_ENVIRON -#define strcasecmp _stricmp -#endif -#include "BinaryPath.h" - -#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL - -#include "mozilla/Sprintf.h" -#include "mozilla/Telemetry.h" -#include "mozilla/WindowsDllBlocklist.h" - -#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"Pale Moon", 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; -} - -XRE_GetFileFromPathType XRE_GetFileFromPath; -XRE_CreateAppDataType XRE_CreateAppData; -XRE_FreeAppDataType XRE_FreeAppData; -XRE_TelemetryAccumulateType XRE_TelemetryAccumulate; -XRE_StartupTimelineRecordType XRE_StartupTimelineRecord; -XRE_mainType XRE_main; -XRE_StopLateWriteChecksType XRE_StopLateWriteChecks; -XRE_XPCShellMainType XRE_XPCShellMain; -XRE_GetProcessTypeType XRE_GetProcessType; -XRE_SetProcessTypeType XRE_SetProcessType; -XRE_InitChildProcessType XRE_InitChildProcess; -XRE_EnableSameExecutableForContentProcType XRE_EnableSameExecutableForContentProc; -#ifdef LIBFUZZER -XRE_LibFuzzerSetMainType XRE_LibFuzzerSetMain; -XRE_LibFuzzerGetFuncsType XRE_LibFuzzerGetFuncs; -#endif - -static const nsDynamicFunctionLoad kXULFuncs[] = { - { "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath }, - { "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData }, - { "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData }, - { "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate }, - { "XRE_StartupTimelineRecord", (NSFuncPtr*) &XRE_StartupTimelineRecord }, - { "XRE_main", (NSFuncPtr*) &XRE_main }, - { "XRE_StopLateWriteChecks", (NSFuncPtr*) &XRE_StopLateWriteChecks }, - { "XRE_XPCShellMain", (NSFuncPtr*) &XRE_XPCShellMain }, - { "XRE_GetProcessType", (NSFuncPtr*) &XRE_GetProcessType }, - { "XRE_SetProcessType", (NSFuncPtr*) &XRE_SetProcessType }, - { "XRE_InitChildProcess", (NSFuncPtr*) &XRE_InitChildProcess }, - { "XRE_EnableSameExecutableForContentProc", (NSFuncPtr*) &XRE_EnableSameExecutableForContentProc }, -#ifdef LIBFUZZER - { "XRE_LibFuzzerSetMain", (NSFuncPtr*) &XRE_LibFuzzerSetMain }, - { "XRE_LibFuzzerGetFuncs", (NSFuncPtr*) &XRE_LibFuzzerGetFuncs }, -#endif - { nullptr, nullptr } -}; - -#ifdef LIBFUZZER -int libfuzzer_main(int argc, char **argv); - -/* This wrapper is used by the libFuzzer main to call into libxul */ - -void libFuzzerGetFuncs(const char* moduleName, LibFuzzerInitFunc* initFunc, - LibFuzzerTestingFunc* testingFunc) { - return XRE_LibFuzzerGetFuncs(moduleName, initFunc, testingFunc); -} -#endif - -static int do_main(int argc, char* argv[], char* envp[], nsIFile *xreDirectory) -{ - nsCOMPtr appini; - nsresult rv; - uint32_t mainFlags = 0; - - // Allow palemoon.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) { - rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appini)); - if (NS_FAILED(rv)) { - Output("Invalid path found: '%s'", appDataFile); - return 255; - } - } - else if (argc > 1 && IsArg(argv[1], "app")) { - if (argc == 2) { - Output("Incorrect number of arguments passed to -app"); - return 255; - } - - rv = XRE_GetFileFromPath(argv[2], getter_AddRefs(appini)); - if (NS_FAILED(rv)) { - Output("application.ini path not recognized: '%s'", argv[2]); - return 255; - } - - 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]; - } - - return XRE_XPCShellMain(--argc, argv, envp); - } - - if (appini) { - nsXREAppData *appData; - rv = XRE_CreateAppData(appini, &appData); - if (NS_FAILED(rv)) { - Output("Couldn't read application.ini"); - return 255; - } -#if defined(HAS_DLL_BLOCKLIST) - // The dll blocklist operates in the exe vs. xullib. Pass a flag to - // xullib so automated tests can check the result once the browser - // is up and running. - appData->flags |= - DllBlocklist_CheckStatus() ? NS_XRE_DLL_BLOCKLIST_ENABLED : 0; -#endif - // xreDirectory already has a refcount from NS_NewLocalFile - appData->xreDirectory = xreDirectory; - int result = XRE_main(argc, argv, appData, mainFlags); - XRE_FreeAppData(appData); - return result; - } - - ScopedAppData appData(&sAppData); - nsCOMPtr exeFile; - rv = mozilla::BinaryPath::GetFile(argv[0], getter_AddRefs(exeFile)); - if (NS_FAILED(rv)) { - Output("Couldn't find the application directory.\n"); - return 255; - } - - nsCOMPtr greDir; - exeFile->GetParent(getter_AddRefs(greDir)); -#ifdef XP_MACOSX - greDir->SetNativeLeafName(NS_LITERAL_CSTRING(kOSXResourcesFolder)); -#endif - nsCOMPtr appSubdir; - greDir->Clone(getter_AddRefs(appSubdir)); - appSubdir->Append(NS_LITERAL_STRING(kDesktopFolder)); - - SetStrongPtr(appData.directory, static_cast(appSubdir.get())); - // xreDirectory already has a refcount from NS_NewLocalFile - appData.xreDirectory = xreDirectory; - -#if defined(HAS_DLL_BLOCKLIST) - appData.flags |= - DllBlocklist_CheckStatus() ? NS_XRE_DLL_BLOCKLIST_ENABLED : 0; -#endif - -#ifdef LIBFUZZER - if (getenv("LIBFUZZER")) - XRE_LibFuzzerSetMain(argc, argv, libfuzzer_main); -#endif - - return XRE_main(argc, argv, &appData, mainFlags); -} - -static bool -FileExists(const char *path) -{ -#ifdef XP_WIN - wchar_t wideDir[MAX_PATH]; - MultiByteToWideChar(CP_UTF8, 0, path, -1, wideDir, MAX_PATH); - DWORD fileAttrs = GetFileAttributesW(wideDir); - return fileAttrs != INVALID_FILE_ATTRIBUTES; -#else - return access(path, R_OK) == 0; -#endif -} - -static nsresult -InitXPCOMGlue(const char *argv0, nsIFile **xreDirectory) -{ - char exePath[MAXPATHLEN]; - - nsresult rv = mozilla::BinaryPath::Get(argv0, exePath); - if (NS_FAILED(rv)) { - Output("Couldn't find the application directory.\n"); - return rv; - } - - char *lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]); - if (!lastSlash || - (size_t(lastSlash - exePath) > MAXPATHLEN - sizeof(XPCOM_DLL) - 1)) - return NS_ERROR_FAILURE; - - strcpy(lastSlash + 1, XPCOM_DLL); - - if (!FileExists(exePath)) { - Output("Could not find the Mozilla runtime.\n"); - return NS_ERROR_FAILURE; - } - - // We do this because of data in bug 771745 - XPCOMGlueEnablePreload(); - - rv = XPCOMGlueStartup(exePath); - if (NS_FAILED(rv)) { - Output("Couldn't load XPCOM.\n"); - return rv; - } - - rv = XPCOMGlueLoadXULFunctions(kXULFuncs); - if (NS_FAILED(rv)) { - Output("Couldn't load XRE functions.\n"); - return rv; - } - - // This will set this thread as the main thread. - NS_LogInit(); - - if (xreDirectory) { - // chop XPCOM_DLL off exePath - *lastSlash = '\0'; -#ifdef XP_MACOSX - lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]); - strcpy(lastSlash + 1, kOSXResourcesFolder); -#endif -#ifdef XP_WIN - rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), false, - xreDirectory); -#else - rv = NS_NewNativeLocalFile(nsDependentCString(exePath), false, - xreDirectory); -#endif - } - - return rv; -} - -int main(int argc, char* argv[], char* envp[]) -{ - mozilla::TimeStamp start = mozilla::TimeStamp::Now(); - -#ifdef HAS_DLL_BLOCKLIST - DllBlocklist_Initialize(); - -#ifdef DEBUG - // In order to be effective against AppInit DLLs, the blocklist must be - // initialized before user32.dll is loaded into the process (bug 932100). - if (GetModuleHandleA("user32.dll")) { - fprintf(stderr, "DLL blocklist was unable to intercept AppInit DLLs.\n"); - } -#endif -#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")) { - nsresult rv = InitXPCOMGlue(argv[0], nullptr); - if (NS_FAILED(rv)) { - return 255; - } - - int result = content_process_main(argc, argv); - - // InitXPCOMGlue calls NS_LogInit, so we need to balance it here. - NS_LogTerm(); - - return result; - } -#endif - - - nsIFile *xreDirectory; - - nsresult rv = InitXPCOMGlue(argv[0], &xreDirectory); - if (NS_FAILED(rv)) { - return 255; - } - - XRE_StartupTimelineRecord(mozilla::StartupTimeline::START, start); - -#ifdef MOZ_BROWSER_CAN_BE_CONTENTPROC - XRE_EnableSameExecutableForContentProc(); -#endif - - int result = do_main(argc, argv, envp, xreDirectory); - - 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. - XRE_StopLateWriteChecks(); -#endif - - return result; -} diff --git a/app/palemoon.exe.manifest b/app/palemoon.exe.manifest deleted file mode 100644 index 465effa..0000000 --- a/app/palemoon.exe.manifest +++ /dev/null @@ -1,48 +0,0 @@ - - - -Pale Moon - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - - - - diff --git a/app/permissions b/app/permissions deleted file mode 100644 index 4d90be8..0000000 --- a/app/permissions +++ /dev/null @@ -1,14 +0,0 @@ -# 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... - -# XPInstall -origin install 1 http://www.palemoon.org -origin install 1 https://www.palemoon.org - -origin install 1 http://addons.palemoon.org -origin install 1 https://addons.palemoon.org diff --git a/app/profile/channel-prefs.js b/app/profile/channel-prefs.js deleted file mode 100644 index feb27c1..0000000 --- a/app/profile/channel-prefs.js +++ /dev/null @@ -1,6 +0,0 @@ -#filter substitution -/* 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/app/profile/extensions/moz.build b/app/profile/extensions/moz.build deleted file mode 100644 index df43182..0000000 --- a/app/profile/extensions/moz.build +++ /dev/null @@ -1,7 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; 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/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/Makefile.in b/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/Makefile.in deleted file mode 100644 index ff9319d..0000000 --- a/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/Makefile.in +++ /dev/null @@ -1,10 +0,0 @@ -# -# 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/. - -FILES := \ - install.rdf.in \ - $(NULL) -FILES_PATH = $(FINAL_TARGET)/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd} -PP_TARGETS := FILES diff --git a/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf.in b/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf.in deleted file mode 100644 index f495013..0000000 --- a/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf.in +++ /dev/null @@ -1,40 +0,0 @@ - - - - -#filter substitution - - - - - {972ce4c6-7e08-4474-a285-3208198ce6fd} - @MOZ_APP_VERSION@ - - - - - @MOZ_APP_ID@ - @MOZ_APP_VERSION@ - @MOZ_APP_VERSION@ - - - - - Default - The default theme. - - - Moonchild Productions - Mozilla Contributors - - - true - - classic/1.0 - - - diff --git a/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/moz.build b/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/moz.build deleted file mode 100644 index e14ac8e..0000000 --- a/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/moz.build +++ /dev/null @@ -1,8 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; 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_ID'] = CONFIG['MOZ_APP_ID'] \ No newline at end of file diff --git a/app/profile/pagethemes.rdf b/app/profile/pagethemes.rdf deleted file mode 100644 index 3d09b95..0000000 --- a/app/profile/pagethemes.rdf +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/app/profile/prefs.js b/app/profile/prefs.js deleted file mode 100644 index 8c6f0d6..0000000 --- a/app/profile/prefs.js +++ /dev/null @@ -1,13 +0,0 @@ -/* 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/app/profile/webbrowser.js b/app/profile/webbrowser.js deleted file mode 100644 index b7698a8..0000000 --- a/app/profile/webbrowser.js +++ /dev/null @@ -1,1205 +0,0 @@ -# -*- Mode: JavaScript; tab-width: 4; 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/. - -// 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"); - -// Display the "Get Add-ons" pane in the Add-on Manager -pref("extensions.getAddons.showPane", true); - -// Disables some extra Extension System Logging (can increase 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", "1.5"); - -#define AM_DOMAIN addons.palemoon.org -#define AM_AUS_ARGS 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% - -// Preferences for AMO integration -pref("extensions.getAddons.cache.enabled", false); -pref("extensions.getAddons.maxResults", 10); -pref("extensions.getAddons.get.url", "https://@AM_DOMAIN@/?component=integration&type=internal&request=get&addonguid=%IDS%&os=%OS%&version=%VERSION%"); -pref("extensions.getAddons.getWithPerformance.url", "https://@AM_DOMAIN@/?component=integration&type=internal&request=get&addonguid=%IDS%&os=%OS%&version=%VERSION%"); -pref("extensions.getAddons.search.browseURL", "https://@AM_DOMAIN@/search/?terms=%TERMS%"); -pref("extensions.getAddons.search.url", "https://@AM_DOMAIN@/?component=integration&type=internal&request=search&q=%TERMS%&locale=%LOCALE%&os=%OS%&version=%VERSION%"); -pref("extensions.webservice.discoverURL", "http://@AM_DOMAIN@/?component=discover"); -pref("extensions.getAddons.recommended.url", "https://@AM_DOMAIN@/?component=integration&type=internal&request=recommended&locale=%LOCALE%&os=%OS%"); -pref("extensions.getAddons.browseAddons", "http://@AM_DOMAIN@/"); -pref("extensions.getAddons.recommended.browseURL", "https://@AM_DOMAIN@/?component=integration&type=external&request=recommended"); - -// Blocklist preferences -pref("extensions.blocklist.enabled", false); // Disable blocklist -pref("extensions.blocklist.interval", 0); // Never auto-update blocklist -pref("extensions.blocklist.level.updated", false); -// Controls what level the blocklist switches from warning about items to forcibly -// blocking them. -pref("extensions.blocklist.level", 2); -pref("extensions.blocklist.url", "https://blocklist.palemoon.org/?version=%VERSION%"); -pref("extensions.blocklist.detailsURL", "https://blocklist.palemoon.org/about.shtml"); -pref("extensions.blocklist.itemURL", "https://blocklist.palemoon.org/info/?id=%blockID%"); - -pref("extensions.update.autoUpdateDefault", false); - -// 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); - -// Dictionary download preference -pref("browser.dictionaries.download.url", "https://@AM_DOMAIN@/dictionaries/"); - -// Get More Tools link URL -pref("browser.getdevtools.url","https://@AM_DOMAIN@/?component=integration&type=external&request=devtools"); - -// Feedback URL -pref("browser.feedback.url", "https://forum.palemoon.org"); - -// Help button in slow startup dialog -pref("browser.slowstartup.help.url", "http://www.palemoon.org/support/slowstartup.shtml"); - -// Whether to escape to a content-less page if a user presses "Get me out of here" -// on a network error page (e.g. cert error) -pref("browser.escape_to_blank", false); - -// The minimum delay in seconds for the timer to fire. -// default=2 minutes -pref("app.update.timerMinimumDelay", 0); - -// App-specific update preferences - -// The interval to check for updates (app.update.interval) is defined in -// palemoon-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); - -// When |app.update.cert.requireBuiltIn| is true or not specified the -// final certificate and all certificates the connection is redirected to before -// the final certificate for the url specified in the |app.update.url| -// preference must be built-in. -pref("app.update.cert.requireBuiltIn", false); - -// When |app.update.cert.checkAttributes| is true or not specified the -// certificate attributes specified in the |app.update.certs.| preference branch -// are checked against the certificate for the url specified by the -// |app.update.url| preference. -pref("app.update.cert.checkAttributes", true); - -// The number of certificate attribute check failures to allow for background -// update checks before notifying the user of the failure. User initiated update -// checks always notify the user of the certificate attribute check failure. -pref("app.update.cert.maxErrors", 5); - -// The |app.update.certs.| preference branch contains branches that are -// sequentially numbered starting at 1 that contain attribute name / value -// pairs for the certificate used by the server that hosts the update xml file -// as specified in the |app.update.url| preference. When these preferences are -// present the following conditions apply for a successful update check: -// 1. the uri scheme must be https -// 2. the preference name must exist as an attribute name on the certificate and -// the value for the name must be the same as the value for the attribute name -// on the certificate. -// If these conditions aren't met it will be treated the same as when there is -// no update available. This validation will not be performed when the -// |app.update.url.override| user preference has been set for testing updates or -// when the |app.update.cert.checkAttributes| preference is set to false. Also, -// the |app.update.url.override| preference should ONLY be used for testing. -pref("app.update.certs.1.issuerName", "CN=COMODO RSA Domain Validation Secure Server CA,O=COMODO CA Limited,L=Salford,ST=Greater Manchester,C=GB"); -pref("app.update.certs.1.commonName", "*.palemoon.org"); - -// Whether or not app updates are enabled -pref("app.update.enabled", false); - -// This preference turns on app.update.mode and allows automatic download and -// install to take place. We use a separate boolean toggle for this to make -// the UI easier to construct. -pref("app.update.auto", false); - -// See chart in nsUpdateService.js source for more details -pref("app.update.mode", 1); - -// If set to true, the Update Service will present no UI for any event. -pref("app.update.silent", false); - -// If set to true, the Update Service will apply updates in the background -// when it finishes downloading them. -pref("app.update.staging.enabled", true); - -// app.update.url.manual is in branding section -// app.update.url.details is in branding section - -// User-settable override to app.update.url for testing purposes. -//pref("app.update.url.override", ""); - -// 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", 180); - -// Whether or not we show a dialog box informing the user that the update was -// successfully applied. This is off in Firefox by default since we show a -// upgrade start page instead! Other apps may wish to show this UI, and supply -// a whatsNewURL field in their brand.properties that contains a link to a page -// which tells users what's new in this new update. -pref("app.update.showInstalledUI", false); - -// 0 = suppress prompting for incompatibilities if there are updates available -// to newer versions of installed addons that resolve them. -// 1 = suppress prompting for incompatibilities only if there are VersionInfo -// updates available to installed addons that resolve them, not newer -// versions. -pref("app.update.incompatible.mode", 0); - -// Symmetric (can be overridden by individual extensions) update preferences. -// e.g. -// extensions.{GUID}.update.enabled -// extensions.{GUID}.update.url -// .. etc .. -// -pref("extensions.update.enabled", false); -pref("extensions.update.url", "https://@AM_DOMAIN@/?component=aus&@AM_AUS_ARGS@"); -//pref("extensions.update.background.url", "https://@AM_DOMAIN@/?component=aus&@AM_AUS_ARGS@"); -pref("extensions.update.interval", 0); // Do NOT check for updates to Extensions and - // Themes -// 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("xpinstall.whitelist.required", false); -// Allow installing XPI add-ons by direct URL requests (no referrer) -pref("xpinstall.whitelist.directRequest", true); -// Allow installing XPI add-ons from file referrers (chrome/file) -pref("xpinstall.whitelist.fileRequest", true); - -pref("extensions.install.requireBuiltInCerts", false); -// Only allow installation of extensions from https, chrome or file schemes -pref("extensions.install.requireSecureOrigin", false); -// Allow installation of distribution/bundles extensions -pref("extensions.installDistroAddons", true); - -pref("lightweightThemes.animation.enabled", false); - -pref("keyword.enabled", true); - -pref("general.useragent.locale", "@AB_CD@"); -pref("general.skins.selectedSkin", "classic/1.0"); - -// Native UA mode by default for unbranded -pref("general.useragent.compatMode", 0); -pref("general.useragent.compatMode.gecko", false); -pref("general.useragent.compatMode.firefox", false); - -pref("general.smoothScroll", true); -#ifdef UNIX_BUT_NOT_MAC -pref("general.autoScroll", false); -#else -pref("general.autoScroll", true); -#endif - -pref("general.useragent.complexOverride.moodle", false); // bug 797703 - -// 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", ""); -pref("browser.shell.skipDefaultBrowserCheckOnFirstRun", false); -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", 0); -pref("browser.startup.homepage", "https://wiby.me"); - -pref("browser.slowStartup.notificationDisabled", false); -pref("browser.slowStartup.timeThreshold", 60000); -pref("browser.slowStartup.maxSamples", 5); - -pref("browser.enable_automatic_image_resizing", true); -pref("browser.chrome.site_icons", true); -pref("browser.chrome.favicons", true); -// If enabled, will process favicons by drawing them on a canvas, -// optimizing display size for the UI. This also strips animations. -pref("browser.chrome.favicons.process", false); -// 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.animateUp", 1); -pref("browser.overlink-delay", 80); - -pref("browser.urlbar.clickSelectsAll", true); -pref("browser.urlbar.doubleClickSelectsAll", false); -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", 12); -// 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.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); - -// 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", false); - -// Display punycode in identity panel: -// 0 = Display IDN name -// 1 = Display punycode name for DV domains -// 2 = Also display punycode for HTTP sites if IDN name used -pref("browser.identity.display_punycode", 1); - -// Address bar RSS icon control, show by default -pref("browser.urlbar.rss", true); - -pref("browser.altClickSave", true); - -// Enable logging downloads operations to the Error Console. -pref("browser.download.debug", false); - -// 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); - -// Do not use default download location as standard, but ask. -pref("browser.download.useDownloadDir", false); - -pref("browser.download.folderList", 1); -pref("browser.download.manager.showAlertOnComplete", true); -pref("browser.download.manager.showAlertInterval", 2000); -pref("browser.download.manager.retention", 2); -pref("browser.download.manager.showWhenStarting", true); -pref("browser.download.manager.closeWhenDone", false); -pref("browser.download.manager.focusWhenStarting", false); -pref("browser.download.manager.flashCount", 10); -pref("browser.download.manager.addToRecentDocs", true); -pref("browser.download.manager.quitBehavior", 2); -pref("browser.download.manager.scanWhenDone", true); -pref("browser.download.manager.resumeOnWakeDelay", 10000); - -// This records whether or not the panel has been shown at least once. -pref("browser.download.panel.shown", false); - -// This records whether or not at least one session with the Downloads Panel -// enabled has been completed already. -pref("browser.download.panel.firstSessionCompleted", false); - -// search engines URL -pref("browser.search.searchEnginesURL", "https://@AM_DOMAIN@/?component=integration&type=external&request=searchplugins"); - -// pointer to the default engine name -pref("browser.search.defaultenginename", "chrome://browser-region/locale/region.properties"); - -// disable logging for the search service by default -pref("browser.search.log", false); - -// 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"); -pref("browser.search.order.4", "chrome://browser-region/locale/region.properties"); - -// search bar results always open in a new tab -pref("browser.search.openintab", false); - -// do not swap focus to the context search tab. -pref("browser.search.context.loadInBackground", true); - -// if no result, add the search term so that the panel of the new UI is shown anyway -pref("browser.search.showOneOffButtons", true); - -// send ping to the server to update -pref("browser.search.update", true); - -// disable logging for the search service update system by default -pref("browser.search.update.log", false); - -// Check whether we need to perform engine updates every 6 hours -pref("browser.search.update.interval", 21600); - -// enable search suggestions by default -pref("browser.search.suggest.enabled", true); - -#ifdef MOZ_OFFICIAL_BRANDING -// {moz:official} expands to "official" -pref("browser.search.official", true); -#endif - -pref("browser.sessionhistory.max_entries", 50); - -// 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.autoHide", false); -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.noWindowActivationOnExternal", false); -pref("browser.tabs.tabClipWidth", 140); -pref("browser.tabs.animate", true); -pref("browser.tabs.onTop", false); -#ifdef XP_WIN -pref("browser.tabs.drawInTitlebar", true); -#else -pref("browser.tabs.drawInTitlebar", false); -#endif -pref("browser.tabs.resize_immediately", false); - -// Where to show tab close buttons: -// 0 on active tab only -// 1 on all tabs until tabClipWidth is reached, then active tab only -// 2 no close buttons at all -// 3 at the end of the tabstrip -pref("browser.tabs.closeButtons", 1); - -// 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.allTabs.previews", true); -pref("browser.ctrlTab.previews", true); -pref("browser.ctrlTab.recentlyUsedLimit", 7); - -// 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", 10); - -// 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); -// Allow JS to set status messages -pref("dom.disable_window_status_change", false); -// 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); - -// Disable touch events on Desktop Firefox by default until they are properly -// supported (bug 736048) -pref("dom.w3c_touch_events.enabled", 0); - -// 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.passwords", false); -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.connectivityData", 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.connectivityData", 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 -pref("privacy.sanitize.timeSpan", 1); -pref("privacy.sanitize.sanitizeOnShutdown", false); - -pref("privacy.sanitize.migrateFx3Prefs", false); - -pref("network.proxy.share_proxy_settings", false); // use the same proxy settings for all protocols - -// Disable speculative half-open connections on Pale Moon -pref("network.http.speculative-parallel-limit", 0); - -// Enable pipelining over SSL -pref("network.http.pipelining.ssl", true); - -// Disable predictor/prefetch of URIs -pref("network.predictor.enabled", false); -pref("network.prefetch-next", false); - -// Disable DNS prefetching -pref("network.dns.disablePrefetch", true); - -// Tune DNS lookups -pref("network.dnsCacheEntries", 800); -pref("network.dnsCacheExpiration", 180); // 3 minutes if no TTL given by DNS resolver -pref("network.dns.get-ttl", true); // Get and use DNS resolver TTL -pref("network.dnsCacheExpirationGracePeriod", 60); // 1 minute grace period for stale entry - -// 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: Scroll contents -// 2: Go back or go forward, in your history -// 3: Zoom in or out -// 4: Scroll contents with X and Y swapped -#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); - -// Work Offline is best manually managed by the user. -pref("network.manage-offline-status", false); - -// 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); - -// by default we show an infobar message when pages require plugins that are blocked, or are outdated -pref("plugins.hide_infobar_for_blocked_plugin", false); -pref("plugins.hide_infobar_for_outdated_plugin", false); - -// Pale Moon:pref to always show the plugin indicator or not (default=false) -pref("plugins.always_show_indicator", false); - -pref("plugins.update.url", "https://aus.palemoon.org/plugincheck/"); -pref("plugins.update.notifyUser", false); - -//Enable tri-state option (Always/Never/Ask) -pref("plugins.click_to_play", true); - -#ifdef XP_WIN -pref("browser.preferences.instantApply", false); -#else -pref("browser.preferences.instantApply", true); -#endif -#ifdef XP_MACOSX -pref("browser.preferences.animateFadeIn", true); -#else -pref("browser.preferences.animateFadeIn", false); -#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 - -// Pale Moon never eats the space with word selection, regardless of O.S. -pref("layout.word_select.eat_space_to_next_word", false); - -// 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("gecko.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("gecko.handlerService.schemes.webcal.0.name", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.webcal.0.uriTemplate", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.webcal.1.name", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.webcal.1.uriTemplate", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.webcal.2.name", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.webcal.2.uriTemplate", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.webcal.3.name", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.webcal.3.uriTemplate", "chrome://browser-region/locale/region.properties"); - -// mailto -pref("gecko.handlerService.schemes.mailto.0.name", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.mailto.0.uriTemplate", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.mailto.1.name", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.mailto.1.uriTemplate", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.mailto.2.name", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.mailto.2.uriTemplate", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.mailto.3.name", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.mailto.3.uriTemplate", "chrome://browser-region/locale/region.properties"); - -// irc -pref("gecko.handlerService.schemes.irc.0.name", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.irc.0.uriTemplate", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.irc.1.name", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.irc.1.uriTemplate", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.irc.2.name", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.irc.2.uriTemplate", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.irc.3.name", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.irc.3.uriTemplate", "chrome://browser-region/locale/region.properties"); - -// ircs -pref("gecko.handlerService.schemes.ircs.0.name", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.ircs.0.uriTemplate", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.ircs.1.name", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.ircs.1.uriTemplate", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.ircs.2.name", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.ircs.2.uriTemplate", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.ircs.3.name", "chrome://browser-region/locale/region.properties"); -pref("gecko.handlerService.schemes.ircs.3.uriTemplate", "chrome://browser-region/locale/region.properties"); - -// By default, we don't want protocol/content handlers to be registered from a different host, see bug 402287 -pref("gecko.handlerService.allowRegisterFromDifferentHost", false); - -pref("browser.geolocation.warning.infoURL", "http://www.palemoon.org/info-url/geolocation.shtml"); -pref("browser.mixedcontent.warning.infoURL", "http://www.palemoon.org/info-url/mixedcontent.shtml"); -pref("browser.push.warning.infoURL", "https://www.palemoon.org/info-url/push.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.sessionstore.resume_from_crash", true); -pref("browser.sessionstore.resume_session_once", false); - -// minimal interval between two save operations in milliseconds -pref("browser.sessionstore.interval",60000); -// maximum amount of POSTDATA to be saved in bytes per history entry (-1 = all of it) -// (NB: POSTDATA will be saved either entirely or not at all) -pref("browser.sessionstore.postdata", 0); -// on which sites to save text data, POSTDATA and cookies -// 0 = everywhere, 1 = unencrypted sites, 2 = nowhere -pref("browser.sessionstore.privacy_level", 0); -// the same as browser.sessionstore.privacy_level, but for saving deferred session data -pref("browser.sessionstore.privacy_level_deferred", 1); -// 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 save (-1 = all of them) -pref("browser.sessionstore.max_serialize_back", 10); -// number of forward button session history entries to save (-1 = all of them) -pref("browser.sessionstore.max_serialize_forward", -1); -// restore_on_demand overrides browser.sessionstore.max_concurrent_tabs -// 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 browser.sessionstore.max_concurrent_tabs and restore_hidden_tabs are -// respected. Selected tabs are always restored regardless of this pref. -pref("browser.sessionstore.restore_on_demand", true); -// The number of tabs that can restore concurrently. -// Sane values are 1..10, default 3. -pref("browser.sessionstore.max_concurrent_tabs", 3); -// 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); -// Pale Moon: Allow the user to bypass cached versions of pages when restoring -// tabs from a previous session -// 0 = standard behavior: pull fully from cache -// 1 = perform a soft refresh when restoring a tab (check network) -// 2 = perform a hard refresh when restoring a tab (bypass cache completely) -pref("browser.sessionstore.cache_behavior", 0); -// Pale Moon: Allow exact positioning of windows to previous locations, even -// if they would be outside of the screen bounds -pref("browser.sessionstore.exactPos", false); - -// 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); -pref("places.frecency.bookmarkVisitBonus", 75); -pref("places.frecency.downloadVisitBonus", 0); -pref("places.frecency.permRedirectVisitBonus", 0); -pref("places.frecency.tempRedirectVisitBonus", 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); - -// Controls the behavior of data storage for offline apps -// 0 - Deny storage of offline app data without prompting (breaks sites!) -// 1 - Ask the user if a website wants to store offline app data -// 2 - Allow storage of offline app data without prompting (default) -pref("offline-apps.permissions", 2); -// True if storage of offline app data is allowed without prompting. -pref("offline-apps.allow_by_default", true); -// 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); - -// base URL for web-based support pages -pref("app.support.baseURL", "http://www.palemoon.org/support/"); - -// 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"); - -// Whether to use a panel that looks like an OS X sheet for customization -#ifdef XP_MACOSX -pref("toolbar.customization.usesheet", true); -#else -pref("toolbar.customization.usesheet", false); -#endif - -#ifdef XP_MACOSX -// On mac, the default pref is per-architecture -pref("dom.ipc.plugins.enabled.i386", true); -pref("dom.ipc.plugins.enabled.x86_64", true); -#else -pref("dom.ipc.plugins.enabled", true); -#endif - -pref("browser.tabs.remote", false); - -// 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 - -#ifdef MOZ_SERVICES_SYNC -// Info when outdated sync detected -pref("services.sync.outdated.url", "http://www.palemoon.org/sync/update/"); -// The sync engines to use. -pref("services.sync.registerEngines", "Bookmarks,Form,History,Password,Prefs,Tab,Addons"); -// 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.app.update.mode", true); -pref("services.sync.prefs.sync.browser.download.manager.closeWhenDone", true); -pref("services.sync.prefs.sync.browser.download.manager.retention", true); -pref("services.sync.prefs.sync.browser.download.manager.scanWhenDone", true); -pref("services.sync.prefs.sync.browser.download.manager.showWhenStarting", 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.offline-apps.notify", true); -pref("services.sync.prefs.sync.browser.search.selectedEngine", 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.autoHide", true); -pref("services.sync.prefs.sync.browser.tabs.closeButtons", 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.default.behavior", true); -pref("services.sync.prefs.sync.browser.urlbar.maxRichResults", 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.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.isThemeSelected", 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.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.passwords", 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.clearOnShutdown.connectivityData", true); -pref("services.sync.prefs.sync.privacy.donottrackheader.enabled", true); -pref("services.sync.prefs.sync.privacy.sanitize.sanitizeOnShutdown", 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.signon.rememberSignons", true); -pref("services.sync.prefs.sync.spellchecker.dictionary", true); -pref("services.sync.prefs.sync.xpinstall.whitelist.required", true); -#endif - -// Disable Geolocation services -pref("geo.enabled", false); - -// Enable the error console -pref("devtools.errorconsole.enabled", true); - -// 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); -// Allow tab-modal prompts to switch tab focus -pref("prompts.tab_modal.focusSwitch", true); - -// Defines the url to be used for new tabs. -pref("browser.newtab.url", "about:logopage"); -pref("browser.newtab.choice", 1); - -// Activates preloading of the new tab url. -pref("browser.newtab.preload", false); - -// Toggles the content of 'about:newtab'. Shows the grid when enabled. -pref("browser.newtabpage.enabled", true); - -// Disables capturing of page thumbnails -pref("browser.pagethumbnails.capturing_disabled", false); - -// enables showing basic placeholders for missing thumbnails -pref("browser.newtabpage.thumbnailPlaceholder", false); - -// number of columns of newtab grid -pref("browser.newtabpage.columns", 4); - -// number of rows of newtab grid -pref("browser.newtabpage.rows", 3); - -// Enable the DOM fullscreen API. -pref("full-screen-api.enabled", true); - -// about:permissions -// Maximum number of sites to return from the places database. -// 0-100 (currently) -pref("permissions.places-sites-limit", 50); - -// Built-in default permissions. -pref("permissions.manager.defaultsUrl", "resource://app/defaults/permissions"); - -// 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); - -// 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); - -// Turn on the CSP 1.0 parser for Content Security Policy headers -pref("security.csp.speccompliant", true); - -// Block insecure active content on https pages -pref("security.mixed_content.block_active_content", true); - -// Disable Microsoft Family Safety MitM support -pref("security.family_safety.mode", 0); - -// Override the Gecko-default value of false for Pale Moon. -pref("plain_text.wrap_long_lines", true); - -pref("media.webaudio.enabled", 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"); - -//Pale Moon padlock overlay preferences -pref("browser.padlock.shown", true); -/* Where to show the padlock - 1 = inside identity button, right side - 2 = inside identity button, left side - 3 = urlbar, right side (next to bookmark star) - 4 = statusbar - 5 = tabs bar, right side - 6-10 = same locations, classic style padlock */ -pref("browser.padlock.style", 1); -// address bar border, 0 = no border, 1 = border, 2 = border only on secure sites -pref("browser.padlock.urlbar_background", 2); - -//Pale Moon standalone image background color -pref("browser.display.standalone_images.background_color", "#2E3B41"); - -// These are the thumbnail width/height set in about:newtab. -// If you change this, make sure the size is sufficient for tile sizes -// in about:newtab. These values are in CSS pixels. -pref("toolkit.pageThumbs.minWidth", 250); -pref("toolkit.pageThumbs.minHeight", 180); - -// On GTK, we now default to showing the menubar only when alt is pressed: -#ifdef MOZ_WIDGET_GTK -pref("ui.key.menuAccessKeyFocuses", true); -#endif - -// When a user cancels this number of authentication dialogs coming from -// a single web page (eTLD+1) in a row, all following authentication dialogs -// will be blocked (automatically canceled) for that page. -// This counter is per-tab and per-domain to minimize false positives. -// The counter resets when the page is reloaded from the UI -// (content-reloads do NOT clear this to mitigate reloading tricks). -pref("prompts.authentication_dialog_abuse_limit", 3); - -// ****************** s4e prefs ****************** -pref("status4evar.addonbar.borderStyle", false); -pref("status4evar.addonbar.closeButton", false); -pref("status4evar.addonbar.legacyShim", true); -pref("status4evar.addonbar.windowGripper", true); - -pref("status4evar.advanced.status.detectFullScreen", false); -pref("status4evar.advanced.status.detectVideo", true); - -pref("status4evar.download.button.action", 1); -pref("status4evar.download.button.action.command", ""); -pref("status4evar.download.color.active", "#333399"); -pref("status4evar.download.color.paused", "#808080"); -pref("status4evar.download.force", false); -pref("status4evar.download.label", 0); -pref("status4evar.download.label.force", true); -pref("status4evar.download.notify.animate", true); -pref("status4evar.download.notify.timeout", 60); -pref("status4evar.download.progress", 1); -pref("status4evar.download.tooltip", 2); - -pref("status4evar.firstRun", true); - -pref("status4evar.progress.toolbar.css", "#333399"); -pref("status4evar.progress.toolbar.force", false); -pref("status4evar.progress.toolbar.style", false); -pref("status4evar.progress.toolbar.style.advanced", false); - -pref("status4evar.status", 1); -pref("status4evar.status.default", true); -pref("status4evar.status.network", true); -pref("status4evar.status.network.xhr", true); -pref("status4evar.status.timeout", 30); -pref("status4evar.status.linkOver", 1); -pref("status4evar.status.linkOver.delay.show", 0); -pref("status4evar.status.linkOver.delay.hide", 0); - -pref("status4evar.status.toolbar.maxLength", 0); - -pref("status4evar.status.popup.invertMirror", false); -pref("status4evar.status.popup.mouseMirror", true); diff --git a/app/splash.rc b/app/splash.rc deleted file mode 100644 index 539c342..0000000 --- a/app/splash.rc +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- 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 "palemoon.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/base/content/aboutDialog.css b/base/content/aboutDialog.css deleted file mode 100644 index d96eba5..0000000 --- a/base/content/aboutDialog.css +++ /dev/null @@ -1,74 +0,0 @@ -/* 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/. */ - -#aboutPMDialogContainer { - width: 700px; - height: 410px; -} - -#aboutVersionBox { - font-family: Arial, helvetica; - height: 38 px; -} - -#aboutVersion { - text-align: center; - font-size: 18px; - font-weight: bold; - margin: 4px; -} - -#distribution, -#distributionId { - text-align: center; - font-size: 14px; - font-weight: bold; - display: none; - margin-top: 0; - margin-bottom: 0; -} - -#aboutTextBox { - font-family: Arial, helvetica; - font-size: 14px; - margin: 5px 20px; - padding: 4px 10px 0px; - border-radius: 3px; - color: black; - background-color: rgba(240, 240, 240, .6); -} - -#aboutLinkBox { - font-family: Arial, helvetica; -} - -.text-credits { - margin: 5px 0px; -} - -.text-center { - text-align: center; -} - -.text-link, -.text-link:focus { - margin: 0px; - padding: 0px; -} - -.bottom-link, -.bottom-link:focus { - text-align: center; - text-decoration: none !important; - padding: 4px; - border-radius: 3px; - color: #244C8A; - background-color: rgba(240, 240, 240, .7); - margin: 0 40px; - transition: background-color 0.5s ease-out; -} - -.bottom-link:hover { - background-color: rgba(240, 240, 255, .95); -} diff --git a/base/content/aboutDialog.js b/base/content/aboutDialog.js deleted file mode 100644 index e4e18f2..0000000 --- a/base/content/aboutDialog.js +++ /dev/null @@ -1,62 +0,0 @@ -# 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/. - -// 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 if this is an "a#" or "b#" build - let version = Services.appinfo.version; - if (/[ab]\d+$/.test(version)) { - let buildID = Services.appinfo.appBuildID; - let buildDate = buildID.slice(0,4) + "-" + buildID.slice(4,6) + "-" + buildID.slice(6,8); - document.getElementById("aboutVersion").textContent += " (" + buildDate + ")"; - } - -#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 - -// get release notes URL from prefs - var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"] - .getService(Components.interfaces.nsIURLFormatter); - var releaseNotesURL = formatter.formatURLPref("app.releaseNotesURL"); - if (releaseNotesURL != "about:blank") { - var relnotes = document.getElementById("releaseNotesURL"); - relnotes.setAttribute("href", releaseNotesURL); - } -} diff --git a/base/content/aboutDialog.xul b/base/content/aboutDialog.xul deleted file mode 100644 index 91fa81e..0000000 --- a/base/content/aboutDialog.xul +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - -%brandDTD; - -%aboutDialogDTD; -]> - -#ifdef XP_MACOSX - -#endif - - - - - - - - diff --git a/base/content/global-devtools-theme-scripts.inc b/base/content/global-devtools-theme-scripts.inc deleted file mode 100644 index 408728e..0000000 --- a/base/content/global-devtools-theme-scripts.inc +++ /dev/null @@ -1,6 +0,0 @@ -# -*- 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/. - - - -# All sets except for popupsets (commands, keys, stringbundles and broadcasters) *must* go into the -# browser-sets.inc file for sharing with hiddenWindow.xul. -#include browser-sets.inc - -# The entire main menubar is placed into browser-menubar.inc, so that it can be shared by -# hiddenWindow.xul. -#include browser-menubar.inc - - - - - - - - - - - diff --git a/base/content/nsContextMenu.js b/base/content/nsContextMenu.js deleted file mode 100644 index 916dd26..0000000 --- a/base/content/nsContextMenu.js +++ /dev/null @@ -1,1603 +0,0 @@ -# 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/. - -Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm"); - -var gContextMenuContentData = null; - -function nsContextMenu(aXulMenu, aIsShift) { - this.shouldDisplay = true; - this.initMenu(aXulMenu, aIsShift); -} - -// Prototype for nsContextMenu "class." -nsContextMenu.prototype = { - initMenu: function CM_initMenu(aXulMenu, aIsShift) { - // Get contextual info. - this.setTarget(document.popupNode, document.popupRangeParent, - document.popupRangeOffset); - if (!this.shouldDisplay) - return; - - this.hasPageMenu = false; - if (!aIsShift) { - this.hasPageMenu = PageMenu.maybeBuildAndAttachMenu(this.target, - aXulMenu); - } - - this.isFrameImage = document.getElementById("isFrameImage"); - this.ellipsis = "\u2026"; - try { - this.ellipsis = gPrefService.getComplexValue("intl.ellipsis", - Ci.nsIPrefLocalizedString).data; - } catch (e) { } - - this.isContentSelected = this.isContentSelection(); - this.onPlainTextLink = false; - - // Initialize (disable/remove) menu items. - this.initItems(); - }, - - hiding: function CM_hiding() { - gContextMenuContentData = null; - InlineSpellCheckerUI.clearSuggestionsFromMenu(); - InlineSpellCheckerUI.clearDictionaryListFromMenu(); - InlineSpellCheckerUI.uninit(); - }, - - initItems: function CM_initItems() { - this.initPageMenuSeparator(); - this.initOpenItems(); - this.initNavigationItems(); - this.initViewItems(); - this.initMiscItems(); - this.initSpellingItems(); - this.initSaveItems(); - this.initClipboardItems(); - this.initMediaPlayerItems(); - this.initLeaveDOMFullScreenItems(); - this.initClickToPlayItems(); - }, - - initPageMenuSeparator: function CM_initPageMenuSeparator() { - this.showItem("page-menu-separator", this.hasPageMenu); - }, - - initOpenItems: function CM_initOpenItems() { - var isMailtoInternal = false; - if (this.onMailtoLink) { - var mailtoHandler = Cc["@mozilla.org/uriloader/external-protocol-service;1"]. - getService(Ci.nsIExternalProtocolService). - getProtocolHandlerInfo("mailto"); - isMailtoInternal = (!mailtoHandler.alwaysAskBeforeHandling && - mailtoHandler.preferredAction == Ci.nsIHandlerInfo.useHelperApp && - (mailtoHandler.preferredApplicationHandler instanceof Ci.nsIWebHandlerApp)); - } - - // Time to do some bad things and see if we've highlighted a URL that - // isn't actually linked. - if (this.isTextSelected && !this.onLink) { - // Ok, we have some text, let's figure out if it looks like a URL. - let selection = document.commandDispatcher.focusedWindow - .getSelection(); - let linkText = selection.toString().trim(); - let uri; - if (/^(?:https?|ftp):/i.test(linkText)) { - try { - uri = makeURI(linkText); - } catch (ex) {} - } - // Check if this could be a valid url, just missing the protocol. - else if (/^[-a-z\d\.]+\.[-a-z\d]{2,}[-_=~:#%&\?\w\/\.]*$/i.test(linkText)) { - let uriFixup = Cc["@mozilla.org/docshell/urifixup;1"] - .getService(Ci.nsIURIFixup); - try { - uri = uriFixup.createFixupURI(linkText, uriFixup.FIXUP_FLAG_NONE); - } catch (ex) {} - } - - if (uri && uri.host) { - this.linkURI = uri; - this.linkURL = this.linkURI.spec; - this.onPlainTextLink = true; - } - } - - var shouldShow = this.onSaveableLink || isMailtoInternal || this.onPlainTextLink; - var isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(window); - this.showItem("context-openlink", shouldShow && !isWindowPrivate); - this.showItem("context-openlinkprivate", shouldShow); - this.showItem("context-openlinkintab", shouldShow); - this.showItem("context-openlinkincurrent", shouldShow); - this.showItem("context-sep-open", shouldShow); - }, - - initNavigationItems: function CM_initNavigationItems() { - var shouldShow = !(this.isContentSelected || this.onLink || this.onImage || - this.onCanvas || this.onVideo || this.onAudio || - this.onTextInput); - this.showItem("context-back", shouldShow); - this.showItem("context-forward", shouldShow); - - let stopped = XULBrowserWindow.stopCommand.getAttribute("disabled") == "true"; - - let stopReloadItem = ""; - if (shouldShow) { - stopReloadItem = stopped ? "reload" : "stop"; - } - - this.showItem("context-reload", stopReloadItem == "reload"); - this.showItem("context-stop", stopReloadItem == "stop"); - this.showItem("context-sep-stop", !!stopReloadItem); - - // XXX: Stop is determined in browser.js; the canStop broadcaster is broken - //this.setItemAttrFromNode( "context-stop", "disabled", "canStop" ); - }, - - initLeaveDOMFullScreenItems: function CM_initLeaveFullScreenItem() { - // only show the option if the user is in DOM fullscreen - var shouldShow = (this.target.ownerDocument.mozFullScreenElement != null); - this.showItem("context-leave-dom-fullscreen", shouldShow); - - // Explicitly show if in DOM fullscreen, but do not hide it has already been shown - if (shouldShow) - this.showItem("context-media-sep-commands", true); - }, - - initSaveItems: function CM_initSaveItems() { - var shouldShow = !(this.onTextInput || this.onLink || - this.isContentSelected || this.onImage || - this.onCanvas || this.onVideo || this.onAudio); - this.showItem("context-savepage", shouldShow); - this.showItem("context-sendpage", shouldShow); - - // Save+Send link depends on whether we're in a link, or selected text matches valid URL pattern. - this.showItem("context-savelink", this.onSaveableLink || this.onPlainTextLink); - this.showItem("context-sendlink", this.onSaveableLink || this.onPlainTextLink); - - // Save image depends on having loaded its content, video and audio don't. - this.showItem("context-saveimage", this.onLoadedImage || this.onCanvas); - this.showItem("context-savevideo", this.onVideo); - this.showItem("context-saveaudio", this.onAudio); - this.showItem("context-video-saveimage", this.onVideo); - this.setItemAttr("context-savevideo", "disabled", !this.mediaURL); - this.setItemAttr("context-saveaudio", "disabled", !this.mediaURL); - // Send media URL (but not for canvas, since it's a big data: URL) - this.showItem("context-sendimage", this.onImage); - this.showItem("context-sendvideo", this.onVideo); - this.showItem("context-sendaudio", this.onAudio); - this.setItemAttr("context-sendvideo", "disabled", !this.mediaURL); - this.setItemAttr("context-sendaudio", "disabled", !this.mediaURL); - }, - - initViewItems: function CM_initViewItems() { - // View source is always OK, unless in directory listing. - this.showItem("context-viewpartialsource-selection", - this.isContentSelected); - this.showItem("context-viewpartialsource-mathml", - this.onMathML && !this.isContentSelected); - - var shouldShow = !(this.isContentSelected || - this.onImage || this.onCanvas || - this.onVideo || this.onAudio || - this.onLink || this.onTextInput); - this.showItem("context-viewsource", shouldShow); - this.showItem("context-viewinfo", shouldShow); -#ifdef MOZ_DEVTOOLS - var showInspect = gPrefService.getBoolPref("devtools.inspector.enabled"); - this.showItem("inspect-separator", showInspect); - this.showItem("context-inspect", showInspect); -#endif - - this.showItem("context-sep-viewsource", shouldShow); - - // Set as Desktop background depends on whether an image was clicked on, - // and only works if we have a shell service. - var haveSetDesktopBackground = false; -#ifdef HAVE_SHELL_SERVICE - // Only enable Set as Desktop Background if we can get the shell service. - var shell = getShellService(); - if (shell) - haveSetDesktopBackground = shell.canSetDesktopBackground; -#endif - this.showItem("context-setDesktopBackground", - haveSetDesktopBackground && this.onLoadedImage); - - if (haveSetDesktopBackground && this.onLoadedImage) { - document.getElementById("context-setDesktopBackground") - .disabled = this.disableSetDesktopBackground(); - } - - // Reload image depends on an image that's not fully loaded - this.showItem("context-reloadimage", (this.onImage && !this.onCompletedImage)); - - // View image depends on having an image that's not standalone - // (or is in a frame), or a canvas. - this.showItem("context-viewimage", (this.onImage && - (!this.inSyntheticDoc || this.inFrame)) || this.onCanvas); - - // View video depends on not having a standalone video. - this.showItem("context-viewvideo", this.onVideo && (!this.inSyntheticDoc || this.inFrame)); - this.setItemAttr("context-viewvideo", "disabled", !this.mediaURL); - - // View background image depends on whether there is one, but don't make - // background images of a stand-alone media document available. - this.showItem("context-viewbgimage", shouldShow && - !this._hasMultipleBGImages && - !this.inSyntheticDoc); - this.showItem("context-sep-viewbgimage", shouldShow && - !this._hasMultipleBGImages && - !this.inSyntheticDoc); - document.getElementById("context-viewbgimage") - .disabled = !this.hasBGImage; - - this.showItem("context-viewimageinfo", this.onImage); - }, - - initMiscItems: function CM_initMiscItems() { - // Use "Bookmark This Link" if on a link. - this.showItem("context-bookmarkpage", - !(this.isContentSelected || this.onTextInput || this.onLink || - this.onImage || this.onVideo || this.onAudio)); - this.showItem("context-bookmarklink", (this.onLink && !this.onMailtoLink) || - this.onPlainTextLink); - this.showItem("context-keywordfield", - this.onTextInput && this.onKeywordField); - this.showItem("frame", this.inFrame); - - let showSearchSelect = (this.isTextSelected || this.onLink) && !this.onImage; - this.showItem("context-searchselect", showSearchSelect); - if (showSearchSelect) { - this.formatSearchContextItem(); - } - - // srcdoc cannot be opened separately due to concerns about web - // content with about:srcdoc in location bar masquerading as trusted - // chrome/addon content. - // No need to also test for this.inFrame as this is checked in the parent - // submenu. - this.showItem("context-showonlythisframe", !this.inSrcdocFrame); - this.showItem("context-openframeintab", !this.inSrcdocFrame); - this.showItem("context-openframe", !this.inSrcdocFrame); - this.showItem("context-bookmarkframe", !this.inSrcdocFrame); - this.showItem("open-frame-sep", !this.inSrcdocFrame); - - this.showItem("frame-sep", this.inFrame && this.isTextSelected); - - // Hide menu entries for images, show otherwise - if (this.inFrame) { - if (BrowserUtils.mimeTypeIsTextBased(this.target.ownerDocument.contentType)) - this.isFrameImage.removeAttribute('hidden'); - else - this.isFrameImage.setAttribute('hidden', 'true'); - } - - // BiDi UI - this.showItem("context-sep-bidi", top.gBidiUI); - this.showItem("context-bidi-text-direction-toggle", - this.onTextInput && top.gBidiUI); - this.showItem("context-bidi-page-direction-toggle", - !this.onTextInput && top.gBidiUI); - }, - - initSpellingItems: function() { - var canSpell = InlineSpellCheckerUI.canSpellCheck && this.canSpellCheck; - var onMisspelling = InlineSpellCheckerUI.overMisspelling; - var showUndo = canSpell && InlineSpellCheckerUI.canUndo(); - this.showItem("spell-check-enabled", canSpell); - this.showItem("spell-separator", canSpell || this.onEditableArea); - document.getElementById("spell-check-enabled") - .setAttribute("checked", canSpell && InlineSpellCheckerUI.enabled); - - this.showItem("spell-add-to-dictionary", onMisspelling); - this.showItem("spell-undo-add-to-dictionary", showUndo); - - // suggestion list - this.showItem("spell-suggestions-separator", onMisspelling || showUndo); - if (onMisspelling) { - var suggestionsSeparator = - document.getElementById("spell-add-to-dictionary"); - var numsug = - InlineSpellCheckerUI.addSuggestionsToMenu(suggestionsSeparator.parentNode, - suggestionsSeparator, 5); - this.showItem("spell-no-suggestions", numsug == 0); - } - else - this.showItem("spell-no-suggestions", false); - - // dictionary list - this.showItem("spell-dictionaries", canSpell && InlineSpellCheckerUI.enabled); - if (canSpell) { - var dictMenu = document.getElementById("spell-dictionaries-menu"); - var dictSep = document.getElementById("spell-language-separator"); - InlineSpellCheckerUI.addDictionaryListToMenu(dictMenu, dictSep); - this.showItem("spell-add-dictionaries-main", false); - } - else if (this.onEditableArea) { - // when there is no spellchecker but we might be able to spellcheck - // add the add to dictionaries item. This will ensure that people - // with no dictionaries will be able to download them - this.showItem("spell-add-dictionaries-main", true); - } - else - this.showItem("spell-add-dictionaries-main", false); - }, - - initClipboardItems: function() { - // Copy depends on whether there is selected text. - // Enabling this context menu item is now done through the global - // command updating system - // this.setItemAttr( "context-copy", "disabled", !this.isTextSelected() ); - goUpdateGlobalEditMenuItems(); - - this.showItem("context-undo", this.onTextInput); - this.showItem("context-sep-undo", this.onTextInput); - this.showItem("context-cut", this.onTextInput); - this.showItem("context-copy", - this.isContentSelected || this.onTextInput); - this.showItem("context-paste", this.onTextInput); - this.showItem("context-delete", this.onTextInput); - this.showItem("context-sep-paste", this.onTextInput); - this.showItem("context-selectall", !(this.onLink || this.onImage || - this.onVideo || this.onAudio || - this.inSyntheticDoc) || - this.isDesignMode); - this.showItem("context-sep-selectall", this.isContentSelected ); - - // XXX dr - // ------ - // nsDocumentViewer.cpp has code to determine whether we're - // on a link or an image. we really ought to be using that... - - // Copy email link depends on whether we're on an email link. - this.showItem("context-copyemail", this.onMailtoLink); - - // Copy link location depends on whether we're on a non-mailto link. - this.showItem("context-copylink", this.onLink && !this.onMailtoLink); - this.showItem("context-sep-copylink", this.onLink && - (this.onImage || this.onVideo || this.onAudio)); - -#ifdef CONTEXT_COPY_IMAGE_CONTENTS - // Copy image contents depends on whether we're on an image. - this.showItem("context-copyimage-contents", this.onImage); -#endif - // Copy image location depends on whether we're on an image. - this.showItem("context-copyimage", this.onImage); - this.showItem("context-copyvideourl", this.onVideo); - this.showItem("context-copyaudiourl", this.onAudio); - this.setItemAttr("context-copyvideourl", "disabled", !this.mediaURL); - this.setItemAttr("context-copyaudiourl", "disabled", !this.mediaURL); - this.showItem("context-sep-copyimage", this.onImage || - this.onVideo || this.onAudio); - }, - - initMediaPlayerItems: function() { - var onMedia = (this.onVideo || this.onAudio); - // Several mutually exclusive items... play/pause, mute/unmute, show/hide - this.showItem("context-media-play", onMedia && (this.target.paused || this.target.ended)); - this.showItem("context-media-pause", onMedia && !this.target.paused && !this.target.ended); - this.showItem("context-media-mute", onMedia && !this.target.muted); - this.showItem("context-media-unmute", onMedia && this.target.muted); - this.showItem("context-media-playbackrate", onMedia); - this.showItem("context-media-loop", onMedia); - this.showItem("context-media-showcontrols", onMedia && !this.target.controls); - this.showItem("context-media-hidecontrols", onMedia && this.target.controls); - this.showItem("context-video-fullscreen", this.onVideo && this.target.ownerDocument.mozFullScreenElement == null); - var statsShowing = this.onVideo && XPCNativeWrapper.unwrap(this.target).mozMediaStatisticsShowing; - this.showItem("context-video-showstats", this.onVideo && this.target.controls && !statsShowing); - this.showItem("context-video-hidestats", this.onVideo && this.target.controls && statsShowing); - - // Disable them when there isn't a valid media source loaded. - if (onMedia) { - this.setItemAttr("context-media-playbackrate-050x", "checked", this.target.playbackRate == 0.5); - this.setItemAttr("context-media-playbackrate-100x", "checked", this.target.playbackRate == 1.0); - this.setItemAttr("context-media-playbackrate-150x", "checked", this.target.playbackRate == 1.5); - this.setItemAttr("context-media-playbackrate-200x", "checked", this.target.playbackRate == 2.0); - this.setItemAttr("context-media-loop", "checked", this.target.loop); - var hasError = this.target.error != null || - this.target.networkState == this.target.NETWORK_NO_SOURCE; - this.setItemAttr("context-media-play", "disabled", hasError); - this.setItemAttr("context-media-pause", "disabled", hasError); - this.setItemAttr("context-media-mute", "disabled", hasError); - this.setItemAttr("context-media-unmute", "disabled", hasError); - this.setItemAttr("context-media-playbackrate", "disabled", hasError); - this.setItemAttr("context-media-playbackrate-050x", "disabled", hasError); - this.setItemAttr("context-media-playbackrate-100x", "disabled", hasError); - this.setItemAttr("context-media-playbackrate-150x", "disabled", hasError); - this.setItemAttr("context-media-playbackrate-200x", "disabled", hasError); - this.setItemAttr("context-media-showcontrols", "disabled", hasError); - this.setItemAttr("context-media-hidecontrols", "disabled", hasError); - if (this.onVideo) { - let canSaveSnapshot = this.target.readyState >= this.target.HAVE_CURRENT_DATA; - this.setItemAttr("context-video-saveimage", "disabled", !canSaveSnapshot); - this.setItemAttr("context-video-fullscreen", "disabled", hasError); - this.setItemAttr("context-video-showstats", "disabled", hasError); - this.setItemAttr("context-video-hidestats", "disabled", hasError); - } - } - this.showItem("context-media-sep-commands", onMedia); - }, - - initClickToPlayItems: function() { - this.showItem("context-ctp-play", this.onCTPPlugin); - this.showItem("context-ctp-hide", this.onCTPPlugin); - this.showItem("context-sep-ctp", this.onCTPPlugin); - }, - - inspectNode: function CM_inspectNode() { - let {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {}); - let gBrowser = this.browser.ownerDocument.defaultView.gBrowser; - let target = devtools.TargetFactory.forTab(gBrowser.selectedTab); - - return gDevTools.showToolbox(target, "inspector").then(function(toolbox) { - let inspector = toolbox.getCurrentPanel(); - - this.browser.messageManager.sendAsyncMessage("debug:inspect", {}, {node: this.target}); - inspector.walker.findInspectingNode().then(nodeFront => { - inspector.selection.setNodeFront(nodeFront, "browser-context-menu"); - }); - }.bind(this)); - }, - - // Set various context menu attributes based on the state of the world. - setTarget: function (aNode, aRangeParent, aRangeOffset) { - const xulNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; - if (aNode.namespaceURI == xulNS || - aNode.nodeType == Node.DOCUMENT_NODE || - this.isDisabledForEvents(aNode)) { - this.shouldDisplay = false; - return; - } - - // Initialize contextual info. - this.onImage = false; - this.onLoadedImage = false; - this.onCompletedImage = false; - this.onCanvas = false; - this.onVideo = false; - this.onAudio = false; - this.onTextInput = false; - this.onKeywordField = false; - this.mediaURL = ""; - this.onLink = false; - this.onMailtoLink = false; - this.onSaveableLink = false; - this.link = null; - this.linkURL = ""; - this.linkURI = null; - this.linkProtocol = ""; - this.linkDownload = ""; - this.onMathML = false; - this.inFrame = false; - this.inSrcdocFrame = false; - this.inSyntheticDoc = false; - this.hasBGImage = false; - this.bgImageURL = ""; - this.onEditableArea = false; - this.isDesignMode = false; - this.onCTPPlugin = false; - this.canSpellCheck = false; - this.textSelected = getBrowserSelection(); - this.isTextSelected = this.textSelected.length != 0; - - // Remember the node that was clicked. - this.target = aNode; - - this.browser = this.target.ownerDocument.defaultView - .QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIWebNavigation) - .QueryInterface(Ci.nsIDocShell) - .chromeEventHandler; - - // Check if we are in a synthetic document (stand alone image, video, etc.). - this.inSyntheticDoc = this.target.ownerDocument.mozSyntheticDocument; - // First, do checks for nodes that never have children. - if (this.target.nodeType == Node.ELEMENT_NODE) { - // See if the user clicked on an image. - if (this.target instanceof Ci.nsIImageLoadingContent && - this.target.currentURI) { - this.onImage = true; - - var request = - this.target.getRequest(Ci.nsIImageLoadingContent.CURRENT_REQUEST); - if (request && (request.imageStatus & request.STATUS_SIZE_AVAILABLE)) - this.onLoadedImage = true; - if (request && (request.imageStatus & request.STATUS_LOAD_COMPLETE)) - this.onCompletedImage = true; - - this.mediaURL = this.target.currentURI.spec; - } - else if (this.target instanceof HTMLCanvasElement) { - this.onCanvas = true; - } - else if (this.target instanceof HTMLVideoElement) { - this.mediaURL = this.target.currentSrc || this.target.src; - // Firefox always creates a HTMLVideoElement when loading an ogg file - // directly. If the media is actually audio, be smarter and provide a - // context menu with audio operations. - if (this.target.readyState >= this.target.HAVE_METADATA && - (this.target.videoWidth == 0 || this.target.videoHeight == 0)) { - this.onAudio = true; - } else { - this.onVideo = true; - } - } - else if (this.target instanceof HTMLAudioElement) { - this.onAudio = true; - this.mediaURL = this.target.currentSrc || this.target.src; - } - else if (this.target instanceof HTMLInputElement ) { - this.onTextInput = this.isTargetATextBox(this.target); - // Allow spellchecking UI on all text and search inputs. - if (this.onTextInput && ! this.target.readOnly && - (this.target.type == "text" || this.target.type == "search")) { - this.onEditableArea = true; - InlineSpellCheckerUI.init(this.target.QueryInterface(Ci.nsIDOMNSEditableElement).editor); - InlineSpellCheckerUI.initFromEvent(aRangeParent, aRangeOffset); - } - this.onKeywordField = this.isTargetAKeywordField(this.target); - } - else if (this.target instanceof HTMLTextAreaElement) { - this.onTextInput = true; - if (!this.target.readOnly) { - this.onEditableArea = true; - InlineSpellCheckerUI.init(this.target.QueryInterface(Ci.nsIDOMNSEditableElement).editor); - InlineSpellCheckerUI.initFromEvent(aRangeParent, aRangeOffset); - } - } - else if (this.target instanceof HTMLHtmlElement) { - var bodyElt = this.target.ownerDocument.body; - if (bodyElt) { - let computedURL; - try { - computedURL = this.getComputedURL(bodyElt, "background-image"); - this._hasMultipleBGImages = false; - } catch (e) { - this._hasMultipleBGImages = true; - } - if (computedURL) { - this.hasBGImage = true; - this.bgImageURL = makeURLAbsolute(bodyElt.baseURI, - computedURL); - } - } - } - else if ((this.target instanceof HTMLEmbedElement || - this.target instanceof HTMLObjectElement || - this.target instanceof HTMLAppletElement) && - this.target.displayedType == HTMLObjectElement.TYPE_NULL && - this.target.pluginFallbackType == HTMLObjectElement.PLUGIN_CLICK_TO_PLAY) { - this.onCTPPlugin = true; - } - - this.canSpellCheck = this._isSpellCheckEnabled(this.target); - } - else if (this.target.nodeType == Node.TEXT_NODE) { - // For text nodes, look at the parent node to determine the spellcheck attribute. - this.canSpellCheck = this.target.parentNode && - this._isSpellCheckEnabled(this.target); - } - - // Second, bubble out, looking for items of interest that can have childen. - // Always pick the innermost link, background image, etc. - const XMLNS = "http://www.w3.org/XML/1998/namespace"; - var elem = this.target; - while (elem) { - if (elem.nodeType == Node.ELEMENT_NODE) { - // Link? - if (!this.onLink && - // Be consistent with what hrefAndLinkNodeForClickEvent - // does in browser.js - ((elem instanceof HTMLAnchorElement && elem.href) || - (elem instanceof HTMLAreaElement && elem.href) || - elem instanceof HTMLLinkElement || - elem.getAttributeNS("http://www.w3.org/1999/xlink", "type") == "simple")) { - - // Target is a link or a descendant of a link. - this.onLink = true; - - // Remember corresponding element. - this.link = elem; - this.linkURL = this.getLinkURL(); - this.linkURI = this.getLinkURI(); - this.linkProtocol = this.getLinkProtocol(); - this.onMailtoLink = (this.linkProtocol == "mailto"); - this.onSaveableLink = this.isLinkSaveable( this.link ); - try { - if (elem.download) { - // Ignore download attribute on cross-origin links? - // This shoudn't be an issue because the download link presents - // the originating URL domain and protocol to help user understand - // from where file is downloaded and make right decision. - // If we decide we want this restriction: - // this.principal.checkMayLoad(this.linkURI, false, true); - this.linkDownload = elem.download; - } - } - catch (ex) {} - } - - // Background image? Don't bother if we've already found a - // background image further down the hierarchy. Otherwise, - // we look for the computed background-image style. - if (!this.hasBGImage && - !this._hasMultipleBGImages) { - let bgImgUrl; - try { - bgImgUrl = this.getComputedURL(elem, "background-image"); - this._hasMultipleBGImages = false; - } catch (e) { - this._hasMultipleBGImages = true; - } - if (bgImgUrl) { - this.hasBGImage = true; - this.bgImageURL = makeURLAbsolute(elem.baseURI, - bgImgUrl); - } - } - } - - elem = elem.parentNode; - } - - // See if the user clicked on MathML - const NS_MathML = "http://www.w3.org/1998/Math/MathML"; - if ((this.target.nodeType == Node.TEXT_NODE && - this.target.parentNode.namespaceURI == NS_MathML) - || (this.target.namespaceURI == NS_MathML)) - this.onMathML = true; - - // See if the user clicked in a frame. - var docDefaultView = this.target.ownerDocument.defaultView; - if (docDefaultView != docDefaultView.top) { - this.inFrame = true; - - if (this.target.ownerDocument.isSrcdocDocument) { - this.inSrcdocFrame = true; - } - } - - // if the document is editable, show context menu like in text inputs - if (!this.onEditableArea) { - var win = this.target.ownerDocument.defaultView; - if (win) { - var isEditable = false; - try { - var editingSession = win.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIWebNavigation) - .QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIEditingSession); - if (editingSession.windowIsEditable(win) && - this.getComputedStyle(this.target, "-moz-user-modify") == "read-write") { - isEditable = true; - } - } - catch(ex) { - // If someone built with composer disabled, we can't get an editing session. - } - - if (isEditable) { - this.onTextInput = true; - this.onKeywordField = false; - this.onImage = false; - this.onLoadedImage = false; - this.onCompletedImage = false; - this.onMathML = false; - this.inFrame = false; - this.inSrcdocFrame = false; - this.hasBGImage = false; - this.isDesignMode = true; - this.onEditableArea = true; - InlineSpellCheckerUI.init(editingSession.getEditorForWindow(win)); - var canSpell = InlineSpellCheckerUI.canSpellCheck && this.canSpellCheck; - InlineSpellCheckerUI.initFromEvent(aRangeParent, aRangeOffset); - this.showItem("spell-check-enabled", canSpell); - this.showItem("spell-separator", canSpell); - } - } - } - }, - - // Returns the computed style attribute for the given element. - getComputedStyle: function(aElem, aProp) { - return aElem.ownerDocument - .defaultView - .getComputedStyle(aElem, "").getPropertyValue(aProp); - }, - - // Returns a "url"-type computed style attribute value, with the url() stripped. - getComputedURL: function(aElem, aProp) { - var url = aElem.ownerDocument - .defaultView.getComputedStyle(aElem, "") - .getPropertyCSSValue(aProp); - if (url instanceof CSSValueList) { - if (url.length != 1) - throw "found multiple URLs"; - url = url[0]; - } - return url.primitiveType == CSSPrimitiveValue.CSS_URI ? - url.getStringValue() : null; - }, - - // Returns true if clicked-on link targets a resource that can be saved. - isLinkSaveable: function(aLink) { - // We don't do the Right Thing for news/snews yet, so turn them off - // until we do. - return this.linkProtocol && !( - this.linkProtocol == "mailto" || - this.linkProtocol == "javascript" || - this.linkProtocol == "news" || - this.linkProtocol == "snews" ); - }, - - _isSpellCheckEnabled: function(aNode) { - // We can always force-enable spellchecking on textboxes - if (this.isTargetATextBox(aNode)) { - return true; - } - // We can never spell check something which is not content editable - var editable = aNode.isContentEditable; - if (!editable && aNode.ownerDocument) { - editable = aNode.ownerDocument.designMode == "on"; - } - if (!editable) { - return false; - } - // Otherwise make sure that nothing in the parent chain disables spellchecking - return aNode.spellcheck; - }, - - // Open linked-to URL in a new window. - openLink : function () { - var doc = this.target.ownerDocument; - urlSecurityCheck(this.linkURL, doc.nodePrincipal); - openLinkIn(this.linkURL, "window", - { charset: doc.characterSet, - referrerURI: doc.documentURIObject, - referrerPolicy: doc.referrerPolicy, - originPrincipal: doc.nodePrincipal, - triggeringPrincipal: doc.nodePrincipal }); - }, - - // Open linked-to URL in a new private window. - openLinkInPrivateWindow : function () { - var doc = this.target.ownerDocument; - urlSecurityCheck(this.linkURL, doc.nodePrincipal); - openLinkIn(this.linkURL, "window", - { charset: doc.characterSet, - referrerURI: doc.documentURIObject, - referrerPolicy: doc.referrerPolicy, - originPrincipal: doc.nodePrincipal, - triggeringPrincipal: doc.nodePrincipal, - private: true }); - }, - - // Open linked-to URL in a new tab. - openLinkInTab: function() { - var doc = this.target.ownerDocument; - urlSecurityCheck(this.linkURL, doc.nodePrincipal); - openLinkIn(this.linkURL, "tab", - { charset: doc.characterSet, - referrerURI: doc.documentURIObject, - referrerPolicy: doc.referrerPolicy, - originPrincipal: doc.nodePrincipal, - triggeringPrincipal: doc.nodePrincipal }); - }, - - // open URL in current tab - openLinkInCurrent: function() { - var doc = this.target.ownerDocument; - urlSecurityCheck(this.linkURL, doc.nodePrincipal); - openLinkIn(this.linkURL, "current", - { charset: doc.characterSet, - referrerURI: doc.documentURIObject, - originPrincipal: doc.nodePrincipal, - triggeringPrincipal: doc.nodePrincipal }); - }, - - // Open frame in a new tab. - openFrameInTab: function() { - var doc = this.target.ownerDocument; - var frameURL = doc.location.href; - var referrer = doc.referrer; - openLinkIn(frameURL, "tab", - { charset: doc.characterSet, - referrerURI: referrer ? makeURI(referrer) : null }); - }, - - // Reload clicked-in frame. - reloadFrame: function() { - this.target.ownerDocument.location.reload(); - }, - - // Open clicked-in frame in its own window. - openFrame: function() { - var doc = this.target.ownerDocument; - var frameURL = doc.location.href; - var referrer = doc.referrer; - openLinkIn(frameURL, "window", - { charset: doc.characterSet, - referrerURI: referrer ? makeURI(referrer) : null }); - }, - - // Open clicked-in frame in the same window. - showOnlyThisFrame: function() { - var doc = this.target.ownerDocument; - var frameURL = doc.location.href; - - urlSecurityCheck(frameURL, this.browser.contentPrincipal, - Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); - var referrer = doc.referrer; - openUILinkIn(frameURL, "current", { disallowInheritPrincipal: true, - referrerURI: referrer ? makeURI(referrer) : null }); - }, - - reload: function(event) { - BrowserReloadOrDuplicate(event); - }, - - // View Partial Source - viewPartialSource: function(aContext) { - let target = aContext == "mathml" ? this.target : null; - top.gViewSourceUtils.viewPartialSourceInBrowser(gBrowser.selectedBrowser, target); - }, - - // Open new "view source" window with the frame's URL. - viewFrameSource: function() { - BrowserViewSourceOfDocument(this.target.ownerDocument); - }, - - viewInfo: function() { - BrowserPageInfo(this.target.ownerDocument.defaultView.top.document); - }, - - viewImageInfo: function() { - BrowserPageInfo(this.target.ownerDocument.defaultView.top.document, - "mediaTab", this.target); - }, - - viewFrameInfo: function() { - BrowserPageInfo(this.target.ownerDocument); - }, - - reloadImage: function(e) { - urlSecurityCheck(this.mediaURL, - this.browser.contentPrincipal, - Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); - - if (this.target instanceof Ci.nsIImageLoadingContent) - this.target.forceReload(); - }, - - // Change current window to the URL of the image, video, or audio. - viewMedia: function(e) { - var viewURL; - var doc = this.target.ownerDocument; - if (this.onCanvas) { - var target = this.target; - var win = doc.defaultView; - if (!win) { - Components.utils.reportError( - "View Image (on the element):\n" + - "This feature cannot be used, because it hasn't found " + - "an appropriate window."); - } else { - new Promise.resolve({then: function (resolve) { - target.toBlob((blob) => { - resolve(win.URL.createObjectURL(blob)); - }) - }}).then(function (blobURL) { - openUILink(blobURL, e, { disallowInheritPrincipal: true, - referrerURI: doc.documentURIObject }); - }, Components.utils.reportError); - } - } else { - viewURL = this.mediaURL; - urlSecurityCheck(viewURL, - this.browser.contentPrincipal, - Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); - let doc = this.target.ownerDocument; - openUILink(viewURL, e, { disallowInheritPrincipal: true, - referrerURI: doc.documentURIObject, - forceAllowDataURI: true }); - } - }, - - saveVideoFrameAsImage: function () { - let referrerURI = document.documentURIObject; - let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(this.browser); - - urlSecurityCheck(this.mediaURL, this.browser.contentPrincipal, - Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); - let name = ""; - try { - let uri = makeURI(this.mediaURL); - let url = uri.QueryInterface(Ci.nsIURL); - if (url.fileBaseName) - name = decodeURI(url.fileBaseName) + ".jpg"; - } catch (e) { } - if (!name) - name = "snapshot.jpg"; - var video = this.target; - var canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"); - canvas.width = video.videoWidth; - canvas.height = video.videoHeight; - var ctxDraw = canvas.getContext("2d"); - ctxDraw.drawImage(video, 0, 0); - saveImageURL(canvas.toDataURL("image/jpeg", ""), name, "SaveImageTitle", - true, false, referrerURI, null, null, null, - isPrivate); - }, - - fullScreenVideo: function () { - let video = this.target; - if (document.mozFullScreenEnabled) - video.mozRequestFullScreen(); - }, - - leaveDOMFullScreen: function() { - document.mozCancelFullScreen(); - }, - - // Change current window to the URL of the background image. - viewBGImage: function(e) { - urlSecurityCheck(this.bgImageURL, - this.browser.contentPrincipal, - Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); - var doc = this.target.ownerDocument; - openUILink(this.bgImageURL, e, { disallowInheritPrincipal: true, - referrerURI: doc.documentURIObject }); - }, - - disableSetDesktopBackground: function() { - // Disable the Set as Desktop Background menu item if we're still trying - // to load the image or the load failed. - if (!(this.target instanceof Ci.nsIImageLoadingContent)) - return true; - - if (("complete" in this.target) && !this.target.complete) - return true; - - if (this.target.currentURI.schemeIs("javascript")) - return true; - - var request = this.target - .QueryInterface(Ci.nsIImageLoadingContent) - .getRequest(Ci.nsIImageLoadingContent.CURRENT_REQUEST); - if (!request) - return true; - - return false; - }, - - setDesktopBackground: function() { - // Paranoia: check disableSetDesktopBackground again, in case the - // image changed since the context menu was initiated. - if (this.disableSetDesktopBackground()) - return; - - urlSecurityCheck(this.target.currentURI.spec, - this.target.ownerDocument.nodePrincipal); - - // Confirm since it's annoying if you hit this accidentally. - const kDesktopBackgroundURL = - "chrome://browser/content/setDesktopBackground.xul"; -#ifdef XP_MACOSX - // On Mac, the Set Desktop Background window is not modal. - // Don't open more than one Set Desktop Background window. - var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] - .getService(Components.interfaces.nsIWindowMediator); - var dbWin = wm.getMostRecentWindow("Shell:SetDesktopBackground"); - if (dbWin) { - dbWin.gSetBackground.init(this.target); - dbWin.focus(); - } - else { - openDialog(kDesktopBackgroundURL, "", - "centerscreen,chrome,dialog=no,dependent,resizable=no", - this.target); - } -#else - // On non-Mac platforms, the Set Wallpaper dialog is modal. - openDialog(kDesktopBackgroundURL, "", - "centerscreen,chrome,dialog,modal,dependent", - this.target); -#endif - }, - - // Save URL of clicked-on frame. - saveFrame: function () { - saveDocument(this.target.ownerDocument); - }, - - // Helper function to wait for appropriate MIME-type headers and - // then prompt the user with a file picker - saveHelper: function(linkURL, linkText, dialogTitle, bypassCache, doc, - linkDownload) { - // canonical def in nsURILoader.h - const NS_ERROR_SAVE_LINK_AS_TIMEOUT = 0x805d0020; - - // an object to proxy the data through to - // nsIExternalHelperAppService.doContent, which will wait for the - // appropriate MIME-type headers and then prompt the user with a - // file picker - function saveAsListener() {} - saveAsListener.prototype = { - extListener: null, - - onStartRequest: function saveLinkAs_onStartRequest(aRequest, aContext) { - - // if the timer fired, the error status will have been caused by that, - // and we'll be restarting in onStopRequest, so no reason to notify - // the user - if (aRequest.status == NS_ERROR_SAVE_LINK_AS_TIMEOUT) - return; - - timer.cancel(); - - // some other error occured; notify the user... - if (!Components.isSuccessCode(aRequest.status)) { - try { - const sbs = Cc["@mozilla.org/intl/stringbundle;1"]. - getService(Ci.nsIStringBundleService); - const bundle = sbs.createBundle( - "chrome://mozapps/locale/downloads/downloads.properties"); - - const title = bundle.GetStringFromName("downloadErrorAlertTitle"); - const msg = bundle.GetStringFromName("downloadErrorGeneric"); - - const promptSvc = Cc["@mozilla.org/embedcomp/prompt-service;1"]. - getService(Ci.nsIPromptService); - promptSvc.alert(doc.defaultView, title, msg); - } catch (ex) {} - return; - } - - var extHelperAppSvc = - Cc["@mozilla.org/uriloader/external-helper-app-service;1"]. - getService(Ci.nsIExternalHelperAppService); - var channel = aRequest.QueryInterface(Ci.nsIChannel); - this.extListener = - extHelperAppSvc.doContent(channel.contentType, aRequest, - doc.defaultView, true); - this.extListener.onStartRequest(aRequest, aContext); - }, - - onStopRequest: function saveLinkAs_onStopRequest(aRequest, aContext, - aStatusCode) { - if (aStatusCode == NS_ERROR_SAVE_LINK_AS_TIMEOUT) { - // do it the old fashioned way, which will pick the best filename - // it can without waiting. - saveURL(linkURL, linkText, dialogTitle, bypassCache, false, doc.documentURIObject, doc); - } - if (this.extListener) - this.extListener.onStopRequest(aRequest, aContext, aStatusCode); - }, - - onDataAvailable: function saveLinkAs_onDataAvailable(aRequest, aContext, - aInputStream, - aOffset, aCount) { - this.extListener.onDataAvailable(aRequest, aContext, aInputStream, - aOffset, aCount); - } - } - - function callbacks() {} - callbacks.prototype = { - getInterface: function sLA_callbacks_getInterface(aIID) { - if (aIID.equals(Ci.nsIAuthPrompt) || aIID.equals(Ci.nsIAuthPrompt2)) { - // If the channel demands authentication prompt, we must cancel it - // because the save-as-timer would expire and cancel the channel - // before we get credentials from user. Both authentication dialog - // and save as dialog would appear on the screen as we fall back to - // the old fashioned way after the timeout. - timer.cancel(); - channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT); - } - throw Cr.NS_ERROR_NO_INTERFACE; - } - } - - // if it we don't have the headers after a short time, the user - // won't have received any feedback from their click. that's bad. so - // we give up waiting for the filename. - function timerCallback() {} - timerCallback.prototype = { - notify: function sLA_timer_notify(aTimer) { - channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT); - return; - } - } - - // setting up a new channel for 'right click - save link as ...' - var channel = NetUtil.newChannel({ - uri: makeURI(linkURL), - loadingPrincipal: this.target.ownerDocument.nodePrincipal, - contentPolicyType: Ci.nsIContentPolicy.TYPE_SAVEAS_DOWNLOAD, - securityFlags: Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS, - }); - - if (linkDownload) - channel.contentDispositionFilename = linkDownload; - if (channel instanceof Ci.nsIPrivateBrowsingChannel) { - let docIsPrivate = PrivateBrowsingUtils.isWindowPrivate(doc.defaultView); - channel.setPrivate(docIsPrivate); - } - channel.notificationCallbacks = new callbacks(); - - let flags = Ci.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS; - - if (bypassCache) - flags |= Ci.nsIRequest.LOAD_BYPASS_CACHE; - - if (channel instanceof Ci.nsICachingChannel) - flags |= Ci.nsICachingChannel.LOAD_BYPASS_LOCAL_CACHE_IF_BUSY; - - channel.loadFlags |= flags; - - if (channel instanceof Ci.nsIHttpChannel) { - channel.referrer = doc.documentURIObject; - if (channel instanceof Ci.nsIHttpChannelInternal) - channel.forceAllowThirdPartyCookie = true; - } - - // fallback to the old way if we don't see the headers quickly - var timeToWait = - gPrefService.getIntPref("browser.download.saveLinkAsFilenameTimeout"); - var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); - timer.initWithCallback(new timerCallback(), timeToWait, - timer.TYPE_ONE_SHOT); - - // kick off the channel with our proxy object as the listener - channel.asyncOpen2(new saveAsListener()); - }, - - // Save URL of clicked-on link. - saveLink: function() { - var doc = this.target.ownerDocument; - var linkText; - // If selected text is found to match valid URL pattern. - if (this.onPlainTextLink) - linkText = document.commandDispatcher.focusedWindow.getSelection().toString().trim(); - else - linkText = this.linkText(); - urlSecurityCheck(this.linkURL, doc.nodePrincipal); - - this.saveHelper(this.linkURL, linkText, null, true, doc, - this.linkDownload); - }, - - sendLink: function() { - // we don't know the title of the link so pass in an empty string - MailIntegration.sendMessage( this.linkURL, "" ); - }, - - // Backwards-compatibility wrapper - saveImage : function() { - if (this.onCanvas || this.onImage) - this.saveMedia(); - }, - - // Save URL of the clicked upon image, video, or audio. - saveMedia: function() { - var doc = this.target.ownerDocument; - let referrerURI = doc.documentURIObject; - let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(this.browser); - if (this.onCanvas) { - // Bypass cache, since it's a blob: URL. - var target = this.target; - var win = doc.defaultView; - if (!win) { - Components.utils.reportError( - "Save Image As (on the element):\n" + - "This feature cannot be used, because it hasn't found " + - "an appropriate window."); - } else { - new Promise.resolve({then: function (resolve) { - target.toBlob((blob) => { - resolve(win.URL.createObjectURL(blob)); - }) - }}).then(function (blobURL) { - saveImageURL(blobURL, "canvas.png", "SaveImageTitle", - true, false, referrerURI, null, null, null, - isPrivate); - }, Components.utils.reportError); - } - } else if (this.onImage) { - urlSecurityCheck(this.mediaURL, doc.nodePrincipal); - saveImageURL(this.mediaURL, null, "SaveImageTitle", - false, false, referrerURI, doc, null, null, - isPrivate); - } else if (this.onVideo || this.onAudio) { - urlSecurityCheck(this.mediaURL, doc.nodePrincipal); - var dialogTitle = this.onVideo ? "SaveVideoTitle" : "SaveAudioTitle"; - this.saveHelper(this.mediaURL, null, dialogTitle, false, doc, ""); - } - }, - - // Backwards-compatibility wrapper - sendImage : function() { - if (this.onCanvas || this.onImage) - this.sendMedia(); - }, - - sendMedia: function() { - MailIntegration.sendMessage(this.mediaURL, ""); - }, - - playPlugin: function() { - gPluginHandler._showClickToPlayNotification(this.browser, this.target); - }, - - hidePlugin: function() { - gPluginHandler.hideClickToPlayOverlay(this.target); - }, - - // Generate email address and put it on clipboard. - copyEmail: function() { - // Copy the comma-separated list of email addresses only. - // There are other ways of embedding email addresses in a mailto: - // link, but such complex parsing is beyond us. - var url = this.linkURL; - var qmark = url.indexOf("?"); - var addresses; - - // 7 == length of "mailto:" - addresses = qmark > 7 ? url.substring(7, qmark) : url.substr(7); - - // Let's try to unescape it using a character set - // in case the address is not ASCII. - try { - var characterSet = this.target.ownerDocument.characterSet; - const textToSubURI = Cc["@mozilla.org/intl/texttosuburi;1"]. - getService(Ci.nsITextToSubURI); - addresses = textToSubURI.unEscapeURIForUI(characterSet, addresses); - } - catch(ex) { - // Do nothing. - } - - var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]. - getService(Ci.nsIClipboardHelper); - clipboard.copyString(addresses, document); - }, - - /////////////// - // Utilities // - /////////////// - - // Show/hide one item (specified via name or the item element itself). - showItem: function(aItemOrId, aShow) { - var item = aItemOrId.constructor == String ? - document.getElementById(aItemOrId) : aItemOrId; - if (item) - item.hidden = !aShow; - }, - - // Set given attribute of specified context-menu item. If the - // value is null, then it removes the attribute (which works - // nicely for the disabled attribute). - setItemAttr: function(aID, aAttr, aVal ) { - var elem = document.getElementById(aID); - if (elem) { - if (aVal == null) { - // null indicates attr should be removed. - elem.removeAttribute(aAttr); - } - else { - // Set attr=val. - elem.setAttribute(aAttr, aVal); - } - } - }, - - // Set context menu attribute according to like attribute of another node - // (such as a broadcaster). - setItemAttrFromNode: function(aItem_id, aAttr, aOther_id) { - var elem = document.getElementById(aOther_id); - if (elem && elem.getAttribute(aAttr) == "true") - this.setItemAttr(aItem_id, aAttr, "true"); - else - this.setItemAttr(aItem_id, aAttr, null); - }, - - // Temporary workaround for DOM api not yet implemented by XUL nodes. - cloneNode: function(aItem) { - // Create another element like the one we're cloning. - var node = document.createElement(aItem.tagName); - - // Copy attributes from argument item to the new one. - var attrs = aItem.attributes; - for (var i = 0; i < attrs.length; i++) { - var attr = attrs.item(i); - node.setAttribute(attr.nodeName, attr.nodeValue); - } - - // Voila! - return node; - }, - - // Generate fully qualified URL for clicked-on link. - getLinkURL: function() { - var href = this.link.href; - if (href) - return href; - - href = this.link.getAttributeNS("http://www.w3.org/1999/xlink", - "href"); - - if (!href || !href.match(/\S/)) { - // Without this we try to save as the current doc, - // for example, HTML case also throws if empty - throw "Empty href"; - } - - return makeURLAbsolute(this.link.baseURI, href); - }, - - getLinkURI: function() { - try { - return makeURI(this.linkURL); - } - catch (ex) { - // e.g. empty URL string - } - - return null; - }, - - getLinkProtocol: function() { - if (this.linkURI) - return this.linkURI.scheme; // can be |undefined| - - return null; - }, - - // Get text of link. - linkText: function() { - var text = gatherTextUnder(this.link); - if (!text || !text.match(/\S/)) { - text = this.link.getAttribute("title"); - if (!text || !text.match(/\S/)) { - text = this.link.getAttribute("alt"); - if (!text || !text.match(/\S/)) - text = this.linkURL; - } - } - - return text; - }, - - // Returns true if anything is selected. - isContentSelection: function() { - return !document.commandDispatcher.focusedWindow.getSelection().isCollapsed; - }, - - toString: function () { - return "contextMenu.target = " + this.target + "\n" + - "contextMenu.onImage = " + this.onImage + "\n" + - "contextMenu.onLink = " + this.onLink + "\n" + - "contextMenu.link = " + this.link + "\n" + - "contextMenu.inFrame = " + this.inFrame + "\n" + - "contextMenu.hasBGImage = " + this.hasBGImage + "\n"; - }, - - isDisabledForEvents: function(aNode) { - let ownerDoc = aNode.ownerDocument; - return ownerDoc.defaultView && - ownerDoc.defaultView - .QueryInterface(Components.interfaces.nsIInterfaceRequestor) - .getInterface(Components.interfaces.nsIDOMWindowUtils) - .isNodeDisabledForEvents(aNode); - }, - - isTargetATextBox: function(node) { - if (node instanceof HTMLInputElement) - return node.mozIsTextField(false); - - return (node instanceof HTMLTextAreaElement); - }, - - isTargetAKeywordField: function(aNode) { - if (!(aNode instanceof HTMLInputElement)) - return false; - - var form = aNode.form; - if (!form || aNode.type == "password") - return false; - - var method = form.method.toUpperCase(); - - // These are the following types of forms we can create keywords for: - // - // method encoding type can create keyword - // GET * YES - // * YES - // POST YES - // POST application/x-www-form-urlencoded YES - // POST text/plain NO (a little tricky to do) - // POST multipart/form-data NO - // POST everything else YES - return (method == "GET" || method == "") || - (form.enctype != "text/plain") && (form.enctype != "multipart/form-data"); - }, - - // Determines whether or not the separator with the specified ID should be - // shown or not by determining if there are any non-hidden items between it - // and the previous separator. - shouldShowSeparator: function (aSeparatorID) { - var separator = document.getElementById(aSeparatorID); - if (separator) { - var sibling = separator.previousSibling; - while (sibling && sibling.localName != "menuseparator") { - if (!sibling.hidden) - return true; - sibling = sibling.previousSibling; - } - } - return false; - }, - - addDictionaries: function() { - var uri = formatURL("browser.dictionaries.download.url", true); - - var locale = "-"; - try { - locale = gPrefService.getComplexValue("intl.accept_languages", - Ci.nsIPrefLocalizedString).data; - } - catch (e) { } - - var version = "-"; - try { - version = Cc["@mozilla.org/xre/app-info;1"]. - getService(Ci.nsIXULAppInfo).version; - } - catch (e) { } - - uri = uri.replace(/%LOCALE%/, escape(locale)).replace(/%VERSION%/, version); - - var newWindowPref = gPrefService.getIntPref("browser.link.open_newwindow"); - var where = newWindowPref == 3 ? "tab" : "window"; - - openUILinkIn(uri, where); - }, - - bookmarkThisPage: function CM_bookmarkThisPage() { - window.top.PlacesCommandHook.bookmarkPage(this.browser, PlacesUtils.bookmarksMenuFolderId, true); - }, - - bookmarkLink: function CM_bookmarkLink() { - var linkText; - // If selected text is found to match valid URL pattern. - if (this.onPlainTextLink) - linkText = document.commandDispatcher.focusedWindow.getSelection().toString().trim(); - else - linkText = this.linkText(); - window.top.PlacesCommandHook.bookmarkLink(PlacesUtils.bookmarksMenuFolderId, this.linkURL, - linkText); - }, - - addBookmarkForFrame: function CM_addBookmarkForFrame() { - var doc = this.target.ownerDocument; - var uri = doc.documentURIObject; - - var itemId = PlacesUtils.getMostRecentBookmarkForURI(uri); - if (itemId == -1) { - var title = doc.title; - var description = PlacesUIUtils.getDescriptionFromDocument(doc); - PlacesUIUtils.showBookmarkDialog({ action: "add" - , type: "bookmark" - , uri: uri - , title: title - , description: description - , hiddenRows: [ "description" - , "location" - , "loadInSidebar" - , "keyword" ] - }, window.top); - } - else { - PlacesUIUtils.showBookmarkDialog({ action: "edit" - , type: "bookmark" - , itemId: itemId - }, window.top); - } - }, - - savePageAs: function CM_savePageAs() { - saveDocument(this.browser.contentDocument); - }, - - sendPage: function CM_sendPage() { - MailIntegration.sendLinkForWindow(this.browser.contentWindow); - }, - - printFrame: function CM_printFrame() { - PrintUtils.print(this.target.ownerDocument.defaultView); - }, - - switchPageDirection: function CM_switchPageDirection() { - SwitchDocumentDirection(this.browser.contentWindow); - }, - - mediaCommand : function CM_mediaCommand(command, data) { - var media = this.target; - - switch (command) { - case "play": - media.play(); - break; - case "pause": - media.pause(); - break; - case "loop": - media.loop = !media.loop; - break; - case "mute": - media.muted = true; - break; - case "unmute": - media.muted = false; - break; - case "playbackRate": - media.playbackRate = data; - break; - case "hidecontrols": - media.removeAttribute("controls"); - break; - case "showcontrols": - media.setAttribute("controls", "true"); - break; - case "hidestats": - case "showstats": - var event = media.ownerDocument.createEvent("CustomEvent"); - event.initCustomEvent("media-showStatistics", false, true, command == "showstats"); - media.dispatchEvent(event); - break; - } - }, - - copyMediaLocation : function () { - var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]. - getService(Ci.nsIClipboardHelper); - clipboard.copyString(this.mediaURL, document); - }, - - get imageURL() { - if (this.onImage) - return this.mediaURL; - return ""; - }, - - // Formats the 'Search for ""' context menu. - formatSearchContextItem: function() { - var menuItem = document.getElementById("context-searchselect"); - var selectedText = this.isTextSelected ? this.textSelected : this.linkText(); - - // Store searchTerms in context menu item so we know what to search onclick - menuItem.searchTerms = selectedText; - - if (selectedText.length > 15) - selectedText = selectedText.substr(0,15) + this.ellipsis; - - // Use the current engine if the search bar is visible, the default - // engine otherwise. - var engineName = ""; - var ss = Cc["@mozilla.org/browser/search-service;1"]. - getService(Ci.nsIBrowserSearchService); - if (isElementVisible(BrowserSearch.searchBar)) - engineName = ss.currentEngine.name; - else - engineName = ss.defaultEngine.name; - - // format "Search for " string to show in menu - var menuLabel = gNavigatorBundle.getFormattedString("contextMenuSearch", - [engineName, - selectedText]); - menuItem.label = menuLabel; - menuItem.accessKey = gNavigatorBundle.getString("contextMenuSearch.accesskey"); - } -}; diff --git a/base/content/openLocation.js b/base/content/openLocation.js deleted file mode 100644 index 7ad2f7c..0000000 --- a/base/content/openLocation.js +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- 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/. */ - -var browser; -var dialog = {}; -var pref = null; -var openLocationModule = {}; -try { - pref = Components.classes["@mozilla.org/preferences-service;1"] - .getService(Components.interfaces.nsIPrefBranch); -} catch (ex) { - // not critical, remain silent -} - -Components.utils.import("resource:///modules/openLocationLastURL.jsm", openLocationModule); -var gOpenLocationLastURL = new openLocationModule.OpenLocationLastURL(window.opener); - -function onLoad() -{ - dialog.input = document.getElementById("dialog.input"); - dialog.open = document.documentElement.getButton("accept"); - dialog.openWhereList = document.getElementById("openWhereList"); - dialog.openTopWindow = document.getElementById("currentWindow"); - dialog.bundle = document.getElementById("openLocationBundle"); - - if ("arguments" in window && window.arguments.length >= 1) - browser = window.arguments[0]; - - dialog.openWhereList.selectedItem = dialog.openTopWindow; - - if (pref) { - try { - var useAutoFill = pref.getBoolPref("browser.urlbar.autoFill"); - if (useAutoFill) - dialog.input.setAttribute("completedefaultindex", "true"); - } catch (ex) {} - - try { - var value = pref.getIntPref("general.open_location.last_window_choice"); - var element = dialog.openWhereList.getElementsByAttribute("value", value)[0]; - if (element) - dialog.openWhereList.selectedItem = element; - dialog.input.value = gOpenLocationLastURL.value; - } - catch(ex) { - } - if (dialog.input.value) - dialog.input.select(); // XXX should probably be done automatically - } - - doEnabling(); -} - -function doEnabling() -{ - dialog.open.disabled = !dialog.input.value; -} - -function open() -{ - var openData = { - "url": null, - "postData": null, - "mayInheritPrincipal": false - }; - if (browser) { - browser.getShortcutOrURIAndPostData(dialog.input.value).then(data => { - openData.url = data.url; - openData.postData = data.postData; - openData.mayInheritPrincipal = data.mayInheritPrincipal; - - openLocation(openData); - }); - } else { - openData.url = dialog.input.value; - - openLocation(openData); - } - - return false; -} - -function openLocation(openData) -{ - try { - // Whichever target we use for the load, we allow third-party services to - // fix up the URI - switch (dialog.openWhereList.value) { - case "0": - var webNav = Components.interfaces.nsIWebNavigation; - var flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP | - webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS; - if (!openData.mayInheritPrincipal) - flags |= webNav.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL; - browser.gBrowser.loadURIWithFlags( - openData.url, flags, null, null, openData.postData); - break; - case "1": - window.opener.delayedOpenWindow(getBrowserURL(), "all,dialog=no", - openData.url, openData.postData, - null, null, true); - break; - case "3": - browser.delayedOpenTab( - openData.url, null, null, openData.postData, true); - break; - } - } catch (ex) {} - - if (pref) { - gOpenLocationLastURL.value = dialog.input.value; - pref.setIntPref( - "general.open_location.last_window_choice", dialog.openWhereList.value); - } - - window.close(); -} - -function createInstance(contractid, iidName) -{ - var iid = Components.interfaces[iidName]; - return Components.classes[contractid].createInstance(iid); -} - -const nsIFilePicker = Components.interfaces.nsIFilePicker; -function onChooseFile() -{ - try { - let fp = Components.classes["@mozilla.org/filepicker;1"]. - createInstance(nsIFilePicker); - let fpCallback = function fpCallback_done(aResult) { - if (aResult == nsIFilePicker.returnOK && fp.fileURL.spec && - fp.fileURL.spec.length > 0) { - dialog.input.value = fp.fileURL.spec; - } - doEnabling(); - }; - - fp.init(window, dialog.bundle.getString("chooseFileDialogTitle"), - nsIFilePicker.modeOpen); - fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText | - nsIFilePicker.filterImages | nsIFilePicker.filterXML | - nsIFilePicker.filterHTML); - fp.open(fpCallback); - } catch (ex) { - } -} diff --git a/base/content/openLocation.xul b/base/content/openLocation.xul deleted file mode 100644 index 7bafed0..0000000 --- a/base/content/openLocation.xul +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - -#endif - - - - - - - -
- - -
-

&certerror.longpagetitle;

-
- - -
-
-

&certerror.introPara1;

-

&certerror.introPara2;

-
- -
-

&certerror.whatShouldIDo.heading;

-
-

&certerror.whatShouldIDo.content;

- -
-
- - -

- -

-

- -

- -

-
-

&certerror.expert.content;

-

&certerror.expert.contentPara2;

- -
-
-
- - - - - - diff --git a/components/certerror/jar.mn b/components/certerror/jar.mn deleted file mode 100644 index 08e0710..0000000 --- a/components/certerror/jar.mn +++ /dev/null @@ -1,7 +0,0 @@ -# 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/. - -browser.jar: - content/browser/certerror/aboutCertError.xhtml (content/aboutCertError.xhtml) - content/browser/certerror/aboutCertError.css (content/aboutCertError.css) diff --git a/components/certerror/moz.build b/components/certerror/moz.build deleted file mode 100644 index c97072b..0000000 --- a/components/certerror/moz.build +++ /dev/null @@ -1,7 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; 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/. - -JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/components/dirprovider/DirectoryProvider.cpp b/components/dirprovider/DirectoryProvider.cpp deleted file mode 100644 index 85728b3..0000000 --- a/components/dirprovider/DirectoryProvider.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/* 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 "nsIDirectoryService.h" -#include "DirectoryProvider.h" - -#include "nsIFile.h" -#include "nsISimpleEnumerator.h" -#include "nsIPrefService.h" -#include "nsIPrefBranch.h" - -#include "nsArrayEnumerator.h" -#include "nsEnumeratorUtils.h" -#include "nsAppDirectoryServiceDefs.h" -#include "nsDirectoryServiceDefs.h" -#include "nsCategoryManagerUtils.h" -#include "nsComponentManagerUtils.h" -#include "nsCOMArray.h" -#include "nsDirectoryServiceUtils.h" -#include "mozilla/ModuleUtils.h" -#include "nsServiceManagerUtils.h" -#include "nsStringAPI.h" -#include "nsXULAppAPI.h" -#include "nsIPrefLocalizedString.h" - -namespace mozilla { -namespace browser { - -NS_IMPL_ISUPPORTS(DirectoryProvider, - nsIDirectoryServiceProvider, - nsIDirectoryServiceProvider2) - -NS_IMETHODIMP -DirectoryProvider::GetFile(const char *aKey, bool *aPersist, nsIFile* *aResult) -{ - return NS_ERROR_FAILURE; -} - -static void -AppendFileKey(const char *key, nsIProperties* aDirSvc, - nsCOMArray &array) -{ - nsCOMPtr file; - nsresult rv = aDirSvc->Get(key, NS_GET_IID(nsIFile), getter_AddRefs(file)); - if (NS_FAILED(rv)) - return; - - bool exists; - rv = file->Exists(&exists); - if (NS_FAILED(rv) || !exists) - return; - - array.AppendObject(file); -} - -// Appends the distribution-specific search engine directories to the -// array. The directory structure is as follows: - -// appdir/ -// \- distribution/ -// \- searchplugins/ -// |- common/ -// \- locale/ -// |- / -// ... -// \- / - -// common engines are loaded for all locales. If there is no locale -// directory for the current locale, there is a pref: -// "distribution.searchplugins.defaultLocale" -// which specifies a default locale to use. - -static void -AppendDistroSearchDirs(nsIProperties* aDirSvc, nsCOMArray &array) -{ - nsCOMPtr searchPlugins; - nsresult rv = aDirSvc->Get(XRE_APP_DISTRIBUTION_DIR, - NS_GET_IID(nsIFile), - getter_AddRefs(searchPlugins)); - if (NS_FAILED(rv)) - return; - searchPlugins->AppendNative(NS_LITERAL_CSTRING("searchplugins")); - - bool exists; - rv = searchPlugins->Exists(&exists); - if (NS_FAILED(rv) || !exists) - return; - - nsCOMPtr commonPlugins; - rv = searchPlugins->Clone(getter_AddRefs(commonPlugins)); - if (NS_SUCCEEDED(rv)) { - commonPlugins->AppendNative(NS_LITERAL_CSTRING("common")); - rv = commonPlugins->Exists(&exists); - if (NS_SUCCEEDED(rv) && exists) - array.AppendObject(commonPlugins); - } - - nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); - if (prefs) { - - nsCOMPtr localePlugins; - rv = searchPlugins->Clone(getter_AddRefs(localePlugins)); - if (NS_FAILED(rv)) - return; - - localePlugins->AppendNative(NS_LITERAL_CSTRING("locale")); - - nsCString locale; - nsCOMPtr prefString; - rv = prefs->GetComplexValue("general.useragent.locale", - NS_GET_IID(nsIPrefLocalizedString), - getter_AddRefs(prefString)); - if (NS_SUCCEEDED(rv)) { - nsAutoString wLocale; - prefString->GetData(getter_Copies(wLocale)); - CopyUTF16toUTF8(wLocale, locale); - } else { - rv = prefs->GetCharPref("general.useragent.locale", getter_Copies(locale)); - } - - if (NS_SUCCEEDED(rv)) { - - nsCOMPtr curLocalePlugins; - rv = localePlugins->Clone(getter_AddRefs(curLocalePlugins)); - if (NS_SUCCEEDED(rv)) { - - curLocalePlugins->AppendNative(locale); - rv = curLocalePlugins->Exists(&exists); - if (NS_SUCCEEDED(rv) && exists) { - array.AppendObject(curLocalePlugins); - return; // all done - } - } - } - - // we didn't append the locale dir - try the default one - nsCString defLocale; - rv = prefs->GetCharPref("distribution.searchplugins.defaultLocale", - getter_Copies(defLocale)); - if (NS_SUCCEEDED(rv)) { - - nsCOMPtr defLocalePlugins; - rv = localePlugins->Clone(getter_AddRefs(defLocalePlugins)); - if (NS_SUCCEEDED(rv)) { - - defLocalePlugins->AppendNative(defLocale); - rv = defLocalePlugins->Exists(&exists); - if (NS_SUCCEEDED(rv) && exists) - array.AppendObject(defLocalePlugins); - } - } - } -} - -NS_IMETHODIMP -DirectoryProvider::GetFiles(const char *aKey, nsISimpleEnumerator* *aResult) -{ - nsresult rv; - - if (!strcmp(aKey, NS_APP_SEARCH_DIR_LIST)) { - nsCOMPtr dirSvc - (do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID)); - if (!dirSvc) - return NS_ERROR_FAILURE; - - nsCOMArray baseFiles; - - /** - * We want to preserve the following order, since the search service loads - * engines in first-loaded-wins order. - * - extension search plugin locations (prepended below using - * NS_NewUnionEnumerator) - * - distro search plugin locations - * - user search plugin locations (profile) - * - app search plugin location (shipped engines) - */ - AppendDistroSearchDirs(dirSvc, baseFiles); - AppendFileKey(NS_APP_USER_SEARCH_DIR, dirSvc, baseFiles); - AppendFileKey(NS_APP_SEARCH_DIR, dirSvc, baseFiles); - - nsCOMPtr baseEnum; - rv = NS_NewArrayEnumerator(getter_AddRefs(baseEnum), baseFiles); - if (NS_FAILED(rv)) - return rv; - - nsCOMPtr list; - rv = dirSvc->Get(XRE_EXTENSIONS_DIR_LIST, - NS_GET_IID(nsISimpleEnumerator), getter_AddRefs(list)); - if (NS_FAILED(rv)) - return rv; - - static char const *const kAppendSPlugins[] = {"searchplugins", nullptr}; - - nsCOMPtr extEnum = - new AppendingEnumerator(list, kAppendSPlugins); - if (!extEnum) - return NS_ERROR_OUT_OF_MEMORY; - - return NS_NewUnionEnumerator(aResult, extEnum, baseEnum); - } - - return NS_ERROR_FAILURE; -} - -NS_IMPL_ISUPPORTS(DirectoryProvider::AppendingEnumerator, nsISimpleEnumerator) - -NS_IMETHODIMP -DirectoryProvider::AppendingEnumerator::HasMoreElements(bool *aResult) -{ - *aResult = mNext ? true : false; - return NS_OK; -} - -NS_IMETHODIMP -DirectoryProvider::AppendingEnumerator::GetNext(nsISupports* *aResult) -{ - if (aResult) - NS_ADDREF(*aResult = mNext); - - mNext = nullptr; - - nsresult rv; - - // Ignore all errors - - bool more; - while (NS_SUCCEEDED(mBase->HasMoreElements(&more)) && more) { - nsCOMPtr nextbasesupp; - mBase->GetNext(getter_AddRefs(nextbasesupp)); - - nsCOMPtr nextbase(do_QueryInterface(nextbasesupp)); - if (!nextbase) - continue; - - nextbase->Clone(getter_AddRefs(mNext)); - if (!mNext) - continue; - - char const *const * i = mAppendList; - while (*i) { - mNext->AppendNative(nsDependentCString(*i)); - ++i; - } - - bool exists; - rv = mNext->Exists(&exists); - if (NS_SUCCEEDED(rv) && exists) - break; - - mNext = nullptr; - } - - return NS_OK; -} - -DirectoryProvider::AppendingEnumerator::AppendingEnumerator - (nsISimpleEnumerator* aBase, - char const *const *aAppendList) : - mBase(aBase), - mAppendList(aAppendList) -{ - // Initialize mNext to begin. - GetNext(nullptr); -} - -} // namespace browser -} // namespace mozilla diff --git a/components/dirprovider/DirectoryProvider.h b/components/dirprovider/DirectoryProvider.h deleted file mode 100644 index 43fa85a..0000000 --- a/components/dirprovider/DirectoryProvider.h +++ /dev/null @@ -1,51 +0,0 @@ -/* 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/. */ - -#ifndef DirectoryProvider_h__ -#define DirectoryProvider_h__ - -#include "nsIDirectoryService.h" -#include "nsComponentManagerUtils.h" -#include "nsISimpleEnumerator.h" -#include "nsIFile.h" -#include "mozilla/Attributes.h" - -#define NS_BROWSERDIRECTORYPROVIDER_CONTRACTID \ - "@mozilla.org/browser/directory-provider;1" - -namespace mozilla { -namespace browser { - -class DirectoryProvider final : public nsIDirectoryServiceProvider2 -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIDIRECTORYSERVICEPROVIDER - NS_DECL_NSIDIRECTORYSERVICEPROVIDER2 - -private: - ~DirectoryProvider() {} - - class AppendingEnumerator final : public nsISimpleEnumerator - { - public: - NS_DECL_ISUPPORTS - NS_DECL_NSISIMPLEENUMERATOR - - AppendingEnumerator(nsISimpleEnumerator* aBase, - char const *const *aAppendList); - - private: - ~AppendingEnumerator() {} - - nsCOMPtr mBase; - char const *const *const mAppendList; - nsCOMPtr mNext; - }; -}; - -} // namespace browser -} // namespace mozilla - -#endif // DirectoryProvider_h__ diff --git a/components/dirprovider/moz.build b/components/dirprovider/moz.build deleted file mode 100644 index b01c4a3..0000000 --- a/components/dirprovider/moz.build +++ /dev/null @@ -1,13 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; 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/. - -EXPORTS.mozilla.browser += ['DirectoryProvider.h'] - -SOURCES += ['DirectoryProvider.cpp'] - -FINAL_LIBRARY = 'browsercomps' - -LOCAL_INCLUDES += ['../build'] diff --git a/components/distribution.js b/components/distribution.js deleted file mode 100644 index 121e55b..0000000 --- a/components/distribution.js +++ /dev/null @@ -1,345 +0,0 @@ -/* 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/. */ - -this.EXPORTED_SYMBOLS = [ "DistributionCustomizer" ]; - -var Ci = Components.interfaces; -var Cc = Components.classes; -var Cr = Components.results; -var Cu = Components.utils; - -const DISTRIBUTION_CUSTOMIZATION_COMPLETE_TOPIC = - "distribution-customization-complete"; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", - "resource://gre/modules/PlacesUtils.jsm"); - -this.DistributionCustomizer = function DistributionCustomizer() { - let dirSvc = Cc["@mozilla.org/file/directory_service;1"]. - getService(Ci.nsIProperties); - let iniFile = dirSvc.get("XREExeF", Ci.nsIFile); - iniFile.leafName = "distribution"; - iniFile.append("distribution.ini"); - if (iniFile.exists()) - this._iniFile = iniFile; -} - -DistributionCustomizer.prototype = { - _iniFile: null, - - get _ini() { - let ini = Cc["@mozilla.org/xpcom/ini-parser-factory;1"]. - getService(Ci.nsIINIParserFactory). - createINIParser(this._iniFile); - this.__defineGetter__("_ini", function() ini); - return this._ini; - }, - - get _locale() { - let locale = this._prefs.getCharPref("general.useragent.locale", "en-US"); - this.__defineGetter__("_locale", function() locale); - return this._locale; - }, - - get _prefSvc() { - let svc = Cc["@mozilla.org/preferences-service;1"]. - getService(Ci.nsIPrefService); - this.__defineGetter__("_prefSvc", function() svc); - return this._prefSvc; - }, - - get _prefs() { - let branch = this._prefSvc.getBranch(null); - this.__defineGetter__("_prefs", function() branch); - return this._prefs; - }, - - get _ioSvc() { - let svc = Cc["@mozilla.org/network/io-service;1"]. - getService(Ci.nsIIOService); - this.__defineGetter__("_ioSvc", function() svc); - return this._ioSvc; - }, - - _makeURI: function DIST__makeURI(spec) { - return this._ioSvc.newURI(spec, null, null); - }, - - _parseBookmarksSection: - function DIST_parseBookmarksSection(parentId, section) { - let keys = []; - for (let i in enumerate(this._ini.getKeys(section))) - keys.push(i); - keys.sort(); - - let items = {}; - let defaultItemId = -1; - let maxItemId = -1; - - for (let i = 0; i < keys.length; i++) { - let m = /^item\.(\d+)\.(\w+)\.?(\w*)/.exec(keys[i]); - if (m) { - let [foo, iid, iprop, ilocale] = m; - iid = parseInt(iid); - - if (ilocale) - continue; - - if (!items[iid]) - items[iid] = {}; - if (keys.indexOf(keys[i] + "." + this._locale) >= 0) { - items[iid][iprop] = this._ini.getString(section, keys[i] + "." + - this._locale); - } else { - items[iid][iprop] = this._ini.getString(section, keys[i]); - } - - if (iprop == "type" && items[iid]["type"] == "default") - defaultItemId = iid; - - if (maxItemId < iid) - maxItemId = iid; - } else { - dump("Key did not match: " + keys[i] + "\n"); - } - } - - let prependIndex = 0; - for (let iid = 0; iid <= maxItemId; iid++) { - if (!items[iid]) - continue; - - let index = PlacesUtils.bookmarks.DEFAULT_INDEX; - let newId; - - switch (items[iid]["type"]) { - case "default": - break; - - case "folder": - if (iid < defaultItemId) - index = prependIndex++; - - newId = PlacesUtils.bookmarks.createFolder(parentId, - items[iid]["title"], - index); - - this._parseBookmarksSection(newId, "BookmarksFolder-" + - items[iid]["folderId"]); - - if (items[iid]["description"]) - PlacesUtils.annotations.setItemAnnotation(newId, - "bookmarkProperties/description", - items[iid]["description"], 0, - PlacesUtils.annotations.EXPIRE_NEVER); - - break; - - case "separator": - if (iid < defaultItemId) - index = prependIndex++; - PlacesUtils.bookmarks.insertSeparator(parentId, index); - break; - - case "livemark": - if (iid < defaultItemId) - index = prependIndex++; - - // Don't bother updating the livemark contents on creation. - PlacesUtils.livemarks.addLivemark({ title: items[iid]["title"] - , parentId: parentId - , index: index - , feedURI: this._makeURI(items[iid]["feedLink"]) - , siteURI: this._makeURI(items[iid]["siteLink"]) - }).then(null, Cu.reportError); - break; - - case "bookmark": - default: - if (iid < defaultItemId) - index = prependIndex++; - - newId = PlacesUtils.bookmarks.insertBookmark(parentId, - this._makeURI(items[iid]["link"]), - index, items[iid]["title"]); - - if (items[iid]["description"]) - PlacesUtils.annotations.setItemAnnotation(newId, - "bookmarkProperties/description", - items[iid]["description"], 0, - PlacesUtils.annotations.EXPIRE_NEVER); - - break; - } - } - }, - - _customizationsApplied: false, - applyCustomizations: function DIST_applyCustomizations() { - this._customizationsApplied = true; - if (!this._iniFile) - return this._checkCustomizationComplete(); - - // nsPrefService loads very early. Reload prefs so we can set - // distribution defaults during the prefservice:after-app-defaults - // notification (see applyPrefDefaults below) - this._prefSvc.QueryInterface(Ci.nsIObserver); - this._prefSvc.observe(null, "reload-default-prefs", null); - }, - - _bookmarksApplied: false, - applyBookmarks: function DIST_applyBookmarks() { - this._bookmarksApplied = true; - if (!this._iniFile) - return this._checkCustomizationComplete(); - - let sections = enumToObject(this._ini.getSections()); - - // The global section, and several of its fields, is required - // (we also check here to be consistent with applyPrefDefaults below) - if (!sections["Global"]) - return this._checkCustomizationComplete(); - let globalPrefs = enumToObject(this._ini.getKeys("Global")); - if (!(globalPrefs["id"] && globalPrefs["version"] && globalPrefs["about"])) - return this._checkCustomizationComplete(); - - let bmProcessedPref; - try { - bmProcessedPref = this._ini.getString("Global", - "bookmarks.initialized.pref"); - } - catch (e) { - bmProcessedPref = "distribution." + - this._ini.getString("Global", "id") + ".bookmarksProcessed"; - } - - let bmProcessed = this._prefs.getBoolPref(bmProcessedPref, false); - - if (!bmProcessed) { - if (sections["BookmarksMenu"]) - this._parseBookmarksSection(PlacesUtils.bookmarksMenuFolderId, - "BookmarksMenu"); - if (sections["BookmarksToolbar"]) - this._parseBookmarksSection(PlacesUtils.toolbarFolderId, - "BookmarksToolbar"); - this._prefs.setBoolPref(bmProcessedPref, true); - } - return this._checkCustomizationComplete(); - }, - - _prefDefaultsApplied: false, - applyPrefDefaults: function DIST_applyPrefDefaults() { - this._prefDefaultsApplied = true; - if (!this._iniFile) - return this._checkCustomizationComplete(); - - let sections = enumToObject(this._ini.getSections()); - - // The global section, and several of its fields, is required - if (!sections["Global"]) - return this._checkCustomizationComplete(); - let globalPrefs = enumToObject(this._ini.getKeys("Global")); - if (!(globalPrefs["id"] && globalPrefs["version"] && globalPrefs["about"])) - return this._checkCustomizationComplete(); - - let defaults = this._prefSvc.getDefaultBranch(null); - - // Global really contains info we set as prefs. They're only - // separate because they are "special" (read: required) - - defaults.setCharPref("distribution.id", this._ini.getString("Global", "id")); - defaults.setCharPref("distribution.version", - this._ini.getString("Global", "version")); - - let partnerAbout = Cc["@mozilla.org/supports-string;1"]. - createInstance(Ci.nsISupportsString); - try { - if (globalPrefs["about." + this._locale]) { - partnerAbout.data = this._ini.getString("Global", "about." + this._locale); - } else { - partnerAbout.data = this._ini.getString("Global", "about"); - } - defaults.setComplexValue("distribution.about", - Ci.nsISupportsString, partnerAbout); - } catch (e) { - /* ignore bad prefs due to bug 895473 and move on */ - Cu.reportError(e); - } - - if (sections["Preferences"]) { - for (let key in enumerate(this._ini.getKeys("Preferences"))) { - try { - let value = eval(this._ini.getString("Preferences", key)); - switch (typeof value) { - case "boolean": - defaults.setBoolPref(key, value); - break; - case "number": - defaults.setIntPref(key, value); - break; - case "string": - defaults.setCharPref(key, value); - break; - case "undefined": - defaults.setCharPref(key, value); - break; - } - } catch (e) { /* ignore bad prefs and move on */ } - } - } - - // We eval() the localizable prefs as well (even though they'll - // always get set as a string) to keep the INI format consistent: - // string prefs always need to be in quotes - - let localizedStr = Cc["@mozilla.org/pref-localizedstring;1"]. - createInstance(Ci.nsIPrefLocalizedString); - - if (sections["LocalizablePreferences"]) { - for (let key in enumerate(this._ini.getKeys("LocalizablePreferences"))) { - try { - let value = eval(this._ini.getString("LocalizablePreferences", key)); - value = value.replace("%LOCALE%", this._locale, "g"); - localizedStr.data = "data:text/plain," + key + "=" + value; - defaults.setComplexValue(key, Ci.nsIPrefLocalizedString, localizedStr); - } catch (e) { /* ignore bad prefs and move on */ } - } - } - - if (sections["LocalizablePreferences-" + this._locale]) { - for (let key in enumerate(this._ini.getKeys("LocalizablePreferences-" + this._locale))) { - try { - let value = eval(this._ini.getString("LocalizablePreferences-" + this._locale, key)); - localizedStr.data = "data:text/plain," + key + "=" + value; - defaults.setComplexValue(key, Ci.nsIPrefLocalizedString, localizedStr); - } catch (e) { /* ignore bad prefs and move on */ } - } - } - - return this._checkCustomizationComplete(); - }, - - _checkCustomizationComplete: function DIST__checkCustomizationComplete() { - let prefDefaultsApplied = this._prefDefaultsApplied || !this._iniFile; - if (this._customizationsApplied && this._bookmarksApplied && - prefDefaultsApplied) { - let os = Cc["@mozilla.org/observer-service;1"]. - getService(Ci.nsIObserverService); - os.notifyObservers(null, DISTRIBUTION_CUSTOMIZATION_COMPLETE_TOPIC, null); - } - } -}; - -function enumerate(UTF8Enumerator) { - while (UTF8Enumerator.hasMore()) - yield UTF8Enumerator.getNext(); -} - -function enumToObject(UTF8Enumerator) { - let ret = {}; - for (let i in enumerate(UTF8Enumerator)) - ret[i] = 1; - return ret; -} diff --git a/components/downloads/BrowserDownloads.manifest b/components/downloads/BrowserDownloads.manifest deleted file mode 100644 index 1881ca1..0000000 --- a/components/downloads/BrowserDownloads.manifest +++ /dev/null @@ -1,4 +0,0 @@ -component {49507fe5-2cee-4824-b6a3-e999150ce9b8} DownloadsStartup.js -contract @mozilla.org/browser/downloadsstartup;1 {49507fe5-2cee-4824-b6a3-e999150ce9b8} -category profile-after-change DownloadsStartup @mozilla.org/browser/downloadsstartup;1 -component {4d99321e-d156-455b-81f7-e7aa2308134f} DownloadsUI.js diff --git a/components/downloads/DownloadsCommon.jsm b/components/downloads/DownloadsCommon.jsm deleted file mode 100644 index efe31ce..0000000 --- a/components/downloads/DownloadsCommon.jsm +++ /dev/null @@ -1,1920 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80 filetype=javascript: */ -/* 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"; - -this.EXPORTED_SYMBOLS = [ - "DownloadsCommon", -]; - -/** - * Handles the Downloads panel shared methods and data access. - * - * This file includes the following constructors and global objects: - * - * DownloadsCommon - * This object is exposed directly to the consumers of this JavaScript module, - * and provides shared methods for all the instances of the user interface. - * - * DownloadsData - * Retrieves the list of past and completed downloads from the underlying - * Downloads API data, and provides asynchronous notifications allowing - * to build a consistent view of the available data. - * - * DownloadsIndicatorData - * This object registers itself with DownloadsData as a view, and transforms the - * notifications it receives into overall status data, that is then broadcast to - * the registered download status indicators. - */ - -//////////////////////////////////////////////////////////////////////////////// -//// Globals - -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cu = Components.utils; -const Cr = Components.results; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/Services.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", - "resource://gre/modules/NetUtil.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "PluralForm", - "resource://gre/modules/PluralForm.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Downloads", - "resource://gre/modules/Downloads.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "DownloadUIHelper", - "resource://gre/modules/DownloadUIHelper.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "DownloadUtils", - "resource://gre/modules/DownloadUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", - "resource://gre/modules/FileUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "OS", - "resource://gre/modules/osfile.jsm") -XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", - "resource://gre/modules/PlacesUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", - "resource://gre/modules/PrivateBrowsingUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow", - "resource:///modules/RecentWindow.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", - "resource://gre/modules/PlacesUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Promise", - "resource://gre/modules/Promise.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "DownloadsLogger", - "resource:///modules/DownloadsLogger.jsm"); - -const nsIDM = Ci.nsIDownloadManager; - -const kDownloadsStringBundleUrl = - "chrome://browser/locale/downloads/downloads.properties"; - -const kPrefConfirmOpenExe = "browser.download.confirmOpenExecutable"; - -const kDownloadsStringsRequiringFormatting = { - sizeWithUnits: true, - shortTimeLeftSeconds: true, - shortTimeLeftMinutes: true, - shortTimeLeftHours: true, - shortTimeLeftDays: true, - statusSeparator: true, - statusSeparatorBeforeNumber: true, - fileExecutableSecurityWarning: true -}; - -const kDownloadsStringsRequiringPluralForm = { - otherDownloads2: true -}; - -const kPartialDownloadSuffix = ".part"; - -const kPrefBranch = Services.prefs.getBranch("browser.download."); - -var PrefObserver = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference]), - getPref: function PO_getPref(name) { - try { - switch (typeof this.prefs[name]) { - case "boolean": - return kPrefBranch.getBoolPref(name); - } - } catch (ex) { } - return this.prefs[name]; - }, - observe: function PO_observe(aSubject, aTopic, aData) { - if (this.prefs.hasOwnProperty(aData)) { - return this[aData] = this.getPref(aData); - } - }, - register: function PO_register(prefs) { - this.prefs = prefs; - kPrefBranch.addObserver("", this, true); - for (let key in prefs) { - let name = key; - XPCOMUtils.defineLazyGetter(this, name, function () { - return PrefObserver.getPref(name); - }); - } - }, -}; - -PrefObserver.register({ - // prefName: defaultValue - debug: false, - animateNotifications: true -}); - - -//////////////////////////////////////////////////////////////////////////////// -//// DownloadsCommon - -/** - * This object is exposed directly to the consumers of this JavaScript module, - * and provides shared methods for all the instances of the user interface. - */ -this.DownloadsCommon = { - log: function DC_log(...aMessageArgs) { - delete this.log; - this.log = function DC_log(...aMessageArgs) { - if (!PrefObserver.debug) { - return; - } - DownloadsLogger.log.apply(DownloadsLogger, aMessageArgs); - } - this.log.apply(this, aMessageArgs); - }, - - error: function DC_error(...aMessageArgs) { - delete this.error; - this.error = function DC_error(...aMessageArgs) { - if (!PrefObserver.debug) { - return; - } - DownloadsLogger.reportError.apply(DownloadsLogger, aMessageArgs); - } - this.error.apply(this, aMessageArgs); - }, - /** - * Returns an object whose keys are the string names from the downloads string - * bundle, and whose values are either the translated strings or functions - * returning formatted strings. - */ - get strings() - { - let strings = {}; - let sb = Services.strings.createBundle(kDownloadsStringBundleUrl); - let enumerator = sb.getSimpleEnumeration(); - while (enumerator.hasMoreElements()) { - let string = enumerator.getNext().QueryInterface(Ci.nsIPropertyElement); - let stringName = string.key; - if (stringName in kDownloadsStringsRequiringFormatting) { - strings[stringName] = function () { - // Convert "arguments" to a real array before calling into XPCOM. - return sb.formatStringFromName(stringName, - Array.slice(arguments, 0), - arguments.length); - }; - } else if (stringName in kDownloadsStringsRequiringPluralForm) { - strings[stringName] = function (aCount) { - // Convert "arguments" to a real array before calling into XPCOM. - let formattedString = sb.formatStringFromName(stringName, - Array.slice(arguments, 0), - arguments.length); - return PluralForm.get(aCount, formattedString); - }; - } else { - strings[stringName] = string.value; - } - } - delete this.strings; - return this.strings = strings; - }, - - /** - * Generates a very short string representing the given time left. - * - * @param aSeconds - * Value to be formatted. It represents the number of seconds, it must - * be positive but does not need to be an integer. - * - * @return Formatted string, for example "30s" or "2h". The returned value is - * maximum three characters long, at least in English. - */ - formatTimeLeft: function DC_formatTimeLeft(aSeconds) - { - // Decide what text to show for the time - let seconds = Math.round(aSeconds); - if (!seconds) { - return ""; - } else if (seconds <= 30) { - return DownloadsCommon.strings["shortTimeLeftSeconds"](seconds); - } - let minutes = Math.round(aSeconds / 60); - if (minutes < 60) { - return DownloadsCommon.strings["shortTimeLeftMinutes"](minutes); - } - let hours = Math.round(minutes / 60); - if (hours < 48) { // two days - return DownloadsCommon.strings["shortTimeLeftHours"](hours); - } - let days = Math.round(hours / 24); - return DownloadsCommon.strings["shortTimeLeftDays"](Math.min(days, 99)); - }, - - /** - * Indicates whether we should show the full Download Manager window interface - * instead of the simplified panel interface. The behavior of downloads - * across browsing session is consistent with the selected interface. - */ - get useToolkitUI() - { - /* Toolkit UI is currently incompatible. - * FIXME: Either fix the toolkitUI (make DBConnection work) or remove - * the unused code altogether - */ - //try { - // return Services.prefs.getBoolPref("browser.download.useToolkitUI"); - //} catch (ex) { } - return false; - }, - - /** - * Indicates whether we should show visual notification on the indicator - * when a download event is triggered. - */ - get animateNotifications() - { - return PrefObserver.animateNotifications; - }, - - /** - * Get access to one of the DownloadsData or PrivateDownloadsData objects, - * depending on the privacy status of the window in question. - * - * @param aWindow - * The browser window which owns the download button. - */ - getData: function DC_getData(aWindow) { - if (PrivateBrowsingUtils.isWindowPrivate(aWindow)) { - return PrivateDownloadsData; - } else { - return DownloadsData; - } - }, - - /** - * Initializes the data link for both the private and non-private downloads - * data objects. - * - * @param aDownloadManagerService - * Reference to the service implementing nsIDownloadManager. We need - * this because getService isn't available for us when this method is - * called, and we must ensure to register our listeners before the - * getService call for the Download Manager returns. - */ - initializeAllDataLinks: function DC_initializeAllDataLinks(aDownloadManagerService) { - DownloadsData.initializeDataLink(aDownloadManagerService); - PrivateDownloadsData.initializeDataLink(aDownloadManagerService); - }, - - /** - * Terminates the data link for both the private and non-private downloads - * data objects. - */ - terminateAllDataLinks: function DC_terminateAllDataLinks() { - DownloadsData.terminateDataLink(); - PrivateDownloadsData.terminateDataLink(); - }, - - /** - * Reloads the specified kind of downloads from the non-private store. - * This method must only be called when Private Browsing Mode is disabled. - * - * @param aActiveOnly - * True to load only active downloads from the database. - */ - ensureAllPersistentDataLoaded: - function DC_ensureAllPersistentDataLoaded(aActiveOnly) { - DownloadsData.ensurePersistentDataLoaded(aActiveOnly); - }, - - /** - * Get access to one of the DownloadsIndicatorData or - * PrivateDownloadsIndicatorData objects, depending on the privacy status of - * the window in question. - */ - getIndicatorData: function DC_getIndicatorData(aWindow) { - if (PrivateBrowsingUtils.isWindowPrivate(aWindow)) { - return PrivateDownloadsIndicatorData; - } else { - return DownloadsIndicatorData; - } - }, - - /** - * Returns a reference to the DownloadsSummaryData singleton - creating one - * in the process if one hasn't been instantiated yet. - * - * @param aWindow - * The browser window which owns the download button. - * @param aNumToExclude - * The number of items on the top of the downloads list to exclude - * from the summary. - */ - getSummary: function DC_getSummary(aWindow, aNumToExclude) - { - if (PrivateBrowsingUtils.isWindowPrivate(aWindow)) { - if (this._privateSummary) { - return this._privateSummary; - } - return this._privateSummary = new DownloadsSummaryData(true, aNumToExclude); - } else { - if (this._summary) { - return this._summary; - } - return this._summary = new DownloadsSummaryData(false, aNumToExclude); - } - }, - _summary: null, - _privateSummary: null, - - /** - * Returns the legacy state integer value for the provided Download object. - */ - stateOfDownload(download) { - // Collapse state using the correct priority. - if (!download.stopped) { - return nsIDM.DOWNLOAD_DOWNLOADING; - } - if (download.succeeded) { - return nsIDM.DOWNLOAD_FINISHED; - } - if (download.error) { - if (download.error.becauseBlockedByParentalControls) { - return nsIDM.DOWNLOAD_BLOCKED_PARENTAL; - } - if (download.error.becauseBlockedByReputationCheck) { - return nsIDM.DOWNLOAD_DIRTY; - } - return nsIDM.DOWNLOAD_FAILED; - } - if (download.canceled) { - if (download.hasPartialData) { - return nsIDM.DOWNLOAD_PAUSED; - } - return nsIDM.DOWNLOAD_CANCELED; - } - return nsIDM.DOWNLOAD_NOTSTARTED; - }, - - /** - * Helper function required because the Downloads Panel and the Downloads View - * don't share the controller yet. - */ - removeAndFinalizeDownload(download) { - Downloads.getList(Downloads.ALL) - .then(list => list.remove(download)) - .then(() => download.finalize(true)) - .catch(Cu.reportError); - }, - - /** - * Given an iterable collection of Download objects, generates and returns - * statistics about that collection. - * - * @param downloads An iterable collection of Download objects. - * - * @return Object whose properties are the generated statistics. Currently, - * we return the following properties: - * - * numActive : The total number of downloads. - * numPaused : The total number of paused downloads. - * numDownloading : The total number of downloads being downloaded. - * totalSize : The total size of all downloads once completed. - * totalTransferred: The total amount of transferred data for these - * downloads. - * slowestSpeed : The slowest download rate. - * rawTimeLeft : The estimated time left for the downloads to - * complete. - * percentComplete : The percentage of bytes successfully downloaded. - */ - summarizeDownloads(downloads) { - let summary = { - numActive: 0, - numPaused: 0, - numDownloading: 0, - totalSize: 0, - totalTransferred: 0, - // slowestSpeed is Infinity so that we can use Math.min to - // find the slowest speed. We'll set this to 0 afterwards if - // it's still at Infinity by the time we're done iterating all - // download. - slowestSpeed: Infinity, - rawTimeLeft: -1, - percentComplete: -1 - } - - for (let download of downloads) { - summary.numActive++; - - if (!download.stopped) { - summary.numDownloading++; - if (download.hasProgress && download.speed > 0) { - let sizeLeft = download.totalBytes - download.currentBytes; - summary.rawTimeLeft = Math.max(summary.rawTimeLeft, - sizeLeft / download.speed); - summary.slowestSpeed = Math.min(summary.slowestSpeed, - download.speed); - } - } else if (download.canceled && download.hasPartialData) { - summary.numPaused++; - } - // Only add to total values if we actually know the download size. - if (download.succeeded) { - summary.totalSize += download.target.size; - summary.totalTransferred += download.target.size; - } else if (download.hasProgress) { - summary.totalSize += download.totalBytes; - summary.totalTransferred += download.currentBytes; - } - } - - if (summary.totalSize != 0) { - summary.percentComplete = (summary.totalTransferred / - summary.totalSize) * 100; - } - - if (summary.slowestSpeed == Infinity) { - summary.slowestSpeed = 0; - } - - return summary; - }, - - /** - * If necessary, smooths the estimated number of seconds remaining for one - * or more downloads to complete. - * - * @param aSeconds - * Current raw estimate on number of seconds left for one or more - * downloads. This is a floating point value to help get sub-second - * accuracy for current and future estimates. - */ - smoothSeconds: function DC_smoothSeconds(aSeconds, aLastSeconds) - { - // We apply an algorithm similar to the DownloadUtils.getTimeLeft function, - // though tailored to a single time estimation for all downloads. We never - // apply something if the new value is less than half the previous value. - let shouldApplySmoothing = aLastSeconds >= 0 && - aSeconds > aLastSeconds / 2; - if (shouldApplySmoothing) { - // Apply hysteresis to favor downward over upward swings. Trust only 30% - // of the new value if lower, and 10% if higher (exponential smoothing). - let diff = aSeconds - aLastSeconds; - aSeconds = aLastSeconds + (diff < 0 ? .3 : .1) * diff; - - // If the new time is similar, reuse something close to the last time - // left, but subtract a little to provide forward progress. - diff = aSeconds - aLastSeconds; - let diffPercent = diff / aLastSeconds * 100; - if (Math.abs(diff) < 5 || Math.abs(diffPercent) < 5) { - aSeconds = aLastSeconds - (diff < 0 ? .4 : .2); - } - } - - // In the last few seconds of downloading, we are always subtracting and - // never adding to the time left. Ensure that we never fall below one - // second left until all downloads are actually finished. - return aLastSeconds = Math.max(aSeconds, 1); - }, - - /** - * Opens a downloaded file. - * - * @param aFile - * the downloaded file to be opened. - * @param aMimeInfo - * the mime type info object. May be null. - * @param aOwnerWindow - * the window with which this action is associated. - */ - openDownloadedFile: function DC_openDownloadedFile(aFile, aMimeInfo, aOwnerWindow) { - if (!(aFile instanceof Ci.nsIFile)) - throw new Error("aFile must be a nsIFile object"); - if (aMimeInfo && !(aMimeInfo instanceof Ci.nsIMIMEInfo)) - throw new Error("Invalid value passed for aMimeInfo"); - if (!(aOwnerWindow instanceof Ci.nsIDOMWindow)) - throw new Error("aOwnerWindow must be a dom-window object"); - -#ifdef XP_WIN - // On Windows, the system will provide a native confirmation prompt - // for .exe files. Exclude this from our prompt, but prompt on other - // executable types. - let isWindowsExe = aFile.leafName.toLowerCase().endsWith(".exe"); -#else - let isWindowsExe = false; -#endif - - // Confirm opening executable files if required. - if (aFile.isExecutable() && !isWindowsExe) { - let showAlert = true; - try { - showAlert = Services.prefs.getBoolPref(kPrefConfirmOpenExe); - } catch (ex) { - // If the preference does not exist, continue with the prompt. - } - - if (showAlert) { - let name = aFile.leafName; - let message = - DownloadsCommon.strings.fileExecutableSecurityWarning(name, name); - let title = - DownloadsCommon.strings.fileExecutableSecurityWarningTitle; - - let open = Services.prompt.confirm(aOwnerWindow, title, message); - if (!open) { - return; - } - } - } - - // Actually open the file. - try { - if (aMimeInfo && aMimeInfo.preferredAction == aMimeInfo.useHelperApp) { - aMimeInfo.launchWithFile(aFile); - return; - } - } - catch(ex) { } - - // If either we don't have the mime info, or the preferred action failed, - // attempt to launch the file directly. - try { - aFile.launch(); - } - catch(ex) { - // If launch fails, try sending it through the system's external "file:" - // URL handler. - Cc["@mozilla.org/uriloader/external-protocol-service;1"] - .getService(Ci.nsIExternalProtocolService) - .loadUrl(NetUtil.newURI(aFile)); - } - }, - - /** - * Show a downloaded file in the system file manager. - * - * @param aFile - * a downloaded file. - */ - showDownloadedFile: function DC_showDownloadedFile(aFile) { - if (!(aFile instanceof Ci.nsIFile)) - throw new Error("aFile must be a nsIFile object"); - try { - // Show the directory containing the file and select the file. - aFile.reveal(); - } catch (ex) { - // If reveal fails for some reason (e.g., it's not implemented on unix - // or the file doesn't exist), try using the parent if we have it. - let parent = aFile.parent; - if (parent) { - try { - // Open the parent directory to show where the file should be. - parent.launch(); - } catch (ex) { - // If launch also fails (probably because it's not implemented), let - // the OS handler try to open the parent. - Cc["@mozilla.org/uriloader/external-protocol-service;1"] - .getService(Ci.nsIExternalProtocolService) - .loadUrl(NetUtil.newURI(parent)); - } - } - } - } -}; - -/** - * Returns true if we are executing on Windows Vista or a later version. - */ -XPCOMUtils.defineLazyGetter(DownloadsCommon, "isWinVistaOrHigher", function () { - let os = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS; - if (os != "WINNT") { - return false; - } - let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2); - return parseFloat(sysInfo.getProperty("version")) >= 6; -}); - -/** - * Returns true to indicate that we should hook the panel to the JavaScript API - * for downloads instead of the nsIDownloadManager back-end. - * This is kept for compatibility/leftovers and should be removed later. - */ -XPCOMUtils.defineLazyGetter(DownloadsCommon, "useJSTransfer", function () { - return true; -}); - -//////////////////////////////////////////////////////////////////////////////// -//// DownloadsData - -/** - * Retrieves the list of past and completed downloads from the underlying - * Download Manager data, and provides asynchronous notifications allowing to - * build a consistent view of the available data. - * - * This object responds to real-time changes in the underlying Download Manager - * data. For example, the deletion of one or more downloads is notified through - * the nsIObserver interface, while any state or progress change is notified - * through the nsIDownloadProgressListener interface. - * - * Note that using this object does not automatically start the Download Manager - * service. Consumers will see an empty list of downloads until the service is - * actually started. This is useful to display a neutral progress indicator in - * the main browser window until the autostart timeout elapses. - * - * Note that DownloadsData and PrivateDownloadsData are two equivalent singleton - * objects, one accessing non-private downloads, and the other accessing private - * ones. - */ -function DownloadsDataCtor(aPrivate) { - this._isPrivate = aPrivate; - - // Contains all the available Download objects and their integer state. - this.oldDownloadStates = new Map(); - - // Array of view objects that should be notified when the available download - // data changes. - this._views = []; -} - -DownloadsDataCtor.prototype = { - /** - * Starts receiving events for current downloads. - */ - initializeDataLink() { - if (!this._dataLinkInitialized) { - let promiseList = Downloads.getList(this._isPrivate ? Downloads.PRIVATE - : Downloads.PUBLIC); - promiseList.then(list => list.addView(this)).then(null, Cu.reportError); - this._dataLinkInitialized = true; - } - }, - _dataLinkInitialized: false, - - /** - * Stops receiving events for current downloads and cancels any pending read. - */ - terminateDataLink: function DD_terminateDataLink() - { - Cu.reportError("terminateDataLink not applicable with JS Transfers"); - return; - }, - - /** - * Iterator for all the available Download objects. This is empty until the - * data has been loaded using the JavaScript API for downloads. - */ - get downloads() this.oldDownloadStates.keys(), - - /** - * True if there are finished downloads that can be removed from the list. - */ - get canRemoveFinished() - { - for (let download of this.downloads) { - // Stopped, paused, and failed downloads with partial data are removed. - if (download.stopped && !(download.canceled && download.hasPartialData)) { - return true; - } - } - return false; - }, - - /** - * Asks the back-end to remove finished downloads from the list. - */ - removeFinished: function DD_removeFinished() - { - let promiseList = Downloads.getList(this._isPrivate ? Downloads.PRIVATE - : Downloads.PUBLIC); - promiseList.then(list => list.removeFinished()) - .then(null, Cu.reportError); - }, - - ////////////////////////////////////////////////////////////////////////////// - //// Integration with the asynchronous Downloads back-end - - onDownloadAdded(download) { - // Download objects do not store the end time of downloads, as the Downloads - // API does not need to persist this information for all platforms. Once a - // download terminates on a Desktop browser, it becomes a history download, - // for which the end time is stored differently, as a Places annotation. - download.endTime = Date.now(); - - this.oldDownloadStates.set(download, - DownloadsCommon.stateOfDownload(download)); - - for (let view of this._views) { - view.onDownloadAdded(download, true); - } - }, - - onDownloadChanged(download) { - let oldState = this.oldDownloadStates.get(download); - let newState = DownloadsCommon.stateOfDownload(download); - this.oldDownloadStates.set(download, newState); - - if (oldState != newState) { - if (download.succeeded || - (download.canceled && !download.hasPartialData) || - download.error) { - // Store the end time that may be displayed by the views. - download.endTime = Date.now(); - - // This state transition code should actually be located in a Downloads - // API module (bug 941009). Moreover, the fact that state is stored as - // annotations should be ideally hidden behind methods of - // nsIDownloadHistory (bug 830415). - if (!this._isPrivate) { - try { - let downloadMetaData = { - state: DownloadsCommon.stateOfDownload(download), - endTime: download.endTime, - }; - if (download.succeeded) { - downloadMetaData.fileSize = download.target.size; - } - - PlacesUtils.annotations.setPageAnnotation( - NetUtil.newURI(download.source.url), - "downloads/metaData", - JSON.stringify(downloadMetaData), 0, - PlacesUtils.annotations.EXPIRE_WITH_HISTORY); - } catch (ex) { - Cu.reportError(ex); - } - } - } - - for (let view of this._views) { - try { - view.onDownloadStateChanged(download); - } catch (ex) { - Cu.reportError(ex); - } - } - - if (download.succeeded || - (download.error && download.error.becauseBlocked)) { - this._notifyDownloadEvent("finish"); - } - } - - if (!download.newDownloadNotified) { - download.newDownloadNotified = true; - this._notifyDownloadEvent("start"); - } - - for (let view of this._views) { - view.onDownloadChanged(download); - } - }, - - onDownloadRemoved(download) { - this.oldDownloadStates.delete(download); - - for (let view of this._views) { - view.onDownloadRemoved(download); - } - }, - - ////////////////////////////////////////////////////////////////////////////// - //// Registration of views - - /** - * Adds an object to be notified when the available download data changes. - * The specified object is initialized with the currently available downloads. - * - * @param aView - * DownloadsView object to be added. This reference must be passed to - * removeView before termination. - */ - addView: function DD_addView(aView) - { - this._views.push(aView); - this._updateView(aView); - }, - - /** - * Removes an object previously added using addView. - * - * @param aView - * DownloadsView object to be removed. - */ - removeView: function DD_removeView(aView) - { - let index = this._views.indexOf(aView); - if (index != -1) { - this._views.splice(index, 1); - } - }, - - /** - * Ensures that the currently loaded data is added to the specified view. - * - * @param aView - * DownloadsView object to be initialized. - */ - _updateView: function DD_updateView(aView) - { - // Indicate to the view that a batch loading operation is in progress. - aView.onDataLoadStarting(); - - // Sort backwards by start time, ensuring that the most recent - // downloads are added first regardless of their state. - // Tycho: - //let loadedItemsArray = [dataItem - // for each (dataItem in this.dataItems) - // if (dataItem)]; - let downloadsArray = [...this.downloads]; - downloadsArray.sort((a, b) => b.startTime - a.startTime); - downloadsArray.forEach(download => aView.onDownloadAdded(download, false)); - - // Notify the view that all data is available unless loading is in progress. - if (!this._pendingStatement) { - aView.onDataLoadCompleted(); - } - }, - - ////////////////////////////////////////////////////////////////////////////// - //// In-memory downloads data store - - /** - * Clears the loaded data. - */ - clear: function DD_clear() - { - this._terminateDataAccess(); - this.dataItems = {}; - }, - - /** - * Returns the data item associated with the provided source object. The - * source can be a download object that we received from the Download Manager - * because of a real-time notification, or a row from the downloads database, - * during the asynchronous data load. - * - * In case we receive download status notifications while we are still - * populating the list of downloads from the database, we want the real-time - * status to take precedence over the state that is read from the database, - * which might be older. This is achieved by creating the download item if - * it's not already in the list, but never updating the returned object using - * the data from the database, if the object already exists. - * - * @param aSource - * Object containing the data with which the item should be initialized - * if it doesn't already exist in the list. This should implement - * either nsIDownload or mozIStorageRow. If the item exists, this - * argument is only used to retrieve the download identifier. - * @param aMayReuseGUID - * If false, indicates that the download should not be added if a - * download with the same identifier was removed in the meantime. This - * ensures that, while loading the list asynchronously, downloads that - * have been removed in the meantime do no reappear inadvertently. - * - * @return New or existing data item, or null if the item was deleted from the - * list of available downloads. - */ - _getOrAddDataItem: function DD_getOrAddDataItem(aSource, aMayReuseGUID) - { - let downloadGuid = (aSource instanceof Ci.nsIDownload) - ? aSource.guid - : aSource.getResultByName("guid"); - if (downloadGuid in this.dataItems) { - let existingItem = this.dataItems[downloadGuid]; - if (existingItem || !aMayReuseGUID) { - // Returns null if the download was removed and we can't reuse the item. - return existingItem; - } - } - DownloadsCommon.log("Creating a new DownloadsDataItem with downloadGuid =", - downloadGuid); - let dataItem = new DownloadsDataItem(aSource); - this.dataItems[downloadGuid] = dataItem; - - // Create the view items before returning. - let addToStartOfList = aSource instanceof Ci.nsIDownload; - this._views.forEach( - function (view) view.onDataItemAdded(dataItem, addToStartOfList) - ); - return dataItem; - }, - - /** - * Removes the data item with the specified identifier. - * - * This method can be called at most once per download identifier. - */ - _removeDataItem: function DD_removeDataItem(aDownloadId) - { - if (aDownloadId in this.dataItems) { - let dataItem = this.dataItems[aDownloadId]; - this.dataItems[aDownloadId] = null; - this._views.forEach( - function (view) view.onDataItemRemoved(dataItem) - ); - } - }, - - ////////////////////////////////////////////////////////////////////////////// - //// Persistent data loading - - /** - * Represents an executing statement, allowing its cancellation. - */ - _pendingStatement: null, - - /** - * Indicates which kind of items from the persistent downloads database have - * been fully loaded in memory and are available to the views. This can - * assume the value of one of the kLoad constants. - */ - _loadState: 0, - - /** No downloads have been fully loaded yet. */ - get kLoadNone() 0, - /** All the active downloads in the database are loaded in memory. */ - get kLoadActive() 1, - /** All the downloads in the database are loaded in memory. */ - get kLoadAll() 2, - - /** - * Reloads the specified kind of downloads from the persistent database. This - * method must only be called when Private Browsing Mode is disabled. - * - * @param aActiveOnly - * True to load only active downloads from the database. - */ - ensurePersistentDataLoaded: - function DD_ensurePersistentDataLoaded(aActiveOnly) - { - if (this == PrivateDownloadsData) { - Cu.reportError("ensurePersistentDataLoaded should not be called on PrivateDownloadsData"); - return; - } - - if (this._pendingStatement) { - // We are already in the process of reloading all downloads. - return; - } - - if (aActiveOnly) { - if (this._loadState == this.kLoadNone) { - DownloadsCommon.log("Loading only active downloads from the persistence database"); - // Indicate to the views that a batch loading operation is in progress. - this._views.forEach( - function (view) view.onDataLoadStarting() - ); - - // Reload the list using the Download Manager service. The list is - // returned in no particular order. - let downloads = Services.downloads.activeDownloads; - while (downloads.hasMoreElements()) { - let download = downloads.getNext().QueryInterface(Ci.nsIDownload); - this._getOrAddDataItem(download, true); - } - this._loadState = this.kLoadActive; - - // Indicate to the views that the batch loading operation is complete. - this._views.forEach( - function (view) view.onDataLoadCompleted() - ); - DownloadsCommon.log("Active downloads done loading."); - } - } else { - if (this._loadState != this.kLoadAll) { - // Load only the relevant columns from the downloads database. The - // columns are read in the _initFromDataRow method of DownloadsDataItem. - // Order by descending download identifier so that the most recent - // downloads are notified first to the listening views. - DownloadsCommon.log("Loading all downloads from the persistence database."); - let dbConnection = Services.downloads.DBConnection; - let statement = dbConnection.createAsyncStatement( - "SELECT guid, target, name, source, referrer, state, " - + "startTime, endTime, currBytes, maxBytes " - + "FROM moz_downloads " - + "ORDER BY startTime DESC" - ); - try { - this._pendingStatement = statement.executeAsync(this); - } finally { - statement.finalize(); - } - } - } - }, - - /** - * Cancels any pending data access and ensures views are notified. - */ - _terminateDataAccess: function DD_terminateDataAccess() - { - if (this._pendingStatement) { - this._pendingStatement.cancel(); - this._pendingStatement = null; - } - - // Close all the views on the current data. Create a copy of the array - // because some views might unregister while processing this event. - Array.slice(this._views, 0).forEach( - function (view) view.onDataInvalidated() - ); - }, - - ////////////////////////////////////////////////////////////////////////////// - //// mozIStorageStatementCallback - - handleResult: function DD_handleResult(aResultSet) - { - for (let row = aResultSet.getNextRow(); - row; - row = aResultSet.getNextRow()) { - // Add the download to the list and initialize it with the data we read, - // unless we already received a notification providing more reliable - // information for this download. - this._getOrAddDataItem(row, false); - } - }, - - handleError: function DD_handleError(aError) - { - DownloadsCommon.error("Database statement execution error (", - aError.result, "): ", aError.message); - }, - - handleCompletion: function DD_handleCompletion(aReason) - { - DownloadsCommon.log("Loading all downloads from database completed with reason:", - aReason); - this._pendingStatement = null; - - // To ensure that we don't inadvertently delete more downloads from the - // database than needed on shutdown, we should update the load state only if - // the operation completed successfully. - if (aReason == Ci.mozIStorageStatementCallback.REASON_FINISHED) { - this._loadState = this.kLoadAll; - } - - // Indicate to the views that the batch loading operation is complete, even - // if the lookup failed or was canceled. The only possible glitch happens - // in case the database backend changes while loading data, when the views - // would open and immediately close. This case is rare enough not to need a - // special treatment. - this._views.forEach( - function (view) view.onDataLoadCompleted() - ); - }, - - ////////////////////////////////////////////////////////////////////////////// - //// nsIObserver - - observe: function DD_observe(aSubject, aTopic, aData) - { - switch (aTopic) { - case "download-manager-remove-download-guid": - // If a single download was removed, remove the corresponding data item. - if (aSubject) { - let downloadGuid = aSubject.QueryInterface(Ci.nsISupportsCString).data; - DownloadsCommon.log("A single download with id", - downloadGuid, "was removed."); - this._removeDataItem(downloadGuid); - break; - } - - // Multiple downloads have been removed. Iterate over known downloads - // and remove those that don't exist anymore. - DownloadsCommon.log("Multiple downloads were removed."); - for each (let dataItem in this.dataItems) { - if (dataItem) { - // Bug 449811 - We have to bind to the dataItem because Javascript - // doesn't do fresh let-bindings per loop iteration. - let dataItemBinding = dataItem; - Services.downloads.getDownloadByGUID(dataItemBinding.downloadGuid, - function(aStatus, aResult) { - if (aStatus == Components.results.NS_ERROR_NOT_AVAILABLE) { - DownloadsCommon.log("Removing download with id", - dataItemBinding.downloadGuid); - this._removeDataItem(dataItemBinding.downloadGuid); - } - }.bind(this)); - } - } - break; - } - }, - - ////////////////////////////////////////////////////////////////////////////// - //// nsIDownloadProgressListener - - onDownloadStateChange: function DD_onDownloadStateChange(aOldState, aDownload) - { - if (aDownload.isPrivate != this._isPrivate) { - // Ignore the downloads with a privacy status other than what we are - // tracking. - return; - } - - // When a new download is added, it may have the same identifier of a - // download that we previously deleted during this session, and we also - // want to provide a visible indication that the download started. - let isNew = aOldState == nsIDM.DOWNLOAD_NOTSTARTED || - aOldState == nsIDM.DOWNLOAD_QUEUED; - - let dataItem = this._getOrAddDataItem(aDownload, isNew); - if (!dataItem) { - return; - } - - let wasInProgress = dataItem.inProgress; - - DownloadsCommon.log("A download changed its state to:", aDownload.state); - dataItem.state = aDownload.state; - dataItem.referrer = aDownload.referrer && aDownload.referrer.spec; - dataItem.resumable = aDownload.resumable; - dataItem.startTime = Math.round(aDownload.startTime / 1000); - dataItem.currBytes = aDownload.amountTransferred; - dataItem.maxBytes = aDownload.size; - - if (wasInProgress && !dataItem.inProgress) { - dataItem.endTime = Date.now(); - } - - // When a download is retried, we create a different download object from - // the database with the same ID as before. This means that the nsIDownload - // that the dataItem holds might now need updating. - // - // We only overwrite this in the event that _download exists, because if it - // doesn't, that means that no caller ever tried to get the nsIDownload, - // which means it was never retrieved and doesn't need to be overwritten. - if (dataItem._download) { - dataItem._download = aDownload; - } - - for (let view of this._views) { - try { - view.getViewItem(dataItem).onStateChange(aOldState); - } catch (ex) { - Cu.reportError(ex); - } - } - - if (isNew && !dataItem.newDownloadNotified) { - dataItem.newDownloadNotified = true; - this._notifyDownloadEvent("start"); - } - - // This is a final state of which we are only notified once. - if (dataItem.done) { - this._notifyDownloadEvent("finish"); - } - - // TODO Bug 830415: this isn't the right place to set these annotation. - // It should be set it in places' nsIDownloadHistory implementation. - if (!this._isPrivate && !dataItem.inProgress) { - let downloadMetaData = { state: dataItem.state, - endTime: dataItem.endTime }; - if (dataItem.done) - downloadMetaData.fileSize = dataItem.maxBytes; - - try { - PlacesUtils.annotations.setPageAnnotation( - NetUtil.newURI(dataItem.uri), "downloads/metaData", JSON.stringify(downloadMetaData), 0, - PlacesUtils.annotations.EXPIRE_WITH_HISTORY); - } - catch(ex) { - Cu.reportError(ex); - } - } - }, - - onProgressChange: function DD_onProgressChange(aWebProgress, aRequest, - aCurSelfProgress, - aMaxSelfProgress, - aCurTotalProgress, - aMaxTotalProgress, aDownload) - { - if (aDownload.isPrivate != this._isPrivate) { - // Ignore the downloads with a privacy status other than what we are - // tracking. - return; - } - - let dataItem = this._getOrAddDataItem(aDownload, false); - if (!dataItem) { - return; - } - - dataItem.currBytes = aDownload.amountTransferred; - dataItem.maxBytes = aDownload.size; - dataItem.speed = aDownload.speed; - dataItem.percentComplete = aDownload.percentComplete; - - this._views.forEach( - function (view) view.getViewItem(dataItem).onProgressChange() - ); - }, - - onStateChange: function () { }, - - onSecurityChange: function () { }, - - ////////////////////////////////////////////////////////////////////////////// - //// Notifications sent to the most recent browser window only - - /** - * Set to true after the first download causes the downloads panel to be - * displayed. - */ - get panelHasShownBefore() { - try { - return Services.prefs.getBoolPref("browser.download.panel.shown"); - } catch (ex) { } - return false; - }, - - set panelHasShownBefore(aValue) { - Services.prefs.setBoolPref("browser.download.panel.shown", aValue); - return aValue; - }, - - /** - * Displays a new or finished download notification in the most recent browser - * window, if one is currently available with the required privacy type. - * - * @param aType - * Set to "start" for new downloads, "finish" for completed downloads. - */ - _notifyDownloadEvent: function DD_notifyDownloadEvent(aType) - { - DownloadsCommon.log("Attempting to notify that a new download has started or finished."); - if (DownloadsCommon.useToolkitUI) { - DownloadsCommon.log("Cancelling notification - we're using the toolkit downloads manager."); - return; - } - - // Show the panel in the most recent browser window, if present. - let browserWin = RecentWindow.getMostRecentBrowserWindow({ private: this._isPrivate }); - if (!browserWin) { - return; - } - - if (this.panelHasShownBefore) { - // For new downloads after the first one, don't show the panel - // automatically, but provide a visible notification in the topmost - // browser window, if the status indicator is already visible. - DownloadsCommon.log("Showing new download notification."); - browserWin.DownloadsIndicatorView.showEventNotification(aType); - return; - } - this.panelHasShownBefore = true; - browserWin.DownloadsPanel.showPanel(); - } -}; - -XPCOMUtils.defineLazyGetter(this, "PrivateDownloadsData", function() { - return new DownloadsDataCtor(true); -}); - -XPCOMUtils.defineLazyGetter(this, "DownloadsData", function() { - return new DownloadsDataCtor(false); -}); - -//////////////////////////////////////////////////////////////////////////////// -//// DownloadsViewPrototype - -/** - * A prototype for an object that registers itself with DownloadsData as soon - * as a view is registered with it. - */ -const DownloadsViewPrototype = { - ////////////////////////////////////////////////////////////////////////////// - //// Registration of views - - /** - * Array of view objects that should be notified when the available status - * data changes. - * - * SUBCLASSES MUST OVERRIDE THIS PROPERTY. - */ - _views: null, - - /** - * Determines whether this view object is over the private or non-private - * downloads. - * - * SUBCLASSES MUST OVERRIDE THIS PROPERTY. - */ - _isPrivate: false, - - /** - * Adds an object to be notified when the available status data changes. - * The specified object is initialized with the currently available status. - * - * @param aView - * View object to be added. This reference must be - * passed to removeView before termination. - */ - addView: function DVP_addView(aView) - { - // Start receiving events when the first of our views is registered. - if (this._views.length == 0) { - if (this._isPrivate) { - PrivateDownloadsData.addView(this); - } else { - DownloadsData.addView(this); - } - } - - this._views.push(aView); - this.refreshView(aView); - }, - - /** - * Updates the properties of an object previously added using addView. - * - * @param aView - * View object to be updated. - */ - refreshView: function DVP_refreshView(aView) - { - // Update immediately even if we are still loading data asynchronously. - // Subclasses must provide these two functions! - this._refreshProperties(); - this._updateView(aView); - }, - - /** - * Removes an object previously added using addView. - * - * @param aView - * View object to be removed. - */ - removeView: function DVP_removeView(aView) - { - let index = this._views.indexOf(aView); - if (index != -1) { - this._views.splice(index, 1); - } - - // Stop receiving events when the last of our views is unregistered. - if (this._views.length == 0) { - if (this._isPrivate) { - PrivateDownloadsData.removeView(this); - } else { - DownloadsData.removeView(this); - } - } - }, - - ////////////////////////////////////////////////////////////////////////////// - //// Callback functions from DownloadsData - - /** - * Indicates whether we are still loading downloads data asynchronously. - */ - _loading: false, - - /** - * Called before multiple downloads are about to be loaded. - */ - onDataLoadStarting: function DVP_onDataLoadStarting() - { - this._loading = true; - }, - - /** - * Called after data loading finished. - */ - onDataLoadCompleted: function DVP_onDataLoadCompleted() - { - this._loading = false; - }, - - /** - * Called when the downloads database becomes unavailable (for example, we - * entered Private Browsing Mode and the database backend changed). - * References to existing data should be discarded. - * - * @note Subclasses should override this. - */ - onDataInvalidated: function DVP_onDataInvalidated() - { - throw Components.results.NS_ERROR_NOT_IMPLEMENTED; - }, - - /** - * Called when a new download data item is available, either during the - * asynchronous data load or when a new download is started. - * - * @param download - * Download object that was just added. - * @param newest - * When true, indicates that this item is the most recent and should be - * added in the topmost position. This happens when a new download is - * started. When false, indicates that the item is the least recent - * with regard to the items that have been already added. The latter - * generally happens during the asynchronous data load. - * - * @note Subclasses should override this. - */ - onDownloadAdded(download, newest) { - throw Components.results.NS_ERROR_NOT_IMPLEMENTED; - }, - - /** - * Called when the overall state of a Download has changed. In particular, - * this is called only once when the download succeeds or is blocked - * permanently, and is never called if only the current progress changed. - * - * The onDownloadChanged notification will always be sent afterwards. - * - * @note Subclasses should override this. - */ - onDownloadStateChanged(download) { - throw Components.results.NS_ERROR_NOT_IMPLEMENTED; - }, - - /** - * Called every time any state property of a Download may have changed, - * including progress properties. - * - * Note that progress notification changes are throttled at the Downloads.jsm - * API level, and there is no throttling mechanism in the front-end. - * - * @note Subclasses should override this. - */ - onDownloadChanged(download) { - throw Components.results.NS_ERROR_NOT_IMPLEMENTED; - }, - - /** - * Called when a data item is removed, ensures that the widget associated with - * the view item is removed from the user interface. - * - * @param download - * Download object that is being removed. - * - * @note Subclasses should override this. - */ - onDownloadRemoved(download) { - throw Components.results.NS_ERROR_NOT_IMPLEMENTED; - }, - - /** - * Private function used to refresh the internal properties being sent to - * each registered view. - * - * @note Subclasses should override this. - */ - _refreshProperties: function DID_refreshProperties() - { - throw Components.results.NS_ERROR_NOT_IMPLEMENTED; - }, - - /** - * Private function used to refresh an individual view. - * - * @note Subclasses should override this. - */ - _updateView: function DID_updateView() - { - throw Components.results.NS_ERROR_NOT_IMPLEMENTED; - } -}; - -//////////////////////////////////////////////////////////////////////////////// -//// DownloadsIndicatorData - -/** - * This object registers itself with DownloadsData as a view, and transforms the - * notifications it receives into overall status data, that is then broadcast to - * the registered download status indicators. - * - * Note that using this object does not automatically start the Download Manager - * service. Consumers will see an empty list of downloads until the service is - * actually started. This is useful to display a neutral progress indicator in - * the main browser window until the autostart timeout elapses. - */ -function DownloadsIndicatorDataCtor(aPrivate) { - this._isPrivate = aPrivate; - this._views = []; -} -DownloadsIndicatorDataCtor.prototype = { - __proto__: DownloadsViewPrototype, - - /** - * Removes an object previously added using addView. - * - * @param aView - * DownloadsIndicatorView object to be removed. - */ - removeView: function DID_removeView(aView) - { - DownloadsViewPrototype.removeView.call(this, aView); - - if (this._views.length == 0) { - this._itemCount = 0; - } - }, - - ////////////////////////////////////////////////////////////////////////////// - //// Callback functions from DownloadsData - - onDataLoadCompleted: function DID_onDataLoadCompleted() - { - DownloadsViewPrototype.onDataLoadCompleted.call(this); - this._updateViews(); - }, - - /** - * Called when the downloads database becomes unavailable (for example, we - * entered Private Browsing Mode and the database backend changed). - * References to existing data should be discarded. - */ - onDataInvalidated: function DID_onDataInvalidated() - { - this._itemCount = 0; - }, - - onDownloadAdded(download, newest) { - this._itemCount++; - this._updateViews(); - }, - - onDownloadStateChanged(download) { - if (download.succeeded || download.error) { - this.attention = true; - } - - // Since the state of a download changed, reset the estimated time left. - this._lastRawTimeLeft = -1; - this._lastTimeLeft = -1; - }, - - onDownloadChanged(download) { - this._updateViews(); - }, - - onDownloadRemoved(download) { - this._itemCount--; - this._updateViews(); - }, - - ////////////////////////////////////////////////////////////////////////////// - //// Propagation of properties to our views - - // The following properties are updated by _refreshProperties and are then - // propagated to the views. See _refreshProperties for details. - _hasDownloads: false, - _counter: "", - _percentComplete: -1, - _paused: false, - - /** - * Indicates whether the download indicators should be highlighted. - */ - set attention(aValue) - { - this._attention = aValue; - this._updateViews(); - return aValue; - }, - _attention: false, - - /** - * Indicates whether the user is interacting with downloads, thus the - * attention indication should not be shown even if requested. - */ - set attentionSuppressed(aValue) - { - this._attentionSuppressed = aValue; - this._attention = false; - this._updateViews(); - return aValue; - }, - _attentionSuppressed: false, - - /** - * Computes aggregate values and propagates the changes to our views. - */ - _updateViews: function DID_updateViews() - { - // Do not update the status indicators during batch loads of download items. - if (this._loading) { - return; - } - - this._refreshProperties(); - this._views.forEach(this._updateView, this); - }, - - /** - * Updates the specified view with the current aggregate values. - * - * @param aView - * DownloadsIndicatorView object to be updated. - */ - _updateView: function DID_updateView(aView) - { - aView.hasDownloads = this._hasDownloads; - aView.counter = this._counter; - aView.percentComplete = this._percentComplete; - aView.paused = this._paused; - aView.attention = this._attention && !this._attentionSuppressed; - }, - - ////////////////////////////////////////////////////////////////////////////// - //// Property updating based on current download status - - /** - * Number of download items that are available to be displayed. - */ - _itemCount: 0, - - /** - * Floating point value indicating the last number of seconds estimated until - * the longest download will finish. We need to store this value so that we - * don't continuously apply smoothing if the actual download state has not - * changed. This is set to -1 if the previous value is unknown. - */ - _lastRawTimeLeft: -1, - - /** - * Last number of seconds estimated until all in-progress downloads with a - * known size and speed will finish. This value is stored to allow smoothing - * in case of small variations. This is set to -1 if the previous value is - * unknown. - */ - _lastTimeLeft: -1, - - /** - * A generator function for the Download objects this summary is currently - * interested in. This generator is passed off to summarizeDownloads in order - * to generate statistics about the downloads we care about - in this case, - * it's all active downloads. - */ - * _activeDownloads() { - let downloads = this._isPrivate ? PrivateDownloadsData.downloads - : DownloadsData.downloads; - for (let download of downloads) { - if (!download.stopped || (download.canceled && download.hasPartialData)) { - yield download; - } - } - }, - - /** - * Computes aggregate values based on the current state of downloads. - */ - _refreshProperties: function DID_refreshProperties() - { - let summary = - DownloadsCommon.summarizeDownloads(this._activeDownloads()); - - // Determine if the indicator should be shown or get attention. - this._hasDownloads = (this._itemCount > 0); - - // If all downloads are paused, show the progress indicator as paused. - this._paused = summary.numActive > 0 && - summary.numActive == summary.numPaused; - - this._percentComplete = summary.percentComplete; - - // Display the estimated time left, if present. - if (summary.rawTimeLeft == -1) { - // There are no downloads with a known time left. - this._lastRawTimeLeft = -1; - this._lastTimeLeft = -1; - this._counter = ""; - } else { - // Compute the new time left only if state actually changed. - if (this._lastRawTimeLeft != summary.rawTimeLeft) { - this._lastRawTimeLeft = summary.rawTimeLeft; - this._lastTimeLeft = DownloadsCommon.smoothSeconds(summary.rawTimeLeft, - this._lastTimeLeft); - } - this._counter = DownloadsCommon.formatTimeLeft(this._lastTimeLeft); - } - } -}; - -XPCOMUtils.defineLazyGetter(this, "PrivateDownloadsIndicatorData", function() { - return new DownloadsIndicatorDataCtor(true); -}); - -XPCOMUtils.defineLazyGetter(this, "DownloadsIndicatorData", function() { - return new DownloadsIndicatorDataCtor(false); -}); - -//////////////////////////////////////////////////////////////////////////////// -//// DownloadsSummaryData - -/** - * DownloadsSummaryData is a view for DownloadsData that produces a summary - * of all downloads after a certain exclusion point aNumToExclude. For example, - * if there were 5 downloads in progress, and a DownloadsSummaryData was - * constructed with aNumToExclude equal to 3, then that DownloadsSummaryData - * would produce a summary of the last 2 downloads. - * - * @param aIsPrivate - * True if the browser window which owns the download button is a private - * window. - * @param aNumToExclude - * The number of items to exclude from the summary, starting from the - * top of the list. - */ -function DownloadsSummaryData(aIsPrivate, aNumToExclude) { - this._numToExclude = aNumToExclude; - // Since we can have multiple instances of DownloadsSummaryData, we - // override these values from the prototype so that each instance can be - // completely separated from one another. - this._loading = false; - - this._downloads = []; - - // Floating point value indicating the last number of seconds estimated until - // the longest download will finish. We need to store this value so that we - // don't continuously apply smoothing if the actual download state has not - // changed. This is set to -1 if the previous value is unknown. - this._lastRawTimeLeft = -1; - - // Last number of seconds estimated until all in-progress downloads with a - // known size and speed will finish. This value is stored to allow smoothing - // in case of small variations. This is set to -1 if the previous value is - // unknown. - this._lastTimeLeft = -1; - - // The following properties are updated by _refreshProperties and are then - // propagated to the views. - this._showingProgress = false; - this._details = ""; - this._description = ""; - this._numActive = 0; - this._percentComplete = -1; - - this._isPrivate = aIsPrivate; - this._views = []; -} - -DownloadsSummaryData.prototype = { - __proto__: DownloadsViewPrototype, - - /** - * Removes an object previously added using addView. - * - * @param aView - * DownloadsSummary view to be removed. - */ - removeView: function DSD_removeView(aView) - { - DownloadsViewPrototype.removeView.call(this, aView); - - if (this._views.length == 0) { - // Clear out our collection of Download objects. If we ever have - // another view registered with us, this will get re-populated. - this._downloads = []; - } - }, - - ////////////////////////////////////////////////////////////////////////////// - //// Callback functions from DownloadsData - see the documentation in - //// DownloadsViewPrototype for more information on what these functions - //// are used for. - - onDataLoadCompleted: function DSD_onDataLoadCompleted() - { - DownloadsViewPrototype.onDataLoadCompleted.call(this); - this._updateViews(); - }, - - onDataInvalidated: function DSD_onDataInvalidated() - { - this._dataItems = []; - }, - - onDownloadAdded(download, newest) { - if (newest) { - this._downloads.unshift(download); - } else { - this._downloads.push(download); - } - - this._updateViews(); - }, - - onDownloadStateChanged() { - // Since the state of a download changed, reset the estimated time left. - this._lastRawTimeLeft = -1; - this._lastTimeLeft = -1; - }, - - onDownloadChanged() { - this._updateViews(); - }, - - onDownloadRemoved(download) { - let itemIndex = this._downloads.indexOf(download); - this._downloads.splice(itemIndex, 1); - this._updateViews(); - }, - - ////////////////////////////////////////////////////////////////////////////// - //// Propagation of properties to our views - - /** - * Computes aggregate values and propagates the changes to our views. - */ - _updateViews: function DSD_updateViews() - { - // Do not update the status indicators during batch loads of download items. - if (this._loading) { - return; - } - - this._refreshProperties(); - this._views.forEach(this._updateView, this); - }, - - /** - * Updates the specified view with the current aggregate values. - * - * @param aView - * DownloadsIndicatorView object to be updated. - */ - _updateView: function DSD_updateView(aView) - { - aView.showingProgress = this._showingProgress; - aView.percentComplete = this._percentComplete; - aView.description = this._description; - aView.details = this._details; - }, - - ////////////////////////////////////////////////////////////////////////////// - //// Property updating based on current download status - - /** - * A generator function for the Download objects this summary is currently - * interested in. This generator is passed off to summarizeDownloads in order - * to generate statistics about the downloads we care about - in this case, - * it's the downloads in this._downloads after the first few to exclude, - * which was set when constructing this DownloadsSummaryData instance. - */ - * _downloadsForSummary() { - if (this._downloads.length > 0) { - for (let i = this._numToExclude; i < this._downloads.length; ++i) { - yield this._downloads[i]; - } - } - }, - - /** - * Computes aggregate values based on the current state of downloads. - */ - _refreshProperties: function DSD_refreshProperties() - { - // Pre-load summary with default values. - let summary = - DownloadsCommon.summarizeDownloads(this._downloadsForSummary()); - - this._description = DownloadsCommon.strings - .otherDownloads2(summary.numActive); - this._percentComplete = summary.percentComplete; - - // If all downloads are paused, show the progress indicator as paused. - this._showingProgress = summary.numDownloading > 0 || - summary.numPaused > 0; - - // Display the estimated time left, if present. - if (summary.rawTimeLeft == -1) { - // There are no downloads with a known time left. - this._lastRawTimeLeft = -1; - this._lastTimeLeft = -1; - this._details = ""; - } else { - // Compute the new time left only if state actually changed. - if (this._lastRawTimeLeft != summary.rawTimeLeft) { - this._lastRawTimeLeft = summary.rawTimeLeft; - this._lastTimeLeft = DownloadsCommon.smoothSeconds(summary.rawTimeLeft, - this._lastTimeLeft); - } - [this._details] = DownloadUtils.getDownloadStatusNoRate( - summary.totalTransferred, summary.totalSize, summary.slowestSpeed, - this._lastTimeLeft); - } - } -} diff --git a/components/downloads/DownloadsLogger.jsm b/components/downloads/DownloadsLogger.jsm deleted file mode 100644 index 1218539..0000000 --- a/components/downloads/DownloadsLogger.jsm +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: js2; js2-basic-offset: 2; indent-tabs-mode: nil; -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* 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/. */ - -/** - * The contents of this file were copied almost entirely from - * toolkit/identity/LogUtils.jsm. Until we've got a more generalized logging - * mechanism for toolkit, I think this is going to be how we roll. - */ - -"use strict"; - -this.EXPORTED_SYMBOLS = ["DownloadsLogger"]; -const PREF_DEBUG = "browser.download.debug"; - -const Cu = Components.utils; -const Ci = Components.interfaces; -const Cc = Components.classes; -const Cr = Components.results; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/Services.jsm"); - -this.DownloadsLogger = { - _generateLogMessage: function _generateLogMessage(args) { - // create a string representation of a list of arbitrary things - let strings = []; - - for (let arg of args) { - if (typeof arg === 'string') { - strings.push(arg); - } else if (arg === undefined) { - strings.push('undefined'); - } else if (arg === null) { - strings.push('null'); - } else { - try { - strings.push(JSON.stringify(arg, null, 2)); - } catch(err) { - strings.push("<>"); - } - } - }; - return 'Downloads: ' + strings.join(' '); - }, - - /** - * log() - utility function to print a list of arbitrary things - * - * Enable with about:config pref browser.download.debug - */ - log: function DL_log(...args) { - let output = this._generateLogMessage(args); - dump(output + "\n"); - - // Additionally, make the output visible in the Error Console - Services.console.logStringMessage(output); - }, - - /** - * reportError() - report an error through component utils as well as - * our log function - */ - reportError: function DL_reportError(...aArgs) { - // Report the error in the browser - let output = this._generateLogMessage(aArgs); - Cu.reportError(output); - dump("ERROR:" + output + "\n"); - for (let frame = Components.stack.caller; frame; frame = frame.caller) { - dump("\t" + frame + "\n"); - } - } - -}; diff --git a/components/downloads/DownloadsStartup.js b/components/downloads/DownloadsStartup.js deleted file mode 100644 index e1dd207..0000000 --- a/components/downloads/DownloadsStartup.js +++ /dev/null @@ -1,278 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ -/* 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/. */ - -/** - * This component listens to notifications for startup, shutdown and session - * restore, controlling which downloads should be loaded from the database. - * - * To avoid affecting startup performance, this component monitors the current - * session restore state, but defers the actual downloads data manipulation - * until the Download Manager service is loaded. - */ - -"use strict"; - -//////////////////////////////////////////////////////////////////////////////// -//// Globals - -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cu = Components.utils; -const Cr = Components.results; - -Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "DownloadsCommon", - "resource:///modules/DownloadsCommon.jsm"); -XPCOMUtils.defineLazyServiceGetter(this, "gSessionStartup", - "@mozilla.org/browser/sessionstartup;1", - "nsISessionStartup"); - -const kObservedTopics = [ - "sessionstore-windows-restored", - "sessionstore-browser-state-restored", - "download-manager-initialized", - "download-manager-change-retention", - "last-pb-context-exited", - "browser-lastwindow-close-granted", - "quit-application", - "profile-change-teardown", -]; - -/** - * CID of our implementation of nsIDownloadManagerUI. - */ -const kDownloadsUICid = Components.ID("{4d99321e-d156-455b-81f7-e7aa2308134f}"); - -/** - * Contract ID of the service implementing nsIDownloadManagerUI. - */ -const kDownloadsUIContractId = "@mozilla.org/download-manager-ui;1"; - -/** - * CID of the JavaScript implementation of nsITransfer. - */ -const kTransferCid = Components.ID("{1b4c85df-cbdd-4bb6-b04e-613caece083c}"); - -/** - * Contract ID of the service implementing nsITransfer. - */ -const kTransferContractId = "@mozilla.org/transfer;1"; - -//////////////////////////////////////////////////////////////////////////////// -//// DownloadsStartup - -function DownloadsStartup() { } - -DownloadsStartup.prototype = { - classID: Components.ID("{49507fe5-2cee-4824-b6a3-e999150ce9b8}"), - - _xpcom_factory: XPCOMUtils.generateSingletonFactory(DownloadsStartup), - - ////////////////////////////////////////////////////////////////////////////// - //// nsISupports - - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference]), - - ////////////////////////////////////////////////////////////////////////////// - //// nsIObserver - - observe: function DS_observe(aSubject, aTopic, aData) - { - switch (aTopic) { - case "profile-after-change": - // Override Toolkit's nsIDownloadManagerUI implementation with our own. - // This must be done at application startup and not in the manifest to - // ensure that our implementation overrides the original one. - Components.manager.QueryInterface(Ci.nsIComponentRegistrar) - .registerFactory(kDownloadsUICid, "", - kDownloadsUIContractId, null); - - Components.manager.QueryInterface(Ci.nsIComponentRegistrar) - .registerFactory(kTransferCid, "", - kTransferContractId, null); - break; - - case "sessionstore-windows-restored": - case "sessionstore-browser-state-restored": - // Unless there is no saved session, there is a chance that we are - // starting up after a restart or a crash. We should check the disk - // database to see if there are completed downloads to recover and show - // in the panel, in addition to in-progress downloads. - if (gSessionStartup.sessionType != Ci.nsISessionStartup.NO_SESSION) { - this._restoringSession = true; - } - this._ensureDataLoaded(); - break; - - case "download-manager-initialized": - // Don't initialize the JavaScript data and user interface layer if we - // are initializing the Download Manager service during shutdown. - if (this._shuttingDown) { - break; - } - - // Start receiving events for active and new downloads before we return - // from this observer function. We can't defer the execution of this - // step, to ensure that we don't lose events raised in the meantime. - DownloadsCommon.initializeAllDataLinks( - aSubject.QueryInterface(Ci.nsIDownloadManager)); - - this._downloadsServiceInitialized = true; - - // Since this notification is generated during the getService call and - // we need to get the Download Manager service ourselves, we must post - // the handler on the event queue to be executed later. - Services.tm.mainThread.dispatch(this._ensureDataLoaded.bind(this), - Ci.nsIThread.DISPATCH_NORMAL); - break; - - case "download-manager-change-retention": - // If we're using the Downloads Panel, we override the retention - // preference to always retain downloads on completion. - if (!DownloadsCommon.useToolkitUI) { - aSubject.QueryInterface(Ci.nsISupportsPRInt32).data = 2; - } - break; - - case "browser-lastwindow-close-granted": - // When using the panel interface, downloads that are already completed - // should be removed when the last full browser window is closed. This - // event is invoked only if the application is not shutting down yet. - // If the Download Manager service is not initialized, we don't want to - // initialize it just to clean up completed downloads, because they can - // be present only in case there was a browser crash or restart. - if (this._downloadsServiceInitialized && - !DownloadsCommon.useToolkitUI) { - Services.downloads.cleanUp(); - } - break; - - case "last-pb-context-exited": - // Similar to the above notification, but for private downloads. - if (this._downloadsServiceInitialized && - !DownloadsCommon.useToolkitUI) { - Services.downloads.cleanUpPrivate(); - } - break; - - case "quit-application": - // When the application is shutting down, we must free all resources in - // addition to cleaning up completed downloads. If the Download Manager - // service is not initialized, we don't want to initialize it just to - // clean up completed downloads, because they can be present only in - // case there was a browser crash or restart. - this._shuttingDown = true; - if (!this._downloadsServiceInitialized) { - break; - } - - DownloadsCommon.terminateAllDataLinks(); - - // When using the panel interface, downloads that are already completed - // should be removed when quitting the application. - if (!DownloadsCommon.useToolkitUI && aData != "restart") { - this._cleanupOnShutdown = true; - } - break; - - case "profile-change-teardown": - // If we need to clean up, we must do it synchronously after all the - // "quit-application" listeners are invoked, so that the Download - // Manager service has a chance to pause or cancel in-progress downloads - // before we remove completed downloads from the list. Note that, since - // "quit-application" was invoked, we've already exited Private Browsing - // Mode, thus we are always working on the disk database. - if (this._cleanupOnShutdown) { - Services.downloads.cleanUp(); - } - - if (!DownloadsCommon.useToolkitUI) { - // If we got this far, that means that we finished our first session - // with the Downloads Panel without crashing. This means that we don't - // have to force displaying only active downloads on the next startup - // now. - this._firstSessionCompleted = true; - } - break; - } - }, - - ////////////////////////////////////////////////////////////////////////////// - //// Private - - /** - * Indicates whether we're restoring a previous session. This is used by - * _recoverAllDownloads to determine whether or not we should load and - * display all downloads data, or restrict it to only the active downloads. - */ - _restoringSession: false, - - /** - * Indicates whether the Download Manager service has been initialized. This - * flag is required because we want to avoid accessing the service immediately - * at browser startup. The service will start when the user first requests a - * download, or some time after browser startup. - */ - _downloadsServiceInitialized: false, - - /** - * True while we are processing the "quit-application" event, and later. - */ - _shuttingDown: false, - - /** - * True during shutdown if we need to remove completed downloads. - */ - _cleanupOnShutdown: false, - - /** - * True if we should display all downloads, as opposed to just active - * downloads. We decide to display all downloads if we're restoring a session, - * or if we're using the Downloads Panel anytime after the first session with - * it has completed. - */ - get _recoverAllDownloads() { - return this._restoringSession || - (!DownloadsCommon.useToolkitUI && this._firstSessionCompleted); - }, - - /** - * True if we've ever completed a session with the Downloads Panel enabled. - */ - get _firstSessionCompleted() { - return Services.prefs - .getBoolPref("browser.download.panel.firstSessionCompleted"); - }, - - set _firstSessionCompleted(aValue) { - Services.prefs.setBoolPref("browser.download.panel.firstSessionCompleted", - aValue); - return aValue; - }, - - /** - * Ensures that persistent download data is reloaded at the appropriate time. - */ - _ensureDataLoaded: function DS_ensureDataLoaded() - { - if (!this._downloadsServiceInitialized) { - return; - } - - // If the previous session has been already restored, then we ensure that - // all the downloads are loaded. Otherwise, we only ensure that the active - // downloads from the previous session are loaded. - DownloadsCommon.ensureAllPersistentDataLoaded(!this._recoverAllDownloads); - } -}; - -//////////////////////////////////////////////////////////////////////////////// -//// Module - -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DownloadsStartup]); diff --git a/components/downloads/DownloadsTaskbar.jsm b/components/downloads/DownloadsTaskbar.jsm deleted file mode 100644 index cf915ab..0000000 --- a/components/downloads/DownloadsTaskbar.jsm +++ /dev/null @@ -1,177 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80 filetype=javascript: */ -/* 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/. */ - -/** - * Handles the download progress indicator in the taskbar. - */ - -"use strict"; - -this.EXPORTED_SYMBOLS = [ - "DownloadsTaskbar", -]; - -//////////////////////////////////////////////////////////////////////////////// -//// Globals - -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cu = Components.utils; -const Cr = Components.results; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "Downloads", - "resource://gre/modules/Downloads.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow", - "resource:///modules/RecentWindow.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Services", - "resource://gre/modules/Services.jsm"); - -XPCOMUtils.defineLazyGetter(this, "gWinTaskbar", function () { - if (!("@mozilla.org/windows-taskbar;1" in Cc)) { - return null; - } - let winTaskbar = Cc["@mozilla.org/windows-taskbar;1"] - .getService(Ci.nsIWinTaskbar); - return winTaskbar.available && winTaskbar; -}); - -XPCOMUtils.defineLazyGetter(this, "gMacTaskbarProgress", function () { - return ("@mozilla.org/widget/macdocksupport;1" in Cc) && - Cc["@mozilla.org/widget/macdocksupport;1"] - .getService(Ci.nsITaskbarProgress); -}); - -//////////////////////////////////////////////////////////////////////////////// -//// DownloadsTaskbar - -/** - * Handles the download progress indicator in the taskbar. - */ -this.DownloadsTaskbar = { - /** - * Underlying DownloadSummary providing the aggregate download information, or - * null if the indicator has never been initialized. - */ - _summary: null, - - /** - * nsITaskbarProgress object to which download information is dispatched. - * This can be null if the indicator has never been initialized or if the - * indicator is currently hidden on Windows. - */ - _taskbarProgress: null, - - /** - * This method is called after a new browser window is opened, and ensures - * that the download progress indicator is displayed in the taskbar. - * - * On Windows, the indicator is attached to the first browser window that - * calls this method. When the window is closed, the indicator is moved to - * another browser window, if available, in no particular order. When there - * are no browser windows visible, the indicator is hidden. - * - * On Mac OS X, the indicator is initialized globally when this method is - * called for the first time. Subsequent calls have no effect. - * - * @param aBrowserWindow - * nsIDOMWindow object of the newly opened browser window to which the - * indicator may be attached. - */ - registerIndicator(aBrowserWindow) { - if (!this._taskbarProgress) { - if (gMacTaskbarProgress) { - // On Mac OS X, we have to register the global indicator only once. - this._taskbarProgress = gMacTaskbarProgress; - // Free the XPCOM reference on shutdown, to prevent detecting a leak. - Services.obs.addObserver(() => { - this._taskbarProgress = null; - gMacTaskbarProgress = null; - }, "quit-application-granted", false); - } else if (gWinTaskbar) { - // On Windows, the indicator is currently hidden because we have no - // previous browser window, thus we should attach the indicator now. - this._attachIndicator(aBrowserWindow); - } else { - // The taskbar indicator is not available on this platform. - return; - } - } - - // Ensure that the DownloadSummary object will be created asynchronously. - if (!this._summary) { - Downloads.getSummary(Downloads.ALL).then(summary => { - // In case the method is re-entered, we simply ignore redundant - // invocations of the callback, instead of keeping separate state. - if (this._summary) { - return; - } - this._summary = summary; - return this._summary.addView(this); - }).then(null, Cu.reportError); - } - }, - - /** - * On Windows, attaches the taskbar indicator to the specified browser window. - */ - _attachIndicator(aWindow) { - // Activate the indicator on the specified window. - let docShell = aWindow.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIWebNavigation) - .QueryInterface(Ci.nsIDocShellTreeItem).treeOwner - .QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIXULWindow).docShell; - this._taskbarProgress = gWinTaskbar.getTaskbarProgress(docShell); - - // If the DownloadSummary object has already been created, we should update - // the state of the new indicator, otherwise it will be updated as soon as - // the DownloadSummary view is registered. - if (this._summary) { - this.onSummaryChanged(); - } - - aWindow.addEventListener("unload", () => { - // Locate another browser window, excluding the one being closed. - let browserWindow = RecentWindow.getMostRecentBrowserWindow(); - if (browserWindow) { - // Move the progress indicator to the other browser window. - this._attachIndicator(browserWindow); - } else { - // The last browser window has been closed. We remove the reference to - // the taskbar progress object so that the indicator will be registered - // again on the next browser window that is opened. - this._taskbarProgress = null; - } - }, false); - }, - - ////////////////////////////////////////////////////////////////////////////// - //// DownloadSummary view - - onSummaryChanged() { - // If the last browser window has been closed, we have no indicator any more. - if (!this._taskbarProgress) { - return; - } - - if (this._summary.allHaveStopped || this._summary.progressTotalBytes == 0) { - this._taskbarProgress.setProgressState( - Ci.nsITaskbarProgress.STATE_NO_PROGRESS, 0, 0); - } else { - // For a brief moment before completion, some download components may - // report more transferred bytes than the total number of bytes. Thus, - // ensure that we never break the expectations of the progress indicator. - let progressCurrentBytes = Math.min(this._summary.progressTotalBytes, - this._summary.progressCurrentBytes); - this._taskbarProgress.setProgressState( - Ci.nsITaskbarProgress.STATE_NORMAL, - progressCurrentBytes, - this._summary.progressTotalBytes); - } - }, -}; diff --git a/components/downloads/DownloadsUI.js b/components/downloads/DownloadsUI.js deleted file mode 100644 index afdbda8..0000000 --- a/components/downloads/DownloadsUI.js +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ -/* 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/. */ - -/** - * This component implements the nsIDownloadManagerUI interface and opens the - * downloads panel in the most recent browser window when requested. - * - * If a specific preference is set, this component transparently forwards all - * calls to the original implementation in Toolkit, that shows the window UI. - */ - -"use strict"; - -//////////////////////////////////////////////////////////////////////////////// -//// Globals - -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cu = Components.utils; -const Cr = Components.results; - -Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "DownloadsCommon", - "resource:///modules/DownloadsCommon.jsm"); -XPCOMUtils.defineLazyServiceGetter(this, "gBrowserGlue", - "@mozilla.org/browser/browserglue;1", - "nsIBrowserGlue"); -XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow", - "resource:///modules/RecentWindow.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", - "resource://gre/modules/PrivateBrowsingUtils.jsm"); - -//////////////////////////////////////////////////////////////////////////////// -//// DownloadsUI - -function DownloadsUI() -{ - XPCOMUtils.defineLazyGetter(this, "_toolkitUI", function () { - // Create Toolkit's nsIDownloadManagerUI implementation. - return Components.classesByID["{7dfdf0d1-aff6-4a34-bad1-d0fe74601642}"] - .getService(Ci.nsIDownloadManagerUI); - }); -} - -DownloadsUI.prototype = { - classID: Components.ID("{4d99321e-d156-455b-81f7-e7aa2308134f}"), - - _xpcom_factory: XPCOMUtils.generateSingletonFactory(DownloadsUI), - - ////////////////////////////////////////////////////////////////////////////// - //// nsISupports - - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDownloadManagerUI]), - - ////////////////////////////////////////////////////////////////////////////// - //// nsIDownloadManagerUI - - show: function DUI_show(aWindowContext, aDownload, aReason, aUsePrivateUI) - { - if (DownloadsCommon.useToolkitUI && !PrivateBrowsingUtils.isWindowPrivate(aWindowContext)) { - this._toolkitUI.show(aWindowContext, aDownload, aReason, aUsePrivateUI); - return; - } - - if (!aReason) { - aReason = Ci.nsIDownloadManagerUI.REASON_USER_INTERACTED; - } - - if (aReason == Ci.nsIDownloadManagerUI.REASON_NEW_DOWNLOAD) { - const kMinimized = Ci.nsIDOMChromeWindow.STATE_MINIMIZED; - let browserWin = gBrowserGlue.getMostRecentBrowserWindow(); - - if (!browserWin || browserWin.windowState == kMinimized) { - this._showDownloadManagerUI(aWindowContext, aUsePrivateUI); - } - else { - // If the indicator is visible, then new download notifications are - // already handled by the panel service. - browserWin.DownloadsButton.checkIsVisible(function(isVisible) { - if (!isVisible) { - this._showDownloadManagerUI(aWindowContext, aUsePrivateUI); - } - }.bind(this)); - } - } else { - this._showDownloadManagerUI(aWindowContext, aUsePrivateUI); - } - }, - - get visible() - { - // If we're still using the toolkit downloads manager, delegate the call - // to it. Otherwise, return true for now, until we decide on how we want - // to indicate that a new download has started if a browser window is - // not available or minimized. - return DownloadsCommon.useToolkitUI ? this._toolkitUI.visible : true; - }, - - getAttention: function DUI_getAttention() - { - if (DownloadsCommon.useToolkitUI) { - this._toolkitUI.getAttention(); - } - }, - - /** - * Helper function that opens the download manager UI. - */ - _showDownloadManagerUI: - function DUI_showDownloadManagerUI(aWindowContext, aUsePrivateUI) - { - // If we weren't given a window context, try to find a browser window - // to use as our parent - and if that doesn't work, error out and give up. - let parentWindow = aWindowContext; - if (!parentWindow) { - parentWindow = RecentWindow.getMostRecentBrowserWindow({ private: !!aUsePrivateUI }); - if (!parentWindow) { - Components.utils.reportError( - "Couldn't find a browser window to open the Places Downloads View " + - "from."); - return; - } - } - - // If window is private then show it in a tab. - if (PrivateBrowsingUtils.isWindowPrivate(parentWindow)) { - parentWindow.openUILinkIn("about:downloads", "tab"); - return; - } else { - let organizer = Services.wm.getMostRecentWindow("Places:Organizer"); - if (!organizer) { - parentWindow.openDialog("chrome://browser/content/places/places.xul", - "", "chrome,toolbar=yes,dialog=no,resizable", - "Downloads"); - } else { - organizer.PlacesOrganizer.selectLeftPaneQuery("Downloads"); - organizer.focus(); - } - } - } -}; - -//////////////////////////////////////////////////////////////////////////////// -//// Module - -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DownloadsUI]); diff --git a/components/downloads/DownloadsViewUI.jsm b/components/downloads/DownloadsViewUI.jsm deleted file mode 100644 index ede593e..0000000 --- a/components/downloads/DownloadsViewUI.jsm +++ /dev/null @@ -1,250 +0,0 @@ -/* 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/. */ - -/* - * This module is imported by code that uses the "download.xml" binding, and - * provides prototypes for objects that handle input and display information. - */ - -"use strict"; - -this.EXPORTED_SYMBOLS = [ - "DownloadsViewUI", -]; - -const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "DownloadUtils", - "resource://gre/modules/DownloadUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "DownloadsCommon", - "resource:///modules/DownloadsCommon.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "OS", - "resource://gre/modules/osfile.jsm"); - -this.DownloadsViewUI = {}; - -/** - * A download element shell is responsible for handling the commands and the - * displayed data for a single element that uses the "download.xml" binding. - * - * The information to display is obtained through the associated Download object - * from the JavaScript API for downloads, and commands are executed using a - * combination of Download methods and DownloadsCommon.jsm helper functions. - * - * Specialized versions of this shell must be defined, and they are required to - * implement the "download" property or getter. Currently these objects are the - * HistoryDownloadElementShell and the DownloadsViewItem for the panel. The - * history view may use a HistoryDownload object in place of a Download object. - */ -this.DownloadsViewUI.DownloadElementShell = function () {} - -this.DownloadsViewUI.DownloadElementShell.prototype = { - /** - * The richlistitem for the download, initialized by the derived object. - */ - element: null, - - /** - * URI string for the file type icon displayed in the download element. - */ - get image() { - if (!this.download.target.path) { - // Old history downloads may not have a target path. - return "moz-icon://.unknown?size=32"; - } - - // When a download that was previously in progress finishes successfully, it - // means that the target file now exists and we can extract its specific - // icon, for example from a Windows executable. To ensure that the icon is - // reloaded, however, we must change the URI used by the XUL image element, - // for example by adding a query parameter. This only works if we add one of - // the parameters explicitly supported by the nsIMozIconURI interface. - return "moz-icon://" + this.download.target.path + "?size=32" + - (this.download.succeeded ? "&state=normal" : ""); - }, - - /** - * The user-facing label for the download. This is normally the leaf name of - * the download target file. In case this is a very old history download for - * which the target file is unknown, the download source URI is displayed. - */ - get displayName() { - if (!this.download.target.path) { - return this.download.source.url; - } - return OS.Path.basename(this.download.target.path); - }, - - get extendedDisplayName() { - let s = DownloadsCommon.strings; - let referrer = this.download.source.referrer || - this.download.source.url; - let [displayHost, fullHost] = DownloadUtils.getURIHost(referrer); - return s.statusSeparator(this.displayName, displayHost); - }, - - get extendedDisplayNameTip() { - let s = DownloadsCommon.strings; - let referrer = this.download.source.referrer || - this.download.source.url; - let [displayHost, fullHost] = DownloadUtils.getURIHost(referrer); - return s.statusSeparator(this.displayName, fullHost); - }, - - /** - * The progress element for the download, or undefined in case the XBL binding - * has not been applied yet. - */ - get _progressElement() { - if (!this.__progressElement) { - // If the element is not available now, we will try again the next time. - this.__progressElement = - this.element.ownerDocument.getAnonymousElementByAttribute( - this.element, "anonid", - "progressmeter"); - } - return this.__progressElement; - }, - - /** - * Processes a major state change in the user interface, then proceeds with - * the normal progress update. This function is not called for every progress - * update in order to improve performance. - */ - _updateState() { - this.element.setAttribute("displayName", this.displayName); - this.element.setAttribute("extendedDisplayName", this.extendedDisplayName); - this.element.setAttribute("extendedDisplayNameTip", this.extendedDisplayNameTip); - this.element.setAttribute("image", this.image); - this.element.setAttribute("state", - DownloadsCommon.stateOfDownload(this.download)); - - // Since state changed, reset the time left estimation. - this.lastEstimatedSecondsLeft = Infinity; - - this._updateProgress(); - }, - - /** - * Updates the elements that change regularly for in-progress downloads, - * namely the progress bar and the status line. - */ - _updateProgress() { - if (this.download.succeeded) { - // We only need to add or remove this attribute for succeeded downloads. - if (this.download.target.exists) { - this.element.setAttribute("exists", "true"); - } else { - this.element.removeAttribute("exists"); - } - } - - // The progress bar is only displayed for in-progress downloads. - if (this.download.hasProgress) { - this.element.setAttribute("progressmode", "normal"); - this.element.setAttribute("progress", this.download.progress); - } else { - this.element.setAttribute("progressmode", "undetermined"); - } - - // Dispatch the ValueChange event for accessibility, if possible. - if (this._progressElement) { - let event = this.element.ownerDocument.createEvent("Events"); - event.initEvent("ValueChange", true, true); - this._progressElement.dispatchEvent(event); - } - - let status = this.statusTextAndTip; - this.element.setAttribute("status", status.text); - this.element.setAttribute("statusTip", status.tip); - }, - - lastEstimatedSecondsLeft: Infinity, - - /** - * Returns the text for the status line and the associated tooltip. These are - * returned by a single property because they are computed together. The - * result may be overridden by derived objects. - */ - get statusTextAndTip() this.rawStatusTextAndTip, - - /** - * Derived objects may call this to get the status text. - */ - get rawStatusTextAndTip() { - const nsIDM = Ci.nsIDownloadManager; - let s = DownloadsCommon.strings; - - let text = ""; - let tip = ""; - - if (!this.download.stopped) { - let totalBytes = this.download.hasProgress ? this.download.totalBytes - : -1; - // By default, extended status information including the individual - // download rate is displayed in the tooltip. The history view overrides - // the getter and displays the datails in the main area instead. - [text] = DownloadUtils.getDownloadStatusNoRate( - this.download.currentBytes, - totalBytes, - this.download.speed, - this.lastEstimatedSecondsLeft); - let newEstimatedSecondsLeft; - [tip, newEstimatedSecondsLeft] = DownloadUtils.getDownloadStatus( - this.download.currentBytes, - totalBytes, - this.download.speed, - this.lastEstimatedSecondsLeft); - this.lastEstimatedSecondsLeft = newEstimatedSecondsLeft; - } else if (this.download.canceled && this.download.hasPartialData) { - let totalBytes = this.download.hasProgress ? this.download.totalBytes - : -1; - let transfer = DownloadUtils.getTransferTotal(this.download.currentBytes, - totalBytes); - - // We use the same XUL label to display both the state and the amount - // transferred, for example "Paused - 1.1 MB". - text = s.statusSeparatorBeforeNumber(s.statePaused, transfer); - } else if (!this.download.succeeded && !this.download.canceled && - !this.download.error) { - text = s.stateStarting; - } else { - let stateLabel; - - if (this.download.succeeded) { - // For completed downloads, show the file size (e.g. "1.5 MB"). - if (this.download.target.size !== undefined) { - let [size, unit] = - DownloadUtils.convertByteUnits(this.download.target.size); - stateLabel = s.sizeWithUnits(size, unit); - } else { - // History downloads may not have a size defined. - stateLabel = s.sizeUnknown; - } - } else if (this.download.canceled) { - stateLabel = s.stateCanceled; - } else if (this.download.error.becauseBlockedByParentalControls) { - stateLabel = s.stateBlockedParentalControls; - } else if (this.download.error.becauseBlockedByReputationCheck) { - stateLabel = s.stateDirty; - } else { - stateLabel = s.stateFailed; - } - - let referrer = this.download.source.referrer || this.download.source.url; - let [displayHost, fullHost] = DownloadUtils.getURIHost(referrer); - - let date = new Date(this.download.endTime); - let [displayDate, fullDate] = DownloadUtils.getReadableDates(date); - - let firstPart = s.statusSeparator(stateLabel, displayHost); - text = s.statusSeparator(firstPart, displayDate); - tip = s.statusSeparator(fullHost, fullDate); - } - - return { text, tip: tip || text }; - }, -}; diff --git a/components/downloads/content/allDownloadsViewOverlay.css b/components/downloads/content/allDownloadsViewOverlay.css deleted file mode 100644 index c062ae4..0000000 --- a/components/downloads/content/allDownloadsViewOverlay.css +++ /dev/null @@ -1,56 +0,0 @@ -/* 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/. */ - -/** - * The downloads richlistbox may list thousands of items, and it turns out - * XBL binding attachment, and even more so detachment, is a performance hog. - * This hack makes sure we don't apply any binding to inactive items (inactive - * items are history downloads that haven't been in the visible area). - * We can do this because the richlistbox implementation does not interact - * much with the richlistitem binding. However, this may turn out to have - * some side effects (see bug 828111 for the details). - * - * We might be able to do away with this workaround once bug 653881 is fixed. - */ -richlistitem.download { - -moz-binding: none; -} - -richlistitem.download[active] { - -moz-binding: url('chrome://browser/content/downloads/download.xml#download-full-ui'); -} - -richlistitem.download[active]:-moz-any([state="-1"],/* Starting (initial) */ - [state="0"], /* Downloading */ - [state="4"], /* Paused */ - [state="5"], /* Starting (queued) */ - [state="7"]) /* Scanning */ -{ - -moz-binding: url('chrome://browser/content/downloads/download.xml#download-in-progress-full-ui'); -} - -.download-state:not( [state="0"] /* Downloading */) - .downloadPauseMenuItem, -.download-state:not( [state="4"] /* Paused */) - .downloadResumeMenuItem, -.download-state:not(:-moz-any([state="2"], /* Failed */ - [state="4"]) /* Paused */) - .downloadCancelMenuItem, -.download-state[state]:not(:-moz-any([state="1"], /* Finished */ - [state="2"], /* Failed */ - [state="3"], /* Canceled */ - [state="6"], /* Blocked (parental) */ - [state="8"], /* Blocked (dirty) */ - [state="9"]) /* Blocked (policy) */) - .downloadRemoveFromHistoryMenuItem, -.download-state:not(:-moz-any([state="-1"],/* Starting (initial) */ - [state="0"], /* Downloading */ - [state="1"], /* Finished */ - [state="4"], /* Paused */ - [state="5"]) /* Starting (queued) */) - .downloadShowMenuItem, -.download-state[state="7"] /* Scanning */ .downloadCommandsSeparator -{ - display: none; -} diff --git a/components/downloads/content/allDownloadsViewOverlay.js b/components/downloads/content/allDownloadsViewOverlay.js deleted file mode 100644 index 4830f21..0000000 --- a/components/downloads/content/allDownloadsViewOverlay.js +++ /dev/null @@ -1,1399 +0,0 @@ -/* 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 { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "DownloadUtils", - "resource://gre/modules/DownloadUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "DownloadsCommon", - "resource:///modules/DownloadsCommon.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "DownloadsViewUI", - "resource:///modules/DownloadsViewUI.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", - "resource://gre/modules/FileUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", - "resource://gre/modules/NetUtil.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "OS", - "resource://gre/modules/osfile.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", - "resource://gre/modules/PlacesUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Promise", - "resource://gre/modules/Promise.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow", - "resource:///modules/RecentWindow.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Services", - "resource://gre/modules/Services.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Task", - "resource://gre/modules/Task.jsm"); - -const nsIDM = Ci.nsIDownloadManager; - -const DESTINATION_FILE_URI_ANNO = "downloads/destinationFileURI"; -const DOWNLOAD_META_DATA_ANNO = "downloads/metaData"; - -const DOWNLOAD_VIEW_SUPPORTED_COMMANDS = - ["cmd_delete", "cmd_copy", "cmd_paste", "cmd_selectAll", - "downloadsCmd_pauseResume", "downloadsCmd_cancel", - "downloadsCmd_open", "downloadsCmd_show", "downloadsCmd_retry", - "downloadsCmd_openReferrer", "downloadsCmd_clearDownloads"]; - -/** - * Represents a download from the browser history. It implements part of the - * interface of the Download object. - * - * @param aPlacesNode - * The Places node from which the history download should be initialized. - */ -function HistoryDownload(aPlacesNode) { - // TODO (bug 829201): history downloads should get the referrer from Places. - this.source = { - url: aPlacesNode.uri, - }; - this.target = { - path: undefined, - exists: false, - size: undefined, - }; - - // In case this download cannot obtain its end time from the Places metadata, - // use the time from the Places node, that is the start time of the download. - this.endTime = aPlacesNode.time / 1000; -} - -HistoryDownload.prototype = { - /** - * Pushes information from Places metadata into this object. - */ - updateFromMetaData(metaData) { - try { - this.target.path = Cc["@mozilla.org/network/protocol;1?name=file"] - .getService(Ci.nsIFileProtocolHandler) - .getFileFromURLSpec(metaData.targetFileSpec).path; - } catch (ex) { - this.target.path = undefined; - } - - if ("state" in metaData) { - this.succeeded = metaData.state == nsIDM.DOWNLOAD_FINISHED; - this.error = metaData.state == nsIDM.DOWNLOAD_FAILED - ? { message: "History download failed." } - : metaData.state == nsIDM.DOWNLOAD_BLOCKED_PARENTAL - ? { becauseBlockedByParentalControls: true } - : metaData.state == nsIDM.DOWNLOAD_DIRTY - ? { becauseBlockedByReputationCheck: true } - : null; - this.canceled = metaData.state == nsIDM.DOWNLOAD_CANCELED || - metaData.state == nsIDM.DOWNLOAD_PAUSED; - this.endTime = metaData.endTime; - - // Normal history downloads are assumed to exist until the user interface - // is refreshed, at which point these values may be updated. - this.target.exists = true; - this.target.size = metaData.fileSize; - } else { - // Metadata might be missing from a download that has started but hasn't - // stopped already. Normally, this state is overridden with the one from - // the corresponding in-progress session download. But if the browser is - // terminated abruptly and additionally the file with information about - // in-progress downloads is lost, we may end up using this state. We use - // the failed state to allow the download to be restarted. - // - // On the other hand, if the download is missing the target file - // annotation as well, it is just a very old one, and we can assume it - // succeeded. - this.succeeded = !this.target.path; - this.error = this.target.path ? { message: "Unstarted download." } : null; - this.canceled = false; - - // These properties may be updated if the user interface is refreshed. - this.target.exists = false; - this.target.size = undefined; - } - }, - - /** - * History downloads are never in progress. - */ - stopped: true, - - /** - * No percentage indication is shown for history downloads. - */ - hasProgress: false, - - /** - * History downloads cannot be restarted using their partial data, even if - * they are indicated as paused in their Places metadata. The only way is to - * use the information from a persisted session download, that will be shown - * instead of the history download. In case this session download is not - * available, we show the history download as canceled, not paused. - */ - hasPartialData: false, - - /** - * This method mimicks the "start" method of session downloads, and is called - * when the user retries a history download. - * - * At present, we always ask the user for a new target path when retrying a - * history download. In the future we may consider reusing the known target - * path if the folder still exists and the file name is not already used, - * except when the user preferences indicate that the target path should be - * requested every time a new download is started. - */ - start() { - let browserWin = RecentWindow.getMostRecentBrowserWindow(); - let initiatingDoc = browserWin ? browserWin.document : document; - - // Do not suggest a file name if we don't know the original target. - let leafName = this.target.path ? OS.Path.basename(this.target.path) : null; - DownloadURL(this.source.url, leafName, initiatingDoc); - - return Promise.resolve(); - }, - - /** - * This method mimicks the "refresh" method of session downloads, except that - * it cannot notify that the data changed to the Downloads View. - */ - refresh: Task.async(function* () { - try { - this.target.size = (yield OS.File.stat(this.target.path)).size; - this.target.exists = true; - } catch (ex) { - // We keep the known file size from the metadata, if any. - this.target.exists = false; - } - }), -}; - -/** - * A download element shell is responsible for handling the commands and the - * displayed data for a single download view element. - * - * The shell may contain a session download, a history download, or both. When - * both a history and a session download are present, the session download gets - * priority and its information is displayed. - * - * On construction, a new richlistitem is created, and can be accessed through - * the |element| getter. The shell doesn't insert the item in a richlistbox, the - * caller must do it and remove the element when it's no longer needed. - * - * The caller is also responsible for forwarding status notifications for - * session downloads, calling the onStateChanged and onChanged methods. - * - * @param [optional] aSessionDownload - * The session download, required if aHistoryDownload is not set. - * @param [optional] aHistoryDownload - * The history download, required if aSessionDownload is not set. - */ -function HistoryDownloadElementShell(aSessionDownload, aHistoryDownload) { - this.element = document.createElement("richlistitem"); - this.element._shell = this; - - this.element.classList.add("download"); - this.element.classList.add("download-state"); - - if (aSessionDownload) { - this.sessionDownload = aSessionDownload; - } - if (aHistoryDownload) { - this.historyDownload = aHistoryDownload; - } -} - -HistoryDownloadElementShell.prototype = { - __proto__: DownloadsViewUI.DownloadElementShell.prototype, - - /** - * Manages the "active" state of the shell. By default all the shells without - * a session download are inactive, thus their UI is not updated. They must - * be activated when entering the visible area. Session downloads are always - * active. - */ - ensureActive: function DES_ensureActive() { - if (!this._active) { - this._active = true; - this.element.setAttribute("active", true); - this._updateUI(); - } - }, - get active() !!this._active, - - /** - * Overrides the base getter to return the Download or HistoryDownload object - * for displaying information and executing commands in the user interface. - */ - get download() this._sessionDownload || this._historyDownload, - - _sessionDownload: null, - get sessionDownload() this._sessionDownload, - set sessionDownload(aValue) { - if (this._sessionDownload != aValue) { - if (!aValue && !this._historyDownload) { - throw new Error("Should always have either a Download or a HistoryDownload"); - } - - this._sessionDownload = aValue; - - this.ensureActive(); - this._updateUI(); - } - return aValue; - }, - - _historyDownload: null, - get historyDownload() this._historyDownload, - set historyDownload(aValue) { - if (this._historyDownload != aValue) { - if (!aValue && !this._sessionDownload) { - throw new Error("Should always have either a Download or a HistoryDownload"); - } - - this._historyDownload = aValue; - - // We don't need to update the UI if we had a session data item, because - // the places information isn't used in this case. - if (!this._sessionDownload) { - this._updateUI(); - } - } - return aValue; - }, - - _updateUI() { - // There is nothing to do if the item has always been invisible. - if (!this.active) { - return; - } - - // Since the state changed, we may need to check the target file again. - this._targetFileChecked = false; - - this._updateState(); - }, - - get statusTextAndTip() { - let status = this.rawStatusTextAndTip; - - // The base object would show extended progress information in the tooltip, - // but we move this to the main view and never display a tooltip. - if (!this.download.stopped) { - status.text = status.tip; - } - status.tip = ""; - - return status; - }, - - onStateChanged() { - this.element.setAttribute("image", this.image); - this.element.setAttribute("state", - DownloadsCommon.stateOfDownload(this.download)); - - if (this.element.selected) { - goUpdateDownloadCommands(); - } else { - goUpdateCommand("downloadsCmd_clearDownloads"); - } - }, - - onChanged() { - this._updateProgress(); - }, - - /* nsIController */ - isCommandEnabled: function DES_isCommandEnabled(aCommand) { - // The only valid command for inactive elements is cmd_delete. - if (!this.active && aCommand != "cmd_delete") - return false; - switch (aCommand) { - case "downloadsCmd_open": - // This property is false if the download did not succeed. - return this.download.target.exists; - case "downloadsCmd_show": - // TODO: Bug 827010 - Handle part-file asynchronously. - if (this._sessionDownload && this.download.target.partFilePath) { - let partFile = new FileUtils.File(this.download.target.partFilePath); - if (partFile.exists()) { - return true; - } - } - - // This property is false if the download did not succeed. - return this.download.target.exists; - case "downloadsCmd_pauseResume": - return this.download.hasPartialData && !this.download.error; - case "downloadsCmd_retry": - return this.download.canceled || this.download.error; - case "downloadsCmd_openReferrer": - return !!this.download.source.referrer; - case "cmd_delete": - // We don't want in-progress downloads to be removed accidentally. - return this.download.stopped; - case "downloadsCmd_cancel": - return !!this._sessionDownload; - } - return false; - }, - - /* nsIController */ - doCommand: function DES_doCommand(aCommand) { - switch (aCommand) { - case "downloadsCmd_open": { - let file = new FileUtils.File(this.download.target.path); - DownloadsCommon.openDownloadedFile(file, null, window); - break; - } - case "downloadsCmd_show": { - let file = new FileUtils.File(this.download.target.path); - DownloadsCommon.showDownloadedFile(file); - break; - } - case "downloadsCmd_openReferrer": { - openURL(this.download.source.referrer); - break; - } - case "downloadsCmd_cancel": { - this.download.cancel().catch(() => {}); - this.download.removePartialData().catch(Cu.reportError); - break; - } - case "cmd_delete": { - if (this._sessionDownload) { - DownloadsCommon.removeAndFinalizeDownload(this.download); - } - if (this._historyDownload) { - let uri = NetUtil.newURI(this.download.source.url); - PlacesUtils.bhistory.removePage(uri); - } - break; - } - case "downloadsCmd_retry": { - // Errors when retrying are already reported as download failures. - this.download.start().catch(() => {}); - break; - } - case "downloadsCmd_pauseResume": { - // This command is only enabled for session downloads. - if (this.download.stopped) { - this.download.start(); - } else { - this.download.cancel(); - } - break; - } - } - }, - - // Returns whether or not the download handled by this shell should - // show up in the search results for the given term. Both the display - // name for the download and the url are searched. - matchesSearchTerm: function DES_matchesSearchTerm(aTerm) { - if (!aTerm) - return true; - aTerm = aTerm.toLowerCase(); - return this.displayName.toLowerCase().contains(aTerm) || - this.download.source.url.toLowerCase().contains(aTerm); - }, - - // Handles return keypress on the element (the keypress listener is - // set in the DownloadsPlacesView object). - doDefaultCommand: function DES_doDefaultCommand() { - function getDefaultCommandForState(aState) { - switch (aState) { - case nsIDM.DOWNLOAD_FINISHED: - return "downloadsCmd_open"; - case nsIDM.DOWNLOAD_PAUSED: - return "downloadsCmd_pauseResume"; - case nsIDM.DOWNLOAD_NOTSTARTED: - case nsIDM.DOWNLOAD_QUEUED: - return "downloadsCmd_cancel"; - case nsIDM.DOWNLOAD_FAILED: - case nsIDM.DOWNLOAD_CANCELED: - return "downloadsCmd_retry"; - case nsIDM.DOWNLOAD_SCANNING: - return "downloadsCmd_show"; - case nsIDM.DOWNLOAD_BLOCKED_PARENTAL: - case nsIDM.DOWNLOAD_DIRTY: - case nsIDM.DOWNLOAD_BLOCKED_POLICY: - return "downloadsCmd_openReferrer"; - } - return ""; - } - let state = DownloadsCommon.stateOfDownload(this.download); - let command = getDefaultCommandForState(state); - if (command && this.isCommandEnabled(command)) - this.doCommand(command); - }, - - /** - * This method is called by the outer download view, after the controller - * commands have already been updated. In case we did not check for the - * existence of the target file already, we can do it now and then update - * the commands as needed. - */ - onSelect: function DES_onSelect() { - if (!this.active) - return; - - // If this is a history download for which no target file information is - // available, we cannot retrieve information about the target file. - if (!this.download.target.path) { - return; - } - - // Start checking for existence. This may be done twice if onSelect is - // called again before the information is collected. - if (!this._targetFileChecked) { - this._checkTargetFileOnSelect().catch(Cu.reportError); - } - }, - - _checkTargetFileOnSelect: Task.async(function* () { - try { - yield this.download.refresh(); - } finally { - // Do not try to check for existence again if this failed once. - this._targetFileChecked = true; - } - - // Update the commands only if the element is still selected. - if (this.element.selected) { - goUpdateDownloadCommands(); - } - - // Ensure the interface has been updated based on the new values. We need to - // do this because history downloads can't trigger update notifications. - this._updateProgress(); - }), -}; - -/** - * A Downloads Places View is a places view designed to show a places query - * for history downloads alongside the session downloads. - * - * As we don't use the places controller, some methods implemented by other - * places views are not implemented by this view. - * - * A richlistitem in this view can represent either a past download or a session - * download, or both. Session downloads are shown first in the view, and as long - * as they exist they "collapses" their history "counterpart" (So we don't show two - * items for every download). - */ -function DownloadsPlacesView(aRichListBox, aActive = true) { - this._richlistbox = aRichListBox; - this._richlistbox._placesView = this; - window.controllers.insertControllerAt(0, this); - - // Map download URLs to download element shells regardless of their type - this._downloadElementsShellsForURI = new Map(); - - // Map download data items to their element shells. - this._viewItemsForDownloads = new WeakMap(); - - // Points to the last session download element. We keep track of this - // in order to keep all session downloads above past downloads. - this._lastSessionDownloadElement = null; - - this._searchTerm = ""; - - this._active = aActive; - - // Register as a downloads view. The places data will be initialized by - // the places setter. - this._initiallySelectedElement = null; - this._downloadsData = DownloadsCommon.getData(window.opener || window); - this._downloadsData.addView(this); - - // Get the Download button out of the attention state since we're about to - // view all downloads. - DownloadsCommon.getIndicatorData(window).attention = false; - - // Make sure to unregister the view if the window is closed. - window.addEventListener("unload", function() { - window.controllers.removeController(this); - this._downloadsData.removeView(this); - this.result = null; - }.bind(this), true); - // Resizing the window may change items visibility. - window.addEventListener("resize", function() { - this._ensureVisibleElementsAreActive(); - }.bind(this), true); -} - -DownloadsPlacesView.prototype = { - get associatedElement() this._richlistbox, - - get active() this._active, - set active(val) { - this._active = val; - if (this._active) - this._ensureVisibleElementsAreActive(); - return this._active; - }, - - /** - * This cache exists in order to optimize the load of the Downloads View, when - * Places annotations for history downloads must be read. In fact, annotations - * are stored in a single table, and reading all of them at once is much more - * efficient than an individual query. - * - * When this property is first requested, it reads the annotations for all the - * history downloads and stores them indefinitely. - * - * The historical annotations are not expected to change for the duration of - * the session, except in the case where a session download is running for the - * same URI as a history download. To ensure we don't use stale data, URIs - * corresponding to session downloads are permanently removed from the cache. - * This is a very small mumber compared to history downloads. - * - * This property returns a Map from each download source URI found in Places - * annotations to an object with the format: - * - * { targetFileSpec, state, endTime, fileSize, ... } - * - * The targetFileSpec property is the value of "downloads/destinationFileURI", - * while the other properties are taken from "downloads/metaData". Any of the - * properties may be missing from the object. - */ - get _cachedPlacesMetaData() { - if (!this.__cachedPlacesMetaData) { - this.__cachedPlacesMetaData = new Map(); - - // Read the metadata annotations first, but ignore invalid JSON. - for (let result of PlacesUtils.annotations.getAnnotationsWithName( - DOWNLOAD_META_DATA_ANNO)) { - try { - this.__cachedPlacesMetaData.set(result.uri.spec, - JSON.parse(result.annotationValue)); - } catch (ex) {} - } - - // Add the target file annotations to the metadata. - for (let result of PlacesUtils.annotations.getAnnotationsWithName( - DESTINATION_FILE_URI_ANNO)) { - let metaData = this.__cachedPlacesMetaData.get(result.uri.spec); - if (!metaData) { - metaData = {}; - this.__cachedPlacesMetaData.set(result.uri.spec, metaData); - } - metaData.targetFileSpec = result.annotationValue; - } - } - - return this.__cachedPlacesMetaData; - }, - __cachedPlacesMetaData: null, - - /** - * Reads current metadata from Places annotations for the specified URI, and - * returns an object with the format: - * - * { targetFileSpec, state, endTime, fileSize, ... } - * - * The targetFileSpec property is the value of "downloads/destinationFileURI", - * while the other properties are taken from "downloads/metaData". Any of the - * properties may be missing from the object. - */ - _getPlacesMetaDataFor(spec) { - let metaData = {}; - - try { - let uri = NetUtil.newURI(spec); - try { - metaData = JSON.parse(PlacesUtils.annotations.getPageAnnotation( - uri, DOWNLOAD_META_DATA_ANNO)); - } catch (ex) {} - metaData.targetFileSpec = PlacesUtils.annotations.getPageAnnotation( - uri, DESTINATION_FILE_URI_ANNO); - } catch (ex) {} - - return metaData; - }, - - /** - * Given a data item for a session download, or a places node for a past - * download, updates the view as necessary. - * 1. If the given data is a places node, we check whether there are any - * elements for the same download url. If there are, then we just reset - * their places node. Otherwise we add a new download element. - * 2. If the given data is a data item, we first check if there's a history - * download in the list that is not associated with a data item. If we - * found one, we use it for the data item as well and reposition it - * alongside the other session downloads. If we don't, then we go ahead - * and create a new element for the download. - * - * @param [optional] sessionDownload - * A Download object, or null for history downloads. - * @param [optional] aPlacesNode - * The Places node for a history download, or null for session downloads. - * @param [optional] aNewest - * @see onDownloadAdded. Ignored for history downloads. - * @param [optional] aDocumentFragment - * To speed up the appending of multiple elements to the end of the - * list which are coming in a single batch (i.e. invalidateContainer), - * a document fragment may be passed to which the new elements would - * be appended. It's the caller's job to ensure the fragment is merged - * to the richlistbox at the end. - */ - _addDownloadData(sessionDownload, aPlacesNode, aNewest = false, - aDocumentFragment = null) { - let downloadURI = aPlacesNode ? aPlacesNode.uri - : sessionDownload.source.url; - let shellsForURI = this._downloadElementsShellsForURI.get(downloadURI); - if (!shellsForURI) { - shellsForURI = new Set(); - this._downloadElementsShellsForURI.set(downloadURI, shellsForURI); - } - - // When a session download is attached to a shell, we ensure not to keep - // stale metadata around for the corresponding history download. This - // prevents stale state from being used if the view is rebuilt. - // - // Note that we will eagerly load the data in the cache at this point, even - // if we have seen no history download. The case where no history download - // will appear at all is rare enough in normal usage, so we can apply this - // simpler solution rather than keeping a list of cache items to ignore. - if (sessionDownload) { - this._cachedPlacesMetaData.delete(sessionDownload.source.url); - } - - let newOrUpdatedShell = null; - - // Trivial: if there are no shells for this download URI, we always - // need to create one. - let shouldCreateShell = shellsForURI.size == 0; - - // However, if we do have shells for this download uri, there are - // few options: - // 1) There's only one shell and it's for a history download (it has - // no data item). In this case, we update this shell and move it - // if necessary - // 2) There are multiple shells, indicating multiple downloads for - // the same download uri are running. In this case we create - // another shell for the download (so we have one shell for each data - // item). - // - // Note: If a cancelled session download is already in the list, and the - // download is retried, onDownloadAdded is called again for the same - // data item. Thus, we also check that we make sure we don't have a view item - // already. - if (!shouldCreateShell && - sessionDownload && !this._viewItemsForDownloads.has(sessionDownload)) { - // If there's a past-download-only shell for this download-uri with no - // associated data item, use it for the new data item. Otherwise, go ahead - // and create another shell. - shouldCreateShell = true; - for (let shell of shellsForURI) { - if (!shell.sessionDownload) { - shouldCreateShell = false; - shell.sessionDownload = sessionDownload; - newOrUpdatedShell = shell; - this._viewItemsForDownloads.set(sessionDownload, shell); - break; - } - } - } - - if (shouldCreateShell) { - // If we are adding a new history download here, it means there is no - // associated session download, thus we must read the Places metadata, - // because it will not be obscured by the session download. - let historyDownload = null; - if (aPlacesNode) { - let metaData = this._cachedPlacesMetaData.get(aPlacesNode.uri) || - this._getPlacesMetaDataFor(aPlacesNode.uri); - historyDownload = new HistoryDownload(aPlacesNode); - historyDownload.updateFromMetaData(metaData); - } - let shell = new HistoryDownloadElementShell(sessionDownload, - historyDownload); - shell.element._placesNode = aPlacesNode; - newOrUpdatedShell = shell; - shellsForURI.add(shell); - if (sessionDownload) { - this._viewItemsForDownloads.set(sessionDownload, shell); - } - } - else if (aPlacesNode) { - // We are updating information for a history download for which we have - // at least one download element shell already. There are two cases: - // 1) There are one or more download element shells for this source URI, - // each with an associated session download. We update the Places node - // because we may need it later, but we don't need to read the Places - // metadata until the last session download is removed. - // 2) Occasionally, we may receive a duplicate notification for a history - // download with no associated session download. We have exactly one - // download element shell in this case, but the metdata cannot have - // changed, just the reference to the Places node object is different. - // So, we update all the node references and keep the metadata intact. - for (let shell of shellsForURI) { - if (!shell.historyDownload) { - // Create the element to host the metadata when needed. - shell.historyDownload = new HistoryDownload(aPlacesNode); - } - shell.element._placesNode = aPlacesNode; - } - } - - if (newOrUpdatedShell) { - if (aNewest) { - this._richlistbox.insertBefore(newOrUpdatedShell.element, - this._richlistbox.firstChild); - if (!this._lastSessionDownloadElement) { - this._lastSessionDownloadElement = newOrUpdatedShell.element; - } - // Some operations like retrying an history download move an element to - // the top of the richlistbox, along with other session downloads. - // More generally, if a new download is added, should be made visible. - this._richlistbox.ensureElementIsVisible(newOrUpdatedShell.element); - } else if (sessionDownload) { - let before = this._lastSessionDownloadElement ? - this._lastSessionDownloadElement.nextSibling : this._richlistbox.firstChild; - this._richlistbox.insertBefore(newOrUpdatedShell.element, before); - this._lastSessionDownloadElement = newOrUpdatedShell.element; - } - else { - let appendTo = aDocumentFragment || this._richlistbox; - appendTo.appendChild(newOrUpdatedShell.element); - } - - if (this.searchTerm) { - newOrUpdatedShell.element.hidden = - !newOrUpdatedShell.element._shell.matchesSearchTerm(this.searchTerm); - } - } - - // If aDocumentFragment is defined this is a batch change, so it's up to - // the caller to append the fragment and activate the visible shells. - if (!aDocumentFragment) { - this._ensureVisibleElementsAreActive(); - goUpdateCommand("downloadsCmd_clearDownloads"); - } - }, - - _removeElement: function DPV__removeElement(aElement) { - // If the element was selected exclusively, select its next - // sibling first, if not, try for previous sibling, if any. - if ((aElement.nextSibling || aElement.previousSibling) && - this._richlistbox.selectedItems && - this._richlistbox.selectedItems.length == 1 && - this._richlistbox.selectedItems[0] == aElement) { - this._richlistbox.selectItem(aElement.nextSibling || - aElement.previousSibling); - } - - if (this._lastSessionDownloadElement == aElement) - this._lastSessionDownloadElement = aElement.previousSibling; - - this._richlistbox.removeItemFromSelection(aElement); - this._richlistbox.removeChild(aElement); - this._ensureVisibleElementsAreActive(); - goUpdateCommand("downloadsCmd_clearDownloads"); - }, - - _removeHistoryDownloadFromView: - function DPV__removeHistoryDownloadFromView(aPlacesNode) { - let downloadURI = aPlacesNode.uri; - let shellsForURI = this._downloadElementsShellsForURI.get(downloadURI); - if (shellsForURI) { - for (let shell of shellsForURI) { - if (shell.sessionDownload) { - shell.historyDownload = null; - } - else { - this._removeElement(shell.element); - shellsForURI.delete(shell); - if (shellsForURI.size == 0) - this._downloadElementsShellsForURI.delete(downloadURI); - } - } - } - }, - - _removeSessionDownloadFromView(download) { - let shells = this._downloadElementsShellsForURI - .get(download.source.url); - if (shells.size == 0) - throw new Error("Should have had at leaat one shell for this uri"); - - let shell = this._viewItemsForDownloads.get(download); - if (!shells.has(shell)) - throw new Error("Missing download element shell in shells list for url"); - - // If there's more than one item for this download uri, we can let the - // view item for this this particular data item go away. - // If there's only one item for this download uri, we should only - // keep it if it is associated with a history download. - if (shells.size > 1 || !shell.historyDownload) { - this._removeElement(shell.element); - shells.delete(shell); - if (shells.size == 0) - this._downloadElementsShellsForURI.delete(download.source.url); - } - else { - // We have one download element shell containing both a session download - // and a history download, and we are now removing the session download. - // Previously, we did not use the Places metadata because it was obscured - // by the session download. Since this is no longer the case, we have to - // read the latest metadata before removing the session download. - let url = shell.historyDownload.source.url; - let metaData = this._getPlacesMetaDataFor(url); - shell.historyDownload.updateFromMetaData(metaData); - shell.sessionDownload = null; - // Move it below the session-download items; - if (this._lastSessionDownloadElement == shell.element) { - this._lastSessionDownloadElement = shell.element.previousSibling; - } - else { - let before = this._lastSessionDownloadElement ? - this._lastSessionDownloadElement.nextSibling : this._richlistbox.firstChild; - this._richlistbox.insertBefore(shell.element, before); - } - } - }, - - _ensureVisibleElementsAreActive: - function DPV__ensureVisibleElementsAreActive() { - if (!this.active || this._ensureVisibleTimer || !this._richlistbox.firstChild) - return; - - this._ensureVisibleTimer = setTimeout(function() { - delete this._ensureVisibleTimer; - if (!this._richlistbox.firstChild) - return; - - let rlbRect = this._richlistbox.getBoundingClientRect(); - let winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindowUtils); - let nodes = winUtils.nodesFromRect(rlbRect.left, rlbRect.top, - 0, rlbRect.width, rlbRect.height, 0, - true, false); - // nodesFromRect returns nodes in z-index order, and for the same z-index - // sorts them in inverted DOM order, thus starting from the one that would - // be on top. - let firstVisibleNode, lastVisibleNode; - for (let node of nodes) { - if (node.localName === "richlistitem" && node._shell) { - node._shell.ensureActive(); - // The first visible node is the last match. - firstVisibleNode = node; - // While the last visible node is the first match. - if (!lastVisibleNode) - lastVisibleNode = node; - } - } - - // Also activate the first invisible nodes in both boundaries (that is, - // above and below the visible area) to ensure proper keyboard navigation - // in both directions. - let nodeBelowVisibleArea = lastVisibleNode && lastVisibleNode.nextSibling; - if (nodeBelowVisibleArea && nodeBelowVisibleArea._shell) - nodeBelowVisibleArea._shell.ensureActive(); - - let nodeABoveVisibleArea = - firstVisibleNode && firstVisibleNode.previousSibling; - if (nodeABoveVisibleArea && nodeABoveVisibleArea._shell) - nodeABoveVisibleArea._shell.ensureActive(); - }.bind(this), 10); - }, - - _place: "", - get place() this._place, - set place(val) { - // Don't reload everything if we don't have to. - if (this._place == val) { - // XXXmano: places.js relies on this behavior (see Bug 822203). - this.searchTerm = ""; - return val; - } - - this._place = val; - - let history = PlacesUtils.history; - let queries = { }, options = { }; - history.queryStringToQueries(val, queries, { }, options); - if (!queries.value.length) - queries.value = [history.getNewQuery()]; - - let result = history.executeQueries(queries.value, queries.value.length, - options.value); - result.addObserver(this, false); - return val; - }, - - _result: null, - get result() this._result, - set result(val) { - if (this._result == val) - return val; - - if (this._result) { - this._result.removeObserver(this); - this._resultNode.containerOpen = false; - } - - if (val) { - this._result = val; - this._resultNode = val.root; - this._resultNode.containerOpen = true; - this._ensureInitialSelection(); - } - else { - delete this._resultNode; - delete this._result; - } - - return val; - }, - - get selectedNodes() { - return [for (element of this._richlistbox.selectedItems) - if (element._placesNode) - element._placesNode]; - }, - - get selectedNode() { - let selectedNodes = this.selectedNodes; - return selectedNodes.length == 1 ? selectedNodes[0] : null; - }, - - get hasSelection() this.selectedNodes.length > 0, - - containerStateChanged: - function DPV_containerStateChanged(aNode, aOldState, aNewState) { - this.invalidateContainer(aNode) - }, - - invalidateContainer: - function DPV_invalidateContainer(aContainer) { - if (aContainer != this._resultNode) - throw new Error("Unexpected container node"); - if (!aContainer.containerOpen) - throw new Error("Root container for the downloads query cannot be closed"); - - let suppressOnSelect = this._richlistbox.suppressOnSelect; - this._richlistbox.suppressOnSelect = true; - try { - // Remove the invalidated history downloads from the list and unset the - // places node for data downloads. - // Loop backwards since _removeHistoryDownloadFromView may removeChild(). - for (let i = this._richlistbox.childNodes.length - 1; i >= 0; --i) { - let element = this._richlistbox.childNodes[i]; - if (element._placesNode) { - this._removeHistoryDownloadFromView(element._placesNode); - } - } - } - finally { - this._richlistbox.suppressOnSelect = suppressOnSelect; - } - - if (aContainer.childCount > 0) { - let elementsToAppendFragment = document.createDocumentFragment(); - for (let i = 0; i < aContainer.childCount; i++) { - try { - this._addDownloadData(null, aContainer.getChild(i), false, - elementsToAppendFragment); - } - catch(ex) { - Cu.reportError(ex); - } - } - - // _addDownloadData may not add new elements if there were already - // data items in place. - if (elementsToAppendFragment.firstChild) { - this._appendDownloadsFragment(elementsToAppendFragment); - this._ensureVisibleElementsAreActive(); - } - } - - goUpdateDownloadCommands(); - }, - - _appendDownloadsFragment: function DPV__appendDownloadsFragment(aDOMFragment) { - // Workaround multiple reflows hang by removing the richlistbox - // and adding it back when we're done. - - // Hack for bug 836283: reset xbl fields to their old values after the - // binding is reattached to avoid breaking the selection state - let xblFields = new Map(); - for (let [key, value] in Iterator(this._richlistbox)) { - xblFields.set(key, value); - } - - let parentNode = this._richlistbox.parentNode; - let nextSibling = this._richlistbox.nextSibling; - parentNode.removeChild(this._richlistbox); - this._richlistbox.appendChild(aDOMFragment); - parentNode.insertBefore(this._richlistbox, nextSibling); - - for (let [key, value] of xblFields) { - this._richlistbox[key] = value; - } - }, - - nodeInserted: function DPV_nodeInserted(aParent, aPlacesNode) { - this._addDownloadData(null, aPlacesNode); - }, - - nodeRemoved: function DPV_nodeRemoved(aParent, aPlacesNode, aOldIndex) { - this._removeHistoryDownloadFromView(aPlacesNode); - }, - - nodeAnnotationChanged() {}, - nodeIconChanged() {}, - nodeTitleChanged() {}, - nodeKeywordChanged: function() {}, - nodeDateAddedChanged: function() {}, - nodeLastModifiedChanged: function() {}, - nodeHistoryDetailsChanged: function() {}, - nodeTagsChanged: function() {}, - sortingChanged: function() {}, - nodeMoved: function() {}, - nodeURIChanged: function() {}, - batching: function() {}, - - get controller() this._richlistbox.controller, - - get searchTerm() this._searchTerm, - set searchTerm(aValue) { - if (this._searchTerm != aValue) { - for (let element of this._richlistbox.childNodes) { - element.hidden = !element._shell.matchesSearchTerm(aValue); - } - this._ensureVisibleElementsAreActive(); - } - return this._searchTerm = aValue; - }, - - /** - * When the view loads, we want to select the first item. - * However, because session downloads, for which the data is loaded - * asynchronously, always come first in the list, and because the list - * may (or may not) already contain history downloads at that point, it - * turns out that by the time we can select the first item, the user may - * have already started using the view. - * To make things even more complicated, in other cases, the places data - * may be loaded after the session downloads data. Thus we cannot rely on - * the order in which the data comes in. - * We work around this by attempting to select the first element twice, - * once after the places data is loaded and once when the session downloads - * data is done loading. However, if the selection has changed in-between, - * we assume the user has already started using the view and give up. - */ - _ensureInitialSelection: function DPV__ensureInitialSelection() { - // Either they're both null, or the selection has not changed in between. - if (this._richlistbox.selectedItem == this._initiallySelectedElement) { - let firstDownloadElement = this._richlistbox.firstChild; - if (firstDownloadElement != this._initiallySelectedElement) { - // We may be called before _ensureVisibleElementsAreActive, - // or before the download binding is attached. Therefore, ensure the - // first item is activated, and pass the item to the richlistbox - // setters only at a point we know for sure the binding is attached. - firstDownloadElement._shell.ensureActive(); - Services.tm.mainThread.dispatch(function() { - this._richlistbox.selectedItem = firstDownloadElement; - this._richlistbox.currentItem = firstDownloadElement; - this._initiallySelectedElement = firstDownloadElement; - }.bind(this), Ci.nsIThread.DISPATCH_NORMAL); - } - } - }, - - onDataLoadStarting: function() { }, - onDataLoadCompleted: function DPV_onDataLoadCompleted() { - this._ensureInitialSelection(); - }, - - onDownloadAdded(download, newest) { - this._addDownloadData(download, null, newest); - }, - - onDownloadStateChanged(download) { - this._viewItemsForDownloads.get(download).onStateChanged(); - }, - - onDownloadChanged(download) { - this._viewItemsForDownloads.get(download).onChanged(); - }, - - onDownloadRemoved(download) { - this._removeSessionDownloadFromView(download); - }, - - supportsCommand: function DPV_supportsCommand(aCommand) { - if (DOWNLOAD_VIEW_SUPPORTED_COMMANDS.indexOf(aCommand) != -1) { - // The clear-downloads command may be performed by the toolbar-button, - // which can be focused on OS X. Thus enable this command even if the - // richlistbox is not focused. - // For other commands, be prudent and disable them unless the richlistview - // is focused. It's important to make the decision here rather than in - // isCommandEnabled. Otherwise our controller may "steal" commands from - // other controls in the window (see goUpdateCommand & - // getControllerForCommand). - if (document.activeElement == this._richlistbox || - aCommand == "downloadsCmd_clearDownloads") { - return true; - } - } - return false; - }, - - isCommandEnabled: function DPV_isCommandEnabled(aCommand) { - switch (aCommand) { - case "cmd_copy": - return this._richlistbox.selectedItems.length > 0; - case "cmd_selectAll": - return true; - case "cmd_paste": - return this._canDownloadClipboardURL(); - case "downloadsCmd_clearDownloads": - return this._canClearDownloads(); - default: - return Array.every(this._richlistbox.selectedItems, function(element) { - return element._shell.isCommandEnabled(aCommand); - }); - } - }, - - _canClearDownloads: function DPV__canClearDownloads() { - // Downloads can be cleared if there's at least one removable download in - // the list (either a history download or a completed session download). - // Because history downloads are always removable and are listed after the - // session downloads, check from bottom to top. - for (let elt = this._richlistbox.lastChild; elt; elt = elt.previousSibling) { - // Stopped, paused, and failed downloads with partial data are removed. - let download = elt._shell.download; - if (download.stopped && !(download.canceled && download.hasPartialData)) { - return true; - } - } - return false; - }, - - _copySelectedDownloadsToClipboard: - function DPV__copySelectedDownloadsToClipboard() { - let urls = [for (element of this._richlistbox.selectedItems) - element._shell.download.source.url]; - - Cc["@mozilla.org/widget/clipboardhelper;1"] - .getService(Ci.nsIClipboardHelper) - .copyString(urls.join("\n"), document); - }, - - _getURLFromClipboardData: function DPV__getURLFromClipboardData() { - let trans = Cc["@mozilla.org/widget/transferable;1"]. - createInstance(Ci.nsITransferable); - trans.init(null); - - let flavors = ["text/x-moz-url", "text/unicode"]; - flavors.forEach(trans.addDataFlavor); - - Services.clipboard.getData(trans, Services.clipboard.kGlobalClipboard); - - // Getting the data or creating the nsIURI might fail. - try { - let data = {}; - trans.getAnyTransferData({}, data, {}); - let [url, name] = data.value.QueryInterface(Ci.nsISupportsString) - .data.split("\n"); - if (url) - return [NetUtil.newURI(url, null, null).spec, name]; - } - catch(ex) { } - - return ["", ""]; - }, - - _canDownloadClipboardURL: function DPV__canDownloadClipboardURL() { - let [url, name] = this._getURLFromClipboardData(); - return url != ""; - }, - - _downloadURLFromClipboard: function DPV__downloadURLFromClipboard() { - let [url, name] = this._getURLFromClipboardData(); - let browserWin = RecentWindow.getMostRecentBrowserWindow(); - let initiatingDoc = browserWin ? browserWin.document : document; - DownloadURL(url, name, initiatingDoc); - }, - - doCommand: function DPV_doCommand(aCommand) { - // Commands may be invoked with keyboard shortcuts even if disabled. - if (!this.isCommandEnabled(aCommand)) { - return; - } - switch (aCommand) { - case "cmd_copy": - this._copySelectedDownloadsToClipboard(); - break; - case "cmd_selectAll": - this._richlistbox.selectAll(); - break; - case "cmd_paste": - this._downloadURLFromClipboard(); - break; - case "downloadsCmd_clearDownloads": - this._downloadsData.removeFinished(); - if (this.result) { - Cc["@mozilla.org/browser/download-history;1"] - .getService(Ci.nsIDownloadHistory) - .removeAllDownloads(); - } - // There may be no selection or focus change as a result - // of these change, and we want the command updated immediately. - goUpdateCommand("downloadsCmd_clearDownloads"); - break; - default: { - // Cloning the nodelist into an array to get a frozen list of selected items. - // Otherwise, the selectedItems nodelist is live and doCommand may alter the - // selection while we are trying to do one particular action, like removing - // items from history. - let selectedElements = [...this._richlistbox.selectedItems]; - for (let element of selectedElements) { - element._shell.doCommand(aCommand); - } - } - } - }, - - onEvent: function() { }, - - onContextMenu: function DPV_onContextMenu(aEvent) - { - let element = this._richlistbox.selectedItem; - if (!element || !element._shell) - return false; - - // Set the state attribute so that only the appropriate items are displayed. - let contextMenu = document.getElementById("downloadsContextMenu"); - let download = element._shell.download; - contextMenu.setAttribute("state", - DownloadsCommon.stateOfDownload(download)); - - if (!download.stopped) { - // The hasPartialData property of a download may change at any time after - // it has started, so ensure we update the related command now. - goUpdateCommand("downloadsCmd_pauseResume"); - } - return true; - }, - - onKeyPress: function DPV_onKeyPress(aEvent) { - let selectedElements = this._richlistbox.selectedItems; - if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN) { - // In the content tree, opening bookmarks by pressing return is only - // supported when a single item is selected. To be consistent, do the - // same here. - if (selectedElements.length == 1) { - let element = selectedElements[0]; - if (element._shell) - element._shell.doDefaultCommand(); - } - } - else if (aEvent.charCode == " ".charCodeAt(0)) { - // Pause/Resume every selected download - for (let element of selectedElements) { - if (element._shell.isCommandEnabled("downloadsCmd_pauseResume")) - element._shell.doCommand("downloadsCmd_pauseResume"); - } - } - }, - - onDoubleClick: function DPV_onDoubleClick(aEvent) { - if (aEvent.button != 0) - return; - - let selectedElements = this._richlistbox.selectedItems; - if (selectedElements.length != 1) - return; - - let element = selectedElements[0]; - if (element._shell) - element._shell.doDefaultCommand(); - }, - - onScroll: function DPV_onScroll() { - this._ensureVisibleElementsAreActive(); - }, - - onSelect: function DPV_onSelect() { - goUpdateDownloadCommands(); - - let selectedElements = this._richlistbox.selectedItems; - for (let elt of selectedElements) { - if (elt._shell) - elt._shell.onSelect(); - } - }, - - onDragStart: function DPV_onDragStart(aEvent) { - // TODO Bug 831358: Support d&d for multiple selection. - // For now, we just drag the first element. - let selectedItem = this._richlistbox.selectedItem; - if (!selectedItem) - return; - - let targetPath = selectedItem._shell.download.target.path; - if (!targetPath) { - return; - } - - // We must check for existence synchronously because this is a DOM event. - let file = new FileUtils.File(targetPath); - if (!file.exists()) - return; - - let dt = aEvent.dataTransfer; - dt.mozSetDataAt("application/x-moz-file", file, 0); - let url = Services.io.newFileURI(file).spec; - dt.setData("text/uri-list", url); - dt.setData("text/plain", url); - dt.effectAllowed = "copyMove"; - dt.addElement(selectedItem); - }, - - onDragOver: function DPV_onDragOver(aEvent) { - let types = aEvent.dataTransfer.types; - if (types.contains("text/uri-list") || - types.contains("text/x-moz-url") || - types.contains("text/plain")) { - aEvent.preventDefault(); - } - }, - - onDrop: function DPV_onDrop(aEvent) { - let dt = aEvent.dataTransfer; - // If dragged item is from our source, do not try to - // redownload already downloaded file. - if (dt.mozGetDataAt("application/x-moz-file", 0)) - return; - - let links = Services.droppedLinkHandler.dropLinks(aEvent); - if (!links.length) - return; - let browserWin = RecentWindow.getMostRecentBrowserWindow(); - let initiatingDoc = browserWin ? browserWin.document : document; - for (let link of links) { - if (link.url.startsWith("about:")) - continue; - DownloadURL(link.url, link.name, initiatingDoc); - } - } -}; - -for (let methodName of ["load", "applyFilter", "selectNode", "selectItems"]) { - DownloadsPlacesView.prototype[methodName] = function() { - throw new Error("|" + methodName + "| is not implemented by the downloads view."); - } -} - -function goUpdateDownloadCommands() { - for (let command of DOWNLOAD_VIEW_SUPPORTED_COMMANDS) { - goUpdateCommand(command); - } -} diff --git a/components/downloads/content/allDownloadsViewOverlay.xul b/components/downloads/content/allDownloadsViewOverlay.xul deleted file mode 100644 index 4e9bfd1..0000000 --- a/components/downloads/content/allDownloadsViewOverlay.xul +++ /dev/null @@ -1,119 +0,0 @@ - - -# 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/. - - - - - -%downloadsDTD; -]> - - - - - - -
-
- - - -
-

-

-

-
-
-
- - diff --git a/components/feeds/content/subscribe.xml b/components/feeds/content/subscribe.xml deleted file mode 100644 index 949bcfd..0000000 --- a/components/feeds/content/subscribe.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - %feedDTD; -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/feeds/jar.mn b/components/feeds/jar.mn deleted file mode 100644 index f8896f8..0000000 --- a/components/feeds/jar.mn +++ /dev/null @@ -1,9 +0,0 @@ -# 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/. - -browser.jar: - content/browser/feeds/subscribe.xhtml (content/subscribe.xhtml) - content/browser/feeds/subscribe.js (content/subscribe.js) - content/browser/feeds/subscribe.xml (content/subscribe.xml) - content/browser/feeds/subscribe.css (content/subscribe.css) diff --git a/components/feeds/moz.build b/components/feeds/moz.build deleted file mode 100644 index 736920a..0000000 --- a/components/feeds/moz.build +++ /dev/null @@ -1,33 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; 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/. - -JAR_MANIFESTS += ['jar.mn'] - -XPIDL_SOURCES += [ - 'nsIFeedResultService.idl', - 'nsIWebContentConverterRegistrar.idl', -] - -XPIDL_MODULE = 'browser-feeds' - -SOURCES += ['nsFeedSniffer.cpp'] - -EXTRA_COMPONENTS += [ - 'BrowserFeeds.manifest', - 'FeedConverter.js', -] - -EXTRA_PP_COMPONENTS += [ - 'FeedWriter.js', - 'WebContentConverter.js', -] - -FINAL_LIBRARY = 'browsercomps' - -for var in ('MOZ_APP_NAME', 'MOZ_MACBUNDLE_NAME'): - DEFINES[var] = CONFIG[var] - -LOCAL_INCLUDES += ['../build'] diff --git a/components/feeds/nsFeedSniffer.cpp b/components/feeds/nsFeedSniffer.cpp deleted file mode 100644 index f314d3d..0000000 --- a/components/feeds/nsFeedSniffer.cpp +++ /dev/null @@ -1,363 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; 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 "nsFeedSniffer.h" - - -#include "nsNetCID.h" -#include "nsXPCOM.h" -#include "nsCOMPtr.h" -#include "nsStringStream.h" - -#include "nsBrowserCompsCID.h" - -#include "nsICategoryManager.h" -#include "nsIServiceManager.h" -#include "nsComponentManagerUtils.h" -#include "nsServiceManagerUtils.h" - -#include "nsIStreamConverterService.h" -#include "nsIStreamConverter.h" - -#include "nsIStreamListener.h" - -#include "nsIHttpChannel.h" -#include "nsIMIMEHeaderParam.h" - -#include "nsMimeTypes.h" -#include "nsIURI.h" -#include - -#define TYPE_ATOM "application/atom+xml" -#define TYPE_RSS "application/rss+xml" -#define TYPE_MAYBE_FEED "application/vnd.mozilla.maybe.feed" - -#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" -#define NS_RSS "http://purl.org/rss/1.0/" - -#define MAX_BYTES 512u - -NS_IMPL_ISUPPORTS(nsFeedSniffer, - nsIContentSniffer, - nsIStreamListener, - nsIRequestObserver) - -nsresult -nsFeedSniffer::ConvertEncodedData(nsIRequest* request, - const uint8_t* data, - uint32_t length) -{ - nsresult rv = NS_OK; - - mDecodedData = ""; - nsCOMPtr httpChannel(do_QueryInterface(request)); - if (!httpChannel) - return NS_ERROR_NO_INTERFACE; - - nsAutoCString contentEncoding; - httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Encoding"), - contentEncoding); - if (!contentEncoding.IsEmpty()) { - nsCOMPtr converterService(do_GetService(NS_STREAMCONVERTERSERVICE_CONTRACTID)); - if (converterService) { - ToLowerCase(contentEncoding); - - nsCOMPtr converter; - rv = converterService->AsyncConvertData(contentEncoding.get(), - "uncompressed", this, nullptr, - getter_AddRefs(converter)); - NS_ENSURE_SUCCESS(rv, rv); - - converter->OnStartRequest(request, nullptr); - - nsCOMPtr rawStream = - do_CreateInstance(NS_STRINGINPUTSTREAM_CONTRACTID); - if (!rawStream) - return NS_ERROR_FAILURE; - - rv = rawStream->SetData((const char*)data, length); - NS_ENSURE_SUCCESS(rv, rv); - - rv = converter->OnDataAvailable(request, nullptr, rawStream, 0, length); - NS_ENSURE_SUCCESS(rv, rv); - - converter->OnStopRequest(request, nullptr, NS_OK); - } - } - return rv; -} - -template -static bool -StringBeginsWithLowercaseLiteral(nsAString& aString, - const char (&aSubstring)[N]) -{ - return StringHead(aString, N).LowerCaseEqualsLiteral(aSubstring); -} - -bool -HasAttachmentDisposition(nsIHttpChannel* httpChannel) -{ - if (!httpChannel) - return false; - - uint32_t disp; - nsresult rv = httpChannel->GetContentDisposition(&disp); - - if (NS_SUCCEEDED(rv) && disp == nsIChannel::DISPOSITION_ATTACHMENT) - return true; - - return false; -} - -/** - * @return the first occurrence of a character within a string buffer, - * or nullptr if not found - */ -static const char* -FindChar(char c, const char *begin, const char *end) -{ - for (; begin < end; ++begin) { - if (*begin == c) - return begin; - } - return nullptr; -} - -/** - * - * Determine if a substring is the "documentElement" in the document. - * - * All of our sniffed substrings: = end) - return false; - - // Check to see if the character following the '<' is either '?' or '!' - // (processing instruction or doctype or comment)... these are valid nodes - // to have in the prologue. - if (*start != '?' && *start != '!') - return false; - - // Now advance the iterator until the '>' (We do this because we don't want - // to sniff indicator substrings that are embedded within other nodes, e.g. - // comments: - start = FindChar('>', start, end); - if (!start) - return false; - - ++start; - } - return true; -} - -/** - * Determines whether or not a string exists as the root element in an XML data - * string buffer. - * @param dataString - * The data being sniffed - * @param substring - * The substring being tested for existence and root-ness. - * @returns true if the substring exists and is the documentElement, false - * otherwise. - */ -static bool -ContainsTopLevelSubstring(nsACString& dataString, const char *substring) -{ - int32_t offset = dataString.Find(substring); - if (offset == -1) - return false; - - const char *begin = dataString.BeginReading(); - - // Only do the validation when we find the substring. - return IsDocumentElement(begin, begin + offset); -} - -NS_IMETHODIMP -nsFeedSniffer::GetMIMETypeFromContent(nsIRequest* request, - const uint8_t* data, - uint32_t length, - nsACString& sniffedType) -{ - nsCOMPtr channel(do_QueryInterface(request)); - if (!channel) - return NS_ERROR_NO_INTERFACE; - - // Check that this is a GET request, since you can't subscribe to a POST... - nsAutoCString method; - channel->GetRequestMethod(method); - if (!method.EqualsLiteral("GET")) { - sniffedType.Truncate(); - return NS_OK; - } - - // We need to find out if this is a load of a view-source document. In this - // case we do not want to override the content type, since the source display - // does not need to be converted from feed format to XUL. More importantly, - // we don't want to change the content type from something - // nsContentDLF::CreateInstance knows about (e.g. application/xml, text/html - // etc) to something that only the application fe knows about (maybe.feed) - // thus deactivating syntax highlighting. - nsCOMPtr originalURI; - channel->GetOriginalURI(getter_AddRefs(originalURI)); - - nsAutoCString scheme; - originalURI->GetScheme(scheme); - if (scheme.EqualsLiteral("view-source")) { - sniffedType.Truncate(); - return NS_OK; - } - - // Check the Content-Type to see if it is set correctly. If it is set to - // something specific that we think is a reliable indication of a feed, don't - // bother sniffing since we assume the site maintainer knows what they're - // doing. - nsAutoCString contentType; - channel->GetContentType(contentType); - bool noSniff = contentType.EqualsLiteral(TYPE_RSS) || - contentType.EqualsLiteral(TYPE_ATOM); - - // Check to see if this was a feed request from the location bar or from - // the feed: protocol. This is also a reliable indication. - // The value of the header doesn't matter. - if (!noSniff) { - nsAutoCString sniffHeader; - nsresult foundHeader = - channel->GetRequestHeader(NS_LITERAL_CSTRING("X-Moz-Is-Feed"), - sniffHeader); - noSniff = NS_SUCCEEDED(foundHeader); - } - - if (noSniff) { - // check for an attachment after we have a likely feed. - if(HasAttachmentDisposition(channel)) { - sniffedType.Truncate(); - return NS_OK; - } - - // set the feed header as a response header, since we have good metadata - // telling us that the feed is supposed to be RSS or Atom - channel->SetResponseHeader(NS_LITERAL_CSTRING("X-Moz-Is-Feed"), - NS_LITERAL_CSTRING("1"), false); - sniffedType.AssignLiteral(TYPE_MAYBE_FEED); - return NS_OK; - } - - // Don't sniff arbitrary types. Limit sniffing to situations that - // we think can reasonably arise. - if (!contentType.EqualsLiteral(TEXT_HTML) && - !contentType.EqualsLiteral(APPLICATION_OCTET_STREAM) && - // Same criterion as XMLHttpRequest. Should we be checking for "+xml" - // and check for text/xml and application/xml by hand instead? - contentType.Find("xml") == -1) { - sniffedType.Truncate(); - return NS_OK; - } - - // Now we need to potentially decompress data served with - // Content-Encoding: gzip - nsresult rv = ConvertEncodedData(request, data, length); - if (NS_FAILED(rv)) - return rv; - - // We cap the number of bytes to scan at MAX_BYTES to prevent picking up - // false positives by accidentally reading document content, e.g. a "how to - // make a feed" page. - const char* testData; - if (mDecodedData.IsEmpty()) { - testData = (const char*)data; - length = std::min(length, MAX_BYTES); - } else { - testData = mDecodedData.get(); - length = std::min(mDecodedData.Length(), MAX_BYTES); - } - - // The strategy here is based on that described in: - // http://blogs.msdn.com/rssteam/articles/PublishersGuide.aspx - // for interoperarbility purposes. - - // Thus begins the actual sniffing. - nsDependentCSubstring dataString((const char*)testData, length); - - bool isFeed = false; - - // RSS 0.91/0.92/2.0 - isFeed = ContainsTopLevelSubstring(dataString, "(closure); - decodedData->Append(rawSegment, count); - *writeCount = count; - return NS_OK; -} - -NS_IMETHODIMP -nsFeedSniffer::OnDataAvailable(nsIRequest* request, nsISupports* context, - nsIInputStream* stream, uint64_t offset, - uint32_t count) -{ - uint32_t read; - return stream->ReadSegments(AppendSegmentToString, &mDecodedData, count, - &read); -} - -NS_IMETHODIMP -nsFeedSniffer::OnStopRequest(nsIRequest* request, nsISupports* context, - nsresult status) -{ - return NS_OK; -} diff --git a/components/feeds/nsFeedSniffer.h b/components/feeds/nsFeedSniffer.h deleted file mode 100644 index a0eb986..0000000 --- a/components/feeds/nsFeedSniffer.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; 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 "nsIContentSniffer.h" -#include "nsIStreamListener.h" -#include "nsStringAPI.h" -#include "mozilla/Attributes.h" - -class nsFeedSniffer final : public nsIContentSniffer, - nsIStreamListener -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSICONTENTSNIFFER - NS_DECL_NSIREQUESTOBSERVER - NS_DECL_NSISTREAMLISTENER - - static nsresult AppendSegmentToString(nsIInputStream* inputStream, - void* closure, - const char* rawSegment, - uint32_t toOffset, - uint32_t count, - uint32_t* writeCount); - -protected: - ~nsFeedSniffer() {} - - nsresult ConvertEncodedData(nsIRequest* request, const uint8_t* data, - uint32_t length); - -private: - nsCString mDecodedData; -}; - diff --git a/components/feeds/nsIFeedResultService.idl b/components/feeds/nsIFeedResultService.idl deleted file mode 100644 index cb0f332..0000000 --- a/components/feeds/nsIFeedResultService.idl +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; 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 "nsISupports.idl" -interface nsIURI; -interface nsIRequest; -interface nsIFeedResult; - -/** - * nsIFeedResultService provides a globally-accessible object for retrieving - * the results of feed processing. - */ -[scriptable, uuid(950a829e-c20e-4dc3-b447-f8b753ae54da)] -interface nsIFeedResultService : nsISupports -{ - /** - * When set to true, forces the preview page to be displayed, regardless - * of the user's preferences. - */ - attribute boolean forcePreviewPage; - - /** - * Adds a URI to the user's specified external feed handler, or live - * bookmarks. - * @param uri - * The uri of the feed to add. - * @param title - * The title of the feed to add. - * @param subtitle - * The subtitle of the feed to add. - * @param feedType - * The nsIFeed type of the feed. See nsIFeed.idl - */ - void addToClientReader(in AUTF8String uri, - in AString title, - in AString subtitle, - in unsigned long feedType); - - /** - * Registers a Feed Result object with a globally accessible service - * so that it can be accessed by a singleton method outside the usual - * flow of control in document loading. - * - * @param feedResult - * An object implementing nsIFeedResult representing the feed. - */ - void addFeedResult(in nsIFeedResult feedResult); - - /** - * Gets a Feed Handler object registered using addFeedResult. - * - * @param uri - * The URI of the feed a handler is being requested for - */ - nsIFeedResult getFeedResult(in nsIURI uri); - - /** - * Unregisters a Feed Handler object registered using addFeedResult. - * @param uri - * The feed URI the handler was registered under. This must be - * the same *instance* the feed was registered under. - */ - void removeFeedResult(in nsIURI uri); -}; diff --git a/components/feeds/nsIWebContentConverterRegistrar.idl b/components/feeds/nsIWebContentConverterRegistrar.idl deleted file mode 100644 index 08ce2f4..0000000 --- a/components/feeds/nsIWebContentConverterRegistrar.idl +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; 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 "nsIMIMEInfo.idl" -#include "nsIWebContentHandlerRegistrar.idl" - -interface nsIRequest; - -[scriptable, uuid(eb361098-5158-4b21-8f98-50b445f1f0b2)] -interface nsIWebContentHandlerInfo : nsIHandlerApp -{ - /** - * The content type handled by the handler - */ - readonly attribute AString contentType; - - /** - * The uri of the handler, with an embedded %s where the URI of the loaded - * document will be encoded. - */ - readonly attribute AString uri; - - /** - * Gets the service URL Spec, with the loading document URI encoded in it. - * @param uri - * The URI of the document being loaded - * @returns The URI of the service with the loading document URI encoded in - * it. - */ - AString getHandlerURI(in AString uri); -}; - -[scriptable, uuid(de7cc06e-e778-45cb-b7db-7a114e1e75b1)] -interface nsIWebContentConverterService : nsIWebContentHandlerRegistrar -{ - /** - * Specifies the handler to be used to automatically handle all links of a - * certain content type from now on. - * @param contentType - * The content type to automatically load with the specified handler - * @param handler - * A web service handler. If this is null, no automatic action is - * performed and the user must choose. - * @throws NS_ERROR_NOT_AVAILABLE if the service refered to by |handler| is - * not already registered. - */ - void setAutoHandler(in AString contentType, in nsIWebContentHandlerInfo handler); - - /** - * Gets the auto handler specified for a particular content type - * @param contentType - * The content type to look up an auto handler for. - * @returns The web service handler that will automatically handle all - * documents of the specified type. null if there is no automatic - * handler. (Handlers may be registered, just none of them specified - * as "automatic"). - */ - nsIWebContentHandlerInfo getAutoHandler(in AString contentType); - - /** - * Gets a web handler for the specified service URI - * @param contentType - * The content type of the service being located - * @param uri - * The service URI of the handler to locate. - * @returns A web service handler that uses the specified uri. - */ - nsIWebContentHandlerInfo getWebContentHandlerByURI(in AString contentType, - in AString uri); - - /** - * Loads the preferred handler when content of a registered type is about - * to be loaded. - * @param request - * The nsIRequest for the load of the content - */ - void loadPreferredHandler(in nsIRequest request); - - /** - * Removes a registered protocol handler - * @param protocol - * The protocol scheme to remove a service handler for - * @param uri - * The uri of the service handler to remove - */ - void removeProtocolHandler(in AString protocol, in AString uri); - - /** - * Removes a registered content handler - * @param contentType - * The content type to remove a service handler for - * @param uri - * The uri of the service handler to remove - */ - void removeContentHandler(in AString contentType, in AString uri); - - /** - * Gets the list of content handlers for a particular type. - * @param contentType - * The content type to get handlers for - * @returns An array of nsIWebContentHandlerInfo objects - */ - void getContentHandlers(in AString contentType, - [optional] out unsigned long count, - [retval,array,size_is(count)] out nsIWebContentHandlerInfo handlers); - - /** - * Resets the list of available content handlers to the default set from - * the distribution. - * @param contentType - * The content type to reset handlers for - */ - void resetHandlersForType(in AString contentType); -}; - diff --git a/components/fuel/fuelApplication.js b/components/fuel/fuelApplication.js deleted file mode 100644 index bc3a091..0000000 --- a/components/fuel/fuelApplication.js +++ /dev/null @@ -1,822 +0,0 @@ -/* 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/. */ - -const Ci = Components.interfaces; -const Cc = Components.classes; - -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Deprecated", - "resource://gre/modules/Deprecated.jsm"); - -const APPLICATION_CID = Components.ID("fe74cf80-aa2d-11db-abbd-0800200c9a66"); -const APPLICATION_CONTRACTID = "@mozilla.org/fuel/application;1"; - -//================================================= -// Singleton that holds services and utilities -var Utilities = { - get bookmarks() { - let bookmarks = Cc["@mozilla.org/browser/nav-bookmarks-service;1"]. - getService(Ci.nsINavBookmarksService); - this.__defineGetter__("bookmarks", function() bookmarks); - return this.bookmarks; - }, - - get bookmarksObserver() { - let bookmarksObserver = new BookmarksObserver(); - this.__defineGetter__("bookmarksObserver", function() bookmarksObserver); - return this.bookmarksObserver; - }, - - get annotations() { - let annotations = Cc["@mozilla.org/browser/annotation-service;1"]. - getService(Ci.nsIAnnotationService); - this.__defineGetter__("annotations", function() annotations); - return this.annotations; - }, - - get history() { - let history = Cc["@mozilla.org/browser/nav-history-service;1"]. - getService(Ci.nsINavHistoryService); - this.__defineGetter__("history", function() history); - return this.history; - }, - - get windowMediator() { - let windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"]. - getService(Ci.nsIWindowMediator); - this.__defineGetter__("windowMediator", function() windowMediator); - return this.windowMediator; - }, - - makeURI: function fuelutil_makeURI(aSpec) { - if (!aSpec) - return null; - var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); - return ios.newURI(aSpec, null, null); - }, - - free: function fuelutil_free() { - delete this.bookmarks; - delete this.bookmarksObserver; - delete this.annotations; - delete this.history; - delete this.windowMediator; - } -}; - - -//================================================= -// Window implementation - -var fuelWindowMap = new WeakMap(); -function getWindow(aWindow) { - let fuelWindow = fuelWindowMap.get(aWindow); - if (!fuelWindow) { - fuelWindow = new Window(aWindow); - fuelWindowMap.set(aWindow, fuelWindow); - } - return fuelWindow; -} - -// Don't call new Window() directly; use getWindow instead. -function Window(aWindow) { - this._window = aWindow; - this._events = new Events(); - - this._watch("TabOpen"); - this._watch("TabMove"); - this._watch("TabClose"); - this._watch("TabSelect"); -} - -Window.prototype = { - get events() { - return this._events; - }, - - get _tabbrowser() { - return this._window.getBrowser(); - }, - - /* - * Helper used to setup event handlers on the XBL element. Note that the events - * are actually dispatched to tabs, so we capture them. - */ - _watch: function win_watch(aType) { - this._tabbrowser.tabContainer.addEventListener(aType, this, - /* useCapture = */ true); - }, - - handleEvent: function win_handleEvent(aEvent) { - this._events.dispatch(aEvent.type, getBrowserTab(this, aEvent.originalTarget.linkedBrowser)); - }, - - get tabs() { - var tabs = []; - var browsers = this._tabbrowser.browsers; - for (var i=0; i getWindow(Utilities.windowMediator.getMostRecentWindow("navigator:browser")), - enumerable: true, - configurable: true - }); - -}; - -// set the proto, defined in extApplication.js -ApplicationPrototype.prototype = extApplication.prototype; - -Application.prototype = new ApplicationPrototype(); - -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([Application]); - diff --git a/components/fuel/fuelApplication.manifest b/components/fuel/fuelApplication.manifest deleted file mode 100644 index 67e6d0f..0000000 --- a/components/fuel/fuelApplication.manifest +++ /dev/null @@ -1,3 +0,0 @@ -component {fe74cf80-aa2d-11db-abbd-0800200c9a66} fuelApplication.js -contract @mozilla.org/fuel/application;1 {fe74cf80-aa2d-11db-abbd-0800200c9a66} -category JavaScript-global-privileged-property Application @mozilla.org/fuel/application;1 diff --git a/components/fuel/fuelIApplication.idl b/components/fuel/fuelIApplication.idl deleted file mode 100644 index 69b51b0..0000000 --- a/components/fuel/fuelIApplication.idl +++ /dev/null @@ -1,347 +0,0 @@ -/* 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 "nsISupports.idl" -#include "extIApplication.idl" - -interface nsIVariant; -interface nsIURI; -interface nsIDOMHTMLDocument; - -interface fuelIBookmarkFolder; -interface fuelIBrowserTab; - -/** - * Interface representing a collection of annotations associated - * with a bookmark or bookmark folder. - */ -[scriptable, uuid(335c9292-91a1-4ca0-ad0b-07d5f63ed6cd)] -interface fuelIAnnotations : nsISupports -{ - /** - * Array of the annotation names associated with the owning item - */ - readonly attribute nsIVariant names; - - /** - * Determines if an annotation exists with the given name. - * @param aName - * The name of the annotation - * @returns true if an annotation exists with the given name, - * false otherwise. - */ - boolean has(in AString aName); - - /** - * Gets the value of an annotation with the given name. - * @param aName - * The name of the annotation - * @returns A variant containing the value of the annotation. Supports - * string, boolean and number. - */ - nsIVariant get(in AString aName); - - /** - * Sets the value of an annotation with the given name. - * @param aName - * The name of the annotation - * @param aValue - * The new value of the annotation. Supports string, boolean - * and number - * @param aExpiration - * The expiration policy for the annotation. - * See nsIAnnotationService. - */ - void set(in AString aName, in nsIVariant aValue, in int32_t aExpiration); - - /** - * Removes the named annotation from the owner item. - * @param aName - * The name of annotation. - */ - void remove(in AString aName); -}; - - -/** - * Interface representing a bookmark item. - */ -[scriptable, uuid(808585b6-7568-4b26-8c62-545221bf2b8c)] -interface fuelIBookmark : nsISupports -{ - /** - * The id of the bookmark. - */ - readonly attribute long long id; - - /** - * The title of the bookmark. - */ - attribute AString title; - - /** - * The uri of the bookmark. - */ - attribute nsIURI uri; - - /** - * The description of the bookmark. - */ - attribute AString description; - - /** - * The keyword associated with the bookmark. - */ - attribute AString keyword; - - /** - * The type of the bookmark. - * values: "bookmark", "separator" - */ - readonly attribute AString type; - - /** - * The parent folder of the bookmark. - */ - attribute fuelIBookmarkFolder parent; - - /** - * The annotations object for the bookmark. - */ - readonly attribute fuelIAnnotations annotations; - - /** - * The events object for the bookmark. - * supports: "remove", "change", "visit", "move" - */ - readonly attribute extIEvents events; - - /** - * Removes the item from the parent folder. Used to - * delete a bookmark or separator - */ - void remove(); -}; - - -/** - * Interface representing a bookmark folder. Folders - * can hold bookmarks, separators and other folders. - */ -[scriptable, uuid(9f42fe20-52de-4a55-8632-a459c7716aa0)] -interface fuelIBookmarkFolder : nsISupports -{ - /** - * The id of the folder. - */ - readonly attribute long long id; - - /** - * The title of the folder. - */ - attribute AString title; - - /** - * The description of the folder. - */ - attribute AString description; - - /** - * The type of the folder. - * values: "folder" - */ - readonly attribute AString type; - - /** - * The parent folder of the folder. - */ - attribute fuelIBookmarkFolder parent; - - /** - * The annotations object for the folder. - */ - readonly attribute fuelIAnnotations annotations; - - /** - * The events object for the folder. - * supports: "add", "addchild", "remove", "removechild", "change", "move" - */ - readonly attribute extIEvents events; - - /** - * Array of all bookmarks, separators and folders contained - * in this folder. - */ - readonly attribute nsIVariant children; - - /** - * Adds a new child bookmark to this folder. - * @param aTitle - * The title of bookmark. - * @param aURI - * The uri of bookmark. - */ - fuelIBookmark addBookmark(in AString aTitle, in nsIURI aURI); - - /** - * Adds a new child separator to this folder. - */ - fuelIBookmark addSeparator(); - - /** - * Adds a new child folder to this folder. - * @param aTitle - * The title of folder. - */ - fuelIBookmarkFolder addFolder(in AString aTitle); - - /** - * Removes the folder from the parent folder. - */ - void remove(); -}; - -/** - * Interface representing a container for bookmark roots. Roots - * are the top level parents for the various types of bookmarks in the system. - */ -[scriptable, uuid(c9a80870-eb3c-11dc-95ff-0800200c9a66)] -interface fuelIBookmarkRoots : nsISupports -{ - /** - * The folder for the 'bookmarks menu' root. - */ - readonly attribute fuelIBookmarkFolder menu; - - /** - * The folder for the 'personal toolbar' root. - */ - readonly attribute fuelIBookmarkFolder toolbar; - - /** - * The folder for the 'tags' root. - */ - readonly attribute fuelIBookmarkFolder tags; - - /** - * The folder for the 'unfiled bookmarks' root. - */ - readonly attribute fuelIBookmarkFolder unfiled; -}; - -/** - * Interface representing a browser window. - */ -[scriptable, uuid(207edb28-eb5e-424e-a862-b0e97C8de866)] -interface fuelIWindow : nsISupports -{ - /** - * A collection of browser tabs within the browser window. - */ - readonly attribute nsIVariant tabs; - - /** - * The currently-active tab within the browser window. - */ - readonly attribute fuelIBrowserTab activeTab; - - /** - * Open a new browser tab, pointing to the specified URI. - * @param aURI - * The uri to open the browser tab to - */ - fuelIBrowserTab open(in nsIURI aURI); - - /** - * The events object for the browser window. - * supports: "TabOpen", "TabClose", "TabMove", "TabSelect" - */ - readonly attribute extIEvents events; -}; - -/** - * Interface representing a browser tab. - */ -[scriptable, uuid(3073ceff-777c-41ce-9ace-ab37268147c1)] -interface fuelIBrowserTab : nsISupports -{ - /** - * The current uri of this tab. - */ - readonly attribute nsIURI uri; - - /** - * The current index of this tab in the browser window. - */ - readonly attribute int32_t index; - - /** - * The browser window that is holding the tab. - */ - readonly attribute fuelIWindow window; - - /** - * The content document of the browser tab. - */ - readonly attribute nsIDOMHTMLDocument document; - - /** - * The events object for the browser tab. - * supports: "load" - */ - readonly attribute extIEvents events; - - /** - * Load a new URI into this browser tab. - * @param aURI - * The uri to load into the browser tab - */ - void load(in nsIURI aURI); - - /** - * Give focus to this browser tab, and bring it to the front. - */ - void focus(); - - /** - * Close the browser tab. This may not actually close the tab - * as script may abort the close operation. - */ - void close(); - - /** - * Moves this browser tab before another browser tab within the window. - * @param aBefore - * The tab before which the target tab will be moved - */ - void moveBefore(in fuelIBrowserTab aBefore); - - /** - * Move this browser tab to the last tab within the window. - */ - void moveToEnd(); -}; - -/** - * Interface for managing and accessing the applications systems - */ -[scriptable, uuid(fe74cf80-aa2d-11db-abbd-0800200c9a66)] -interface fuelIApplication : extIApplication -{ - /** - * The root bookmarks object for the application. - * Contains all the bookmark roots in the system. - */ - readonly attribute fuelIBookmarkRoots bookmarks; - - /** - * An array of browser windows within the application. - */ - readonly attribute nsIVariant windows; - - /** - * The currently active browser window. - */ - readonly attribute fuelIWindow activeWindow; -}; diff --git a/components/fuel/moz.build b/components/fuel/moz.build deleted file mode 100644 index 5c468f2..0000000 --- a/components/fuel/moz.build +++ /dev/null @@ -1,14 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; 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/. - -XPIDL_SOURCES += ['fuelIApplication.idl'] - -XPIDL_MODULE = 'fuel' - -EXTRA_COMPONENTS += ['fuelApplication.manifest'] - -EXTRA_PP_COMPONENTS += ['fuelApplication.js'] - diff --git a/components/moz.build b/components/moz.build deleted file mode 100644 index 48d4552..0000000 --- a/components/moz.build +++ /dev/null @@ -1,47 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; 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 += [ - 'abouthome', - 'certerror', - 'dirprovider', - 'downloads', - 'feeds', - 'fuel', - 'newtab', - 'pageinfo', - 'places', - 'permissions', - 'preferences', - 'privatebrowsing', - 'search', - 'sessionstore', - 'shell', - 'statusbar', -] - -if CONFIG['MOZ_SERVICES_SYNC']: - DIRS += ['sync'] - -DIRS += ['build'] - -XPIDL_SOURCES += [ - 'nsIBrowserGlue.idl', - 'nsIBrowserHandler.idl', -] - -XPIDL_MODULE = 'browsercompsbase' - -EXTRA_PP_COMPONENTS += [ - 'BrowserComponents.manifest', - 'nsAboutRedirector.js', - 'nsBrowserContentHandler.js', - 'nsBrowserGlue.js', -] - -EXTRA_JS_MODULES += [ - 'distribution.js', -] \ No newline at end of file diff --git a/components/newtab/cells.js b/components/newtab/cells.js deleted file mode 100644 index 47d4ef5..0000000 --- a/components/newtab/cells.js +++ /dev/null @@ -1,126 +0,0 @@ -#ifdef 0 -/* 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/. */ -#endif - -/** - * This class manages a cell's DOM node (not the actually cell content, a site). - * It's mostly read-only, i.e. all manipulation of both position and content - * aren't handled here. - */ -function Cell(aGrid, aNode) { - this._grid = aGrid; - this._node = aNode; - this._node._newtabCell = this; - - // Register drag-and-drop event handlers. - ["dragenter", "dragover", "dragexit", "drop"].forEach(function (aType) { - this._node.addEventListener(aType, this, false); - }, this); -} - -Cell.prototype = { - /** - * The grid. - */ - _grid: null, - - /** - * The cell's DOM node. - */ - get node() { return this._node; }, - - /** - * The cell's offset in the grid. - */ - get index() { - let index = this._grid.cells.indexOf(this); - - // Cache this value, overwrite the getter. - Object.defineProperty(this, "index", {value: index, enumerable: true}); - - return index; - }, - - /** - * The previous cell in the grid. - */ - get previousSibling() { - let prev = this.node.previousElementSibling; - prev = prev && prev._newtabCell; - - // Cache this value, overwrite the getter. - Object.defineProperty(this, "previousSibling", {value: prev, enumerable: true}); - - return prev; - }, - - /** - * The next cell in the grid. - */ - get nextSibling() { - let next = this.node.nextElementSibling; - next = next && next._newtabCell; - - // Cache this value, overwrite the getter. - Object.defineProperty(this, "nextSibling", {value: next, enumerable: true}); - - return next; - }, - - /** - * The site contained in the cell, if any. - */ - get site() { - let firstChild = this.node.firstElementChild; - return firstChild && firstChild._newtabSite; - }, - - /** - * Checks whether the cell contains a pinned site. - * @return Whether the cell contains a pinned site. - */ - containsPinnedSite: function Cell_containsPinnedSite() { - let site = this.site; - return site && site.isPinned(); - }, - - /** - * Checks whether the cell contains a site (is empty). - * @return Whether the cell is empty. - */ - isEmpty: function Cell_isEmpty() { - return !this.site; - }, - - /** - * Handles all cell events. - */ - handleEvent: function Cell_handleEvent(aEvent) { - // We're not responding to external drag/drop events - // when our parent window is in private browsing mode. - if (inPrivateBrowsingMode() && !gDrag.draggedSite) - return; - - if (aEvent.type != "dragexit" && !gDrag.isValid(aEvent)) - return; - - switch (aEvent.type) { - case "dragenter": - aEvent.preventDefault(); - gDrop.enter(this, aEvent); - break; - case "dragover": - aEvent.preventDefault(); - break; - case "dragexit": - gDrop.exit(this, aEvent); - break; - case "drop": - aEvent.preventDefault(); - gDrop.drop(this, aEvent); - break; - } - } -}; diff --git a/components/newtab/drag.js b/components/newtab/drag.js deleted file mode 100644 index e3928eb..0000000 --- a/components/newtab/drag.js +++ /dev/null @@ -1,151 +0,0 @@ -#ifdef 0 -/* 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/. */ -#endif - -/** - * This singleton implements site dragging functionality. - */ -var gDrag = { - /** - * The site offset to the drag start point. - */ - _offsetX: null, - _offsetY: null, - - /** - * The site that is dragged. - */ - _draggedSite: null, - get draggedSite() { return this._draggedSite; }, - - /** - * The cell width/height at the point the drag started. - */ - _cellWidth: null, - _cellHeight: null, - get cellWidth() { return this._cellWidth; }, - get cellHeight() { return this._cellHeight; }, - - /** - * Start a new drag operation. - * @param aSite The site that's being dragged. - * @param aEvent The 'dragstart' event. - */ - start: function Drag_start(aSite, aEvent) { - this._draggedSite = aSite; - - // Mark nodes as being dragged. - let selector = ".newtab-site, .newtab-control, .newtab-thumbnail"; - let parentCell = aSite.node.parentNode; - let nodes = parentCell.querySelectorAll(selector); - for (let i = 0; i < nodes.length; i++) - nodes[i].setAttribute("dragged", "true"); - - parentCell.setAttribute("dragged", "true"); - - this._setDragData(aSite, aEvent); - - // Store the cursor offset. - let node = aSite.node; - let rect = node.getBoundingClientRect(); - this._offsetX = aEvent.clientX - rect.left; - this._offsetY = aEvent.clientY - rect.top; - - // Store the cell dimensions. - let cellNode = aSite.cell.node; - this._cellWidth = cellNode.offsetWidth; - this._cellHeight = cellNode.offsetHeight; - - gTransformation.freezeSitePosition(aSite); - }, - - /** - * Handles the 'drag' event. - * @param aSite The site that's being dragged. - * @param aEvent The 'drag' event. - */ - drag: function Drag_drag(aSite, aEvent) { - // Get the viewport size. - let {clientWidth, clientHeight} = document.documentElement; - - // We'll want a padding of 5px. - let border = 5; - - // Enforce minimum constraints to keep the drag image inside the window. - let left = Math.max(scrollX + aEvent.clientX - this._offsetX, border); - let top = Math.max(scrollY + aEvent.clientY - this._offsetY, border); - - // Enforce maximum constraints to keep the drag image inside the window. - left = Math.min(left, scrollX + clientWidth - this.cellWidth - border); - top = Math.min(top, scrollY + clientHeight - this.cellHeight - border); - - // Update the drag image's position. - gTransformation.setSitePosition(aSite, {left: left, top: top}); - }, - - /** - * Ends the current drag operation. - * @param aSite The site that's being dragged. - * @param aEvent The 'dragend' event. - */ - end: function Drag_end(aSite, aEvent) { - let nodes = gGrid.node.querySelectorAll("[dragged]") - for (let i = 0; i < nodes.length; i++) - nodes[i].removeAttribute("dragged"); - - // Slide the dragged site back into its cell (may be the old or the new cell). - gTransformation.slideSiteTo(aSite, aSite.cell, {unfreeze: true}); - - this._draggedSite = null; - }, - - /** - * Checks whether we're responsible for a given drag event. - * @param aEvent The drag event to check. - * @return Whether we should handle this drag and drop operation. - */ - isValid: function Drag_isValid(aEvent) { - let link = gDragDataHelper.getLinkFromDragEvent(aEvent); - - // Check that the drag data is non-empty. - // Can happen when dragging places folders. - if (!link || !link.url) { - return false; - } - - // Check that we're not accepting URLs which would inherit the caller's - // principal (such as javascript: or data:). - return gLinkChecker.checkLoadURI(link.url); - }, - - /** - * Initializes the drag data for the current drag operation. - * @param aSite The site that's being dragged. - * @param aEvent The 'dragstart' event. - */ - _setDragData: function Drag_setDragData(aSite, aEvent) { - let {url, title} = aSite; - - let dt = aEvent.dataTransfer; - dt.mozCursor = "default"; - dt.effectAllowed = "move"; - dt.setData("text/plain", url); - dt.setData("text/uri-list", url); - dt.setData("text/x-moz-url", url + "\n" + title); - dt.setData("text/html", "" + url + ""); - - // Create and use an empty drag element. We don't want to use the default - // drag image with its default opacity. - let dragElement = document.createElementNS(HTML_NAMESPACE, "div"); - dragElement.classList.add("newtab-drag"); - let scrollbox = document.getElementById("newtab-vertical-margin"); - scrollbox.appendChild(dragElement); - dt.setDragImage(dragElement, 0, 0); - - // After the 'dragstart' event has been processed we can remove the - // temporary drag element from the DOM. - setTimeout(() => scrollbox.removeChild(dragElement), 0); - } -}; diff --git a/components/newtab/dragDataHelper.js b/components/newtab/dragDataHelper.js deleted file mode 100644 index 675ff26..0000000 --- a/components/newtab/dragDataHelper.js +++ /dev/null @@ -1,22 +0,0 @@ -#ifdef 0 -/* 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/. */ -#endif - -var gDragDataHelper = { - get mimeType() { - return "text/x-moz-url"; - }, - - getLinkFromDragEvent: function DragDataHelper_getLinkFromDragEvent(aEvent) { - let dt = aEvent.dataTransfer; - if (!dt || !dt.types.includes(this.mimeType)) { - return null; - } - - let data = dt.getData(this.mimeType) || ""; - let [url, title] = data.split(/[\r\n]+/); - return {url: url, title: title}; - } -}; diff --git a/components/newtab/drop.js b/components/newtab/drop.js deleted file mode 100644 index 7486524..0000000 --- a/components/newtab/drop.js +++ /dev/null @@ -1,150 +0,0 @@ -#ifdef 0 -/* 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/. */ -#endif - -// A little delay that prevents the grid from being too sensitive when dragging -// sites around. -const DELAY_REARRANGE_MS = 100; - -/** - * This singleton implements site dropping functionality. - */ -var gDrop = { - /** - * The last drop target. - */ - _lastDropTarget: null, - - /** - * Handles the 'dragenter' event. - * @param aCell The drop target cell. - */ - enter: function Drop_enter(aCell) { - this._delayedRearrange(aCell); - }, - - /** - * Handles the 'dragexit' event. - * @param aCell The drop target cell. - * @param aEvent The 'dragexit' event. - */ - exit: function Drop_exit(aCell, aEvent) { - if (aEvent.dataTransfer && !aEvent.dataTransfer.mozUserCancelled) { - this._delayedRearrange(); - } else { - // The drag operation has been cancelled. - this._cancelDelayedArrange(); - this._rearrange(); - } - }, - - /** - * Handles the 'drop' event. - * @param aCell The drop target cell. - * @param aEvent The 'dragexit' event. - */ - drop: function Drop_drop(aCell, aEvent) { - // The cell that is the drop target could contain a pinned site. We need - // to find out where that site has gone and re-pin it there. - if (aCell.containsPinnedSite()) - this._repinSitesAfterDrop(aCell); - - // Pin the dragged or insert the new site. - this._pinDraggedSite(aCell, aEvent); - - this._cancelDelayedArrange(); - - // Update the grid and move all sites to their new places. - gUpdater.updateGrid(); - }, - - /** - * Re-pins all pinned sites in their (new) positions. - * @param aCell The drop target cell. - */ - _repinSitesAfterDrop: function Drop_repinSitesAfterDrop(aCell) { - let sites = gDropPreview.rearrange(aCell); - - // Filter out pinned sites. - let pinnedSites = sites.filter(function (aSite) { - return aSite && aSite.isPinned(); - }); - - // Re-pin all shifted pinned cells. - pinnedSites.forEach(aSite => aSite.pin(sites.indexOf(aSite))); - }, - - /** - * Pins the dragged site in its new place. - * @param aCell The drop target cell. - * @param aEvent The 'dragexit' event. - */ - _pinDraggedSite: function Drop_pinDraggedSite(aCell, aEvent) { - let index = aCell.index; - let draggedSite = gDrag.draggedSite; - - if (draggedSite) { - // Pin the dragged site at its new place. - if (aCell != draggedSite.cell) - draggedSite.pin(index); - } else { - let link = gDragDataHelper.getLinkFromDragEvent(aEvent); - if (link) { - // A new link was dragged onto the grid. Create it by pinning its URL. - gPinnedLinks.pin(link, index); - - // Make sure the newly added link is not blocked. - gBlockedLinks.unblock(link); - } - } - }, - - /** - * Time a rearrange with a little delay. - * @param aCell The drop target cell. - */ - _delayedRearrange: function Drop_delayedRearrange(aCell) { - // The last drop target didn't change so there's no need to re-arrange. - if (this._lastDropTarget == aCell) - return; - - let self = this; - - function callback() { - self._rearrangeTimeout = null; - self._rearrange(aCell); - } - - this._cancelDelayedArrange(); - this._rearrangeTimeout = setTimeout(callback, DELAY_REARRANGE_MS); - - // Store the last drop target. - this._lastDropTarget = aCell; - }, - - /** - * Cancels a timed rearrange, if any. - */ - _cancelDelayedArrange: function Drop_cancelDelayedArrange() { - if (this._rearrangeTimeout) { - clearTimeout(this._rearrangeTimeout); - this._rearrangeTimeout = null; - } - }, - - /** - * Rearrange all sites in the grid depending on the current drop target. - * @param aCell The drop target cell. - */ - _rearrange: function Drop_rearrange(aCell) { - let sites = gGrid.sites; - - // We need to rearrange the grid only if there's a current drop target. - if (aCell) - sites = gDropPreview.rearrange(aCell); - - gTransformation.rearrangeSites(sites, {unfreeze: !aCell}); - } -}; diff --git a/components/newtab/dropPreview.js b/components/newtab/dropPreview.js deleted file mode 100644 index fd7587a..0000000 --- a/components/newtab/dropPreview.js +++ /dev/null @@ -1,222 +0,0 @@ -#ifdef 0 -/* 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/. */ -#endif - -/** - * This singleton provides the ability to re-arrange the current grid to - * indicate the transformation that results from dropping a cell at a certain - * position. - */ -var gDropPreview = { - /** - * Rearranges the sites currently contained in the grid when a site would be - * dropped onto the given cell. - * @param aCell The drop target cell. - * @return The re-arranged array of sites. - */ - rearrange: function DropPreview_rearrange(aCell) { - let sites = gGrid.sites; - - // Insert the dragged site into the current grid. - this._insertDraggedSite(sites, aCell); - - // After the new site has been inserted we need to correct the positions - // of all pinned tabs that have been moved around. - this._repositionPinnedSites(sites, aCell); - - return sites; - }, - - /** - * Inserts the currently dragged site into the given array of sites. - * @param aSites The array of sites to insert into. - * @param aCell The drop target cell. - */ - _insertDraggedSite: function DropPreview_insertDraggedSite(aSites, aCell) { - let dropIndex = aCell.index; - let draggedSite = gDrag.draggedSite; - - // We're currently dragging a site. - if (draggedSite) { - let dragCell = draggedSite.cell; - let dragIndex = dragCell.index; - - // Move the dragged site into its new position. - if (dragIndex != dropIndex) { - aSites.splice(dragIndex, 1); - aSites.splice(dropIndex, 0, draggedSite); - } - // We're handling an external drag item. - } else { - aSites.splice(dropIndex, 0, null); - } - }, - - /** - * Correct the position of all pinned sites that might have been moved to - * different positions after the dragged site has been inserted. - * @param aSites The array of sites containing the dragged site. - * @param aCell The drop target cell. - */ - _repositionPinnedSites: - function DropPreview_repositionPinnedSites(aSites, aCell) { - - // Collect all pinned sites. - let pinnedSites = this._filterPinnedSites(aSites, aCell); - - // Correct pinned site positions. - pinnedSites.forEach(function (aSite) { - aSites[aSites.indexOf(aSite)] = aSites[aSite.cell.index]; - aSites[aSite.cell.index] = aSite; - }, this); - - // There might be a pinned cell that got pushed out of the grid, try to - // sneak it in by removing a lower-priority cell. - if (this._hasOverflowedPinnedSite(aSites, aCell)) - this._repositionOverflowedPinnedSite(aSites, aCell); - }, - - /** - * Filter pinned sites out of the grid that are still on their old positions - * and have not moved. - * @param aSites The array of sites to filter. - * @param aCell The drop target cell. - * @return The filtered array of sites. - */ - _filterPinnedSites: function DropPreview_filterPinnedSites(aSites, aCell) { - let draggedSite = gDrag.draggedSite; - - // When dropping on a cell that contains a pinned site make sure that all - // pinned cells surrounding the drop target are moved as well. - let range = this._getPinnedRange(aCell); - - return aSites.filter(function (aSite, aIndex) { - // The site must be valid, pinned and not the dragged site. - if (!aSite || aSite == draggedSite || !aSite.isPinned()) - return false; - - let index = aSite.cell.index; - - // If it's not in the 'pinned range' it's a valid pinned site. - return (index > range.end || index < range.start); - }); - }, - - /** - * Determines the range of pinned sites surrounding the drop target cell. - * @param aCell The drop target cell. - * @return The range of pinned cells. - */ - _getPinnedRange: function DropPreview_getPinnedRange(aCell) { - let dropIndex = aCell.index; - let range = {start: dropIndex, end: dropIndex}; - - // We need a pinned range only when dropping on a pinned site. - if (aCell.containsPinnedSite()) { - let links = gPinnedLinks.links; - - // Find all previous siblings of the drop target that are pinned as well. - while (range.start && links[range.start - 1]) - range.start--; - - let maxEnd = links.length - 1; - - // Find all next siblings of the drop target that are pinned as well. - while (range.end < maxEnd && links[range.end + 1]) - range.end++; - } - - return range; - }, - - /** - * Checks if the given array of sites contains a pinned site that has - * been pushed out of the grid. - * @param aSites The array of sites to check. - * @param aCell The drop target cell. - * @return Whether there is an overflowed pinned cell. - */ - _hasOverflowedPinnedSite: - function DropPreview_hasOverflowedPinnedSite(aSites, aCell) { - - // If the drop target isn't pinned there's no way a pinned site has been - // pushed out of the grid so we can just exit here. - if (!aCell.containsPinnedSite()) - return false; - - let cells = gGrid.cells; - - // No cells have been pushed out of the grid, nothing to do here. - if (aSites.length <= cells.length) - return false; - - let overflowedSite = aSites[cells.length]; - - // Nothing to do if the site that got pushed out of the grid is not pinned. - return (overflowedSite && overflowedSite.isPinned()); - }, - - /** - * We have a overflowed pinned site that we need to re-position so that it's - * visible again. We try to find a lower-priority cell (empty or containing - * an unpinned site) that we can move it to. - * @param aSites The array of sites. - * @param aCell The drop target cell. - */ - _repositionOverflowedPinnedSite: - function DropPreview_repositionOverflowedPinnedSite(aSites, aCell) { - - // Try to find a lower-priority cell (empty or containing an unpinned site). - let index = this._indexOfLowerPrioritySite(aSites, aCell); - - if (index > -1) { - let cells = gGrid.cells; - let dropIndex = aCell.index; - - // Move all pinned cells to their new positions to let the overflowed - // site fit into the grid. - for (let i = index + 1, lastPosition = index; i < aSites.length; i++) { - if (i != dropIndex) { - aSites[lastPosition] = aSites[i]; - lastPosition = i; - } - } - - // Finally, remove the overflowed site from its previous position. - aSites.splice(cells.length, 1); - } - }, - - /** - * Finds the index of the last cell that is empty or contains an unpinned - * site. These are considered to be of a lower priority. - * @param aSites The array of sites. - * @param aCell The drop target cell. - * @return The cell's index. - */ - _indexOfLowerPrioritySite: - function DropPreview_indexOfLowerPrioritySite(aSites, aCell) { - - let cells = gGrid.cells; - let dropIndex = aCell.index; - - // Search (beginning with the last site in the grid) for a site that is - // empty or unpinned (an thus lower-priority) and can be pushed out of the - // grid instead of the pinned site. - for (let i = cells.length - 1; i >= 0; i--) { - // The cell that is our drop target is not a good choice. - if (i == dropIndex) - continue; - - let site = aSites[i]; - - // We can use the cell only if it's empty or the site is un-pinned. - if (!site || !site.isPinned()) - return i; - } - - return -1; - } -}; diff --git a/components/newtab/dropTargetShim.js b/components/newtab/dropTargetShim.js deleted file mode 100644 index 57a97fa..0000000 --- a/components/newtab/dropTargetShim.js +++ /dev/null @@ -1,232 +0,0 @@ -#ifdef 0 -/* 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/. */ -#endif - -/** - * This singleton provides a custom drop target detection. We need this because - * the default DnD target detection relies on the cursor's position. We want - * to pick a drop target based on the dragged site's position. - */ -var gDropTargetShim = { - /** - * Cache for the position of all cells, cleaned after drag finished. - */ - _cellPositions: null, - - /** - * The last drop target that was hovered. - */ - _lastDropTarget: null, - - /** - * Initializes the drop target shim. - */ - init: function () { - gGrid.node.addEventListener("dragstart", this, true); - }, - - /** - * Add all event listeners needed during a drag operation. - */ - _addEventListeners: function () { - gGrid.node.addEventListener("dragend", this); - - let docElement = document.documentElement; - docElement.addEventListener("dragover", this); - docElement.addEventListener("dragenter", this); - docElement.addEventListener("drop", this); - }, - - /** - * Remove all event listeners that were needed during a drag operation. - */ - _removeEventListeners: function () { - gGrid.node.removeEventListener("dragend", this); - - let docElement = document.documentElement; - docElement.removeEventListener("dragover", this); - docElement.removeEventListener("dragenter", this); - docElement.removeEventListener("drop", this); - }, - - /** - * Handles all shim events. - */ - handleEvent: function (aEvent) { - switch (aEvent.type) { - case "dragstart": - this._dragstart(aEvent); - break; - case "dragenter": - aEvent.preventDefault(); - break; - case "dragover": - this._dragover(aEvent); - break; - case "drop": - this._drop(aEvent); - break; - case "dragend": - this._dragend(aEvent); - break; - } - }, - - /** - * Handles the 'dragstart' event. - * @param aEvent The 'dragstart' event. - */ - _dragstart: function (aEvent) { - if (aEvent.target.classList.contains("newtab-link")) { - gGrid.lock(); - this._addEventListeners(); - } - }, - - /** - * Handles the 'dragover' event. - * @param aEvent The 'dragover' event. - */ - _dragover: function (aEvent) { - // XXX bug 505521 - Use the dragover event to retrieve the - // current mouse coordinates while dragging. - let sourceNode = aEvent.dataTransfer.mozSourceNode.parentNode; - gDrag.drag(sourceNode._newtabSite, aEvent); - - // Find the current drop target, if there's one. - this._updateDropTarget(aEvent); - - // If we have a valid drop target, - // let the drag-and-drop service know. - if (this._lastDropTarget) { - aEvent.preventDefault(); - } - }, - - /** - * Handles the 'drop' event. - * @param aEvent The 'drop' event. - */ - _drop: function (aEvent) { - // We're accepting all drops. - aEvent.preventDefault(); - - // remember that drop event was seen, this explicitly - // assumes that drop event preceeds dragend event - this._dropSeen = true; - - // Make sure to determine the current drop target - // in case the dragover event hasn't been fired. - this._updateDropTarget(aEvent); - - // A site was successfully dropped. - this._dispatchEvent(aEvent, "drop", this._lastDropTarget); - }, - - /** - * Handles the 'dragend' event. - * @param aEvent The 'dragend' event. - */ - _dragend: function (aEvent) { - if (this._lastDropTarget) { - if (aEvent.dataTransfer.mozUserCancelled || !this._dropSeen) { - // The drag operation was cancelled or no drop event was generated - this._dispatchEvent(aEvent, "dragexit", this._lastDropTarget); - this._dispatchEvent(aEvent, "dragleave", this._lastDropTarget); - } - - // Clean up. - this._lastDropTarget = null; - this._cellPositions = null; - } - - this._dropSeen = false; - gGrid.unlock(); - this._removeEventListeners(); - }, - - /** - * Tries to find the current drop target and will fire - * appropriate dragenter, dragexit, and dragleave events. - * @param aEvent The current drag event. - */ - _updateDropTarget: function (aEvent) { - // Let's see if we find a drop target. - let target = this._findDropTarget(aEvent); - - if (target != this._lastDropTarget) { - if (this._lastDropTarget) - // We left the last drop target. - this._dispatchEvent(aEvent, "dragexit", this._lastDropTarget); - - if (target) - // We're now hovering a (new) drop target. - this._dispatchEvent(aEvent, "dragenter", target); - - if (this._lastDropTarget) - // We left the last drop target. - this._dispatchEvent(aEvent, "dragleave", this._lastDropTarget); - - this._lastDropTarget = target; - } - }, - - /** - * Determines the current drop target by matching the dragged site's position - * against all cells in the grid. - * @return The currently hovered drop target or null. - */ - _findDropTarget: function () { - // These are the minimum intersection values - we want to use the cell if - // the site is >= 50% hovering its position. - let minWidth = gDrag.cellWidth / 2; - let minHeight = gDrag.cellHeight / 2; - - let cellPositions = this._getCellPositions(); - let rect = gTransformation.getNodePosition(gDrag.draggedSite.node); - - // Compare each cell's position to the dragged site's position. - for (let i = 0; i < cellPositions.length; i++) { - let inter = rect.intersect(cellPositions[i].rect); - - // If the intersection is big enough we found a drop target. - if (inter.width >= minWidth && inter.height >= minHeight) - return cellPositions[i].cell; - } - - // No drop target found. - return null; - }, - - /** - * Gets the positions of all cell nodes. - * @return The (cached) cell positions. - */ - _getCellPositions: function DropTargetShim_getCellPositions() { - if (this._cellPositions) - return this._cellPositions; - - return this._cellPositions = gGrid.cells.map(function (cell) { - return {cell: cell, rect: gTransformation.getNodePosition(cell.node)}; - }); - }, - - /** - * Dispatches a custom DragEvent on the given target node. - * @param aEvent The source event. - * @param aType The event type. - * @param aTarget The target node that receives the event. - */ - _dispatchEvent: function (aEvent, aType, aTarget) { - let node = aTarget.node; - let event = document.createEvent("DragEvent"); - - // The event should not bubble to prevent recursion. - event.initDragEvent(aType, false, true, window, 0, 0, 0, 0, 0, false, false, - false, false, 0, node, aEvent.dataTransfer); - - node.dispatchEvent(event); - } -}; diff --git a/components/newtab/grid.js b/components/newtab/grid.js deleted file mode 100644 index e63ea54..0000000 --- a/components/newtab/grid.js +++ /dev/null @@ -1,175 +0,0 @@ -#ifdef 0 -/* 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/. */ -#endif - -/** - * This singleton represents the grid that contains all sites. - */ -var gGrid = { - /** - * The DOM node of the grid. - */ - _node: null, - _gridDefaultContent: null, - get node() { return this._node; }, - - /** - * The cached DOM fragment for sites. - */ - _siteFragment: null, - - /** - * All cells contained in the grid. - */ - _cells: [], - get cells() { return this._cells; }, - - /** - * All sites contained in the grid's cells. Sites may be empty. - */ - get sites() { - // return [for (cell of this.cells) cell.site]; - let aSites = []; - for (let cell of this.cells) { - aSites.push(cell.site); - } - return aSites; - }, - - // Tells whether the grid has already been initialized. - get ready() { return !!this._ready; }, - - // Returns whether the page has finished loading yet. - get isDocumentLoaded() { return document.readyState == "complete"; }, - - /** - * Initializes the grid. - * @param aSelector The query selector of the grid. - */ - init: function Grid_init() { - this._node = document.getElementById("newtab-grid"); - this._gridDefaultContent = this._node.lastChild; - this._createSiteFragment(); - - gLinks.populateCache(() => { - this._refreshGrid(); - this._ready = true; - }); - }, - - /** - * Creates a new site in the grid. - * @param aLink The new site's link. - * @param aCell The cell that will contain the new site. - * @return The newly created site. - */ - createSite: function Grid_createSite(aLink, aCell) { - let node = aCell.node; - node.appendChild(this._siteFragment.cloneNode(true)); - return new Site(node.firstElementChild, aLink); - }, - - /** - * Handles all grid events. - */ - handleEvent: function Grid_handleEvent(aEvent) { - // Any specific events should go here. - }, - - /** - * Locks the grid to block all pointer events. - */ - lock: function Grid_lock() { - this.node.setAttribute("locked", "true"); - }, - - /** - * Unlocks the grid to allow all pointer events. - */ - unlock: function Grid_unlock() { - this.node.removeAttribute("locked"); - }, - - /** - * Renders the grid. - */ - refresh() { - this._refreshGrid(); - }, - - /** - * Renders the grid, including cells and sites. - */ - _refreshGrid() { - let row = document.createElementNS(HTML_NAMESPACE, "div"); - row.classList.add("newtab-row"); - let cell = document.createElementNS(HTML_NAMESPACE, "div"); - cell.classList.add("newtab-cell"); - - // Clear the grid - this._node.innerHTML = ""; - - // Creates the structure of one row - for (let i = 0; i < gGridPrefs.gridColumns; i++) { - row.appendChild(cell.cloneNode(true)); - } - - // Creates the grid - for (let j = 0; j < gGridPrefs.gridRows; j++) { - this._node.appendChild(row.cloneNode(true)); - } - - // Create cell array. - let cellElements = this.node.querySelectorAll(".newtab-cell"); - let cells = Array.from(cellElements, (cell) => new Cell(this, cell)); - - // Fetch links. - let links = gLinks.getLinks(); - - // Create sites. - let numLinks = Math.min(links.length, cells.length); - for (let i = 0; i < numLinks; i++) { - if (links[i]) { - this.createSite(links[i], cells[i]); - } - } - - this._cells = cells; - }, - - /** - * Creates the DOM fragment that is re-used when creating sites. - */ - _createSiteFragment: function Grid_createSiteFragment() { - let site = document.createElementNS(HTML_NAMESPACE, "div"); - site.classList.add("newtab-site"); - site.setAttribute("draggable", "true"); - - // Create the site's inner HTML code. - site.innerHTML = - '' + - ' ' + - ' ' + - ' ' + - '' + - '' + - ''; - - this._siteFragment = document.createDocumentFragment(); - this._siteFragment.appendChild(site); - }, - - /** - * Test a tile at a given position for being pinned or history - * @param position Position in sites array - */ - _isHistoricalTile: function Grid_isHistoricalTile(aPos) { - let site = this.sites[aPos]; - return site && (site.isPinned() || site.link && site.link.type == "history"); - } - -}; diff --git a/components/newtab/jar.mn b/components/newtab/jar.mn deleted file mode 100644 index 2d62914..0000000 --- a/components/newtab/jar.mn +++ /dev/null @@ -1,8 +0,0 @@ -# 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/. - -browser.jar: - content/browser/newtab/newTab.xhtml -* content/browser/newtab/newTab.js - content/browser/newtab/newTab.css \ No newline at end of file diff --git a/components/newtab/moz.build b/components/newtab/moz.build deleted file mode 100644 index 2d64d50..0000000 --- a/components/newtab/moz.build +++ /dev/null @@ -1,8 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; 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/. - -JAR_MANIFESTS += ['jar.mn'] - diff --git a/components/newtab/newTab.css b/components/newtab/newTab.css deleted file mode 100644 index 3c7cfa1..0000000 --- a/components/newtab/newTab.css +++ /dev/null @@ -1,349 +0,0 @@ -/* 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 { - width: 100%; - height: 100%; -} - -body { - font: message-box; - width: 100%; - height: 100%; - padding: 0; - margin: 0; - background-color: #F9F9F9; - display: -moz-box; - position: relative; - -moz-box-flex: 1; - -moz-user-focus: normal; - -moz-box-orient: vertical; -} - -input { - font: message-box; - font-size: 16px; -} - -input[type=button] { - cursor: pointer; -} - -/* UNDO */ -#newtab-undo-container { - transition: opacity 100ms ease-out; - -moz-box-align: center; - -moz-box-pack: center; -} - -#newtab-undo-container[undo-disabled] { - opacity: 0; - pointer-events: none; -} - -/* TOGGLE */ -#newtab-toggle { - position: absolute; - top: 12px; - right: 12px; -} - -#newtab-toggle:-moz-locale-dir(rtl) { - left: 12px; - right: auto; -} - -/* MARGINS */ -#newtab-vertical-margin { - display: -moz-box; - position: relative; - -moz-box-flex: 1; - -moz-box-orient: vertical; -} - -#newtab-margin-undo-container { - display: -moz-box; - left: 6px; - position: absolute; - top: 6px; - z-index: 1; -} - -#newtab-margin-undo-container:dir(rtl) { - left: auto; - right: 6px; -} - -#newtab-undo-close-button:dir(rtl) { - float:left; -} - -#newtab-horizontal-margin { - display: -moz-box; - -moz-box-flex: 5; -} - -#newtab-margin-top { - min-height: 10px; - max-height: 30px; - display: -moz-box; - -moz-box-flex: 1; - -moz-box-align: center; - -moz-box-pack: center; -} - -#newtab-margin-bottom { - min-height: 40px; - max-height: 80px; - -moz-box-flex: 1; -} - -.newtab-side-margin { - min-width: 40px; - max-width: 300px; - -moz-box-flex: 1; -} - -/* GRID */ -#newtab-grid { - display: -moz-box; - -moz-box-flex: 5; - -moz-box-orient: vertical; - min-width: 600px; - min-height: 400px; - transition: 175ms ease-out; - transition-property: opacity; -} - -#newtab-grid[page-disabled] { - opacity: 0; -} - -#newtab-grid[locked], -#newtab-grid[page-disabled] { - pointer-events: none; -} - -/* ROWS */ -.newtab-row { - display: -moz-box; - -moz-box-orient: horizontal; - -moz-box-direction: normal; - -moz-box-flex: 1; -} - -/* - * Thumbnail image sizes are determined in the preferences: - * toolkit.pageThumbs.minWidth - * toolkit.pageThumbs.minHeight - */ -/* CELLS */ -.newtab-cell { - display: -moz-box; - -moz-box-flex: 1; -} - -/* SITES */ -.newtab-site { - position: relative; - -moz-box-flex: 1; - transition: 150ms ease-out; - transition-property: top, left, opacity; -} - -.newtab-site[frozen] { - position: absolute; - pointer-events: none; -} - -.newtab-site[dragged] { - transition-property: none; - z-index: 10; -} - -/* LINK + THUMBNAILS */ -.newtab-link, -.newtab-thumbnail { - position: absolute; - left: 0; - top: 0; - right: 0; - bottom: 0; -} - -/* TITLES */ -.newtab-title { - overflow: hidden; - position: absolute; - right: 0; - text-align: center; -} - -.newtab-title { - bottom: 0; - white-space: nowrap; - text-overflow: ellipsis; - vertical-align: middle; -} - -.newtab-title { - left: 0; - padding: 0 4px; -} - -/* CONTROLS */ -.newtab-control { - position: absolute; - opacity: 0; - transition: opacity 100ms ease-out; -} - -.newtab-control:-moz-focusring, -.newtab-cell:not([ignorehover]) > .newtab-site:hover > .newtab-control { - opacity: 1; -} - -.newtab-control[dragged] { - opacity: 0 !important; -} - -@media (-moz-touch-enabled) { - .newtab-control { - opacity: 1; - } -} - -/* DRAG & DROP */ - -/* - * This is just a temporary drag element used for dataTransfer.setDragImage() - * so that we can use custom drag images and elements. It needs an opacity of - * 0.01 so that the core code detects that it's in fact a visible element. - */ -.newtab-drag { - width: 1px; - height: 1px; - background-color: #fff; - opacity: 0.01; -} - -/* SEARCH */ -#searchContainer { - display: -moz-box; - position: relative; - -moz-box-pack: center; - margin: 10px 0 15px; -} - -#searchContainer[page-disabled] { - opacity: 0; - pointer-events: none; -} - -#searchForm { - display: -moz-box; - position: relative; - height: 36px; - -moz-box-flex: 1; - max-width: 600px; /* 2 * (290 cell width + 10 cell margin) */ -} - -#searchEngineLogo { - border: 1px transparent; - padding: 2px 4px; - margin: 0; - width: 32px; - height: 32px; - position: absolute; -} - -#searchText { - -moz-box-flex: 1; - padding-top: 6px; - padding-bottom: 6px; - padding-inline-start: 42px; - padding-inline-end: 8px; - background: hsla(0,0%,100%,.9) padding-box; - border: 1px solid; - border-spacing: 0; - border-radius: 2px 0 0 2px; - border-color: hsla(210,54%,20%,.15) hsla(210,54%,20%,.17) hsla(210,54%,20%,.2); - box-shadow: 0 1px 0 hsla(210,65%,9%,.02) inset, - 0 0 2px hsla(210,65%,9%,.1) inset, - 0 1px 0 hsla(0,0%,100%,.2); - color: inherit; - unicode-bidi: plaintext; -} - -#searchText:dir(rtl) { - border-radius: 0 2px 2px 0; -} - -#searchText[aria-expanded="true"] { - border-radius: 2px 0 0 0; -} - -#searchText[aria-expanded="true"]:dir(rtl) { - border-radius: 0 2px 0 0; -} - -#searchText[keepfocus], -#searchText:focus { - border-color: hsla(216,100%,60%,.6) hsla(216,76%,52%,.6) hsla(214,100%,40%,.6); -} - -#searchSubmit { - margin-inline-start: -1px; - padding: 0; - border: 1px solid; - background-color: #e0e0e0; - color: black; - border-color: hsla(220,54%,20%,.15) hsla(220,54%,20%,.17) hsla(220,54%,20%,.2); - border-radius: 0 2px 2px 0; - box-shadow: 0 0 2px hsla(0,0%,100%,.5) inset, - 0 1px 0 hsla(0,0%,100%,.2); - cursor: pointer; - transition-property: background-color, border-color, box-shadow; - transition-duration: 150ms; - width: 50px; -} - -#searchSubmit:dir(rtl) { - border-radius: 2px 0 0 2px; -} - -#searchSubmit:hover { - background-color: hsl(220,54%,20%); - color: white; -} - -#searchText:focus + #searchSubmit, -#searchText + #searchSubmit:hover { - border-color: #5985fc #4573e7 #3264d5; -} - -#searchText:focus + #searchSubmit, -#searchText[keepfocus] + #searchSubmit { - box-shadow: 0 1px 0 hsla(0,0%,100%,.2) inset, - 0 0 0 1px hsla(0,0%,100%,.1) inset, - 0 1px 0 hsla(220,54%,20%,.03); -} - -#searchText + #searchSubmit:hover { - box-shadow: 0 1px 0 hsla(0,0%,100%,.2) inset, - 0 0 0 1px hsla(0,0%,100%,.1) inset, - 0 1px 0 hsla(220,54%,20%,.03), - 0 0 4px hsla(216,100%,20%,.2); -} - -#searchText + #searchSubmit:hover:active { - box-shadow: 0 1px 1px hsla(221,79%,6%,.1) inset, - 0 0 1px hsla(221,79%,6%,.2) inset; - transition-duration: 0ms; -} - -.contentSearchSuggestionTable { - font: message-box; - font-size: 16px; -} diff --git a/components/newtab/newTab.js b/components/newtab/newTab.js deleted file mode 100644 index 0022f21..0000000 --- a/components/newtab/newTab.js +++ /dev/null @@ -1,69 +0,0 @@ -/* 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"; - -var Cu = Components.utils; -var Ci = Components.interfaces; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/PageThumbs.jsm"); -Cu.import("resource://gre/modules/BackgroundPageThumbs.jsm"); -Cu.import("resource://gre/modules/NewTabUtils.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "Rect", - "resource://gre/modules/Geometry.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", - "resource://gre/modules/PrivateBrowsingUtils.jsm"); - -var { - links: gLinks, - allPages: gAllPages, - linkChecker: gLinkChecker, - pinnedLinks: gPinnedLinks, - blockedLinks: gBlockedLinks, - gridPrefs: gGridPrefs -} = NewTabUtils; - -XPCOMUtils.defineLazyGetter(this, "gStringBundle", function() { - return Services.strings. - createBundle("chrome://browser/locale/newTab.properties"); -}); - -function newTabString(name, args) { - let stringName = "newtab." + name; - if (!args) { - return gStringBundle.GetStringFromName(stringName); - } - return gStringBundle.formatStringFromName(stringName, args, args.length); -} - -function inPrivateBrowsingMode() { - return PrivateBrowsingUtils.isContentWindowPrivate(window); -} - -const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml"; -const XUL_NAMESPACE = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; - -const TILES_EXPLAIN_LINK = "https://support.mozilla.org/kb/how-do-tiles-work-firefox"; -const TILES_INTRO_LINK = "https://www.mozilla.org/firefox/tiles/"; -const TILES_PRIVACY_LINK = "https://www.mozilla.org/privacy/"; - -#include transformations.js -#include page.js -#include grid.js -#include cells.js -#include sites.js -#include drag.js -#include dragDataHelper.js -#include drop.js -#include dropTargetShim.js -#include dropPreview.js -#include updater.js -#include undo.js -#include search.js - -// Everything is loaded. Initialize the New Tab Page. -gPage.init(); diff --git a/components/newtab/newTab.xhtml b/components/newtab/newTab.xhtml deleted file mode 100644 index de000e7..0000000 --- a/components/newtab/newTab.xhtml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - %newTabDTD; - - %browserDTD; - - %globalDTD; -]> - - - - &newtab.pageTitle; - - - - - - - -
-
- -
-
- - - -
-
- -
-
-
- - -
-
- -
-
-
- -
-
-
- -
- -
- - - - - - - - - - - - - - - - - diff --git a/components/places/content/editBookmarkOverlay.js b/components/places/content/editBookmarkOverlay.js deleted file mode 100644 index 69d7d32..0000000 --- a/components/places/content/editBookmarkOverlay.js +++ /dev/null @@ -1,1063 +0,0 @@ -/* 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/. */ - -const LAST_USED_ANNO = "bookmarkPropertiesDialog/folderLastUsed"; -const MAX_FOLDER_ITEM_IN_MENU_LIST = 5; - -var gEditItemOverlay = { - _uri: null, - _itemId: -1, - _itemIds: [], - _uris: [], - _tags: [], - _allTags: [], - _keyword: null, - _multiEdit: false, - _itemType: -1, - _readOnly: false, - _hiddenRows: [], - _onPanelReady: false, - _observersAdded: false, - _staticFoldersListBuilt: false, - _initialized: false, - _titleOverride: "", - - // the first field which was edited after this panel was initialized for - // a certain item - _firstEditedField: "", - - get itemId() { - return this._itemId; - }, - - get uri() { - return this._uri; - }, - - get multiEdit() { - return this._multiEdit; - }, - - /** - * Determines the initial data for the item edited or added by this dialog - */ - _determineInfo: function EIO__determineInfo(aInfo) { - // hidden rows - if (aInfo && aInfo.hiddenRows) - this._hiddenRows = aInfo.hiddenRows; - else - this._hiddenRows.splice(0, this._hiddenRows.length); - // force-read-only - this._readOnly = aInfo && aInfo.forceReadOnly; - this._titleOverride = aInfo && aInfo.titleOverride ? aInfo.titleOverride - : ""; - this._onPanelReady = aInfo && aInfo.onPanelReady; - }, - - _showHideRows: function EIO__showHideRows() { - var isBookmark = this._itemId != -1 && - this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK; - var isQuery = false; - if (this._uri) - isQuery = this._uri.schemeIs("place"); - - this._element("nameRow").collapsed = this._hiddenRows.indexOf("name") != -1; - this._element("folderRow").collapsed = - this._hiddenRows.indexOf("folderPicker") != -1 || this._readOnly; - this._element("tagsRow").collapsed = !this._uri || - this._hiddenRows.indexOf("tags") != -1 || isQuery; - // Collapse the tag selector if the item does not accept tags. - if (!this._element("tagsSelectorRow").collapsed && - this._element("tagsRow").collapsed) - this.toggleTagsSelector(); - this._element("descriptionRow").collapsed = - this._hiddenRows.indexOf("description") != -1 || this._readOnly; - this._element("keywordRow").collapsed = !isBookmark || this._readOnly || - this._hiddenRows.indexOf("keyword") != -1 || isQuery; - this._element("locationRow").collapsed = !(this._uri && !isQuery) || - this._hiddenRows.indexOf("location") != -1; - this._element("loadInSidebarCheckbox").collapsed = !isBookmark || isQuery || - this._readOnly || this._hiddenRows.indexOf("loadInSidebar") != -1; - this._element("feedLocationRow").collapsed = !this._isLivemark || - this._hiddenRows.indexOf("feedLocation") != -1; - this._element("siteLocationRow").collapsed = !this._isLivemark || - this._hiddenRows.indexOf("siteLocation") != -1; - this._element("selectionCount").hidden = !this._multiEdit; - }, - - /** - * Initialize the panel - * @param aFor - * Either a places-itemId (of a bookmark, folder or a live bookmark), - * an array of itemIds (used for bulk tagging), or a URI object (in - * which case, the panel would be initialized in read-only mode). - * @param [optional] aInfo - * JS object which stores additional info for the panel - * initialization. The following properties may bet set: - * * hiddenRows (Strings array): list of rows to be hidden regardless - * of the item edited. Possible values: "title", "location", - * "description", "keyword", "loadInSidebar", "feedLocation", - * "siteLocation", folderPicker" - * * forceReadOnly - set this flag to initialize the panel to its - * read-only (view) mode even if the given item is editable. - */ - initPanel: function EIO_initPanel(aFor, aInfo) { - // For sanity ensure that the implementer has uninited the panel before - // trying to init it again, or we could end up leaking due to observers. - if (this._initialized) - this.uninitPanel(false); - - var aItemIdList; - if (Array.isArray(aFor)) { - aItemIdList = aFor; - aFor = aItemIdList[0]; - } - else if (this._multiEdit) { - this._multiEdit = false; - this._tags = []; - this._uris = []; - this._allTags = []; - this._itemIds = []; - this._element("selectionCount").hidden = true; - } - - this._folderMenuList = this._element("folderMenuList"); - this._folderTree = this._element("folderTree"); - - this._determineInfo(aInfo); - if (aFor instanceof Ci.nsIURI) { - this._itemId = -1; - this._uri = aFor; - this._readOnly = true; - } - else { - this._itemId = aFor; - // We can't store information on invalid itemIds. - this._readOnly = this._readOnly || this._itemId == -1; - - var containerId = PlacesUtils.bookmarks.getFolderIdForItem(this._itemId); - this._itemType = PlacesUtils.bookmarks.getItemType(this._itemId); - if (this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK) { - this._uri = PlacesUtils.bookmarks.getBookmarkURI(this._itemId); - this._keyword = PlacesUtils.bookmarks.getKeywordForBookmark(this._itemId); - this._initTextField("keywordField", this._keyword); - this._element("loadInSidebarCheckbox").checked = - PlacesUtils.annotations.itemHasAnnotation(this._itemId, - PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO); - } - else { - this._uri = null; - this._isLivemark = false; - PlacesUtils.livemarks.getLivemark({id: this._itemId }) - .then(aLivemark => { - this._isLivemark = true; - this._initTextField("feedLocationField", aLivemark.feedURI.spec, true); - this._initTextField("siteLocationField", aLivemark.siteURI ? aLivemark.siteURI.spec : "", true); - this._showHideRows(); - }, () => undefined); - } - - // folder picker - this._initFolderMenuList(containerId); - - // description field - this._initTextField("descriptionField", - PlacesUIUtils.getItemDescription(this._itemId)); - } - - if (this._itemId == -1 || - this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK) { - this._isLivemark = false; - - this._initTextField("locationField", this._uri.spec); - if (!aItemIdList) { - var tags = PlacesUtils.tagging.getTagsForURI(this._uri).join(", "); - this._initTextField("tagsField", tags, false); - } - else { - this._multiEdit = true; - this._allTags = []; - this._itemIds = aItemIdList; - for (var i = 0; i < aItemIdList.length; i++) { - if (aItemIdList[i] instanceof Ci.nsIURI) { - this._uris[i] = aItemIdList[i]; - this._itemIds[i] = -1; - } - else - this._uris[i] = PlacesUtils.bookmarks.getBookmarkURI(this._itemIds[i]); - this._tags[i] = PlacesUtils.tagging.getTagsForURI(this._uris[i]); - } - this._allTags = this._getCommonTags(); - this._initTextField("tagsField", this._allTags.join(", "), false); - this._element("itemsCountText").value = - PlacesUIUtils.getPluralString("detailsPane.itemsCountLabel", - this._itemIds.length, - [this._itemIds.length]); - } - - // tags selector - this._rebuildTagsSelectorList(); - } - - // name picker - this._initNamePicker(); - - this._showHideRows(); - - // observe changes - if (!this._observersAdded) { - // Single bookmarks observe any change. History entries and multiEdit - // observe only tags changes, through bookmarks. - if (this._itemId != -1 || this._uri || this._multiEdit) - PlacesUtils.bookmarks.addObserver(this, false); - - this._element("namePicker").addEventListener("blur", this); - this._element("locationField").addEventListener("blur", this); - this._element("tagsField").addEventListener("blur", this); - this._element("keywordField").addEventListener("blur", this); - this._element("descriptionField").addEventListener("blur", this); - window.addEventListener("unload", this, false); - this._observersAdded = true; - } - - let focusElement = () => { - this._initialized = true; - }; - - if (this._onPanelReady) { - this._onPanelReady(focusElement); - } else { - focusElement(); - } - }, - - /** - * Finds tags that are in common among this._tags entries that track tags - * for each selected uri. - * The tags arrays should be kept up-to-date for this to work properly. - * - * @return array of common tags for the selected uris. - */ - _getCommonTags: function() { - return this._tags[0].filter( - function (aTag) this._tags.every( - function (aTags) aTags.indexOf(aTag) != -1 - ), this - ); - }, - - _initTextField: function(aTextFieldId, aValue, aReadOnly) { - var field = this._element(aTextFieldId); - field.readOnly = aReadOnly !== undefined ? aReadOnly : this._readOnly; - - if (field.value != aValue) { - field.value = aValue; - this._editorTransactionManagerClear(field); - } - }, - - /** - * Appends a menu-item representing a bookmarks folder to a menu-popup. - * @param aMenupopup - * The popup to which the menu-item should be added. - * @param aFolderId - * The identifier of the bookmarks folder. - * @return the new menu item. - */ - _appendFolderItemToMenupopup: - function EIO__appendFolderItemToMenuList(aMenupopup, aFolderId) { - // First make sure the folders-separator is visible - this._element("foldersSeparator").hidden = false; - - var folderMenuItem = document.createElement("menuitem"); - var folderTitle = PlacesUtils.bookmarks.getItemTitle(aFolderId) - folderMenuItem.folderId = aFolderId; - folderMenuItem.setAttribute("label", folderTitle); - folderMenuItem.className = "menuitem-iconic folder-icon"; - aMenupopup.appendChild(folderMenuItem); - return folderMenuItem; - }, - - _initFolderMenuList: function EIO__initFolderMenuList(aSelectedFolder) { - // clean up first - var menupopup = this._folderMenuList.menupopup; - while (menupopup.childNodes.length > 6) - menupopup.removeChild(menupopup.lastChild); - - const bms = PlacesUtils.bookmarks; - const annos = PlacesUtils.annotations; - - // Build the static list - var unfiledItem = this._element("unfiledRootItem"); - if (!this._staticFoldersListBuilt) { - unfiledItem.label = bms.getItemTitle(PlacesUtils.unfiledBookmarksFolderId); - unfiledItem.folderId = PlacesUtils.unfiledBookmarksFolderId; - var bmMenuItem = this._element("bmRootItem"); - bmMenuItem.label = bms.getItemTitle(PlacesUtils.bookmarksMenuFolderId); - bmMenuItem.folderId = PlacesUtils.bookmarksMenuFolderId; - var toolbarItem = this._element("toolbarFolderItem"); - toolbarItem.label = bms.getItemTitle(PlacesUtils.toolbarFolderId); - toolbarItem.folderId = PlacesUtils.toolbarFolderId; - this._staticFoldersListBuilt = true; - } - - // List of recently used folders: - var folderIds = annos.getItemsWithAnnotation(LAST_USED_ANNO); - - /** - * The value of the LAST_USED_ANNO annotation is the time (in the form of - * Date.getTime) at which the folder has been last used. - * - * First we build the annotated folders array, each item has both the - * folder identifier and the time at which it was last-used by this dialog - * set. Then we sort it descendingly based on the time field. - */ - this._recentFolders = []; - for (var i = 0; i < folderIds.length; i++) { - var lastUsed = annos.getItemAnnotation(folderIds[i], LAST_USED_ANNO); - this._recentFolders.push({ folderId: folderIds[i], lastUsed: lastUsed }); - } - this._recentFolders.sort(function(a, b) { - if (b.lastUsed < a.lastUsed) - return -1; - if (b.lastUsed > a.lastUsed) - return 1; - return 0; - }); - - var numberOfItems = Math.min(MAX_FOLDER_ITEM_IN_MENU_LIST, - this._recentFolders.length); - for (var i = 0; i < numberOfItems; i++) { - this._appendFolderItemToMenupopup(menupopup, - this._recentFolders[i].folderId); - } - - var defaultItem = this._getFolderMenuItem(aSelectedFolder); - this._folderMenuList.selectedItem = defaultItem; - - // Set a selectedIndex attribute to show special icons - this._folderMenuList.setAttribute("selectedIndex", - this._folderMenuList.selectedIndex); - - // Hide the folders-separator if no folder is annotated as recently-used - this._element("foldersSeparator").hidden = (menupopup.childNodes.length <= 6); - this._folderMenuList.disabled = this._readOnly; - }, - - QueryInterface: function EIO_QueryInterface(aIID) { - if (aIID.equals(Ci.nsIDOMEventListener) || - aIID.equals(Ci.nsINavBookmarkObserver) || - aIID.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - }, - - _element: function EIO__element(aID) { - return document.getElementById("editBMPanel_" + aID); - }, - - _editorTransactionManagerClear: function EIO__editorTransactionManagerClear(aItem) { - // Clear the editor's undo stack - let transactionManager; - try { - transactionManager = aItem.editor.transactionManager; - } catch (e) { - // When retrieving the transaction manager, editor may be null resulting - // in a TypeError. Additionally, the transaction manager may not - // exist yet, which causes access to it to throw NS_ERROR_FAILURE. - // In either event, the transaction manager doesn't exist it, so we - // don't need to worry about clearing it. - if (!(e instanceof TypeError) && e.result != Cr.NS_ERROR_FAILURE) { - throw e; - } - } - if (transactionManager) { - transactionManager.clear(); - } - }, - - _getItemStaticTitle: function EIO__getItemStaticTitle() { - if (this._titleOverride) - return this._titleOverride; - - let title = ""; - if (this._itemId == -1) { - title = PlacesUtils.history.getPageTitle(this._uri); - } - else { - title = PlacesUtils.bookmarks.getItemTitle(this._itemId); - } - return title; - }, - - _initNamePicker: function EIO_initNamePicker() { - var namePicker = this._element("namePicker"); - namePicker.value = this._getItemStaticTitle(); - namePicker.readOnly = this._readOnly; - this._editorTransactionManagerClear(namePicker); - }, - - uninitPanel: function EIO_uninitPanel(aHideCollapsibleElements) { - if (aHideCollapsibleElements) { - // hide the folder tree if it was previously visible - var folderTreeRow = this._element("folderTreeRow"); - if (!folderTreeRow.collapsed) - this.toggleFolderTreeVisibility(); - - // hide the tag selector if it was previously visible - var tagsSelectorRow = this._element("tagsSelectorRow"); - if (!tagsSelectorRow.collapsed) - this.toggleTagsSelector(); - } - - if (this._observersAdded) { - if (this._itemId != -1 || this._uri || this._multiEdit) - PlacesUtils.bookmarks.removeObserver(this); - - this._element("namePicker").removeEventListener("blur", this); - this._element("locationField").removeEventListener("blur", this); - this._element("tagsField").removeEventListener("blur", this); - this._element("keywordField").removeEventListener("blur", this); - this._element("descriptionField").removeEventListener("blur", this); - - this._observersAdded = false; - } - - this._itemId = -1; - this._uri = null; - this._uris = []; - this._tags = []; - this._allTags = []; - this._itemIds = []; - this._multiEdit = false; - this._firstEditedField = ""; - this._initialized = false; - this._titleOverride = ""; - this._readOnly = false; - }, - - onTagsFieldBlur: function EIO_onTagsFieldBlur() { - if (this._updateTags()) // if anything has changed - this._mayUpdateFirstEditField("tagsField"); - }, - - _updateTags: function EIO__updateTags() { - if (this._multiEdit) - return this._updateMultipleTagsForItems(); - return this._updateSingleTagForItem(); - }, - - _updateSingleTagForItem: function EIO__updateSingleTagForItem() { - var currentTags = PlacesUtils.tagging.getTagsForURI(this._uri); - var tags = this._getTagsArrayFromTagField(); - if (tags.length > 0 || currentTags.length > 0) { - var tagsToRemove = []; - var tagsToAdd = []; - var txns = []; - for (var i = 0; i < currentTags.length; i++) { - if (tags.indexOf(currentTags[i]) == -1) - tagsToRemove.push(currentTags[i]); - } - for (var i = 0; i < tags.length; i++) { - if (currentTags.indexOf(tags[i]) == -1) - tagsToAdd.push(tags[i]); - } - - if (tagsToRemove.length > 0) { - let untagTxn = new PlacesUntagURITransaction(this._uri, tagsToRemove); - txns.push(untagTxn); - } - if (tagsToAdd.length > 0) { - let tagTxn = new PlacesTagURITransaction(this._uri, tagsToAdd); - txns.push(tagTxn); - } - - if (txns.length > 0) { - let aggregate = new PlacesAggregatedTransaction("Update tags", txns); - PlacesUtils.transactionManager.doTransaction(aggregate); - - // Ensure the tagsField is in sync, clean it up from empty tags - var tags = PlacesUtils.tagging.getTagsForURI(this._uri).join(", "); - this._initTextField("tagsField", tags, false); - return true; - } - } - return false; - }, - - /** - * Stores the first-edit field for this dialog, if the passed-in field - * is indeed the first edited field - * @param aNewField - * the id of the field that may be set (without the "editBMPanel_" - * prefix) - */ - _mayUpdateFirstEditField: function EIO__mayUpdateFirstEditField(aNewField) { - // * The first-edit-field behavior is not applied in the multi-edit case - // * if this._firstEditedField is already set, this is not the first field, - // so there's nothing to do - if (this._multiEdit || this._firstEditedField) - return; - - this._firstEditedField = aNewField; - - // set the pref - var prefs = Cc["@mozilla.org/preferences-service;1"]. - getService(Ci.nsIPrefBranch); - prefs.setCharPref("browser.bookmarks.editDialog.firstEditField", aNewField); - }, - - _updateMultipleTagsForItems: function EIO__updateMultipleTagsForItems() { - var tags = this._getTagsArrayFromTagField(); - if (tags.length > 0 || this._allTags.length > 0) { - var tagsToRemove = []; - var tagsToAdd = []; - var txns = []; - for (var i = 0; i < this._allTags.length; i++) { - if (tags.indexOf(this._allTags[i]) == -1) - tagsToRemove.push(this._allTags[i]); - } - for (var i = 0; i < this._tags.length; i++) { - tagsToAdd[i] = []; - for (var j = 0; j < tags.length; j++) { - if (this._tags[i].indexOf(tags[j]) == -1) - tagsToAdd[i].push(tags[j]); - } - } - - if (tagsToAdd.length > 0) { - for (let i = 0; i < this._uris.length; i++) { - if (tagsToAdd[i].length > 0) { - let tagTxn = new PlacesTagURITransaction(this._uris[i], - tagsToAdd[i]); - txns.push(tagTxn); - } - } - } - if (tagsToRemove.length > 0) { - for (let i = 0; i < this._uris.length; i++) { - let untagTxn = new PlacesUntagURITransaction(this._uris[i], - tagsToRemove); - txns.push(untagTxn); - } - } - - if (txns.length > 0) { - let aggregate = new PlacesAggregatedTransaction("Update tags", txns); - PlacesUtils.transactionManager.doTransaction(aggregate); - - this._allTags = tags; - this._tags = []; - for (let i = 0; i < this._uris.length; i++) { - this._tags[i] = PlacesUtils.tagging.getTagsForURI(this._uris[i]); - } - - // Ensure the tagsField is in sync, clean it up from empty tags - this._initTextField("tagsField", tags, false); - return true; - } - } - return false; - }, - - onNamePickerBlur: function EIO_onNamePickerBlur() { - if (this._itemId == -1) - return; - - var namePicker = this._element("namePicker") - - // Here we update either the item title or its cached static title - var newTitle = namePicker.value; - if (!newTitle && - PlacesUtils.bookmarks.getFolderIdForItem(this._itemId) == PlacesUtils.tagsFolderId) { - // We don't allow setting an empty title for a tag, restore the old one. - this._initNamePicker(); - } - else if (this._getItemStaticTitle() != newTitle) { - this._mayUpdateFirstEditField("namePicker"); - let txn = new PlacesEditItemTitleTransaction(this._itemId, newTitle); - PlacesUtils.transactionManager.doTransaction(txn); - } - }, - - onDescriptionFieldBlur: function EIO_onDescriptionFieldBlur() { - var description = this._element("descriptionField").value; - if (description != PlacesUIUtils.getItemDescription(this._itemId)) { - var annoObj = { name : PlacesUIUtils.DESCRIPTION_ANNO, - type : Ci.nsIAnnotationService.TYPE_STRING, - flags : 0, - value : description, - expires: Ci.nsIAnnotationService.EXPIRE_NEVER }; - var txn = new PlacesSetItemAnnotationTransaction(this._itemId, annoObj); - PlacesUtils.transactionManager.doTransaction(txn); - } - }, - - onLocationFieldBlur: function EIO_onLocationFieldBlur() { - var uri; - try { - uri = PlacesUIUtils.createFixedURI(this._element("locationField").value); - } - catch(ex) { return; } - - if (!this._uri.equals(uri)) { - var txn = new PlacesEditBookmarkURITransaction(this._itemId, uri); - PlacesUtils.transactionManager.doTransaction(txn); - this._uri = uri; - } - }, - - onKeywordFieldBlur: function EIO_onKeywordFieldBlur() { - let oldKeyword = this._keyword; - let keyword = this._keyword = this._element("keywordField").value; - if (keyword != oldKeyword) { - let txn = new PlacesEditBookmarkKeywordTransaction(this._itemId, - keyword, - null, - oldKeyword); - PlacesUtils.transactionManager.doTransaction(txn); - } - }, - - onLoadInSidebarCheckboxCommand: - function EIO_onLoadInSidebarCheckboxCommand() { - let annoObj = { name : PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO }; - if (this._element("loadInSidebarCheckbox").checked) - annoObj.value = true; - let txn = new PlacesSetItemAnnotationTransaction(this._itemId, annoObj); - PlacesUtils.transactionManager.doTransaction(txn); - }, - - toggleFolderTreeVisibility: function EIO_toggleFolderTreeVisibility() { - var expander = this._element("foldersExpander"); - var folderTreeRow = this._element("folderTreeRow"); - if (!folderTreeRow.collapsed) { - expander.className = "expander-down"; - expander.setAttribute("tooltiptext", - expander.getAttribute("tooltiptextdown")); - folderTreeRow.collapsed = true; - this._element("chooseFolderSeparator").hidden = - this._element("chooseFolderMenuItem").hidden = false; - } - else { - expander.className = "expander-up" - expander.setAttribute("tooltiptext", - expander.getAttribute("tooltiptextup")); - folderTreeRow.collapsed = false; - - // XXXmano: Ideally we would only do this once, but for some odd reason, - // the editable mode set on this tree, together with its collapsed state - // breaks the view. - const FOLDER_TREE_PLACE_URI = - "place:excludeItems=1&excludeQueries=1&excludeReadOnlyFolders=1&folder=" + - PlacesUIUtils.allBookmarksFolderId; - this._folderTree.place = FOLDER_TREE_PLACE_URI; - - this._element("chooseFolderSeparator").hidden = - this._element("chooseFolderMenuItem").hidden = true; - var currentFolder = this._getFolderIdFromMenuList(); - this._folderTree.selectItems([currentFolder]); - this._folderTree.focus(); - } - }, - - _getFolderIdFromMenuList: - function EIO__getFolderIdFromMenuList() { - var selectedItem = this._folderMenuList.selectedItem; - NS_ASSERT("folderId" in selectedItem, - "Invalid menuitem in the folders-menulist"); - return selectedItem.folderId; - }, - - /** - * Get the corresponding menu-item in the folder-menu-list for a bookmarks - * folder if such an item exists. Otherwise, this creates a menu-item for the - * folder. If the items-count limit (see MAX_FOLDERS_IN_MENU_LIST) is reached, - * the new item replaces the last menu-item. - * @param aFolderId - * The identifier of the bookmarks folder. - */ - _getFolderMenuItem: - function EIO__getFolderMenuItem(aFolderId) { - var menupopup = this._folderMenuList.menupopup; - - for (let i = 0; i < menupopup.childNodes.length; i++) { - if ("folderId" in menupopup.childNodes[i] && - menupopup.childNodes[i].folderId == aFolderId) - return menupopup.childNodes[i]; - } - - // 3 special folders + separator + folder-items-count limit - if (menupopup.childNodes.length == 4 + MAX_FOLDER_ITEM_IN_MENU_LIST) - menupopup.removeChild(menupopup.lastChild); - - return this._appendFolderItemToMenupopup(menupopup, aFolderId); - }, - - onFolderMenuListCommand: function EIO_onFolderMenuListCommand(aEvent) { - // Set a selectedIndex attribute to show special icons - this._folderMenuList.setAttribute("selectedIndex", - this._folderMenuList.selectedIndex); - - if (aEvent.target.id == "editBMPanel_chooseFolderMenuItem") { - // reset the selection back to where it was and expand the tree - // (this menu-item is hidden when the tree is already visible - var container = PlacesUtils.bookmarks.getFolderIdForItem(this._itemId); - var item = this._getFolderMenuItem(container); - this._folderMenuList.selectedItem = item; - // XXXmano HACK: setTimeout 100, otherwise focus goes back to the - // menulist right away - setTimeout(function(self) self.toggleFolderTreeVisibility(), 100, this); - return; - } - - // Move the item - var container = this._getFolderIdFromMenuList(); - if (PlacesUtils.bookmarks.getFolderIdForItem(this._itemId) != container) { - var txn = new PlacesMoveItemTransaction(this._itemId, - container, - PlacesUtils.bookmarks.DEFAULT_INDEX); - PlacesUtils.transactionManager.doTransaction(txn); - - // Mark the containing folder as recently-used if it isn't in the - // static list - if (container != PlacesUtils.unfiledBookmarksFolderId && - container != PlacesUtils.toolbarFolderId && - container != PlacesUtils.bookmarksMenuFolderId) - this._markFolderAsRecentlyUsed(container); - } - - // Update folder-tree selection - var folderTreeRow = this._element("folderTreeRow"); - if (!folderTreeRow.collapsed) { - var selectedNode = this._folderTree.selectedNode; - if (!selectedNode || - PlacesUtils.getConcreteItemId(selectedNode) != container) - this._folderTree.selectItems([container]); - } - }, - - onFolderTreeSelect: function EIO_onFolderTreeSelect() { - var selectedNode = this._folderTree.selectedNode; - - // Disable the "New Folder" button if we cannot create a new folder - this._element("newFolderButton") - .disabled = !this._folderTree.insertionPoint || !selectedNode; - - if (!selectedNode) - return; - - var folderId = PlacesUtils.getConcreteItemId(selectedNode); - if (this._getFolderIdFromMenuList() == folderId) - return; - - var folderItem = this._getFolderMenuItem(folderId); - this._folderMenuList.selectedItem = folderItem; - folderItem.doCommand(); - }, - - _markFolderAsRecentlyUsed: - function EIO__markFolderAsRecentlyUsed(aFolderId) { - var txns = []; - - // Expire old unused recent folders - var anno = this._getLastUsedAnnotationObject(false); - while (this._recentFolders.length > MAX_FOLDER_ITEM_IN_MENU_LIST) { - var folderId = this._recentFolders.pop().folderId; - let annoTxn = new PlacesSetItemAnnotationTransaction(folderId, anno); - txns.push(annoTxn); - } - - // Mark folder as recently used - anno = this._getLastUsedAnnotationObject(true); - let annoTxn = new PlacesSetItemAnnotationTransaction(aFolderId, anno); - txns.push(annoTxn); - - let aggregate = new PlacesAggregatedTransaction("Update last used folders", txns); - PlacesUtils.transactionManager.doTransaction(aggregate); - }, - - /** - * Returns an object which could then be used to set/unset the - * LAST_USED_ANNO annotation for a folder. - * - * @param aLastUsed - * Whether to set or unset the LAST_USED_ANNO annotation. - * @returns an object representing the annotation which could then be used - * with the transaction manager. - */ - _getLastUsedAnnotationObject: - function EIO__getLastUsedAnnotationObject(aLastUsed) { - var anno = { name: LAST_USED_ANNO, - type: Ci.nsIAnnotationService.TYPE_INT32, - flags: 0, - value: aLastUsed ? new Date().getTime() : null, - expires: Ci.nsIAnnotationService.EXPIRE_NEVER }; - - return anno; - }, - - _rebuildTagsSelectorList: function EIO__rebuildTagsSelectorList() { - var tagsSelector = this._element("tagsSelector"); - var tagsSelectorRow = this._element("tagsSelectorRow"); - if (tagsSelectorRow.collapsed) - return; - - // Save the current scroll position and restore it after the rebuild. - let firstIndex = tagsSelector.getIndexOfFirstVisibleRow(); - let selectedIndex = tagsSelector.selectedIndex; - let selectedTag = selectedIndex >= 0 ? tagsSelector.selectedItem.label - : null; - - while (tagsSelector.hasChildNodes()) - tagsSelector.removeChild(tagsSelector.lastChild); - - var tagsInField = this._getTagsArrayFromTagField(); - var allTags = PlacesUtils.tagging.allTags; - for (var i = 0; i < allTags.length; i++) { - var tag = allTags[i]; - var elt = document.createElement("listitem"); - elt.setAttribute("type", "checkbox"); - elt.setAttribute("label", tag); - if (tagsInField.indexOf(tag) != -1) - elt.setAttribute("checked", "true"); - tagsSelector.appendChild(elt); - if (selectedTag === tag) - selectedIndex = tagsSelector.getIndexOfItem(elt); - } - - // Restore position. - // The listbox allows to scroll only if the required offset doesn't - // overflow its capacity, thus need to adjust the index for removals. - firstIndex = - Math.min(firstIndex, - tagsSelector.itemCount - tagsSelector.getNumberOfVisibleRows()); - tagsSelector.scrollToIndex(firstIndex); - if (selectedIndex >= 0 && tagsSelector.itemCount > 0) { - selectedIndex = Math.min(selectedIndex, tagsSelector.itemCount - 1); - tagsSelector.selectedIndex = selectedIndex; - tagsSelector.ensureIndexIsVisible(selectedIndex); - } - }, - - toggleTagsSelector: function EIO_toggleTagsSelector() { - var tagsSelector = this._element("tagsSelector"); - var tagsSelectorRow = this._element("tagsSelectorRow"); - var expander = this._element("tagsSelectorExpander"); - if (tagsSelectorRow.collapsed) { - expander.className = "expander-up"; - expander.setAttribute("tooltiptext", - expander.getAttribute("tooltiptextup")); - tagsSelectorRow.collapsed = false; - this._rebuildTagsSelectorList(); - - // This is a no-op if we've added the listener. - tagsSelector.addEventListener("CheckboxStateChange", this, false); - } - else { - expander.className = "expander-down"; - expander.setAttribute("tooltiptext", - expander.getAttribute("tooltiptextdown")); - tagsSelectorRow.collapsed = true; - } - }, - - /** - * Splits "tagsField" element value, returning an array of valid tag strings. - * - * @return Array of tag strings found in the field value. - */ - _getTagsArrayFromTagField: function EIO__getTagsArrayFromTagField() { - let tags = this._element("tagsField").value; - return tags.trim() - .split(/\s*,\s*/) // Split on commas and remove spaces. - .filter(function (tag) tag.length > 0); // Kill empty tags. - }, - - newFolder: function EIO_newFolder() { - var ip = this._folderTree.insertionPoint; - - // default to the bookmarks menu folder - if (!ip || ip.itemId == PlacesUIUtils.allBookmarksFolderId) { - ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId, - PlacesUtils.bookmarks.DEFAULT_INDEX, - Ci.nsITreeView.DROP_ON); - } - - // XXXmano: add a separate "New Folder" string at some point... - var defaultLabel = this._element("newFolderButton").label; - var txn = new PlacesCreateFolderTransaction(defaultLabel, ip.itemId, ip.index); - PlacesUtils.transactionManager.doTransaction(txn); - this._folderTree.focus(); - this._folderTree.selectItems([this._lastNewItem]); - this._folderTree.startEditing(this._folderTree.view.selection.currentIndex, - this._folderTree.columns.getFirstColumn()); - }, - - // nsIDOMEventListener - handleEvent: function EIO_nsIDOMEventListener(aEvent) { - switch (aEvent.type) { - case "CheckboxStateChange": - // Update the tags field when items are checked/unchecked in the listbox - var tags = this._getTagsArrayFromTagField(); - - if (aEvent.target.checked) { - if (tags.indexOf(aEvent.target.label) == -1) - tags.push(aEvent.target.label); - } - else { - var indexOfItem = tags.indexOf(aEvent.target.label); - if (indexOfItem != -1) - tags.splice(indexOfItem, 1); - } - this._element("tagsField").value = tags.join(", "); - this._updateTags(); - break; - case "blur": - let replaceFn = (str, firstLetter) => firstLetter.toUpperCase(); - let nodeName = aEvent.target.id.replace(/editBMPanel_(\w)/, replaceFn); - this["on" + nodeName + "Blur"](); - break; - case "unload": - this.uninitPanel(false); - break; - } - }, - - // nsINavBookmarkObserver - onItemChanged: function EIO_onItemChanged(aItemId, aProperty, - aIsAnnotationProperty, aValue, - aLastModified, aItemType) { - if (aProperty == "tags") { - // Tags case is special, since they should be updated if either: - // - the notification is for the edited bookmark - // - the notification is for the edited history entry - // - the notification is for one of edited uris - let shouldUpdateTagsField = this._itemId == aItemId; - if (this._itemId == -1 || this._multiEdit) { - // Check if the changed uri is part of the modified ones. - let changedURI = PlacesUtils.bookmarks.getBookmarkURI(aItemId); - let uris = this._multiEdit ? this._uris : [this._uri]; - uris.forEach(function (aURI, aIndex) { - if (aURI.equals(changedURI)) { - shouldUpdateTagsField = true; - if (this._multiEdit) { - this._tags[aIndex] = PlacesUtils.tagging.getTagsForURI(this._uris[aIndex]); - } - } - }, this); - } - - if (shouldUpdateTagsField) { - if (this._multiEdit) { - this._allTags = this._getCommonTags(); - this._initTextField("tagsField", this._allTags.join(", "), false); - } - else { - let tags = PlacesUtils.tagging.getTagsForURI(this._uri).join(", "); - this._initTextField("tagsField", tags, false); - } - } - - // Any tags change should be reflected in the tags selector. - this._rebuildTagsSelectorList(); - return; - } - - if (this._itemId != aItemId) { - if (aProperty == "title") { - // If the title of a folder which is listed within the folders - // menulist has been changed, we need to update the label of its - // representing element. - var menupopup = this._folderMenuList.menupopup; - for (let i = 0; i < menupopup.childNodes.length; i++) { - if ("folderId" in menupopup.childNodes[i] && - menupopup.childNodes[i].folderId == aItemId) { - menupopup.childNodes[i].label = aValue; - break; - } - } - } - - return; - } - - switch (aProperty) { - case "title": - var namePicker = this._element("namePicker"); - if (namePicker.value != aValue) { - namePicker.value = aValue; - this._editorTransactionManagerClear(namePicker); - } - break; - case "uri": - var locationField = this._element("locationField"); - if (locationField.value != aValue) { - this._uri = Cc["@mozilla.org/network/io-service;1"]. - getService(Ci.nsIIOService). - newURI(aValue, null, null); - this._initTextField("locationField", this._uri.spec); - this._initNamePicker(); - this._initTextField("tagsField", - PlacesUtils.tagging - .getTagsForURI(this._uri).join(", "), - false); - this._rebuildTagsSelectorList(); - } - break; - case "keyword": - this._keyword = PlacesUtils.bookmarks.getKeywordForBookmark(this._itemId); - this._initTextField("keywordField", this._keyword); - break; - case PlacesUIUtils.DESCRIPTION_ANNO: - this._initTextField("descriptionField", - PlacesUIUtils.getItemDescription(this._itemId)); - break; - case PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO: - this._element("loadInSidebarCheckbox").checked = - PlacesUtils.annotations.itemHasAnnotation(this._itemId, - PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO); - break; - case PlacesUtils.LMANNO_FEEDURI: - let feedURISpec = - PlacesUtils.annotations.getItemAnnotation(this._itemId, - PlacesUtils.LMANNO_FEEDURI); - this._initTextField("feedLocationField", feedURISpec, true); - break; - case PlacesUtils.LMANNO_SITEURI: - let siteURISpec = ""; - try { - siteURISpec = - PlacesUtils.annotations.getItemAnnotation(this._itemId, - PlacesUtils.LMANNO_SITEURI); - } catch (ex) {} - this._initTextField("siteLocationField", siteURISpec, true); - break; - } - }, - - onItemMoved: function EIO_onItemMoved(aItemId, aOldParent, aOldIndex, - aNewParent, aNewIndex, aItemType) { - if (aItemId != this._itemId || - aNewParent == this._getFolderIdFromMenuList()) - return; - - var folderItem = this._getFolderMenuItem(aNewParent); - - // just setting selectItem _does not_ trigger oncommand, so we don't - // recurse - this._folderMenuList.selectedItem = folderItem; - }, - - onItemAdded: function EIO_onItemAdded(aItemId, aParentId, aIndex, aItemType, - aURI) { - this._lastNewItem = aItemId; - }, - - onItemRemoved: function() { }, - onBeginUpdateBatch: function() { }, - onEndUpdateBatch: function() { }, - onItemVisited: function() { }, -}; diff --git a/components/places/content/editBookmarkOverlay.xul b/components/places/content/editBookmarkOverlay.xul deleted file mode 100644 index 196369d..0000000 --- a/components/places/content/editBookmarkOverlay.xul +++ /dev/null @@ -1,228 +0,0 @@ - - - -%editBookmarkOverlayDTD; -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-

&privatebrowsingpage.howToStop3;

-

&privatebrowsingpage.howToStart3;

-
- - -
-

- &privatebrowsingpage.moreInfo; -

- -
-
-
- - - diff --git a/components/privatebrowsing/jar.mn b/components/privatebrowsing/jar.mn deleted file mode 100644 index 75e985c..0000000 --- a/components/privatebrowsing/jar.mn +++ /dev/null @@ -1,6 +0,0 @@ -# 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/. - -browser.jar: -* content/browser/aboutPrivateBrowsing.xhtml (content/aboutPrivateBrowsing.xhtml) diff --git a/components/privatebrowsing/moz.build b/components/privatebrowsing/moz.build deleted file mode 100644 index c97072b..0000000 --- a/components/privatebrowsing/moz.build +++ /dev/null @@ -1,7 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; 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/. - -JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/components/search/content/engineManager.js b/components/search/content/engineManager.js deleted file mode 100644 index 993d48b..0000000 --- a/components/search/content/engineManager.js +++ /dev/null @@ -1,492 +0,0 @@ -/* 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/. */ - -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); -Components.utils.import("resource://gre/modules/Services.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", - "resource://gre/modules/PlacesUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Task", - "resource://gre/modules/Task.jsm"); - -const Ci = Components.interfaces; -const Cc = Components.classes; - -const ENGINE_FLAVOR = "text/x-moz-search-engine"; - -const BROWSER_SUGGEST_PREF = "browser.search.suggest.enabled"; - -var gEngineView = null; - -var gEngineManagerDialog = { - init: function engineManager_init() { - gEngineView = new EngineView(new EngineStore()); - - var suggestEnabled = Services.prefs.getBoolPref(BROWSER_SUGGEST_PREF); - document.getElementById("enableSuggest").checked = suggestEnabled; - - var tree = document.getElementById("engineList"); - tree.view = gEngineView; - - Services.obs.addObserver(this, "browser-search-engine-modified", false); - }, - - destroy: function engineManager_destroy() { - // Remove the observer - Services.obs.removeObserver(this, "browser-search-engine-modified"); - }, - - observe: function engineManager_observe(aEngine, aTopic, aVerb) { - if (aTopic == "browser-search-engine-modified") { - aEngine.QueryInterface(Ci.nsISearchEngine); - switch (aVerb) { - case "engine-added": - gEngineView._engineStore.addEngine(aEngine); - gEngineView.rowCountChanged(gEngineView.lastIndex, 1); - break; - case "engine-changed": - gEngineView._engineStore.reloadIcons(); - gEngineView.invalidate(); - break; - case "engine-removed": - case "engine-current": - case "engine-default": - // Not relevant - break; - } - } - }, - - onOK: function engineManager_onOK() { - // Set the preference - var newSuggestEnabled = document.getElementById("enableSuggest").checked; - Services.prefs.setBoolPref(BROWSER_SUGGEST_PREF, newSuggestEnabled); - - // Commit the changes - gEngineView._engineStore.commit(); - }, - - onRestoreDefaults: function engineManager_onRestoreDefaults() { - var num = gEngineView._engineStore.restoreDefaultEngines(); - gEngineView.rowCountChanged(0, num); - gEngineView.invalidate(); - }, - - showRestoreDefaults: function engineManager_showRestoreDefaults(val) { - document.documentElement.getButton("extra2").disabled = !val; - }, - - loadAddEngines: function engineManager_loadAddEngines() { - this.onOK(); - window.opener.BrowserSearch.loadAddEngines(); - window.close(); - }, - - remove: function engineManager_remove() { - gEngineView._engineStore.removeEngine(gEngineView.selectedEngine); - var index = gEngineView.selectedIndex; - gEngineView.rowCountChanged(index, -1); - gEngineView.invalidate(); - gEngineView.selection.select(Math.min(index, gEngineView.lastIndex)); - gEngineView.ensureRowIsVisible(gEngineView.currentIndex); - document.getElementById("engineList").focus(); - }, - - /** - * Moves the selected engine either up or down in the engine list - * @param aDir - * -1 to move the selected engine down, +1 to move it up. - */ - bump: function engineManager_move(aDir) { - var selectedEngine = gEngineView.selectedEngine; - var newIndex = gEngineView.selectedIndex - aDir; - - gEngineView._engineStore.moveEngine(selectedEngine, newIndex); - - gEngineView.invalidate(); - gEngineView.selection.select(newIndex); - gEngineView.ensureRowIsVisible(newIndex); - this.showRestoreDefaults(true); - document.getElementById("engineList").focus(); - }, - - editKeyword: Task.async(function* engineManager_editKeyword() { - var selectedEngine = gEngineView.selectedEngine; - if (!selectedEngine) - return; - - var alias = { value: selectedEngine.alias }; - var strings = document.getElementById("engineManagerBundle"); - var title = strings.getString("editTitle"); - var msg = strings.getFormattedString("editMsg", [selectedEngine.name]); - - while (Services.prompt.prompt(window, title, msg, alias, null, {})) { - var bduplicate = false; - var eduplicate = false; - var dupName = ""; - - if (alias.value != "") { - // Check for duplicates in Places keywords. - bduplicate = !!(yield PlacesUtils.keywords.fetch(alias.value)); - - // Check for duplicates in changes we haven't committed yet - let engines = gEngineView._engineStore.engines; - for each (let engine in engines) { - if (engine.alias == alias.value && - engine.name != selectedEngine.name) { - eduplicate = true; - dupName = engine.name; - break; - } - } - } - - // Notify the user if they have chosen an existing engine/bookmark keyword - if (eduplicate || bduplicate) { - var dtitle = strings.getString("duplicateTitle"); - var bmsg = strings.getString("duplicateBookmarkMsg"); - var emsg = strings.getFormattedString("duplicateEngineMsg", [dupName]); - - Services.prompt.alert(window, dtitle, eduplicate ? emsg : bmsg); - } else { - gEngineView._engineStore.changeEngine(selectedEngine, "alias", - alias.value); - gEngineView.invalidate(); - break; - } - } - }), - - onSelect: function engineManager_onSelect() { - // Buttons only work if an engine is selected and it's not the last engine, - // the latter is true when the selected is first and last at the same time. - var lastSelected = (gEngineView.selectedIndex == gEngineView.lastIndex); - var firstSelected = (gEngineView.selectedIndex == 0); - var noSelection = (gEngineView.selectedIndex == -1); - - document.getElementById("cmd_remove") - .setAttribute("disabled", noSelection || - (firstSelected && lastSelected)); - - document.getElementById("cmd_moveup") - .setAttribute("disabled", noSelection || firstSelected); - - document.getElementById("cmd_movedown") - .setAttribute("disabled", noSelection || lastSelected); - - document.getElementById("cmd_editkeyword") - .setAttribute("disabled", noSelection); - } -}; - -function onDragEngineStart(event) { - var selectedIndex = gEngineView.selectedIndex; - if (selectedIndex >= 0) { - event.dataTransfer.setData(ENGINE_FLAVOR, selectedIndex.toString()); - event.dataTransfer.effectAllowed = "move"; - } -} - -// "Operation" objects -function EngineMoveOp(aEngineClone, aNewIndex) { - if (!aEngineClone) - throw new Error("bad args to new EngineMoveOp!"); - this._engine = aEngineClone.originalEngine; - this._newIndex = aNewIndex; -} -EngineMoveOp.prototype = { - _engine: null, - _newIndex: null, - commit: function EMO_commit() { - Services.search.moveEngine(this._engine, this._newIndex); - } -} - -function EngineRemoveOp(aEngineClone) { - if (!aEngineClone) - throw new Error("bad args to new EngineRemoveOp!"); - this._engine = aEngineClone.originalEngine; -} -EngineRemoveOp.prototype = { - _engine: null, - commit: function ERO_commit() { - Services.search.removeEngine(this._engine); - } -} - -function EngineUnhideOp(aEngineClone, aNewIndex) { - if (!aEngineClone) - throw new Error("bad args to new EngineUnhideOp!"); - this._engine = aEngineClone.originalEngine; - this._newIndex = aNewIndex; -} -EngineUnhideOp.prototype = { - _engine: null, - _newIndex: null, - commit: function EUO_commit() { - this._engine.hidden = false; - Services.search.moveEngine(this._engine, this._newIndex); - } -} - -function EngineChangeOp(aEngineClone, aProp, aValue) { - if (!aEngineClone) - throw new Error("bad args to new EngineChangeOp!"); - - this._engine = aEngineClone.originalEngine; - this._prop = aProp; - this._newValue = aValue; -} -EngineChangeOp.prototype = { - _engine: null, - _prop: null, - _newValue: null, - commit: function ECO_commit() { - this._engine[this._prop] = this._newValue; - } -} - -function EngineStore() { - this._engines = Services.search.getVisibleEngines().map(this._cloneEngine); - this._defaultEngines = Services.search.getDefaultEngines().map(this._cloneEngine); - - this._ops = []; - - // check if we need to disable the restore defaults button - var someHidden = this._defaultEngines.some(function (e) e.hidden); - gEngineManagerDialog.showRestoreDefaults(someHidden); -} -EngineStore.prototype = { - _engines: null, - _defaultEngines: null, - _ops: null, - - get engines() { - return this._engines; - }, - set engines(val) { - this._engines = val; - return val; - }, - - _getIndexForEngine: function ES_getIndexForEngine(aEngine) { - return this._engines.indexOf(aEngine); - }, - - _getEngineByName: function ES_getEngineByName(aName) { - for each (var engine in this._engines) - if (engine.name == aName) - return engine; - - return null; - }, - - _cloneEngine: function ES_cloneEngine(aEngine) { - var clonedObj={}; - for (var i in aEngine) - clonedObj[i] = aEngine[i]; - clonedObj.originalEngine = aEngine; - return clonedObj; - }, - - // Callback for Array's some(). A thisObj must be passed to some() - _isSameEngine: function ES_isSameEngine(aEngineClone) { - return aEngineClone.originalEngine == this.originalEngine; - }, - - commit: function ES_commit() { - var currentEngine = this._cloneEngine(Services.search.currentEngine); - for (var i = 0; i < this._ops.length; i++) - this._ops[i].commit(); - - // Restore currentEngine if it is a default engine that is still visible. - // Needed if the user deletes currentEngine and then restores it. - if (this._defaultEngines.some(this._isSameEngine, currentEngine) && - !currentEngine.originalEngine.hidden) - Services.search.currentEngine = currentEngine.originalEngine; - }, - - addEngine: function ES_addEngine(aEngine) { - this._engines.push(this._cloneEngine(aEngine)); - }, - - moveEngine: function ES_moveEngine(aEngine, aNewIndex) { - if (aNewIndex < 0 || aNewIndex > this._engines.length - 1) - throw new Error("ES_moveEngine: invalid aNewIndex!"); - var index = this._getIndexForEngine(aEngine); - if (index == -1) - throw new Error("ES_moveEngine: invalid engine?"); - - if (index == aNewIndex) - return; // nothing to do - - // Move the engine in our internal store - var removedEngine = this._engines.splice(index, 1)[0]; - this._engines.splice(aNewIndex, 0, removedEngine); - - this._ops.push(new EngineMoveOp(aEngine, aNewIndex)); - }, - - removeEngine: function ES_removeEngine(aEngine) { - var index = this._getIndexForEngine(aEngine); - if (index == -1) - throw new Error("invalid engine?"); - - this._engines.splice(index, 1); - this._ops.push(new EngineRemoveOp(aEngine)); - if (this._defaultEngines.some(this._isSameEngine, aEngine)) - gEngineManagerDialog.showRestoreDefaults(true); - }, - - restoreDefaultEngines: function ES_restoreDefaultEngines() { - var added = 0; - - for (var i = 0; i < this._defaultEngines.length; ++i) { - var e = this._defaultEngines[i]; - - // If the engine is already in the list, just move it. - if (this._engines.some(this._isSameEngine, e)) { - this.moveEngine(this._getEngineByName(e.name), i); - } else { - // Otherwise, add it back to our internal store - this._engines.splice(i, 0, e); - this._ops.push(new EngineUnhideOp(e, i)); - added++; - } - } - gEngineManagerDialog.showRestoreDefaults(false); - return added; - }, - - changeEngine: function ES_changeEngine(aEngine, aProp, aNewValue) { - var index = this._getIndexForEngine(aEngine); - if (index == -1) - throw new Error("invalid engine?"); - - this._engines[index][aProp] = aNewValue; - this._ops.push(new EngineChangeOp(aEngine, aProp, aNewValue)); - }, - - reloadIcons: function ES_reloadIcons() { - this._engines.forEach(function (e) { - e.uri = e.originalEngine.uri; - }); - } -} - -function EngineView(aEngineStore) { - this._engineStore = aEngineStore; -} -EngineView.prototype = { - _engineStore: null, - tree: null, - - get lastIndex() { - return this.rowCount - 1; - }, - get selectedIndex() { - var seln = this.selection; - if (seln.getRangeCount() > 0) { - var min = {}; - seln.getRangeAt(0, min, {}); - return min.value; - } - return -1; - }, - get selectedEngine() { - return this._engineStore.engines[this.selectedIndex]; - }, - - // Helpers - rowCountChanged: function (index, count) { - this.tree.rowCountChanged(index, count); - }, - - invalidate: function () { - this.tree.invalidate(); - }, - - ensureRowIsVisible: function (index) { - this.tree.ensureRowIsVisible(index); - }, - - getSourceIndexFromDrag: function (dataTransfer) { - return parseInt(dataTransfer.getData(ENGINE_FLAVOR)); - }, - - // nsITreeView - get rowCount() { - return this._engineStore.engines.length; - }, - - getImageSrc: function(index, column) { - if (column.id == "engineName" && this._engineStore.engines[index].iconURI) - return this._engineStore.engines[index].iconURI.spec; - return ""; - }, - - getCellText: function(index, column) { - if (column.id == "engineName") - return this._engineStore.engines[index].name; - else if (column.id == "engineKeyword") - return this._engineStore.engines[index].alias; - return ""; - }, - - setTree: function(tree) { - this.tree = tree; - }, - - canDrop: function(targetIndex, orientation, dataTransfer) { - var sourceIndex = this.getSourceIndexFromDrag(dataTransfer); - return (sourceIndex != -1 && - sourceIndex != targetIndex && - sourceIndex != targetIndex + orientation); - }, - - drop: function(dropIndex, orientation, dataTransfer) { - var sourceIndex = this.getSourceIndexFromDrag(dataTransfer); - var sourceEngine = this._engineStore.engines[sourceIndex]; - - if (dropIndex > sourceIndex) { - if (orientation == Ci.nsITreeView.DROP_BEFORE) - dropIndex--; - } else { - if (orientation == Ci.nsITreeView.DROP_AFTER) - dropIndex++; - } - - this._engineStore.moveEngine(sourceEngine, dropIndex); - gEngineManagerDialog.showRestoreDefaults(true); - - // Redraw, and adjust selection - this.invalidate(); - this.selection.select(dropIndex); - }, - - selection: null, - getRowProperties: function(index) { return ""; }, - getCellProperties: function(index, column) { return ""; }, - getColumnProperties: function(column) { return ""; }, - isContainer: function(index) { return false; }, - isContainerOpen: function(index) { return false; }, - isContainerEmpty: function(index) { return false; }, - isSeparator: function(index) { return false; }, - isSorted: function(index) { return false; }, - getParentIndex: function(index) { return -1; }, - hasNextSibling: function(parentIndex, index) { return false; }, - getLevel: function(index) { return 0; }, - getProgressMode: function(index, column) { }, - getCellValue: function(index, column) { }, - toggleOpenState: function(index) { }, - cycleHeader: function(column) { }, - selectionChanged: function() { }, - cycleCell: function(row, column) { }, - isEditable: function(index, column) { return false; }, - isSelectable: function(index, column) { return false; }, - setCellValue: function(index, column, value) { }, - setCellText: function(index, column, value) { }, - performAction: function(action) { }, - performActionOnRow: function(action, index) { }, - performActionOnCell: function(action, index, column) { } -}; diff --git a/components/search/content/engineManager.xul b/components/search/content/engineManager.xul deleted file mode 100644 index 1152ef8..0000000 --- a/components/search/content/engineManager.xul +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - + + + + diff --git a/webbrowser/base/content/global-devtools-theme-scripts.inc b/webbrowser/base/content/global-devtools-theme-scripts.inc new file mode 100644 index 0000000..408728e --- /dev/null +++ b/webbrowser/base/content/global-devtools-theme-scripts.inc @@ -0,0 +1,6 @@ +# -*- 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/. + + + +# All sets except for popupsets (commands, keys, stringbundles and broadcasters) *must* go into the +# browser-sets.inc file for sharing with hiddenWindow.xul. +#include browser-sets.inc + +# The entire main menubar is placed into browser-menubar.inc, so that it can be shared by +# hiddenWindow.xul. +#include browser-menubar.inc + + + + + + + + + + + diff --git a/webbrowser/base/content/nsContextMenu.js b/webbrowser/base/content/nsContextMenu.js new file mode 100644 index 0000000..916dd26 --- /dev/null +++ b/webbrowser/base/content/nsContextMenu.js @@ -0,0 +1,1603 @@ +# 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/. + +Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm"); + +var gContextMenuContentData = null; + +function nsContextMenu(aXulMenu, aIsShift) { + this.shouldDisplay = true; + this.initMenu(aXulMenu, aIsShift); +} + +// Prototype for nsContextMenu "class." +nsContextMenu.prototype = { + initMenu: function CM_initMenu(aXulMenu, aIsShift) { + // Get contextual info. + this.setTarget(document.popupNode, document.popupRangeParent, + document.popupRangeOffset); + if (!this.shouldDisplay) + return; + + this.hasPageMenu = false; + if (!aIsShift) { + this.hasPageMenu = PageMenu.maybeBuildAndAttachMenu(this.target, + aXulMenu); + } + + this.isFrameImage = document.getElementById("isFrameImage"); + this.ellipsis = "\u2026"; + try { + this.ellipsis = gPrefService.getComplexValue("intl.ellipsis", + Ci.nsIPrefLocalizedString).data; + } catch (e) { } + + this.isContentSelected = this.isContentSelection(); + this.onPlainTextLink = false; + + // Initialize (disable/remove) menu items. + this.initItems(); + }, + + hiding: function CM_hiding() { + gContextMenuContentData = null; + InlineSpellCheckerUI.clearSuggestionsFromMenu(); + InlineSpellCheckerUI.clearDictionaryListFromMenu(); + InlineSpellCheckerUI.uninit(); + }, + + initItems: function CM_initItems() { + this.initPageMenuSeparator(); + this.initOpenItems(); + this.initNavigationItems(); + this.initViewItems(); + this.initMiscItems(); + this.initSpellingItems(); + this.initSaveItems(); + this.initClipboardItems(); + this.initMediaPlayerItems(); + this.initLeaveDOMFullScreenItems(); + this.initClickToPlayItems(); + }, + + initPageMenuSeparator: function CM_initPageMenuSeparator() { + this.showItem("page-menu-separator", this.hasPageMenu); + }, + + initOpenItems: function CM_initOpenItems() { + var isMailtoInternal = false; + if (this.onMailtoLink) { + var mailtoHandler = Cc["@mozilla.org/uriloader/external-protocol-service;1"]. + getService(Ci.nsIExternalProtocolService). + getProtocolHandlerInfo("mailto"); + isMailtoInternal = (!mailtoHandler.alwaysAskBeforeHandling && + mailtoHandler.preferredAction == Ci.nsIHandlerInfo.useHelperApp && + (mailtoHandler.preferredApplicationHandler instanceof Ci.nsIWebHandlerApp)); + } + + // Time to do some bad things and see if we've highlighted a URL that + // isn't actually linked. + if (this.isTextSelected && !this.onLink) { + // Ok, we have some text, let's figure out if it looks like a URL. + let selection = document.commandDispatcher.focusedWindow + .getSelection(); + let linkText = selection.toString().trim(); + let uri; + if (/^(?:https?|ftp):/i.test(linkText)) { + try { + uri = makeURI(linkText); + } catch (ex) {} + } + // Check if this could be a valid url, just missing the protocol. + else if (/^[-a-z\d\.]+\.[-a-z\d]{2,}[-_=~:#%&\?\w\/\.]*$/i.test(linkText)) { + let uriFixup = Cc["@mozilla.org/docshell/urifixup;1"] + .getService(Ci.nsIURIFixup); + try { + uri = uriFixup.createFixupURI(linkText, uriFixup.FIXUP_FLAG_NONE); + } catch (ex) {} + } + + if (uri && uri.host) { + this.linkURI = uri; + this.linkURL = this.linkURI.spec; + this.onPlainTextLink = true; + } + } + + var shouldShow = this.onSaveableLink || isMailtoInternal || this.onPlainTextLink; + var isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(window); + this.showItem("context-openlink", shouldShow && !isWindowPrivate); + this.showItem("context-openlinkprivate", shouldShow); + this.showItem("context-openlinkintab", shouldShow); + this.showItem("context-openlinkincurrent", shouldShow); + this.showItem("context-sep-open", shouldShow); + }, + + initNavigationItems: function CM_initNavigationItems() { + var shouldShow = !(this.isContentSelected || this.onLink || this.onImage || + this.onCanvas || this.onVideo || this.onAudio || + this.onTextInput); + this.showItem("context-back", shouldShow); + this.showItem("context-forward", shouldShow); + + let stopped = XULBrowserWindow.stopCommand.getAttribute("disabled") == "true"; + + let stopReloadItem = ""; + if (shouldShow) { + stopReloadItem = stopped ? "reload" : "stop"; + } + + this.showItem("context-reload", stopReloadItem == "reload"); + this.showItem("context-stop", stopReloadItem == "stop"); + this.showItem("context-sep-stop", !!stopReloadItem); + + // XXX: Stop is determined in browser.js; the canStop broadcaster is broken + //this.setItemAttrFromNode( "context-stop", "disabled", "canStop" ); + }, + + initLeaveDOMFullScreenItems: function CM_initLeaveFullScreenItem() { + // only show the option if the user is in DOM fullscreen + var shouldShow = (this.target.ownerDocument.mozFullScreenElement != null); + this.showItem("context-leave-dom-fullscreen", shouldShow); + + // Explicitly show if in DOM fullscreen, but do not hide it has already been shown + if (shouldShow) + this.showItem("context-media-sep-commands", true); + }, + + initSaveItems: function CM_initSaveItems() { + var shouldShow = !(this.onTextInput || this.onLink || + this.isContentSelected || this.onImage || + this.onCanvas || this.onVideo || this.onAudio); + this.showItem("context-savepage", shouldShow); + this.showItem("context-sendpage", shouldShow); + + // Save+Send link depends on whether we're in a link, or selected text matches valid URL pattern. + this.showItem("context-savelink", this.onSaveableLink || this.onPlainTextLink); + this.showItem("context-sendlink", this.onSaveableLink || this.onPlainTextLink); + + // Save image depends on having loaded its content, video and audio don't. + this.showItem("context-saveimage", this.onLoadedImage || this.onCanvas); + this.showItem("context-savevideo", this.onVideo); + this.showItem("context-saveaudio", this.onAudio); + this.showItem("context-video-saveimage", this.onVideo); + this.setItemAttr("context-savevideo", "disabled", !this.mediaURL); + this.setItemAttr("context-saveaudio", "disabled", !this.mediaURL); + // Send media URL (but not for canvas, since it's a big data: URL) + this.showItem("context-sendimage", this.onImage); + this.showItem("context-sendvideo", this.onVideo); + this.showItem("context-sendaudio", this.onAudio); + this.setItemAttr("context-sendvideo", "disabled", !this.mediaURL); + this.setItemAttr("context-sendaudio", "disabled", !this.mediaURL); + }, + + initViewItems: function CM_initViewItems() { + // View source is always OK, unless in directory listing. + this.showItem("context-viewpartialsource-selection", + this.isContentSelected); + this.showItem("context-viewpartialsource-mathml", + this.onMathML && !this.isContentSelected); + + var shouldShow = !(this.isContentSelected || + this.onImage || this.onCanvas || + this.onVideo || this.onAudio || + this.onLink || this.onTextInput); + this.showItem("context-viewsource", shouldShow); + this.showItem("context-viewinfo", shouldShow); +#ifdef MOZ_DEVTOOLS + var showInspect = gPrefService.getBoolPref("devtools.inspector.enabled"); + this.showItem("inspect-separator", showInspect); + this.showItem("context-inspect", showInspect); +#endif + + this.showItem("context-sep-viewsource", shouldShow); + + // Set as Desktop background depends on whether an image was clicked on, + // and only works if we have a shell service. + var haveSetDesktopBackground = false; +#ifdef HAVE_SHELL_SERVICE + // Only enable Set as Desktop Background if we can get the shell service. + var shell = getShellService(); + if (shell) + haveSetDesktopBackground = shell.canSetDesktopBackground; +#endif + this.showItem("context-setDesktopBackground", + haveSetDesktopBackground && this.onLoadedImage); + + if (haveSetDesktopBackground && this.onLoadedImage) { + document.getElementById("context-setDesktopBackground") + .disabled = this.disableSetDesktopBackground(); + } + + // Reload image depends on an image that's not fully loaded + this.showItem("context-reloadimage", (this.onImage && !this.onCompletedImage)); + + // View image depends on having an image that's not standalone + // (or is in a frame), or a canvas. + this.showItem("context-viewimage", (this.onImage && + (!this.inSyntheticDoc || this.inFrame)) || this.onCanvas); + + // View video depends on not having a standalone video. + this.showItem("context-viewvideo", this.onVideo && (!this.inSyntheticDoc || this.inFrame)); + this.setItemAttr("context-viewvideo", "disabled", !this.mediaURL); + + // View background image depends on whether there is one, but don't make + // background images of a stand-alone media document available. + this.showItem("context-viewbgimage", shouldShow && + !this._hasMultipleBGImages && + !this.inSyntheticDoc); + this.showItem("context-sep-viewbgimage", shouldShow && + !this._hasMultipleBGImages && + !this.inSyntheticDoc); + document.getElementById("context-viewbgimage") + .disabled = !this.hasBGImage; + + this.showItem("context-viewimageinfo", this.onImage); + }, + + initMiscItems: function CM_initMiscItems() { + // Use "Bookmark This Link" if on a link. + this.showItem("context-bookmarkpage", + !(this.isContentSelected || this.onTextInput || this.onLink || + this.onImage || this.onVideo || this.onAudio)); + this.showItem("context-bookmarklink", (this.onLink && !this.onMailtoLink) || + this.onPlainTextLink); + this.showItem("context-keywordfield", + this.onTextInput && this.onKeywordField); + this.showItem("frame", this.inFrame); + + let showSearchSelect = (this.isTextSelected || this.onLink) && !this.onImage; + this.showItem("context-searchselect", showSearchSelect); + if (showSearchSelect) { + this.formatSearchContextItem(); + } + + // srcdoc cannot be opened separately due to concerns about web + // content with about:srcdoc in location bar masquerading as trusted + // chrome/addon content. + // No need to also test for this.inFrame as this is checked in the parent + // submenu. + this.showItem("context-showonlythisframe", !this.inSrcdocFrame); + this.showItem("context-openframeintab", !this.inSrcdocFrame); + this.showItem("context-openframe", !this.inSrcdocFrame); + this.showItem("context-bookmarkframe", !this.inSrcdocFrame); + this.showItem("open-frame-sep", !this.inSrcdocFrame); + + this.showItem("frame-sep", this.inFrame && this.isTextSelected); + + // Hide menu entries for images, show otherwise + if (this.inFrame) { + if (BrowserUtils.mimeTypeIsTextBased(this.target.ownerDocument.contentType)) + this.isFrameImage.removeAttribute('hidden'); + else + this.isFrameImage.setAttribute('hidden', 'true'); + } + + // BiDi UI + this.showItem("context-sep-bidi", top.gBidiUI); + this.showItem("context-bidi-text-direction-toggle", + this.onTextInput && top.gBidiUI); + this.showItem("context-bidi-page-direction-toggle", + !this.onTextInput && top.gBidiUI); + }, + + initSpellingItems: function() { + var canSpell = InlineSpellCheckerUI.canSpellCheck && this.canSpellCheck; + var onMisspelling = InlineSpellCheckerUI.overMisspelling; + var showUndo = canSpell && InlineSpellCheckerUI.canUndo(); + this.showItem("spell-check-enabled", canSpell); + this.showItem("spell-separator", canSpell || this.onEditableArea); + document.getElementById("spell-check-enabled") + .setAttribute("checked", canSpell && InlineSpellCheckerUI.enabled); + + this.showItem("spell-add-to-dictionary", onMisspelling); + this.showItem("spell-undo-add-to-dictionary", showUndo); + + // suggestion list + this.showItem("spell-suggestions-separator", onMisspelling || showUndo); + if (onMisspelling) { + var suggestionsSeparator = + document.getElementById("spell-add-to-dictionary"); + var numsug = + InlineSpellCheckerUI.addSuggestionsToMenu(suggestionsSeparator.parentNode, + suggestionsSeparator, 5); + this.showItem("spell-no-suggestions", numsug == 0); + } + else + this.showItem("spell-no-suggestions", false); + + // dictionary list + this.showItem("spell-dictionaries", canSpell && InlineSpellCheckerUI.enabled); + if (canSpell) { + var dictMenu = document.getElementById("spell-dictionaries-menu"); + var dictSep = document.getElementById("spell-language-separator"); + InlineSpellCheckerUI.addDictionaryListToMenu(dictMenu, dictSep); + this.showItem("spell-add-dictionaries-main", false); + } + else if (this.onEditableArea) { + // when there is no spellchecker but we might be able to spellcheck + // add the add to dictionaries item. This will ensure that people + // with no dictionaries will be able to download them + this.showItem("spell-add-dictionaries-main", true); + } + else + this.showItem("spell-add-dictionaries-main", false); + }, + + initClipboardItems: function() { + // Copy depends on whether there is selected text. + // Enabling this context menu item is now done through the global + // command updating system + // this.setItemAttr( "context-copy", "disabled", !this.isTextSelected() ); + goUpdateGlobalEditMenuItems(); + + this.showItem("context-undo", this.onTextInput); + this.showItem("context-sep-undo", this.onTextInput); + this.showItem("context-cut", this.onTextInput); + this.showItem("context-copy", + this.isContentSelected || this.onTextInput); + this.showItem("context-paste", this.onTextInput); + this.showItem("context-delete", this.onTextInput); + this.showItem("context-sep-paste", this.onTextInput); + this.showItem("context-selectall", !(this.onLink || this.onImage || + this.onVideo || this.onAudio || + this.inSyntheticDoc) || + this.isDesignMode); + this.showItem("context-sep-selectall", this.isContentSelected ); + + // XXX dr + // ------ + // nsDocumentViewer.cpp has code to determine whether we're + // on a link or an image. we really ought to be using that... + + // Copy email link depends on whether we're on an email link. + this.showItem("context-copyemail", this.onMailtoLink); + + // Copy link location depends on whether we're on a non-mailto link. + this.showItem("context-copylink", this.onLink && !this.onMailtoLink); + this.showItem("context-sep-copylink", this.onLink && + (this.onImage || this.onVideo || this.onAudio)); + +#ifdef CONTEXT_COPY_IMAGE_CONTENTS + // Copy image contents depends on whether we're on an image. + this.showItem("context-copyimage-contents", this.onImage); +#endif + // Copy image location depends on whether we're on an image. + this.showItem("context-copyimage", this.onImage); + this.showItem("context-copyvideourl", this.onVideo); + this.showItem("context-copyaudiourl", this.onAudio); + this.setItemAttr("context-copyvideourl", "disabled", !this.mediaURL); + this.setItemAttr("context-copyaudiourl", "disabled", !this.mediaURL); + this.showItem("context-sep-copyimage", this.onImage || + this.onVideo || this.onAudio); + }, + + initMediaPlayerItems: function() { + var onMedia = (this.onVideo || this.onAudio); + // Several mutually exclusive items... play/pause, mute/unmute, show/hide + this.showItem("context-media-play", onMedia && (this.target.paused || this.target.ended)); + this.showItem("context-media-pause", onMedia && !this.target.paused && !this.target.ended); + this.showItem("context-media-mute", onMedia && !this.target.muted); + this.showItem("context-media-unmute", onMedia && this.target.muted); + this.showItem("context-media-playbackrate", onMedia); + this.showItem("context-media-loop", onMedia); + this.showItem("context-media-showcontrols", onMedia && !this.target.controls); + this.showItem("context-media-hidecontrols", onMedia && this.target.controls); + this.showItem("context-video-fullscreen", this.onVideo && this.target.ownerDocument.mozFullScreenElement == null); + var statsShowing = this.onVideo && XPCNativeWrapper.unwrap(this.target).mozMediaStatisticsShowing; + this.showItem("context-video-showstats", this.onVideo && this.target.controls && !statsShowing); + this.showItem("context-video-hidestats", this.onVideo && this.target.controls && statsShowing); + + // Disable them when there isn't a valid media source loaded. + if (onMedia) { + this.setItemAttr("context-media-playbackrate-050x", "checked", this.target.playbackRate == 0.5); + this.setItemAttr("context-media-playbackrate-100x", "checked", this.target.playbackRate == 1.0); + this.setItemAttr("context-media-playbackrate-150x", "checked", this.target.playbackRate == 1.5); + this.setItemAttr("context-media-playbackrate-200x", "checked", this.target.playbackRate == 2.0); + this.setItemAttr("context-media-loop", "checked", this.target.loop); + var hasError = this.target.error != null || + this.target.networkState == this.target.NETWORK_NO_SOURCE; + this.setItemAttr("context-media-play", "disabled", hasError); + this.setItemAttr("context-media-pause", "disabled", hasError); + this.setItemAttr("context-media-mute", "disabled", hasError); + this.setItemAttr("context-media-unmute", "disabled", hasError); + this.setItemAttr("context-media-playbackrate", "disabled", hasError); + this.setItemAttr("context-media-playbackrate-050x", "disabled", hasError); + this.setItemAttr("context-media-playbackrate-100x", "disabled", hasError); + this.setItemAttr("context-media-playbackrate-150x", "disabled", hasError); + this.setItemAttr("context-media-playbackrate-200x", "disabled", hasError); + this.setItemAttr("context-media-showcontrols", "disabled", hasError); + this.setItemAttr("context-media-hidecontrols", "disabled", hasError); + if (this.onVideo) { + let canSaveSnapshot = this.target.readyState >= this.target.HAVE_CURRENT_DATA; + this.setItemAttr("context-video-saveimage", "disabled", !canSaveSnapshot); + this.setItemAttr("context-video-fullscreen", "disabled", hasError); + this.setItemAttr("context-video-showstats", "disabled", hasError); + this.setItemAttr("context-video-hidestats", "disabled", hasError); + } + } + this.showItem("context-media-sep-commands", onMedia); + }, + + initClickToPlayItems: function() { + this.showItem("context-ctp-play", this.onCTPPlugin); + this.showItem("context-ctp-hide", this.onCTPPlugin); + this.showItem("context-sep-ctp", this.onCTPPlugin); + }, + + inspectNode: function CM_inspectNode() { + let {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {}); + let gBrowser = this.browser.ownerDocument.defaultView.gBrowser; + let target = devtools.TargetFactory.forTab(gBrowser.selectedTab); + + return gDevTools.showToolbox(target, "inspector").then(function(toolbox) { + let inspector = toolbox.getCurrentPanel(); + + this.browser.messageManager.sendAsyncMessage("debug:inspect", {}, {node: this.target}); + inspector.walker.findInspectingNode().then(nodeFront => { + inspector.selection.setNodeFront(nodeFront, "browser-context-menu"); + }); + }.bind(this)); + }, + + // Set various context menu attributes based on the state of the world. + setTarget: function (aNode, aRangeParent, aRangeOffset) { + const xulNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; + if (aNode.namespaceURI == xulNS || + aNode.nodeType == Node.DOCUMENT_NODE || + this.isDisabledForEvents(aNode)) { + this.shouldDisplay = false; + return; + } + + // Initialize contextual info. + this.onImage = false; + this.onLoadedImage = false; + this.onCompletedImage = false; + this.onCanvas = false; + this.onVideo = false; + this.onAudio = false; + this.onTextInput = false; + this.onKeywordField = false; + this.mediaURL = ""; + this.onLink = false; + this.onMailtoLink = false; + this.onSaveableLink = false; + this.link = null; + this.linkURL = ""; + this.linkURI = null; + this.linkProtocol = ""; + this.linkDownload = ""; + this.onMathML = false; + this.inFrame = false; + this.inSrcdocFrame = false; + this.inSyntheticDoc = false; + this.hasBGImage = false; + this.bgImageURL = ""; + this.onEditableArea = false; + this.isDesignMode = false; + this.onCTPPlugin = false; + this.canSpellCheck = false; + this.textSelected = getBrowserSelection(); + this.isTextSelected = this.textSelected.length != 0; + + // Remember the node that was clicked. + this.target = aNode; + + this.browser = this.target.ownerDocument.defaultView + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShell) + .chromeEventHandler; + + // Check if we are in a synthetic document (stand alone image, video, etc.). + this.inSyntheticDoc = this.target.ownerDocument.mozSyntheticDocument; + // First, do checks for nodes that never have children. + if (this.target.nodeType == Node.ELEMENT_NODE) { + // See if the user clicked on an image. + if (this.target instanceof Ci.nsIImageLoadingContent && + this.target.currentURI) { + this.onImage = true; + + var request = + this.target.getRequest(Ci.nsIImageLoadingContent.CURRENT_REQUEST); + if (request && (request.imageStatus & request.STATUS_SIZE_AVAILABLE)) + this.onLoadedImage = true; + if (request && (request.imageStatus & request.STATUS_LOAD_COMPLETE)) + this.onCompletedImage = true; + + this.mediaURL = this.target.currentURI.spec; + } + else if (this.target instanceof HTMLCanvasElement) { + this.onCanvas = true; + } + else if (this.target instanceof HTMLVideoElement) { + this.mediaURL = this.target.currentSrc || this.target.src; + // Firefox always creates a HTMLVideoElement when loading an ogg file + // directly. If the media is actually audio, be smarter and provide a + // context menu with audio operations. + if (this.target.readyState >= this.target.HAVE_METADATA && + (this.target.videoWidth == 0 || this.target.videoHeight == 0)) { + this.onAudio = true; + } else { + this.onVideo = true; + } + } + else if (this.target instanceof HTMLAudioElement) { + this.onAudio = true; + this.mediaURL = this.target.currentSrc || this.target.src; + } + else if (this.target instanceof HTMLInputElement ) { + this.onTextInput = this.isTargetATextBox(this.target); + // Allow spellchecking UI on all text and search inputs. + if (this.onTextInput && ! this.target.readOnly && + (this.target.type == "text" || this.target.type == "search")) { + this.onEditableArea = true; + InlineSpellCheckerUI.init(this.target.QueryInterface(Ci.nsIDOMNSEditableElement).editor); + InlineSpellCheckerUI.initFromEvent(aRangeParent, aRangeOffset); + } + this.onKeywordField = this.isTargetAKeywordField(this.target); + } + else if (this.target instanceof HTMLTextAreaElement) { + this.onTextInput = true; + if (!this.target.readOnly) { + this.onEditableArea = true; + InlineSpellCheckerUI.init(this.target.QueryInterface(Ci.nsIDOMNSEditableElement).editor); + InlineSpellCheckerUI.initFromEvent(aRangeParent, aRangeOffset); + } + } + else if (this.target instanceof HTMLHtmlElement) { + var bodyElt = this.target.ownerDocument.body; + if (bodyElt) { + let computedURL; + try { + computedURL = this.getComputedURL(bodyElt, "background-image"); + this._hasMultipleBGImages = false; + } catch (e) { + this._hasMultipleBGImages = true; + } + if (computedURL) { + this.hasBGImage = true; + this.bgImageURL = makeURLAbsolute(bodyElt.baseURI, + computedURL); + } + } + } + else if ((this.target instanceof HTMLEmbedElement || + this.target instanceof HTMLObjectElement || + this.target instanceof HTMLAppletElement) && + this.target.displayedType == HTMLObjectElement.TYPE_NULL && + this.target.pluginFallbackType == HTMLObjectElement.PLUGIN_CLICK_TO_PLAY) { + this.onCTPPlugin = true; + } + + this.canSpellCheck = this._isSpellCheckEnabled(this.target); + } + else if (this.target.nodeType == Node.TEXT_NODE) { + // For text nodes, look at the parent node to determine the spellcheck attribute. + this.canSpellCheck = this.target.parentNode && + this._isSpellCheckEnabled(this.target); + } + + // Second, bubble out, looking for items of interest that can have childen. + // Always pick the innermost link, background image, etc. + const XMLNS = "http://www.w3.org/XML/1998/namespace"; + var elem = this.target; + while (elem) { + if (elem.nodeType == Node.ELEMENT_NODE) { + // Link? + if (!this.onLink && + // Be consistent with what hrefAndLinkNodeForClickEvent + // does in browser.js + ((elem instanceof HTMLAnchorElement && elem.href) || + (elem instanceof HTMLAreaElement && elem.href) || + elem instanceof HTMLLinkElement || + elem.getAttributeNS("http://www.w3.org/1999/xlink", "type") == "simple")) { + + // Target is a link or a descendant of a link. + this.onLink = true; + + // Remember corresponding element. + this.link = elem; + this.linkURL = this.getLinkURL(); + this.linkURI = this.getLinkURI(); + this.linkProtocol = this.getLinkProtocol(); + this.onMailtoLink = (this.linkProtocol == "mailto"); + this.onSaveableLink = this.isLinkSaveable( this.link ); + try { + if (elem.download) { + // Ignore download attribute on cross-origin links? + // This shoudn't be an issue because the download link presents + // the originating URL domain and protocol to help user understand + // from where file is downloaded and make right decision. + // If we decide we want this restriction: + // this.principal.checkMayLoad(this.linkURI, false, true); + this.linkDownload = elem.download; + } + } + catch (ex) {} + } + + // Background image? Don't bother if we've already found a + // background image further down the hierarchy. Otherwise, + // we look for the computed background-image style. + if (!this.hasBGImage && + !this._hasMultipleBGImages) { + let bgImgUrl; + try { + bgImgUrl = this.getComputedURL(elem, "background-image"); + this._hasMultipleBGImages = false; + } catch (e) { + this._hasMultipleBGImages = true; + } + if (bgImgUrl) { + this.hasBGImage = true; + this.bgImageURL = makeURLAbsolute(elem.baseURI, + bgImgUrl); + } + } + } + + elem = elem.parentNode; + } + + // See if the user clicked on MathML + const NS_MathML = "http://www.w3.org/1998/Math/MathML"; + if ((this.target.nodeType == Node.TEXT_NODE && + this.target.parentNode.namespaceURI == NS_MathML) + || (this.target.namespaceURI == NS_MathML)) + this.onMathML = true; + + // See if the user clicked in a frame. + var docDefaultView = this.target.ownerDocument.defaultView; + if (docDefaultView != docDefaultView.top) { + this.inFrame = true; + + if (this.target.ownerDocument.isSrcdocDocument) { + this.inSrcdocFrame = true; + } + } + + // if the document is editable, show context menu like in text inputs + if (!this.onEditableArea) { + var win = this.target.ownerDocument.defaultView; + if (win) { + var isEditable = false; + try { + var editingSession = win.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIEditingSession); + if (editingSession.windowIsEditable(win) && + this.getComputedStyle(this.target, "-moz-user-modify") == "read-write") { + isEditable = true; + } + } + catch(ex) { + // If someone built with composer disabled, we can't get an editing session. + } + + if (isEditable) { + this.onTextInput = true; + this.onKeywordField = false; + this.onImage = false; + this.onLoadedImage = false; + this.onCompletedImage = false; + this.onMathML = false; + this.inFrame = false; + this.inSrcdocFrame = false; + this.hasBGImage = false; + this.isDesignMode = true; + this.onEditableArea = true; + InlineSpellCheckerUI.init(editingSession.getEditorForWindow(win)); + var canSpell = InlineSpellCheckerUI.canSpellCheck && this.canSpellCheck; + InlineSpellCheckerUI.initFromEvent(aRangeParent, aRangeOffset); + this.showItem("spell-check-enabled", canSpell); + this.showItem("spell-separator", canSpell); + } + } + } + }, + + // Returns the computed style attribute for the given element. + getComputedStyle: function(aElem, aProp) { + return aElem.ownerDocument + .defaultView + .getComputedStyle(aElem, "").getPropertyValue(aProp); + }, + + // Returns a "url"-type computed style attribute value, with the url() stripped. + getComputedURL: function(aElem, aProp) { + var url = aElem.ownerDocument + .defaultView.getComputedStyle(aElem, "") + .getPropertyCSSValue(aProp); + if (url instanceof CSSValueList) { + if (url.length != 1) + throw "found multiple URLs"; + url = url[0]; + } + return url.primitiveType == CSSPrimitiveValue.CSS_URI ? + url.getStringValue() : null; + }, + + // Returns true if clicked-on link targets a resource that can be saved. + isLinkSaveable: function(aLink) { + // We don't do the Right Thing for news/snews yet, so turn them off + // until we do. + return this.linkProtocol && !( + this.linkProtocol == "mailto" || + this.linkProtocol == "javascript" || + this.linkProtocol == "news" || + this.linkProtocol == "snews" ); + }, + + _isSpellCheckEnabled: function(aNode) { + // We can always force-enable spellchecking on textboxes + if (this.isTargetATextBox(aNode)) { + return true; + } + // We can never spell check something which is not content editable + var editable = aNode.isContentEditable; + if (!editable && aNode.ownerDocument) { + editable = aNode.ownerDocument.designMode == "on"; + } + if (!editable) { + return false; + } + // Otherwise make sure that nothing in the parent chain disables spellchecking + return aNode.spellcheck; + }, + + // Open linked-to URL in a new window. + openLink : function () { + var doc = this.target.ownerDocument; + urlSecurityCheck(this.linkURL, doc.nodePrincipal); + openLinkIn(this.linkURL, "window", + { charset: doc.characterSet, + referrerURI: doc.documentURIObject, + referrerPolicy: doc.referrerPolicy, + originPrincipal: doc.nodePrincipal, + triggeringPrincipal: doc.nodePrincipal }); + }, + + // Open linked-to URL in a new private window. + openLinkInPrivateWindow : function () { + var doc = this.target.ownerDocument; + urlSecurityCheck(this.linkURL, doc.nodePrincipal); + openLinkIn(this.linkURL, "window", + { charset: doc.characterSet, + referrerURI: doc.documentURIObject, + referrerPolicy: doc.referrerPolicy, + originPrincipal: doc.nodePrincipal, + triggeringPrincipal: doc.nodePrincipal, + private: true }); + }, + + // Open linked-to URL in a new tab. + openLinkInTab: function() { + var doc = this.target.ownerDocument; + urlSecurityCheck(this.linkURL, doc.nodePrincipal); + openLinkIn(this.linkURL, "tab", + { charset: doc.characterSet, + referrerURI: doc.documentURIObject, + referrerPolicy: doc.referrerPolicy, + originPrincipal: doc.nodePrincipal, + triggeringPrincipal: doc.nodePrincipal }); + }, + + // open URL in current tab + openLinkInCurrent: function() { + var doc = this.target.ownerDocument; + urlSecurityCheck(this.linkURL, doc.nodePrincipal); + openLinkIn(this.linkURL, "current", + { charset: doc.characterSet, + referrerURI: doc.documentURIObject, + originPrincipal: doc.nodePrincipal, + triggeringPrincipal: doc.nodePrincipal }); + }, + + // Open frame in a new tab. + openFrameInTab: function() { + var doc = this.target.ownerDocument; + var frameURL = doc.location.href; + var referrer = doc.referrer; + openLinkIn(frameURL, "tab", + { charset: doc.characterSet, + referrerURI: referrer ? makeURI(referrer) : null }); + }, + + // Reload clicked-in frame. + reloadFrame: function() { + this.target.ownerDocument.location.reload(); + }, + + // Open clicked-in frame in its own window. + openFrame: function() { + var doc = this.target.ownerDocument; + var frameURL = doc.location.href; + var referrer = doc.referrer; + openLinkIn(frameURL, "window", + { charset: doc.characterSet, + referrerURI: referrer ? makeURI(referrer) : null }); + }, + + // Open clicked-in frame in the same window. + showOnlyThisFrame: function() { + var doc = this.target.ownerDocument; + var frameURL = doc.location.href; + + urlSecurityCheck(frameURL, this.browser.contentPrincipal, + Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); + var referrer = doc.referrer; + openUILinkIn(frameURL, "current", { disallowInheritPrincipal: true, + referrerURI: referrer ? makeURI(referrer) : null }); + }, + + reload: function(event) { + BrowserReloadOrDuplicate(event); + }, + + // View Partial Source + viewPartialSource: function(aContext) { + let target = aContext == "mathml" ? this.target : null; + top.gViewSourceUtils.viewPartialSourceInBrowser(gBrowser.selectedBrowser, target); + }, + + // Open new "view source" window with the frame's URL. + viewFrameSource: function() { + BrowserViewSourceOfDocument(this.target.ownerDocument); + }, + + viewInfo: function() { + BrowserPageInfo(this.target.ownerDocument.defaultView.top.document); + }, + + viewImageInfo: function() { + BrowserPageInfo(this.target.ownerDocument.defaultView.top.document, + "mediaTab", this.target); + }, + + viewFrameInfo: function() { + BrowserPageInfo(this.target.ownerDocument); + }, + + reloadImage: function(e) { + urlSecurityCheck(this.mediaURL, + this.browser.contentPrincipal, + Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); + + if (this.target instanceof Ci.nsIImageLoadingContent) + this.target.forceReload(); + }, + + // Change current window to the URL of the image, video, or audio. + viewMedia: function(e) { + var viewURL; + var doc = this.target.ownerDocument; + if (this.onCanvas) { + var target = this.target; + var win = doc.defaultView; + if (!win) { + Components.utils.reportError( + "View Image (on the element):\n" + + "This feature cannot be used, because it hasn't found " + + "an appropriate window."); + } else { + new Promise.resolve({then: function (resolve) { + target.toBlob((blob) => { + resolve(win.URL.createObjectURL(blob)); + }) + }}).then(function (blobURL) { + openUILink(blobURL, e, { disallowInheritPrincipal: true, + referrerURI: doc.documentURIObject }); + }, Components.utils.reportError); + } + } else { + viewURL = this.mediaURL; + urlSecurityCheck(viewURL, + this.browser.contentPrincipal, + Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); + let doc = this.target.ownerDocument; + openUILink(viewURL, e, { disallowInheritPrincipal: true, + referrerURI: doc.documentURIObject, + forceAllowDataURI: true }); + } + }, + + saveVideoFrameAsImage: function () { + let referrerURI = document.documentURIObject; + let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(this.browser); + + urlSecurityCheck(this.mediaURL, this.browser.contentPrincipal, + Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); + let name = ""; + try { + let uri = makeURI(this.mediaURL); + let url = uri.QueryInterface(Ci.nsIURL); + if (url.fileBaseName) + name = decodeURI(url.fileBaseName) + ".jpg"; + } catch (e) { } + if (!name) + name = "snapshot.jpg"; + var video = this.target; + var canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"); + canvas.width = video.videoWidth; + canvas.height = video.videoHeight; + var ctxDraw = canvas.getContext("2d"); + ctxDraw.drawImage(video, 0, 0); + saveImageURL(canvas.toDataURL("image/jpeg", ""), name, "SaveImageTitle", + true, false, referrerURI, null, null, null, + isPrivate); + }, + + fullScreenVideo: function () { + let video = this.target; + if (document.mozFullScreenEnabled) + video.mozRequestFullScreen(); + }, + + leaveDOMFullScreen: function() { + document.mozCancelFullScreen(); + }, + + // Change current window to the URL of the background image. + viewBGImage: function(e) { + urlSecurityCheck(this.bgImageURL, + this.browser.contentPrincipal, + Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); + var doc = this.target.ownerDocument; + openUILink(this.bgImageURL, e, { disallowInheritPrincipal: true, + referrerURI: doc.documentURIObject }); + }, + + disableSetDesktopBackground: function() { + // Disable the Set as Desktop Background menu item if we're still trying + // to load the image or the load failed. + if (!(this.target instanceof Ci.nsIImageLoadingContent)) + return true; + + if (("complete" in this.target) && !this.target.complete) + return true; + + if (this.target.currentURI.schemeIs("javascript")) + return true; + + var request = this.target + .QueryInterface(Ci.nsIImageLoadingContent) + .getRequest(Ci.nsIImageLoadingContent.CURRENT_REQUEST); + if (!request) + return true; + + return false; + }, + + setDesktopBackground: function() { + // Paranoia: check disableSetDesktopBackground again, in case the + // image changed since the context menu was initiated. + if (this.disableSetDesktopBackground()) + return; + + urlSecurityCheck(this.target.currentURI.spec, + this.target.ownerDocument.nodePrincipal); + + // Confirm since it's annoying if you hit this accidentally. + const kDesktopBackgroundURL = + "chrome://browser/content/setDesktopBackground.xul"; +#ifdef XP_MACOSX + // On Mac, the Set Desktop Background window is not modal. + // Don't open more than one Set Desktop Background window. + var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] + .getService(Components.interfaces.nsIWindowMediator); + var dbWin = wm.getMostRecentWindow("Shell:SetDesktopBackground"); + if (dbWin) { + dbWin.gSetBackground.init(this.target); + dbWin.focus(); + } + else { + openDialog(kDesktopBackgroundURL, "", + "centerscreen,chrome,dialog=no,dependent,resizable=no", + this.target); + } +#else + // On non-Mac platforms, the Set Wallpaper dialog is modal. + openDialog(kDesktopBackgroundURL, "", + "centerscreen,chrome,dialog,modal,dependent", + this.target); +#endif + }, + + // Save URL of clicked-on frame. + saveFrame: function () { + saveDocument(this.target.ownerDocument); + }, + + // Helper function to wait for appropriate MIME-type headers and + // then prompt the user with a file picker + saveHelper: function(linkURL, linkText, dialogTitle, bypassCache, doc, + linkDownload) { + // canonical def in nsURILoader.h + const NS_ERROR_SAVE_LINK_AS_TIMEOUT = 0x805d0020; + + // an object to proxy the data through to + // nsIExternalHelperAppService.doContent, which will wait for the + // appropriate MIME-type headers and then prompt the user with a + // file picker + function saveAsListener() {} + saveAsListener.prototype = { + extListener: null, + + onStartRequest: function saveLinkAs_onStartRequest(aRequest, aContext) { + + // if the timer fired, the error status will have been caused by that, + // and we'll be restarting in onStopRequest, so no reason to notify + // the user + if (aRequest.status == NS_ERROR_SAVE_LINK_AS_TIMEOUT) + return; + + timer.cancel(); + + // some other error occured; notify the user... + if (!Components.isSuccessCode(aRequest.status)) { + try { + const sbs = Cc["@mozilla.org/intl/stringbundle;1"]. + getService(Ci.nsIStringBundleService); + const bundle = sbs.createBundle( + "chrome://mozapps/locale/downloads/downloads.properties"); + + const title = bundle.GetStringFromName("downloadErrorAlertTitle"); + const msg = bundle.GetStringFromName("downloadErrorGeneric"); + + const promptSvc = Cc["@mozilla.org/embedcomp/prompt-service;1"]. + getService(Ci.nsIPromptService); + promptSvc.alert(doc.defaultView, title, msg); + } catch (ex) {} + return; + } + + var extHelperAppSvc = + Cc["@mozilla.org/uriloader/external-helper-app-service;1"]. + getService(Ci.nsIExternalHelperAppService); + var channel = aRequest.QueryInterface(Ci.nsIChannel); + this.extListener = + extHelperAppSvc.doContent(channel.contentType, aRequest, + doc.defaultView, true); + this.extListener.onStartRequest(aRequest, aContext); + }, + + onStopRequest: function saveLinkAs_onStopRequest(aRequest, aContext, + aStatusCode) { + if (aStatusCode == NS_ERROR_SAVE_LINK_AS_TIMEOUT) { + // do it the old fashioned way, which will pick the best filename + // it can without waiting. + saveURL(linkURL, linkText, dialogTitle, bypassCache, false, doc.documentURIObject, doc); + } + if (this.extListener) + this.extListener.onStopRequest(aRequest, aContext, aStatusCode); + }, + + onDataAvailable: function saveLinkAs_onDataAvailable(aRequest, aContext, + aInputStream, + aOffset, aCount) { + this.extListener.onDataAvailable(aRequest, aContext, aInputStream, + aOffset, aCount); + } + } + + function callbacks() {} + callbacks.prototype = { + getInterface: function sLA_callbacks_getInterface(aIID) { + if (aIID.equals(Ci.nsIAuthPrompt) || aIID.equals(Ci.nsIAuthPrompt2)) { + // If the channel demands authentication prompt, we must cancel it + // because the save-as-timer would expire and cancel the channel + // before we get credentials from user. Both authentication dialog + // and save as dialog would appear on the screen as we fall back to + // the old fashioned way after the timeout. + timer.cancel(); + channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT); + } + throw Cr.NS_ERROR_NO_INTERFACE; + } + } + + // if it we don't have the headers after a short time, the user + // won't have received any feedback from their click. that's bad. so + // we give up waiting for the filename. + function timerCallback() {} + timerCallback.prototype = { + notify: function sLA_timer_notify(aTimer) { + channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT); + return; + } + } + + // setting up a new channel for 'right click - save link as ...' + var channel = NetUtil.newChannel({ + uri: makeURI(linkURL), + loadingPrincipal: this.target.ownerDocument.nodePrincipal, + contentPolicyType: Ci.nsIContentPolicy.TYPE_SAVEAS_DOWNLOAD, + securityFlags: Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS, + }); + + if (linkDownload) + channel.contentDispositionFilename = linkDownload; + if (channel instanceof Ci.nsIPrivateBrowsingChannel) { + let docIsPrivate = PrivateBrowsingUtils.isWindowPrivate(doc.defaultView); + channel.setPrivate(docIsPrivate); + } + channel.notificationCallbacks = new callbacks(); + + let flags = Ci.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS; + + if (bypassCache) + flags |= Ci.nsIRequest.LOAD_BYPASS_CACHE; + + if (channel instanceof Ci.nsICachingChannel) + flags |= Ci.nsICachingChannel.LOAD_BYPASS_LOCAL_CACHE_IF_BUSY; + + channel.loadFlags |= flags; + + if (channel instanceof Ci.nsIHttpChannel) { + channel.referrer = doc.documentURIObject; + if (channel instanceof Ci.nsIHttpChannelInternal) + channel.forceAllowThirdPartyCookie = true; + } + + // fallback to the old way if we don't see the headers quickly + var timeToWait = + gPrefService.getIntPref("browser.download.saveLinkAsFilenameTimeout"); + var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); + timer.initWithCallback(new timerCallback(), timeToWait, + timer.TYPE_ONE_SHOT); + + // kick off the channel with our proxy object as the listener + channel.asyncOpen2(new saveAsListener()); + }, + + // Save URL of clicked-on link. + saveLink: function() { + var doc = this.target.ownerDocument; + var linkText; + // If selected text is found to match valid URL pattern. + if (this.onPlainTextLink) + linkText = document.commandDispatcher.focusedWindow.getSelection().toString().trim(); + else + linkText = this.linkText(); + urlSecurityCheck(this.linkURL, doc.nodePrincipal); + + this.saveHelper(this.linkURL, linkText, null, true, doc, + this.linkDownload); + }, + + sendLink: function() { + // we don't know the title of the link so pass in an empty string + MailIntegration.sendMessage( this.linkURL, "" ); + }, + + // Backwards-compatibility wrapper + saveImage : function() { + if (this.onCanvas || this.onImage) + this.saveMedia(); + }, + + // Save URL of the clicked upon image, video, or audio. + saveMedia: function() { + var doc = this.target.ownerDocument; + let referrerURI = doc.documentURIObject; + let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(this.browser); + if (this.onCanvas) { + // Bypass cache, since it's a blob: URL. + var target = this.target; + var win = doc.defaultView; + if (!win) { + Components.utils.reportError( + "Save Image As (on the element):\n" + + "This feature cannot be used, because it hasn't found " + + "an appropriate window."); + } else { + new Promise.resolve({then: function (resolve) { + target.toBlob((blob) => { + resolve(win.URL.createObjectURL(blob)); + }) + }}).then(function (blobURL) { + saveImageURL(blobURL, "canvas.png", "SaveImageTitle", + true, false, referrerURI, null, null, null, + isPrivate); + }, Components.utils.reportError); + } + } else if (this.onImage) { + urlSecurityCheck(this.mediaURL, doc.nodePrincipal); + saveImageURL(this.mediaURL, null, "SaveImageTitle", + false, false, referrerURI, doc, null, null, + isPrivate); + } else if (this.onVideo || this.onAudio) { + urlSecurityCheck(this.mediaURL, doc.nodePrincipal); + var dialogTitle = this.onVideo ? "SaveVideoTitle" : "SaveAudioTitle"; + this.saveHelper(this.mediaURL, null, dialogTitle, false, doc, ""); + } + }, + + // Backwards-compatibility wrapper + sendImage : function() { + if (this.onCanvas || this.onImage) + this.sendMedia(); + }, + + sendMedia: function() { + MailIntegration.sendMessage(this.mediaURL, ""); + }, + + playPlugin: function() { + gPluginHandler._showClickToPlayNotification(this.browser, this.target); + }, + + hidePlugin: function() { + gPluginHandler.hideClickToPlayOverlay(this.target); + }, + + // Generate email address and put it on clipboard. + copyEmail: function() { + // Copy the comma-separated list of email addresses only. + // There are other ways of embedding email addresses in a mailto: + // link, but such complex parsing is beyond us. + var url = this.linkURL; + var qmark = url.indexOf("?"); + var addresses; + + // 7 == length of "mailto:" + addresses = qmark > 7 ? url.substring(7, qmark) : url.substr(7); + + // Let's try to unescape it using a character set + // in case the address is not ASCII. + try { + var characterSet = this.target.ownerDocument.characterSet; + const textToSubURI = Cc["@mozilla.org/intl/texttosuburi;1"]. + getService(Ci.nsITextToSubURI); + addresses = textToSubURI.unEscapeURIForUI(characterSet, addresses); + } + catch(ex) { + // Do nothing. + } + + var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]. + getService(Ci.nsIClipboardHelper); + clipboard.copyString(addresses, document); + }, + + /////////////// + // Utilities // + /////////////// + + // Show/hide one item (specified via name or the item element itself). + showItem: function(aItemOrId, aShow) { + var item = aItemOrId.constructor == String ? + document.getElementById(aItemOrId) : aItemOrId; + if (item) + item.hidden = !aShow; + }, + + // Set given attribute of specified context-menu item. If the + // value is null, then it removes the attribute (which works + // nicely for the disabled attribute). + setItemAttr: function(aID, aAttr, aVal ) { + var elem = document.getElementById(aID); + if (elem) { + if (aVal == null) { + // null indicates attr should be removed. + elem.removeAttribute(aAttr); + } + else { + // Set attr=val. + elem.setAttribute(aAttr, aVal); + } + } + }, + + // Set context menu attribute according to like attribute of another node + // (such as a broadcaster). + setItemAttrFromNode: function(aItem_id, aAttr, aOther_id) { + var elem = document.getElementById(aOther_id); + if (elem && elem.getAttribute(aAttr) == "true") + this.setItemAttr(aItem_id, aAttr, "true"); + else + this.setItemAttr(aItem_id, aAttr, null); + }, + + // Temporary workaround for DOM api not yet implemented by XUL nodes. + cloneNode: function(aItem) { + // Create another element like the one we're cloning. + var node = document.createElement(aItem.tagName); + + // Copy attributes from argument item to the new one. + var attrs = aItem.attributes; + for (var i = 0; i < attrs.length; i++) { + var attr = attrs.item(i); + node.setAttribute(attr.nodeName, attr.nodeValue); + } + + // Voila! + return node; + }, + + // Generate fully qualified URL for clicked-on link. + getLinkURL: function() { + var href = this.link.href; + if (href) + return href; + + href = this.link.getAttributeNS("http://www.w3.org/1999/xlink", + "href"); + + if (!href || !href.match(/\S/)) { + // Without this we try to save as the current doc, + // for example, HTML case also throws if empty + throw "Empty href"; + } + + return makeURLAbsolute(this.link.baseURI, href); + }, + + getLinkURI: function() { + try { + return makeURI(this.linkURL); + } + catch (ex) { + // e.g. empty URL string + } + + return null; + }, + + getLinkProtocol: function() { + if (this.linkURI) + return this.linkURI.scheme; // can be |undefined| + + return null; + }, + + // Get text of link. + linkText: function() { + var text = gatherTextUnder(this.link); + if (!text || !text.match(/\S/)) { + text = this.link.getAttribute("title"); + if (!text || !text.match(/\S/)) { + text = this.link.getAttribute("alt"); + if (!text || !text.match(/\S/)) + text = this.linkURL; + } + } + + return text; + }, + + // Returns true if anything is selected. + isContentSelection: function() { + return !document.commandDispatcher.focusedWindow.getSelection().isCollapsed; + }, + + toString: function () { + return "contextMenu.target = " + this.target + "\n" + + "contextMenu.onImage = " + this.onImage + "\n" + + "contextMenu.onLink = " + this.onLink + "\n" + + "contextMenu.link = " + this.link + "\n" + + "contextMenu.inFrame = " + this.inFrame + "\n" + + "contextMenu.hasBGImage = " + this.hasBGImage + "\n"; + }, + + isDisabledForEvents: function(aNode) { + let ownerDoc = aNode.ownerDocument; + return ownerDoc.defaultView && + ownerDoc.defaultView + .QueryInterface(Components.interfaces.nsIInterfaceRequestor) + .getInterface(Components.interfaces.nsIDOMWindowUtils) + .isNodeDisabledForEvents(aNode); + }, + + isTargetATextBox: function(node) { + if (node instanceof HTMLInputElement) + return node.mozIsTextField(false); + + return (node instanceof HTMLTextAreaElement); + }, + + isTargetAKeywordField: function(aNode) { + if (!(aNode instanceof HTMLInputElement)) + return false; + + var form = aNode.form; + if (!form || aNode.type == "password") + return false; + + var method = form.method.toUpperCase(); + + // These are the following types of forms we can create keywords for: + // + // method encoding type can create keyword + // GET * YES + // * YES + // POST YES + // POST application/x-www-form-urlencoded YES + // POST text/plain NO (a little tricky to do) + // POST multipart/form-data NO + // POST everything else YES + return (method == "GET" || method == "") || + (form.enctype != "text/plain") && (form.enctype != "multipart/form-data"); + }, + + // Determines whether or not the separator with the specified ID should be + // shown or not by determining if there are any non-hidden items between it + // and the previous separator. + shouldShowSeparator: function (aSeparatorID) { + var separator = document.getElementById(aSeparatorID); + if (separator) { + var sibling = separator.previousSibling; + while (sibling && sibling.localName != "menuseparator") { + if (!sibling.hidden) + return true; + sibling = sibling.previousSibling; + } + } + return false; + }, + + addDictionaries: function() { + var uri = formatURL("browser.dictionaries.download.url", true); + + var locale = "-"; + try { + locale = gPrefService.getComplexValue("intl.accept_languages", + Ci.nsIPrefLocalizedString).data; + } + catch (e) { } + + var version = "-"; + try { + version = Cc["@mozilla.org/xre/app-info;1"]. + getService(Ci.nsIXULAppInfo).version; + } + catch (e) { } + + uri = uri.replace(/%LOCALE%/, escape(locale)).replace(/%VERSION%/, version); + + var newWindowPref = gPrefService.getIntPref("browser.link.open_newwindow"); + var where = newWindowPref == 3 ? "tab" : "window"; + + openUILinkIn(uri, where); + }, + + bookmarkThisPage: function CM_bookmarkThisPage() { + window.top.PlacesCommandHook.bookmarkPage(this.browser, PlacesUtils.bookmarksMenuFolderId, true); + }, + + bookmarkLink: function CM_bookmarkLink() { + var linkText; + // If selected text is found to match valid URL pattern. + if (this.onPlainTextLink) + linkText = document.commandDispatcher.focusedWindow.getSelection().toString().trim(); + else + linkText = this.linkText(); + window.top.PlacesCommandHook.bookmarkLink(PlacesUtils.bookmarksMenuFolderId, this.linkURL, + linkText); + }, + + addBookmarkForFrame: function CM_addBookmarkForFrame() { + var doc = this.target.ownerDocument; + var uri = doc.documentURIObject; + + var itemId = PlacesUtils.getMostRecentBookmarkForURI(uri); + if (itemId == -1) { + var title = doc.title; + var description = PlacesUIUtils.getDescriptionFromDocument(doc); + PlacesUIUtils.showBookmarkDialog({ action: "add" + , type: "bookmark" + , uri: uri + , title: title + , description: description + , hiddenRows: [ "description" + , "location" + , "loadInSidebar" + , "keyword" ] + }, window.top); + } + else { + PlacesUIUtils.showBookmarkDialog({ action: "edit" + , type: "bookmark" + , itemId: itemId + }, window.top); + } + }, + + savePageAs: function CM_savePageAs() { + saveDocument(this.browser.contentDocument); + }, + + sendPage: function CM_sendPage() { + MailIntegration.sendLinkForWindow(this.browser.contentWindow); + }, + + printFrame: function CM_printFrame() { + PrintUtils.print(this.target.ownerDocument.defaultView); + }, + + switchPageDirection: function CM_switchPageDirection() { + SwitchDocumentDirection(this.browser.contentWindow); + }, + + mediaCommand : function CM_mediaCommand(command, data) { + var media = this.target; + + switch (command) { + case "play": + media.play(); + break; + case "pause": + media.pause(); + break; + case "loop": + media.loop = !media.loop; + break; + case "mute": + media.muted = true; + break; + case "unmute": + media.muted = false; + break; + case "playbackRate": + media.playbackRate = data; + break; + case "hidecontrols": + media.removeAttribute("controls"); + break; + case "showcontrols": + media.setAttribute("controls", "true"); + break; + case "hidestats": + case "showstats": + var event = media.ownerDocument.createEvent("CustomEvent"); + event.initCustomEvent("media-showStatistics", false, true, command == "showstats"); + media.dispatchEvent(event); + break; + } + }, + + copyMediaLocation : function () { + var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]. + getService(Ci.nsIClipboardHelper); + clipboard.copyString(this.mediaURL, document); + }, + + get imageURL() { + if (this.onImage) + return this.mediaURL; + return ""; + }, + + // Formats the 'Search for ""' context menu. + formatSearchContextItem: function() { + var menuItem = document.getElementById("context-searchselect"); + var selectedText = this.isTextSelected ? this.textSelected : this.linkText(); + + // Store searchTerms in context menu item so we know what to search onclick + menuItem.searchTerms = selectedText; + + if (selectedText.length > 15) + selectedText = selectedText.substr(0,15) + this.ellipsis; + + // Use the current engine if the search bar is visible, the default + // engine otherwise. + var engineName = ""; + var ss = Cc["@mozilla.org/browser/search-service;1"]. + getService(Ci.nsIBrowserSearchService); + if (isElementVisible(BrowserSearch.searchBar)) + engineName = ss.currentEngine.name; + else + engineName = ss.defaultEngine.name; + + // format "Search for " string to show in menu + var menuLabel = gNavigatorBundle.getFormattedString("contextMenuSearch", + [engineName, + selectedText]); + menuItem.label = menuLabel; + menuItem.accessKey = gNavigatorBundle.getString("contextMenuSearch.accesskey"); + } +}; diff --git a/webbrowser/base/content/openLocation.js b/webbrowser/base/content/openLocation.js new file mode 100644 index 0000000..7ad2f7c --- /dev/null +++ b/webbrowser/base/content/openLocation.js @@ -0,0 +1,150 @@ +/* -*- 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/. */ + +var browser; +var dialog = {}; +var pref = null; +var openLocationModule = {}; +try { + pref = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); +} catch (ex) { + // not critical, remain silent +} + +Components.utils.import("resource:///modules/openLocationLastURL.jsm", openLocationModule); +var gOpenLocationLastURL = new openLocationModule.OpenLocationLastURL(window.opener); + +function onLoad() +{ + dialog.input = document.getElementById("dialog.input"); + dialog.open = document.documentElement.getButton("accept"); + dialog.openWhereList = document.getElementById("openWhereList"); + dialog.openTopWindow = document.getElementById("currentWindow"); + dialog.bundle = document.getElementById("openLocationBundle"); + + if ("arguments" in window && window.arguments.length >= 1) + browser = window.arguments[0]; + + dialog.openWhereList.selectedItem = dialog.openTopWindow; + + if (pref) { + try { + var useAutoFill = pref.getBoolPref("browser.urlbar.autoFill"); + if (useAutoFill) + dialog.input.setAttribute("completedefaultindex", "true"); + } catch (ex) {} + + try { + var value = pref.getIntPref("general.open_location.last_window_choice"); + var element = dialog.openWhereList.getElementsByAttribute("value", value)[0]; + if (element) + dialog.openWhereList.selectedItem = element; + dialog.input.value = gOpenLocationLastURL.value; + } + catch(ex) { + } + if (dialog.input.value) + dialog.input.select(); // XXX should probably be done automatically + } + + doEnabling(); +} + +function doEnabling() +{ + dialog.open.disabled = !dialog.input.value; +} + +function open() +{ + var openData = { + "url": null, + "postData": null, + "mayInheritPrincipal": false + }; + if (browser) { + browser.getShortcutOrURIAndPostData(dialog.input.value).then(data => { + openData.url = data.url; + openData.postData = data.postData; + openData.mayInheritPrincipal = data.mayInheritPrincipal; + + openLocation(openData); + }); + } else { + openData.url = dialog.input.value; + + openLocation(openData); + } + + return false; +} + +function openLocation(openData) +{ + try { + // Whichever target we use for the load, we allow third-party services to + // fix up the URI + switch (dialog.openWhereList.value) { + case "0": + var webNav = Components.interfaces.nsIWebNavigation; + var flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP | + webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS; + if (!openData.mayInheritPrincipal) + flags |= webNav.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL; + browser.gBrowser.loadURIWithFlags( + openData.url, flags, null, null, openData.postData); + break; + case "1": + window.opener.delayedOpenWindow(getBrowserURL(), "all,dialog=no", + openData.url, openData.postData, + null, null, true); + break; + case "3": + browser.delayedOpenTab( + openData.url, null, null, openData.postData, true); + break; + } + } catch (ex) {} + + if (pref) { + gOpenLocationLastURL.value = dialog.input.value; + pref.setIntPref( + "general.open_location.last_window_choice", dialog.openWhereList.value); + } + + window.close(); +} + +function createInstance(contractid, iidName) +{ + var iid = Components.interfaces[iidName]; + return Components.classes[contractid].createInstance(iid); +} + +const nsIFilePicker = Components.interfaces.nsIFilePicker; +function onChooseFile() +{ + try { + let fp = Components.classes["@mozilla.org/filepicker;1"]. + createInstance(nsIFilePicker); + let fpCallback = function fpCallback_done(aResult) { + if (aResult == nsIFilePicker.returnOK && fp.fileURL.spec && + fp.fileURL.spec.length > 0) { + dialog.input.value = fp.fileURL.spec; + } + doEnabling(); + }; + + fp.init(window, dialog.bundle.getString("chooseFileDialogTitle"), + nsIFilePicker.modeOpen); + fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText | + nsIFilePicker.filterImages | nsIFilePicker.filterXML | + nsIFilePicker.filterHTML); + fp.open(fpCallback); + } catch (ex) { + } +} diff --git a/webbrowser/base/content/openLocation.xul b/webbrowser/base/content/openLocation.xul new file mode 100644 index 0000000..7bafed0 --- /dev/null +++ b/webbrowser/base/content/openLocation.xul @@ -0,0 +1,57 @@ + + + + + + + + + + + +#endif + + + + + + + +
+ + +
+

&certerror.longpagetitle;

+
+ + +
+
+

&certerror.introPara1;

+

&certerror.introPara2;

+
+ +
+

&certerror.whatShouldIDo.heading;

+
+

&certerror.whatShouldIDo.content;

+ +
+
+ + +

+ +

+

+ +

+ +

+
+

&certerror.expert.content;

+

&certerror.expert.contentPara2;

+ +
+
+
+ + + + + + diff --git a/webbrowser/components/certerror/jar.mn b/webbrowser/components/certerror/jar.mn new file mode 100644 index 0000000..08e0710 --- /dev/null +++ b/webbrowser/components/certerror/jar.mn @@ -0,0 +1,7 @@ +# 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/. + +browser.jar: + content/browser/certerror/aboutCertError.xhtml (content/aboutCertError.xhtml) + content/browser/certerror/aboutCertError.css (content/aboutCertError.css) diff --git a/webbrowser/components/certerror/moz.build b/webbrowser/components/certerror/moz.build new file mode 100644 index 0000000..c97072b --- /dev/null +++ b/webbrowser/components/certerror/moz.build @@ -0,0 +1,7 @@ +# -*- Mode: python; c-basic-offset: 4; 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/. + +JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/webbrowser/components/dirprovider/DirectoryProvider.cpp b/webbrowser/components/dirprovider/DirectoryProvider.cpp new file mode 100644 index 0000000..85728b3 --- /dev/null +++ b/webbrowser/components/dirprovider/DirectoryProvider.cpp @@ -0,0 +1,268 @@ +/* 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 "nsIDirectoryService.h" +#include "DirectoryProvider.h" + +#include "nsIFile.h" +#include "nsISimpleEnumerator.h" +#include "nsIPrefService.h" +#include "nsIPrefBranch.h" + +#include "nsArrayEnumerator.h" +#include "nsEnumeratorUtils.h" +#include "nsAppDirectoryServiceDefs.h" +#include "nsDirectoryServiceDefs.h" +#include "nsCategoryManagerUtils.h" +#include "nsComponentManagerUtils.h" +#include "nsCOMArray.h" +#include "nsDirectoryServiceUtils.h" +#include "mozilla/ModuleUtils.h" +#include "nsServiceManagerUtils.h" +#include "nsStringAPI.h" +#include "nsXULAppAPI.h" +#include "nsIPrefLocalizedString.h" + +namespace mozilla { +namespace browser { + +NS_IMPL_ISUPPORTS(DirectoryProvider, + nsIDirectoryServiceProvider, + nsIDirectoryServiceProvider2) + +NS_IMETHODIMP +DirectoryProvider::GetFile(const char *aKey, bool *aPersist, nsIFile* *aResult) +{ + return NS_ERROR_FAILURE; +} + +static void +AppendFileKey(const char *key, nsIProperties* aDirSvc, + nsCOMArray &array) +{ + nsCOMPtr file; + nsresult rv = aDirSvc->Get(key, NS_GET_IID(nsIFile), getter_AddRefs(file)); + if (NS_FAILED(rv)) + return; + + bool exists; + rv = file->Exists(&exists); + if (NS_FAILED(rv) || !exists) + return; + + array.AppendObject(file); +} + +// Appends the distribution-specific search engine directories to the +// array. The directory structure is as follows: + +// appdir/ +// \- distribution/ +// \- searchplugins/ +// |- common/ +// \- locale/ +// |- / +// ... +// \- / + +// common engines are loaded for all locales. If there is no locale +// directory for the current locale, there is a pref: +// "distribution.searchplugins.defaultLocale" +// which specifies a default locale to use. + +static void +AppendDistroSearchDirs(nsIProperties* aDirSvc, nsCOMArray &array) +{ + nsCOMPtr searchPlugins; + nsresult rv = aDirSvc->Get(XRE_APP_DISTRIBUTION_DIR, + NS_GET_IID(nsIFile), + getter_AddRefs(searchPlugins)); + if (NS_FAILED(rv)) + return; + searchPlugins->AppendNative(NS_LITERAL_CSTRING("searchplugins")); + + bool exists; + rv = searchPlugins->Exists(&exists); + if (NS_FAILED(rv) || !exists) + return; + + nsCOMPtr commonPlugins; + rv = searchPlugins->Clone(getter_AddRefs(commonPlugins)); + if (NS_SUCCEEDED(rv)) { + commonPlugins->AppendNative(NS_LITERAL_CSTRING("common")); + rv = commonPlugins->Exists(&exists); + if (NS_SUCCEEDED(rv) && exists) + array.AppendObject(commonPlugins); + } + + nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefs) { + + nsCOMPtr localePlugins; + rv = searchPlugins->Clone(getter_AddRefs(localePlugins)); + if (NS_FAILED(rv)) + return; + + localePlugins->AppendNative(NS_LITERAL_CSTRING("locale")); + + nsCString locale; + nsCOMPtr prefString; + rv = prefs->GetComplexValue("general.useragent.locale", + NS_GET_IID(nsIPrefLocalizedString), + getter_AddRefs(prefString)); + if (NS_SUCCEEDED(rv)) { + nsAutoString wLocale; + prefString->GetData(getter_Copies(wLocale)); + CopyUTF16toUTF8(wLocale, locale); + } else { + rv = prefs->GetCharPref("general.useragent.locale", getter_Copies(locale)); + } + + if (NS_SUCCEEDED(rv)) { + + nsCOMPtr curLocalePlugins; + rv = localePlugins->Clone(getter_AddRefs(curLocalePlugins)); + if (NS_SUCCEEDED(rv)) { + + curLocalePlugins->AppendNative(locale); + rv = curLocalePlugins->Exists(&exists); + if (NS_SUCCEEDED(rv) && exists) { + array.AppendObject(curLocalePlugins); + return; // all done + } + } + } + + // we didn't append the locale dir - try the default one + nsCString defLocale; + rv = prefs->GetCharPref("distribution.searchplugins.defaultLocale", + getter_Copies(defLocale)); + if (NS_SUCCEEDED(rv)) { + + nsCOMPtr defLocalePlugins; + rv = localePlugins->Clone(getter_AddRefs(defLocalePlugins)); + if (NS_SUCCEEDED(rv)) { + + defLocalePlugins->AppendNative(defLocale); + rv = defLocalePlugins->Exists(&exists); + if (NS_SUCCEEDED(rv) && exists) + array.AppendObject(defLocalePlugins); + } + } + } +} + +NS_IMETHODIMP +DirectoryProvider::GetFiles(const char *aKey, nsISimpleEnumerator* *aResult) +{ + nsresult rv; + + if (!strcmp(aKey, NS_APP_SEARCH_DIR_LIST)) { + nsCOMPtr dirSvc + (do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID)); + if (!dirSvc) + return NS_ERROR_FAILURE; + + nsCOMArray baseFiles; + + /** + * We want to preserve the following order, since the search service loads + * engines in first-loaded-wins order. + * - extension search plugin locations (prepended below using + * NS_NewUnionEnumerator) + * - distro search plugin locations + * - user search plugin locations (profile) + * - app search plugin location (shipped engines) + */ + AppendDistroSearchDirs(dirSvc, baseFiles); + AppendFileKey(NS_APP_USER_SEARCH_DIR, dirSvc, baseFiles); + AppendFileKey(NS_APP_SEARCH_DIR, dirSvc, baseFiles); + + nsCOMPtr baseEnum; + rv = NS_NewArrayEnumerator(getter_AddRefs(baseEnum), baseFiles); + if (NS_FAILED(rv)) + return rv; + + nsCOMPtr list; + rv = dirSvc->Get(XRE_EXTENSIONS_DIR_LIST, + NS_GET_IID(nsISimpleEnumerator), getter_AddRefs(list)); + if (NS_FAILED(rv)) + return rv; + + static char const *const kAppendSPlugins[] = {"searchplugins", nullptr}; + + nsCOMPtr extEnum = + new AppendingEnumerator(list, kAppendSPlugins); + if (!extEnum) + return NS_ERROR_OUT_OF_MEMORY; + + return NS_NewUnionEnumerator(aResult, extEnum, baseEnum); + } + + return NS_ERROR_FAILURE; +} + +NS_IMPL_ISUPPORTS(DirectoryProvider::AppendingEnumerator, nsISimpleEnumerator) + +NS_IMETHODIMP +DirectoryProvider::AppendingEnumerator::HasMoreElements(bool *aResult) +{ + *aResult = mNext ? true : false; + return NS_OK; +} + +NS_IMETHODIMP +DirectoryProvider::AppendingEnumerator::GetNext(nsISupports* *aResult) +{ + if (aResult) + NS_ADDREF(*aResult = mNext); + + mNext = nullptr; + + nsresult rv; + + // Ignore all errors + + bool more; + while (NS_SUCCEEDED(mBase->HasMoreElements(&more)) && more) { + nsCOMPtr nextbasesupp; + mBase->GetNext(getter_AddRefs(nextbasesupp)); + + nsCOMPtr nextbase(do_QueryInterface(nextbasesupp)); + if (!nextbase) + continue; + + nextbase->Clone(getter_AddRefs(mNext)); + if (!mNext) + continue; + + char const *const * i = mAppendList; + while (*i) { + mNext->AppendNative(nsDependentCString(*i)); + ++i; + } + + bool exists; + rv = mNext->Exists(&exists); + if (NS_SUCCEEDED(rv) && exists) + break; + + mNext = nullptr; + } + + return NS_OK; +} + +DirectoryProvider::AppendingEnumerator::AppendingEnumerator + (nsISimpleEnumerator* aBase, + char const *const *aAppendList) : + mBase(aBase), + mAppendList(aAppendList) +{ + // Initialize mNext to begin. + GetNext(nullptr); +} + +} // namespace browser +} // namespace mozilla diff --git a/webbrowser/components/dirprovider/DirectoryProvider.h b/webbrowser/components/dirprovider/DirectoryProvider.h new file mode 100644 index 0000000..43fa85a --- /dev/null +++ b/webbrowser/components/dirprovider/DirectoryProvider.h @@ -0,0 +1,51 @@ +/* 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/. */ + +#ifndef DirectoryProvider_h__ +#define DirectoryProvider_h__ + +#include "nsIDirectoryService.h" +#include "nsComponentManagerUtils.h" +#include "nsISimpleEnumerator.h" +#include "nsIFile.h" +#include "mozilla/Attributes.h" + +#define NS_BROWSERDIRECTORYPROVIDER_CONTRACTID \ + "@mozilla.org/browser/directory-provider;1" + +namespace mozilla { +namespace browser { + +class DirectoryProvider final : public nsIDirectoryServiceProvider2 +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NSIDIRECTORYSERVICEPROVIDER + NS_DECL_NSIDIRECTORYSERVICEPROVIDER2 + +private: + ~DirectoryProvider() {} + + class AppendingEnumerator final : public nsISimpleEnumerator + { + public: + NS_DECL_ISUPPORTS + NS_DECL_NSISIMPLEENUMERATOR + + AppendingEnumerator(nsISimpleEnumerator* aBase, + char const *const *aAppendList); + + private: + ~AppendingEnumerator() {} + + nsCOMPtr mBase; + char const *const *const mAppendList; + nsCOMPtr mNext; + }; +}; + +} // namespace browser +} // namespace mozilla + +#endif // DirectoryProvider_h__ diff --git a/webbrowser/components/dirprovider/moz.build b/webbrowser/components/dirprovider/moz.build new file mode 100644 index 0000000..b01c4a3 --- /dev/null +++ b/webbrowser/components/dirprovider/moz.build @@ -0,0 +1,13 @@ +# -*- Mode: python; c-basic-offset: 4; 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/. + +EXPORTS.mozilla.browser += ['DirectoryProvider.h'] + +SOURCES += ['DirectoryProvider.cpp'] + +FINAL_LIBRARY = 'browsercomps' + +LOCAL_INCLUDES += ['../build'] diff --git a/webbrowser/components/distribution.js b/webbrowser/components/distribution.js new file mode 100644 index 0000000..121e55b --- /dev/null +++ b/webbrowser/components/distribution.js @@ -0,0 +1,345 @@ +/* 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/. */ + +this.EXPORTED_SYMBOLS = [ "DistributionCustomizer" ]; + +var Ci = Components.interfaces; +var Cc = Components.classes; +var Cr = Components.results; +var Cu = Components.utils; + +const DISTRIBUTION_CUSTOMIZATION_COMPLETE_TOPIC = + "distribution-customization-complete"; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", + "resource://gre/modules/PlacesUtils.jsm"); + +this.DistributionCustomizer = function DistributionCustomizer() { + let dirSvc = Cc["@mozilla.org/file/directory_service;1"]. + getService(Ci.nsIProperties); + let iniFile = dirSvc.get("XREExeF", Ci.nsIFile); + iniFile.leafName = "distribution"; + iniFile.append("distribution.ini"); + if (iniFile.exists()) + this._iniFile = iniFile; +} + +DistributionCustomizer.prototype = { + _iniFile: null, + + get _ini() { + let ini = Cc["@mozilla.org/xpcom/ini-parser-factory;1"]. + getService(Ci.nsIINIParserFactory). + createINIParser(this._iniFile); + this.__defineGetter__("_ini", function() ini); + return this._ini; + }, + + get _locale() { + let locale = this._prefs.getCharPref("general.useragent.locale", "en-US"); + this.__defineGetter__("_locale", function() locale); + return this._locale; + }, + + get _prefSvc() { + let svc = Cc["@mozilla.org/preferences-service;1"]. + getService(Ci.nsIPrefService); + this.__defineGetter__("_prefSvc", function() svc); + return this._prefSvc; + }, + + get _prefs() { + let branch = this._prefSvc.getBranch(null); + this.__defineGetter__("_prefs", function() branch); + return this._prefs; + }, + + get _ioSvc() { + let svc = Cc["@mozilla.org/network/io-service;1"]. + getService(Ci.nsIIOService); + this.__defineGetter__("_ioSvc", function() svc); + return this._ioSvc; + }, + + _makeURI: function DIST__makeURI(spec) { + return this._ioSvc.newURI(spec, null, null); + }, + + _parseBookmarksSection: + function DIST_parseBookmarksSection(parentId, section) { + let keys = []; + for (let i in enumerate(this._ini.getKeys(section))) + keys.push(i); + keys.sort(); + + let items = {}; + let defaultItemId = -1; + let maxItemId = -1; + + for (let i = 0; i < keys.length; i++) { + let m = /^item\.(\d+)\.(\w+)\.?(\w*)/.exec(keys[i]); + if (m) { + let [foo, iid, iprop, ilocale] = m; + iid = parseInt(iid); + + if (ilocale) + continue; + + if (!items[iid]) + items[iid] = {}; + if (keys.indexOf(keys[i] + "." + this._locale) >= 0) { + items[iid][iprop] = this._ini.getString(section, keys[i] + "." + + this._locale); + } else { + items[iid][iprop] = this._ini.getString(section, keys[i]); + } + + if (iprop == "type" && items[iid]["type"] == "default") + defaultItemId = iid; + + if (maxItemId < iid) + maxItemId = iid; + } else { + dump("Key did not match: " + keys[i] + "\n"); + } + } + + let prependIndex = 0; + for (let iid = 0; iid <= maxItemId; iid++) { + if (!items[iid]) + continue; + + let index = PlacesUtils.bookmarks.DEFAULT_INDEX; + let newId; + + switch (items[iid]["type"]) { + case "default": + break; + + case "folder": + if (iid < defaultItemId) + index = prependIndex++; + + newId = PlacesUtils.bookmarks.createFolder(parentId, + items[iid]["title"], + index); + + this._parseBookmarksSection(newId, "BookmarksFolder-" + + items[iid]["folderId"]); + + if (items[iid]["description"]) + PlacesUtils.annotations.setItemAnnotation(newId, + "bookmarkProperties/description", + items[iid]["description"], 0, + PlacesUtils.annotations.EXPIRE_NEVER); + + break; + + case "separator": + if (iid < defaultItemId) + index = prependIndex++; + PlacesUtils.bookmarks.insertSeparator(parentId, index); + break; + + case "livemark": + if (iid < defaultItemId) + index = prependIndex++; + + // Don't bother updating the livemark contents on creation. + PlacesUtils.livemarks.addLivemark({ title: items[iid]["title"] + , parentId: parentId + , index: index + , feedURI: this._makeURI(items[iid]["feedLink"]) + , siteURI: this._makeURI(items[iid]["siteLink"]) + }).then(null, Cu.reportError); + break; + + case "bookmark": + default: + if (iid < defaultItemId) + index = prependIndex++; + + newId = PlacesUtils.bookmarks.insertBookmark(parentId, + this._makeURI(items[iid]["link"]), + index, items[iid]["title"]); + + if (items[iid]["description"]) + PlacesUtils.annotations.setItemAnnotation(newId, + "bookmarkProperties/description", + items[iid]["description"], 0, + PlacesUtils.annotations.EXPIRE_NEVER); + + break; + } + } + }, + + _customizationsApplied: false, + applyCustomizations: function DIST_applyCustomizations() { + this._customizationsApplied = true; + if (!this._iniFile) + return this._checkCustomizationComplete(); + + // nsPrefService loads very early. Reload prefs so we can set + // distribution defaults during the prefservice:after-app-defaults + // notification (see applyPrefDefaults below) + this._prefSvc.QueryInterface(Ci.nsIObserver); + this._prefSvc.observe(null, "reload-default-prefs", null); + }, + + _bookmarksApplied: false, + applyBookmarks: function DIST_applyBookmarks() { + this._bookmarksApplied = true; + if (!this._iniFile) + return this._checkCustomizationComplete(); + + let sections = enumToObject(this._ini.getSections()); + + // The global section, and several of its fields, is required + // (we also check here to be consistent with applyPrefDefaults below) + if (!sections["Global"]) + return this._checkCustomizationComplete(); + let globalPrefs = enumToObject(this._ini.getKeys("Global")); + if (!(globalPrefs["id"] && globalPrefs["version"] && globalPrefs["about"])) + return this._checkCustomizationComplete(); + + let bmProcessedPref; + try { + bmProcessedPref = this._ini.getString("Global", + "bookmarks.initialized.pref"); + } + catch (e) { + bmProcessedPref = "distribution." + + this._ini.getString("Global", "id") + ".bookmarksProcessed"; + } + + let bmProcessed = this._prefs.getBoolPref(bmProcessedPref, false); + + if (!bmProcessed) { + if (sections["BookmarksMenu"]) + this._parseBookmarksSection(PlacesUtils.bookmarksMenuFolderId, + "BookmarksMenu"); + if (sections["BookmarksToolbar"]) + this._parseBookmarksSection(PlacesUtils.toolbarFolderId, + "BookmarksToolbar"); + this._prefs.setBoolPref(bmProcessedPref, true); + } + return this._checkCustomizationComplete(); + }, + + _prefDefaultsApplied: false, + applyPrefDefaults: function DIST_applyPrefDefaults() { + this._prefDefaultsApplied = true; + if (!this._iniFile) + return this._checkCustomizationComplete(); + + let sections = enumToObject(this._ini.getSections()); + + // The global section, and several of its fields, is required + if (!sections["Global"]) + return this._checkCustomizationComplete(); + let globalPrefs = enumToObject(this._ini.getKeys("Global")); + if (!(globalPrefs["id"] && globalPrefs["version"] && globalPrefs["about"])) + return this._checkCustomizationComplete(); + + let defaults = this._prefSvc.getDefaultBranch(null); + + // Global really contains info we set as prefs. They're only + // separate because they are "special" (read: required) + + defaults.setCharPref("distribution.id", this._ini.getString("Global", "id")); + defaults.setCharPref("distribution.version", + this._ini.getString("Global", "version")); + + let partnerAbout = Cc["@mozilla.org/supports-string;1"]. + createInstance(Ci.nsISupportsString); + try { + if (globalPrefs["about." + this._locale]) { + partnerAbout.data = this._ini.getString("Global", "about." + this._locale); + } else { + partnerAbout.data = this._ini.getString("Global", "about"); + } + defaults.setComplexValue("distribution.about", + Ci.nsISupportsString, partnerAbout); + } catch (e) { + /* ignore bad prefs due to bug 895473 and move on */ + Cu.reportError(e); + } + + if (sections["Preferences"]) { + for (let key in enumerate(this._ini.getKeys("Preferences"))) { + try { + let value = eval(this._ini.getString("Preferences", key)); + switch (typeof value) { + case "boolean": + defaults.setBoolPref(key, value); + break; + case "number": + defaults.setIntPref(key, value); + break; + case "string": + defaults.setCharPref(key, value); + break; + case "undefined": + defaults.setCharPref(key, value); + break; + } + } catch (e) { /* ignore bad prefs and move on */ } + } + } + + // We eval() the localizable prefs as well (even though they'll + // always get set as a string) to keep the INI format consistent: + // string prefs always need to be in quotes + + let localizedStr = Cc["@mozilla.org/pref-localizedstring;1"]. + createInstance(Ci.nsIPrefLocalizedString); + + if (sections["LocalizablePreferences"]) { + for (let key in enumerate(this._ini.getKeys("LocalizablePreferences"))) { + try { + let value = eval(this._ini.getString("LocalizablePreferences", key)); + value = value.replace("%LOCALE%", this._locale, "g"); + localizedStr.data = "data:text/plain," + key + "=" + value; + defaults.setComplexValue(key, Ci.nsIPrefLocalizedString, localizedStr); + } catch (e) { /* ignore bad prefs and move on */ } + } + } + + if (sections["LocalizablePreferences-" + this._locale]) { + for (let key in enumerate(this._ini.getKeys("LocalizablePreferences-" + this._locale))) { + try { + let value = eval(this._ini.getString("LocalizablePreferences-" + this._locale, key)); + localizedStr.data = "data:text/plain," + key + "=" + value; + defaults.setComplexValue(key, Ci.nsIPrefLocalizedString, localizedStr); + } catch (e) { /* ignore bad prefs and move on */ } + } + } + + return this._checkCustomizationComplete(); + }, + + _checkCustomizationComplete: function DIST__checkCustomizationComplete() { + let prefDefaultsApplied = this._prefDefaultsApplied || !this._iniFile; + if (this._customizationsApplied && this._bookmarksApplied && + prefDefaultsApplied) { + let os = Cc["@mozilla.org/observer-service;1"]. + getService(Ci.nsIObserverService); + os.notifyObservers(null, DISTRIBUTION_CUSTOMIZATION_COMPLETE_TOPIC, null); + } + } +}; + +function enumerate(UTF8Enumerator) { + while (UTF8Enumerator.hasMore()) + yield UTF8Enumerator.getNext(); +} + +function enumToObject(UTF8Enumerator) { + let ret = {}; + for (let i in enumerate(UTF8Enumerator)) + ret[i] = 1; + return ret; +} diff --git a/webbrowser/components/downloads/BrowserDownloads.manifest b/webbrowser/components/downloads/BrowserDownloads.manifest new file mode 100644 index 0000000..1881ca1 --- /dev/null +++ b/webbrowser/components/downloads/BrowserDownloads.manifest @@ -0,0 +1,4 @@ +component {49507fe5-2cee-4824-b6a3-e999150ce9b8} DownloadsStartup.js +contract @mozilla.org/browser/downloadsstartup;1 {49507fe5-2cee-4824-b6a3-e999150ce9b8} +category profile-after-change DownloadsStartup @mozilla.org/browser/downloadsstartup;1 +component {4d99321e-d156-455b-81f7-e7aa2308134f} DownloadsUI.js diff --git a/webbrowser/components/downloads/DownloadsCommon.jsm b/webbrowser/components/downloads/DownloadsCommon.jsm new file mode 100644 index 0000000..efe31ce --- /dev/null +++ b/webbrowser/components/downloads/DownloadsCommon.jsm @@ -0,0 +1,1920 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80 filetype=javascript: */ +/* 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"; + +this.EXPORTED_SYMBOLS = [ + "DownloadsCommon", +]; + +/** + * Handles the Downloads panel shared methods and data access. + * + * This file includes the following constructors and global objects: + * + * DownloadsCommon + * This object is exposed directly to the consumers of this JavaScript module, + * and provides shared methods for all the instances of the user interface. + * + * DownloadsData + * Retrieves the list of past and completed downloads from the underlying + * Downloads API data, and provides asynchronous notifications allowing + * to build a consistent view of the available data. + * + * DownloadsIndicatorData + * This object registers itself with DownloadsData as a view, and transforms the + * notifications it receives into overall status data, that is then broadcast to + * the registered download status indicators. + */ + +//////////////////////////////////////////////////////////////////////////////// +//// Globals + +const Cc = Components.classes; +const Ci = Components.interfaces; +const Cu = Components.utils; +const Cr = Components.results; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", + "resource://gre/modules/NetUtil.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "PluralForm", + "resource://gre/modules/PluralForm.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "Downloads", + "resource://gre/modules/Downloads.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "DownloadUIHelper", + "resource://gre/modules/DownloadUIHelper.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "DownloadUtils", + "resource://gre/modules/DownloadUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", + "resource://gre/modules/FileUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "OS", + "resource://gre/modules/osfile.jsm") +XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", + "resource://gre/modules/PlacesUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", + "resource://gre/modules/PrivateBrowsingUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow", + "resource:///modules/RecentWindow.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", + "resource://gre/modules/PlacesUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "Promise", + "resource://gre/modules/Promise.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "DownloadsLogger", + "resource:///modules/DownloadsLogger.jsm"); + +const nsIDM = Ci.nsIDownloadManager; + +const kDownloadsStringBundleUrl = + "chrome://browser/locale/downloads/downloads.properties"; + +const kPrefConfirmOpenExe = "browser.download.confirmOpenExecutable"; + +const kDownloadsStringsRequiringFormatting = { + sizeWithUnits: true, + shortTimeLeftSeconds: true, + shortTimeLeftMinutes: true, + shortTimeLeftHours: true, + shortTimeLeftDays: true, + statusSeparator: true, + statusSeparatorBeforeNumber: true, + fileExecutableSecurityWarning: true +}; + +const kDownloadsStringsRequiringPluralForm = { + otherDownloads2: true +}; + +const kPartialDownloadSuffix = ".part"; + +const kPrefBranch = Services.prefs.getBranch("browser.download."); + +var PrefObserver = { + QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference]), + getPref: function PO_getPref(name) { + try { + switch (typeof this.prefs[name]) { + case "boolean": + return kPrefBranch.getBoolPref(name); + } + } catch (ex) { } + return this.prefs[name]; + }, + observe: function PO_observe(aSubject, aTopic, aData) { + if (this.prefs.hasOwnProperty(aData)) { + return this[aData] = this.getPref(aData); + } + }, + register: function PO_register(prefs) { + this.prefs = prefs; + kPrefBranch.addObserver("", this, true); + for (let key in prefs) { + let name = key; + XPCOMUtils.defineLazyGetter(this, name, function () { + return PrefObserver.getPref(name); + }); + } + }, +}; + +PrefObserver.register({ + // prefName: defaultValue + debug: false, + animateNotifications: true +}); + + +//////////////////////////////////////////////////////////////////////////////// +//// DownloadsCommon + +/** + * This object is exposed directly to the consumers of this JavaScript module, + * and provides shared methods for all the instances of the user interface. + */ +this.DownloadsCommon = { + log: function DC_log(...aMessageArgs) { + delete this.log; + this.log = function DC_log(...aMessageArgs) { + if (!PrefObserver.debug) { + return; + } + DownloadsLogger.log.apply(DownloadsLogger, aMessageArgs); + } + this.log.apply(this, aMessageArgs); + }, + + error: function DC_error(...aMessageArgs) { + delete this.error; + this.error = function DC_error(...aMessageArgs) { + if (!PrefObserver.debug) { + return; + } + DownloadsLogger.reportError.apply(DownloadsLogger, aMessageArgs); + } + this.error.apply(this, aMessageArgs); + }, + /** + * Returns an object whose keys are the string names from the downloads string + * bundle, and whose values are either the translated strings or functions + * returning formatted strings. + */ + get strings() + { + let strings = {}; + let sb = Services.strings.createBundle(kDownloadsStringBundleUrl); + let enumerator = sb.getSimpleEnumeration(); + while (enumerator.hasMoreElements()) { + let string = enumerator.getNext().QueryInterface(Ci.nsIPropertyElement); + let stringName = string.key; + if (stringName in kDownloadsStringsRequiringFormatting) { + strings[stringName] = function () { + // Convert "arguments" to a real array before calling into XPCOM. + return sb.formatStringFromName(stringName, + Array.slice(arguments, 0), + arguments.length); + }; + } else if (stringName in kDownloadsStringsRequiringPluralForm) { + strings[stringName] = function (aCount) { + // Convert "arguments" to a real array before calling into XPCOM. + let formattedString = sb.formatStringFromName(stringName, + Array.slice(arguments, 0), + arguments.length); + return PluralForm.get(aCount, formattedString); + }; + } else { + strings[stringName] = string.value; + } + } + delete this.strings; + return this.strings = strings; + }, + + /** + * Generates a very short string representing the given time left. + * + * @param aSeconds + * Value to be formatted. It represents the number of seconds, it must + * be positive but does not need to be an integer. + * + * @return Formatted string, for example "30s" or "2h". The returned value is + * maximum three characters long, at least in English. + */ + formatTimeLeft: function DC_formatTimeLeft(aSeconds) + { + // Decide what text to show for the time + let seconds = Math.round(aSeconds); + if (!seconds) { + return ""; + } else if (seconds <= 30) { + return DownloadsCommon.strings["shortTimeLeftSeconds"](seconds); + } + let minutes = Math.round(aSeconds / 60); + if (minutes < 60) { + return DownloadsCommon.strings["shortTimeLeftMinutes"](minutes); + } + let hours = Math.round(minutes / 60); + if (hours < 48) { // two days + return DownloadsCommon.strings["shortTimeLeftHours"](hours); + } + let days = Math.round(hours / 24); + return DownloadsCommon.strings["shortTimeLeftDays"](Math.min(days, 99)); + }, + + /** + * Indicates whether we should show the full Download Manager window interface + * instead of the simplified panel interface. The behavior of downloads + * across browsing session is consistent with the selected interface. + */ + get useToolkitUI() + { + /* Toolkit UI is currently incompatible. + * FIXME: Either fix the toolkitUI (make DBConnection work) or remove + * the unused code altogether + */ + //try { + // return Services.prefs.getBoolPref("browser.download.useToolkitUI"); + //} catch (ex) { } + return false; + }, + + /** + * Indicates whether we should show visual notification on the indicator + * when a download event is triggered. + */ + get animateNotifications() + { + return PrefObserver.animateNotifications; + }, + + /** + * Get access to one of the DownloadsData or PrivateDownloadsData objects, + * depending on the privacy status of the window in question. + * + * @param aWindow + * The browser window which owns the download button. + */ + getData: function DC_getData(aWindow) { + if (PrivateBrowsingUtils.isWindowPrivate(aWindow)) { + return PrivateDownloadsData; + } else { + return DownloadsData; + } + }, + + /** + * Initializes the data link for both the private and non-private downloads + * data objects. + * + * @param aDownloadManagerService + * Reference to the service implementing nsIDownloadManager. We need + * this because getService isn't available for us when this method is + * called, and we must ensure to register our listeners before the + * getService call for the Download Manager returns. + */ + initializeAllDataLinks: function DC_initializeAllDataLinks(aDownloadManagerService) { + DownloadsData.initializeDataLink(aDownloadManagerService); + PrivateDownloadsData.initializeDataLink(aDownloadManagerService); + }, + + /** + * Terminates the data link for both the private and non-private downloads + * data objects. + */ + terminateAllDataLinks: function DC_terminateAllDataLinks() { + DownloadsData.terminateDataLink(); + PrivateDownloadsData.terminateDataLink(); + }, + + /** + * Reloads the specified kind of downloads from the non-private store. + * This method must only be called when Private Browsing Mode is disabled. + * + * @param aActiveOnly + * True to load only active downloads from the database. + */ + ensureAllPersistentDataLoaded: + function DC_ensureAllPersistentDataLoaded(aActiveOnly) { + DownloadsData.ensurePersistentDataLoaded(aActiveOnly); + }, + + /** + * Get access to one of the DownloadsIndicatorData or + * PrivateDownloadsIndicatorData objects, depending on the privacy status of + * the window in question. + */ + getIndicatorData: function DC_getIndicatorData(aWindow) { + if (PrivateBrowsingUtils.isWindowPrivate(aWindow)) { + return PrivateDownloadsIndicatorData; + } else { + return DownloadsIndicatorData; + } + }, + + /** + * Returns a reference to the DownloadsSummaryData singleton - creating one + * in the process if one hasn't been instantiated yet. + * + * @param aWindow + * The browser window which owns the download button. + * @param aNumToExclude + * The number of items on the top of the downloads list to exclude + * from the summary. + */ + getSummary: function DC_getSummary(aWindow, aNumToExclude) + { + if (PrivateBrowsingUtils.isWindowPrivate(aWindow)) { + if (this._privateSummary) { + return this._privateSummary; + } + return this._privateSummary = new DownloadsSummaryData(true, aNumToExclude); + } else { + if (this._summary) { + return this._summary; + } + return this._summary = new DownloadsSummaryData(false, aNumToExclude); + } + }, + _summary: null, + _privateSummary: null, + + /** + * Returns the legacy state integer value for the provided Download object. + */ + stateOfDownload(download) { + // Collapse state using the correct priority. + if (!download.stopped) { + return nsIDM.DOWNLOAD_DOWNLOADING; + } + if (download.succeeded) { + return nsIDM.DOWNLOAD_FINISHED; + } + if (download.error) { + if (download.error.becauseBlockedByParentalControls) { + return nsIDM.DOWNLOAD_BLOCKED_PARENTAL; + } + if (download.error.becauseBlockedByReputationCheck) { + return nsIDM.DOWNLOAD_DIRTY; + } + return nsIDM.DOWNLOAD_FAILED; + } + if (download.canceled) { + if (download.hasPartialData) { + return nsIDM.DOWNLOAD_PAUSED; + } + return nsIDM.DOWNLOAD_CANCELED; + } + return nsIDM.DOWNLOAD_NOTSTARTED; + }, + + /** + * Helper function required because the Downloads Panel and the Downloads View + * don't share the controller yet. + */ + removeAndFinalizeDownload(download) { + Downloads.getList(Downloads.ALL) + .then(list => list.remove(download)) + .then(() => download.finalize(true)) + .catch(Cu.reportError); + }, + + /** + * Given an iterable collection of Download objects, generates and returns + * statistics about that collection. + * + * @param downloads An iterable collection of Download objects. + * + * @return Object whose properties are the generated statistics. Currently, + * we return the following properties: + * + * numActive : The total number of downloads. + * numPaused : The total number of paused downloads. + * numDownloading : The total number of downloads being downloaded. + * totalSize : The total size of all downloads once completed. + * totalTransferred: The total amount of transferred data for these + * downloads. + * slowestSpeed : The slowest download rate. + * rawTimeLeft : The estimated time left for the downloads to + * complete. + * percentComplete : The percentage of bytes successfully downloaded. + */ + summarizeDownloads(downloads) { + let summary = { + numActive: 0, + numPaused: 0, + numDownloading: 0, + totalSize: 0, + totalTransferred: 0, + // slowestSpeed is Infinity so that we can use Math.min to + // find the slowest speed. We'll set this to 0 afterwards if + // it's still at Infinity by the time we're done iterating all + // download. + slowestSpeed: Infinity, + rawTimeLeft: -1, + percentComplete: -1 + } + + for (let download of downloads) { + summary.numActive++; + + if (!download.stopped) { + summary.numDownloading++; + if (download.hasProgress && download.speed > 0) { + let sizeLeft = download.totalBytes - download.currentBytes; + summary.rawTimeLeft = Math.max(summary.rawTimeLeft, + sizeLeft / download.speed); + summary.slowestSpeed = Math.min(summary.slowestSpeed, + download.speed); + } + } else if (download.canceled && download.hasPartialData) { + summary.numPaused++; + } + // Only add to total values if we actually know the download size. + if (download.succeeded) { + summary.totalSize += download.target.size; + summary.totalTransferred += download.target.size; + } else if (download.hasProgress) { + summary.totalSize += download.totalBytes; + summary.totalTransferred += download.currentBytes; + } + } + + if (summary.totalSize != 0) { + summary.percentComplete = (summary.totalTransferred / + summary.totalSize) * 100; + } + + if (summary.slowestSpeed == Infinity) { + summary.slowestSpeed = 0; + } + + return summary; + }, + + /** + * If necessary, smooths the estimated number of seconds remaining for one + * or more downloads to complete. + * + * @param aSeconds + * Current raw estimate on number of seconds left for one or more + * downloads. This is a floating point value to help get sub-second + * accuracy for current and future estimates. + */ + smoothSeconds: function DC_smoothSeconds(aSeconds, aLastSeconds) + { + // We apply an algorithm similar to the DownloadUtils.getTimeLeft function, + // though tailored to a single time estimation for all downloads. We never + // apply something if the new value is less than half the previous value. + let shouldApplySmoothing = aLastSeconds >= 0 && + aSeconds > aLastSeconds / 2; + if (shouldApplySmoothing) { + // Apply hysteresis to favor downward over upward swings. Trust only 30% + // of the new value if lower, and 10% if higher (exponential smoothing). + let diff = aSeconds - aLastSeconds; + aSeconds = aLastSeconds + (diff < 0 ? .3 : .1) * diff; + + // If the new time is similar, reuse something close to the last time + // left, but subtract a little to provide forward progress. + diff = aSeconds - aLastSeconds; + let diffPercent = diff / aLastSeconds * 100; + if (Math.abs(diff) < 5 || Math.abs(diffPercent) < 5) { + aSeconds = aLastSeconds - (diff < 0 ? .4 : .2); + } + } + + // In the last few seconds of downloading, we are always subtracting and + // never adding to the time left. Ensure that we never fall below one + // second left until all downloads are actually finished. + return aLastSeconds = Math.max(aSeconds, 1); + }, + + /** + * Opens a downloaded file. + * + * @param aFile + * the downloaded file to be opened. + * @param aMimeInfo + * the mime type info object. May be null. + * @param aOwnerWindow + * the window with which this action is associated. + */ + openDownloadedFile: function DC_openDownloadedFile(aFile, aMimeInfo, aOwnerWindow) { + if (!(aFile instanceof Ci.nsIFile)) + throw new Error("aFile must be a nsIFile object"); + if (aMimeInfo && !(aMimeInfo instanceof Ci.nsIMIMEInfo)) + throw new Error("Invalid value passed for aMimeInfo"); + if (!(aOwnerWindow instanceof Ci.nsIDOMWindow)) + throw new Error("aOwnerWindow must be a dom-window object"); + +#ifdef XP_WIN + // On Windows, the system will provide a native confirmation prompt + // for .exe files. Exclude this from our prompt, but prompt on other + // executable types. + let isWindowsExe = aFile.leafName.toLowerCase().endsWith(".exe"); +#else + let isWindowsExe = false; +#endif + + // Confirm opening executable files if required. + if (aFile.isExecutable() && !isWindowsExe) { + let showAlert = true; + try { + showAlert = Services.prefs.getBoolPref(kPrefConfirmOpenExe); + } catch (ex) { + // If the preference does not exist, continue with the prompt. + } + + if (showAlert) { + let name = aFile.leafName; + let message = + DownloadsCommon.strings.fileExecutableSecurityWarning(name, name); + let title = + DownloadsCommon.strings.fileExecutableSecurityWarningTitle; + + let open = Services.prompt.confirm(aOwnerWindow, title, message); + if (!open) { + return; + } + } + } + + // Actually open the file. + try { + if (aMimeInfo && aMimeInfo.preferredAction == aMimeInfo.useHelperApp) { + aMimeInfo.launchWithFile(aFile); + return; + } + } + catch(ex) { } + + // If either we don't have the mime info, or the preferred action failed, + // attempt to launch the file directly. + try { + aFile.launch(); + } + catch(ex) { + // If launch fails, try sending it through the system's external "file:" + // URL handler. + Cc["@mozilla.org/uriloader/external-protocol-service;1"] + .getService(Ci.nsIExternalProtocolService) + .loadUrl(NetUtil.newURI(aFile)); + } + }, + + /** + * Show a downloaded file in the system file manager. + * + * @param aFile + * a downloaded file. + */ + showDownloadedFile: function DC_showDownloadedFile(aFile) { + if (!(aFile instanceof Ci.nsIFile)) + throw new Error("aFile must be a nsIFile object"); + try { + // Show the directory containing the file and select the file. + aFile.reveal(); + } catch (ex) { + // If reveal fails for some reason (e.g., it's not implemented on unix + // or the file doesn't exist), try using the parent if we have it. + let parent = aFile.parent; + if (parent) { + try { + // Open the parent directory to show where the file should be. + parent.launch(); + } catch (ex) { + // If launch also fails (probably because it's not implemented), let + // the OS handler try to open the parent. + Cc["@mozilla.org/uriloader/external-protocol-service;1"] + .getService(Ci.nsIExternalProtocolService) + .loadUrl(NetUtil.newURI(parent)); + } + } + } + } +}; + +/** + * Returns true if we are executing on Windows Vista or a later version. + */ +XPCOMUtils.defineLazyGetter(DownloadsCommon, "isWinVistaOrHigher", function () { + let os = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS; + if (os != "WINNT") { + return false; + } + let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2); + return parseFloat(sysInfo.getProperty("version")) >= 6; +}); + +/** + * Returns true to indicate that we should hook the panel to the JavaScript API + * for downloads instead of the nsIDownloadManager back-end. + * This is kept for compatibility/leftovers and should be removed later. + */ +XPCOMUtils.defineLazyGetter(DownloadsCommon, "useJSTransfer", function () { + return true; +}); + +//////////////////////////////////////////////////////////////////////////////// +//// DownloadsData + +/** + * Retrieves the list of past and completed downloads from the underlying + * Download Manager data, and provides asynchronous notifications allowing to + * build a consistent view of the available data. + * + * This object responds to real-time changes in the underlying Download Manager + * data. For example, the deletion of one or more downloads is notified through + * the nsIObserver interface, while any state or progress change is notified + * through the nsIDownloadProgressListener interface. + * + * Note that using this object does not automatically start the Download Manager + * service. Consumers will see an empty list of downloads until the service is + * actually started. This is useful to display a neutral progress indicator in + * the main browser window until the autostart timeout elapses. + * + * Note that DownloadsData and PrivateDownloadsData are two equivalent singleton + * objects, one accessing non-private downloads, and the other accessing private + * ones. + */ +function DownloadsDataCtor(aPrivate) { + this._isPrivate = aPrivate; + + // Contains all the available Download objects and their integer state. + this.oldDownloadStates = new Map(); + + // Array of view objects that should be notified when the available download + // data changes. + this._views = []; +} + +DownloadsDataCtor.prototype = { + /** + * Starts receiving events for current downloads. + */ + initializeDataLink() { + if (!this._dataLinkInitialized) { + let promiseList = Downloads.getList(this._isPrivate ? Downloads.PRIVATE + : Downloads.PUBLIC); + promiseList.then(list => list.addView(this)).then(null, Cu.reportError); + this._dataLinkInitialized = true; + } + }, + _dataLinkInitialized: false, + + /** + * Stops receiving events for current downloads and cancels any pending read. + */ + terminateDataLink: function DD_terminateDataLink() + { + Cu.reportError("terminateDataLink not applicable with JS Transfers"); + return; + }, + + /** + * Iterator for all the available Download objects. This is empty until the + * data has been loaded using the JavaScript API for downloads. + */ + get downloads() this.oldDownloadStates.keys(), + + /** + * True if there are finished downloads that can be removed from the list. + */ + get canRemoveFinished() + { + for (let download of this.downloads) { + // Stopped, paused, and failed downloads with partial data are removed. + if (download.stopped && !(download.canceled && download.hasPartialData)) { + return true; + } + } + return false; + }, + + /** + * Asks the back-end to remove finished downloads from the list. + */ + removeFinished: function DD_removeFinished() + { + let promiseList = Downloads.getList(this._isPrivate ? Downloads.PRIVATE + : Downloads.PUBLIC); + promiseList.then(list => list.removeFinished()) + .then(null, Cu.reportError); + }, + + ////////////////////////////////////////////////////////////////////////////// + //// Integration with the asynchronous Downloads back-end + + onDownloadAdded(download) { + // Download objects do not store the end time of downloads, as the Downloads + // API does not need to persist this information for all platforms. Once a + // download terminates on a Desktop browser, it becomes a history download, + // for which the end time is stored differently, as a Places annotation. + download.endTime = Date.now(); + + this.oldDownloadStates.set(download, + DownloadsCommon.stateOfDownload(download)); + + for (let view of this._views) { + view.onDownloadAdded(download, true); + } + }, + + onDownloadChanged(download) { + let oldState = this.oldDownloadStates.get(download); + let newState = DownloadsCommon.stateOfDownload(download); + this.oldDownloadStates.set(download, newState); + + if (oldState != newState) { + if (download.succeeded || + (download.canceled && !download.hasPartialData) || + download.error) { + // Store the end time that may be displayed by the views. + download.endTime = Date.now(); + + // This state transition code should actually be located in a Downloads + // API module (bug 941009). Moreover, the fact that state is stored as + // annotations should be ideally hidden behind methods of + // nsIDownloadHistory (bug 830415). + if (!this._isPrivate) { + try { + let downloadMetaData = { + state: DownloadsCommon.stateOfDownload(download), + endTime: download.endTime, + }; + if (download.succeeded) { + downloadMetaData.fileSize = download.target.size; + } + + PlacesUtils.annotations.setPageAnnotation( + NetUtil.newURI(download.source.url), + "downloads/metaData", + JSON.stringify(downloadMetaData), 0, + PlacesUtils.annotations.EXPIRE_WITH_HISTORY); + } catch (ex) { + Cu.reportError(ex); + } + } + } + + for (let view of this._views) { + try { + view.onDownloadStateChanged(download); + } catch (ex) { + Cu.reportError(ex); + } + } + + if (download.succeeded || + (download.error && download.error.becauseBlocked)) { + this._notifyDownloadEvent("finish"); + } + } + + if (!download.newDownloadNotified) { + download.newDownloadNotified = true; + this._notifyDownloadEvent("start"); + } + + for (let view of this._views) { + view.onDownloadChanged(download); + } + }, + + onDownloadRemoved(download) { + this.oldDownloadStates.delete(download); + + for (let view of this._views) { + view.onDownloadRemoved(download); + } + }, + + ////////////////////////////////////////////////////////////////////////////// + //// Registration of views + + /** + * Adds an object to be notified when the available download data changes. + * The specified object is initialized with the currently available downloads. + * + * @param aView + * DownloadsView object to be added. This reference must be passed to + * removeView before termination. + */ + addView: function DD_addView(aView) + { + this._views.push(aView); + this._updateView(aView); + }, + + /** + * Removes an object previously added using addView. + * + * @param aView + * DownloadsView object to be removed. + */ + removeView: function DD_removeView(aView) + { + let index = this._views.indexOf(aView); + if (index != -1) { + this._views.splice(index, 1); + } + }, + + /** + * Ensures that the currently loaded data is added to the specified view. + * + * @param aView + * DownloadsView object to be initialized. + */ + _updateView: function DD_updateView(aView) + { + // Indicate to the view that a batch loading operation is in progress. + aView.onDataLoadStarting(); + + // Sort backwards by start time, ensuring that the most recent + // downloads are added first regardless of their state. + // Tycho: + //let loadedItemsArray = [dataItem + // for each (dataItem in this.dataItems) + // if (dataItem)]; + let downloadsArray = [...this.downloads]; + downloadsArray.sort((a, b) => b.startTime - a.startTime); + downloadsArray.forEach(download => aView.onDownloadAdded(download, false)); + + // Notify the view that all data is available unless loading is in progress. + if (!this._pendingStatement) { + aView.onDataLoadCompleted(); + } + }, + + ////////////////////////////////////////////////////////////////////////////// + //// In-memory downloads data store + + /** + * Clears the loaded data. + */ + clear: function DD_clear() + { + this._terminateDataAccess(); + this.dataItems = {}; + }, + + /** + * Returns the data item associated with the provided source object. The + * source can be a download object that we received from the Download Manager + * because of a real-time notification, or a row from the downloads database, + * during the asynchronous data load. + * + * In case we receive download status notifications while we are still + * populating the list of downloads from the database, we want the real-time + * status to take precedence over the state that is read from the database, + * which might be older. This is achieved by creating the download item if + * it's not already in the list, but never updating the returned object using + * the data from the database, if the object already exists. + * + * @param aSource + * Object containing the data with which the item should be initialized + * if it doesn't already exist in the list. This should implement + * either nsIDownload or mozIStorageRow. If the item exists, this + * argument is only used to retrieve the download identifier. + * @param aMayReuseGUID + * If false, indicates that the download should not be added if a + * download with the same identifier was removed in the meantime. This + * ensures that, while loading the list asynchronously, downloads that + * have been removed in the meantime do no reappear inadvertently. + * + * @return New or existing data item, or null if the item was deleted from the + * list of available downloads. + */ + _getOrAddDataItem: function DD_getOrAddDataItem(aSource, aMayReuseGUID) + { + let downloadGuid = (aSource instanceof Ci.nsIDownload) + ? aSource.guid + : aSource.getResultByName("guid"); + if (downloadGuid in this.dataItems) { + let existingItem = this.dataItems[downloadGuid]; + if (existingItem || !aMayReuseGUID) { + // Returns null if the download was removed and we can't reuse the item. + return existingItem; + } + } + DownloadsCommon.log("Creating a new DownloadsDataItem with downloadGuid =", + downloadGuid); + let dataItem = new DownloadsDataItem(aSource); + this.dataItems[downloadGuid] = dataItem; + + // Create the view items before returning. + let addToStartOfList = aSource instanceof Ci.nsIDownload; + this._views.forEach( + function (view) view.onDataItemAdded(dataItem, addToStartOfList) + ); + return dataItem; + }, + + /** + * Removes the data item with the specified identifier. + * + * This method can be called at most once per download identifier. + */ + _removeDataItem: function DD_removeDataItem(aDownloadId) + { + if (aDownloadId in this.dataItems) { + let dataItem = this.dataItems[aDownloadId]; + this.dataItems[aDownloadId] = null; + this._views.forEach( + function (view) view.onDataItemRemoved(dataItem) + ); + } + }, + + ////////////////////////////////////////////////////////////////////////////// + //// Persistent data loading + + /** + * Represents an executing statement, allowing its cancellation. + */ + _pendingStatement: null, + + /** + * Indicates which kind of items from the persistent downloads database have + * been fully loaded in memory and are available to the views. This can + * assume the value of one of the kLoad constants. + */ + _loadState: 0, + + /** No downloads have been fully loaded yet. */ + get kLoadNone() 0, + /** All the active downloads in the database are loaded in memory. */ + get kLoadActive() 1, + /** All the downloads in the database are loaded in memory. */ + get kLoadAll() 2, + + /** + * Reloads the specified kind of downloads from the persistent database. This + * method must only be called when Private Browsing Mode is disabled. + * + * @param aActiveOnly + * True to load only active downloads from the database. + */ + ensurePersistentDataLoaded: + function DD_ensurePersistentDataLoaded(aActiveOnly) + { + if (this == PrivateDownloadsData) { + Cu.reportError("ensurePersistentDataLoaded should not be called on PrivateDownloadsData"); + return; + } + + if (this._pendingStatement) { + // We are already in the process of reloading all downloads. + return; + } + + if (aActiveOnly) { + if (this._loadState == this.kLoadNone) { + DownloadsCommon.log("Loading only active downloads from the persistence database"); + // Indicate to the views that a batch loading operation is in progress. + this._views.forEach( + function (view) view.onDataLoadStarting() + ); + + // Reload the list using the Download Manager service. The list is + // returned in no particular order. + let downloads = Services.downloads.activeDownloads; + while (downloads.hasMoreElements()) { + let download = downloads.getNext().QueryInterface(Ci.nsIDownload); + this._getOrAddDataItem(download, true); + } + this._loadState = this.kLoadActive; + + // Indicate to the views that the batch loading operation is complete. + this._views.forEach( + function (view) view.onDataLoadCompleted() + ); + DownloadsCommon.log("Active downloads done loading."); + } + } else { + if (this._loadState != this.kLoadAll) { + // Load only the relevant columns from the downloads database. The + // columns are read in the _initFromDataRow method of DownloadsDataItem. + // Order by descending download identifier so that the most recent + // downloads are notified first to the listening views. + DownloadsCommon.log("Loading all downloads from the persistence database."); + let dbConnection = Services.downloads.DBConnection; + let statement = dbConnection.createAsyncStatement( + "SELECT guid, target, name, source, referrer, state, " + + "startTime, endTime, currBytes, maxBytes " + + "FROM moz_downloads " + + "ORDER BY startTime DESC" + ); + try { + this._pendingStatement = statement.executeAsync(this); + } finally { + statement.finalize(); + } + } + } + }, + + /** + * Cancels any pending data access and ensures views are notified. + */ + _terminateDataAccess: function DD_terminateDataAccess() + { + if (this._pendingStatement) { + this._pendingStatement.cancel(); + this._pendingStatement = null; + } + + // Close all the views on the current data. Create a copy of the array + // because some views might unregister while processing this event. + Array.slice(this._views, 0).forEach( + function (view) view.onDataInvalidated() + ); + }, + + ////////////////////////////////////////////////////////////////////////////// + //// mozIStorageStatementCallback + + handleResult: function DD_handleResult(aResultSet) + { + for (let row = aResultSet.getNextRow(); + row; + row = aResultSet.getNextRow()) { + // Add the download to the list and initialize it with the data we read, + // unless we already received a notification providing more reliable + // information for this download. + this._getOrAddDataItem(row, false); + } + }, + + handleError: function DD_handleError(aError) + { + DownloadsCommon.error("Database statement execution error (", + aError.result, "): ", aError.message); + }, + + handleCompletion: function DD_handleCompletion(aReason) + { + DownloadsCommon.log("Loading all downloads from database completed with reason:", + aReason); + this._pendingStatement = null; + + // To ensure that we don't inadvertently delete more downloads from the + // database than needed on shutdown, we should update the load state only if + // the operation completed successfully. + if (aReason == Ci.mozIStorageStatementCallback.REASON_FINISHED) { + this._loadState = this.kLoadAll; + } + + // Indicate to the views that the batch loading operation is complete, even + // if the lookup failed or was canceled. The only possible glitch happens + // in case the database backend changes while loading data, when the views + // would open and immediately close. This case is rare enough not to need a + // special treatment. + this._views.forEach( + function (view) view.onDataLoadCompleted() + ); + }, + + ////////////////////////////////////////////////////////////////////////////// + //// nsIObserver + + observe: function DD_observe(aSubject, aTopic, aData) + { + switch (aTopic) { + case "download-manager-remove-download-guid": + // If a single download was removed, remove the corresponding data item. + if (aSubject) { + let downloadGuid = aSubject.QueryInterface(Ci.nsISupportsCString).data; + DownloadsCommon.log("A single download with id", + downloadGuid, "was removed."); + this._removeDataItem(downloadGuid); + break; + } + + // Multiple downloads have been removed. Iterate over known downloads + // and remove those that don't exist anymore. + DownloadsCommon.log("Multiple downloads were removed."); + for each (let dataItem in this.dataItems) { + if (dataItem) { + // Bug 449811 - We have to bind to the dataItem because Javascript + // doesn't do fresh let-bindings per loop iteration. + let dataItemBinding = dataItem; + Services.downloads.getDownloadByGUID(dataItemBinding.downloadGuid, + function(aStatus, aResult) { + if (aStatus == Components.results.NS_ERROR_NOT_AVAILABLE) { + DownloadsCommon.log("Removing download with id", + dataItemBinding.downloadGuid); + this._removeDataItem(dataItemBinding.downloadGuid); + } + }.bind(this)); + } + } + break; + } + }, + + ////////////////////////////////////////////////////////////////////////////// + //// nsIDownloadProgressListener + + onDownloadStateChange: function DD_onDownloadStateChange(aOldState, aDownload) + { + if (aDownload.isPrivate != this._isPrivate) { + // Ignore the downloads with a privacy status other than what we are + // tracking. + return; + } + + // When a new download is added, it may have the same identifier of a + // download that we previously deleted during this session, and we also + // want to provide a visible indication that the download started. + let isNew = aOldState == nsIDM.DOWNLOAD_NOTSTARTED || + aOldState == nsIDM.DOWNLOAD_QUEUED; + + let dataItem = this._getOrAddDataItem(aDownload, isNew); + if (!dataItem) { + return; + } + + let wasInProgress = dataItem.inProgress; + + DownloadsCommon.log("A download changed its state to:", aDownload.state); + dataItem.state = aDownload.state; + dataItem.referrer = aDownload.referrer && aDownload.referrer.spec; + dataItem.resumable = aDownload.resumable; + dataItem.startTime = Math.round(aDownload.startTime / 1000); + dataItem.currBytes = aDownload.amountTransferred; + dataItem.maxBytes = aDownload.size; + + if (wasInProgress && !dataItem.inProgress) { + dataItem.endTime = Date.now(); + } + + // When a download is retried, we create a different download object from + // the database with the same ID as before. This means that the nsIDownload + // that the dataItem holds might now need updating. + // + // We only overwrite this in the event that _download exists, because if it + // doesn't, that means that no caller ever tried to get the nsIDownload, + // which means it was never retrieved and doesn't need to be overwritten. + if (dataItem._download) { + dataItem._download = aDownload; + } + + for (let view of this._views) { + try { + view.getViewItem(dataItem).onStateChange(aOldState); + } catch (ex) { + Cu.reportError(ex); + } + } + + if (isNew && !dataItem.newDownloadNotified) { + dataItem.newDownloadNotified = true; + this._notifyDownloadEvent("start"); + } + + // This is a final state of which we are only notified once. + if (dataItem.done) { + this._notifyDownloadEvent("finish"); + } + + // TODO Bug 830415: this isn't the right place to set these annotation. + // It should be set it in places' nsIDownloadHistory implementation. + if (!this._isPrivate && !dataItem.inProgress) { + let downloadMetaData = { state: dataItem.state, + endTime: dataItem.endTime }; + if (dataItem.done) + downloadMetaData.fileSize = dataItem.maxBytes; + + try { + PlacesUtils.annotations.setPageAnnotation( + NetUtil.newURI(dataItem.uri), "downloads/metaData", JSON.stringify(downloadMetaData), 0, + PlacesUtils.annotations.EXPIRE_WITH_HISTORY); + } + catch(ex) { + Cu.reportError(ex); + } + } + }, + + onProgressChange: function DD_onProgressChange(aWebProgress, aRequest, + aCurSelfProgress, + aMaxSelfProgress, + aCurTotalProgress, + aMaxTotalProgress, aDownload) + { + if (aDownload.isPrivate != this._isPrivate) { + // Ignore the downloads with a privacy status other than what we are + // tracking. + return; + } + + let dataItem = this._getOrAddDataItem(aDownload, false); + if (!dataItem) { + return; + } + + dataItem.currBytes = aDownload.amountTransferred; + dataItem.maxBytes = aDownload.size; + dataItem.speed = aDownload.speed; + dataItem.percentComplete = aDownload.percentComplete; + + this._views.forEach( + function (view) view.getViewItem(dataItem).onProgressChange() + ); + }, + + onStateChange: function () { }, + + onSecurityChange: function () { }, + + ////////////////////////////////////////////////////////////////////////////// + //// Notifications sent to the most recent browser window only + + /** + * Set to true after the first download causes the downloads panel to be + * displayed. + */ + get panelHasShownBefore() { + try { + return Services.prefs.getBoolPref("browser.download.panel.shown"); + } catch (ex) { } + return false; + }, + + set panelHasShownBefore(aValue) { + Services.prefs.setBoolPref("browser.download.panel.shown", aValue); + return aValue; + }, + + /** + * Displays a new or finished download notification in the most recent browser + * window, if one is currently available with the required privacy type. + * + * @param aType + * Set to "start" for new downloads, "finish" for completed downloads. + */ + _notifyDownloadEvent: function DD_notifyDownloadEvent(aType) + { + DownloadsCommon.log("Attempting to notify that a new download has started or finished."); + if (DownloadsCommon.useToolkitUI) { + DownloadsCommon.log("Cancelling notification - we're using the toolkit downloads manager."); + return; + } + + // Show the panel in the most recent browser window, if present. + let browserWin = RecentWindow.getMostRecentBrowserWindow({ private: this._isPrivate }); + if (!browserWin) { + return; + } + + if (this.panelHasShownBefore) { + // For new downloads after the first one, don't show the panel + // automatically, but provide a visible notification in the topmost + // browser window, if the status indicator is already visible. + DownloadsCommon.log("Showing new download notification."); + browserWin.DownloadsIndicatorView.showEventNotification(aType); + return; + } + this.panelHasShownBefore = true; + browserWin.DownloadsPanel.showPanel(); + } +}; + +XPCOMUtils.defineLazyGetter(this, "PrivateDownloadsData", function() { + return new DownloadsDataCtor(true); +}); + +XPCOMUtils.defineLazyGetter(this, "DownloadsData", function() { + return new DownloadsDataCtor(false); +}); + +//////////////////////////////////////////////////////////////////////////////// +//// DownloadsViewPrototype + +/** + * A prototype for an object that registers itself with DownloadsData as soon + * as a view is registered with it. + */ +const DownloadsViewPrototype = { + ////////////////////////////////////////////////////////////////////////////// + //// Registration of views + + /** + * Array of view objects that should be notified when the available status + * data changes. + * + * SUBCLASSES MUST OVERRIDE THIS PROPERTY. + */ + _views: null, + + /** + * Determines whether this view object is over the private or non-private + * downloads. + * + * SUBCLASSES MUST OVERRIDE THIS PROPERTY. + */ + _isPrivate: false, + + /** + * Adds an object to be notified when the available status data changes. + * The specified object is initialized with the currently available status. + * + * @param aView + * View object to be added. This reference must be + * passed to removeView before termination. + */ + addView: function DVP_addView(aView) + { + // Start receiving events when the first of our views is registered. + if (this._views.length == 0) { + if (this._isPrivate) { + PrivateDownloadsData.addView(this); + } else { + DownloadsData.addView(this); + } + } + + this._views.push(aView); + this.refreshView(aView); + }, + + /** + * Updates the properties of an object previously added using addView. + * + * @param aView + * View object to be updated. + */ + refreshView: function DVP_refreshView(aView) + { + // Update immediately even if we are still loading data asynchronously. + // Subclasses must provide these two functions! + this._refreshProperties(); + this._updateView(aView); + }, + + /** + * Removes an object previously added using addView. + * + * @param aView + * View object to be removed. + */ + removeView: function DVP_removeView(aView) + { + let index = this._views.indexOf(aView); + if (index != -1) { + this._views.splice(index, 1); + } + + // Stop receiving events when the last of our views is unregistered. + if (this._views.length == 0) { + if (this._isPrivate) { + PrivateDownloadsData.removeView(this); + } else { + DownloadsData.removeView(this); + } + } + }, + + ////////////////////////////////////////////////////////////////////////////// + //// Callback functions from DownloadsData + + /** + * Indicates whether we are still loading downloads data asynchronously. + */ + _loading: false, + + /** + * Called before multiple downloads are about to be loaded. + */ + onDataLoadStarting: function DVP_onDataLoadStarting() + { + this._loading = true; + }, + + /** + * Called after data loading finished. + */ + onDataLoadCompleted: function DVP_onDataLoadCompleted() + { + this._loading = false; + }, + + /** + * Called when the downloads database becomes unavailable (for example, we + * entered Private Browsing Mode and the database backend changed). + * References to existing data should be discarded. + * + * @note Subclasses should override this. + */ + onDataInvalidated: function DVP_onDataInvalidated() + { + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + }, + + /** + * Called when a new download data item is available, either during the + * asynchronous data load or when a new download is started. + * + * @param download + * Download object that was just added. + * @param newest + * When true, indicates that this item is the most recent and should be + * added in the topmost position. This happens when a new download is + * started. When false, indicates that the item is the least recent + * with regard to the items that have been already added. The latter + * generally happens during the asynchronous data load. + * + * @note Subclasses should override this. + */ + onDownloadAdded(download, newest) { + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + }, + + /** + * Called when the overall state of a Download has changed. In particular, + * this is called only once when the download succeeds or is blocked + * permanently, and is never called if only the current progress changed. + * + * The onDownloadChanged notification will always be sent afterwards. + * + * @note Subclasses should override this. + */ + onDownloadStateChanged(download) { + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + }, + + /** + * Called every time any state property of a Download may have changed, + * including progress properties. + * + * Note that progress notification changes are throttled at the Downloads.jsm + * API level, and there is no throttling mechanism in the front-end. + * + * @note Subclasses should override this. + */ + onDownloadChanged(download) { + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + }, + + /** + * Called when a data item is removed, ensures that the widget associated with + * the view item is removed from the user interface. + * + * @param download + * Download object that is being removed. + * + * @note Subclasses should override this. + */ + onDownloadRemoved(download) { + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + }, + + /** + * Private function used to refresh the internal properties being sent to + * each registered view. + * + * @note Subclasses should override this. + */ + _refreshProperties: function DID_refreshProperties() + { + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + }, + + /** + * Private function used to refresh an individual view. + * + * @note Subclasses should override this. + */ + _updateView: function DID_updateView() + { + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + } +}; + +//////////////////////////////////////////////////////////////////////////////// +//// DownloadsIndicatorData + +/** + * This object registers itself with DownloadsData as a view, and transforms the + * notifications it receives into overall status data, that is then broadcast to + * the registered download status indicators. + * + * Note that using this object does not automatically start the Download Manager + * service. Consumers will see an empty list of downloads until the service is + * actually started. This is useful to display a neutral progress indicator in + * the main browser window until the autostart timeout elapses. + */ +function DownloadsIndicatorDataCtor(aPrivate) { + this._isPrivate = aPrivate; + this._views = []; +} +DownloadsIndicatorDataCtor.prototype = { + __proto__: DownloadsViewPrototype, + + /** + * Removes an object previously added using addView. + * + * @param aView + * DownloadsIndicatorView object to be removed. + */ + removeView: function DID_removeView(aView) + { + DownloadsViewPrototype.removeView.call(this, aView); + + if (this._views.length == 0) { + this._itemCount = 0; + } + }, + + ////////////////////////////////////////////////////////////////////////////// + //// Callback functions from DownloadsData + + onDataLoadCompleted: function DID_onDataLoadCompleted() + { + DownloadsViewPrototype.onDataLoadCompleted.call(this); + this._updateViews(); + }, + + /** + * Called when the downloads database becomes unavailable (for example, we + * entered Private Browsing Mode and the database backend changed). + * References to existing data should be discarded. + */ + onDataInvalidated: function DID_onDataInvalidated() + { + this._itemCount = 0; + }, + + onDownloadAdded(download, newest) { + this._itemCount++; + this._updateViews(); + }, + + onDownloadStateChanged(download) { + if (download.succeeded || download.error) { + this.attention = true; + } + + // Since the state of a download changed, reset the estimated time left. + this._lastRawTimeLeft = -1; + this._lastTimeLeft = -1; + }, + + onDownloadChanged(download) { + this._updateViews(); + }, + + onDownloadRemoved(download) { + this._itemCount--; + this._updateViews(); + }, + + ////////////////////////////////////////////////////////////////////////////// + //// Propagation of properties to our views + + // The following properties are updated by _refreshProperties and are then + // propagated to the views. See _refreshProperties for details. + _hasDownloads: false, + _counter: "", + _percentComplete: -1, + _paused: false, + + /** + * Indicates whether the download indicators should be highlighted. + */ + set attention(aValue) + { + this._attention = aValue; + this._updateViews(); + return aValue; + }, + _attention: false, + + /** + * Indicates whether the user is interacting with downloads, thus the + * attention indication should not be shown even if requested. + */ + set attentionSuppressed(aValue) + { + this._attentionSuppressed = aValue; + this._attention = false; + this._updateViews(); + return aValue; + }, + _attentionSuppressed: false, + + /** + * Computes aggregate values and propagates the changes to our views. + */ + _updateViews: function DID_updateViews() + { + // Do not update the status indicators during batch loads of download items. + if (this._loading) { + return; + } + + this._refreshProperties(); + this._views.forEach(this._updateView, this); + }, + + /** + * Updates the specified view with the current aggregate values. + * + * @param aView + * DownloadsIndicatorView object to be updated. + */ + _updateView: function DID_updateView(aView) + { + aView.hasDownloads = this._hasDownloads; + aView.counter = this._counter; + aView.percentComplete = this._percentComplete; + aView.paused = this._paused; + aView.attention = this._attention && !this._attentionSuppressed; + }, + + ////////////////////////////////////////////////////////////////////////////// + //// Property updating based on current download status + + /** + * Number of download items that are available to be displayed. + */ + _itemCount: 0, + + /** + * Floating point value indicating the last number of seconds estimated until + * the longest download will finish. We need to store this value so that we + * don't continuously apply smoothing if the actual download state has not + * changed. This is set to -1 if the previous value is unknown. + */ + _lastRawTimeLeft: -1, + + /** + * Last number of seconds estimated until all in-progress downloads with a + * known size and speed will finish. This value is stored to allow smoothing + * in case of small variations. This is set to -1 if the previous value is + * unknown. + */ + _lastTimeLeft: -1, + + /** + * A generator function for the Download objects this summary is currently + * interested in. This generator is passed off to summarizeDownloads in order + * to generate statistics about the downloads we care about - in this case, + * it's all active downloads. + */ + * _activeDownloads() { + let downloads = this._isPrivate ? PrivateDownloadsData.downloads + : DownloadsData.downloads; + for (let download of downloads) { + if (!download.stopped || (download.canceled && download.hasPartialData)) { + yield download; + } + } + }, + + /** + * Computes aggregate values based on the current state of downloads. + */ + _refreshProperties: function DID_refreshProperties() + { + let summary = + DownloadsCommon.summarizeDownloads(this._activeDownloads()); + + // Determine if the indicator should be shown or get attention. + this._hasDownloads = (this._itemCount > 0); + + // If all downloads are paused, show the progress indicator as paused. + this._paused = summary.numActive > 0 && + summary.numActive == summary.numPaused; + + this._percentComplete = summary.percentComplete; + + // Display the estimated time left, if present. + if (summary.rawTimeLeft == -1) { + // There are no downloads with a known time left. + this._lastRawTimeLeft = -1; + this._lastTimeLeft = -1; + this._counter = ""; + } else { + // Compute the new time left only if state actually changed. + if (this._lastRawTimeLeft != summary.rawTimeLeft) { + this._lastRawTimeLeft = summary.rawTimeLeft; + this._lastTimeLeft = DownloadsCommon.smoothSeconds(summary.rawTimeLeft, + this._lastTimeLeft); + } + this._counter = DownloadsCommon.formatTimeLeft(this._lastTimeLeft); + } + } +}; + +XPCOMUtils.defineLazyGetter(this, "PrivateDownloadsIndicatorData", function() { + return new DownloadsIndicatorDataCtor(true); +}); + +XPCOMUtils.defineLazyGetter(this, "DownloadsIndicatorData", function() { + return new DownloadsIndicatorDataCtor(false); +}); + +//////////////////////////////////////////////////////////////////////////////// +//// DownloadsSummaryData + +/** + * DownloadsSummaryData is a view for DownloadsData that produces a summary + * of all downloads after a certain exclusion point aNumToExclude. For example, + * if there were 5 downloads in progress, and a DownloadsSummaryData was + * constructed with aNumToExclude equal to 3, then that DownloadsSummaryData + * would produce a summary of the last 2 downloads. + * + * @param aIsPrivate + * True if the browser window which owns the download button is a private + * window. + * @param aNumToExclude + * The number of items to exclude from the summary, starting from the + * top of the list. + */ +function DownloadsSummaryData(aIsPrivate, aNumToExclude) { + this._numToExclude = aNumToExclude; + // Since we can have multiple instances of DownloadsSummaryData, we + // override these values from the prototype so that each instance can be + // completely separated from one another. + this._loading = false; + + this._downloads = []; + + // Floating point value indicating the last number of seconds estimated until + // the longest download will finish. We need to store this value so that we + // don't continuously apply smoothing if the actual download state has not + // changed. This is set to -1 if the previous value is unknown. + this._lastRawTimeLeft = -1; + + // Last number of seconds estimated until all in-progress downloads with a + // known size and speed will finish. This value is stored to allow smoothing + // in case of small variations. This is set to -1 if the previous value is + // unknown. + this._lastTimeLeft = -1; + + // The following properties are updated by _refreshProperties and are then + // propagated to the views. + this._showingProgress = false; + this._details = ""; + this._description = ""; + this._numActive = 0; + this._percentComplete = -1; + + this._isPrivate = aIsPrivate; + this._views = []; +} + +DownloadsSummaryData.prototype = { + __proto__: DownloadsViewPrototype, + + /** + * Removes an object previously added using addView. + * + * @param aView + * DownloadsSummary view to be removed. + */ + removeView: function DSD_removeView(aView) + { + DownloadsViewPrototype.removeView.call(this, aView); + + if (this._views.length == 0) { + // Clear out our collection of Download objects. If we ever have + // another view registered with us, this will get re-populated. + this._downloads = []; + } + }, + + ////////////////////////////////////////////////////////////////////////////// + //// Callback functions from DownloadsData - see the documentation in + //// DownloadsViewPrototype for more information on what these functions + //// are used for. + + onDataLoadCompleted: function DSD_onDataLoadCompleted() + { + DownloadsViewPrototype.onDataLoadCompleted.call(this); + this._updateViews(); + }, + + onDataInvalidated: function DSD_onDataInvalidated() + { + this._dataItems = []; + }, + + onDownloadAdded(download, newest) { + if (newest) { + this._downloads.unshift(download); + } else { + this._downloads.push(download); + } + + this._updateViews(); + }, + + onDownloadStateChanged() { + // Since the state of a download changed, reset the estimated time left. + this._lastRawTimeLeft = -1; + this._lastTimeLeft = -1; + }, + + onDownloadChanged() { + this._updateViews(); + }, + + onDownloadRemoved(download) { + let itemIndex = this._downloads.indexOf(download); + this._downloads.splice(itemIndex, 1); + this._updateViews(); + }, + + ////////////////////////////////////////////////////////////////////////////// + //// Propagation of properties to our views + + /** + * Computes aggregate values and propagates the changes to our views. + */ + _updateViews: function DSD_updateViews() + { + // Do not update the status indicators during batch loads of download items. + if (this._loading) { + return; + } + + this._refreshProperties(); + this._views.forEach(this._updateView, this); + }, + + /** + * Updates the specified view with the current aggregate values. + * + * @param aView + * DownloadsIndicatorView object to be updated. + */ + _updateView: function DSD_updateView(aView) + { + aView.showingProgress = this._showingProgress; + aView.percentComplete = this._percentComplete; + aView.description = this._description; + aView.details = this._details; + }, + + ////////////////////////////////////////////////////////////////////////////// + //// Property updating based on current download status + + /** + * A generator function for the Download objects this summary is currently + * interested in. This generator is passed off to summarizeDownloads in order + * to generate statistics about the downloads we care about - in this case, + * it's the downloads in this._downloads after the first few to exclude, + * which was set when constructing this DownloadsSummaryData instance. + */ + * _downloadsForSummary() { + if (this._downloads.length > 0) { + for (let i = this._numToExclude; i < this._downloads.length; ++i) { + yield this._downloads[i]; + } + } + }, + + /** + * Computes aggregate values based on the current state of downloads. + */ + _refreshProperties: function DSD_refreshProperties() + { + // Pre-load summary with default values. + let summary = + DownloadsCommon.summarizeDownloads(this._downloadsForSummary()); + + this._description = DownloadsCommon.strings + .otherDownloads2(summary.numActive); + this._percentComplete = summary.percentComplete; + + // If all downloads are paused, show the progress indicator as paused. + this._showingProgress = summary.numDownloading > 0 || + summary.numPaused > 0; + + // Display the estimated time left, if present. + if (summary.rawTimeLeft == -1) { + // There are no downloads with a known time left. + this._lastRawTimeLeft = -1; + this._lastTimeLeft = -1; + this._details = ""; + } else { + // Compute the new time left only if state actually changed. + if (this._lastRawTimeLeft != summary.rawTimeLeft) { + this._lastRawTimeLeft = summary.rawTimeLeft; + this._lastTimeLeft = DownloadsCommon.smoothSeconds(summary.rawTimeLeft, + this._lastTimeLeft); + } + [this._details] = DownloadUtils.getDownloadStatusNoRate( + summary.totalTransferred, summary.totalSize, summary.slowestSpeed, + this._lastTimeLeft); + } + } +} diff --git a/webbrowser/components/downloads/DownloadsLogger.jsm b/webbrowser/components/downloads/DownloadsLogger.jsm new file mode 100644 index 0000000..1218539 --- /dev/null +++ b/webbrowser/components/downloads/DownloadsLogger.jsm @@ -0,0 +1,76 @@ +/* -*- Mode: js2; js2-basic-offset: 2; indent-tabs-mode: nil; -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* 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/. */ + +/** + * The contents of this file were copied almost entirely from + * toolkit/identity/LogUtils.jsm. Until we've got a more generalized logging + * mechanism for toolkit, I think this is going to be how we roll. + */ + +"use strict"; + +this.EXPORTED_SYMBOLS = ["DownloadsLogger"]; +const PREF_DEBUG = "browser.download.debug"; + +const Cu = Components.utils; +const Ci = Components.interfaces; +const Cc = Components.classes; +const Cr = Components.results; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); + +this.DownloadsLogger = { + _generateLogMessage: function _generateLogMessage(args) { + // create a string representation of a list of arbitrary things + let strings = []; + + for (let arg of args) { + if (typeof arg === 'string') { + strings.push(arg); + } else if (arg === undefined) { + strings.push('undefined'); + } else if (arg === null) { + strings.push('null'); + } else { + try { + strings.push(JSON.stringify(arg, null, 2)); + } catch(err) { + strings.push("<>"); + } + } + }; + return 'Downloads: ' + strings.join(' '); + }, + + /** + * log() - utility function to print a list of arbitrary things + * + * Enable with about:config pref browser.download.debug + */ + log: function DL_log(...args) { + let output = this._generateLogMessage(args); + dump(output + "\n"); + + // Additionally, make the output visible in the Error Console + Services.console.logStringMessage(output); + }, + + /** + * reportError() - report an error through component utils as well as + * our log function + */ + reportError: function DL_reportError(...aArgs) { + // Report the error in the browser + let output = this._generateLogMessage(aArgs); + Cu.reportError(output); + dump("ERROR:" + output + "\n"); + for (let frame = Components.stack.caller; frame; frame = frame.caller) { + dump("\t" + frame + "\n"); + } + } + +}; diff --git a/webbrowser/components/downloads/DownloadsStartup.js b/webbrowser/components/downloads/DownloadsStartup.js new file mode 100644 index 0000000..e1dd207 --- /dev/null +++ b/webbrowser/components/downloads/DownloadsStartup.js @@ -0,0 +1,278 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* 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/. */ + +/** + * This component listens to notifications for startup, shutdown and session + * restore, controlling which downloads should be loaded from the database. + * + * To avoid affecting startup performance, this component monitors the current + * session restore state, but defers the actual downloads data manipulation + * until the Download Manager service is loaded. + */ + +"use strict"; + +//////////////////////////////////////////////////////////////////////////////// +//// Globals + +const Cc = Components.classes; +const Ci = Components.interfaces; +const Cu = Components.utils; +const Cr = Components.results; + +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "DownloadsCommon", + "resource:///modules/DownloadsCommon.jsm"); +XPCOMUtils.defineLazyServiceGetter(this, "gSessionStartup", + "@mozilla.org/browser/sessionstartup;1", + "nsISessionStartup"); + +const kObservedTopics = [ + "sessionstore-windows-restored", + "sessionstore-browser-state-restored", + "download-manager-initialized", + "download-manager-change-retention", + "last-pb-context-exited", + "browser-lastwindow-close-granted", + "quit-application", + "profile-change-teardown", +]; + +/** + * CID of our implementation of nsIDownloadManagerUI. + */ +const kDownloadsUICid = Components.ID("{4d99321e-d156-455b-81f7-e7aa2308134f}"); + +/** + * Contract ID of the service implementing nsIDownloadManagerUI. + */ +const kDownloadsUIContractId = "@mozilla.org/download-manager-ui;1"; + +/** + * CID of the JavaScript implementation of nsITransfer. + */ +const kTransferCid = Components.ID("{1b4c85df-cbdd-4bb6-b04e-613caece083c}"); + +/** + * Contract ID of the service implementing nsITransfer. + */ +const kTransferContractId = "@mozilla.org/transfer;1"; + +//////////////////////////////////////////////////////////////////////////////// +//// DownloadsStartup + +function DownloadsStartup() { } + +DownloadsStartup.prototype = { + classID: Components.ID("{49507fe5-2cee-4824-b6a3-e999150ce9b8}"), + + _xpcom_factory: XPCOMUtils.generateSingletonFactory(DownloadsStartup), + + ////////////////////////////////////////////////////////////////////////////// + //// nsISupports + + QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference]), + + ////////////////////////////////////////////////////////////////////////////// + //// nsIObserver + + observe: function DS_observe(aSubject, aTopic, aData) + { + switch (aTopic) { + case "profile-after-change": + // Override Toolkit's nsIDownloadManagerUI implementation with our own. + // This must be done at application startup and not in the manifest to + // ensure that our implementation overrides the original one. + Components.manager.QueryInterface(Ci.nsIComponentRegistrar) + .registerFactory(kDownloadsUICid, "", + kDownloadsUIContractId, null); + + Components.manager.QueryInterface(Ci.nsIComponentRegistrar) + .registerFactory(kTransferCid, "", + kTransferContractId, null); + break; + + case "sessionstore-windows-restored": + case "sessionstore-browser-state-restored": + // Unless there is no saved session, there is a chance that we are + // starting up after a restart or a crash. We should check the disk + // database to see if there are completed downloads to recover and show + // in the panel, in addition to in-progress downloads. + if (gSessionStartup.sessionType != Ci.nsISessionStartup.NO_SESSION) { + this._restoringSession = true; + } + this._ensureDataLoaded(); + break; + + case "download-manager-initialized": + // Don't initialize the JavaScript data and user interface layer if we + // are initializing the Download Manager service during shutdown. + if (this._shuttingDown) { + break; + } + + // Start receiving events for active and new downloads before we return + // from this observer function. We can't defer the execution of this + // step, to ensure that we don't lose events raised in the meantime. + DownloadsCommon.initializeAllDataLinks( + aSubject.QueryInterface(Ci.nsIDownloadManager)); + + this._downloadsServiceInitialized = true; + + // Since this notification is generated during the getService call and + // we need to get the Download Manager service ourselves, we must post + // the handler on the event queue to be executed later. + Services.tm.mainThread.dispatch(this._ensureDataLoaded.bind(this), + Ci.nsIThread.DISPATCH_NORMAL); + break; + + case "download-manager-change-retention": + // If we're using the Downloads Panel, we override the retention + // preference to always retain downloads on completion. + if (!DownloadsCommon.useToolkitUI) { + aSubject.QueryInterface(Ci.nsISupportsPRInt32).data = 2; + } + break; + + case "browser-lastwindow-close-granted": + // When using the panel interface, downloads that are already completed + // should be removed when the last full browser window is closed. This + // event is invoked only if the application is not shutting down yet. + // If the Download Manager service is not initialized, we don't want to + // initialize it just to clean up completed downloads, because they can + // be present only in case there was a browser crash or restart. + if (this._downloadsServiceInitialized && + !DownloadsCommon.useToolkitUI) { + Services.downloads.cleanUp(); + } + break; + + case "last-pb-context-exited": + // Similar to the above notification, but for private downloads. + if (this._downloadsServiceInitialized && + !DownloadsCommon.useToolkitUI) { + Services.downloads.cleanUpPrivate(); + } + break; + + case "quit-application": + // When the application is shutting down, we must free all resources in + // addition to cleaning up completed downloads. If the Download Manager + // service is not initialized, we don't want to initialize it just to + // clean up completed downloads, because they can be present only in + // case there was a browser crash or restart. + this._shuttingDown = true; + if (!this._downloadsServiceInitialized) { + break; + } + + DownloadsCommon.terminateAllDataLinks(); + + // When using the panel interface, downloads that are already completed + // should be removed when quitting the application. + if (!DownloadsCommon.useToolkitUI && aData != "restart") { + this._cleanupOnShutdown = true; + } + break; + + case "profile-change-teardown": + // If we need to clean up, we must do it synchronously after all the + // "quit-application" listeners are invoked, so that the Download + // Manager service has a chance to pause or cancel in-progress downloads + // before we remove completed downloads from the list. Note that, since + // "quit-application" was invoked, we've already exited Private Browsing + // Mode, thus we are always working on the disk database. + if (this._cleanupOnShutdown) { + Services.downloads.cleanUp(); + } + + if (!DownloadsCommon.useToolkitUI) { + // If we got this far, that means that we finished our first session + // with the Downloads Panel without crashing. This means that we don't + // have to force displaying only active downloads on the next startup + // now. + this._firstSessionCompleted = true; + } + break; + } + }, + + ////////////////////////////////////////////////////////////////////////////// + //// Private + + /** + * Indicates whether we're restoring a previous session. This is used by + * _recoverAllDownloads to determine whether or not we should load and + * display all downloads data, or restrict it to only the active downloads. + */ + _restoringSession: false, + + /** + * Indicates whether the Download Manager service has been initialized. This + * flag is required because we want to avoid accessing the service immediately + * at browser startup. The service will start when the user first requests a + * download, or some time after browser startup. + */ + _downloadsServiceInitialized: false, + + /** + * True while we are processing the "quit-application" event, and later. + */ + _shuttingDown: false, + + /** + * True during shutdown if we need to remove completed downloads. + */ + _cleanupOnShutdown: false, + + /** + * True if we should display all downloads, as opposed to just active + * downloads. We decide to display all downloads if we're restoring a session, + * or if we're using the Downloads Panel anytime after the first session with + * it has completed. + */ + get _recoverAllDownloads() { + return this._restoringSession || + (!DownloadsCommon.useToolkitUI && this._firstSessionCompleted); + }, + + /** + * True if we've ever completed a session with the Downloads Panel enabled. + */ + get _firstSessionCompleted() { + return Services.prefs + .getBoolPref("browser.download.panel.firstSessionCompleted"); + }, + + set _firstSessionCompleted(aValue) { + Services.prefs.setBoolPref("browser.download.panel.firstSessionCompleted", + aValue); + return aValue; + }, + + /** + * Ensures that persistent download data is reloaded at the appropriate time. + */ + _ensureDataLoaded: function DS_ensureDataLoaded() + { + if (!this._downloadsServiceInitialized) { + return; + } + + // If the previous session has been already restored, then we ensure that + // all the downloads are loaded. Otherwise, we only ensure that the active + // downloads from the previous session are loaded. + DownloadsCommon.ensureAllPersistentDataLoaded(!this._recoverAllDownloads); + } +}; + +//////////////////////////////////////////////////////////////////////////////// +//// Module + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DownloadsStartup]); diff --git a/webbrowser/components/downloads/DownloadsTaskbar.jsm b/webbrowser/components/downloads/DownloadsTaskbar.jsm new file mode 100644 index 0000000..cf915ab --- /dev/null +++ b/webbrowser/components/downloads/DownloadsTaskbar.jsm @@ -0,0 +1,177 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80 filetype=javascript: */ +/* 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/. */ + +/** + * Handles the download progress indicator in the taskbar. + */ + +"use strict"; + +this.EXPORTED_SYMBOLS = [ + "DownloadsTaskbar", +]; + +//////////////////////////////////////////////////////////////////////////////// +//// Globals + +const Cc = Components.classes; +const Ci = Components.interfaces; +const Cu = Components.utils; +const Cr = Components.results; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "Downloads", + "resource://gre/modules/Downloads.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow", + "resource:///modules/RecentWindow.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "Services", + "resource://gre/modules/Services.jsm"); + +XPCOMUtils.defineLazyGetter(this, "gWinTaskbar", function () { + if (!("@mozilla.org/windows-taskbar;1" in Cc)) { + return null; + } + let winTaskbar = Cc["@mozilla.org/windows-taskbar;1"] + .getService(Ci.nsIWinTaskbar); + return winTaskbar.available && winTaskbar; +}); + +XPCOMUtils.defineLazyGetter(this, "gMacTaskbarProgress", function () { + return ("@mozilla.org/widget/macdocksupport;1" in Cc) && + Cc["@mozilla.org/widget/macdocksupport;1"] + .getService(Ci.nsITaskbarProgress); +}); + +//////////////////////////////////////////////////////////////////////////////// +//// DownloadsTaskbar + +/** + * Handles the download progress indicator in the taskbar. + */ +this.DownloadsTaskbar = { + /** + * Underlying DownloadSummary providing the aggregate download information, or + * null if the indicator has never been initialized. + */ + _summary: null, + + /** + * nsITaskbarProgress object to which download information is dispatched. + * This can be null if the indicator has never been initialized or if the + * indicator is currently hidden on Windows. + */ + _taskbarProgress: null, + + /** + * This method is called after a new browser window is opened, and ensures + * that the download progress indicator is displayed in the taskbar. + * + * On Windows, the indicator is attached to the first browser window that + * calls this method. When the window is closed, the indicator is moved to + * another browser window, if available, in no particular order. When there + * are no browser windows visible, the indicator is hidden. + * + * On Mac OS X, the indicator is initialized globally when this method is + * called for the first time. Subsequent calls have no effect. + * + * @param aBrowserWindow + * nsIDOMWindow object of the newly opened browser window to which the + * indicator may be attached. + */ + registerIndicator(aBrowserWindow) { + if (!this._taskbarProgress) { + if (gMacTaskbarProgress) { + // On Mac OS X, we have to register the global indicator only once. + this._taskbarProgress = gMacTaskbarProgress; + // Free the XPCOM reference on shutdown, to prevent detecting a leak. + Services.obs.addObserver(() => { + this._taskbarProgress = null; + gMacTaskbarProgress = null; + }, "quit-application-granted", false); + } else if (gWinTaskbar) { + // On Windows, the indicator is currently hidden because we have no + // previous browser window, thus we should attach the indicator now. + this._attachIndicator(aBrowserWindow); + } else { + // The taskbar indicator is not available on this platform. + return; + } + } + + // Ensure that the DownloadSummary object will be created asynchronously. + if (!this._summary) { + Downloads.getSummary(Downloads.ALL).then(summary => { + // In case the method is re-entered, we simply ignore redundant + // invocations of the callback, instead of keeping separate state. + if (this._summary) { + return; + } + this._summary = summary; + return this._summary.addView(this); + }).then(null, Cu.reportError); + } + }, + + /** + * On Windows, attaches the taskbar indicator to the specified browser window. + */ + _attachIndicator(aWindow) { + // Activate the indicator on the specified window. + let docShell = aWindow.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShellTreeItem).treeOwner + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIXULWindow).docShell; + this._taskbarProgress = gWinTaskbar.getTaskbarProgress(docShell); + + // If the DownloadSummary object has already been created, we should update + // the state of the new indicator, otherwise it will be updated as soon as + // the DownloadSummary view is registered. + if (this._summary) { + this.onSummaryChanged(); + } + + aWindow.addEventListener("unload", () => { + // Locate another browser window, excluding the one being closed. + let browserWindow = RecentWindow.getMostRecentBrowserWindow(); + if (browserWindow) { + // Move the progress indicator to the other browser window. + this._attachIndicator(browserWindow); + } else { + // The last browser window has been closed. We remove the reference to + // the taskbar progress object so that the indicator will be registered + // again on the next browser window that is opened. + this._taskbarProgress = null; + } + }, false); + }, + + ////////////////////////////////////////////////////////////////////////////// + //// DownloadSummary view + + onSummaryChanged() { + // If the last browser window has been closed, we have no indicator any more. + if (!this._taskbarProgress) { + return; + } + + if (this._summary.allHaveStopped || this._summary.progressTotalBytes == 0) { + this._taskbarProgress.setProgressState( + Ci.nsITaskbarProgress.STATE_NO_PROGRESS, 0, 0); + } else { + // For a brief moment before completion, some download components may + // report more transferred bytes than the total number of bytes. Thus, + // ensure that we never break the expectations of the progress indicator. + let progressCurrentBytes = Math.min(this._summary.progressTotalBytes, + this._summary.progressCurrentBytes); + this._taskbarProgress.setProgressState( + Ci.nsITaskbarProgress.STATE_NORMAL, + progressCurrentBytes, + this._summary.progressTotalBytes); + } + }, +}; diff --git a/webbrowser/components/downloads/DownloadsUI.js b/webbrowser/components/downloads/DownloadsUI.js new file mode 100644 index 0000000..afdbda8 --- /dev/null +++ b/webbrowser/components/downloads/DownloadsUI.js @@ -0,0 +1,151 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* 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/. */ + +/** + * This component implements the nsIDownloadManagerUI interface and opens the + * downloads panel in the most recent browser window when requested. + * + * If a specific preference is set, this component transparently forwards all + * calls to the original implementation in Toolkit, that shows the window UI. + */ + +"use strict"; + +//////////////////////////////////////////////////////////////////////////////// +//// Globals + +const Cc = Components.classes; +const Ci = Components.interfaces; +const Cu = Components.utils; +const Cr = Components.results; + +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "DownloadsCommon", + "resource:///modules/DownloadsCommon.jsm"); +XPCOMUtils.defineLazyServiceGetter(this, "gBrowserGlue", + "@mozilla.org/browser/browserglue;1", + "nsIBrowserGlue"); +XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow", + "resource:///modules/RecentWindow.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", + "resource://gre/modules/PrivateBrowsingUtils.jsm"); + +//////////////////////////////////////////////////////////////////////////////// +//// DownloadsUI + +function DownloadsUI() +{ + XPCOMUtils.defineLazyGetter(this, "_toolkitUI", function () { + // Create Toolkit's nsIDownloadManagerUI implementation. + return Components.classesByID["{7dfdf0d1-aff6-4a34-bad1-d0fe74601642}"] + .getService(Ci.nsIDownloadManagerUI); + }); +} + +DownloadsUI.prototype = { + classID: Components.ID("{4d99321e-d156-455b-81f7-e7aa2308134f}"), + + _xpcom_factory: XPCOMUtils.generateSingletonFactory(DownloadsUI), + + ////////////////////////////////////////////////////////////////////////////// + //// nsISupports + + QueryInterface: XPCOMUtils.generateQI([Ci.nsIDownloadManagerUI]), + + ////////////////////////////////////////////////////////////////////////////// + //// nsIDownloadManagerUI + + show: function DUI_show(aWindowContext, aDownload, aReason, aUsePrivateUI) + { + if (DownloadsCommon.useToolkitUI && !PrivateBrowsingUtils.isWindowPrivate(aWindowContext)) { + this._toolkitUI.show(aWindowContext, aDownload, aReason, aUsePrivateUI); + return; + } + + if (!aReason) { + aReason = Ci.nsIDownloadManagerUI.REASON_USER_INTERACTED; + } + + if (aReason == Ci.nsIDownloadManagerUI.REASON_NEW_DOWNLOAD) { + const kMinimized = Ci.nsIDOMChromeWindow.STATE_MINIMIZED; + let browserWin = gBrowserGlue.getMostRecentBrowserWindow(); + + if (!browserWin || browserWin.windowState == kMinimized) { + this._showDownloadManagerUI(aWindowContext, aUsePrivateUI); + } + else { + // If the indicator is visible, then new download notifications are + // already handled by the panel service. + browserWin.DownloadsButton.checkIsVisible(function(isVisible) { + if (!isVisible) { + this._showDownloadManagerUI(aWindowContext, aUsePrivateUI); + } + }.bind(this)); + } + } else { + this._showDownloadManagerUI(aWindowContext, aUsePrivateUI); + } + }, + + get visible() + { + // If we're still using the toolkit downloads manager, delegate the call + // to it. Otherwise, return true for now, until we decide on how we want + // to indicate that a new download has started if a browser window is + // not available or minimized. + return DownloadsCommon.useToolkitUI ? this._toolkitUI.visible : true; + }, + + getAttention: function DUI_getAttention() + { + if (DownloadsCommon.useToolkitUI) { + this._toolkitUI.getAttention(); + } + }, + + /** + * Helper function that opens the download manager UI. + */ + _showDownloadManagerUI: + function DUI_showDownloadManagerUI(aWindowContext, aUsePrivateUI) + { + // If we weren't given a window context, try to find a browser window + // to use as our parent - and if that doesn't work, error out and give up. + let parentWindow = aWindowContext; + if (!parentWindow) { + parentWindow = RecentWindow.getMostRecentBrowserWindow({ private: !!aUsePrivateUI }); + if (!parentWindow) { + Components.utils.reportError( + "Couldn't find a browser window to open the Places Downloads View " + + "from."); + return; + } + } + + // If window is private then show it in a tab. + if (PrivateBrowsingUtils.isWindowPrivate(parentWindow)) { + parentWindow.openUILinkIn("about:downloads", "tab"); + return; + } else { + let organizer = Services.wm.getMostRecentWindow("Places:Organizer"); + if (!organizer) { + parentWindow.openDialog("chrome://browser/content/places/places.xul", + "", "chrome,toolbar=yes,dialog=no,resizable", + "Downloads"); + } else { + organizer.PlacesOrganizer.selectLeftPaneQuery("Downloads"); + organizer.focus(); + } + } + } +}; + +//////////////////////////////////////////////////////////////////////////////// +//// Module + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DownloadsUI]); diff --git a/webbrowser/components/downloads/DownloadsViewUI.jsm b/webbrowser/components/downloads/DownloadsViewUI.jsm new file mode 100644 index 0000000..ede593e --- /dev/null +++ b/webbrowser/components/downloads/DownloadsViewUI.jsm @@ -0,0 +1,250 @@ +/* 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/. */ + +/* + * This module is imported by code that uses the "download.xml" binding, and + * provides prototypes for objects that handle input and display information. + */ + +"use strict"; + +this.EXPORTED_SYMBOLS = [ + "DownloadsViewUI", +]; + +const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "DownloadUtils", + "resource://gre/modules/DownloadUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "DownloadsCommon", + "resource:///modules/DownloadsCommon.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "OS", + "resource://gre/modules/osfile.jsm"); + +this.DownloadsViewUI = {}; + +/** + * A download element shell is responsible for handling the commands and the + * displayed data for a single element that uses the "download.xml" binding. + * + * The information to display is obtained through the associated Download object + * from the JavaScript API for downloads, and commands are executed using a + * combination of Download methods and DownloadsCommon.jsm helper functions. + * + * Specialized versions of this shell must be defined, and they are required to + * implement the "download" property or getter. Currently these objects are the + * HistoryDownloadElementShell and the DownloadsViewItem for the panel. The + * history view may use a HistoryDownload object in place of a Download object. + */ +this.DownloadsViewUI.DownloadElementShell = function () {} + +this.DownloadsViewUI.DownloadElementShell.prototype = { + /** + * The richlistitem for the download, initialized by the derived object. + */ + element: null, + + /** + * URI string for the file type icon displayed in the download element. + */ + get image() { + if (!this.download.target.path) { + // Old history downloads may not have a target path. + return "moz-icon://.unknown?size=32"; + } + + // When a download that was previously in progress finishes successfully, it + // means that the target file now exists and we can extract its specific + // icon, for example from a Windows executable. To ensure that the icon is + // reloaded, however, we must change the URI used by the XUL image element, + // for example by adding a query parameter. This only works if we add one of + // the parameters explicitly supported by the nsIMozIconURI interface. + return "moz-icon://" + this.download.target.path + "?size=32" + + (this.download.succeeded ? "&state=normal" : ""); + }, + + /** + * The user-facing label for the download. This is normally the leaf name of + * the download target file. In case this is a very old history download for + * which the target file is unknown, the download source URI is displayed. + */ + get displayName() { + if (!this.download.target.path) { + return this.download.source.url; + } + return OS.Path.basename(this.download.target.path); + }, + + get extendedDisplayName() { + let s = DownloadsCommon.strings; + let referrer = this.download.source.referrer || + this.download.source.url; + let [displayHost, fullHost] = DownloadUtils.getURIHost(referrer); + return s.statusSeparator(this.displayName, displayHost); + }, + + get extendedDisplayNameTip() { + let s = DownloadsCommon.strings; + let referrer = this.download.source.referrer || + this.download.source.url; + let [displayHost, fullHost] = DownloadUtils.getURIHost(referrer); + return s.statusSeparator(this.displayName, fullHost); + }, + + /** + * The progress element for the download, or undefined in case the XBL binding + * has not been applied yet. + */ + get _progressElement() { + if (!this.__progressElement) { + // If the element is not available now, we will try again the next time. + this.__progressElement = + this.element.ownerDocument.getAnonymousElementByAttribute( + this.element, "anonid", + "progressmeter"); + } + return this.__progressElement; + }, + + /** + * Processes a major state change in the user interface, then proceeds with + * the normal progress update. This function is not called for every progress + * update in order to improve performance. + */ + _updateState() { + this.element.setAttribute("displayName", this.displayName); + this.element.setAttribute("extendedDisplayName", this.extendedDisplayName); + this.element.setAttribute("extendedDisplayNameTip", this.extendedDisplayNameTip); + this.element.setAttribute("image", this.image); + this.element.setAttribute("state", + DownloadsCommon.stateOfDownload(this.download)); + + // Since state changed, reset the time left estimation. + this.lastEstimatedSecondsLeft = Infinity; + + this._updateProgress(); + }, + + /** + * Updates the elements that change regularly for in-progress downloads, + * namely the progress bar and the status line. + */ + _updateProgress() { + if (this.download.succeeded) { + // We only need to add or remove this attribute for succeeded downloads. + if (this.download.target.exists) { + this.element.setAttribute("exists", "true"); + } else { + this.element.removeAttribute("exists"); + } + } + + // The progress bar is only displayed for in-progress downloads. + if (this.download.hasProgress) { + this.element.setAttribute("progressmode", "normal"); + this.element.setAttribute("progress", this.download.progress); + } else { + this.element.setAttribute("progressmode", "undetermined"); + } + + // Dispatch the ValueChange event for accessibility, if possible. + if (this._progressElement) { + let event = this.element.ownerDocument.createEvent("Events"); + event.initEvent("ValueChange", true, true); + this._progressElement.dispatchEvent(event); + } + + let status = this.statusTextAndTip; + this.element.setAttribute("status", status.text); + this.element.setAttribute("statusTip", status.tip); + }, + + lastEstimatedSecondsLeft: Infinity, + + /** + * Returns the text for the status line and the associated tooltip. These are + * returned by a single property because they are computed together. The + * result may be overridden by derived objects. + */ + get statusTextAndTip() this.rawStatusTextAndTip, + + /** + * Derived objects may call this to get the status text. + */ + get rawStatusTextAndTip() { + const nsIDM = Ci.nsIDownloadManager; + let s = DownloadsCommon.strings; + + let text = ""; + let tip = ""; + + if (!this.download.stopped) { + let totalBytes = this.download.hasProgress ? this.download.totalBytes + : -1; + // By default, extended status information including the individual + // download rate is displayed in the tooltip. The history view overrides + // the getter and displays the datails in the main area instead. + [text] = DownloadUtils.getDownloadStatusNoRate( + this.download.currentBytes, + totalBytes, + this.download.speed, + this.lastEstimatedSecondsLeft); + let newEstimatedSecondsLeft; + [tip, newEstimatedSecondsLeft] = DownloadUtils.getDownloadStatus( + this.download.currentBytes, + totalBytes, + this.download.speed, + this.lastEstimatedSecondsLeft); + this.lastEstimatedSecondsLeft = newEstimatedSecondsLeft; + } else if (this.download.canceled && this.download.hasPartialData) { + let totalBytes = this.download.hasProgress ? this.download.totalBytes + : -1; + let transfer = DownloadUtils.getTransferTotal(this.download.currentBytes, + totalBytes); + + // We use the same XUL label to display both the state and the amount + // transferred, for example "Paused - 1.1 MB". + text = s.statusSeparatorBeforeNumber(s.statePaused, transfer); + } else if (!this.download.succeeded && !this.download.canceled && + !this.download.error) { + text = s.stateStarting; + } else { + let stateLabel; + + if (this.download.succeeded) { + // For completed downloads, show the file size (e.g. "1.5 MB"). + if (this.download.target.size !== undefined) { + let [size, unit] = + DownloadUtils.convertByteUnits(this.download.target.size); + stateLabel = s.sizeWithUnits(size, unit); + } else { + // History downloads may not have a size defined. + stateLabel = s.sizeUnknown; + } + } else if (this.download.canceled) { + stateLabel = s.stateCanceled; + } else if (this.download.error.becauseBlockedByParentalControls) { + stateLabel = s.stateBlockedParentalControls; + } else if (this.download.error.becauseBlockedByReputationCheck) { + stateLabel = s.stateDirty; + } else { + stateLabel = s.stateFailed; + } + + let referrer = this.download.source.referrer || this.download.source.url; + let [displayHost, fullHost] = DownloadUtils.getURIHost(referrer); + + let date = new Date(this.download.endTime); + let [displayDate, fullDate] = DownloadUtils.getReadableDates(date); + + let firstPart = s.statusSeparator(stateLabel, displayHost); + text = s.statusSeparator(firstPart, displayDate); + tip = s.statusSeparator(fullHost, fullDate); + } + + return { text, tip: tip || text }; + }, +}; diff --git a/webbrowser/components/downloads/content/allDownloadsViewOverlay.css b/webbrowser/components/downloads/content/allDownloadsViewOverlay.css new file mode 100644 index 0000000..c062ae4 --- /dev/null +++ b/webbrowser/components/downloads/content/allDownloadsViewOverlay.css @@ -0,0 +1,56 @@ +/* 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/. */ + +/** + * The downloads richlistbox may list thousands of items, and it turns out + * XBL binding attachment, and even more so detachment, is a performance hog. + * This hack makes sure we don't apply any binding to inactive items (inactive + * items are history downloads that haven't been in the visible area). + * We can do this because the richlistbox implementation does not interact + * much with the richlistitem binding. However, this may turn out to have + * some side effects (see bug 828111 for the details). + * + * We might be able to do away with this workaround once bug 653881 is fixed. + */ +richlistitem.download { + -moz-binding: none; +} + +richlistitem.download[active] { + -moz-binding: url('chrome://browser/content/downloads/download.xml#download-full-ui'); +} + +richlistitem.download[active]:-moz-any([state="-1"],/* Starting (initial) */ + [state="0"], /* Downloading */ + [state="4"], /* Paused */ + [state="5"], /* Starting (queued) */ + [state="7"]) /* Scanning */ +{ + -moz-binding: url('chrome://browser/content/downloads/download.xml#download-in-progress-full-ui'); +} + +.download-state:not( [state="0"] /* Downloading */) + .downloadPauseMenuItem, +.download-state:not( [state="4"] /* Paused */) + .downloadResumeMenuItem, +.download-state:not(:-moz-any([state="2"], /* Failed */ + [state="4"]) /* Paused */) + .downloadCancelMenuItem, +.download-state[state]:not(:-moz-any([state="1"], /* Finished */ + [state="2"], /* Failed */ + [state="3"], /* Canceled */ + [state="6"], /* Blocked (parental) */ + [state="8"], /* Blocked (dirty) */ + [state="9"]) /* Blocked (policy) */) + .downloadRemoveFromHistoryMenuItem, +.download-state:not(:-moz-any([state="-1"],/* Starting (initial) */ + [state="0"], /* Downloading */ + [state="1"], /* Finished */ + [state="4"], /* Paused */ + [state="5"]) /* Starting (queued) */) + .downloadShowMenuItem, +.download-state[state="7"] /* Scanning */ .downloadCommandsSeparator +{ + display: none; +} diff --git a/webbrowser/components/downloads/content/allDownloadsViewOverlay.js b/webbrowser/components/downloads/content/allDownloadsViewOverlay.js new file mode 100644 index 0000000..4830f21 --- /dev/null +++ b/webbrowser/components/downloads/content/allDownloadsViewOverlay.js @@ -0,0 +1,1399 @@ +/* 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 { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "DownloadUtils", + "resource://gre/modules/DownloadUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "DownloadsCommon", + "resource:///modules/DownloadsCommon.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "DownloadsViewUI", + "resource:///modules/DownloadsViewUI.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", + "resource://gre/modules/FileUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", + "resource://gre/modules/NetUtil.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "OS", + "resource://gre/modules/osfile.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", + "resource://gre/modules/PlacesUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "Promise", + "resource://gre/modules/Promise.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow", + "resource:///modules/RecentWindow.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "Services", + "resource://gre/modules/Services.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "Task", + "resource://gre/modules/Task.jsm"); + +const nsIDM = Ci.nsIDownloadManager; + +const DESTINATION_FILE_URI_ANNO = "downloads/destinationFileURI"; +const DOWNLOAD_META_DATA_ANNO = "downloads/metaData"; + +const DOWNLOAD_VIEW_SUPPORTED_COMMANDS = + ["cmd_delete", "cmd_copy", "cmd_paste", "cmd_selectAll", + "downloadsCmd_pauseResume", "downloadsCmd_cancel", + "downloadsCmd_open", "downloadsCmd_show", "downloadsCmd_retry", + "downloadsCmd_openReferrer", "downloadsCmd_clearDownloads"]; + +/** + * Represents a download from the browser history. It implements part of the + * interface of the Download object. + * + * @param aPlacesNode + * The Places node from which the history download should be initialized. + */ +function HistoryDownload(aPlacesNode) { + // TODO (bug 829201): history downloads should get the referrer from Places. + this.source = { + url: aPlacesNode.uri, + }; + this.target = { + path: undefined, + exists: false, + size: undefined, + }; + + // In case this download cannot obtain its end time from the Places metadata, + // use the time from the Places node, that is the start time of the download. + this.endTime = aPlacesNode.time / 1000; +} + +HistoryDownload.prototype = { + /** + * Pushes information from Places metadata into this object. + */ + updateFromMetaData(metaData) { + try { + this.target.path = Cc["@mozilla.org/network/protocol;1?name=file"] + .getService(Ci.nsIFileProtocolHandler) + .getFileFromURLSpec(metaData.targetFileSpec).path; + } catch (ex) { + this.target.path = undefined; + } + + if ("state" in metaData) { + this.succeeded = metaData.state == nsIDM.DOWNLOAD_FINISHED; + this.error = metaData.state == nsIDM.DOWNLOAD_FAILED + ? { message: "History download failed." } + : metaData.state == nsIDM.DOWNLOAD_BLOCKED_PARENTAL + ? { becauseBlockedByParentalControls: true } + : metaData.state == nsIDM.DOWNLOAD_DIRTY + ? { becauseBlockedByReputationCheck: true } + : null; + this.canceled = metaData.state == nsIDM.DOWNLOAD_CANCELED || + metaData.state == nsIDM.DOWNLOAD_PAUSED; + this.endTime = metaData.endTime; + + // Normal history downloads are assumed to exist until the user interface + // is refreshed, at which point these values may be updated. + this.target.exists = true; + this.target.size = metaData.fileSize; + } else { + // Metadata might be missing from a download that has started but hasn't + // stopped already. Normally, this state is overridden with the one from + // the corresponding in-progress session download. But if the browser is + // terminated abruptly and additionally the file with information about + // in-progress downloads is lost, we may end up using this state. We use + // the failed state to allow the download to be restarted. + // + // On the other hand, if the download is missing the target file + // annotation as well, it is just a very old one, and we can assume it + // succeeded. + this.succeeded = !this.target.path; + this.error = this.target.path ? { message: "Unstarted download." } : null; + this.canceled = false; + + // These properties may be updated if the user interface is refreshed. + this.target.exists = false; + this.target.size = undefined; + } + }, + + /** + * History downloads are never in progress. + */ + stopped: true, + + /** + * No percentage indication is shown for history downloads. + */ + hasProgress: false, + + /** + * History downloads cannot be restarted using their partial data, even if + * they are indicated as paused in their Places metadata. The only way is to + * use the information from a persisted session download, that will be shown + * instead of the history download. In case this session download is not + * available, we show the history download as canceled, not paused. + */ + hasPartialData: false, + + /** + * This method mimicks the "start" method of session downloads, and is called + * when the user retries a history download. + * + * At present, we always ask the user for a new target path when retrying a + * history download. In the future we may consider reusing the known target + * path if the folder still exists and the file name is not already used, + * except when the user preferences indicate that the target path should be + * requested every time a new download is started. + */ + start() { + let browserWin = RecentWindow.getMostRecentBrowserWindow(); + let initiatingDoc = browserWin ? browserWin.document : document; + + // Do not suggest a file name if we don't know the original target. + let leafName = this.target.path ? OS.Path.basename(this.target.path) : null; + DownloadURL(this.source.url, leafName, initiatingDoc); + + return Promise.resolve(); + }, + + /** + * This method mimicks the "refresh" method of session downloads, except that + * it cannot notify that the data changed to the Downloads View. + */ + refresh: Task.async(function* () { + try { + this.target.size = (yield OS.File.stat(this.target.path)).size; + this.target.exists = true; + } catch (ex) { + // We keep the known file size from the metadata, if any. + this.target.exists = false; + } + }), +}; + +/** + * A download element shell is responsible for handling the commands and the + * displayed data for a single download view element. + * + * The shell may contain a session download, a history download, or both. When + * both a history and a session download are present, the session download gets + * priority and its information is displayed. + * + * On construction, a new richlistitem is created, and can be accessed through + * the |element| getter. The shell doesn't insert the item in a richlistbox, the + * caller must do it and remove the element when it's no longer needed. + * + * The caller is also responsible for forwarding status notifications for + * session downloads, calling the onStateChanged and onChanged methods. + * + * @param [optional] aSessionDownload + * The session download, required if aHistoryDownload is not set. + * @param [optional] aHistoryDownload + * The history download, required if aSessionDownload is not set. + */ +function HistoryDownloadElementShell(aSessionDownload, aHistoryDownload) { + this.element = document.createElement("richlistitem"); + this.element._shell = this; + + this.element.classList.add("download"); + this.element.classList.add("download-state"); + + if (aSessionDownload) { + this.sessionDownload = aSessionDownload; + } + if (aHistoryDownload) { + this.historyDownload = aHistoryDownload; + } +} + +HistoryDownloadElementShell.prototype = { + __proto__: DownloadsViewUI.DownloadElementShell.prototype, + + /** + * Manages the "active" state of the shell. By default all the shells without + * a session download are inactive, thus their UI is not updated. They must + * be activated when entering the visible area. Session downloads are always + * active. + */ + ensureActive: function DES_ensureActive() { + if (!this._active) { + this._active = true; + this.element.setAttribute("active", true); + this._updateUI(); + } + }, + get active() !!this._active, + + /** + * Overrides the base getter to return the Download or HistoryDownload object + * for displaying information and executing commands in the user interface. + */ + get download() this._sessionDownload || this._historyDownload, + + _sessionDownload: null, + get sessionDownload() this._sessionDownload, + set sessionDownload(aValue) { + if (this._sessionDownload != aValue) { + if (!aValue && !this._historyDownload) { + throw new Error("Should always have either a Download or a HistoryDownload"); + } + + this._sessionDownload = aValue; + + this.ensureActive(); + this._updateUI(); + } + return aValue; + }, + + _historyDownload: null, + get historyDownload() this._historyDownload, + set historyDownload(aValue) { + if (this._historyDownload != aValue) { + if (!aValue && !this._sessionDownload) { + throw new Error("Should always have either a Download or a HistoryDownload"); + } + + this._historyDownload = aValue; + + // We don't need to update the UI if we had a session data item, because + // the places information isn't used in this case. + if (!this._sessionDownload) { + this._updateUI(); + } + } + return aValue; + }, + + _updateUI() { + // There is nothing to do if the item has always been invisible. + if (!this.active) { + return; + } + + // Since the state changed, we may need to check the target file again. + this._targetFileChecked = false; + + this._updateState(); + }, + + get statusTextAndTip() { + let status = this.rawStatusTextAndTip; + + // The base object would show extended progress information in the tooltip, + // but we move this to the main view and never display a tooltip. + if (!this.download.stopped) { + status.text = status.tip; + } + status.tip = ""; + + return status; + }, + + onStateChanged() { + this.element.setAttribute("image", this.image); + this.element.setAttribute("state", + DownloadsCommon.stateOfDownload(this.download)); + + if (this.element.selected) { + goUpdateDownloadCommands(); + } else { + goUpdateCommand("downloadsCmd_clearDownloads"); + } + }, + + onChanged() { + this._updateProgress(); + }, + + /* nsIController */ + isCommandEnabled: function DES_isCommandEnabled(aCommand) { + // The only valid command for inactive elements is cmd_delete. + if (!this.active && aCommand != "cmd_delete") + return false; + switch (aCommand) { + case "downloadsCmd_open": + // This property is false if the download did not succeed. + return this.download.target.exists; + case "downloadsCmd_show": + // TODO: Bug 827010 - Handle part-file asynchronously. + if (this._sessionDownload && this.download.target.partFilePath) { + let partFile = new FileUtils.File(this.download.target.partFilePath); + if (partFile.exists()) { + return true; + } + } + + // This property is false if the download did not succeed. + return this.download.target.exists; + case "downloadsCmd_pauseResume": + return this.download.hasPartialData && !this.download.error; + case "downloadsCmd_retry": + return this.download.canceled || this.download.error; + case "downloadsCmd_openReferrer": + return !!this.download.source.referrer; + case "cmd_delete": + // We don't want in-progress downloads to be removed accidentally. + return this.download.stopped; + case "downloadsCmd_cancel": + return !!this._sessionDownload; + } + return false; + }, + + /* nsIController */ + doCommand: function DES_doCommand(aCommand) { + switch (aCommand) { + case "downloadsCmd_open": { + let file = new FileUtils.File(this.download.target.path); + DownloadsCommon.openDownloadedFile(file, null, window); + break; + } + case "downloadsCmd_show": { + let file = new FileUtils.File(this.download.target.path); + DownloadsCommon.showDownloadedFile(file); + break; + } + case "downloadsCmd_openReferrer": { + openURL(this.download.source.referrer); + break; + } + case "downloadsCmd_cancel": { + this.download.cancel().catch(() => {}); + this.download.removePartialData().catch(Cu.reportError); + break; + } + case "cmd_delete": { + if (this._sessionDownload) { + DownloadsCommon.removeAndFinalizeDownload(this.download); + } + if (this._historyDownload) { + let uri = NetUtil.newURI(this.download.source.url); + PlacesUtils.bhistory.removePage(uri); + } + break; + } + case "downloadsCmd_retry": { + // Errors when retrying are already reported as download failures. + this.download.start().catch(() => {}); + break; + } + case "downloadsCmd_pauseResume": { + // This command is only enabled for session downloads. + if (this.download.stopped) { + this.download.start(); + } else { + this.download.cancel(); + } + break; + } + } + }, + + // Returns whether or not the download handled by this shell should + // show up in the search results for the given term. Both the display + // name for the download and the url are searched. + matchesSearchTerm: function DES_matchesSearchTerm(aTerm) { + if (!aTerm) + return true; + aTerm = aTerm.toLowerCase(); + return this.displayName.toLowerCase().contains(aTerm) || + this.download.source.url.toLowerCase().contains(aTerm); + }, + + // Handles return keypress on the element (the keypress listener is + // set in the DownloadsPlacesView object). + doDefaultCommand: function DES_doDefaultCommand() { + function getDefaultCommandForState(aState) { + switch (aState) { + case nsIDM.DOWNLOAD_FINISHED: + return "downloadsCmd_open"; + case nsIDM.DOWNLOAD_PAUSED: + return "downloadsCmd_pauseResume"; + case nsIDM.DOWNLOAD_NOTSTARTED: + case nsIDM.DOWNLOAD_QUEUED: + return "downloadsCmd_cancel"; + case nsIDM.DOWNLOAD_FAILED: + case nsIDM.DOWNLOAD_CANCELED: + return "downloadsCmd_retry"; + case nsIDM.DOWNLOAD_SCANNING: + return "downloadsCmd_show"; + case nsIDM.DOWNLOAD_BLOCKED_PARENTAL: + case nsIDM.DOWNLOAD_DIRTY: + case nsIDM.DOWNLOAD_BLOCKED_POLICY: + return "downloadsCmd_openReferrer"; + } + return ""; + } + let state = DownloadsCommon.stateOfDownload(this.download); + let command = getDefaultCommandForState(state); + if (command && this.isCommandEnabled(command)) + this.doCommand(command); + }, + + /** + * This method is called by the outer download view, after the controller + * commands have already been updated. In case we did not check for the + * existence of the target file already, we can do it now and then update + * the commands as needed. + */ + onSelect: function DES_onSelect() { + if (!this.active) + return; + + // If this is a history download for which no target file information is + // available, we cannot retrieve information about the target file. + if (!this.download.target.path) { + return; + } + + // Start checking for existence. This may be done twice if onSelect is + // called again before the information is collected. + if (!this._targetFileChecked) { + this._checkTargetFileOnSelect().catch(Cu.reportError); + } + }, + + _checkTargetFileOnSelect: Task.async(function* () { + try { + yield this.download.refresh(); + } finally { + // Do not try to check for existence again if this failed once. + this._targetFileChecked = true; + } + + // Update the commands only if the element is still selected. + if (this.element.selected) { + goUpdateDownloadCommands(); + } + + // Ensure the interface has been updated based on the new values. We need to + // do this because history downloads can't trigger update notifications. + this._updateProgress(); + }), +}; + +/** + * A Downloads Places View is a places view designed to show a places query + * for history downloads alongside the session downloads. + * + * As we don't use the places controller, some methods implemented by other + * places views are not implemented by this view. + * + * A richlistitem in this view can represent either a past download or a session + * download, or both. Session downloads are shown first in the view, and as long + * as they exist they "collapses" their history "counterpart" (So we don't show two + * items for every download). + */ +function DownloadsPlacesView(aRichListBox, aActive = true) { + this._richlistbox = aRichListBox; + this._richlistbox._placesView = this; + window.controllers.insertControllerAt(0, this); + + // Map download URLs to download element shells regardless of their type + this._downloadElementsShellsForURI = new Map(); + + // Map download data items to their element shells. + this._viewItemsForDownloads = new WeakMap(); + + // Points to the last session download element. We keep track of this + // in order to keep all session downloads above past downloads. + this._lastSessionDownloadElement = null; + + this._searchTerm = ""; + + this._active = aActive; + + // Register as a downloads view. The places data will be initialized by + // the places setter. + this._initiallySelectedElement = null; + this._downloadsData = DownloadsCommon.getData(window.opener || window); + this._downloadsData.addView(this); + + // Get the Download button out of the attention state since we're about to + // view all downloads. + DownloadsCommon.getIndicatorData(window).attention = false; + + // Make sure to unregister the view if the window is closed. + window.addEventListener("unload", function() { + window.controllers.removeController(this); + this._downloadsData.removeView(this); + this.result = null; + }.bind(this), true); + // Resizing the window may change items visibility. + window.addEventListener("resize", function() { + this._ensureVisibleElementsAreActive(); + }.bind(this), true); +} + +DownloadsPlacesView.prototype = { + get associatedElement() this._richlistbox, + + get active() this._active, + set active(val) { + this._active = val; + if (this._active) + this._ensureVisibleElementsAreActive(); + return this._active; + }, + + /** + * This cache exists in order to optimize the load of the Downloads View, when + * Places annotations for history downloads must be read. In fact, annotations + * are stored in a single table, and reading all of them at once is much more + * efficient than an individual query. + * + * When this property is first requested, it reads the annotations for all the + * history downloads and stores them indefinitely. + * + * The historical annotations are not expected to change for the duration of + * the session, except in the case where a session download is running for the + * same URI as a history download. To ensure we don't use stale data, URIs + * corresponding to session downloads are permanently removed from the cache. + * This is a very small mumber compared to history downloads. + * + * This property returns a Map from each download source URI found in Places + * annotations to an object with the format: + * + * { targetFileSpec, state, endTime, fileSize, ... } + * + * The targetFileSpec property is the value of "downloads/destinationFileURI", + * while the other properties are taken from "downloads/metaData". Any of the + * properties may be missing from the object. + */ + get _cachedPlacesMetaData() { + if (!this.__cachedPlacesMetaData) { + this.__cachedPlacesMetaData = new Map(); + + // Read the metadata annotations first, but ignore invalid JSON. + for (let result of PlacesUtils.annotations.getAnnotationsWithName( + DOWNLOAD_META_DATA_ANNO)) { + try { + this.__cachedPlacesMetaData.set(result.uri.spec, + JSON.parse(result.annotationValue)); + } catch (ex) {} + } + + // Add the target file annotations to the metadata. + for (let result of PlacesUtils.annotations.getAnnotationsWithName( + DESTINATION_FILE_URI_ANNO)) { + let metaData = this.__cachedPlacesMetaData.get(result.uri.spec); + if (!metaData) { + metaData = {}; + this.__cachedPlacesMetaData.set(result.uri.spec, metaData); + } + metaData.targetFileSpec = result.annotationValue; + } + } + + return this.__cachedPlacesMetaData; + }, + __cachedPlacesMetaData: null, + + /** + * Reads current metadata from Places annotations for the specified URI, and + * returns an object with the format: + * + * { targetFileSpec, state, endTime, fileSize, ... } + * + * The targetFileSpec property is the value of "downloads/destinationFileURI", + * while the other properties are taken from "downloads/metaData". Any of the + * properties may be missing from the object. + */ + _getPlacesMetaDataFor(spec) { + let metaData = {}; + + try { + let uri = NetUtil.newURI(spec); + try { + metaData = JSON.parse(PlacesUtils.annotations.getPageAnnotation( + uri, DOWNLOAD_META_DATA_ANNO)); + } catch (ex) {} + metaData.targetFileSpec = PlacesUtils.annotations.getPageAnnotation( + uri, DESTINATION_FILE_URI_ANNO); + } catch (ex) {} + + return metaData; + }, + + /** + * Given a data item for a session download, or a places node for a past + * download, updates the view as necessary. + * 1. If the given data is a places node, we check whether there are any + * elements for the same download url. If there are, then we just reset + * their places node. Otherwise we add a new download element. + * 2. If the given data is a data item, we first check if there's a history + * download in the list that is not associated with a data item. If we + * found one, we use it for the data item as well and reposition it + * alongside the other session downloads. If we don't, then we go ahead + * and create a new element for the download. + * + * @param [optional] sessionDownload + * A Download object, or null for history downloads. + * @param [optional] aPlacesNode + * The Places node for a history download, or null for session downloads. + * @param [optional] aNewest + * @see onDownloadAdded. Ignored for history downloads. + * @param [optional] aDocumentFragment + * To speed up the appending of multiple elements to the end of the + * list which are coming in a single batch (i.e. invalidateContainer), + * a document fragment may be passed to which the new elements would + * be appended. It's the caller's job to ensure the fragment is merged + * to the richlistbox at the end. + */ + _addDownloadData(sessionDownload, aPlacesNode, aNewest = false, + aDocumentFragment = null) { + let downloadURI = aPlacesNode ? aPlacesNode.uri + : sessionDownload.source.url; + let shellsForURI = this._downloadElementsShellsForURI.get(downloadURI); + if (!shellsForURI) { + shellsForURI = new Set(); + this._downloadElementsShellsForURI.set(downloadURI, shellsForURI); + } + + // When a session download is attached to a shell, we ensure not to keep + // stale metadata around for the corresponding history download. This + // prevents stale state from being used if the view is rebuilt. + // + // Note that we will eagerly load the data in the cache at this point, even + // if we have seen no history download. The case where no history download + // will appear at all is rare enough in normal usage, so we can apply this + // simpler solution rather than keeping a list of cache items to ignore. + if (sessionDownload) { + this._cachedPlacesMetaData.delete(sessionDownload.source.url); + } + + let newOrUpdatedShell = null; + + // Trivial: if there are no shells for this download URI, we always + // need to create one. + let shouldCreateShell = shellsForURI.size == 0; + + // However, if we do have shells for this download uri, there are + // few options: + // 1) There's only one shell and it's for a history download (it has + // no data item). In this case, we update this shell and move it + // if necessary + // 2) There are multiple shells, indicating multiple downloads for + // the same download uri are running. In this case we create + // another shell for the download (so we have one shell for each data + // item). + // + // Note: If a cancelled session download is already in the list, and the + // download is retried, onDownloadAdded is called again for the same + // data item. Thus, we also check that we make sure we don't have a view item + // already. + if (!shouldCreateShell && + sessionDownload && !this._viewItemsForDownloads.has(sessionDownload)) { + // If there's a past-download-only shell for this download-uri with no + // associated data item, use it for the new data item. Otherwise, go ahead + // and create another shell. + shouldCreateShell = true; + for (let shell of shellsForURI) { + if (!shell.sessionDownload) { + shouldCreateShell = false; + shell.sessionDownload = sessionDownload; + newOrUpdatedShell = shell; + this._viewItemsForDownloads.set(sessionDownload, shell); + break; + } + } + } + + if (shouldCreateShell) { + // If we are adding a new history download here, it means there is no + // associated session download, thus we must read the Places metadata, + // because it will not be obscured by the session download. + let historyDownload = null; + if (aPlacesNode) { + let metaData = this._cachedPlacesMetaData.get(aPlacesNode.uri) || + this._getPlacesMetaDataFor(aPlacesNode.uri); + historyDownload = new HistoryDownload(aPlacesNode); + historyDownload.updateFromMetaData(metaData); + } + let shell = new HistoryDownloadElementShell(sessionDownload, + historyDownload); + shell.element._placesNode = aPlacesNode; + newOrUpdatedShell = shell; + shellsForURI.add(shell); + if (sessionDownload) { + this._viewItemsForDownloads.set(sessionDownload, shell); + } + } + else if (aPlacesNode) { + // We are updating information for a history download for which we have + // at least one download element shell already. There are two cases: + // 1) There are one or more download element shells for this source URI, + // each with an associated session download. We update the Places node + // because we may need it later, but we don't need to read the Places + // metadata until the last session download is removed. + // 2) Occasionally, we may receive a duplicate notification for a history + // download with no associated session download. We have exactly one + // download element shell in this case, but the metdata cannot have + // changed, just the reference to the Places node object is different. + // So, we update all the node references and keep the metadata intact. + for (let shell of shellsForURI) { + if (!shell.historyDownload) { + // Create the element to host the metadata when needed. + shell.historyDownload = new HistoryDownload(aPlacesNode); + } + shell.element._placesNode = aPlacesNode; + } + } + + if (newOrUpdatedShell) { + if (aNewest) { + this._richlistbox.insertBefore(newOrUpdatedShell.element, + this._richlistbox.firstChild); + if (!this._lastSessionDownloadElement) { + this._lastSessionDownloadElement = newOrUpdatedShell.element; + } + // Some operations like retrying an history download move an element to + // the top of the richlistbox, along with other session downloads. + // More generally, if a new download is added, should be made visible. + this._richlistbox.ensureElementIsVisible(newOrUpdatedShell.element); + } else if (sessionDownload) { + let before = this._lastSessionDownloadElement ? + this._lastSessionDownloadElement.nextSibling : this._richlistbox.firstChild; + this._richlistbox.insertBefore(newOrUpdatedShell.element, before); + this._lastSessionDownloadElement = newOrUpdatedShell.element; + } + else { + let appendTo = aDocumentFragment || this._richlistbox; + appendTo.appendChild(newOrUpdatedShell.element); + } + + if (this.searchTerm) { + newOrUpdatedShell.element.hidden = + !newOrUpdatedShell.element._shell.matchesSearchTerm(this.searchTerm); + } + } + + // If aDocumentFragment is defined this is a batch change, so it's up to + // the caller to append the fragment and activate the visible shells. + if (!aDocumentFragment) { + this._ensureVisibleElementsAreActive(); + goUpdateCommand("downloadsCmd_clearDownloads"); + } + }, + + _removeElement: function DPV__removeElement(aElement) { + // If the element was selected exclusively, select its next + // sibling first, if not, try for previous sibling, if any. + if ((aElement.nextSibling || aElement.previousSibling) && + this._richlistbox.selectedItems && + this._richlistbox.selectedItems.length == 1 && + this._richlistbox.selectedItems[0] == aElement) { + this._richlistbox.selectItem(aElement.nextSibling || + aElement.previousSibling); + } + + if (this._lastSessionDownloadElement == aElement) + this._lastSessionDownloadElement = aElement.previousSibling; + + this._richlistbox.removeItemFromSelection(aElement); + this._richlistbox.removeChild(aElement); + this._ensureVisibleElementsAreActive(); + goUpdateCommand("downloadsCmd_clearDownloads"); + }, + + _removeHistoryDownloadFromView: + function DPV__removeHistoryDownloadFromView(aPlacesNode) { + let downloadURI = aPlacesNode.uri; + let shellsForURI = this._downloadElementsShellsForURI.get(downloadURI); + if (shellsForURI) { + for (let shell of shellsForURI) { + if (shell.sessionDownload) { + shell.historyDownload = null; + } + else { + this._removeElement(shell.element); + shellsForURI.delete(shell); + if (shellsForURI.size == 0) + this._downloadElementsShellsForURI.delete(downloadURI); + } + } + } + }, + + _removeSessionDownloadFromView(download) { + let shells = this._downloadElementsShellsForURI + .get(download.source.url); + if (shells.size == 0) + throw new Error("Should have had at leaat one shell for this uri"); + + let shell = this._viewItemsForDownloads.get(download); + if (!shells.has(shell)) + throw new Error("Missing download element shell in shells list for url"); + + // If there's more than one item for this download uri, we can let the + // view item for this this particular data item go away. + // If there's only one item for this download uri, we should only + // keep it if it is associated with a history download. + if (shells.size > 1 || !shell.historyDownload) { + this._removeElement(shell.element); + shells.delete(shell); + if (shells.size == 0) + this._downloadElementsShellsForURI.delete(download.source.url); + } + else { + // We have one download element shell containing both a session download + // and a history download, and we are now removing the session download. + // Previously, we did not use the Places metadata because it was obscured + // by the session download. Since this is no longer the case, we have to + // read the latest metadata before removing the session download. + let url = shell.historyDownload.source.url; + let metaData = this._getPlacesMetaDataFor(url); + shell.historyDownload.updateFromMetaData(metaData); + shell.sessionDownload = null; + // Move it below the session-download items; + if (this._lastSessionDownloadElement == shell.element) { + this._lastSessionDownloadElement = shell.element.previousSibling; + } + else { + let before = this._lastSessionDownloadElement ? + this._lastSessionDownloadElement.nextSibling : this._richlistbox.firstChild; + this._richlistbox.insertBefore(shell.element, before); + } + } + }, + + _ensureVisibleElementsAreActive: + function DPV__ensureVisibleElementsAreActive() { + if (!this.active || this._ensureVisibleTimer || !this._richlistbox.firstChild) + return; + + this._ensureVisibleTimer = setTimeout(function() { + delete this._ensureVisibleTimer; + if (!this._richlistbox.firstChild) + return; + + let rlbRect = this._richlistbox.getBoundingClientRect(); + let winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils); + let nodes = winUtils.nodesFromRect(rlbRect.left, rlbRect.top, + 0, rlbRect.width, rlbRect.height, 0, + true, false); + // nodesFromRect returns nodes in z-index order, and for the same z-index + // sorts them in inverted DOM order, thus starting from the one that would + // be on top. + let firstVisibleNode, lastVisibleNode; + for (let node of nodes) { + if (node.localName === "richlistitem" && node._shell) { + node._shell.ensureActive(); + // The first visible node is the last match. + firstVisibleNode = node; + // While the last visible node is the first match. + if (!lastVisibleNode) + lastVisibleNode = node; + } + } + + // Also activate the first invisible nodes in both boundaries (that is, + // above and below the visible area) to ensure proper keyboard navigation + // in both directions. + let nodeBelowVisibleArea = lastVisibleNode && lastVisibleNode.nextSibling; + if (nodeBelowVisibleArea && nodeBelowVisibleArea._shell) + nodeBelowVisibleArea._shell.ensureActive(); + + let nodeABoveVisibleArea = + firstVisibleNode && firstVisibleNode.previousSibling; + if (nodeABoveVisibleArea && nodeABoveVisibleArea._shell) + nodeABoveVisibleArea._shell.ensureActive(); + }.bind(this), 10); + }, + + _place: "", + get place() this._place, + set place(val) { + // Don't reload everything if we don't have to. + if (this._place == val) { + // XXXmano: places.js relies on this behavior (see Bug 822203). + this.searchTerm = ""; + return val; + } + + this._place = val; + + let history = PlacesUtils.history; + let queries = { }, options = { }; + history.queryStringToQueries(val, queries, { }, options); + if (!queries.value.length) + queries.value = [history.getNewQuery()]; + + let result = history.executeQueries(queries.value, queries.value.length, + options.value); + result.addObserver(this, false); + return val; + }, + + _result: null, + get result() this._result, + set result(val) { + if (this._result == val) + return val; + + if (this._result) { + this._result.removeObserver(this); + this._resultNode.containerOpen = false; + } + + if (val) { + this._result = val; + this._resultNode = val.root; + this._resultNode.containerOpen = true; + this._ensureInitialSelection(); + } + else { + delete this._resultNode; + delete this._result; + } + + return val; + }, + + get selectedNodes() { + return [for (element of this._richlistbox.selectedItems) + if (element._placesNode) + element._placesNode]; + }, + + get selectedNode() { + let selectedNodes = this.selectedNodes; + return selectedNodes.length == 1 ? selectedNodes[0] : null; + }, + + get hasSelection() this.selectedNodes.length > 0, + + containerStateChanged: + function DPV_containerStateChanged(aNode, aOldState, aNewState) { + this.invalidateContainer(aNode) + }, + + invalidateContainer: + function DPV_invalidateContainer(aContainer) { + if (aContainer != this._resultNode) + throw new Error("Unexpected container node"); + if (!aContainer.containerOpen) + throw new Error("Root container for the downloads query cannot be closed"); + + let suppressOnSelect = this._richlistbox.suppressOnSelect; + this._richlistbox.suppressOnSelect = true; + try { + // Remove the invalidated history downloads from the list and unset the + // places node for data downloads. + // Loop backwards since _removeHistoryDownloadFromView may removeChild(). + for (let i = this._richlistbox.childNodes.length - 1; i >= 0; --i) { + let element = this._richlistbox.childNodes[i]; + if (element._placesNode) { + this._removeHistoryDownloadFromView(element._placesNode); + } + } + } + finally { + this._richlistbox.suppressOnSelect = suppressOnSelect; + } + + if (aContainer.childCount > 0) { + let elementsToAppendFragment = document.createDocumentFragment(); + for (let i = 0; i < aContainer.childCount; i++) { + try { + this._addDownloadData(null, aContainer.getChild(i), false, + elementsToAppendFragment); + } + catch(ex) { + Cu.reportError(ex); + } + } + + // _addDownloadData may not add new elements if there were already + // data items in place. + if (elementsToAppendFragment.firstChild) { + this._appendDownloadsFragment(elementsToAppendFragment); + this._ensureVisibleElementsAreActive(); + } + } + + goUpdateDownloadCommands(); + }, + + _appendDownloadsFragment: function DPV__appendDownloadsFragment(aDOMFragment) { + // Workaround multiple reflows hang by removing the richlistbox + // and adding it back when we're done. + + // Hack for bug 836283: reset xbl fields to their old values after the + // binding is reattached to avoid breaking the selection state + let xblFields = new Map(); + for (let [key, value] in Iterator(this._richlistbox)) { + xblFields.set(key, value); + } + + let parentNode = this._richlistbox.parentNode; + let nextSibling = this._richlistbox.nextSibling; + parentNode.removeChild(this._richlistbox); + this._richlistbox.appendChild(aDOMFragment); + parentNode.insertBefore(this._richlistbox, nextSibling); + + for (let [key, value] of xblFields) { + this._richlistbox[key] = value; + } + }, + + nodeInserted: function DPV_nodeInserted(aParent, aPlacesNode) { + this._addDownloadData(null, aPlacesNode); + }, + + nodeRemoved: function DPV_nodeRemoved(aParent, aPlacesNode, aOldIndex) { + this._removeHistoryDownloadFromView(aPlacesNode); + }, + + nodeAnnotationChanged() {}, + nodeIconChanged() {}, + nodeTitleChanged() {}, + nodeKeywordChanged: function() {}, + nodeDateAddedChanged: function() {}, + nodeLastModifiedChanged: function() {}, + nodeHistoryDetailsChanged: function() {}, + nodeTagsChanged: function() {}, + sortingChanged: function() {}, + nodeMoved: function() {}, + nodeURIChanged: function() {}, + batching: function() {}, + + get controller() this._richlistbox.controller, + + get searchTerm() this._searchTerm, + set searchTerm(aValue) { + if (this._searchTerm != aValue) { + for (let element of this._richlistbox.childNodes) { + element.hidden = !element._shell.matchesSearchTerm(aValue); + } + this._ensureVisibleElementsAreActive(); + } + return this._searchTerm = aValue; + }, + + /** + * When the view loads, we want to select the first item. + * However, because session downloads, for which the data is loaded + * asynchronously, always come first in the list, and because the list + * may (or may not) already contain history downloads at that point, it + * turns out that by the time we can select the first item, the user may + * have already started using the view. + * To make things even more complicated, in other cases, the places data + * may be loaded after the session downloads data. Thus we cannot rely on + * the order in which the data comes in. + * We work around this by attempting to select the first element twice, + * once after the places data is loaded and once when the session downloads + * data is done loading. However, if the selection has changed in-between, + * we assume the user has already started using the view and give up. + */ + _ensureInitialSelection: function DPV__ensureInitialSelection() { + // Either they're both null, or the selection has not changed in between. + if (this._richlistbox.selectedItem == this._initiallySelectedElement) { + let firstDownloadElement = this._richlistbox.firstChild; + if (firstDownloadElement != this._initiallySelectedElement) { + // We may be called before _ensureVisibleElementsAreActive, + // or before the download binding is attached. Therefore, ensure the + // first item is activated, and pass the item to the richlistbox + // setters only at a point we know for sure the binding is attached. + firstDownloadElement._shell.ensureActive(); + Services.tm.mainThread.dispatch(function() { + this._richlistbox.selectedItem = firstDownloadElement; + this._richlistbox.currentItem = firstDownloadElement; + this._initiallySelectedElement = firstDownloadElement; + }.bind(this), Ci.nsIThread.DISPATCH_NORMAL); + } + } + }, + + onDataLoadStarting: function() { }, + onDataLoadCompleted: function DPV_onDataLoadCompleted() { + this._ensureInitialSelection(); + }, + + onDownloadAdded(download, newest) { + this._addDownloadData(download, null, newest); + }, + + onDownloadStateChanged(download) { + this._viewItemsForDownloads.get(download).onStateChanged(); + }, + + onDownloadChanged(download) { + this._viewItemsForDownloads.get(download).onChanged(); + }, + + onDownloadRemoved(download) { + this._removeSessionDownloadFromView(download); + }, + + supportsCommand: function DPV_supportsCommand(aCommand) { + if (DOWNLOAD_VIEW_SUPPORTED_COMMANDS.indexOf(aCommand) != -1) { + // The clear-downloads command may be performed by the toolbar-button, + // which can be focused on OS X. Thus enable this command even if the + // richlistbox is not focused. + // For other commands, be prudent and disable them unless the richlistview + // is focused. It's important to make the decision here rather than in + // isCommandEnabled. Otherwise our controller may "steal" commands from + // other controls in the window (see goUpdateCommand & + // getControllerForCommand). + if (document.activeElement == this._richlistbox || + aCommand == "downloadsCmd_clearDownloads") { + return true; + } + } + return false; + }, + + isCommandEnabled: function DPV_isCommandEnabled(aCommand) { + switch (aCommand) { + case "cmd_copy": + return this._richlistbox.selectedItems.length > 0; + case "cmd_selectAll": + return true; + case "cmd_paste": + return this._canDownloadClipboardURL(); + case "downloadsCmd_clearDownloads": + return this._canClearDownloads(); + default: + return Array.every(this._richlistbox.selectedItems, function(element) { + return element._shell.isCommandEnabled(aCommand); + }); + } + }, + + _canClearDownloads: function DPV__canClearDownloads() { + // Downloads can be cleared if there's at least one removable download in + // the list (either a history download or a completed session download). + // Because history downloads are always removable and are listed after the + // session downloads, check from bottom to top. + for (let elt = this._richlistbox.lastChild; elt; elt = elt.previousSibling) { + // Stopped, paused, and failed downloads with partial data are removed. + let download = elt._shell.download; + if (download.stopped && !(download.canceled && download.hasPartialData)) { + return true; + } + } + return false; + }, + + _copySelectedDownloadsToClipboard: + function DPV__copySelectedDownloadsToClipboard() { + let urls = [for (element of this._richlistbox.selectedItems) + element._shell.download.source.url]; + + Cc["@mozilla.org/widget/clipboardhelper;1"] + .getService(Ci.nsIClipboardHelper) + .copyString(urls.join("\n"), document); + }, + + _getURLFromClipboardData: function DPV__getURLFromClipboardData() { + let trans = Cc["@mozilla.org/widget/transferable;1"]. + createInstance(Ci.nsITransferable); + trans.init(null); + + let flavors = ["text/x-moz-url", "text/unicode"]; + flavors.forEach(trans.addDataFlavor); + + Services.clipboard.getData(trans, Services.clipboard.kGlobalClipboard); + + // Getting the data or creating the nsIURI might fail. + try { + let data = {}; + trans.getAnyTransferData({}, data, {}); + let [url, name] = data.value.QueryInterface(Ci.nsISupportsString) + .data.split("\n"); + if (url) + return [NetUtil.newURI(url, null, null).spec, name]; + } + catch(ex) { } + + return ["", ""]; + }, + + _canDownloadClipboardURL: function DPV__canDownloadClipboardURL() { + let [url, name] = this._getURLFromClipboardData(); + return url != ""; + }, + + _downloadURLFromClipboard: function DPV__downloadURLFromClipboard() { + let [url, name] = this._getURLFromClipboardData(); + let browserWin = RecentWindow.getMostRecentBrowserWindow(); + let initiatingDoc = browserWin ? browserWin.document : document; + DownloadURL(url, name, initiatingDoc); + }, + + doCommand: function DPV_doCommand(aCommand) { + // Commands may be invoked with keyboard shortcuts even if disabled. + if (!this.isCommandEnabled(aCommand)) { + return; + } + switch (aCommand) { + case "cmd_copy": + this._copySelectedDownloadsToClipboard(); + break; + case "cmd_selectAll": + this._richlistbox.selectAll(); + break; + case "cmd_paste": + this._downloadURLFromClipboard(); + break; + case "downloadsCmd_clearDownloads": + this._downloadsData.removeFinished(); + if (this.result) { + Cc["@mozilla.org/browser/download-history;1"] + .getService(Ci.nsIDownloadHistory) + .removeAllDownloads(); + } + // There may be no selection or focus change as a result + // of these change, and we want the command updated immediately. + goUpdateCommand("downloadsCmd_clearDownloads"); + break; + default: { + // Cloning the nodelist into an array to get a frozen list of selected items. + // Otherwise, the selectedItems nodelist is live and doCommand may alter the + // selection while we are trying to do one particular action, like removing + // items from history. + let selectedElements = [...this._richlistbox.selectedItems]; + for (let element of selectedElements) { + element._shell.doCommand(aCommand); + } + } + } + }, + + onEvent: function() { }, + + onContextMenu: function DPV_onContextMenu(aEvent) + { + let element = this._richlistbox.selectedItem; + if (!element || !element._shell) + return false; + + // Set the state attribute so that only the appropriate items are displayed. + let contextMenu = document.getElementById("downloadsContextMenu"); + let download = element._shell.download; + contextMenu.setAttribute("state", + DownloadsCommon.stateOfDownload(download)); + + if (!download.stopped) { + // The hasPartialData property of a download may change at any time after + // it has started, so ensure we update the related command now. + goUpdateCommand("downloadsCmd_pauseResume"); + } + return true; + }, + + onKeyPress: function DPV_onKeyPress(aEvent) { + let selectedElements = this._richlistbox.selectedItems; + if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN) { + // In the content tree, opening bookmarks by pressing return is only + // supported when a single item is selected. To be consistent, do the + // same here. + if (selectedElements.length == 1) { + let element = selectedElements[0]; + if (element._shell) + element._shell.doDefaultCommand(); + } + } + else if (aEvent.charCode == " ".charCodeAt(0)) { + // Pause/Resume every selected download + for (let element of selectedElements) { + if (element._shell.isCommandEnabled("downloadsCmd_pauseResume")) + element._shell.doCommand("downloadsCmd_pauseResume"); + } + } + }, + + onDoubleClick: function DPV_onDoubleClick(aEvent) { + if (aEvent.button != 0) + return; + + let selectedElements = this._richlistbox.selectedItems; + if (selectedElements.length != 1) + return; + + let element = selectedElements[0]; + if (element._shell) + element._shell.doDefaultCommand(); + }, + + onScroll: function DPV_onScroll() { + this._ensureVisibleElementsAreActive(); + }, + + onSelect: function DPV_onSelect() { + goUpdateDownloadCommands(); + + let selectedElements = this._richlistbox.selectedItems; + for (let elt of selectedElements) { + if (elt._shell) + elt._shell.onSelect(); + } + }, + + onDragStart: function DPV_onDragStart(aEvent) { + // TODO Bug 831358: Support d&d for multiple selection. + // For now, we just drag the first element. + let selectedItem = this._richlistbox.selectedItem; + if (!selectedItem) + return; + + let targetPath = selectedItem._shell.download.target.path; + if (!targetPath) { + return; + } + + // We must check for existence synchronously because this is a DOM event. + let file = new FileUtils.File(targetPath); + if (!file.exists()) + return; + + let dt = aEvent.dataTransfer; + dt.mozSetDataAt("application/x-moz-file", file, 0); + let url = Services.io.newFileURI(file).spec; + dt.setData("text/uri-list", url); + dt.setData("text/plain", url); + dt.effectAllowed = "copyMove"; + dt.addElement(selectedItem); + }, + + onDragOver: function DPV_onDragOver(aEvent) { + let types = aEvent.dataTransfer.types; + if (types.contains("text/uri-list") || + types.contains("text/x-moz-url") || + types.contains("text/plain")) { + aEvent.preventDefault(); + } + }, + + onDrop: function DPV_onDrop(aEvent) { + let dt = aEvent.dataTransfer; + // If dragged item is from our source, do not try to + // redownload already downloaded file. + if (dt.mozGetDataAt("application/x-moz-file", 0)) + return; + + let links = Services.droppedLinkHandler.dropLinks(aEvent); + if (!links.length) + return; + let browserWin = RecentWindow.getMostRecentBrowserWindow(); + let initiatingDoc = browserWin ? browserWin.document : document; + for (let link of links) { + if (link.url.startsWith("about:")) + continue; + DownloadURL(link.url, link.name, initiatingDoc); + } + } +}; + +for (let methodName of ["load", "applyFilter", "selectNode", "selectItems"]) { + DownloadsPlacesView.prototype[methodName] = function() { + throw new Error("|" + methodName + "| is not implemented by the downloads view."); + } +} + +function goUpdateDownloadCommands() { + for (let command of DOWNLOAD_VIEW_SUPPORTED_COMMANDS) { + goUpdateCommand(command); + } +} diff --git a/webbrowser/components/downloads/content/allDownloadsViewOverlay.xul b/webbrowser/components/downloads/content/allDownloadsViewOverlay.xul new file mode 100644 index 0000000..4e9bfd1 --- /dev/null +++ b/webbrowser/components/downloads/content/allDownloadsViewOverlay.xul @@ -0,0 +1,119 @@ + + +# 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/. + + + + + +%downloadsDTD; +]> + + + + + + +
+
+ + + +
+

+

+

+
+
+
+ + diff --git a/webbrowser/components/feeds/content/subscribe.xml b/webbrowser/components/feeds/content/subscribe.xml new file mode 100644 index 0000000..949bcfd --- /dev/null +++ b/webbrowser/components/feeds/content/subscribe.xml @@ -0,0 +1,40 @@ + + + + + %feedDTD; +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/webbrowser/components/feeds/jar.mn b/webbrowser/components/feeds/jar.mn new file mode 100644 index 0000000..f8896f8 --- /dev/null +++ b/webbrowser/components/feeds/jar.mn @@ -0,0 +1,9 @@ +# 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/. + +browser.jar: + content/browser/feeds/subscribe.xhtml (content/subscribe.xhtml) + content/browser/feeds/subscribe.js (content/subscribe.js) + content/browser/feeds/subscribe.xml (content/subscribe.xml) + content/browser/feeds/subscribe.css (content/subscribe.css) diff --git a/webbrowser/components/feeds/moz.build b/webbrowser/components/feeds/moz.build new file mode 100644 index 0000000..736920a --- /dev/null +++ b/webbrowser/components/feeds/moz.build @@ -0,0 +1,33 @@ +# -*- Mode: python; c-basic-offset: 4; 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/. + +JAR_MANIFESTS += ['jar.mn'] + +XPIDL_SOURCES += [ + 'nsIFeedResultService.idl', + 'nsIWebContentConverterRegistrar.idl', +] + +XPIDL_MODULE = 'browser-feeds' + +SOURCES += ['nsFeedSniffer.cpp'] + +EXTRA_COMPONENTS += [ + 'BrowserFeeds.manifest', + 'FeedConverter.js', +] + +EXTRA_PP_COMPONENTS += [ + 'FeedWriter.js', + 'WebContentConverter.js', +] + +FINAL_LIBRARY = 'browsercomps' + +for var in ('MOZ_APP_NAME', 'MOZ_MACBUNDLE_NAME'): + DEFINES[var] = CONFIG[var] + +LOCAL_INCLUDES += ['../build'] diff --git a/webbrowser/components/feeds/nsFeedSniffer.cpp b/webbrowser/components/feeds/nsFeedSniffer.cpp new file mode 100644 index 0000000..f314d3d --- /dev/null +++ b/webbrowser/components/feeds/nsFeedSniffer.cpp @@ -0,0 +1,363 @@ +/* -*- Mode: C++; tab-width: 8; 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 "nsFeedSniffer.h" + + +#include "nsNetCID.h" +#include "nsXPCOM.h" +#include "nsCOMPtr.h" +#include "nsStringStream.h" + +#include "nsBrowserCompsCID.h" + +#include "nsICategoryManager.h" +#include "nsIServiceManager.h" +#include "nsComponentManagerUtils.h" +#include "nsServiceManagerUtils.h" + +#include "nsIStreamConverterService.h" +#include "nsIStreamConverter.h" + +#include "nsIStreamListener.h" + +#include "nsIHttpChannel.h" +#include "nsIMIMEHeaderParam.h" + +#include "nsMimeTypes.h" +#include "nsIURI.h" +#include + +#define TYPE_ATOM "application/atom+xml" +#define TYPE_RSS "application/rss+xml" +#define TYPE_MAYBE_FEED "application/vnd.mozilla.maybe.feed" + +#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" +#define NS_RSS "http://purl.org/rss/1.0/" + +#define MAX_BYTES 512u + +NS_IMPL_ISUPPORTS(nsFeedSniffer, + nsIContentSniffer, + nsIStreamListener, + nsIRequestObserver) + +nsresult +nsFeedSniffer::ConvertEncodedData(nsIRequest* request, + const uint8_t* data, + uint32_t length) +{ + nsresult rv = NS_OK; + + mDecodedData = ""; + nsCOMPtr httpChannel(do_QueryInterface(request)); + if (!httpChannel) + return NS_ERROR_NO_INTERFACE; + + nsAutoCString contentEncoding; + httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Encoding"), + contentEncoding); + if (!contentEncoding.IsEmpty()) { + nsCOMPtr converterService(do_GetService(NS_STREAMCONVERTERSERVICE_CONTRACTID)); + if (converterService) { + ToLowerCase(contentEncoding); + + nsCOMPtr converter; + rv = converterService->AsyncConvertData(contentEncoding.get(), + "uncompressed", this, nullptr, + getter_AddRefs(converter)); + NS_ENSURE_SUCCESS(rv, rv); + + converter->OnStartRequest(request, nullptr); + + nsCOMPtr rawStream = + do_CreateInstance(NS_STRINGINPUTSTREAM_CONTRACTID); + if (!rawStream) + return NS_ERROR_FAILURE; + + rv = rawStream->SetData((const char*)data, length); + NS_ENSURE_SUCCESS(rv, rv); + + rv = converter->OnDataAvailable(request, nullptr, rawStream, 0, length); + NS_ENSURE_SUCCESS(rv, rv); + + converter->OnStopRequest(request, nullptr, NS_OK); + } + } + return rv; +} + +template +static bool +StringBeginsWithLowercaseLiteral(nsAString& aString, + const char (&aSubstring)[N]) +{ + return StringHead(aString, N).LowerCaseEqualsLiteral(aSubstring); +} + +bool +HasAttachmentDisposition(nsIHttpChannel* httpChannel) +{ + if (!httpChannel) + return false; + + uint32_t disp; + nsresult rv = httpChannel->GetContentDisposition(&disp); + + if (NS_SUCCEEDED(rv) && disp == nsIChannel::DISPOSITION_ATTACHMENT) + return true; + + return false; +} + +/** + * @return the first occurrence of a character within a string buffer, + * or nullptr if not found + */ +static const char* +FindChar(char c, const char *begin, const char *end) +{ + for (; begin < end; ++begin) { + if (*begin == c) + return begin; + } + return nullptr; +} + +/** + * + * Determine if a substring is the "documentElement" in the document. + * + * All of our sniffed substrings: = end) + return false; + + // Check to see if the character following the '<' is either '?' or '!' + // (processing instruction or doctype or comment)... these are valid nodes + // to have in the prologue. + if (*start != '?' && *start != '!') + return false; + + // Now advance the iterator until the '>' (We do this because we don't want + // to sniff indicator substrings that are embedded within other nodes, e.g. + // comments: + start = FindChar('>', start, end); + if (!start) + return false; + + ++start; + } + return true; +} + +/** + * Determines whether or not a string exists as the root element in an XML data + * string buffer. + * @param dataString + * The data being sniffed + * @param substring + * The substring being tested for existence and root-ness. + * @returns true if the substring exists and is the documentElement, false + * otherwise. + */ +static bool +ContainsTopLevelSubstring(nsACString& dataString, const char *substring) +{ + int32_t offset = dataString.Find(substring); + if (offset == -1) + return false; + + const char *begin = dataString.BeginReading(); + + // Only do the validation when we find the substring. + return IsDocumentElement(begin, begin + offset); +} + +NS_IMETHODIMP +nsFeedSniffer::GetMIMETypeFromContent(nsIRequest* request, + const uint8_t* data, + uint32_t length, + nsACString& sniffedType) +{ + nsCOMPtr channel(do_QueryInterface(request)); + if (!channel) + return NS_ERROR_NO_INTERFACE; + + // Check that this is a GET request, since you can't subscribe to a POST... + nsAutoCString method; + channel->GetRequestMethod(method); + if (!method.EqualsLiteral("GET")) { + sniffedType.Truncate(); + return NS_OK; + } + + // We need to find out if this is a load of a view-source document. In this + // case we do not want to override the content type, since the source display + // does not need to be converted from feed format to XUL. More importantly, + // we don't want to change the content type from something + // nsContentDLF::CreateInstance knows about (e.g. application/xml, text/html + // etc) to something that only the application fe knows about (maybe.feed) + // thus deactivating syntax highlighting. + nsCOMPtr originalURI; + channel->GetOriginalURI(getter_AddRefs(originalURI)); + + nsAutoCString scheme; + originalURI->GetScheme(scheme); + if (scheme.EqualsLiteral("view-source")) { + sniffedType.Truncate(); + return NS_OK; + } + + // Check the Content-Type to see if it is set correctly. If it is set to + // something specific that we think is a reliable indication of a feed, don't + // bother sniffing since we assume the site maintainer knows what they're + // doing. + nsAutoCString contentType; + channel->GetContentType(contentType); + bool noSniff = contentType.EqualsLiteral(TYPE_RSS) || + contentType.EqualsLiteral(TYPE_ATOM); + + // Check to see if this was a feed request from the location bar or from + // the feed: protocol. This is also a reliable indication. + // The value of the header doesn't matter. + if (!noSniff) { + nsAutoCString sniffHeader; + nsresult foundHeader = + channel->GetRequestHeader(NS_LITERAL_CSTRING("X-Moz-Is-Feed"), + sniffHeader); + noSniff = NS_SUCCEEDED(foundHeader); + } + + if (noSniff) { + // check for an attachment after we have a likely feed. + if(HasAttachmentDisposition(channel)) { + sniffedType.Truncate(); + return NS_OK; + } + + // set the feed header as a response header, since we have good metadata + // telling us that the feed is supposed to be RSS or Atom + channel->SetResponseHeader(NS_LITERAL_CSTRING("X-Moz-Is-Feed"), + NS_LITERAL_CSTRING("1"), false); + sniffedType.AssignLiteral(TYPE_MAYBE_FEED); + return NS_OK; + } + + // Don't sniff arbitrary types. Limit sniffing to situations that + // we think can reasonably arise. + if (!contentType.EqualsLiteral(TEXT_HTML) && + !contentType.EqualsLiteral(APPLICATION_OCTET_STREAM) && + // Same criterion as XMLHttpRequest. Should we be checking for "+xml" + // and check for text/xml and application/xml by hand instead? + contentType.Find("xml") == -1) { + sniffedType.Truncate(); + return NS_OK; + } + + // Now we need to potentially decompress data served with + // Content-Encoding: gzip + nsresult rv = ConvertEncodedData(request, data, length); + if (NS_FAILED(rv)) + return rv; + + // We cap the number of bytes to scan at MAX_BYTES to prevent picking up + // false positives by accidentally reading document content, e.g. a "how to + // make a feed" page. + const char* testData; + if (mDecodedData.IsEmpty()) { + testData = (const char*)data; + length = std::min(length, MAX_BYTES); + } else { + testData = mDecodedData.get(); + length = std::min(mDecodedData.Length(), MAX_BYTES); + } + + // The strategy here is based on that described in: + // http://blogs.msdn.com/rssteam/articles/PublishersGuide.aspx + // for interoperarbility purposes. + + // Thus begins the actual sniffing. + nsDependentCSubstring dataString((const char*)testData, length); + + bool isFeed = false; + + // RSS 0.91/0.92/2.0 + isFeed = ContainsTopLevelSubstring(dataString, "(closure); + decodedData->Append(rawSegment, count); + *writeCount = count; + return NS_OK; +} + +NS_IMETHODIMP +nsFeedSniffer::OnDataAvailable(nsIRequest* request, nsISupports* context, + nsIInputStream* stream, uint64_t offset, + uint32_t count) +{ + uint32_t read; + return stream->ReadSegments(AppendSegmentToString, &mDecodedData, count, + &read); +} + +NS_IMETHODIMP +nsFeedSniffer::OnStopRequest(nsIRequest* request, nsISupports* context, + nsresult status) +{ + return NS_OK; +} diff --git a/webbrowser/components/feeds/nsFeedSniffer.h b/webbrowser/components/feeds/nsFeedSniffer.h new file mode 100644 index 0000000..a0eb986 --- /dev/null +++ b/webbrowser/components/feeds/nsFeedSniffer.h @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 8; 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 "nsIContentSniffer.h" +#include "nsIStreamListener.h" +#include "nsStringAPI.h" +#include "mozilla/Attributes.h" + +class nsFeedSniffer final : public nsIContentSniffer, + nsIStreamListener +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NSICONTENTSNIFFER + NS_DECL_NSIREQUESTOBSERVER + NS_DECL_NSISTREAMLISTENER + + static nsresult AppendSegmentToString(nsIInputStream* inputStream, + void* closure, + const char* rawSegment, + uint32_t toOffset, + uint32_t count, + uint32_t* writeCount); + +protected: + ~nsFeedSniffer() {} + + nsresult ConvertEncodedData(nsIRequest* request, const uint8_t* data, + uint32_t length); + +private: + nsCString mDecodedData; +}; + diff --git a/webbrowser/components/feeds/nsIFeedResultService.idl b/webbrowser/components/feeds/nsIFeedResultService.idl new file mode 100644 index 0000000..cb0f332 --- /dev/null +++ b/webbrowser/components/feeds/nsIFeedResultService.idl @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 8; 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 "nsISupports.idl" +interface nsIURI; +interface nsIRequest; +interface nsIFeedResult; + +/** + * nsIFeedResultService provides a globally-accessible object for retrieving + * the results of feed processing. + */ +[scriptable, uuid(950a829e-c20e-4dc3-b447-f8b753ae54da)] +interface nsIFeedResultService : nsISupports +{ + /** + * When set to true, forces the preview page to be displayed, regardless + * of the user's preferences. + */ + attribute boolean forcePreviewPage; + + /** + * Adds a URI to the user's specified external feed handler, or live + * bookmarks. + * @param uri + * The uri of the feed to add. + * @param title + * The title of the feed to add. + * @param subtitle + * The subtitle of the feed to add. + * @param feedType + * The nsIFeed type of the feed. See nsIFeed.idl + */ + void addToClientReader(in AUTF8String uri, + in AString title, + in AString subtitle, + in unsigned long feedType); + + /** + * Registers a Feed Result object with a globally accessible service + * so that it can be accessed by a singleton method outside the usual + * flow of control in document loading. + * + * @param feedResult + * An object implementing nsIFeedResult representing the feed. + */ + void addFeedResult(in nsIFeedResult feedResult); + + /** + * Gets a Feed Handler object registered using addFeedResult. + * + * @param uri + * The URI of the feed a handler is being requested for + */ + nsIFeedResult getFeedResult(in nsIURI uri); + + /** + * Unregisters a Feed Handler object registered using addFeedResult. + * @param uri + * The feed URI the handler was registered under. This must be + * the same *instance* the feed was registered under. + */ + void removeFeedResult(in nsIURI uri); +}; diff --git a/webbrowser/components/feeds/nsIWebContentConverterRegistrar.idl b/webbrowser/components/feeds/nsIWebContentConverterRegistrar.idl new file mode 100644 index 0000000..08ce2f4 --- /dev/null +++ b/webbrowser/components/feeds/nsIWebContentConverterRegistrar.idl @@ -0,0 +1,117 @@ +/* -*- Mode: C++; tab-width: 8; 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 "nsIMIMEInfo.idl" +#include "nsIWebContentHandlerRegistrar.idl" + +interface nsIRequest; + +[scriptable, uuid(eb361098-5158-4b21-8f98-50b445f1f0b2)] +interface nsIWebContentHandlerInfo : nsIHandlerApp +{ + /** + * The content type handled by the handler + */ + readonly attribute AString contentType; + + /** + * The uri of the handler, with an embedded %s where the URI of the loaded + * document will be encoded. + */ + readonly attribute AString uri; + + /** + * Gets the service URL Spec, with the loading document URI encoded in it. + * @param uri + * The URI of the document being loaded + * @returns The URI of the service with the loading document URI encoded in + * it. + */ + AString getHandlerURI(in AString uri); +}; + +[scriptable, uuid(de7cc06e-e778-45cb-b7db-7a114e1e75b1)] +interface nsIWebContentConverterService : nsIWebContentHandlerRegistrar +{ + /** + * Specifies the handler to be used to automatically handle all links of a + * certain content type from now on. + * @param contentType + * The content type to automatically load with the specified handler + * @param handler + * A web service handler. If this is null, no automatic action is + * performed and the user must choose. + * @throws NS_ERROR_NOT_AVAILABLE if the service refered to by |handler| is + * not already registered. + */ + void setAutoHandler(in AString contentType, in nsIWebContentHandlerInfo handler); + + /** + * Gets the auto handler specified for a particular content type + * @param contentType + * The content type to look up an auto handler for. + * @returns The web service handler that will automatically handle all + * documents of the specified type. null if there is no automatic + * handler. (Handlers may be registered, just none of them specified + * as "automatic"). + */ + nsIWebContentHandlerInfo getAutoHandler(in AString contentType); + + /** + * Gets a web handler for the specified service URI + * @param contentType + * The content type of the service being located + * @param uri + * The service URI of the handler to locate. + * @returns A web service handler that uses the specified uri. + */ + nsIWebContentHandlerInfo getWebContentHandlerByURI(in AString contentType, + in AString uri); + + /** + * Loads the preferred handler when content of a registered type is about + * to be loaded. + * @param request + * The nsIRequest for the load of the content + */ + void loadPreferredHandler(in nsIRequest request); + + /** + * Removes a registered protocol handler + * @param protocol + * The protocol scheme to remove a service handler for + * @param uri + * The uri of the service handler to remove + */ + void removeProtocolHandler(in AString protocol, in AString uri); + + /** + * Removes a registered content handler + * @param contentType + * The content type to remove a service handler for + * @param uri + * The uri of the service handler to remove + */ + void removeContentHandler(in AString contentType, in AString uri); + + /** + * Gets the list of content handlers for a particular type. + * @param contentType + * The content type to get handlers for + * @returns An array of nsIWebContentHandlerInfo objects + */ + void getContentHandlers(in AString contentType, + [optional] out unsigned long count, + [retval,array,size_is(count)] out nsIWebContentHandlerInfo handlers); + + /** + * Resets the list of available content handlers to the default set from + * the distribution. + * @param contentType + * The content type to reset handlers for + */ + void resetHandlersForType(in AString contentType); +}; + diff --git a/webbrowser/components/fuel/fuelApplication.js b/webbrowser/components/fuel/fuelApplication.js new file mode 100644 index 0000000..bc3a091 --- /dev/null +++ b/webbrowser/components/fuel/fuelApplication.js @@ -0,0 +1,822 @@ +/* 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/. */ + +const Ci = Components.interfaces; +const Cc = Components.classes; + +Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "Deprecated", + "resource://gre/modules/Deprecated.jsm"); + +const APPLICATION_CID = Components.ID("fe74cf80-aa2d-11db-abbd-0800200c9a66"); +const APPLICATION_CONTRACTID = "@mozilla.org/fuel/application;1"; + +//================================================= +// Singleton that holds services and utilities +var Utilities = { + get bookmarks() { + let bookmarks = Cc["@mozilla.org/browser/nav-bookmarks-service;1"]. + getService(Ci.nsINavBookmarksService); + this.__defineGetter__("bookmarks", function() bookmarks); + return this.bookmarks; + }, + + get bookmarksObserver() { + let bookmarksObserver = new BookmarksObserver(); + this.__defineGetter__("bookmarksObserver", function() bookmarksObserver); + return this.bookmarksObserver; + }, + + get annotations() { + let annotations = Cc["@mozilla.org/browser/annotation-service;1"]. + getService(Ci.nsIAnnotationService); + this.__defineGetter__("annotations", function() annotations); + return this.annotations; + }, + + get history() { + let history = Cc["@mozilla.org/browser/nav-history-service;1"]. + getService(Ci.nsINavHistoryService); + this.__defineGetter__("history", function() history); + return this.history; + }, + + get windowMediator() { + let windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"]. + getService(Ci.nsIWindowMediator); + this.__defineGetter__("windowMediator", function() windowMediator); + return this.windowMediator; + }, + + makeURI: function fuelutil_makeURI(aSpec) { + if (!aSpec) + return null; + var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); + return ios.newURI(aSpec, null, null); + }, + + free: function fuelutil_free() { + delete this.bookmarks; + delete this.bookmarksObserver; + delete this.annotations; + delete this.history; + delete this.windowMediator; + } +}; + + +//================================================= +// Window implementation + +var fuelWindowMap = new WeakMap(); +function getWindow(aWindow) { + let fuelWindow = fuelWindowMap.get(aWindow); + if (!fuelWindow) { + fuelWindow = new Window(aWindow); + fuelWindowMap.set(aWindow, fuelWindow); + } + return fuelWindow; +} + +// Don't call new Window() directly; use getWindow instead. +function Window(aWindow) { + this._window = aWindow; + this._events = new Events(); + + this._watch("TabOpen"); + this._watch("TabMove"); + this._watch("TabClose"); + this._watch("TabSelect"); +} + +Window.prototype = { + get events() { + return this._events; + }, + + get _tabbrowser() { + return this._window.getBrowser(); + }, + + /* + * Helper used to setup event handlers on the XBL element. Note that the events + * are actually dispatched to tabs, so we capture them. + */ + _watch: function win_watch(aType) { + this._tabbrowser.tabContainer.addEventListener(aType, this, + /* useCapture = */ true); + }, + + handleEvent: function win_handleEvent(aEvent) { + this._events.dispatch(aEvent.type, getBrowserTab(this, aEvent.originalTarget.linkedBrowser)); + }, + + get tabs() { + var tabs = []; + var browsers = this._tabbrowser.browsers; + for (var i=0; i getWindow(Utilities.windowMediator.getMostRecentWindow("navigator:browser")), + enumerable: true, + configurable: true + }); + +}; + +// set the proto, defined in extApplication.js +ApplicationPrototype.prototype = extApplication.prototype; + +Application.prototype = new ApplicationPrototype(); + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([Application]); + diff --git a/webbrowser/components/fuel/fuelApplication.manifest b/webbrowser/components/fuel/fuelApplication.manifest new file mode 100644 index 0000000..67e6d0f --- /dev/null +++ b/webbrowser/components/fuel/fuelApplication.manifest @@ -0,0 +1,3 @@ +component {fe74cf80-aa2d-11db-abbd-0800200c9a66} fuelApplication.js +contract @mozilla.org/fuel/application;1 {fe74cf80-aa2d-11db-abbd-0800200c9a66} +category JavaScript-global-privileged-property Application @mozilla.org/fuel/application;1 diff --git a/webbrowser/components/fuel/fuelIApplication.idl b/webbrowser/components/fuel/fuelIApplication.idl new file mode 100644 index 0000000..69b51b0 --- /dev/null +++ b/webbrowser/components/fuel/fuelIApplication.idl @@ -0,0 +1,347 @@ +/* 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 "nsISupports.idl" +#include "extIApplication.idl" + +interface nsIVariant; +interface nsIURI; +interface nsIDOMHTMLDocument; + +interface fuelIBookmarkFolder; +interface fuelIBrowserTab; + +/** + * Interface representing a collection of annotations associated + * with a bookmark or bookmark folder. + */ +[scriptable, uuid(335c9292-91a1-4ca0-ad0b-07d5f63ed6cd)] +interface fuelIAnnotations : nsISupports +{ + /** + * Array of the annotation names associated with the owning item + */ + readonly attribute nsIVariant names; + + /** + * Determines if an annotation exists with the given name. + * @param aName + * The name of the annotation + * @returns true if an annotation exists with the given name, + * false otherwise. + */ + boolean has(in AString aName); + + /** + * Gets the value of an annotation with the given name. + * @param aName + * The name of the annotation + * @returns A variant containing the value of the annotation. Supports + * string, boolean and number. + */ + nsIVariant get(in AString aName); + + /** + * Sets the value of an annotation with the given name. + * @param aName + * The name of the annotation + * @param aValue + * The new value of the annotation. Supports string, boolean + * and number + * @param aExpiration + * The expiration policy for the annotation. + * See nsIAnnotationService. + */ + void set(in AString aName, in nsIVariant aValue, in int32_t aExpiration); + + /** + * Removes the named annotation from the owner item. + * @param aName + * The name of annotation. + */ + void remove(in AString aName); +}; + + +/** + * Interface representing a bookmark item. + */ +[scriptable, uuid(808585b6-7568-4b26-8c62-545221bf2b8c)] +interface fuelIBookmark : nsISupports +{ + /** + * The id of the bookmark. + */ + readonly attribute long long id; + + /** + * The title of the bookmark. + */ + attribute AString title; + + /** + * The uri of the bookmark. + */ + attribute nsIURI uri; + + /** + * The description of the bookmark. + */ + attribute AString description; + + /** + * The keyword associated with the bookmark. + */ + attribute AString keyword; + + /** + * The type of the bookmark. + * values: "bookmark", "separator" + */ + readonly attribute AString type; + + /** + * The parent folder of the bookmark. + */ + attribute fuelIBookmarkFolder parent; + + /** + * The annotations object for the bookmark. + */ + readonly attribute fuelIAnnotations annotations; + + /** + * The events object for the bookmark. + * supports: "remove", "change", "visit", "move" + */ + readonly attribute extIEvents events; + + /** + * Removes the item from the parent folder. Used to + * delete a bookmark or separator + */ + void remove(); +}; + + +/** + * Interface representing a bookmark folder. Folders + * can hold bookmarks, separators and other folders. + */ +[scriptable, uuid(9f42fe20-52de-4a55-8632-a459c7716aa0)] +interface fuelIBookmarkFolder : nsISupports +{ + /** + * The id of the folder. + */ + readonly attribute long long id; + + /** + * The title of the folder. + */ + attribute AString title; + + /** + * The description of the folder. + */ + attribute AString description; + + /** + * The type of the folder. + * values: "folder" + */ + readonly attribute AString type; + + /** + * The parent folder of the folder. + */ + attribute fuelIBookmarkFolder parent; + + /** + * The annotations object for the folder. + */ + readonly attribute fuelIAnnotations annotations; + + /** + * The events object for the folder. + * supports: "add", "addchild", "remove", "removechild", "change", "move" + */ + readonly attribute extIEvents events; + + /** + * Array of all bookmarks, separators and folders contained + * in this folder. + */ + readonly attribute nsIVariant children; + + /** + * Adds a new child bookmark to this folder. + * @param aTitle + * The title of bookmark. + * @param aURI + * The uri of bookmark. + */ + fuelIBookmark addBookmark(in AString aTitle, in nsIURI aURI); + + /** + * Adds a new child separator to this folder. + */ + fuelIBookmark addSeparator(); + + /** + * Adds a new child folder to this folder. + * @param aTitle + * The title of folder. + */ + fuelIBookmarkFolder addFolder(in AString aTitle); + + /** + * Removes the folder from the parent folder. + */ + void remove(); +}; + +/** + * Interface representing a container for bookmark roots. Roots + * are the top level parents for the various types of bookmarks in the system. + */ +[scriptable, uuid(c9a80870-eb3c-11dc-95ff-0800200c9a66)] +interface fuelIBookmarkRoots : nsISupports +{ + /** + * The folder for the 'bookmarks menu' root. + */ + readonly attribute fuelIBookmarkFolder menu; + + /** + * The folder for the 'personal toolbar' root. + */ + readonly attribute fuelIBookmarkFolder toolbar; + + /** + * The folder for the 'tags' root. + */ + readonly attribute fuelIBookmarkFolder tags; + + /** + * The folder for the 'unfiled bookmarks' root. + */ + readonly attribute fuelIBookmarkFolder unfiled; +}; + +/** + * Interface representing a browser window. + */ +[scriptable, uuid(207edb28-eb5e-424e-a862-b0e97C8de866)] +interface fuelIWindow : nsISupports +{ + /** + * A collection of browser tabs within the browser window. + */ + readonly attribute nsIVariant tabs; + + /** + * The currently-active tab within the browser window. + */ + readonly attribute fuelIBrowserTab activeTab; + + /** + * Open a new browser tab, pointing to the specified URI. + * @param aURI + * The uri to open the browser tab to + */ + fuelIBrowserTab open(in nsIURI aURI); + + /** + * The events object for the browser window. + * supports: "TabOpen", "TabClose", "TabMove", "TabSelect" + */ + readonly attribute extIEvents events; +}; + +/** + * Interface representing a browser tab. + */ +[scriptable, uuid(3073ceff-777c-41ce-9ace-ab37268147c1)] +interface fuelIBrowserTab : nsISupports +{ + /** + * The current uri of this tab. + */ + readonly attribute nsIURI uri; + + /** + * The current index of this tab in the browser window. + */ + readonly attribute int32_t index; + + /** + * The browser window that is holding the tab. + */ + readonly attribute fuelIWindow window; + + /** + * The content document of the browser tab. + */ + readonly attribute nsIDOMHTMLDocument document; + + /** + * The events object for the browser tab. + * supports: "load" + */ + readonly attribute extIEvents events; + + /** + * Load a new URI into this browser tab. + * @param aURI + * The uri to load into the browser tab + */ + void load(in nsIURI aURI); + + /** + * Give focus to this browser tab, and bring it to the front. + */ + void focus(); + + /** + * Close the browser tab. This may not actually close the tab + * as script may abort the close operation. + */ + void close(); + + /** + * Moves this browser tab before another browser tab within the window. + * @param aBefore + * The tab before which the target tab will be moved + */ + void moveBefore(in fuelIBrowserTab aBefore); + + /** + * Move this browser tab to the last tab within the window. + */ + void moveToEnd(); +}; + +/** + * Interface for managing and accessing the applications systems + */ +[scriptable, uuid(fe74cf80-aa2d-11db-abbd-0800200c9a66)] +interface fuelIApplication : extIApplication +{ + /** + * The root bookmarks object for the application. + * Contains all the bookmark roots in the system. + */ + readonly attribute fuelIBookmarkRoots bookmarks; + + /** + * An array of browser windows within the application. + */ + readonly attribute nsIVariant windows; + + /** + * The currently active browser window. + */ + readonly attribute fuelIWindow activeWindow; +}; diff --git a/webbrowser/components/fuel/moz.build b/webbrowser/components/fuel/moz.build new file mode 100644 index 0000000..5c468f2 --- /dev/null +++ b/webbrowser/components/fuel/moz.build @@ -0,0 +1,14 @@ +# -*- Mode: python; c-basic-offset: 4; 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/. + +XPIDL_SOURCES += ['fuelIApplication.idl'] + +XPIDL_MODULE = 'fuel' + +EXTRA_COMPONENTS += ['fuelApplication.manifest'] + +EXTRA_PP_COMPONENTS += ['fuelApplication.js'] + diff --git a/webbrowser/components/moz.build b/webbrowser/components/moz.build new file mode 100644 index 0000000..48d4552 --- /dev/null +++ b/webbrowser/components/moz.build @@ -0,0 +1,47 @@ +# -*- Mode: python; c-basic-offset: 4; 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 += [ + 'abouthome', + 'certerror', + 'dirprovider', + 'downloads', + 'feeds', + 'fuel', + 'newtab', + 'pageinfo', + 'places', + 'permissions', + 'preferences', + 'privatebrowsing', + 'search', + 'sessionstore', + 'shell', + 'statusbar', +] + +if CONFIG['MOZ_SERVICES_SYNC']: + DIRS += ['sync'] + +DIRS += ['build'] + +XPIDL_SOURCES += [ + 'nsIBrowserGlue.idl', + 'nsIBrowserHandler.idl', +] + +XPIDL_MODULE = 'browsercompsbase' + +EXTRA_PP_COMPONENTS += [ + 'BrowserComponents.manifest', + 'nsAboutRedirector.js', + 'nsBrowserContentHandler.js', + 'nsBrowserGlue.js', +] + +EXTRA_JS_MODULES += [ + 'distribution.js', +] \ No newline at end of file diff --git a/webbrowser/components/newtab/cells.js b/webbrowser/components/newtab/cells.js new file mode 100644 index 0000000..47d4ef5 --- /dev/null +++ b/webbrowser/components/newtab/cells.js @@ -0,0 +1,126 @@ +#ifdef 0 +/* 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/. */ +#endif + +/** + * This class manages a cell's DOM node (not the actually cell content, a site). + * It's mostly read-only, i.e. all manipulation of both position and content + * aren't handled here. + */ +function Cell(aGrid, aNode) { + this._grid = aGrid; + this._node = aNode; + this._node._newtabCell = this; + + // Register drag-and-drop event handlers. + ["dragenter", "dragover", "dragexit", "drop"].forEach(function (aType) { + this._node.addEventListener(aType, this, false); + }, this); +} + +Cell.prototype = { + /** + * The grid. + */ + _grid: null, + + /** + * The cell's DOM node. + */ + get node() { return this._node; }, + + /** + * The cell's offset in the grid. + */ + get index() { + let index = this._grid.cells.indexOf(this); + + // Cache this value, overwrite the getter. + Object.defineProperty(this, "index", {value: index, enumerable: true}); + + return index; + }, + + /** + * The previous cell in the grid. + */ + get previousSibling() { + let prev = this.node.previousElementSibling; + prev = prev && prev._newtabCell; + + // Cache this value, overwrite the getter. + Object.defineProperty(this, "previousSibling", {value: prev, enumerable: true}); + + return prev; + }, + + /** + * The next cell in the grid. + */ + get nextSibling() { + let next = this.node.nextElementSibling; + next = next && next._newtabCell; + + // Cache this value, overwrite the getter. + Object.defineProperty(this, "nextSibling", {value: next, enumerable: true}); + + return next; + }, + + /** + * The site contained in the cell, if any. + */ + get site() { + let firstChild = this.node.firstElementChild; + return firstChild && firstChild._newtabSite; + }, + + /** + * Checks whether the cell contains a pinned site. + * @return Whether the cell contains a pinned site. + */ + containsPinnedSite: function Cell_containsPinnedSite() { + let site = this.site; + return site && site.isPinned(); + }, + + /** + * Checks whether the cell contains a site (is empty). + * @return Whether the cell is empty. + */ + isEmpty: function Cell_isEmpty() { + return !this.site; + }, + + /** + * Handles all cell events. + */ + handleEvent: function Cell_handleEvent(aEvent) { + // We're not responding to external drag/drop events + // when our parent window is in private browsing mode. + if (inPrivateBrowsingMode() && !gDrag.draggedSite) + return; + + if (aEvent.type != "dragexit" && !gDrag.isValid(aEvent)) + return; + + switch (aEvent.type) { + case "dragenter": + aEvent.preventDefault(); + gDrop.enter(this, aEvent); + break; + case "dragover": + aEvent.preventDefault(); + break; + case "dragexit": + gDrop.exit(this, aEvent); + break; + case "drop": + aEvent.preventDefault(); + gDrop.drop(this, aEvent); + break; + } + } +}; diff --git a/webbrowser/components/newtab/drag.js b/webbrowser/components/newtab/drag.js new file mode 100644 index 0000000..e3928eb --- /dev/null +++ b/webbrowser/components/newtab/drag.js @@ -0,0 +1,151 @@ +#ifdef 0 +/* 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/. */ +#endif + +/** + * This singleton implements site dragging functionality. + */ +var gDrag = { + /** + * The site offset to the drag start point. + */ + _offsetX: null, + _offsetY: null, + + /** + * The site that is dragged. + */ + _draggedSite: null, + get draggedSite() { return this._draggedSite; }, + + /** + * The cell width/height at the point the drag started. + */ + _cellWidth: null, + _cellHeight: null, + get cellWidth() { return this._cellWidth; }, + get cellHeight() { return this._cellHeight; }, + + /** + * Start a new drag operation. + * @param aSite The site that's being dragged. + * @param aEvent The 'dragstart' event. + */ + start: function Drag_start(aSite, aEvent) { + this._draggedSite = aSite; + + // Mark nodes as being dragged. + let selector = ".newtab-site, .newtab-control, .newtab-thumbnail"; + let parentCell = aSite.node.parentNode; + let nodes = parentCell.querySelectorAll(selector); + for (let i = 0; i < nodes.length; i++) + nodes[i].setAttribute("dragged", "true"); + + parentCell.setAttribute("dragged", "true"); + + this._setDragData(aSite, aEvent); + + // Store the cursor offset. + let node = aSite.node; + let rect = node.getBoundingClientRect(); + this._offsetX = aEvent.clientX - rect.left; + this._offsetY = aEvent.clientY - rect.top; + + // Store the cell dimensions. + let cellNode = aSite.cell.node; + this._cellWidth = cellNode.offsetWidth; + this._cellHeight = cellNode.offsetHeight; + + gTransformation.freezeSitePosition(aSite); + }, + + /** + * Handles the 'drag' event. + * @param aSite The site that's being dragged. + * @param aEvent The 'drag' event. + */ + drag: function Drag_drag(aSite, aEvent) { + // Get the viewport size. + let {clientWidth, clientHeight} = document.documentElement; + + // We'll want a padding of 5px. + let border = 5; + + // Enforce minimum constraints to keep the drag image inside the window. + let left = Math.max(scrollX + aEvent.clientX - this._offsetX, border); + let top = Math.max(scrollY + aEvent.clientY - this._offsetY, border); + + // Enforce maximum constraints to keep the drag image inside the window. + left = Math.min(left, scrollX + clientWidth - this.cellWidth - border); + top = Math.min(top, scrollY + clientHeight - this.cellHeight - border); + + // Update the drag image's position. + gTransformation.setSitePosition(aSite, {left: left, top: top}); + }, + + /** + * Ends the current drag operation. + * @param aSite The site that's being dragged. + * @param aEvent The 'dragend' event. + */ + end: function Drag_end(aSite, aEvent) { + let nodes = gGrid.node.querySelectorAll("[dragged]") + for (let i = 0; i < nodes.length; i++) + nodes[i].removeAttribute("dragged"); + + // Slide the dragged site back into its cell (may be the old or the new cell). + gTransformation.slideSiteTo(aSite, aSite.cell, {unfreeze: true}); + + this._draggedSite = null; + }, + + /** + * Checks whether we're responsible for a given drag event. + * @param aEvent The drag event to check. + * @return Whether we should handle this drag and drop operation. + */ + isValid: function Drag_isValid(aEvent) { + let link = gDragDataHelper.getLinkFromDragEvent(aEvent); + + // Check that the drag data is non-empty. + // Can happen when dragging places folders. + if (!link || !link.url) { + return false; + } + + // Check that we're not accepting URLs which would inherit the caller's + // principal (such as javascript: or data:). + return gLinkChecker.checkLoadURI(link.url); + }, + + /** + * Initializes the drag data for the current drag operation. + * @param aSite The site that's being dragged. + * @param aEvent The 'dragstart' event. + */ + _setDragData: function Drag_setDragData(aSite, aEvent) { + let {url, title} = aSite; + + let dt = aEvent.dataTransfer; + dt.mozCursor = "default"; + dt.effectAllowed = "move"; + dt.setData("text/plain", url); + dt.setData("text/uri-list", url); + dt.setData("text/x-moz-url", url + "\n" + title); + dt.setData("text/html", "" + url + ""); + + // Create and use an empty drag element. We don't want to use the default + // drag image with its default opacity. + let dragElement = document.createElementNS(HTML_NAMESPACE, "div"); + dragElement.classList.add("newtab-drag"); + let scrollbox = document.getElementById("newtab-vertical-margin"); + scrollbox.appendChild(dragElement); + dt.setDragImage(dragElement, 0, 0); + + // After the 'dragstart' event has been processed we can remove the + // temporary drag element from the DOM. + setTimeout(() => scrollbox.removeChild(dragElement), 0); + } +}; diff --git a/webbrowser/components/newtab/dragDataHelper.js b/webbrowser/components/newtab/dragDataHelper.js new file mode 100644 index 0000000..675ff26 --- /dev/null +++ b/webbrowser/components/newtab/dragDataHelper.js @@ -0,0 +1,22 @@ +#ifdef 0 +/* 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/. */ +#endif + +var gDragDataHelper = { + get mimeType() { + return "text/x-moz-url"; + }, + + getLinkFromDragEvent: function DragDataHelper_getLinkFromDragEvent(aEvent) { + let dt = aEvent.dataTransfer; + if (!dt || !dt.types.includes(this.mimeType)) { + return null; + } + + let data = dt.getData(this.mimeType) || ""; + let [url, title] = data.split(/[\r\n]+/); + return {url: url, title: title}; + } +}; diff --git a/webbrowser/components/newtab/drop.js b/webbrowser/components/newtab/drop.js new file mode 100644 index 0000000..7486524 --- /dev/null +++ b/webbrowser/components/newtab/drop.js @@ -0,0 +1,150 @@ +#ifdef 0 +/* 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/. */ +#endif + +// A little delay that prevents the grid from being too sensitive when dragging +// sites around. +const DELAY_REARRANGE_MS = 100; + +/** + * This singleton implements site dropping functionality. + */ +var gDrop = { + /** + * The last drop target. + */ + _lastDropTarget: null, + + /** + * Handles the 'dragenter' event. + * @param aCell The drop target cell. + */ + enter: function Drop_enter(aCell) { + this._delayedRearrange(aCell); + }, + + /** + * Handles the 'dragexit' event. + * @param aCell The drop target cell. + * @param aEvent The 'dragexit' event. + */ + exit: function Drop_exit(aCell, aEvent) { + if (aEvent.dataTransfer && !aEvent.dataTransfer.mozUserCancelled) { + this._delayedRearrange(); + } else { + // The drag operation has been cancelled. + this._cancelDelayedArrange(); + this._rearrange(); + } + }, + + /** + * Handles the 'drop' event. + * @param aCell The drop target cell. + * @param aEvent The 'dragexit' event. + */ + drop: function Drop_drop(aCell, aEvent) { + // The cell that is the drop target could contain a pinned site. We need + // to find out where that site has gone and re-pin it there. + if (aCell.containsPinnedSite()) + this._repinSitesAfterDrop(aCell); + + // Pin the dragged or insert the new site. + this._pinDraggedSite(aCell, aEvent); + + this._cancelDelayedArrange(); + + // Update the grid and move all sites to their new places. + gUpdater.updateGrid(); + }, + + /** + * Re-pins all pinned sites in their (new) positions. + * @param aCell The drop target cell. + */ + _repinSitesAfterDrop: function Drop_repinSitesAfterDrop(aCell) { + let sites = gDropPreview.rearrange(aCell); + + // Filter out pinned sites. + let pinnedSites = sites.filter(function (aSite) { + return aSite && aSite.isPinned(); + }); + + // Re-pin all shifted pinned cells. + pinnedSites.forEach(aSite => aSite.pin(sites.indexOf(aSite))); + }, + + /** + * Pins the dragged site in its new place. + * @param aCell The drop target cell. + * @param aEvent The 'dragexit' event. + */ + _pinDraggedSite: function Drop_pinDraggedSite(aCell, aEvent) { + let index = aCell.index; + let draggedSite = gDrag.draggedSite; + + if (draggedSite) { + // Pin the dragged site at its new place. + if (aCell != draggedSite.cell) + draggedSite.pin(index); + } else { + let link = gDragDataHelper.getLinkFromDragEvent(aEvent); + if (link) { + // A new link was dragged onto the grid. Create it by pinning its URL. + gPinnedLinks.pin(link, index); + + // Make sure the newly added link is not blocked. + gBlockedLinks.unblock(link); + } + } + }, + + /** + * Time a rearrange with a little delay. + * @param aCell The drop target cell. + */ + _delayedRearrange: function Drop_delayedRearrange(aCell) { + // The last drop target didn't change so there's no need to re-arrange. + if (this._lastDropTarget == aCell) + return; + + let self = this; + + function callback() { + self._rearrangeTimeout = null; + self._rearrange(aCell); + } + + this._cancelDelayedArrange(); + this._rearrangeTimeout = setTimeout(callback, DELAY_REARRANGE_MS); + + // Store the last drop target. + this._lastDropTarget = aCell; + }, + + /** + * Cancels a timed rearrange, if any. + */ + _cancelDelayedArrange: function Drop_cancelDelayedArrange() { + if (this._rearrangeTimeout) { + clearTimeout(this._rearrangeTimeout); + this._rearrangeTimeout = null; + } + }, + + /** + * Rearrange all sites in the grid depending on the current drop target. + * @param aCell The drop target cell. + */ + _rearrange: function Drop_rearrange(aCell) { + let sites = gGrid.sites; + + // We need to rearrange the grid only if there's a current drop target. + if (aCell) + sites = gDropPreview.rearrange(aCell); + + gTransformation.rearrangeSites(sites, {unfreeze: !aCell}); + } +}; diff --git a/webbrowser/components/newtab/dropPreview.js b/webbrowser/components/newtab/dropPreview.js new file mode 100644 index 0000000..fd7587a --- /dev/null +++ b/webbrowser/components/newtab/dropPreview.js @@ -0,0 +1,222 @@ +#ifdef 0 +/* 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/. */ +#endif + +/** + * This singleton provides the ability to re-arrange the current grid to + * indicate the transformation that results from dropping a cell at a certain + * position. + */ +var gDropPreview = { + /** + * Rearranges the sites currently contained in the grid when a site would be + * dropped onto the given cell. + * @param aCell The drop target cell. + * @return The re-arranged array of sites. + */ + rearrange: function DropPreview_rearrange(aCell) { + let sites = gGrid.sites; + + // Insert the dragged site into the current grid. + this._insertDraggedSite(sites, aCell); + + // After the new site has been inserted we need to correct the positions + // of all pinned tabs that have been moved around. + this._repositionPinnedSites(sites, aCell); + + return sites; + }, + + /** + * Inserts the currently dragged site into the given array of sites. + * @param aSites The array of sites to insert into. + * @param aCell The drop target cell. + */ + _insertDraggedSite: function DropPreview_insertDraggedSite(aSites, aCell) { + let dropIndex = aCell.index; + let draggedSite = gDrag.draggedSite; + + // We're currently dragging a site. + if (draggedSite) { + let dragCell = draggedSite.cell; + let dragIndex = dragCell.index; + + // Move the dragged site into its new position. + if (dragIndex != dropIndex) { + aSites.splice(dragIndex, 1); + aSites.splice(dropIndex, 0, draggedSite); + } + // We're handling an external drag item. + } else { + aSites.splice(dropIndex, 0, null); + } + }, + + /** + * Correct the position of all pinned sites that might have been moved to + * different positions after the dragged site has been inserted. + * @param aSites The array of sites containing the dragged site. + * @param aCell The drop target cell. + */ + _repositionPinnedSites: + function DropPreview_repositionPinnedSites(aSites, aCell) { + + // Collect all pinned sites. + let pinnedSites = this._filterPinnedSites(aSites, aCell); + + // Correct pinned site positions. + pinnedSites.forEach(function (aSite) { + aSites[aSites.indexOf(aSite)] = aSites[aSite.cell.index]; + aSites[aSite.cell.index] = aSite; + }, this); + + // There might be a pinned cell that got pushed out of the grid, try to + // sneak it in by removing a lower-priority cell. + if (this._hasOverflowedPinnedSite(aSites, aCell)) + this._repositionOverflowedPinnedSite(aSites, aCell); + }, + + /** + * Filter pinned sites out of the grid that are still on their old positions + * and have not moved. + * @param aSites The array of sites to filter. + * @param aCell The drop target cell. + * @return The filtered array of sites. + */ + _filterPinnedSites: function DropPreview_filterPinnedSites(aSites, aCell) { + let draggedSite = gDrag.draggedSite; + + // When dropping on a cell that contains a pinned site make sure that all + // pinned cells surrounding the drop target are moved as well. + let range = this._getPinnedRange(aCell); + + return aSites.filter(function (aSite, aIndex) { + // The site must be valid, pinned and not the dragged site. + if (!aSite || aSite == draggedSite || !aSite.isPinned()) + return false; + + let index = aSite.cell.index; + + // If it's not in the 'pinned range' it's a valid pinned site. + return (index > range.end || index < range.start); + }); + }, + + /** + * Determines the range of pinned sites surrounding the drop target cell. + * @param aCell The drop target cell. + * @return The range of pinned cells. + */ + _getPinnedRange: function DropPreview_getPinnedRange(aCell) { + let dropIndex = aCell.index; + let range = {start: dropIndex, end: dropIndex}; + + // We need a pinned range only when dropping on a pinned site. + if (aCell.containsPinnedSite()) { + let links = gPinnedLinks.links; + + // Find all previous siblings of the drop target that are pinned as well. + while (range.start && links[range.start - 1]) + range.start--; + + let maxEnd = links.length - 1; + + // Find all next siblings of the drop target that are pinned as well. + while (range.end < maxEnd && links[range.end + 1]) + range.end++; + } + + return range; + }, + + /** + * Checks if the given array of sites contains a pinned site that has + * been pushed out of the grid. + * @param aSites The array of sites to check. + * @param aCell The drop target cell. + * @return Whether there is an overflowed pinned cell. + */ + _hasOverflowedPinnedSite: + function DropPreview_hasOverflowedPinnedSite(aSites, aCell) { + + // If the drop target isn't pinned there's no way a pinned site has been + // pushed out of the grid so we can just exit here. + if (!aCell.containsPinnedSite()) + return false; + + let cells = gGrid.cells; + + // No cells have been pushed out of the grid, nothing to do here. + if (aSites.length <= cells.length) + return false; + + let overflowedSite = aSites[cells.length]; + + // Nothing to do if the site that got pushed out of the grid is not pinned. + return (overflowedSite && overflowedSite.isPinned()); + }, + + /** + * We have a overflowed pinned site that we need to re-position so that it's + * visible again. We try to find a lower-priority cell (empty or containing + * an unpinned site) that we can move it to. + * @param aSites The array of sites. + * @param aCell The drop target cell. + */ + _repositionOverflowedPinnedSite: + function DropPreview_repositionOverflowedPinnedSite(aSites, aCell) { + + // Try to find a lower-priority cell (empty or containing an unpinned site). + let index = this._indexOfLowerPrioritySite(aSites, aCell); + + if (index > -1) { + let cells = gGrid.cells; + let dropIndex = aCell.index; + + // Move all pinned cells to their new positions to let the overflowed + // site fit into the grid. + for (let i = index + 1, lastPosition = index; i < aSites.length; i++) { + if (i != dropIndex) { + aSites[lastPosition] = aSites[i]; + lastPosition = i; + } + } + + // Finally, remove the overflowed site from its previous position. + aSites.splice(cells.length, 1); + } + }, + + /** + * Finds the index of the last cell that is empty or contains an unpinned + * site. These are considered to be of a lower priority. + * @param aSites The array of sites. + * @param aCell The drop target cell. + * @return The cell's index. + */ + _indexOfLowerPrioritySite: + function DropPreview_indexOfLowerPrioritySite(aSites, aCell) { + + let cells = gGrid.cells; + let dropIndex = aCell.index; + + // Search (beginning with the last site in the grid) for a site that is + // empty or unpinned (an thus lower-priority) and can be pushed out of the + // grid instead of the pinned site. + for (let i = cells.length - 1; i >= 0; i--) { + // The cell that is our drop target is not a good choice. + if (i == dropIndex) + continue; + + let site = aSites[i]; + + // We can use the cell only if it's empty or the site is un-pinned. + if (!site || !site.isPinned()) + return i; + } + + return -1; + } +}; diff --git a/webbrowser/components/newtab/dropTargetShim.js b/webbrowser/components/newtab/dropTargetShim.js new file mode 100644 index 0000000..57a97fa --- /dev/null +++ b/webbrowser/components/newtab/dropTargetShim.js @@ -0,0 +1,232 @@ +#ifdef 0 +/* 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/. */ +#endif + +/** + * This singleton provides a custom drop target detection. We need this because + * the default DnD target detection relies on the cursor's position. We want + * to pick a drop target based on the dragged site's position. + */ +var gDropTargetShim = { + /** + * Cache for the position of all cells, cleaned after drag finished. + */ + _cellPositions: null, + + /** + * The last drop target that was hovered. + */ + _lastDropTarget: null, + + /** + * Initializes the drop target shim. + */ + init: function () { + gGrid.node.addEventListener("dragstart", this, true); + }, + + /** + * Add all event listeners needed during a drag operation. + */ + _addEventListeners: function () { + gGrid.node.addEventListener("dragend", this); + + let docElement = document.documentElement; + docElement.addEventListener("dragover", this); + docElement.addEventListener("dragenter", this); + docElement.addEventListener("drop", this); + }, + + /** + * Remove all event listeners that were needed during a drag operation. + */ + _removeEventListeners: function () { + gGrid.node.removeEventListener("dragend", this); + + let docElement = document.documentElement; + docElement.removeEventListener("dragover", this); + docElement.removeEventListener("dragenter", this); + docElement.removeEventListener("drop", this); + }, + + /** + * Handles all shim events. + */ + handleEvent: function (aEvent) { + switch (aEvent.type) { + case "dragstart": + this._dragstart(aEvent); + break; + case "dragenter": + aEvent.preventDefault(); + break; + case "dragover": + this._dragover(aEvent); + break; + case "drop": + this._drop(aEvent); + break; + case "dragend": + this._dragend(aEvent); + break; + } + }, + + /** + * Handles the 'dragstart' event. + * @param aEvent The 'dragstart' event. + */ + _dragstart: function (aEvent) { + if (aEvent.target.classList.contains("newtab-link")) { + gGrid.lock(); + this._addEventListeners(); + } + }, + + /** + * Handles the 'dragover' event. + * @param aEvent The 'dragover' event. + */ + _dragover: function (aEvent) { + // XXX bug 505521 - Use the dragover event to retrieve the + // current mouse coordinates while dragging. + let sourceNode = aEvent.dataTransfer.mozSourceNode.parentNode; + gDrag.drag(sourceNode._newtabSite, aEvent); + + // Find the current drop target, if there's one. + this._updateDropTarget(aEvent); + + // If we have a valid drop target, + // let the drag-and-drop service know. + if (this._lastDropTarget) { + aEvent.preventDefault(); + } + }, + + /** + * Handles the 'drop' event. + * @param aEvent The 'drop' event. + */ + _drop: function (aEvent) { + // We're accepting all drops. + aEvent.preventDefault(); + + // remember that drop event was seen, this explicitly + // assumes that drop event preceeds dragend event + this._dropSeen = true; + + // Make sure to determine the current drop target + // in case the dragover event hasn't been fired. + this._updateDropTarget(aEvent); + + // A site was successfully dropped. + this._dispatchEvent(aEvent, "drop", this._lastDropTarget); + }, + + /** + * Handles the 'dragend' event. + * @param aEvent The 'dragend' event. + */ + _dragend: function (aEvent) { + if (this._lastDropTarget) { + if (aEvent.dataTransfer.mozUserCancelled || !this._dropSeen) { + // The drag operation was cancelled or no drop event was generated + this._dispatchEvent(aEvent, "dragexit", this._lastDropTarget); + this._dispatchEvent(aEvent, "dragleave", this._lastDropTarget); + } + + // Clean up. + this._lastDropTarget = null; + this._cellPositions = null; + } + + this._dropSeen = false; + gGrid.unlock(); + this._removeEventListeners(); + }, + + /** + * Tries to find the current drop target and will fire + * appropriate dragenter, dragexit, and dragleave events. + * @param aEvent The current drag event. + */ + _updateDropTarget: function (aEvent) { + // Let's see if we find a drop target. + let target = this._findDropTarget(aEvent); + + if (target != this._lastDropTarget) { + if (this._lastDropTarget) + // We left the last drop target. + this._dispatchEvent(aEvent, "dragexit", this._lastDropTarget); + + if (target) + // We're now hovering a (new) drop target. + this._dispatchEvent(aEvent, "dragenter", target); + + if (this._lastDropTarget) + // We left the last drop target. + this._dispatchEvent(aEvent, "dragleave", this._lastDropTarget); + + this._lastDropTarget = target; + } + }, + + /** + * Determines the current drop target by matching the dragged site's position + * against all cells in the grid. + * @return The currently hovered drop target or null. + */ + _findDropTarget: function () { + // These are the minimum intersection values - we want to use the cell if + // the site is >= 50% hovering its position. + let minWidth = gDrag.cellWidth / 2; + let minHeight = gDrag.cellHeight / 2; + + let cellPositions = this._getCellPositions(); + let rect = gTransformation.getNodePosition(gDrag.draggedSite.node); + + // Compare each cell's position to the dragged site's position. + for (let i = 0; i < cellPositions.length; i++) { + let inter = rect.intersect(cellPositions[i].rect); + + // If the intersection is big enough we found a drop target. + if (inter.width >= minWidth && inter.height >= minHeight) + return cellPositions[i].cell; + } + + // No drop target found. + return null; + }, + + /** + * Gets the positions of all cell nodes. + * @return The (cached) cell positions. + */ + _getCellPositions: function DropTargetShim_getCellPositions() { + if (this._cellPositions) + return this._cellPositions; + + return this._cellPositions = gGrid.cells.map(function (cell) { + return {cell: cell, rect: gTransformation.getNodePosition(cell.node)}; + }); + }, + + /** + * Dispatches a custom DragEvent on the given target node. + * @param aEvent The source event. + * @param aType The event type. + * @param aTarget The target node that receives the event. + */ + _dispatchEvent: function (aEvent, aType, aTarget) { + let node = aTarget.node; + let event = document.createEvent("DragEvent"); + + // The event should not bubble to prevent recursion. + event.initDragEvent(aType, false, true, window, 0, 0, 0, 0, 0, false, false, + false, false, 0, node, aEvent.dataTransfer); + + node.dispatchEvent(event); + } +}; diff --git a/webbrowser/components/newtab/grid.js b/webbrowser/components/newtab/grid.js new file mode 100644 index 0000000..e63ea54 --- /dev/null +++ b/webbrowser/components/newtab/grid.js @@ -0,0 +1,175 @@ +#ifdef 0 +/* 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/. */ +#endif + +/** + * This singleton represents the grid that contains all sites. + */ +var gGrid = { + /** + * The DOM node of the grid. + */ + _node: null, + _gridDefaultContent: null, + get node() { return this._node; }, + + /** + * The cached DOM fragment for sites. + */ + _siteFragment: null, + + /** + * All cells contained in the grid. + */ + _cells: [], + get cells() { return this._cells; }, + + /** + * All sites contained in the grid's cells. Sites may be empty. + */ + get sites() { + // return [for (cell of this.cells) cell.site]; + let aSites = []; + for (let cell of this.cells) { + aSites.push(cell.site); + } + return aSites; + }, + + // Tells whether the grid has already been initialized. + get ready() { return !!this._ready; }, + + // Returns whether the page has finished loading yet. + get isDocumentLoaded() { return document.readyState == "complete"; }, + + /** + * Initializes the grid. + * @param aSelector The query selector of the grid. + */ + init: function Grid_init() { + this._node = document.getElementById("newtab-grid"); + this._gridDefaultContent = this._node.lastChild; + this._createSiteFragment(); + + gLinks.populateCache(() => { + this._refreshGrid(); + this._ready = true; + }); + }, + + /** + * Creates a new site in the grid. + * @param aLink The new site's link. + * @param aCell The cell that will contain the new site. + * @return The newly created site. + */ + createSite: function Grid_createSite(aLink, aCell) { + let node = aCell.node; + node.appendChild(this._siteFragment.cloneNode(true)); + return new Site(node.firstElementChild, aLink); + }, + + /** + * Handles all grid events. + */ + handleEvent: function Grid_handleEvent(aEvent) { + // Any specific events should go here. + }, + + /** + * Locks the grid to block all pointer events. + */ + lock: function Grid_lock() { + this.node.setAttribute("locked", "true"); + }, + + /** + * Unlocks the grid to allow all pointer events. + */ + unlock: function Grid_unlock() { + this.node.removeAttribute("locked"); + }, + + /** + * Renders the grid. + */ + refresh() { + this._refreshGrid(); + }, + + /** + * Renders the grid, including cells and sites. + */ + _refreshGrid() { + let row = document.createElementNS(HTML_NAMESPACE, "div"); + row.classList.add("newtab-row"); + let cell = document.createElementNS(HTML_NAMESPACE, "div"); + cell.classList.add("newtab-cell"); + + // Clear the grid + this._node.innerHTML = ""; + + // Creates the structure of one row + for (let i = 0; i < gGridPrefs.gridColumns; i++) { + row.appendChild(cell.cloneNode(true)); + } + + // Creates the grid + for (let j = 0; j < gGridPrefs.gridRows; j++) { + this._node.appendChild(row.cloneNode(true)); + } + + // Create cell array. + let cellElements = this.node.querySelectorAll(".newtab-cell"); + let cells = Array.from(cellElements, (cell) => new Cell(this, cell)); + + // Fetch links. + let links = gLinks.getLinks(); + + // Create sites. + let numLinks = Math.min(links.length, cells.length); + for (let i = 0; i < numLinks; i++) { + if (links[i]) { + this.createSite(links[i], cells[i]); + } + } + + this._cells = cells; + }, + + /** + * Creates the DOM fragment that is re-used when creating sites. + */ + _createSiteFragment: function Grid_createSiteFragment() { + let site = document.createElementNS(HTML_NAMESPACE, "div"); + site.classList.add("newtab-site"); + site.setAttribute("draggable", "true"); + + // Create the site's inner HTML code. + site.innerHTML = + '' + + ' ' + + ' ' + + ' ' + + '' + + '' + + ''; + + this._siteFragment = document.createDocumentFragment(); + this._siteFragment.appendChild(site); + }, + + /** + * Test a tile at a given position for being pinned or history + * @param position Position in sites array + */ + _isHistoricalTile: function Grid_isHistoricalTile(aPos) { + let site = this.sites[aPos]; + return site && (site.isPinned() || site.link && site.link.type == "history"); + } + +}; diff --git a/webbrowser/components/newtab/jar.mn b/webbrowser/components/newtab/jar.mn new file mode 100644 index 0000000..2d62914 --- /dev/null +++ b/webbrowser/components/newtab/jar.mn @@ -0,0 +1,8 @@ +# 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/. + +browser.jar: + content/browser/newtab/newTab.xhtml +* content/browser/newtab/newTab.js + content/browser/newtab/newTab.css \ No newline at end of file diff --git a/webbrowser/components/newtab/moz.build b/webbrowser/components/newtab/moz.build new file mode 100644 index 0000000..2d64d50 --- /dev/null +++ b/webbrowser/components/newtab/moz.build @@ -0,0 +1,8 @@ +# -*- Mode: python; c-basic-offset: 4; 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/. + +JAR_MANIFESTS += ['jar.mn'] + diff --git a/webbrowser/components/newtab/newTab.css b/webbrowser/components/newtab/newTab.css new file mode 100644 index 0000000..3c7cfa1 --- /dev/null +++ b/webbrowser/components/newtab/newTab.css @@ -0,0 +1,349 @@ +/* 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 { + width: 100%; + height: 100%; +} + +body { + font: message-box; + width: 100%; + height: 100%; + padding: 0; + margin: 0; + background-color: #F9F9F9; + display: -moz-box; + position: relative; + -moz-box-flex: 1; + -moz-user-focus: normal; + -moz-box-orient: vertical; +} + +input { + font: message-box; + font-size: 16px; +} + +input[type=button] { + cursor: pointer; +} + +/* UNDO */ +#newtab-undo-container { + transition: opacity 100ms ease-out; + -moz-box-align: center; + -moz-box-pack: center; +} + +#newtab-undo-container[undo-disabled] { + opacity: 0; + pointer-events: none; +} + +/* TOGGLE */ +#newtab-toggle { + position: absolute; + top: 12px; + right: 12px; +} + +#newtab-toggle:-moz-locale-dir(rtl) { + left: 12px; + right: auto; +} + +/* MARGINS */ +#newtab-vertical-margin { + display: -moz-box; + position: relative; + -moz-box-flex: 1; + -moz-box-orient: vertical; +} + +#newtab-margin-undo-container { + display: -moz-box; + left: 6px; + position: absolute; + top: 6px; + z-index: 1; +} + +#newtab-margin-undo-container:dir(rtl) { + left: auto; + right: 6px; +} + +#newtab-undo-close-button:dir(rtl) { + float:left; +} + +#newtab-horizontal-margin { + display: -moz-box; + -moz-box-flex: 5; +} + +#newtab-margin-top { + min-height: 10px; + max-height: 30px; + display: -moz-box; + -moz-box-flex: 1; + -moz-box-align: center; + -moz-box-pack: center; +} + +#newtab-margin-bottom { + min-height: 40px; + max-height: 80px; + -moz-box-flex: 1; +} + +.newtab-side-margin { + min-width: 40px; + max-width: 300px; + -moz-box-flex: 1; +} + +/* GRID */ +#newtab-grid { + display: -moz-box; + -moz-box-flex: 5; + -moz-box-orient: vertical; + min-width: 600px; + min-height: 400px; + transition: 175ms ease-out; + transition-property: opacity; +} + +#newtab-grid[page-disabled] { + opacity: 0; +} + +#newtab-grid[locked], +#newtab-grid[page-disabled] { + pointer-events: none; +} + +/* ROWS */ +.newtab-row { + display: -moz-box; + -moz-box-orient: horizontal; + -moz-box-direction: normal; + -moz-box-flex: 1; +} + +/* + * Thumbnail image sizes are determined in the preferences: + * toolkit.pageThumbs.minWidth + * toolkit.pageThumbs.minHeight + */ +/* CELLS */ +.newtab-cell { + display: -moz-box; + -moz-box-flex: 1; +} + +/* SITES */ +.newtab-site { + position: relative; + -moz-box-flex: 1; + transition: 150ms ease-out; + transition-property: top, left, opacity; +} + +.newtab-site[frozen] { + position: absolute; + pointer-events: none; +} + +.newtab-site[dragged] { + transition-property: none; + z-index: 10; +} + +/* LINK + THUMBNAILS */ +.newtab-link, +.newtab-thumbnail { + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; +} + +/* TITLES */ +.newtab-title { + overflow: hidden; + position: absolute; + right: 0; + text-align: center; +} + +.newtab-title { + bottom: 0; + white-space: nowrap; + text-overflow: ellipsis; + vertical-align: middle; +} + +.newtab-title { + left: 0; + padding: 0 4px; +} + +/* CONTROLS */ +.newtab-control { + position: absolute; + opacity: 0; + transition: opacity 100ms ease-out; +} + +.newtab-control:-moz-focusring, +.newtab-cell:not([ignorehover]) > .newtab-site:hover > .newtab-control { + opacity: 1; +} + +.newtab-control[dragged] { + opacity: 0 !important; +} + +@media (-moz-touch-enabled) { + .newtab-control { + opacity: 1; + } +} + +/* DRAG & DROP */ + +/* + * This is just a temporary drag element used for dataTransfer.setDragImage() + * so that we can use custom drag images and elements. It needs an opacity of + * 0.01 so that the core code detects that it's in fact a visible element. + */ +.newtab-drag { + width: 1px; + height: 1px; + background-color: #fff; + opacity: 0.01; +} + +/* SEARCH */ +#searchContainer { + display: -moz-box; + position: relative; + -moz-box-pack: center; + margin: 10px 0 15px; +} + +#searchContainer[page-disabled] { + opacity: 0; + pointer-events: none; +} + +#searchForm { + display: -moz-box; + position: relative; + height: 36px; + -moz-box-flex: 1; + max-width: 600px; /* 2 * (290 cell width + 10 cell margin) */ +} + +#searchEngineLogo { + border: 1px transparent; + padding: 2px 4px; + margin: 0; + width: 32px; + height: 32px; + position: absolute; +} + +#searchText { + -moz-box-flex: 1; + padding-top: 6px; + padding-bottom: 6px; + padding-inline-start: 42px; + padding-inline-end: 8px; + background: hsla(0,0%,100%,.9) padding-box; + border: 1px solid; + border-spacing: 0; + border-radius: 2px 0 0 2px; + border-color: hsla(210,54%,20%,.15) hsla(210,54%,20%,.17) hsla(210,54%,20%,.2); + box-shadow: 0 1px 0 hsla(210,65%,9%,.02) inset, + 0 0 2px hsla(210,65%,9%,.1) inset, + 0 1px 0 hsla(0,0%,100%,.2); + color: inherit; + unicode-bidi: plaintext; +} + +#searchText:dir(rtl) { + border-radius: 0 2px 2px 0; +} + +#searchText[aria-expanded="true"] { + border-radius: 2px 0 0 0; +} + +#searchText[aria-expanded="true"]:dir(rtl) { + border-radius: 0 2px 0 0; +} + +#searchText[keepfocus], +#searchText:focus { + border-color: hsla(216,100%,60%,.6) hsla(216,76%,52%,.6) hsla(214,100%,40%,.6); +} + +#searchSubmit { + margin-inline-start: -1px; + padding: 0; + border: 1px solid; + background-color: #e0e0e0; + color: black; + border-color: hsla(220,54%,20%,.15) hsla(220,54%,20%,.17) hsla(220,54%,20%,.2); + border-radius: 0 2px 2px 0; + box-shadow: 0 0 2px hsla(0,0%,100%,.5) inset, + 0 1px 0 hsla(0,0%,100%,.2); + cursor: pointer; + transition-property: background-color, border-color, box-shadow; + transition-duration: 150ms; + width: 50px; +} + +#searchSubmit:dir(rtl) { + border-radius: 2px 0 0 2px; +} + +#searchSubmit:hover { + background-color: hsl(220,54%,20%); + color: white; +} + +#searchText:focus + #searchSubmit, +#searchText + #searchSubmit:hover { + border-color: #5985fc #4573e7 #3264d5; +} + +#searchText:focus + #searchSubmit, +#searchText[keepfocus] + #searchSubmit { + box-shadow: 0 1px 0 hsla(0,0%,100%,.2) inset, + 0 0 0 1px hsla(0,0%,100%,.1) inset, + 0 1px 0 hsla(220,54%,20%,.03); +} + +#searchText + #searchSubmit:hover { + box-shadow: 0 1px 0 hsla(0,0%,100%,.2) inset, + 0 0 0 1px hsla(0,0%,100%,.1) inset, + 0 1px 0 hsla(220,54%,20%,.03), + 0 0 4px hsla(216,100%,20%,.2); +} + +#searchText + #searchSubmit:hover:active { + box-shadow: 0 1px 1px hsla(221,79%,6%,.1) inset, + 0 0 1px hsla(221,79%,6%,.2) inset; + transition-duration: 0ms; +} + +.contentSearchSuggestionTable { + font: message-box; + font-size: 16px; +} diff --git a/webbrowser/components/newtab/newTab.js b/webbrowser/components/newtab/newTab.js new file mode 100644 index 0000000..0022f21 --- /dev/null +++ b/webbrowser/components/newtab/newTab.js @@ -0,0 +1,69 @@ +/* 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"; + +var Cu = Components.utils; +var Ci = Components.interfaces; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/PageThumbs.jsm"); +Cu.import("resource://gre/modules/BackgroundPageThumbs.jsm"); +Cu.import("resource://gre/modules/NewTabUtils.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "Rect", + "resource://gre/modules/Geometry.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", + "resource://gre/modules/PrivateBrowsingUtils.jsm"); + +var { + links: gLinks, + allPages: gAllPages, + linkChecker: gLinkChecker, + pinnedLinks: gPinnedLinks, + blockedLinks: gBlockedLinks, + gridPrefs: gGridPrefs +} = NewTabUtils; + +XPCOMUtils.defineLazyGetter(this, "gStringBundle", function() { + return Services.strings. + createBundle("chrome://browser/locale/newTab.properties"); +}); + +function newTabString(name, args) { + let stringName = "newtab." + name; + if (!args) { + return gStringBundle.GetStringFromName(stringName); + } + return gStringBundle.formatStringFromName(stringName, args, args.length); +} + +function inPrivateBrowsingMode() { + return PrivateBrowsingUtils.isContentWindowPrivate(window); +} + +const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml"; +const XUL_NAMESPACE = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; + +const TILES_EXPLAIN_LINK = "https://support.mozilla.org/kb/how-do-tiles-work-firefox"; +const TILES_INTRO_LINK = "https://www.mozilla.org/firefox/tiles/"; +const TILES_PRIVACY_LINK = "https://www.mozilla.org/privacy/"; + +#include transformations.js +#include page.js +#include grid.js +#include cells.js +#include sites.js +#include drag.js +#include dragDataHelper.js +#include drop.js +#include dropTargetShim.js +#include dropPreview.js +#include updater.js +#include undo.js +#include search.js + +// Everything is loaded. Initialize the New Tab Page. +gPage.init(); diff --git a/webbrowser/components/newtab/newTab.xhtml b/webbrowser/components/newtab/newTab.xhtml new file mode 100644 index 0000000..de000e7 --- /dev/null +++ b/webbrowser/components/newtab/newTab.xhtml @@ -0,0 +1,61 @@ + + + + + + %newTabDTD; + + %browserDTD; + + %globalDTD; +]> + + + + &newtab.pageTitle; + + + + + + + +
+
+ +
+
+ + + +
+
+ +
+
+
+ + +
+
+ +
+
+
+ +
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + diff --git a/webbrowser/components/places/content/editBookmarkOverlay.js b/webbrowser/components/places/content/editBookmarkOverlay.js new file mode 100644 index 0000000..69d7d32 --- /dev/null +++ b/webbrowser/components/places/content/editBookmarkOverlay.js @@ -0,0 +1,1063 @@ +/* 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/. */ + +const LAST_USED_ANNO = "bookmarkPropertiesDialog/folderLastUsed"; +const MAX_FOLDER_ITEM_IN_MENU_LIST = 5; + +var gEditItemOverlay = { + _uri: null, + _itemId: -1, + _itemIds: [], + _uris: [], + _tags: [], + _allTags: [], + _keyword: null, + _multiEdit: false, + _itemType: -1, + _readOnly: false, + _hiddenRows: [], + _onPanelReady: false, + _observersAdded: false, + _staticFoldersListBuilt: false, + _initialized: false, + _titleOverride: "", + + // the first field which was edited after this panel was initialized for + // a certain item + _firstEditedField: "", + + get itemId() { + return this._itemId; + }, + + get uri() { + return this._uri; + }, + + get multiEdit() { + return this._multiEdit; + }, + + /** + * Determines the initial data for the item edited or added by this dialog + */ + _determineInfo: function EIO__determineInfo(aInfo) { + // hidden rows + if (aInfo && aInfo.hiddenRows) + this._hiddenRows = aInfo.hiddenRows; + else + this._hiddenRows.splice(0, this._hiddenRows.length); + // force-read-only + this._readOnly = aInfo && aInfo.forceReadOnly; + this._titleOverride = aInfo && aInfo.titleOverride ? aInfo.titleOverride + : ""; + this._onPanelReady = aInfo && aInfo.onPanelReady; + }, + + _showHideRows: function EIO__showHideRows() { + var isBookmark = this._itemId != -1 && + this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK; + var isQuery = false; + if (this._uri) + isQuery = this._uri.schemeIs("place"); + + this._element("nameRow").collapsed = this._hiddenRows.indexOf("name") != -1; + this._element("folderRow").collapsed = + this._hiddenRows.indexOf("folderPicker") != -1 || this._readOnly; + this._element("tagsRow").collapsed = !this._uri || + this._hiddenRows.indexOf("tags") != -1 || isQuery; + // Collapse the tag selector if the item does not accept tags. + if (!this._element("tagsSelectorRow").collapsed && + this._element("tagsRow").collapsed) + this.toggleTagsSelector(); + this._element("descriptionRow").collapsed = + this._hiddenRows.indexOf("description") != -1 || this._readOnly; + this._element("keywordRow").collapsed = !isBookmark || this._readOnly || + this._hiddenRows.indexOf("keyword") != -1 || isQuery; + this._element("locationRow").collapsed = !(this._uri && !isQuery) || + this._hiddenRows.indexOf("location") != -1; + this._element("loadInSidebarCheckbox").collapsed = !isBookmark || isQuery || + this._readOnly || this._hiddenRows.indexOf("loadInSidebar") != -1; + this._element("feedLocationRow").collapsed = !this._isLivemark || + this._hiddenRows.indexOf("feedLocation") != -1; + this._element("siteLocationRow").collapsed = !this._isLivemark || + this._hiddenRows.indexOf("siteLocation") != -1; + this._element("selectionCount").hidden = !this._multiEdit; + }, + + /** + * Initialize the panel + * @param aFor + * Either a places-itemId (of a bookmark, folder or a live bookmark), + * an array of itemIds (used for bulk tagging), or a URI object (in + * which case, the panel would be initialized in read-only mode). + * @param [optional] aInfo + * JS object which stores additional info for the panel + * initialization. The following properties may bet set: + * * hiddenRows (Strings array): list of rows to be hidden regardless + * of the item edited. Possible values: "title", "location", + * "description", "keyword", "loadInSidebar", "feedLocation", + * "siteLocation", folderPicker" + * * forceReadOnly - set this flag to initialize the panel to its + * read-only (view) mode even if the given item is editable. + */ + initPanel: function EIO_initPanel(aFor, aInfo) { + // For sanity ensure that the implementer has uninited the panel before + // trying to init it again, or we could end up leaking due to observers. + if (this._initialized) + this.uninitPanel(false); + + var aItemIdList; + if (Array.isArray(aFor)) { + aItemIdList = aFor; + aFor = aItemIdList[0]; + } + else if (this._multiEdit) { + this._multiEdit = false; + this._tags = []; + this._uris = []; + this._allTags = []; + this._itemIds = []; + this._element("selectionCount").hidden = true; + } + + this._folderMenuList = this._element("folderMenuList"); + this._folderTree = this._element("folderTree"); + + this._determineInfo(aInfo); + if (aFor instanceof Ci.nsIURI) { + this._itemId = -1; + this._uri = aFor; + this._readOnly = true; + } + else { + this._itemId = aFor; + // We can't store information on invalid itemIds. + this._readOnly = this._readOnly || this._itemId == -1; + + var containerId = PlacesUtils.bookmarks.getFolderIdForItem(this._itemId); + this._itemType = PlacesUtils.bookmarks.getItemType(this._itemId); + if (this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK) { + this._uri = PlacesUtils.bookmarks.getBookmarkURI(this._itemId); + this._keyword = PlacesUtils.bookmarks.getKeywordForBookmark(this._itemId); + this._initTextField("keywordField", this._keyword); + this._element("loadInSidebarCheckbox").checked = + PlacesUtils.annotations.itemHasAnnotation(this._itemId, + PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO); + } + else { + this._uri = null; + this._isLivemark = false; + PlacesUtils.livemarks.getLivemark({id: this._itemId }) + .then(aLivemark => { + this._isLivemark = true; + this._initTextField("feedLocationField", aLivemark.feedURI.spec, true); + this._initTextField("siteLocationField", aLivemark.siteURI ? aLivemark.siteURI.spec : "", true); + this._showHideRows(); + }, () => undefined); + } + + // folder picker + this._initFolderMenuList(containerId); + + // description field + this._initTextField("descriptionField", + PlacesUIUtils.getItemDescription(this._itemId)); + } + + if (this._itemId == -1 || + this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK) { + this._isLivemark = false; + + this._initTextField("locationField", this._uri.spec); + if (!aItemIdList) { + var tags = PlacesUtils.tagging.getTagsForURI(this._uri).join(", "); + this._initTextField("tagsField", tags, false); + } + else { + this._multiEdit = true; + this._allTags = []; + this._itemIds = aItemIdList; + for (var i = 0; i < aItemIdList.length; i++) { + if (aItemIdList[i] instanceof Ci.nsIURI) { + this._uris[i] = aItemIdList[i]; + this._itemIds[i] = -1; + } + else + this._uris[i] = PlacesUtils.bookmarks.getBookmarkURI(this._itemIds[i]); + this._tags[i] = PlacesUtils.tagging.getTagsForURI(this._uris[i]); + } + this._allTags = this._getCommonTags(); + this._initTextField("tagsField", this._allTags.join(", "), false); + this._element("itemsCountText").value = + PlacesUIUtils.getPluralString("detailsPane.itemsCountLabel", + this._itemIds.length, + [this._itemIds.length]); + } + + // tags selector + this._rebuildTagsSelectorList(); + } + + // name picker + this._initNamePicker(); + + this._showHideRows(); + + // observe changes + if (!this._observersAdded) { + // Single bookmarks observe any change. History entries and multiEdit + // observe only tags changes, through bookmarks. + if (this._itemId != -1 || this._uri || this._multiEdit) + PlacesUtils.bookmarks.addObserver(this, false); + + this._element("namePicker").addEventListener("blur", this); + this._element("locationField").addEventListener("blur", this); + this._element("tagsField").addEventListener("blur", this); + this._element("keywordField").addEventListener("blur", this); + this._element("descriptionField").addEventListener("blur", this); + window.addEventListener("unload", this, false); + this._observersAdded = true; + } + + let focusElement = () => { + this._initialized = true; + }; + + if (this._onPanelReady) { + this._onPanelReady(focusElement); + } else { + focusElement(); + } + }, + + /** + * Finds tags that are in common among this._tags entries that track tags + * for each selected uri. + * The tags arrays should be kept up-to-date for this to work properly. + * + * @return array of common tags for the selected uris. + */ + _getCommonTags: function() { + return this._tags[0].filter( + function (aTag) this._tags.every( + function (aTags) aTags.indexOf(aTag) != -1 + ), this + ); + }, + + _initTextField: function(aTextFieldId, aValue, aReadOnly) { + var field = this._element(aTextFieldId); + field.readOnly = aReadOnly !== undefined ? aReadOnly : this._readOnly; + + if (field.value != aValue) { + field.value = aValue; + this._editorTransactionManagerClear(field); + } + }, + + /** + * Appends a menu-item representing a bookmarks folder to a menu-popup. + * @param aMenupopup + * The popup to which the menu-item should be added. + * @param aFolderId + * The identifier of the bookmarks folder. + * @return the new menu item. + */ + _appendFolderItemToMenupopup: + function EIO__appendFolderItemToMenuList(aMenupopup, aFolderId) { + // First make sure the folders-separator is visible + this._element("foldersSeparator").hidden = false; + + var folderMenuItem = document.createElement("menuitem"); + var folderTitle = PlacesUtils.bookmarks.getItemTitle(aFolderId) + folderMenuItem.folderId = aFolderId; + folderMenuItem.setAttribute("label", folderTitle); + folderMenuItem.className = "menuitem-iconic folder-icon"; + aMenupopup.appendChild(folderMenuItem); + return folderMenuItem; + }, + + _initFolderMenuList: function EIO__initFolderMenuList(aSelectedFolder) { + // clean up first + var menupopup = this._folderMenuList.menupopup; + while (menupopup.childNodes.length > 6) + menupopup.removeChild(menupopup.lastChild); + + const bms = PlacesUtils.bookmarks; + const annos = PlacesUtils.annotations; + + // Build the static list + var unfiledItem = this._element("unfiledRootItem"); + if (!this._staticFoldersListBuilt) { + unfiledItem.label = bms.getItemTitle(PlacesUtils.unfiledBookmarksFolderId); + unfiledItem.folderId = PlacesUtils.unfiledBookmarksFolderId; + var bmMenuItem = this._element("bmRootItem"); + bmMenuItem.label = bms.getItemTitle(PlacesUtils.bookmarksMenuFolderId); + bmMenuItem.folderId = PlacesUtils.bookmarksMenuFolderId; + var toolbarItem = this._element("toolbarFolderItem"); + toolbarItem.label = bms.getItemTitle(PlacesUtils.toolbarFolderId); + toolbarItem.folderId = PlacesUtils.toolbarFolderId; + this._staticFoldersListBuilt = true; + } + + // List of recently used folders: + var folderIds = annos.getItemsWithAnnotation(LAST_USED_ANNO); + + /** + * The value of the LAST_USED_ANNO annotation is the time (in the form of + * Date.getTime) at which the folder has been last used. + * + * First we build the annotated folders array, each item has both the + * folder identifier and the time at which it was last-used by this dialog + * set. Then we sort it descendingly based on the time field. + */ + this._recentFolders = []; + for (var i = 0; i < folderIds.length; i++) { + var lastUsed = annos.getItemAnnotation(folderIds[i], LAST_USED_ANNO); + this._recentFolders.push({ folderId: folderIds[i], lastUsed: lastUsed }); + } + this._recentFolders.sort(function(a, b) { + if (b.lastUsed < a.lastUsed) + return -1; + if (b.lastUsed > a.lastUsed) + return 1; + return 0; + }); + + var numberOfItems = Math.min(MAX_FOLDER_ITEM_IN_MENU_LIST, + this._recentFolders.length); + for (var i = 0; i < numberOfItems; i++) { + this._appendFolderItemToMenupopup(menupopup, + this._recentFolders[i].folderId); + } + + var defaultItem = this._getFolderMenuItem(aSelectedFolder); + this._folderMenuList.selectedItem = defaultItem; + + // Set a selectedIndex attribute to show special icons + this._folderMenuList.setAttribute("selectedIndex", + this._folderMenuList.selectedIndex); + + // Hide the folders-separator if no folder is annotated as recently-used + this._element("foldersSeparator").hidden = (menupopup.childNodes.length <= 6); + this._folderMenuList.disabled = this._readOnly; + }, + + QueryInterface: function EIO_QueryInterface(aIID) { + if (aIID.equals(Ci.nsIDOMEventListener) || + aIID.equals(Ci.nsINavBookmarkObserver) || + aIID.equals(Ci.nsISupports)) + return this; + + throw Cr.NS_ERROR_NO_INTERFACE; + }, + + _element: function EIO__element(aID) { + return document.getElementById("editBMPanel_" + aID); + }, + + _editorTransactionManagerClear: function EIO__editorTransactionManagerClear(aItem) { + // Clear the editor's undo stack + let transactionManager; + try { + transactionManager = aItem.editor.transactionManager; + } catch (e) { + // When retrieving the transaction manager, editor may be null resulting + // in a TypeError. Additionally, the transaction manager may not + // exist yet, which causes access to it to throw NS_ERROR_FAILURE. + // In either event, the transaction manager doesn't exist it, so we + // don't need to worry about clearing it. + if (!(e instanceof TypeError) && e.result != Cr.NS_ERROR_FAILURE) { + throw e; + } + } + if (transactionManager) { + transactionManager.clear(); + } + }, + + _getItemStaticTitle: function EIO__getItemStaticTitle() { + if (this._titleOverride) + return this._titleOverride; + + let title = ""; + if (this._itemId == -1) { + title = PlacesUtils.history.getPageTitle(this._uri); + } + else { + title = PlacesUtils.bookmarks.getItemTitle(this._itemId); + } + return title; + }, + + _initNamePicker: function EIO_initNamePicker() { + var namePicker = this._element("namePicker"); + namePicker.value = this._getItemStaticTitle(); + namePicker.readOnly = this._readOnly; + this._editorTransactionManagerClear(namePicker); + }, + + uninitPanel: function EIO_uninitPanel(aHideCollapsibleElements) { + if (aHideCollapsibleElements) { + // hide the folder tree if it was previously visible + var folderTreeRow = this._element("folderTreeRow"); + if (!folderTreeRow.collapsed) + this.toggleFolderTreeVisibility(); + + // hide the tag selector if it was previously visible + var tagsSelectorRow = this._element("tagsSelectorRow"); + if (!tagsSelectorRow.collapsed) + this.toggleTagsSelector(); + } + + if (this._observersAdded) { + if (this._itemId != -1 || this._uri || this._multiEdit) + PlacesUtils.bookmarks.removeObserver(this); + + this._element("namePicker").removeEventListener("blur", this); + this._element("locationField").removeEventListener("blur", this); + this._element("tagsField").removeEventListener("blur", this); + this._element("keywordField").removeEventListener("blur", this); + this._element("descriptionField").removeEventListener("blur", this); + + this._observersAdded = false; + } + + this._itemId = -1; + this._uri = null; + this._uris = []; + this._tags = []; + this._allTags = []; + this._itemIds = []; + this._multiEdit = false; + this._firstEditedField = ""; + this._initialized = false; + this._titleOverride = ""; + this._readOnly = false; + }, + + onTagsFieldBlur: function EIO_onTagsFieldBlur() { + if (this._updateTags()) // if anything has changed + this._mayUpdateFirstEditField("tagsField"); + }, + + _updateTags: function EIO__updateTags() { + if (this._multiEdit) + return this._updateMultipleTagsForItems(); + return this._updateSingleTagForItem(); + }, + + _updateSingleTagForItem: function EIO__updateSingleTagForItem() { + var currentTags = PlacesUtils.tagging.getTagsForURI(this._uri); + var tags = this._getTagsArrayFromTagField(); + if (tags.length > 0 || currentTags.length > 0) { + var tagsToRemove = []; + var tagsToAdd = []; + var txns = []; + for (var i = 0; i < currentTags.length; i++) { + if (tags.indexOf(currentTags[i]) == -1) + tagsToRemove.push(currentTags[i]); + } + for (var i = 0; i < tags.length; i++) { + if (currentTags.indexOf(tags[i]) == -1) + tagsToAdd.push(tags[i]); + } + + if (tagsToRemove.length > 0) { + let untagTxn = new PlacesUntagURITransaction(this._uri, tagsToRemove); + txns.push(untagTxn); + } + if (tagsToAdd.length > 0) { + let tagTxn = new PlacesTagURITransaction(this._uri, tagsToAdd); + txns.push(tagTxn); + } + + if (txns.length > 0) { + let aggregate = new PlacesAggregatedTransaction("Update tags", txns); + PlacesUtils.transactionManager.doTransaction(aggregate); + + // Ensure the tagsField is in sync, clean it up from empty tags + var tags = PlacesUtils.tagging.getTagsForURI(this._uri).join(", "); + this._initTextField("tagsField", tags, false); + return true; + } + } + return false; + }, + + /** + * Stores the first-edit field for this dialog, if the passed-in field + * is indeed the first edited field + * @param aNewField + * the id of the field that may be set (without the "editBMPanel_" + * prefix) + */ + _mayUpdateFirstEditField: function EIO__mayUpdateFirstEditField(aNewField) { + // * The first-edit-field behavior is not applied in the multi-edit case + // * if this._firstEditedField is already set, this is not the first field, + // so there's nothing to do + if (this._multiEdit || this._firstEditedField) + return; + + this._firstEditedField = aNewField; + + // set the pref + var prefs = Cc["@mozilla.org/preferences-service;1"]. + getService(Ci.nsIPrefBranch); + prefs.setCharPref("browser.bookmarks.editDialog.firstEditField", aNewField); + }, + + _updateMultipleTagsForItems: function EIO__updateMultipleTagsForItems() { + var tags = this._getTagsArrayFromTagField(); + if (tags.length > 0 || this._allTags.length > 0) { + var tagsToRemove = []; + var tagsToAdd = []; + var txns = []; + for (var i = 0; i < this._allTags.length; i++) { + if (tags.indexOf(this._allTags[i]) == -1) + tagsToRemove.push(this._allTags[i]); + } + for (var i = 0; i < this._tags.length; i++) { + tagsToAdd[i] = []; + for (var j = 0; j < tags.length; j++) { + if (this._tags[i].indexOf(tags[j]) == -1) + tagsToAdd[i].push(tags[j]); + } + } + + if (tagsToAdd.length > 0) { + for (let i = 0; i < this._uris.length; i++) { + if (tagsToAdd[i].length > 0) { + let tagTxn = new PlacesTagURITransaction(this._uris[i], + tagsToAdd[i]); + txns.push(tagTxn); + } + } + } + if (tagsToRemove.length > 0) { + for (let i = 0; i < this._uris.length; i++) { + let untagTxn = new PlacesUntagURITransaction(this._uris[i], + tagsToRemove); + txns.push(untagTxn); + } + } + + if (txns.length > 0) { + let aggregate = new PlacesAggregatedTransaction("Update tags", txns); + PlacesUtils.transactionManager.doTransaction(aggregate); + + this._allTags = tags; + this._tags = []; + for (let i = 0; i < this._uris.length; i++) { + this._tags[i] = PlacesUtils.tagging.getTagsForURI(this._uris[i]); + } + + // Ensure the tagsField is in sync, clean it up from empty tags + this._initTextField("tagsField", tags, false); + return true; + } + } + return false; + }, + + onNamePickerBlur: function EIO_onNamePickerBlur() { + if (this._itemId == -1) + return; + + var namePicker = this._element("namePicker") + + // Here we update either the item title or its cached static title + var newTitle = namePicker.value; + if (!newTitle && + PlacesUtils.bookmarks.getFolderIdForItem(this._itemId) == PlacesUtils.tagsFolderId) { + // We don't allow setting an empty title for a tag, restore the old one. + this._initNamePicker(); + } + else if (this._getItemStaticTitle() != newTitle) { + this._mayUpdateFirstEditField("namePicker"); + let txn = new PlacesEditItemTitleTransaction(this._itemId, newTitle); + PlacesUtils.transactionManager.doTransaction(txn); + } + }, + + onDescriptionFieldBlur: function EIO_onDescriptionFieldBlur() { + var description = this._element("descriptionField").value; + if (description != PlacesUIUtils.getItemDescription(this._itemId)) { + var annoObj = { name : PlacesUIUtils.DESCRIPTION_ANNO, + type : Ci.nsIAnnotationService.TYPE_STRING, + flags : 0, + value : description, + expires: Ci.nsIAnnotationService.EXPIRE_NEVER }; + var txn = new PlacesSetItemAnnotationTransaction(this._itemId, annoObj); + PlacesUtils.transactionManager.doTransaction(txn); + } + }, + + onLocationFieldBlur: function EIO_onLocationFieldBlur() { + var uri; + try { + uri = PlacesUIUtils.createFixedURI(this._element("locationField").value); + } + catch(ex) { return; } + + if (!this._uri.equals(uri)) { + var txn = new PlacesEditBookmarkURITransaction(this._itemId, uri); + PlacesUtils.transactionManager.doTransaction(txn); + this._uri = uri; + } + }, + + onKeywordFieldBlur: function EIO_onKeywordFieldBlur() { + let oldKeyword = this._keyword; + let keyword = this._keyword = this._element("keywordField").value; + if (keyword != oldKeyword) { + let txn = new PlacesEditBookmarkKeywordTransaction(this._itemId, + keyword, + null, + oldKeyword); + PlacesUtils.transactionManager.doTransaction(txn); + } + }, + + onLoadInSidebarCheckboxCommand: + function EIO_onLoadInSidebarCheckboxCommand() { + let annoObj = { name : PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO }; + if (this._element("loadInSidebarCheckbox").checked) + annoObj.value = true; + let txn = new PlacesSetItemAnnotationTransaction(this._itemId, annoObj); + PlacesUtils.transactionManager.doTransaction(txn); + }, + + toggleFolderTreeVisibility: function EIO_toggleFolderTreeVisibility() { + var expander = this._element("foldersExpander"); + var folderTreeRow = this._element("folderTreeRow"); + if (!folderTreeRow.collapsed) { + expander.className = "expander-down"; + expander.setAttribute("tooltiptext", + expander.getAttribute("tooltiptextdown")); + folderTreeRow.collapsed = true; + this._element("chooseFolderSeparator").hidden = + this._element("chooseFolderMenuItem").hidden = false; + } + else { + expander.className = "expander-up" + expander.setAttribute("tooltiptext", + expander.getAttribute("tooltiptextup")); + folderTreeRow.collapsed = false; + + // XXXmano: Ideally we would only do this once, but for some odd reason, + // the editable mode set on this tree, together with its collapsed state + // breaks the view. + const FOLDER_TREE_PLACE_URI = + "place:excludeItems=1&excludeQueries=1&excludeReadOnlyFolders=1&folder=" + + PlacesUIUtils.allBookmarksFolderId; + this._folderTree.place = FOLDER_TREE_PLACE_URI; + + this._element("chooseFolderSeparator").hidden = + this._element("chooseFolderMenuItem").hidden = true; + var currentFolder = this._getFolderIdFromMenuList(); + this._folderTree.selectItems([currentFolder]); + this._folderTree.focus(); + } + }, + + _getFolderIdFromMenuList: + function EIO__getFolderIdFromMenuList() { + var selectedItem = this._folderMenuList.selectedItem; + NS_ASSERT("folderId" in selectedItem, + "Invalid menuitem in the folders-menulist"); + return selectedItem.folderId; + }, + + /** + * Get the corresponding menu-item in the folder-menu-list for a bookmarks + * folder if such an item exists. Otherwise, this creates a menu-item for the + * folder. If the items-count limit (see MAX_FOLDERS_IN_MENU_LIST) is reached, + * the new item replaces the last menu-item. + * @param aFolderId + * The identifier of the bookmarks folder. + */ + _getFolderMenuItem: + function EIO__getFolderMenuItem(aFolderId) { + var menupopup = this._folderMenuList.menupopup; + + for (let i = 0; i < menupopup.childNodes.length; i++) { + if ("folderId" in menupopup.childNodes[i] && + menupopup.childNodes[i].folderId == aFolderId) + return menupopup.childNodes[i]; + } + + // 3 special folders + separator + folder-items-count limit + if (menupopup.childNodes.length == 4 + MAX_FOLDER_ITEM_IN_MENU_LIST) + menupopup.removeChild(menupopup.lastChild); + + return this._appendFolderItemToMenupopup(menupopup, aFolderId); + }, + + onFolderMenuListCommand: function EIO_onFolderMenuListCommand(aEvent) { + // Set a selectedIndex attribute to show special icons + this._folderMenuList.setAttribute("selectedIndex", + this._folderMenuList.selectedIndex); + + if (aEvent.target.id == "editBMPanel_chooseFolderMenuItem") { + // reset the selection back to where it was and expand the tree + // (this menu-item is hidden when the tree is already visible + var container = PlacesUtils.bookmarks.getFolderIdForItem(this._itemId); + var item = this._getFolderMenuItem(container); + this._folderMenuList.selectedItem = item; + // XXXmano HACK: setTimeout 100, otherwise focus goes back to the + // menulist right away + setTimeout(function(self) self.toggleFolderTreeVisibility(), 100, this); + return; + } + + // Move the item + var container = this._getFolderIdFromMenuList(); + if (PlacesUtils.bookmarks.getFolderIdForItem(this._itemId) != container) { + var txn = new PlacesMoveItemTransaction(this._itemId, + container, + PlacesUtils.bookmarks.DEFAULT_INDEX); + PlacesUtils.transactionManager.doTransaction(txn); + + // Mark the containing folder as recently-used if it isn't in the + // static list + if (container != PlacesUtils.unfiledBookmarksFolderId && + container != PlacesUtils.toolbarFolderId && + container != PlacesUtils.bookmarksMenuFolderId) + this._markFolderAsRecentlyUsed(container); + } + + // Update folder-tree selection + var folderTreeRow = this._element("folderTreeRow"); + if (!folderTreeRow.collapsed) { + var selectedNode = this._folderTree.selectedNode; + if (!selectedNode || + PlacesUtils.getConcreteItemId(selectedNode) != container) + this._folderTree.selectItems([container]); + } + }, + + onFolderTreeSelect: function EIO_onFolderTreeSelect() { + var selectedNode = this._folderTree.selectedNode; + + // Disable the "New Folder" button if we cannot create a new folder + this._element("newFolderButton") + .disabled = !this._folderTree.insertionPoint || !selectedNode; + + if (!selectedNode) + return; + + var folderId = PlacesUtils.getConcreteItemId(selectedNode); + if (this._getFolderIdFromMenuList() == folderId) + return; + + var folderItem = this._getFolderMenuItem(folderId); + this._folderMenuList.selectedItem = folderItem; + folderItem.doCommand(); + }, + + _markFolderAsRecentlyUsed: + function EIO__markFolderAsRecentlyUsed(aFolderId) { + var txns = []; + + // Expire old unused recent folders + var anno = this._getLastUsedAnnotationObject(false); + while (this._recentFolders.length > MAX_FOLDER_ITEM_IN_MENU_LIST) { + var folderId = this._recentFolders.pop().folderId; + let annoTxn = new PlacesSetItemAnnotationTransaction(folderId, anno); + txns.push(annoTxn); + } + + // Mark folder as recently used + anno = this._getLastUsedAnnotationObject(true); + let annoTxn = new PlacesSetItemAnnotationTransaction(aFolderId, anno); + txns.push(annoTxn); + + let aggregate = new PlacesAggregatedTransaction("Update last used folders", txns); + PlacesUtils.transactionManager.doTransaction(aggregate); + }, + + /** + * Returns an object which could then be used to set/unset the + * LAST_USED_ANNO annotation for a folder. + * + * @param aLastUsed + * Whether to set or unset the LAST_USED_ANNO annotation. + * @returns an object representing the annotation which could then be used + * with the transaction manager. + */ + _getLastUsedAnnotationObject: + function EIO__getLastUsedAnnotationObject(aLastUsed) { + var anno = { name: LAST_USED_ANNO, + type: Ci.nsIAnnotationService.TYPE_INT32, + flags: 0, + value: aLastUsed ? new Date().getTime() : null, + expires: Ci.nsIAnnotationService.EXPIRE_NEVER }; + + return anno; + }, + + _rebuildTagsSelectorList: function EIO__rebuildTagsSelectorList() { + var tagsSelector = this._element("tagsSelector"); + var tagsSelectorRow = this._element("tagsSelectorRow"); + if (tagsSelectorRow.collapsed) + return; + + // Save the current scroll position and restore it after the rebuild. + let firstIndex = tagsSelector.getIndexOfFirstVisibleRow(); + let selectedIndex = tagsSelector.selectedIndex; + let selectedTag = selectedIndex >= 0 ? tagsSelector.selectedItem.label + : null; + + while (tagsSelector.hasChildNodes()) + tagsSelector.removeChild(tagsSelector.lastChild); + + var tagsInField = this._getTagsArrayFromTagField(); + var allTags = PlacesUtils.tagging.allTags; + for (var i = 0; i < allTags.length; i++) { + var tag = allTags[i]; + var elt = document.createElement("listitem"); + elt.setAttribute("type", "checkbox"); + elt.setAttribute("label", tag); + if (tagsInField.indexOf(tag) != -1) + elt.setAttribute("checked", "true"); + tagsSelector.appendChild(elt); + if (selectedTag === tag) + selectedIndex = tagsSelector.getIndexOfItem(elt); + } + + // Restore position. + // The listbox allows to scroll only if the required offset doesn't + // overflow its capacity, thus need to adjust the index for removals. + firstIndex = + Math.min(firstIndex, + tagsSelector.itemCount - tagsSelector.getNumberOfVisibleRows()); + tagsSelector.scrollToIndex(firstIndex); + if (selectedIndex >= 0 && tagsSelector.itemCount > 0) { + selectedIndex = Math.min(selectedIndex, tagsSelector.itemCount - 1); + tagsSelector.selectedIndex = selectedIndex; + tagsSelector.ensureIndexIsVisible(selectedIndex); + } + }, + + toggleTagsSelector: function EIO_toggleTagsSelector() { + var tagsSelector = this._element("tagsSelector"); + var tagsSelectorRow = this._element("tagsSelectorRow"); + var expander = this._element("tagsSelectorExpander"); + if (tagsSelectorRow.collapsed) { + expander.className = "expander-up"; + expander.setAttribute("tooltiptext", + expander.getAttribute("tooltiptextup")); + tagsSelectorRow.collapsed = false; + this._rebuildTagsSelectorList(); + + // This is a no-op if we've added the listener. + tagsSelector.addEventListener("CheckboxStateChange", this, false); + } + else { + expander.className = "expander-down"; + expander.setAttribute("tooltiptext", + expander.getAttribute("tooltiptextdown")); + tagsSelectorRow.collapsed = true; + } + }, + + /** + * Splits "tagsField" element value, returning an array of valid tag strings. + * + * @return Array of tag strings found in the field value. + */ + _getTagsArrayFromTagField: function EIO__getTagsArrayFromTagField() { + let tags = this._element("tagsField").value; + return tags.trim() + .split(/\s*,\s*/) // Split on commas and remove spaces. + .filter(function (tag) tag.length > 0); // Kill empty tags. + }, + + newFolder: function EIO_newFolder() { + var ip = this._folderTree.insertionPoint; + + // default to the bookmarks menu folder + if (!ip || ip.itemId == PlacesUIUtils.allBookmarksFolderId) { + ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId, + PlacesUtils.bookmarks.DEFAULT_INDEX, + Ci.nsITreeView.DROP_ON); + } + + // XXXmano: add a separate "New Folder" string at some point... + var defaultLabel = this._element("newFolderButton").label; + var txn = new PlacesCreateFolderTransaction(defaultLabel, ip.itemId, ip.index); + PlacesUtils.transactionManager.doTransaction(txn); + this._folderTree.focus(); + this._folderTree.selectItems([this._lastNewItem]); + this._folderTree.startEditing(this._folderTree.view.selection.currentIndex, + this._folderTree.columns.getFirstColumn()); + }, + + // nsIDOMEventListener + handleEvent: function EIO_nsIDOMEventListener(aEvent) { + switch (aEvent.type) { + case "CheckboxStateChange": + // Update the tags field when items are checked/unchecked in the listbox + var tags = this._getTagsArrayFromTagField(); + + if (aEvent.target.checked) { + if (tags.indexOf(aEvent.target.label) == -1) + tags.push(aEvent.target.label); + } + else { + var indexOfItem = tags.indexOf(aEvent.target.label); + if (indexOfItem != -1) + tags.splice(indexOfItem, 1); + } + this._element("tagsField").value = tags.join(", "); + this._updateTags(); + break; + case "blur": + let replaceFn = (str, firstLetter) => firstLetter.toUpperCase(); + let nodeName = aEvent.target.id.replace(/editBMPanel_(\w)/, replaceFn); + this["on" + nodeName + "Blur"](); + break; + case "unload": + this.uninitPanel(false); + break; + } + }, + + // nsINavBookmarkObserver + onItemChanged: function EIO_onItemChanged(aItemId, aProperty, + aIsAnnotationProperty, aValue, + aLastModified, aItemType) { + if (aProperty == "tags") { + // Tags case is special, since they should be updated if either: + // - the notification is for the edited bookmark + // - the notification is for the edited history entry + // - the notification is for one of edited uris + let shouldUpdateTagsField = this._itemId == aItemId; + if (this._itemId == -1 || this._multiEdit) { + // Check if the changed uri is part of the modified ones. + let changedURI = PlacesUtils.bookmarks.getBookmarkURI(aItemId); + let uris = this._multiEdit ? this._uris : [this._uri]; + uris.forEach(function (aURI, aIndex) { + if (aURI.equals(changedURI)) { + shouldUpdateTagsField = true; + if (this._multiEdit) { + this._tags[aIndex] = PlacesUtils.tagging.getTagsForURI(this._uris[aIndex]); + } + } + }, this); + } + + if (shouldUpdateTagsField) { + if (this._multiEdit) { + this._allTags = this._getCommonTags(); + this._initTextField("tagsField", this._allTags.join(", "), false); + } + else { + let tags = PlacesUtils.tagging.getTagsForURI(this._uri).join(", "); + this._initTextField("tagsField", tags, false); + } + } + + // Any tags change should be reflected in the tags selector. + this._rebuildTagsSelectorList(); + return; + } + + if (this._itemId != aItemId) { + if (aProperty == "title") { + // If the title of a folder which is listed within the folders + // menulist has been changed, we need to update the label of its + // representing element. + var menupopup = this._folderMenuList.menupopup; + for (let i = 0; i < menupopup.childNodes.length; i++) { + if ("folderId" in menupopup.childNodes[i] && + menupopup.childNodes[i].folderId == aItemId) { + menupopup.childNodes[i].label = aValue; + break; + } + } + } + + return; + } + + switch (aProperty) { + case "title": + var namePicker = this._element("namePicker"); + if (namePicker.value != aValue) { + namePicker.value = aValue; + this._editorTransactionManagerClear(namePicker); + } + break; + case "uri": + var locationField = this._element("locationField"); + if (locationField.value != aValue) { + this._uri = Cc["@mozilla.org/network/io-service;1"]. + getService(Ci.nsIIOService). + newURI(aValue, null, null); + this._initTextField("locationField", this._uri.spec); + this._initNamePicker(); + this._initTextField("tagsField", + PlacesUtils.tagging + .getTagsForURI(this._uri).join(", "), + false); + this._rebuildTagsSelectorList(); + } + break; + case "keyword": + this._keyword = PlacesUtils.bookmarks.getKeywordForBookmark(this._itemId); + this._initTextField("keywordField", this._keyword); + break; + case PlacesUIUtils.DESCRIPTION_ANNO: + this._initTextField("descriptionField", + PlacesUIUtils.getItemDescription(this._itemId)); + break; + case PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO: + this._element("loadInSidebarCheckbox").checked = + PlacesUtils.annotations.itemHasAnnotation(this._itemId, + PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO); + break; + case PlacesUtils.LMANNO_FEEDURI: + let feedURISpec = + PlacesUtils.annotations.getItemAnnotation(this._itemId, + PlacesUtils.LMANNO_FEEDURI); + this._initTextField("feedLocationField", feedURISpec, true); + break; + case PlacesUtils.LMANNO_SITEURI: + let siteURISpec = ""; + try { + siteURISpec = + PlacesUtils.annotations.getItemAnnotation(this._itemId, + PlacesUtils.LMANNO_SITEURI); + } catch (ex) {} + this._initTextField("siteLocationField", siteURISpec, true); + break; + } + }, + + onItemMoved: function EIO_onItemMoved(aItemId, aOldParent, aOldIndex, + aNewParent, aNewIndex, aItemType) { + if (aItemId != this._itemId || + aNewParent == this._getFolderIdFromMenuList()) + return; + + var folderItem = this._getFolderMenuItem(aNewParent); + + // just setting selectItem _does not_ trigger oncommand, so we don't + // recurse + this._folderMenuList.selectedItem = folderItem; + }, + + onItemAdded: function EIO_onItemAdded(aItemId, aParentId, aIndex, aItemType, + aURI) { + this._lastNewItem = aItemId; + }, + + onItemRemoved: function() { }, + onBeginUpdateBatch: function() { }, + onEndUpdateBatch: function() { }, + onItemVisited: function() { }, +}; diff --git a/webbrowser/components/places/content/editBookmarkOverlay.xul b/webbrowser/components/places/content/editBookmarkOverlay.xul new file mode 100644 index 0000000..196369d --- /dev/null +++ b/webbrowser/components/places/content/editBookmarkOverlay.xul @@ -0,0 +1,228 @@ + + + +%editBookmarkOverlayDTD; +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

&privatebrowsingpage.howToStop3;

+

&privatebrowsingpage.howToStart3;

+
+ + +
+

+ &privatebrowsingpage.moreInfo; +

+ +
+
+
+ + + diff --git a/webbrowser/components/privatebrowsing/jar.mn b/webbrowser/components/privatebrowsing/jar.mn new file mode 100644 index 0000000..75e985c --- /dev/null +++ b/webbrowser/components/privatebrowsing/jar.mn @@ -0,0 +1,6 @@ +# 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/. + +browser.jar: +* content/browser/aboutPrivateBrowsing.xhtml (content/aboutPrivateBrowsing.xhtml) diff --git a/webbrowser/components/privatebrowsing/moz.build b/webbrowser/components/privatebrowsing/moz.build new file mode 100644 index 0000000..c97072b --- /dev/null +++ b/webbrowser/components/privatebrowsing/moz.build @@ -0,0 +1,7 @@ +# -*- Mode: python; c-basic-offset: 4; 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/. + +JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/webbrowser/components/search/content/engineManager.js b/webbrowser/components/search/content/engineManager.js new file mode 100644 index 0000000..993d48b --- /dev/null +++ b/webbrowser/components/search/content/engineManager.js @@ -0,0 +1,492 @@ +/* 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/. */ + +Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); +Components.utils.import("resource://gre/modules/Services.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", + "resource://gre/modules/PlacesUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "Task", + "resource://gre/modules/Task.jsm"); + +const Ci = Components.interfaces; +const Cc = Components.classes; + +const ENGINE_FLAVOR = "text/x-moz-search-engine"; + +const BROWSER_SUGGEST_PREF = "browser.search.suggest.enabled"; + +var gEngineView = null; + +var gEngineManagerDialog = { + init: function engineManager_init() { + gEngineView = new EngineView(new EngineStore()); + + var suggestEnabled = Services.prefs.getBoolPref(BROWSER_SUGGEST_PREF); + document.getElementById("enableSuggest").checked = suggestEnabled; + + var tree = document.getElementById("engineList"); + tree.view = gEngineView; + + Services.obs.addObserver(this, "browser-search-engine-modified", false); + }, + + destroy: function engineManager_destroy() { + // Remove the observer + Services.obs.removeObserver(this, "browser-search-engine-modified"); + }, + + observe: function engineManager_observe(aEngine, aTopic, aVerb) { + if (aTopic == "browser-search-engine-modified") { + aEngine.QueryInterface(Ci.nsISearchEngine); + switch (aVerb) { + case "engine-added": + gEngineView._engineStore.addEngine(aEngine); + gEngineView.rowCountChanged(gEngineView.lastIndex, 1); + break; + case "engine-changed": + gEngineView._engineStore.reloadIcons(); + gEngineView.invalidate(); + break; + case "engine-removed": + case "engine-current": + case "engine-default": + // Not relevant + break; + } + } + }, + + onOK: function engineManager_onOK() { + // Set the preference + var newSuggestEnabled = document.getElementById("enableSuggest").checked; + Services.prefs.setBoolPref(BROWSER_SUGGEST_PREF, newSuggestEnabled); + + // Commit the changes + gEngineView._engineStore.commit(); + }, + + onRestoreDefaults: function engineManager_onRestoreDefaults() { + var num = gEngineView._engineStore.restoreDefaultEngines(); + gEngineView.rowCountChanged(0, num); + gEngineView.invalidate(); + }, + + showRestoreDefaults: function engineManager_showRestoreDefaults(val) { + document.documentElement.getButton("extra2").disabled = !val; + }, + + loadAddEngines: function engineManager_loadAddEngines() { + this.onOK(); + window.opener.BrowserSearch.loadAddEngines(); + window.close(); + }, + + remove: function engineManager_remove() { + gEngineView._engineStore.removeEngine(gEngineView.selectedEngine); + var index = gEngineView.selectedIndex; + gEngineView.rowCountChanged(index, -1); + gEngineView.invalidate(); + gEngineView.selection.select(Math.min(index, gEngineView.lastIndex)); + gEngineView.ensureRowIsVisible(gEngineView.currentIndex); + document.getElementById("engineList").focus(); + }, + + /** + * Moves the selected engine either up or down in the engine list + * @param aDir + * -1 to move the selected engine down, +1 to move it up. + */ + bump: function engineManager_move(aDir) { + var selectedEngine = gEngineView.selectedEngine; + var newIndex = gEngineView.selectedIndex - aDir; + + gEngineView._engineStore.moveEngine(selectedEngine, newIndex); + + gEngineView.invalidate(); + gEngineView.selection.select(newIndex); + gEngineView.ensureRowIsVisible(newIndex); + this.showRestoreDefaults(true); + document.getElementById("engineList").focus(); + }, + + editKeyword: Task.async(function* engineManager_editKeyword() { + var selectedEngine = gEngineView.selectedEngine; + if (!selectedEngine) + return; + + var alias = { value: selectedEngine.alias }; + var strings = document.getElementById("engineManagerBundle"); + var title = strings.getString("editTitle"); + var msg = strings.getFormattedString("editMsg", [selectedEngine.name]); + + while (Services.prompt.prompt(window, title, msg, alias, null, {})) { + var bduplicate = false; + var eduplicate = false; + var dupName = ""; + + if (alias.value != "") { + // Check for duplicates in Places keywords. + bduplicate = !!(yield PlacesUtils.keywords.fetch(alias.value)); + + // Check for duplicates in changes we haven't committed yet + let engines = gEngineView._engineStore.engines; + for each (let engine in engines) { + if (engine.alias == alias.value && + engine.name != selectedEngine.name) { + eduplicate = true; + dupName = engine.name; + break; + } + } + } + + // Notify the user if they have chosen an existing engine/bookmark keyword + if (eduplicate || bduplicate) { + var dtitle = strings.getString("duplicateTitle"); + var bmsg = strings.getString("duplicateBookmarkMsg"); + var emsg = strings.getFormattedString("duplicateEngineMsg", [dupName]); + + Services.prompt.alert(window, dtitle, eduplicate ? emsg : bmsg); + } else { + gEngineView._engineStore.changeEngine(selectedEngine, "alias", + alias.value); + gEngineView.invalidate(); + break; + } + } + }), + + onSelect: function engineManager_onSelect() { + // Buttons only work if an engine is selected and it's not the last engine, + // the latter is true when the selected is first and last at the same time. + var lastSelected = (gEngineView.selectedIndex == gEngineView.lastIndex); + var firstSelected = (gEngineView.selectedIndex == 0); + var noSelection = (gEngineView.selectedIndex == -1); + + document.getElementById("cmd_remove") + .setAttribute("disabled", noSelection || + (firstSelected && lastSelected)); + + document.getElementById("cmd_moveup") + .setAttribute("disabled", noSelection || firstSelected); + + document.getElementById("cmd_movedown") + .setAttribute("disabled", noSelection || lastSelected); + + document.getElementById("cmd_editkeyword") + .setAttribute("disabled", noSelection); + } +}; + +function onDragEngineStart(event) { + var selectedIndex = gEngineView.selectedIndex; + if (selectedIndex >= 0) { + event.dataTransfer.setData(ENGINE_FLAVOR, selectedIndex.toString()); + event.dataTransfer.effectAllowed = "move"; + } +} + +// "Operation" objects +function EngineMoveOp(aEngineClone, aNewIndex) { + if (!aEngineClone) + throw new Error("bad args to new EngineMoveOp!"); + this._engine = aEngineClone.originalEngine; + this._newIndex = aNewIndex; +} +EngineMoveOp.prototype = { + _engine: null, + _newIndex: null, + commit: function EMO_commit() { + Services.search.moveEngine(this._engine, this._newIndex); + } +} + +function EngineRemoveOp(aEngineClone) { + if (!aEngineClone) + throw new Error("bad args to new EngineRemoveOp!"); + this._engine = aEngineClone.originalEngine; +} +EngineRemoveOp.prototype = { + _engine: null, + commit: function ERO_commit() { + Services.search.removeEngine(this._engine); + } +} + +function EngineUnhideOp(aEngineClone, aNewIndex) { + if (!aEngineClone) + throw new Error("bad args to new EngineUnhideOp!"); + this._engine = aEngineClone.originalEngine; + this._newIndex = aNewIndex; +} +EngineUnhideOp.prototype = { + _engine: null, + _newIndex: null, + commit: function EUO_commit() { + this._engine.hidden = false; + Services.search.moveEngine(this._engine, this._newIndex); + } +} + +function EngineChangeOp(aEngineClone, aProp, aValue) { + if (!aEngineClone) + throw new Error("bad args to new EngineChangeOp!"); + + this._engine = aEngineClone.originalEngine; + this._prop = aProp; + this._newValue = aValue; +} +EngineChangeOp.prototype = { + _engine: null, + _prop: null, + _newValue: null, + commit: function ECO_commit() { + this._engine[this._prop] = this._newValue; + } +} + +function EngineStore() { + this._engines = Services.search.getVisibleEngines().map(this._cloneEngine); + this._defaultEngines = Services.search.getDefaultEngines().map(this._cloneEngine); + + this._ops = []; + + // check if we need to disable the restore defaults button + var someHidden = this._defaultEngines.some(function (e) e.hidden); + gEngineManagerDialog.showRestoreDefaults(someHidden); +} +EngineStore.prototype = { + _engines: null, + _defaultEngines: null, + _ops: null, + + get engines() { + return this._engines; + }, + set engines(val) { + this._engines = val; + return val; + }, + + _getIndexForEngine: function ES_getIndexForEngine(aEngine) { + return this._engines.indexOf(aEngine); + }, + + _getEngineByName: function ES_getEngineByName(aName) { + for each (var engine in this._engines) + if (engine.name == aName) + return engine; + + return null; + }, + + _cloneEngine: function ES_cloneEngine(aEngine) { + var clonedObj={}; + for (var i in aEngine) + clonedObj[i] = aEngine[i]; + clonedObj.originalEngine = aEngine; + return clonedObj; + }, + + // Callback for Array's some(). A thisObj must be passed to some() + _isSameEngine: function ES_isSameEngine(aEngineClone) { + return aEngineClone.originalEngine == this.originalEngine; + }, + + commit: function ES_commit() { + var currentEngine = this._cloneEngine(Services.search.currentEngine); + for (var i = 0; i < this._ops.length; i++) + this._ops[i].commit(); + + // Restore currentEngine if it is a default engine that is still visible. + // Needed if the user deletes currentEngine and then restores it. + if (this._defaultEngines.some(this._isSameEngine, currentEngine) && + !currentEngine.originalEngine.hidden) + Services.search.currentEngine = currentEngine.originalEngine; + }, + + addEngine: function ES_addEngine(aEngine) { + this._engines.push(this._cloneEngine(aEngine)); + }, + + moveEngine: function ES_moveEngine(aEngine, aNewIndex) { + if (aNewIndex < 0 || aNewIndex > this._engines.length - 1) + throw new Error("ES_moveEngine: invalid aNewIndex!"); + var index = this._getIndexForEngine(aEngine); + if (index == -1) + throw new Error("ES_moveEngine: invalid engine?"); + + if (index == aNewIndex) + return; // nothing to do + + // Move the engine in our internal store + var removedEngine = this._engines.splice(index, 1)[0]; + this._engines.splice(aNewIndex, 0, removedEngine); + + this._ops.push(new EngineMoveOp(aEngine, aNewIndex)); + }, + + removeEngine: function ES_removeEngine(aEngine) { + var index = this._getIndexForEngine(aEngine); + if (index == -1) + throw new Error("invalid engine?"); + + this._engines.splice(index, 1); + this._ops.push(new EngineRemoveOp(aEngine)); + if (this._defaultEngines.some(this._isSameEngine, aEngine)) + gEngineManagerDialog.showRestoreDefaults(true); + }, + + restoreDefaultEngines: function ES_restoreDefaultEngines() { + var added = 0; + + for (var i = 0; i < this._defaultEngines.length; ++i) { + var e = this._defaultEngines[i]; + + // If the engine is already in the list, just move it. + if (this._engines.some(this._isSameEngine, e)) { + this.moveEngine(this._getEngineByName(e.name), i); + } else { + // Otherwise, add it back to our internal store + this._engines.splice(i, 0, e); + this._ops.push(new EngineUnhideOp(e, i)); + added++; + } + } + gEngineManagerDialog.showRestoreDefaults(false); + return added; + }, + + changeEngine: function ES_changeEngine(aEngine, aProp, aNewValue) { + var index = this._getIndexForEngine(aEngine); + if (index == -1) + throw new Error("invalid engine?"); + + this._engines[index][aProp] = aNewValue; + this._ops.push(new EngineChangeOp(aEngine, aProp, aNewValue)); + }, + + reloadIcons: function ES_reloadIcons() { + this._engines.forEach(function (e) { + e.uri = e.originalEngine.uri; + }); + } +} + +function EngineView(aEngineStore) { + this._engineStore = aEngineStore; +} +EngineView.prototype = { + _engineStore: null, + tree: null, + + get lastIndex() { + return this.rowCount - 1; + }, + get selectedIndex() { + var seln = this.selection; + if (seln.getRangeCount() > 0) { + var min = {}; + seln.getRangeAt(0, min, {}); + return min.value; + } + return -1; + }, + get selectedEngine() { + return this._engineStore.engines[this.selectedIndex]; + }, + + // Helpers + rowCountChanged: function (index, count) { + this.tree.rowCountChanged(index, count); + }, + + invalidate: function () { + this.tree.invalidate(); + }, + + ensureRowIsVisible: function (index) { + this.tree.ensureRowIsVisible(index); + }, + + getSourceIndexFromDrag: function (dataTransfer) { + return parseInt(dataTransfer.getData(ENGINE_FLAVOR)); + }, + + // nsITreeView + get rowCount() { + return this._engineStore.engines.length; + }, + + getImageSrc: function(index, column) { + if (column.id == "engineName" && this._engineStore.engines[index].iconURI) + return this._engineStore.engines[index].iconURI.spec; + return ""; + }, + + getCellText: function(index, column) { + if (column.id == "engineName") + return this._engineStore.engines[index].name; + else if (column.id == "engineKeyword") + return this._engineStore.engines[index].alias; + return ""; + }, + + setTree: function(tree) { + this.tree = tree; + }, + + canDrop: function(targetIndex, orientation, dataTransfer) { + var sourceIndex = this.getSourceIndexFromDrag(dataTransfer); + return (sourceIndex != -1 && + sourceIndex != targetIndex && + sourceIndex != targetIndex + orientation); + }, + + drop: function(dropIndex, orientation, dataTransfer) { + var sourceIndex = this.getSourceIndexFromDrag(dataTransfer); + var sourceEngine = this._engineStore.engines[sourceIndex]; + + if (dropIndex > sourceIndex) { + if (orientation == Ci.nsITreeView.DROP_BEFORE) + dropIndex--; + } else { + if (orientation == Ci.nsITreeView.DROP_AFTER) + dropIndex++; + } + + this._engineStore.moveEngine(sourceEngine, dropIndex); + gEngineManagerDialog.showRestoreDefaults(true); + + // Redraw, and adjust selection + this.invalidate(); + this.selection.select(dropIndex); + }, + + selection: null, + getRowProperties: function(index) { return ""; }, + getCellProperties: function(index, column) { return ""; }, + getColumnProperties: function(column) { return ""; }, + isContainer: function(index) { return false; }, + isContainerOpen: function(index) { return false; }, + isContainerEmpty: function(index) { return false; }, + isSeparator: function(index) { return false; }, + isSorted: function(index) { return false; }, + getParentIndex: function(index) { return -1; }, + hasNextSibling: function(parentIndex, index) { return false; }, + getLevel: function(index) { return 0; }, + getProgressMode: function(index, column) { }, + getCellValue: function(index, column) { }, + toggleOpenState: function(index) { }, + cycleHeader: function(column) { }, + selectionChanged: function() { }, + cycleCell: function(row, column) { }, + isEditable: function(index, column) { return false; }, + isSelectable: function(index, column) { return false; }, + setCellValue: function(index, column, value) { }, + setCellText: function(index, column, value) { }, + performAction: function(action) { }, + performActionOnRow: function(action, index) { }, + performActionOnCell: function(action, index, column) { } +}; diff --git a/webbrowser/components/search/content/engineManager.xul b/webbrowser/components/search/content/engineManager.xul new file mode 100644 index 0000000..1152ef8 --- /dev/null +++ b/webbrowser/components/search/content/engineManager.xul @@ -0,0 +1,93 @@ + + + + + + + + + + +