From a1be17c1cea81ebb1e8b131a662c698d78f3f7f2 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 4 Jun 2018 13:17:38 +0200 Subject: Issue #303 Part 1: Move basilisk files from /browser to /application/basilisk --- application/basilisk/base/.eslintrc.js | 11 + .../base/content/aboutDialog-appUpdater.js | 428 + application/basilisk/base/content/aboutDialog.css | 97 + application/basilisk/base/content/aboutDialog.js | 91 + application/basilisk/base/content/aboutDialog.xul | 157 + .../basilisk/base/content/aboutNetError.xhtml | 699 ++ .../basilisk/base/content/aboutRobots-icon.png | Bin 0 -> 9817 bytes .../base/content/aboutRobots-widget-left.png | Bin 0 -> 2224 bytes .../basilisk/base/content/aboutRobots.xhtml | 108 + .../basilisk/base/content/aboutTabCrashed.css | 11 + .../basilisk/base/content/aboutTabCrashed.js | 309 + .../basilisk/base/content/aboutTabCrashed.xhtml | 97 + .../base/content/aboutaccounts/aboutaccounts.css | 24 + .../base/content/aboutaccounts/aboutaccounts.js | 543 ++ .../base/content/aboutaccounts/aboutaccounts.xhtml | 112 + .../base/content/aboutaccounts/images/fox.png | Bin 0 -> 1951 bytes .../aboutaccounts/images/graphic_sync_intro.png | Bin 0 -> 6441 bytes .../aboutaccounts/images/graphic_sync_intro@2x.png | Bin 0 -> 12852 bytes .../basilisk/base/content/aboutaccounts/main.css | 166 + .../base/content/aboutaccounts/normalize.css | 402 + .../base/content/abouthealthreport/abouthealth.css | 15 + .../base/content/abouthealthreport/abouthealth.js | 180 + .../content/abouthealthreport/abouthealth.xhtml | 31 + .../basilisk/base/content/abouthome/aboutHome.css | 397 + .../basilisk/base/content/abouthome/aboutHome.js | 118 + .../base/content/abouthome/aboutHome.xhtml | 68 + .../basilisk/base/content/abouthome/addons.png | Bin 0 -> 1444 bytes .../basilisk/base/content/abouthome/addons@2x.png | Bin 0 -> 3783 bytes .../basilisk/base/content/abouthome/bookmarks.png | Bin 0 -> 1276 bytes .../base/content/abouthome/bookmarks@2x.png | Bin 0 -> 2946 bytes .../basilisk/base/content/abouthome/downloads.png | Bin 0 -> 898 bytes .../base/content/abouthome/downloads@2x.png | Bin 0 -> 2018 bytes .../basilisk/base/content/abouthome/history.png | Bin 0 -> 1654 bytes .../basilisk/base/content/abouthome/history@2x.png | Bin 0 -> 4629 bytes .../basilisk/base/content/abouthome/mozilla.png | Bin 0 -> 2684 bytes .../basilisk/base/content/abouthome/mozilla@2x.png | Bin 0 -> 5647 bytes .../base/content/abouthome/restore-large.png | Bin 0 -> 2841 bytes .../base/content/abouthome/restore-large@2x.png | Bin 0 -> 7267 bytes .../basilisk/base/content/abouthome/restore.png | Bin 0 -> 1796 bytes .../basilisk/base/content/abouthome/restore@2x.png | Bin 0 -> 4810 bytes .../basilisk/base/content/abouthome/settings.png | Bin 0 -> 1557 bytes .../base/content/abouthome/settings@2x.png | Bin 0 -> 3836 bytes .../basilisk/base/content/abouthome/snippet1.png | Bin 0 -> 1470 bytes .../base/content/abouthome/snippet1@2x.png | Bin 0 -> 3243 bytes .../basilisk/base/content/abouthome/snippet2.png | Bin 0 -> 3287 bytes .../base/content/abouthome/snippet2@2x.png | Bin 0 -> 11027 bytes .../basilisk/base/content/abouthome/sync.png | Bin 0 -> 1879 bytes .../basilisk/base/content/abouthome/sync@2x.png | Bin 0 -> 4615 bytes .../basilisk/base/content/baseMenuOverlay.xul | 114 + .../basilisk/base/content/blockedSite.xhtml | 196 + .../basilisk/base/content/browser-addons.js | 742 ++ .../basilisk/base/content/browser-captivePortal.js | 257 + .../basilisk/base/content/browser-charsetmenu.inc | 12 + .../basilisk/base/content/browser-context.inc | 454 ++ .../basilisk/base/content/browser-ctrlTab.js | 587 ++ .../basilisk/base/content/browser-customization.js | 100 + .../content/browser-data-submission-info-bar.js | 127 + .../basilisk/base/content/browser-devedition.js | 142 + .../basilisk/base/content/browser-doctype.inc | 25 + application/basilisk/base/content/browser-feeds.js | 646 ++ .../content/browser-fullScreenAndPointerLock.js | 673 ++ .../basilisk/base/content/browser-fullZoom.js | 526 ++ .../basilisk/base/content/browser-fxaccounts.js | 459 ++ .../base/content/browser-gestureSupport.js | 1244 +++ application/basilisk/base/content/browser-media.js | 354 + .../basilisk/base/content/browser-menubar.inc | 521 ++ .../basilisk/base/content/browser-places.js | 2024 +++++ .../basilisk/base/content/browser-plugins.js | 516 ++ .../base/content/browser-refreshblocker.js | 84 + .../basilisk/base/content/browser-safebrowsing.js | 48 + application/basilisk/base/content/browser-sets.inc | 379 + .../basilisk/base/content/browser-sidebar.js | 337 + .../basilisk/base/content/browser-syncui.js | 548 ++ .../basilisk/base/content/browser-tabPreviews.xml | 37 + .../base/content/browser-tabsintitlebar-stub.js | 17 + .../base/content/browser-tabsintitlebar.js | 307 + .../basilisk/base/content/browser-thumbnails.js | 142 + .../base/content/browser-trackingprotection.js | 177 + application/basilisk/base/content/browser.css | 1173 +++ application/basilisk/base/content/browser.js | 8177 ++++++++++++++++++++ application/basilisk/base/content/browser.xul | 1070 +++ .../basilisk/base/content/browserMountPoints.inc | 12 + application/basilisk/base/content/content.js | 1473 ++++ .../basilisk/base/content/contentSearchUI.css | 161 + .../basilisk/base/content/contentSearchUI.js | 915 +++ .../base/content/defaultthemes/1.footer.jpg | Bin 0 -> 151200 bytes .../base/content/defaultthemes/1.header.jpg | Bin 0 -> 266398 bytes .../basilisk/base/content/defaultthemes/1.icon.jpg | Bin 0 -> 1093 bytes .../base/content/defaultthemes/1.preview.jpg | Bin 0 -> 7953 bytes .../base/content/defaultthemes/2.footer.jpg | Bin 0 -> 81134 bytes .../base/content/defaultthemes/2.header.jpg | Bin 0 -> 173983 bytes .../basilisk/base/content/defaultthemes/2.icon.jpg | Bin 0 -> 509 bytes .../base/content/defaultthemes/2.preview.jpg | Bin 0 -> 2877 bytes .../base/content/defaultthemes/3.footer.png | Bin 0 -> 180454 bytes .../base/content/defaultthemes/3.header.png | Bin 0 -> 293504 bytes .../basilisk/base/content/defaultthemes/3.icon.png | Bin 0 -> 896 bytes .../base/content/defaultthemes/3.preview.png | Bin 0 -> 56585 bytes .../base/content/defaultthemes/4.footer.png | Bin 0 -> 384076 bytes .../base/content/defaultthemes/4.header.png | Bin 0 -> 769368 bytes .../basilisk/base/content/defaultthemes/4.icon.png | Bin 0 -> 731 bytes .../base/content/defaultthemes/4.preview.png | Bin 0 -> 95328 bytes .../base/content/defaultthemes/5.footer.png | Bin 0 -> 9760 bytes .../base/content/defaultthemes/5.header.png | Bin 0 -> 9760 bytes .../basilisk/base/content/defaultthemes/5.icon.jpg | Bin 0 -> 267 bytes .../base/content/defaultthemes/5.preview.jpg | Bin 0 -> 2837 bytes .../content/defaultthemes/devedition.header.png | Bin 0 -> 95 bytes .../base/content/defaultthemes/devedition.icon.png | Bin 0 -> 2402 bytes .../content/docs/sslerrorreport/dataformat.rst | 54 + .../base/content/docs/sslerrorreport/index.rst | 15 + .../content/docs/sslerrorreport/preferences.rst | 23 + .../base/content/downloadManagerOverlay.xul | 32 + application/basilisk/base/content/gcli_sec_bad.svg | 7 + .../basilisk/base/content/gcli_sec_good.svg | 4 + .../basilisk/base/content/gcli_sec_moderate.svg | 4 + .../basilisk/base/content/global-scripts.inc | 39 + application/basilisk/base/content/hiddenWindow.xul | 20 + .../basilisk/base/content/jsConsoleOverlay.xul | 18 + .../basilisk/base/content/macBrowserOverlay.xul | 66 + .../content/newtab/alternativeDefaultSites.json | 50 + application/basilisk/base/content/newtab/cells.js | 126 + .../basilisk/base/content/newtab/customize.js | 124 + application/basilisk/base/content/newtab/drag.js | 151 + .../basilisk/base/content/newtab/dragDataHelper.js | 22 + application/basilisk/base/content/newtab/drop.js | 150 + .../basilisk/base/content/newtab/dropPreview.js | 222 + .../basilisk/base/content/newtab/dropTargetShim.js | 232 + application/basilisk/base/content/newtab/grid.js | 279 + .../basilisk/base/content/newtab/newTab.css | 654 ++ .../base/content/newtab/newTab.inadjacent.json | 3209 ++++++++ application/basilisk/base/content/newtab/newTab.js | 71 + .../basilisk/base/content/newtab/newTab.xhtml | 89 + application/basilisk/base/content/newtab/page.js | 297 + application/basilisk/base/content/newtab/search.js | 15 + application/basilisk/base/content/newtab/sites.js | 440 ++ .../base/content/newtab/transformations.js | 270 + application/basilisk/base/content/newtab/undo.js | 116 + .../basilisk/base/content/newtab/updater.js | 177 + application/basilisk/base/content/nsContextMenu.js | 1851 +++++ .../base/content/overrides/app-license.html | 7 + .../basilisk/base/content/pageinfo/feeds.js | 32 + .../basilisk/base/content/pageinfo/feeds.xml | 40 + .../basilisk/base/content/pageinfo/pageInfo.css | 26 + .../basilisk/base/content/pageinfo/pageInfo.js | 1140 +++ .../basilisk/base/content/pageinfo/pageInfo.xml | 20 + .../basilisk/base/content/pageinfo/pageInfo.xul | 438 ++ .../basilisk/base/content/pageinfo/permissions.js | 334 + .../basilisk/base/content/pageinfo/security.js | 388 + .../basilisk/base/content/popup-notifications.inc | 81 + .../base/content/report-phishing-overlay.xul | 35 + application/basilisk/base/content/safeMode.css | 8 + application/basilisk/base/content/safeMode.js | 82 + application/basilisk/base/content/safeMode.xul | 51 + application/basilisk/base/content/sanitize.js | 910 +++ application/basilisk/base/content/sanitize.xul | 183 + .../basilisk/base/content/sanitizeDialog.css | 23 + .../basilisk/base/content/sanitizeDialog.js | 889 +++ .../base/content/softwareUpdateOverlay.xul | 18 + .../base/content/sync/aboutSyncTabs-bindings.xml | 46 + .../basilisk/base/content/sync/aboutSyncTabs.css | 11 + .../basilisk/base/content/sync/aboutSyncTabs.js | 364 + .../basilisk/base/content/sync/aboutSyncTabs.xul | 68 + .../basilisk/base/content/sync/addDevice.js | 157 + .../basilisk/base/content/sync/addDevice.xul | 129 + .../basilisk/base/content/sync/customize.css | 28 + .../basilisk/base/content/sync/customize.js | 25 + .../basilisk/base/content/sync/customize.xul | 62 + .../basilisk/base/content/sync/genericChange.js | 233 + .../basilisk/base/content/sync/genericChange.xul | 123 + application/basilisk/base/content/sync/key.xhtml | 54 + application/basilisk/base/content/sync/setup.js | 1060 +++ application/basilisk/base/content/sync/setup.xul | 490 ++ application/basilisk/base/content/sync/utils.js | 231 + application/basilisk/base/content/tab-content.js | 943 +++ .../basilisk/base/content/tab-shape.inc.svg | 11 + application/basilisk/base/content/tabbrowser.css | 98 + application/basilisk/base/content/tabbrowser.xml | 7389 ++++++++++++++++++ .../basilisk/base/content/urlbarBindings.xml | 2758 +++++++ application/basilisk/base/content/usercontext.svg | 23 + .../basilisk/base/content/utilityOverlay.js | 949 +++ .../basilisk/base/content/viewSourceOverlay.xul | 26 + application/basilisk/base/content/web-panels.js | 104 + application/basilisk/base/content/web-panels.xul | 70 + .../basilisk/base/content/webrtcIndicator.js | 194 + .../basilisk/base/content/webrtcIndicator.xul | 35 + application/basilisk/base/jar.mn | 193 + application/basilisk/base/moz.build | 22 + 186 files changed, 58268 insertions(+) create mode 100644 application/basilisk/base/.eslintrc.js create mode 100644 application/basilisk/base/content/aboutDialog-appUpdater.js create mode 100644 application/basilisk/base/content/aboutDialog.css create mode 100644 application/basilisk/base/content/aboutDialog.js create mode 100644 application/basilisk/base/content/aboutDialog.xul create mode 100644 application/basilisk/base/content/aboutNetError.xhtml create mode 100644 application/basilisk/base/content/aboutRobots-icon.png create mode 100644 application/basilisk/base/content/aboutRobots-widget-left.png create mode 100644 application/basilisk/base/content/aboutRobots.xhtml create mode 100644 application/basilisk/base/content/aboutTabCrashed.css create mode 100644 application/basilisk/base/content/aboutTabCrashed.js create mode 100644 application/basilisk/base/content/aboutTabCrashed.xhtml create mode 100644 application/basilisk/base/content/aboutaccounts/aboutaccounts.css create mode 100644 application/basilisk/base/content/aboutaccounts/aboutaccounts.js create mode 100644 application/basilisk/base/content/aboutaccounts/aboutaccounts.xhtml create mode 100644 application/basilisk/base/content/aboutaccounts/images/fox.png create mode 100644 application/basilisk/base/content/aboutaccounts/images/graphic_sync_intro.png create mode 100644 application/basilisk/base/content/aboutaccounts/images/graphic_sync_intro@2x.png create mode 100644 application/basilisk/base/content/aboutaccounts/main.css create mode 100644 application/basilisk/base/content/aboutaccounts/normalize.css create mode 100644 application/basilisk/base/content/abouthealthreport/abouthealth.css create mode 100644 application/basilisk/base/content/abouthealthreport/abouthealth.js create mode 100644 application/basilisk/base/content/abouthealthreport/abouthealth.xhtml create mode 100644 application/basilisk/base/content/abouthome/aboutHome.css create mode 100644 application/basilisk/base/content/abouthome/aboutHome.js create mode 100644 application/basilisk/base/content/abouthome/aboutHome.xhtml create mode 100644 application/basilisk/base/content/abouthome/addons.png create mode 100644 application/basilisk/base/content/abouthome/addons@2x.png create mode 100644 application/basilisk/base/content/abouthome/bookmarks.png create mode 100644 application/basilisk/base/content/abouthome/bookmarks@2x.png create mode 100644 application/basilisk/base/content/abouthome/downloads.png create mode 100644 application/basilisk/base/content/abouthome/downloads@2x.png create mode 100644 application/basilisk/base/content/abouthome/history.png create mode 100644 application/basilisk/base/content/abouthome/history@2x.png create mode 100644 application/basilisk/base/content/abouthome/mozilla.png create mode 100644 application/basilisk/base/content/abouthome/mozilla@2x.png create mode 100644 application/basilisk/base/content/abouthome/restore-large.png create mode 100644 application/basilisk/base/content/abouthome/restore-large@2x.png create mode 100644 application/basilisk/base/content/abouthome/restore.png create mode 100644 application/basilisk/base/content/abouthome/restore@2x.png create mode 100644 application/basilisk/base/content/abouthome/settings.png create mode 100644 application/basilisk/base/content/abouthome/settings@2x.png create mode 100644 application/basilisk/base/content/abouthome/snippet1.png create mode 100644 application/basilisk/base/content/abouthome/snippet1@2x.png create mode 100644 application/basilisk/base/content/abouthome/snippet2.png create mode 100644 application/basilisk/base/content/abouthome/snippet2@2x.png create mode 100644 application/basilisk/base/content/abouthome/sync.png create mode 100644 application/basilisk/base/content/abouthome/sync@2x.png create mode 100644 application/basilisk/base/content/baseMenuOverlay.xul create mode 100644 application/basilisk/base/content/blockedSite.xhtml create mode 100644 application/basilisk/base/content/browser-addons.js create mode 100644 application/basilisk/base/content/browser-captivePortal.js create mode 100644 application/basilisk/base/content/browser-charsetmenu.inc create mode 100644 application/basilisk/base/content/browser-context.inc create mode 100644 application/basilisk/base/content/browser-ctrlTab.js create mode 100644 application/basilisk/base/content/browser-customization.js create mode 100644 application/basilisk/base/content/browser-data-submission-info-bar.js create mode 100644 application/basilisk/base/content/browser-devedition.js create mode 100644 application/basilisk/base/content/browser-doctype.inc create mode 100644 application/basilisk/base/content/browser-feeds.js create mode 100644 application/basilisk/base/content/browser-fullScreenAndPointerLock.js create mode 100644 application/basilisk/base/content/browser-fullZoom.js create mode 100644 application/basilisk/base/content/browser-fxaccounts.js create mode 100644 application/basilisk/base/content/browser-gestureSupport.js create mode 100644 application/basilisk/base/content/browser-media.js create mode 100644 application/basilisk/base/content/browser-menubar.inc create mode 100644 application/basilisk/base/content/browser-places.js create mode 100644 application/basilisk/base/content/browser-plugins.js create mode 100644 application/basilisk/base/content/browser-refreshblocker.js create mode 100644 application/basilisk/base/content/browser-safebrowsing.js create mode 100644 application/basilisk/base/content/browser-sets.inc create mode 100644 application/basilisk/base/content/browser-sidebar.js create mode 100644 application/basilisk/base/content/browser-syncui.js create mode 100644 application/basilisk/base/content/browser-tabPreviews.xml create mode 100644 application/basilisk/base/content/browser-tabsintitlebar-stub.js create mode 100644 application/basilisk/base/content/browser-tabsintitlebar.js create mode 100644 application/basilisk/base/content/browser-thumbnails.js create mode 100644 application/basilisk/base/content/browser-trackingprotection.js create mode 100644 application/basilisk/base/content/browser.css create mode 100644 application/basilisk/base/content/browser.js create mode 100644 application/basilisk/base/content/browser.xul create mode 100644 application/basilisk/base/content/browserMountPoints.inc create mode 100644 application/basilisk/base/content/content.js create mode 100644 application/basilisk/base/content/contentSearchUI.css create mode 100644 application/basilisk/base/content/contentSearchUI.js create mode 100644 application/basilisk/base/content/defaultthemes/1.footer.jpg create mode 100644 application/basilisk/base/content/defaultthemes/1.header.jpg create mode 100644 application/basilisk/base/content/defaultthemes/1.icon.jpg create mode 100644 application/basilisk/base/content/defaultthemes/1.preview.jpg create mode 100644 application/basilisk/base/content/defaultthemes/2.footer.jpg create mode 100644 application/basilisk/base/content/defaultthemes/2.header.jpg create mode 100644 application/basilisk/base/content/defaultthemes/2.icon.jpg create mode 100644 application/basilisk/base/content/defaultthemes/2.preview.jpg create mode 100644 application/basilisk/base/content/defaultthemes/3.footer.png create mode 100644 application/basilisk/base/content/defaultthemes/3.header.png create mode 100644 application/basilisk/base/content/defaultthemes/3.icon.png create mode 100644 application/basilisk/base/content/defaultthemes/3.preview.png create mode 100644 application/basilisk/base/content/defaultthemes/4.footer.png create mode 100644 application/basilisk/base/content/defaultthemes/4.header.png create mode 100644 application/basilisk/base/content/defaultthemes/4.icon.png create mode 100644 application/basilisk/base/content/defaultthemes/4.preview.png create mode 100644 application/basilisk/base/content/defaultthemes/5.footer.png create mode 100644 application/basilisk/base/content/defaultthemes/5.header.png create mode 100644 application/basilisk/base/content/defaultthemes/5.icon.jpg create mode 100644 application/basilisk/base/content/defaultthemes/5.preview.jpg create mode 100644 application/basilisk/base/content/defaultthemes/devedition.header.png create mode 100644 application/basilisk/base/content/defaultthemes/devedition.icon.png create mode 100644 application/basilisk/base/content/docs/sslerrorreport/dataformat.rst create mode 100644 application/basilisk/base/content/docs/sslerrorreport/index.rst create mode 100644 application/basilisk/base/content/docs/sslerrorreport/preferences.rst create mode 100644 application/basilisk/base/content/downloadManagerOverlay.xul create mode 100644 application/basilisk/base/content/gcli_sec_bad.svg create mode 100644 application/basilisk/base/content/gcli_sec_good.svg create mode 100644 application/basilisk/base/content/gcli_sec_moderate.svg create mode 100644 application/basilisk/base/content/global-scripts.inc create mode 100644 application/basilisk/base/content/hiddenWindow.xul create mode 100644 application/basilisk/base/content/jsConsoleOverlay.xul create mode 100644 application/basilisk/base/content/macBrowserOverlay.xul create mode 100644 application/basilisk/base/content/newtab/alternativeDefaultSites.json create mode 100644 application/basilisk/base/content/newtab/cells.js create mode 100644 application/basilisk/base/content/newtab/customize.js create mode 100644 application/basilisk/base/content/newtab/drag.js create mode 100644 application/basilisk/base/content/newtab/dragDataHelper.js create mode 100644 application/basilisk/base/content/newtab/drop.js create mode 100644 application/basilisk/base/content/newtab/dropPreview.js create mode 100644 application/basilisk/base/content/newtab/dropTargetShim.js create mode 100644 application/basilisk/base/content/newtab/grid.js create mode 100644 application/basilisk/base/content/newtab/newTab.css create mode 100644 application/basilisk/base/content/newtab/newTab.inadjacent.json create mode 100644 application/basilisk/base/content/newtab/newTab.js create mode 100644 application/basilisk/base/content/newtab/newTab.xhtml create mode 100644 application/basilisk/base/content/newtab/page.js create mode 100644 application/basilisk/base/content/newtab/search.js create mode 100644 application/basilisk/base/content/newtab/sites.js create mode 100644 application/basilisk/base/content/newtab/transformations.js create mode 100644 application/basilisk/base/content/newtab/undo.js create mode 100644 application/basilisk/base/content/newtab/updater.js create mode 100644 application/basilisk/base/content/nsContextMenu.js create mode 100644 application/basilisk/base/content/overrides/app-license.html create mode 100644 application/basilisk/base/content/pageinfo/feeds.js create mode 100644 application/basilisk/base/content/pageinfo/feeds.xml create mode 100644 application/basilisk/base/content/pageinfo/pageInfo.css create mode 100644 application/basilisk/base/content/pageinfo/pageInfo.js create mode 100644 application/basilisk/base/content/pageinfo/pageInfo.xml create mode 100644 application/basilisk/base/content/pageinfo/pageInfo.xul create mode 100644 application/basilisk/base/content/pageinfo/permissions.js create mode 100644 application/basilisk/base/content/pageinfo/security.js create mode 100644 application/basilisk/base/content/popup-notifications.inc create mode 100644 application/basilisk/base/content/report-phishing-overlay.xul create mode 100644 application/basilisk/base/content/safeMode.css create mode 100644 application/basilisk/base/content/safeMode.js create mode 100644 application/basilisk/base/content/safeMode.xul create mode 100644 application/basilisk/base/content/sanitize.js create mode 100644 application/basilisk/base/content/sanitize.xul create mode 100644 application/basilisk/base/content/sanitizeDialog.css create mode 100644 application/basilisk/base/content/sanitizeDialog.js create mode 100644 application/basilisk/base/content/softwareUpdateOverlay.xul create mode 100644 application/basilisk/base/content/sync/aboutSyncTabs-bindings.xml create mode 100644 application/basilisk/base/content/sync/aboutSyncTabs.css create mode 100644 application/basilisk/base/content/sync/aboutSyncTabs.js create mode 100644 application/basilisk/base/content/sync/aboutSyncTabs.xul create mode 100644 application/basilisk/base/content/sync/addDevice.js create mode 100644 application/basilisk/base/content/sync/addDevice.xul create mode 100644 application/basilisk/base/content/sync/customize.css create mode 100644 application/basilisk/base/content/sync/customize.js create mode 100644 application/basilisk/base/content/sync/customize.xul create mode 100644 application/basilisk/base/content/sync/genericChange.js create mode 100644 application/basilisk/base/content/sync/genericChange.xul create mode 100644 application/basilisk/base/content/sync/key.xhtml create mode 100644 application/basilisk/base/content/sync/setup.js create mode 100644 application/basilisk/base/content/sync/setup.xul create mode 100644 application/basilisk/base/content/sync/utils.js create mode 100644 application/basilisk/base/content/tab-content.js create mode 100644 application/basilisk/base/content/tab-shape.inc.svg create mode 100644 application/basilisk/base/content/tabbrowser.css create mode 100644 application/basilisk/base/content/tabbrowser.xml create mode 100644 application/basilisk/base/content/urlbarBindings.xml create mode 100644 application/basilisk/base/content/usercontext.svg create mode 100644 application/basilisk/base/content/utilityOverlay.js create mode 100644 application/basilisk/base/content/viewSourceOverlay.xul create mode 100644 application/basilisk/base/content/web-panels.js create mode 100644 application/basilisk/base/content/web-panels.xul create mode 100644 application/basilisk/base/content/webrtcIndicator.js create mode 100644 application/basilisk/base/content/webrtcIndicator.xul create mode 100644 application/basilisk/base/jar.mn create mode 100644 application/basilisk/base/moz.build (limited to 'application/basilisk/base') diff --git a/application/basilisk/base/.eslintrc.js b/application/basilisk/base/.eslintrc.js new file mode 100644 index 000000000..e6cf2032e --- /dev/null +++ b/application/basilisk/base/.eslintrc.js @@ -0,0 +1,11 @@ +"use strict"; + +module.exports = { + "rules": { + "no-unused-vars": ["error", { + "vars": "local", + "varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS", + "args": "none", + }] + } +}; diff --git a/application/basilisk/base/content/aboutDialog-appUpdater.js b/application/basilisk/base/content/aboutDialog-appUpdater.js new file mode 100644 index 000000000..4b4fc6618 --- /dev/null +++ b/application/basilisk/base/content/aboutDialog-appUpdater.js @@ -0,0 +1,428 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Note: this file is included in aboutDialog.xul if MOZ_UPDATER is defined. + +Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); +Components.utils.import("resource://gre/modules/DownloadUtils.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils", + "resource://gre/modules/UpdateUtils.jsm"); + +const PREF_APP_UPDATE_CANCELATIONS_OSX = "app.update.cancelations.osx"; +const PREF_APP_UPDATE_ELEVATE_NEVER = "app.update.elevate.never"; + +var gAppUpdater; + +function onUnload(aEvent) { + if (gAppUpdater.isChecking) + gAppUpdater.checker.stopChecking(Components.interfaces.nsIUpdateChecker.CURRENT_CHECK); + // Safe to call even when there isn't a download in progress. + gAppUpdater.removeDownloadListener(); + gAppUpdater = null; +} + + +function appUpdater() +{ + XPCOMUtils.defineLazyServiceGetter(this, "aus", + "@mozilla.org/updates/update-service;1", + "nsIApplicationUpdateService"); + XPCOMUtils.defineLazyServiceGetter(this, "checker", + "@mozilla.org/updates/update-checker;1", + "nsIUpdateChecker"); + XPCOMUtils.defineLazyServiceGetter(this, "um", + "@mozilla.org/updates/update-manager;1", + "nsIUpdateManager"); + + this.updateDeck = document.getElementById("updateDeck"); + + // Hide the update deck when the update window is already open and it's not + // already applied, to avoid syncing issues between them. Applied updates + // don't have any information to sync between the windows as they both just + // show the "Restart to continue"-type button. + if (Services.wm.getMostRecentWindow("Update:Wizard") && + !this.isApplied) { + this.updateDeck.hidden = true; + return; + } + + this.bundle = Services.strings. + createBundle("chrome://browser/locale/browser.properties"); + + let manualURL = Services.urlFormatter.formatURLPref("app.update.url.manual"); + let manualLink = document.getElementById("manualLink"); + manualLink.value = manualURL; + manualLink.href = manualURL; + document.getElementById("failedLink").href = manualURL; + + if (this.updateDisabledAndLocked) { + this.selectPanel("adminDisabled"); + return; + } + + if (this.isPending || this.isApplied) { + this.selectPanel("apply"); + return; + } + + if (this.aus.isOtherInstanceHandlingUpdates) { + this.selectPanel("otherInstanceHandlingUpdates"); + return; + } + + if (this.isDownloading) { + this.startDownload(); + // selectPanel("downloading") is called from setupDownloadingUI(). + return; + } + + // Honor the "Never check for updates" option by not only disabling background + // update checks, but also in the About dialog, by presenting a + // "Check for updates" button. + // If updates are found, the user is then asked if he wants to "Update to ". + if (!this.updateEnabled || + Services.prefs.prefHasUserValue(PREF_APP_UPDATE_ELEVATE_NEVER)) { + this.selectPanel("checkForUpdates"); + return; + } + + // That leaves the options + // "Check for updates, but let me choose whether to install them", and + // "Automatically install updates". + // In both cases, we check for updates without asking. + // In the "let me choose" case, we ask before downloading though, in onCheckComplete. + this.checkForUpdates(); +} + +appUpdater.prototype = +{ + // true when there is an update check in progress. + isChecking: false, + + // true when there is an update already staged / ready to be applied. + get isPending() { + if (this.update) { + return this.update.state == "pending" || + this.update.state == "pending-service" || + this.update.state == "pending-elevate"; + } + return this.um.activeUpdate && + (this.um.activeUpdate.state == "pending" || + this.um.activeUpdate.state == "pending-service" || + this.um.activeUpdate.state == "pending-elevate"); + }, + + // true when there is an update already installed in the background. + get isApplied() { + if (this.update) + return this.update.state == "applied" || + this.update.state == "applied-service"; + return this.um.activeUpdate && + (this.um.activeUpdate.state == "applied" || + this.um.activeUpdate.state == "applied-service"); + }, + + // true when there is an update download in progress. + get isDownloading() { + if (this.update) + return this.update.state == "downloading"; + return this.um.activeUpdate && + this.um.activeUpdate.state == "downloading"; + }, + + // true when updating is disabled by an administrator. + get updateDisabledAndLocked() { + return !this.updateEnabled && + Services.prefs.prefIsLocked("app.update.enabled"); + }, + + // true when updating is enabled. + get updateEnabled() { + try { + return Services.prefs.getBoolPref("app.update.enabled"); + } + catch (e) { } + return true; // Firefox default is true + }, + + // true when updating in background is enabled. + get backgroundUpdateEnabled() { + return this.updateEnabled && + gAppUpdater.aus.canStageUpdates; + }, + + // true when updating is automatic. + get updateAuto() { + try { + return Services.prefs.getBoolPref("app.update.auto"); + } + catch (e) { } + return true; // Firefox default is true + }, + + /** + * Sets the panel of the updateDeck. + * + * @param aChildID + * The id of the deck's child to select, e.g. "apply". + */ + selectPanel: function(aChildID) { + let panel = document.getElementById(aChildID); + + let button = panel.querySelector("button"); + if (button) { + if (aChildID == "downloadAndInstall") { + let updateVersion = gAppUpdater.update.displayVersion; + button.label = this.bundle.formatStringFromName("update.downloadAndInstallButton.label", [updateVersion], 1); + button.accessKey = this.bundle.GetStringFromName("update.downloadAndInstallButton.accesskey"); + } + this.updateDeck.selectedPanel = panel; + if (!document.commandDispatcher.focusedElement || // don't steal the focus + document.commandDispatcher.focusedElement.localName == "button") // except from the other buttons + button.focus(); + + } else { + this.updateDeck.selectedPanel = panel; + } + }, + + /** + * Check for updates + */ + checkForUpdates: function() { + // Clear prefs that could prevent a user from discovering available updates. + if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_CANCELATIONS_OSX)) { + Services.prefs.clearUserPref(PREF_APP_UPDATE_CANCELATIONS_OSX); + } + if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_ELEVATE_NEVER)) { + Services.prefs.clearUserPref(PREF_APP_UPDATE_ELEVATE_NEVER); + } + this.selectPanel("checkingForUpdates"); + this.isChecking = true; + this.checker.checkForUpdates(this.updateCheckListener, true); + // after checking, onCheckComplete() is called + }, + + /** + * Handles oncommand for the "Restart to Update" button + * which is presented after the download has been downloaded. + */ + buttonRestartAfterDownload: function() { + if (!this.isPending && !this.isApplied) { + return; + } + + gAppUpdater.selectPanel("restarting"); + + // Notify all windows that an application quit has been requested. + let cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]. + createInstance(Components.interfaces.nsISupportsPRBool); + Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart"); + + // Something aborted the quit process. + if (cancelQuit.data) { + gAppUpdater.selectPanel("apply"); + return; + } + + let appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"]. + getService(Components.interfaces.nsIAppStartup); + + // If already in safe mode restart in safe mode (bug 327119) + if (Services.appinfo.inSafeMode) { + appStartup.restartInSafeMode(Components.interfaces.nsIAppStartup.eAttemptQuit); + return; + } + + appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit | + Components.interfaces.nsIAppStartup.eRestart); + }, + + /** + * Implements nsIUpdateCheckListener. The methods implemented by + * nsIUpdateCheckListener are in a different scope from nsIIncrementalDownload + * to make it clear which are used by each interface. + */ + updateCheckListener: { + /** + * See nsIUpdateService.idl + */ + onCheckComplete: function(aRequest, aUpdates, aUpdateCount) { + gAppUpdater.isChecking = false; + gAppUpdater.update = gAppUpdater.aus. + selectUpdate(aUpdates, aUpdates.length); + if (!gAppUpdater.update) { + gAppUpdater.selectPanel("noUpdatesFound"); + return; + } + + if (gAppUpdater.update.unsupported) { + if (gAppUpdater.update.detailsURL) { + let unsupportedLink = document.getElementById("unsupportedLink"); + unsupportedLink.href = gAppUpdater.update.detailsURL; + } + gAppUpdater.selectPanel("unsupportedSystem"); + return; + } + + if (!gAppUpdater.aus.canApplyUpdates) { + gAppUpdater.selectPanel("manualUpdate"); + return; + } + + if (gAppUpdater.updateAuto) // automatically download and install + gAppUpdater.startDownload(); + else // ask + gAppUpdater.selectPanel("downloadAndInstall"); + }, + + /** + * See nsIUpdateService.idl + */ + onError: function(aRequest, aUpdate) { + // Errors in the update check are treated as no updates found. If the + // update check fails repeatedly without a success the user will be + // notified with the normal app update user interface so this is safe. + gAppUpdater.isChecking = false; + gAppUpdater.selectPanel("noUpdatesFound"); + }, + + /** + * See nsISupports.idl + */ + QueryInterface: function(aIID) { + if (!aIID.equals(Components.interfaces.nsIUpdateCheckListener) && + !aIID.equals(Components.interfaces.nsISupports)) + throw Components.results.NS_ERROR_NO_INTERFACE; + return this; + } + }, + + /** + * Starts the download of an update mar. + */ + startDownload: function() { + if (!this.update) + this.update = this.um.activeUpdate; + this.update.QueryInterface(Components.interfaces.nsIWritablePropertyBag); + this.update.setProperty("foregroundDownload", "true"); + + this.aus.pauseDownload(); + let state = this.aus.downloadUpdate(this.update, false); + if (state == "failed") { + this.selectPanel("downloadFailed"); + return; + } + + this.setupDownloadingUI(); + }, + + /** + * Switches to the UI responsible for tracking the download. + */ + setupDownloadingUI: function() { + this.downloadStatus = document.getElementById("downloadStatus"); + this.downloadStatus.value = + DownloadUtils.getTransferTotal(0, this.update.selectedPatch.size); + this.selectPanel("downloading"); + this.aus.addDownloadListener(this); + }, + + removeDownloadListener: function() { + if (this.aus) { + this.aus.removeDownloadListener(this); + } + }, + + /** + * See nsIRequestObserver.idl + */ + onStartRequest: function(aRequest, aContext) { + }, + + /** + * See nsIRequestObserver.idl + */ + onStopRequest: function(aRequest, aContext, aStatusCode) { + switch (aStatusCode) { + case Components.results.NS_ERROR_UNEXPECTED: + if (this.update.selectedPatch.state == "download-failed" && + (this.update.isCompleteUpdate || this.update.patchCount != 2)) { + // Verification error of complete patch, informational text is held in + // the update object. + this.removeDownloadListener(); + this.selectPanel("downloadFailed"); + break; + } + // Verification failed for a partial patch, complete patch is now + // downloading so return early and do NOT remove the download listener! + break; + case Components.results.NS_BINDING_ABORTED: + // Do not remove UI listener since the user may resume downloading again. + break; + case Components.results.NS_OK: + this.removeDownloadListener(); + if (this.backgroundUpdateEnabled) { + this.selectPanel("applying"); + let self = this; + Services.obs.addObserver(function (aSubject, aTopic, aData) { + // Update the UI when the background updater is finished + let status = aData; + if (status == "applied" || status == "applied-service" || + status == "pending" || status == "pending-service" || + status == "pending-elevate") { + // If the update is successfully applied, or if the updater has + // fallen back to non-staged updates, show the "Restart to Update" + // button. + self.selectPanel("apply"); + } else if (status == "failed") { + // Background update has failed, let's show the UI responsible for + // prompting the user to update manually. + self.selectPanel("downloadFailed"); + } else if (status == "downloading") { + // We've fallen back to downloading the full update because the + // partial update failed to get staged in the background. + // Therefore we need to keep our observer. + self.setupDownloadingUI(); + return; + } + Services.obs.removeObserver(arguments.callee, "update-staged"); + }, "update-staged", false); + } else { + this.selectPanel("apply"); + } + break; + default: + this.removeDownloadListener(); + this.selectPanel("downloadFailed"); + break; + } + }, + + /** + * See nsIProgressEventSink.idl + */ + onStatus: function(aRequest, aContext, aStatus, aStatusArg) { + }, + + /** + * See nsIProgressEventSink.idl + */ + onProgress: function(aRequest, aContext, aProgress, aProgressMax) { + this.downloadStatus.value = + DownloadUtils.getTransferTotal(aProgress, aProgressMax); + }, + + /** + * See nsISupports.idl + */ + QueryInterface: function(aIID) { + if (!aIID.equals(Components.interfaces.nsIProgressEventSink) && + !aIID.equals(Components.interfaces.nsIRequestObserver) && + !aIID.equals(Components.interfaces.nsISupports)) + throw Components.results.NS_ERROR_NO_INTERFACE; + return this; + } +}; diff --git a/application/basilisk/base/content/aboutDialog.css b/application/basilisk/base/content/aboutDialog.css new file mode 100644 index 000000000..65830c8bb --- /dev/null +++ b/application/basilisk/base/content/aboutDialog.css @@ -0,0 +1,97 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#aboutDialog { + width: 620px; + /* Set an explicit line-height to avoid discrepancies in 'auto' spacing + across screens with different device DPI, which may cause font metrics + to round differently. */ + line-height: 1.5; +} + +#rightBox { + background-image: url("chrome://branding/content/about-wordmark.png"); + background-repeat: no-repeat; + /* padding-top creates room for the wordmark */ + padding-top: 38px; + margin-top:20px; +} + +#rightBox:-moz-locale-dir(rtl) { + background-position: 100% 0; +} + +#bottomBox { + padding: 15px 10px 0; +} + +#version { + font-weight: bold; + margin-top: 10px; + margin-left: 0; + -moz-user-select: text; + -moz-user-focus: normal; + cursor: text; +} + +#version:-moz-locale-dir(rtl) { + direction: ltr; + text-align: right; + margin-left: 5px; + margin-right: 0; +} + +#releasenotes { + margin-top: 10px; +} + +#distribution, +#distributionId { + display: none; + margin-top: 0; + margin-bottom: 0; +} + +.text-blurb { + margin-bottom: 10px; + margin-inline-start: 0; + padding-inline-start: 0; +} + +#updateButton, +#updateDeck > hbox > label { + margin-inline-start: 0; + padding-inline-start: 0; +} + +.update-throbber { + width: 16px; + min-height: 16px; + margin-inline-end: 3px; + list-style-image: url("chrome://global/skin/icons/loading.png"); +} + +@media (min-resolution: 1.1dppx) { + .update-throbber { + list-style-image: url("chrome://global/skin/icons/loading@2x.png"); + } +} + +description > .text-link, +description > .text-link:focus { + margin: 0px; + padding: 0px; +} + +.bottom-link, +.bottom-link:focus { + text-align: center; + margin: 0 40px; +} + +#currentChannel { + margin: 0; + padding: 0; + font-weight: bold; +} diff --git a/application/basilisk/base/content/aboutDialog.js b/application/basilisk/base/content/aboutDialog.js new file mode 100644 index 000000000..f9571621f --- /dev/null +++ b/application/basilisk/base/content/aboutDialog.js @@ -0,0 +1,91 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +// Services = object with smart getters for common XPCOM services +Components.utils.import("resource://gre/modules/Services.jsm"); +Components.utils.import("resource://gre/modules/AppConstants.jsm"); + +function init(aEvent) +{ + if (aEvent.target != document) + return; + + try { + var distroId = Services.prefs.getCharPref("distribution.id"); + if (distroId) { + var distroVersion = Services.prefs.getCharPref("distribution.version"); + + var distroIdField = document.getElementById("distributionId"); + distroIdField.value = distroId + " - " + distroVersion; + distroIdField.style.display = "block"; + + try { + // This is in its own try catch due to bug 895473 and bug 900925. + var distroAbout = Services.prefs.getComplexValue("distribution.about", + Components.interfaces.nsISupportsString); + var distroField = document.getElementById("distribution"); + distroField.value = distroAbout; + distroField.style.display = "block"; + } + catch (ex) { + // Pref is unset + Components.utils.reportError(ex); + } + } + } + catch (e) { + // Pref is unset + } + + // Include the build ID + let versionField = document.getElementById("version"); + let version = Services.appinfo.version; + let buildID = Services.appinfo.appBuildID; + let year = buildID.slice(0, 4); + let month = buildID.slice(4, 6); + let day = buildID.slice(6, 8); + let hour = buildID.slice(8, 10); + let minute = buildID.slice(10, 12); + if (Services.prefs.getBoolPref("general.useragent.appVersionIsBuildID")) { + versionField.textContent = `${year}.${month}.${day}`; + } else { + versionField.textContent = `v` + version + ` (${year}-${month}-${day})`; + } + + // Display warning if this is an "a#" (nightly or aurora) build + if (/a\d+$/.test(version)) { + document.getElementById("experimental").hidden = false; + document.getElementById("communityDesc").hidden = true; + } + + // Append "(32-bit)" or "(64-bit)" build architecture to the version number: + let bundle = Services.strings.createBundle("chrome://browser/locale/browser.properties"); + let archResource = Services.appinfo.is64Bit + ? "aboutDialog.architecture.sixtyFourBit" + : "aboutDialog.architecture.thirtyTwoBit"; + let arch = bundle.GetStringFromName(archResource); + versionField.textContent += ` (${arch})`; + + // Get Release Notes URL from Preferences + let releaseNotesURL = Services.prefs.getCharPref("app.releaseNotesURL"); + document.getElementById("releasenotes").setAttribute("href", releaseNotesURL); + + if (AppConstants.MOZ_UPDATER) { + gAppUpdater = new appUpdater(); + + let channelLabel = document.getElementById("currentChannel"); + let currentChannelText = document.getElementById("currentChannelText"); + channelLabel.value = UpdateUtils.UpdateChannel; + if (/^release($|\-)/.test(channelLabel.value)) + currentChannelText.hidden = true; + } + + if (AppConstants.platform == "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); + } +} diff --git a/application/basilisk/base/content/aboutDialog.xul b/application/basilisk/base/content/aboutDialog.xul new file mode 100644 index 000000000..5780e5ec1 --- /dev/null +++ b/application/basilisk/base/content/aboutDialog.xul @@ -0,0 +1,157 @@ + + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + + + + + + +%brandDTD; + +%aboutDialogDTD; +]> + +#ifdef XP_MACOSX + +#endif + + + + + + + + + + + + +
+
+

&generic.title;

+

&captivePortal.title;

+

&dnsNotFound.title;

+

&fileNotFound.title;

+

&fileAccessDenied.title;

+

&malformedURI.title;

+

&unknownProtocolFound.title;

+

&connectionFailure.title;

+

&netTimeout.title;

+

&redirectLoop.title;

+

&unknownSocketType.title;

+

&netReset.title;

+

¬Cached.title;

+

&netOffline.title;

+

&netInterrupt.title;

+

&deniedPortAccess.title;

+

&proxyResolveFailure.title;

+

&proxyConnectFailure.title;

+

&contentEncodingError.title;

+

&unsafeContentType.title;

+

&nssFailure2.title;

+

&certerror.longpagetitle1;

+

&cspBlocked.title;

+

&remoteXUL.title;

+

&corruptedContentErrorv2.title;

+

&sslv3Used.title;

+

&weakCryptoUsed.title;

+

&inadequateSecurityError.title;

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

+

+ + +
+ + +
+

+

+ + + + + +
+ + + +
+

&prefReset.longDesc;

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

+ + +

+
+ +
+
+
+

&weakCryptoAdvanced.longDesc;

+
+ + +
+

+ +

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

&robots.errorTitleText;

+
+ + +
+ + +
+

&robots.errorShortDescText;

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

&robots.errorTrailerDescText;

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

&tabCrashed.header2;

+
+ +
+

&tabCrashed.offerHelp;

+

&tabCrashed.single.offerHelpMessage;

+

&tabCrashed.multiple.offerHelpMessage;

+
+ +
+

&tabCrashed.requestHelp;

+

&tabCrashed.requestHelpMessage;

+ +

&tabCrashed.requestReport;

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

&tabCrashed.reportSent;

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

&safeb.blocked.phishingPage.title2;

+

&safeb.blocked.malwarePage.title;

+

&safeb.blocked.unwantedPage.title;

+
+ +
+ + +
+

&safeb.blocked.phishingPage.shortDesc2;

+

&safeb.blocked.malwarePage.shortDesc;

+

&safeb.blocked.unwantedPage.shortDesc;

+
+ + +
+

&safeb.blocked.phishingPage.longDesc2;

+

&safeb.blocked.malwarePage.longDesc;

+

&safeb.blocked.unwantedPage.longDesc;

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